diff --git a/spaces/1acneusushi/gradio-2dmoleculeeditor/data/Buku Matematika Kelas 6.pdf.md b/spaces/1acneusushi/gradio-2dmoleculeeditor/data/Buku Matematika Kelas 6.pdf.md deleted file mode 100644 index 393655806971ffb8128a09bf71c780c37506651e..0000000000000000000000000000000000000000 --- a/spaces/1acneusushi/gradio-2dmoleculeeditor/data/Buku Matematika Kelas 6.pdf.md +++ /dev/null @@ -1,101 +0,0 @@ - -
- H2: The Content of Buku Matematika Kelas 6.pdf
- H2: The Benefits of Buku Matematika Kelas 6.pdf
- H2: How to Download Buku Matematika Kelas 6.pdf
- Conclusion: A summary of the main points and a call to action
- FAQs: Some common questions and answers about Buku Matematika Kelas 6.pdf | # Article with HTML formatting

Buku Matematika Kelas 6.pdf: A Guide for Students and Teachers

-

If you are a student or a teacher of grade 6 mathematics in Indonesia, you might have heard of Buku Matematika Kelas 6.pdf. This is a book that follows the curriculum of 2013 and has been revised in 2018 by the Ministry of Education and Culture. It is a book that covers various topics and skills in mathematics, such as negative integers, mixed operations, circles, prisms, pyramids, cones, spheres, and data analysis. In this article, we will explain what Buku Matematika Kelas 6.pdf is, what it contains, what its benefits are, and how you can download it for free.

-

Buku Matematika Kelas 6.pdf


DOWNLOAD 🆓 https://byltly.com/2uKzSr



-

The Content of Buku Matematika Kelas 6.pdf

-

Buku Matematika Kelas 6.pdf consists of two parts: a book for students and a book for teachers. The book for students is called Buku Siswa and the book for teachers is called Buku Guru. Both books are available in PDF format and can be easily opened and read using various gadgets. They can also be displayed as slide presentations.

-

The book for students has eight chapters that correspond to the eight competencies that are expected from grade 6 students. Each chapter has several subtopics that are explained in detail with examples, exercises, tasks, and activities. The book also features some interesting sections, such as observing, reasoning, questioning, knowing the figures, practice questions, group assignments, and others. These sections are designed to help students develop their scientific skills, higher-order thinking skills, problem-based learning skills, literacy skills, and connection skills.

-

The book for teachers is a guide and a reference for teachers in teaching mathematics, especially in grade 6 elementary school or madrasah ibtidaiyah. The book provides some tips and suggestions on how to plan, implement, and evaluate the learning process using Buku Siswa. The book also explains the learning objectives, indicators, materials, methods, media, resources, assessment tools, and feedback for each subtopic.

-

The Benefits of Buku Matematika Kelas 6.pdf

-

Buku Matematika Kelas 6.pdf has many benefits for both students and teachers. Some of the benefits are:

- -

How to Download Buku Matematika Kelas 6.pdf

-

If you are interested in using Buku Matematika Kelas 6.pdf for your learning or teaching purposes, you can download it from the following links:

- - - - - - - - - - - - - - - - - -
BookLink
Buku Siswahttps://www.pendidikanterkini.com/2021/05/buku-matematika-kelas-6-k13.html
Buku Guruhttps://www.pendidikanterkini.com/2021/05/buku-matematika-kelas-6-k13.html
Buku Siswa dan Buku Guru (zip file)https://www.ayomadrasah.id/2020/01/download-buku-matematika-kelas-6-k13.html
-

After downloading the files, you can open them using any PDF reader software or application. You can also print them if you prefer to have a hard copy.

-

Conclusion

-

Buku Matematika Kelas 6.pdf is a valuable resource for students and teachers of grade 6 mathematics in Indonesia. It follows the curriculum of 2013 that has been revised in 2018 by the Ministry of Education and Culture. It covers various topics and skills in mathematics in a comprehensive, engaging, interactive, relevant, and contextual way. It also provides enough exercises and tasks to practice and reinforce the concepts. Moreover, it can be downloaded easily from the internet without any cost.

-

If you want to improve your mathematics knowledge and skills or help your students do so, you should consider using Buku Matematika Kelas 6.pdf as your learning or teaching material. You will not regret it!

-

Download Buku Matematika Kelas 6 Kurikulum 2013 pdf
-Buku Matematika Kelas 6 Semester 1 dan 2 pdf
-Buku Matematika Kelas 6 SD/MI pdf
-Buku Matematika Kelas 6 Edisi Revisi 2018 pdf
-Buku Matematika Kelas 6 Penerbit Erlangga pdf
-Buku Matematika Kelas 6 Penerbit Esis pdf
-Buku Matematika Kelas 6 Penerbit Yudhistira pdf
-Buku Matematika Kelas 6 Penerbit Intan Pariwara pdf
-Buku Matematika Kelas 6 Penerbit Ganeca Exact pdf
-Buku Matematika Kelas 6 Penerbit Quadra pdf
-Buku Matematika Kelas 6 Tema 1 Hidup Rukun pdf
-Buku Matematika Kelas 6 Tema 2 Selalu Berhemat Energi pdf
-Buku Matematika Kelas 6 Tema 3 Cita-Citaku pdf
-Buku Matematika Kelas 6 Tema 4 Peduli Terhadap Makhluk Hidup pdf
-Buku Matematika Kelas 6 Tema 5 Bangga Sebagai Bangsa Indonesia pdf
-Buku Matematika Kelas 6 Tema 6 Kesehatan dan Olahraga pdf
-Buku Matematika Kelas 6 Tema 7 Permainan Tradisional pdf
-Buku Matematika Kelas 6 Tema 8 Lingkungan Sahabat Kita pdf
-Buku Matematika Kelas 6 Tema 9 Makanan Sehat dan Bergizi pdf
-Buku Matematika Kelas 6 Tema 10 Peristiwa dalam Kehidupan pdf
-Ringkasan Materi Buku Matematika Kelas 6 pdf
-Soal dan Pembahasan Buku Matematika Kelas 6 pdf
-Latihan Ulangan Harian Buku Matematika Kelas 6 pdf
-Latihan Ulangan Tengah Semester Buku Matematika Kelas 6 pdf
-Latihan Ulangan Akhir Semester Buku Matematika Kelas 6 pdf
-Latihan Ujian Sekolah Berstandar Nasional (USBN) Buku Matematika Kelas 6 pdf
-Latihan Ujian Nasional Berbasis Komputer (UNBK) Buku Matematika Kelas 6 pdf
-Kunci Jawaban Buku Matematika Kelas 6 pdf
-RPP dan Silabus Buku Matematika Kelas 6 pdf
-Lembar Kerja Siswa (LKS) Buku Matematika Kelas 6 pdf
-Modul Pembelajaran Jarak Jauh (PJJ) Buku Matematika Kelas 6 pdf
-Video Pembelajaran Interaktif (VPI) Buku Matematika Kelas 6 pdf
-Media Pembelajaran Digital (MPD) Buku Matematika Kelas 6 pdf
-Evaluasi Diri dan Remedial (EDR) Buku Matematika Kelas 6 pdf
-Penilaian Kinerja dan Portofolio (PKP) Buku Matematika Kelas 6 pdf
-Penilaian HOTS (Higher Order Thinking Skills) Buku Matematika Kelas 6 pdf
-Penilaian Afektif dan Psikomotorik (PAP) Buku Matematika Kelas 6 pdf
-Penilaian Autentik dan Holistik (PAH) Buku Matematika Kelas 6 pdf
-Penilaian Berbasis Kompetensi (PBK) Buku Matematika Kelas 6 pdf
-Penilaian Berbasis Proyek (PBP) Buku Matematika Kelas 6 pdf
-Penilaian Berbasis Kinerja (PBK) Buku Matematika Kelas 6 pdf
-Penilaian Berbasis Portofolio (PBP) Buku Matematika Kelas 6 pdf
-Penilaian Berbasis Produk (PBP) Buku Matematika Kelas 6 pdf
-Penilaian Berbasis Proses (PBP) Buku Matematika Kelas 6 pdf
-Penilaian Berbasis Kemampuan Berpikir Kritis (PBKBK) Buku Matematika Kelas 6 pdf
-Penilaian Berbasis Kemampuan Berpikir Kreatif (PBKBK) Buku Matematika Kelas 6 pdf
-Penilaian Berbasis Kemampuan Memecahkan Masalah (PBKMM) Buku Matematika Kelas 6 pdf
-Penilaian Berbasis Kemampuan Komunikasi Efektif (PBKKE) Buku Matematika Kelas

-

FAQs

-

Here are some common questions and answers about Buku Matematika Kelas 6.pdf:

-
    -
  1. What is Buku Matematika Kelas 6.pdf?
    Buku Matematika Kelas 6.pdf is a book that follows the curriculum of 2013 and has been revised in 2018 by the Ministry of Education and Culture. It is a book that covers various topics and skills in mathematics for grade 6 students in Indonesia.
  2. -
  3. What are the two parts of Buku Matematika Kelas 6.pdf?
    Buku Matematika Kelas 6.pdf consists of two parts: a book for students (Buku Siswa) and a book for teachers (Buku Guru). Both books are available in PDF format.
  4. -
  5. What are some of the benefits of Buku Matematika Kelas 6.pdf?
    Buku Matematika Kelas 6.pdf has many benefits for both students and teachers. Some of them are: it is aligned with the latest curriculum; it is comprehensive and thorough; it is engaging and interactive; it is relevant and contextual; it is accessible and free.
  6. -
  7. How can I download Buku Matematika Kelas 6.pdf?
    You can download Buku Matematika Kelas 6.pdf from several links on the internet. Some of them are provided in this article.
  8. -
  9. How can I use Buku Matematika Kelas 6.pdf?
    You can use Buku Matematika Kelas 6.pdf as your learning or teaching material for grade 6 mathematics. You can open it using any PDF reader software or application. You can also print it if you prefer to have a hard copy.
  10. -
-

0a6ba089eb
-
-
\ No newline at end of file diff --git a/spaces/1acneusushi/gradio-2dmoleculeeditor/data/Descargar Crack Memories On Tv 4.1.1 32l Crez des albums photo pour votre TV ou votre ordinateur.md b/spaces/1acneusushi/gradio-2dmoleculeeditor/data/Descargar Crack Memories On Tv 4.1.1 32l Crez des albums photo pour votre TV ou votre ordinateur.md deleted file mode 100644 index cf5f0fd9ee3483c0d775e77384e97321b0c1fb38..0000000000000000000000000000000000000000 --- a/spaces/1acneusushi/gradio-2dmoleculeeditor/data/Descargar Crack Memories On Tv 4.1.1 32l Crez des albums photo pour votre TV ou votre ordinateur.md +++ /dev/null @@ -1,149 +0,0 @@ -
-

Descargar Crack Memories On Tv 4.1.1 32l

-

Do you want to turn your photos and videos into amazing slideshows that you can watch on your TV or share online? Do you want to do it easily and quickly, without spending a lot of money or time? If so, then you need Memories On TV, a powerful and user-friendly software that lets you create stunning slideshows with just a few clicks. And if you want to unlock all the features and benefits of this software, then you need Crack Memories On Tv 4.1.1 32l, a simple and effective tool that will activate your copy of Memories On TV for free.

-

Descargar Crack Memories On Tv 4.1.1 32l


Download ★★★ https://byltly.com/2uKwWy



-

In this article, we will tell you everything you need to know about Memories On TV and Crack Memories On Tv 4.1.1 32l, including what they are, how they work, how to download and install them, and how to use them to create amazing slideshows that will impress your friends and family.

-

What is Memories On TV?

-

Memories On TV is a software program that allows you to create photo/video slideshows that you can watch on your TV or computer, or share online via YouTube, Facebook, or email. You can use it to make slideshows for weddings, birthdays, anniversaries, vacations, or any other occasion that you want to remember and celebrate.

-

Features and benefits of Memories On TV

-

Some of the features and benefits of Memories On TV are:

- -

How to download and install Memories On TV 4.1.1

-

To download and install Memories On TV 4.1.1 on your computer, follow these steps:

-
    -
  1. Go to this website and click on the Download button.
  2. -
  3. Save the file MOTVSetup.exe on your computer.
  4. -
  5. Double-click on the file MOTVSetup.exe and follow the instructions on the screen.
  6. -
  7. Select the language of your choice and click on Next.
  8. -
  9. Read the license agreement and click on I Agree.
  10. -
  11. Select the destination folder where you want to install Memories On TV and click on Next.
  12. -
  13. Select the components that you want to install and click on Next.
  14. -
  15. Select the start menu folder where you want to create shortcuts for Memories On TV and click on Next.
  16. -
  17. Select whether you want to create a desktop icon for Memories On TV and click on Next.
  18. -
  19. Click on Install to start the installation process.
  20. -
  21. Wait for the installation process to finish and click on Finish.
  22. -
-

What is Crack Memories On Tv 4.1.1 32l?

-

Crack Memories On Tv 4.1.1 32l is a small program that can activate your copy of Memories On TV for free. It works by generating a valid serial number that can unlock all the features and benefits of Memories On TV without paying anything.

-

Why do you need Crack Memories On Tv 4.1.1 32l?

-

You need Crack Memories On Tv 4.1.1 32l if you want to enjoy all the advantages of Memories On TV without spending any money or time. With Crack Memories On Tv 4.1.1 32l, you can:

- -

How to download and use Crack Memories On Tv 4.1.1 32l?

-

To download and use Crack Memories On Tv 4.1.1 32l on your computer, follow these steps:

-
    -
  1. Go to this websiteand click on the MORE button.
  2. -
  3. Select Dowload file.
  4. -
  5. Select a location where you want save it on your computer.
  6. -
  7. The file name is CMTV41132L.zip. Extract it using WinRAR or any other program that can unzip files.
  8. -
  9. You will see two files: CMTV41132L.exe, which is the crack program;and CMTV41132L.txt, which contains instructions on how use it.
  10. -
  11. To use Crack Memories On Tv 4.1.1 32l , first make sure that MemorysOnTV is not running on your computer . Then double-click on CMTV41132L.exe . A window will open asking for a serial number . Copy one of serial numbers from CMTV41132L.txt file . Paste it into window . Click OK . A message will appear saying that MemorysOnTV has been activated successfully . Click OK again . Close window .
  12. -
  13. You can now run MemorysOnTV normally . You will see that all features are unlocked . You can create , edit , burn , export , share unlimited slide shows with no problem . Enjoy !
  14. -
-

Tips and tricks for using Memories On TV and Crack Memories On Tv 4.1.1 32l

-

Now that you have downloaded and installed Memories On TV and Crack Memories On Tv 4.1.1 32l, you can start creating amazing slideshows with your photos and videos. Here are some tips and tricks that will help you make the most out of these tools:

-

How to create stunning slideshows with Memories On TV

-

To create a slideshow with Memories On TV, follow these steps:

-

Download Crack Memories On Tv 4.1.1 32l Full Version
-How to Crack Memories On Tv 4.1.1 32l for Free
-Memories On Tv 4.1.1 32l Crack Serial Keygen
-Memories On Tv 4.1.1 32l Crack Patch Download
-Memories On Tv 4.1.1 32l Crack License Key Activation
-Memories On Tv 4.1.1 32l Crack Torrent Magnet Link
-Memories On Tv 4.1.1 32l Crack No Survey No Password
-Memories On Tv 4.1.1 32l Crack Online Generator
-Memories On Tv 4.1.1 32l Crack Working Tested
-Memories On Tv 4.1.1 32l Crack Latest Update
-Descargar Gratis Crack Memories On Tv 4.1.1 32l Español
-Descargar Crack Memories On Tv 4.1.1 32l Mega Mediafire
-Descargar Crack Memories On Tv 4.1.1 32l Sin Virus
-Descargar Crack Memories On Tv 4.1.1 32l Facil Rapido
-Descargar Crack Memories On Tv 4.1.1 32l Windows Mac Linux
-Descargar Crack Memories On Tv 4.1.1 32l Portable USB
-Descargar Crack Memories On Tv 4.1.1 32l Ultima Version
-Descargar Crack Memories On Tv 4.1.1 32l Premium Pro
-Descargar Crack Memories On Tv 4.1.1 32l Mod Apk Android
-Descargar Crack Memories On Tv 4.1.1 32l Full HD Quality
-Download Free Crack Memories On Tv 4.1.1 32l English
-Download Crack Memories On Tv 4.1.1 32l Google Drive Dropbox
-Download Crack Memories On Tv 4.1.1 32l Without Virus
-Download Crack Memories On Tv 4.1.1 32l Easy Fast
-Download Crack Memories On Tv 4.1.1 32l Windows Mac Linux
-Download Crack Memories On Tv 4.1.1 32l Portable USB
-Download Crack Memories On Tv 4.1.1 32l Latest Version
-Download Crack Memories On Tv 4.1.1 32l Premium Pro
-Download Crack Memories On Tv 4.1.1 32l Mod Apk Android
-Download Crack Memories On Tv 4.1.1 32l Full HD Quality
-Télécharger Gratuitement Crack Memories On Tv 4.1.1 French
-Télécharger Crack Memories On Tv

-
    -
  1. Launch Memories On TV and click on New Project.
  2. -
  3. Select the folder where your photos and videos are stored and click on OK.
  4. -
  5. Drag and drop your photos and videos to the timeline at the bottom of the screen.
  6. -
  7. Arrange them in the order that you want them to appear in your slideshow.
  8. -
  9. To add captions, titles, credits, or logos to your slides, click on the Text button on the toolbar and select the type of text that you want to add.
  10. -
  11. To adjust the brightness, contrast, color, or orientation of your photos, click on the Edit button on the toolbar and select the option that you want to apply.
  12. -
  13. To crop, rotate, zoom, pan, or flip your photos and videos, click on the Transform button on the toolbar and select the option that you want to apply.
  14. -
  15. To apply effects and filters to your photos and videos, click on the Effects button on the toolbar and select the effect or filter that you want to apply.
  16. -
  17. To add background music and sound effects to your slideshow, click on the Audio button on the toolbar and select the option that you want to add.
  18. -
  19. To synchronize the music and the images according to the beat or the duration, click on the Sync button on the toolbar and select the option that you want to use.
  20. -
  21. To add transitions between the slides, click on the Transitions button on the toolbar and select the transition that you want to use.
  22. -
  23. To preview your slideshow before burning it or exporting it, click on the Preview button on the toolbar and watch your slideshow on the screen.
  24. -
-

How to add effects, music, and transitions to your slideshows

-

One of the best features of Memories On TV is that it allows you to add various effects, music, and transitions to your slideshows. Here are some tips on how to use them effectively:

- -

How to burn your slideshows to DVD or share them online

-

After creating your slideshow with Memories On TV , you can burn it to DVD or CD with a built-in menu system , or export it as video file that can be played on any device or platform . You can also share it online via YouTube , Facebook , or email . Here are some tips on how to do it :

- -

Conclusion

-

In conclusion , Memories On TV is a great software program that allows you create photo/video slideshows that you can watch on your TV or computer , or share online via YouTube , Facebook , or email . You can use it make slideshows for weddings , birthdays , anniversaries , vacations , or any other occasion that you want remember celebrate . And with Crack Memories On Tv 4.1.1 32l , you can activate your copy of Memories On TV for free unlock all features benefits of this software without paying anything .

-

Summary of main points

-

In this article , we have told everything need know about Memories On TV Crack Memories On Tv 4.1.1 32l , including what they are how they work how download install them how use them create amazing slideshows that will impress friends family . We have also given some tips tricks that will help make most out these tools .

-

Call action

-

If want try Memories On TV Crack Memories On Tv 4.1.1 32l yourself see how easy fun it is create stunning slideshows with photos videos , then don't wait any longer download them now from links provided in this article follow instructions given in this article start creating slideshows today ! You won't regret it !

-

Frequently Asked Questions (FAQs)

-

Here are some frequently asked questions (FAQs) about Memories On TV and Crack Memories On Tv 4.1.1 32l:

-
    -
  1. Is Memories On TV safe to download and install?
    -Yes, Memories On TV is safe to download and install. It does not contain any viruses, malware, spyware, or adware. It does not harm your computer or compromise your privacy.
  2. -
  3. Is Crack Memories On Tv 4.1.1 32l safe to download and use?
    -Yes, Crack Memories On Tv 4.1.1 32l is safe to download and use. It does not contain any viruses, malware, spyware, or adware. It does not harm your computer or compromise your privacy. It only activates your copy of Memories On TV for free.
  4. -
  5. Does Crack Memories On Tv 4.1.1 32l work with any version of Memories On TV?
    -No, Crack Memories On Tv 4.1.1 32l only works with Memories On TV 4.1.1. If you have a different version of Memories On TV, you need to find a different crack program that matches your version.
  6. -
  7. Does Crack Memories On Tv 4.1.1 32l work with any operating system?
    -Yes, Crack Memories On Tv 4.1.1 32l works with any operating system that supports Memories On TV, such as Windows XP, Windows Vista, Windows 7, Windows 8, Windows 10, etc.
  8. -
  9. Does Crack Memories On Tv 4.1.1 32l affect the quality or performance of Memories On TV?
    -No, Crack Memories On Tv 4.1.1 32l does not affect the quality or performance of Memories On TV. It only unlocks all the features and benefits of Memories On TV without paying anything.
  10. -
-

0a6ba089eb
-
-
\ No newline at end of file diff --git a/spaces/1acneusushi/gradio-2dmoleculeeditor/data/Download Memoriesontv 4 Crack Serial 11 with Keygen [Working Tested].md b/spaces/1acneusushi/gradio-2dmoleculeeditor/data/Download Memoriesontv 4 Crack Serial 11 with Keygen [Working Tested].md deleted file mode 100644 index e48e317bd14b61ebad2f256d50f5c7334618aeab..0000000000000000000000000000000000000000 --- a/spaces/1acneusushi/gradio-2dmoleculeeditor/data/Download Memoriesontv 4 Crack Serial 11 with Keygen [Working Tested].md +++ /dev/null @@ -1,85 +0,0 @@ - -

Memoriesontv 4 Crack Serial 11: What You Need to Know

-

If you are looking for a way to create stunning slideshows from your photos and videos, you might have heard of Memoriesontv. This software allows you to add effects, transitions, music, captions, and more to your slideshows and burn them to DVD or share them online. However, Memoriesontv is not a free software, and you need to pay for a license key to use it without limitations. That's why some people resort to using crack serials to unlock the full features of Memoriesontv without paying. In this article, we will explain what Memoriesontv 4 Crack Serial 11 is, how to get it, what are the risks and drawbacks of using it, and what are some alternatives to using it.

-

Introduction

-

What is Memoriesontv?

-

Memoriesontv is a software developed by CodeJam Pte Ltd that allows you to create professional-looking slideshows from your photos and videos. You can import your media files from your computer, camera, scanner, or other devices, and organize them into albums. You can then customize your slideshows by adding effects, transitions, music, captions, clipart, and more. You can also edit your photos and videos with basic tools such as crop, rotate, resize, color correction, red-eye removal, etc. Once you are done with your slideshow creation, you can preview it on your computer screen or TV. You can also burn it to DVD or CD with a built-in disc menu creator. Alternatively, you can export it as a video file or upload it to YouTube or Facebook directly from the software.

-

Memoriesontv 4 Crack Serial 11


DOWNLOAD ::: https://byltly.com/2uKxHU



-

What is a crack serial?

-

A crack serial is a code that is used to bypass the registration or activation process of a software. It is usually generated by hackers or crackers who modify the original software code to remove or disable the protection mechanisms that prevent unauthorized use. A crack serial can be entered into the software interface or applied as a patch file that modifies the software executable file. By using a crack serial, you can access the full features of a software without paying for a license key.

-

Why do people use crack serials for Memoriesontv?

-

Some people use crack serials for Memoriesontv because they want to save money and avoid paying for a license key. The official price of Memoriesontv is $59.99 for the Pro edition and $39.99 for the Standard edition. Some people might find this price too expensive or unreasonable for a slideshow software. They might also think that they will only use the software once or twice and not need it anymore. Therefore, they look for ways to get the software for free or at a lower cost.

-

Memoriesontv 4 full version with keygen download
-How to activate Memoriesontv 4 using serial number
-Memoriesontv 4 cracked software free download
-Memoriesontv 4 license key generator online
-Memoriesontv 4 patch for windows 11
-Memoriesontv 4 registration code and email
-Memoriesontv 4 torrent download with crack
-Memoriesontv 4 activation key 2023
-Memoriesontv 4 serial key list
-Memoriesontv 4 crack only download
-Memoriesontv 4 product key finder
-Memoriesontv 4 crack for mac os
-Memoriesontv 4 keygen.exe download
-Memoriesontv 4 crack file download
-Memoriesontv 4 serial number verification
-Memoriesontv 4 crack reddit
-Memoriesontv 4 keygen online
-Memoriesontv 4 crack no survey
-Memoriesontv 4 serial key free download
-Memoriesontv 4 crack latest version
-Memoriesontv 4 activation code generator
-Memoriesontv 4 crack zip file download
-Memoriesontv 4 serial number generator
-Memoriesontv 4 crack for windows 10
-Memoriesontv 4 keygen download free
-Memoriesontv 4 crack and keygen download
-Memoriesontv 4 serial number and activation code
-Memoriesontv 4 crack for pc download
-Memoriesontv 4 keygen and patch download
-Memoriesontv 4 crack without serial number
-Memoriesontv 4 serial key generator online
-Memoriesontv 4 crack direct download link
-Memoriesontv 4 serial number free download
-Memoriesontv 4 crack for linux
-Memoriesontv 4 keygen and crack download
-Memoriesontv 4 serial number and email address
-Memoriesontv 4 crack for android download
-Memoriesontv 4 keygen and serial number download
-Memoriesontv 4 crack with serial key download
-Memoriesontv 4 activation code free download
-Memoriesontv 4 crack rar file download
-Memoriesontv 4 serial number and license key
-Memoriesontv 4 crack for ios download
-Memoriesontv 4 keygen and activation code download
-Memoriesontv 4 crack with license key download
-Memoriesontv 4 activation code and email address

-

How to get Memoriesontv 4 Crack Serial 11

-

Download from official website

-

The first option to get Memoriesontv 4 Crack Serial 11 is to download it from the official website of CodeJam Pte Ltd. The website offers a free trial version of Memoriesontv that you can download and install on your computer. The trial version has some limitations such as watermarking your slideshows, limiting the number of photos per album, and restricting some features such as DVD burning and video exporting. However, you can unlock these limitations by entering a crack serial that you can find on various websites on the internet. Some examples of websites that provide crack serials for Memoriesontv are Smart Serials, KeyGenNinja, and SerialBay. These websites claim to offer valid and working crack serials for various versions of Memoriesontv, including version 4.

-

Download from third-party websites

-

The second option to get Memoriesontv 4 Crack Serial 11 is to download it from third-party websites that host cracked versions of the software. These websites offer direct downloads of Memoriesontv that have been modified or patched by hackers or crackers to bypass the registration or activation process. You do not need to enter any crack serial or apply any patch file when you install these cracked versions of Memoriesontv. Some examples of websites that offer cracked versions of Memoriesontv are Softpedia, Softonic, and FileHippo. These websites claim to offer safe and virus-free downloads of Memoriesontv that have been tested by their editors or users.

-

Download from keygen or generator

-

The third option to get Memoriesontv 4 Crack Serial 11 is to download it from a keygen or generator program that can create crack serials for various software products. A keygen or generator is a software tool that can generate random codes that match the algorithm or pattern of a specific software license key. You can download these programs from various websites on the internet and run them on your computer. Some examples of websites that offer keygen or generator programs for Memoriesontv are YouTube, Praxis Benefits, and SoundCloud. These websites claim to offer working and verified keygen or generator programs for Memoriesontv that can produce valid and unlimited crack serials.

-

Risks and drawbacks of using Memoriesontv 4 Crack Serial 11

-

Legal issues

-

One of the main risks of using Memoriesontv 4 Crack Serial 11 is that it is illegal and unethical. By using a crack serial, you are violating the terms and conditions of CodeJam Pte Ltd and infringing their intellectual property rights. You are also depriving them of their rightful revenue and profit from their software product. This could result in legal consequences such as fines, lawsuits, or even criminal charges if you are caught using or distributing crack serials for Memoriesontv.

-

Malware and viruses

-

Another risk of using Memoriesontv 4 Crack Serial 11 is that it could expose your computer to malware and viruses. Since crack serials are generated by hackers or crackers who have malicious intentions, they could embed harmful code into the crack serial itself or into the software executable file that they modify or patch. This could compromise your computer security and privacy by installing spyware, ransomware, trojans, worms, keyloggers with an internet connection. The main drawback is that they might require an account or subscription to use some features or remove watermarks.

-

Conclusion

-

Memoriesontv 4 Crack Serial 11 is a code that can unlock the full features of Memoriesontv, a software that allows you to create slideshows from your photos and videos. However, using a crack serial is illegal, unethical, risky, and not recommended. You could face legal issues, malware and viruses, performance and quality issues, and other problems by using a crack serial. Therefore, it is better to use alternatives to using Memoriesontv 4 Crack Serial 11, such as buying a licensed version of Memoriesontv, using a free or open-source slideshow software, or using an online slideshow maker. These alternatives are safer, legal, and more reliable than using a crack serial.

-

FAQs

-

What is the difference between Memoriesontv Pro and Standard editions?

-

The Pro edition of Memoriesontv has more features than the Standard edition, such as video support, clipart library, disc menu creation, video export options, and more. The Pro edition also costs more than the Standard edition ($59.99 vs $39.99).

-

How can I get technical support or customer service from CodeJam Pte Ltd?

-

You can get technical support or customer service from CodeJam Pte Ltd by visiting their website and clicking on the Support tab. You can also email them at support@codejam.com or call them at +65 6220 8837.

-

What are some examples of free or open-source slideshow software?

-

Some examples of free or open-source slideshow software are LibreOffice Impress, OpenOffice Impress, Google Slides, and Zoho Show. These software allow you to create and edit slideshows from your photos and videos with various effects, transitions, music, captions, and more.

-

What are some examples of online slideshow makers?

-

Some examples of online slideshow makers are Canva, Prezi, Powtoon, and Visme. These online tools allow you to choose from hundreds of templates, themes, and styles for your slideshows. You can also add effects, transitions, music, captions, and more to your slideshows with drag-and-drop features.

-

What are some advantages and disadvantages of using Memoriesontv?

-

Some advantages of using Memoriesontv are that it allows you to create professional-looking slideshows from your photos and videos with various effects, transitions, music, captions, and more. It also allows you to burn your slideshows to DVD or CD with a built-in disc menu creator or export them as video files or upload them to YouTube or Facebook directly from the software. Some disadvantages of using Memoriesontv are that it is not a free software and requires a license key to use it without limitations. It also might not have as many templates or options as some other slideshow software or online tools.

-

0a6ba089eb
-
-
\ No newline at end of file diff --git a/spaces/1pelhydcardo/ChatGPT-prompt-generator/assets/Descargar Extreme Car Driving Simulator APK Un juego de conduccin realista y divertido.md b/spaces/1pelhydcardo/ChatGPT-prompt-generator/assets/Descargar Extreme Car Driving Simulator APK Un juego de conduccin realista y divertido.md deleted file mode 100644 index b0d7256f1666ef9168265f6eedadf58d012c1fd7..0000000000000000000000000000000000000000 --- a/spaces/1pelhydcardo/ChatGPT-prompt-generator/assets/Descargar Extreme Car Driving Simulator APK Un juego de conduccin realista y divertido.md +++ /dev/null @@ -1,122 +0,0 @@ - -

Extreme Car Driving Simulator: A Realistic and Fun Driving Game for Android

-

Do you love driving cars? Do you want to experience the thrill of driving in a realistic and open world environment? If yes, then you should try Extreme Car Driving Simulator, a popular and exciting driving game for Android devices. In this game, you can drive various cars with different features and performance, and enjoy the realistic physics and car damage effects. You can also explore a large and detailed city with traffic, ramps, obstacles, and more. Whether you want to drive fast, drift, or crash your car, Extreme Car Driving Simulator will give you the freedom and fun you are looking for.

-

extreme car driving simulator descargar apk


Download Zip 🆓 https://urlin.us/2uSScA



-

What is Extreme Car Driving Simulator?

-

Extreme Car Driving Simulator is a driving game developed by AxesInMotion Racing, a studio that specializes in creating realistic and immersive car games. The game was released in 2015 and has since gained over 100 million downloads on Google Play Store. It is one of the best-rated driving games on the platform, with an average rating of 4.3 out of 5 stars.

-

Features of Extreme Car Driving Simulator

-

Extreme Car Driving Simulator has many features that make it stand out from other driving games. Here are some of them:

-

Drive with traffic

-

You can choose to drive with traffic or without traffic in the game. Driving with traffic will make the game more challenging and realistic, as you will have to avoid collisions and follow the traffic rules. You can also honk your horn, flash your lights, and use your indicators to communicate with other drivers.

-

Full real HUD

-

The game has a full real HUD that shows you important information such as your speed, gear, revs, and fuel level. You can also see the status of your ABS, TC, and ESP systems, which you can turn on or off depending on your preference.

-

ABS, TC and ESP simulation

-

The game simulates the anti-lock braking system (ABS), traction control (TC), and electronic stability program (ESP) of real cars. These systems help you control your car better and prevent skidding, spinning, or losing control. You can also turn them off if you want to test your driving skills without any assistance.

-

Explore a detailed open world environment

-

The game has a large and detailed open world environment that you can explore freely. You can drive around the city, which has various buildings, roads, bridges, tunnels, and landmarks. You can also find ramps, loops, obstacles, and other elements that you can use to perform stunts and tricks. The game also has different weather conditions and time of day effects that add to the realism and variety of the game.

-

extreme car driving simulator 2023 descargar apk
-extreme car driving simulator mod apk descargar gratis
-extreme car driving simulator hack apk descargar
-extreme car driving simulator 2 descargar apk
-extreme car driving simulator 3d descargar apk
-extreme car driving simulator apk descargar ultima version
-extreme car driving simulator apk descargar para pc
-extreme car driving simulator apk descargar android
-extreme car driving simulator apk descargar uptodown
-extreme car driving simulator apk descargar mega
-extreme car driving simulator pro apk descargar
-extreme car driving simulator full apk descargar
-extreme car driving simulator premium apk descargar
-extreme car driving simulator unlimited money apk descargar
-extreme car driving simulator offline apk descargar
-extreme car driving simulator online apk descargar
-extreme car driving simulator real physics engine apk descargar
-extreme car driving simulator free roam apk descargar
-extreme car driving simulator open world apk descargar
-extreme car driving simulator city drive apk descargar
-extreme car driving simulator drift mode apk descargar
-extreme car driving simulator racing mode apk descargar
-extreme car driving simulator traffic mode apk descargar
-extreme car driving simulator police chase mode apk descargar
-extreme car driving simulator zombie mode apk descargar
-extreme car driving simulator multiplayer mode apk descargar
-extreme car driving simulator custom cars apk descargar
-extreme car driving simulator new cars apk descargar
-extreme car driving simulator best cars apk descargar
-extreme car driving simulator all cars unlocked apk descargar
-extreme car driving simulator realistic graphics apk descargar
-extreme car driving simulator hd graphics apk descargar
-extreme car driving simulator low graphics apk descargar
-extreme car driving simulator high graphics mod apk descargar
-extreme car driving simulator no ads apk descargar
-extreme car driving simulator no internet apk descargar
-extreme car driving simulator no root apk descargar
-extreme car driving simulator latest version apk descargar
-extreme car driving simulator old version apk descargar
-extreme car driving simulator beta version apk descargar
-como descargar e instalar extreme car driving simulator apk
-como jugar a extreme car driving simulator sin descargar el apk
-donde puedo descargar el juego de extreme car driving simulator en formato apk
-que es el juego de extreme car driving simulator y como se descarga el archivo apk
-como actualizar el juego de extreme car driving simulator desde el archivo apk
-como solucionar los problemas de instalacion del juego de extreme car driving simulator con el archivo apk
-como conseguir monedas infinitas en el juego de extreme car driving simulator con el archivo modificado de la aplicacion (modded/hacked)

-

Realistic car damage

-

The game has a realistic car damage system that shows you the effects of your driving actions. You can see your car get dented, scratched, or smashed depending on how hard you hit something. You can also see parts of your car fall off or fly away after a collision. The game also has a repair button that you can use to fix your car instantly if you don't want to see it damaged.

-

Accurate physics

-

The game has an accurate physics engine that makes the driving experience more realistic and fun. You can feel the weight, speed, and inertia of your car as you drive it. You can also see how your car reacts to different surfaces, slopes, curves, and jumps. The game also

Control your car with different options

-

The game gives you different options to control your car. You can choose between tilt, buttons, or steering wheel modes. You can also adjust the sensitivity and position of the controls according to your liking. You can also change the camera view from inside or outside the car, or use the free camera mode to see your car from any angle.

-

How to download and install Extreme Car Driving Simulator APK?

-

If you want to play Extreme Car Driving Simulator on your Android device, you will need to download and install the APK file of the game. APK stands for Android Package Kit, and it is a file format that contains all the necessary files and data for an Android application. Here are the requirements and steps to download and install Extreme Car Driving Simulator APK:

-

Requirements for Extreme Car Driving Simulator APK

- -

Steps to download and install Extreme Car Driving Simulator APK

-
    -
  1. Go to a trusted and reliable website that offers the APK file of Extreme Car Driving Simulator. You can use this link as an example.
  2. -
  3. Click on the download button and wait for the APK file to be downloaded on your device.
  4. -
  5. Once the download is complete, locate the APK file in your device's file manager and tap on it.
  6. -
  7. Follow the instructions on the screen to install the game on your device.
  8. -
  9. After the installation is done, you can launch the game from your app drawer or home screen and enjoy driving.
  10. -
-

Why should you play Extreme Car Driving Simulator?

-

Extreme Car Driving Simulator is a game that will appeal to anyone who loves driving cars and wants to have a realistic and fun experience. Here are some of the pros and cons of playing this game:

-

Pros of Extreme Car Driving Simulator

- -

Cons of Extreme Car Driving Simulator

- -

Conclusion

-

Extreme Car Driving Simulator is a driving game that will give you a realistic and fun driving experience on your Android device. You can drive various cars with different features and performance, and enjoy the realistic physics and car damage effects. You can also explore a large and detailed city with traffic, ramps, obstacles, and more. Whether you want to drive fast, drift, or crash your car, Extreme Car Driving Simulator will give you the freedom and fun you are looking for. You can download and install the APK file of the game from a trusted website and start driving today.

-

If you have any questions or feedback about Extreme Car Driving Simulator, feel free to ask them in the comments section below. Here are some FAQs that may help you:

-

Frequently Asked Questions

-
    -
  1. Is Extreme Car Driving Simulator free?
  2. -

    Yes, Extreme Car Driving Simulator is free to download and play. However, it may have some ads and in-app purchases that may affect your gameplay or enjoyment.

    -
  3. Is Extreme Car Driving Simulator safe?
  4. -

    Yes, Extreme Car Driving Simulator is safe to play as long as you download it from a trusted and reliable website. However, you should always be careful when downloading any app from unknown sources, as they may contain viruses or malware that may harm your device or data.

    -
  5. Is Extreme Car Driving Simulator offline?
  6. -

    No, Extreme Car Driving Simulator requires an internet connection to run properly. You will need a stable internet connection to download the APK file, update the game, and access some of the features and content of the game.

    -
  7. How can I unlock more cars in Extreme Car Driving Simulator?
  8. -

    You can unlock more cars in Extreme Car Driving Simulator by earning coins and gems in the game. You can earn coins and gems by completing missions, driving with traffic, performing stunts, and watching ads. You can also buy coins and gems with real money if you want to unlock cars faster.

    -
  9. How can I customize my car in Extreme Car Driving Simulator?
  10. -

    You can customize your car in Extreme Car Driving Simulator by going to the garage menu and selecting the car you want to modify. You can change the color, wheels, spoilers, and stickers of your car. You can also upgrade the engine, brakes, suspension, and turbo of your car to improve its performance.

    -
  11. How can I contact the developer of Extreme Car Driving Simulator?
  12. -

    You can contact the developer of Extreme Car Driving Simulator by sending an email to support@axesinmotion.com. You can also visit their website or follow them on Facebook, Twitter, or Instagram for more information and updates about the game.

    -
-

I hope you enjoyed reading this article and learned something new about Extreme Car Driving Simulator. If you did, please share it with your friends and family who might be interested in this game. Thank you for your time and attention.

197e85843d
-
-
\ No newline at end of file diff --git a/spaces/1phancelerku/anime-remove-background/Descarga Soul Knight Mod APK con gemas y monedas ilimitadas y todo desbloqueado.md b/spaces/1phancelerku/anime-remove-background/Descarga Soul Knight Mod APK con gemas y monedas ilimitadas y todo desbloqueado.md deleted file mode 100644 index 54811ca10b0e3f546a1e203fafb35ed85d1ce296..0000000000000000000000000000000000000000 --- a/spaces/1phancelerku/anime-remove-background/Descarga Soul Knight Mod APK con gemas y monedas ilimitadas y todo desbloqueado.md +++ /dev/null @@ -1,137 +0,0 @@ - -

Soul Knight Mod Apk Todo Desbloqueado: Cómo Descargar y Jugar el Juego de Calabozos Más Divertido

-

¿Te gustan los juegos de acción, aventura y exploración? ¿Te apasionan los juegos de estilo roguelike con gráficos pixelados y una gran variedad de armas y personajes? ¿Quieres disfrutar de una experiencia de juego sin límites ni restricciones? Entonces, te encantará Soul Knight Mod Apk Todo Desbloqueado, una versión modificada del juego original que te permite acceder a todas las características y beneficios del juego desde el principio.

-

soul knight mod apk todo desbloqueado


Download > https://jinyurl.com/2uNOix



-

En este artículo, te contaremos todo lo que necesitas saber sobre Soul Knight, el juego de calabozos más divertido y adictivo que puedes jugar en tu dispositivo Android o iOS. Te explicaremos qué es Soul Knight, qué es Soul Knight Mod Apk Todo Desbloqueado, cómo descargarlo e instalarlo, cómo jugarlo y algunos consejos y trucos para mejorar tu rendimiento. Además, al final del artículo, responderemos a algunas preguntas frecuentes que pueden surgirte sobre el juego.

-

¿Qué es Soul Knight?

-

Soul Knight es un juego de rol y acción desarrollado por ChillyRoom Inc. que se lanzó en febrero de 2017 para Android y iOS. El juego está inspirado en el juego Enter The Gungeon (un juego de disparos con elementos roguelike producido por Dodge Roll y Devolver Digital).

-

Características del juego

-

Soul Knight tiene las siguientes características:

- -

Historia del juego

-

La historia de Soul Knight es muy simple y no tiene mucha importancia para el desarrollo del juego. Según el propio juego, "en un tiempo de espadas y pistolas, la piedra mágica que mantiene el equilibrio del mundo es robada por alienígenas de alta tecnología. El mundo pende de un hilo. Todo depende de ti recuperar la piedra mágica...".

-

Así pues, tu objetivo es entrar en los calabozos infestados de monstruos y alienígenas, encontrar la piedra mágica y devolverla a su lugar. Por el camino, tendrás que enfrentarte a todo tipo de enemigos y jefes, recolectar armas y objetos, y sobrevivir a las trampas y los obstáculos.

-

soul knight mod apk gemas infinitas
-soul knight mod apk monedas ilimitadas
-soul knight mod apk personajes desbloqueados
-soul knight mod apk armas desbloqueadas
-soul knight mod apk ultima version
-soul knight mod apk descargar gratis
-soul knight mod apk sin anuncios
-soul knight mod apk energia infinita
-soul knight mod apk modo dios
-soul knight mod apk mega
-soul knight mod apk mediafıre
-soul knight mod apk android 1
-soul knight mod apk hackeado
-soul knight mod apk 2023
-soul knight mod apk 5.2.4
-soul knight mod apk skins desbloqueadas
-soul knight mod apk plantas infinitas
-soul knight mod apk mascotas desbloqueadas
-soul knight mod apk actualizado
-soul knight mod apk online
-soul knight mod apk offline
-soul knight mod apk no root
-soul knight mod apk facil de instalar
-soul knight mod apk español
-soul knight mod apk full
-soul knight mod apk premium
-soul knight mod apk vip
-soul knight mod apk pro
-soul knight mod apk oro infinito
-soul knight mod apk vida infinita
-soul knight mod apk balas infinitas
-soul knight mod apk daño aumentado
-soul knight mod apk velocidad aumentada
-soul knight mod apk inmortalidad
-soul knight mod apk invencible
-soul knight mod apk todo gratis
-soul knight mod apk todo ilimitado
-soul knight mod apk todo hackeado
-soul knight mod apk todo facil
-soul knight mod apk todo rapido

-

¿Qué es Soul Knight Mod Apk Todo Desbloqueado?

-

Soul Knight Mod Apk Todo Desbloqueado es una versión modificada del juego original que te permite disfrutar de todas las ventajas y beneficios del juego desde el principio. Con este mod apk, no tendrás que gastar dinero real ni esperar a desbloquear los contenidos del juego. Podrás acceder a todo lo siguiente:

-

Ventajas de usar el mod apk

- -

Cómo descargar e instalar el mod apk

-

Para descargar e instalar el mod apk de Soul Knight Todo Desbloqueado, solo tienes que seguir estos pasos:

-
    -
  1. Descarga el archivo apk desde este enlace. El archivo tiene un tamaño de unos 100 MB y es seguro y confiable.
  2. -
  3. Abre el archivo apk desde tu gestor de archivos o desde la carpeta de descargas de tu dispositivo.
  4. -
  5. Acepta los permisos e inicia la instalación. El proceso puede tardar unos segundos o minutos dependiendo de tu velocidad de conexión y de tu dispositivo.
  6. -
  7. Una vez instalado el juego, abrelo y disfruta de Soul Knight Mod Apk Todo Desbloqueado.
  8. -

    Para explorar los calabozos, solo tienes que usar el joystick virtual de la parte inferior izquierda para moverte y el botón de disparo de la parte inferior derecha para atacar. También puedes usar el botón de habilidad especial de la parte superior derecha para activar el poder único de tu héroe. Además, puedes cambiar de arma pulsando en el icono del arma en la parte superior izquierda o recoger nuevas armas que encuentres por el camino.

    -

    Cada calabozo tiene varias habitaciones que tendrás que atravesar hasta llegar al jefe. Algunas habitaciones están vacías, otras tienen enemigos que tendrás que eliminar, y otras tienen objetos o personajes que te pueden ayudar o perjudicar. Por ejemplo, puedes encontrar tiendas donde comprar armas u objetos, estatuas que te dan bendiciones o maldiciones, cofres que contienen tesoros o trampas, o personajes secundarios que te ofrecen misiones o consejos.

    -

    Usa las armas y los objetos

    -

    Una de las características más divertidas y variadas de Soul Knight es la gran cantidad de armas y objetos que puedes usar en tu aventura. Hay más de 400 armas diferentes que puedes encontrar, comprar o fusionar, cada una con su propio tipo de disparo, daño, cadencia, alcance y efecto especial. Por ejemplo, hay armas que disparan balas normales, otras que disparan rayos láser, otras que disparan misiles teledirigidos, otras que disparan bolas de fuego, y así sucesivamente.

    -

    Además, hay muchos objetos que puedes equiparte o usar para mejorar tu rendimiento o tu supervivencia. Por ejemplo, hay pociones que te curan o te dan energía, granadas que explotan y dañan a los enemigos cercanos, anillos que te dan bonificaciones permanentes o temporales, mascotas que te acompañan y te ayudan en el combate, y mucho más.

    -

    Para usar las armas y los objetos, solo tienes que pulsar en el icono correspondiente en la pantalla. Puedes llevar hasta dos armas al mismo tiempo y cambiar entre ellas cuando quieras. También puedes llevar hasta tres objetos diferentes y usarlos cuando los necesites. Además, puedes fusionar o mejorar tus armas usando las forjas o los talleres que encuentres en los calabozos.

    -

    Combate a los enemigos y los jefes

    -

    El principal desafío de Soul Knight es enfrentarte a los numerosos enemigos y jefes que te atacarán sin piedad en los calabozos. Hay más de 200 tipos de enemigos diferentes, cada uno con su propio aspecto, comportamiento y habilidad. Por ejemplo, hay esqueletos que te lanzan huesos, zombis que te muerden, arañas que te lanzan telarañas, robots que te disparan láseres, alienígenas que se teletransportan y muchos más.

    -

    Para combatir a los enemigos, tendrás que usar tus armas, tus objetos y tu habilidad especial con inteligencia y estrategia. Tendrás que tener en cuenta el tipo de arma que usas, el tipo de enemigo al que te enfrentas y el entorno en el que te encuentras. También tendrás que esquivar los ataques enemigos moviéndote por la pantalla y aprovechando los obstáculos o las coberturas.

    -

    Al final de cada calabozo, tendrás que enfrentarte a un jefe final que será mucho más fuerte y resistente que los demás enemigos. Cada jefe tiene su propio diseño , su patrón de ataque y su debilidad. Por ejemplo, hay un jefe que es una planta gigante que te lanza espinas, otro que es un dragón de hielo que te congela, otro que es un caballero oscuro que te persigue con su espada y muchos más.

    -

    Para derrotar a los jefes, tendrás que usar tus mejores armas, tus objetos más útiles y tu habilidad especial más poderosa. Tendrás que estar atento a sus movimientos y a sus señales para anticiparte a sus ataques y evitarlos. También tendrás que buscar sus puntos débiles y aprovecharlos para infligirles más daño.

    -

    Consejos y trucos para jugar Soul Knight Mod Apk Todo Desbloqueado

    -

    Soul Knight Mod Apk Todo Desbloqueado es un juego muy divertido y adictivo, pero también puede ser muy desafiante y frustrante si no sabes cómo jugarlo bien. Por eso, te vamos a dar algunos consejos y trucos para que puedas mejorar tu rendimiento y disfrutar más del juego. Estos son algunos de ellos:

    -

    Aprovecha tu habilidad especial

    -

    Cada héroe tiene una habilidad especial que puede marcar la diferencia en el combate. Estas habilidades pueden ser ofensivas, defensivas o de apoyo, y tienen un tiempo de recarga que varía según el héroe. Por ejemplo, el caballero puede usar dos armas al mismo tiempo durante unos segundos, el asesino puede volverse invisible y lanzar cuchillos, el alquimista puede lanzar bombas venenosas y curarse a sí mismo, y así sucesivamente.

    -

    Para aprovechar tu habilidad especial, tienes que saber cuándo y cómo usarla. No la desperdicies en situaciones innecesarias o fáciles, sino que guárdala para los momentos más difíciles o decisivos. Por ejemplo, puedes usarla para escapar de una situación peligrosa, para acabar con un grupo de enemigos o para enfrentarte a un jefe. También tienes que tener en cuenta el tipo de habilidad que tienes y cómo se complementa con tu arma y tu estilo de juego.

    -

    Gestiona tu energía y tu salud

    -

    Otro aspecto importante de Soul Knight es la gestión de tu energía y tu salud. La energía es el recurso que necesitas para usar tus armas, mientras que la salud es el indicador de tu vida. Ambos se pueden ver en la parte superior izquierda de la pantalla.

    -

    Para gestionar tu energía y tu salud, tienes que tener en cuenta lo siguiente:

    - -

    Busca las estatuas y los cofres

    -

    En los calabozos de Soul Knight hay muchos secretos y sorpresas que puedes descubrir si exploras bien cada habitación. Algunos de estos secretos son las estatuas y los cofres, que te pueden dar beneficios o perjuicios según lo que hagas con ellos.

    -

    Las estatuas son objetos que representan a diferentes personajes o criaturas del juego. Puedes interactuar con ellas usando una moneda dorada o una moneda plateada. Si usas una moneda dorada, la estatua te dará una bendición, que es un efecto positivo temporal o permanente. Por ejemplo, puede aumentar tu daño, tu velocidad, tu resist encia o tu suerte. Si usas una moneda plateada, la estatua te dará una maldición, que es un efecto negativo temporal o permanente. Por ejemplo, puede reducir tu daño, tu velocidad, tu resistencia o tu suerte. Por lo tanto, ten cuidado con lo que usas y con lo que eliges.

    -

    Los cofres son objetos que contienen tesoros o trampas. Puedes abrirlos usando una llave o rompiéndolos con tu arma. Si abres un cofre con una llave, obtendrás un tesoro, que puede ser una arma, un objeto o una moneda. Si rompes un cofre con tu arma, puede que obtengas un tesoro o una trampa, que puede ser un enemigo, una explosión o una maldición. Por lo tanto, piensa bien si vale la pena arriesgarte o no.

    -

    Fusiona y mejora tus armas

    -

    Otro consejo para jugar a Soul Knight Mod Apk Todo Desbloqueado es fusionar y mejorar tus armas para hacerlas más poderosas y eficaces. Para fusionar tus armas, tienes que usar las forjas que hay en algunos calabozos. Las forjas te permiten combinar dos armas del mismo tipo para obtener una nueva arma con mejores características y efectos. Por ejemplo, puedes fusionar dos pistolas para obtener una pistola doble, o dos escopetas para obtener una escopeta de doble cañón.

    -

    Para mejorar tus armas, tienes que usar los talleres que hay en algunos calabozos. Los talleres te permiten aumentar el nivel de tus armas usando monedas doradas. Al aumentar el nivel de tus armas, aumentas su daño, su cadencia, su alcance y su efecto especial. Por ejemplo, puedes mejorar una pistola normal para que dispare más rápido, más lejos y con más fuerza.

    -

    Conclusión

    -

    Soul Knight Mod Apk Todo Desbloqueado es un juego de rol y acción muy divertido y adictivo que te hará pasar horas de diversión y entretenimiento. Con este mod apk, podrás disfrutar de todas las ventajas y beneficios del juego sin tener que gastar dinero ni esperar a desbloquear los contenidos. Podrás acceder a todos los héroes, todas las armas, todos los objetos, todos los niveles y todos los modos de juego desde el principio.

    -

    Además, podrás explorar los calabozos generados aleatoriamente, usar las armas y los objetos más variados y originales, combatir a los enemigos y los jefes más desafiantes y divertidos, y jugar con tus amigos en el modo multijugador cooperativo local. Todo ello con un estilo gráfico retro y colorido y un humor irreverente y divertido.

    -

    Si te gustan los juegos de estilo roguelike con gráficos pixelados y una gran variedad de armas y personajes, no dudes en descargar Soul Knight Mod Apk Todo Desbloqueado y empezar a jugar ya. Te aseguramos que no te arrepentirás.

    -

    Preguntas frecuentes

    -

    A continuación, responderemos a algunas preguntas frecuentes que pueden surgirte sobre Soul Knight Mod Apk Todo Desbloqueado:

    -

    ¿Es seguro descargar e instalar Soul Knight Mod Apk Todo Desbloqueado?

    -

    Sí, es seguro descargar e instalar Soul Knight Mod Apk Todo Desbloqueado desde el enlace que te hemos proporcionado en este artículo. El archivo apk es seguro y confiable, y no contiene virus ni malware. Además, no necesitas rootear ni jailbreakear tu dispositivo para instalarlo.

    -

    ¿Es compatible Soul Knight Mod Apk Todo Desbloqueado con mi dispositivo?

    -

    Soul Knight Mod Apk Todo Desbloqueado es compatible con la mayoría de los dispositivos Android e iOS que tengan al menos la versión 4.1 o superior del sistema operativo. Sin embargo, puede haber algunos dispositivos que no sean compatibles o que presenten problemas de rendimiento o estabilidad. En ese caso, te recomendamos que pruebes el juego original o que contactes con el desarrollador para solucionar el problema.

    -

    ¿Puedo jugar online con Soul Knight Mod Apk Todo Desbloqueado?

    -

    No, no puedes jugar online con Soul Knight Mod Apk Todo Desbloqueado con otros jugadores que no estén en tu misma red local. El juego solo tiene un modo multijugador cooperativo local que te permite jugar con hasta 3 amigos en la misma pantalla. Para jugar con tus amigos, solo tienes que conectaros a la misma red wifi y pulsar en el icono de multijugador en el menú principal. Luego, podréis elegir vuestros héroes y entrar en los calabozos juntos.

    -

    ¿Puedo actualizar Soul Knight Mod Apk Todo Desbloqueado?

    -

    Sí, puedes actualizar Soul Knight Mod Apk Todo Desbloqueado cuando haya una nueva versión disponible. Para actualizar el juego, solo tienes que descargar el nuevo archivo apk desde el mismo enlace que te hemos proporcionado en este artículo y seguir los mismos pasos que para instalarlo. No hace falta que desinstales la versión anterior, solo sobrescríbela con la nueva. Así, podrás disfrutar de las últimas novedades y mejoras del juego.

    -

    ¿Qué otros juegos similares a Soul Knight Mod Apk Todo Desbloqueado me recomiendas?

    -

    Si te gusta Soul Knight Mod Apk Todo Desbloqueado, quizás también te gusten otros juegos similares que tienen un estilo de juego parecido o que están inspirados en el mismo género. Algunos de estos juegos son:

    -

    401be4b1e0
    -
    -
    \ No newline at end of file diff --git a/spaces/1phancelerku/anime-remove-background/Download and Play Special Forces Group 2 with God Mod APK and Get Ready for Intense Shooter Action.md b/spaces/1phancelerku/anime-remove-background/Download and Play Special Forces Group 2 with God Mod APK and Get Ready for Intense Shooter Action.md deleted file mode 100644 index c5e3e755fbb128760d4917d066fc4092430615e8..0000000000000000000000000000000000000000 --- a/spaces/1phancelerku/anime-remove-background/Download and Play Special Forces Group 2 with God Mod APK and Get Ready for Intense Shooter Action.md +++ /dev/null @@ -1,25 +0,0 @@ -
    -

    Special Forces Group 2: A Thrilling FPS Game for Android

    -

    If you are a fan of first-person shooter (FPS) games, you might have heard of Special Forces Group 2, a popular game for Android devices. This game is developed by ForgeGames, a company that specializes in creating realistic and immersive shooting games. Special Forces Group 2 is one of their best creations, as it offers a variety of game modes, weapons, maps, and characters to choose from. You can play this game solo or with your friends online or offline, and enjoy the adrenaline rush of shooting your enemies in different scenarios.

    -

    Features of Special Forces Group 2

    -

    Special Forces Group 2 has many features that make it stand out from other FPS games. Here are some of them:

    -

    special forces group 2 god mod apk download


    DOWNLOADhttps://jinyurl.com/2uNTYZ



    - -

    How to Download and Install Special Forces Group 2 on Android

    -

    If you want to download and install Special Forces Group 2 on your Android device, you can follow these simple steps:

    -
      -
    1. Step 1: Go to the official website or a trusted source that provides the APK file and the OBB file for Special Forces Group 2. For example, you can go to [APKdone](^1^), a website that offers free and safe downloads for Android games.
    2. -
    3. Step 2: Download the APK file and the OBB file for Special Forces Group 2. The APK file is about 40 MB in size, while the OBB file is about 300 MB in size. Make sure you have enough storage space on your device before downloading.
    4. -
    5. Step 3 , you should be careful of the compatibility issues and the risks of using God Mod APK, as mentioned above.
    6. -
    7. Q4: Can I play online with God Mod APK?
    8. -
    9. A4: You can play online with God Mod APK, but you may face some problems, such as lag, disconnects, or bans. You may also encounter other players who are using God Mod APK or other cheats, which may ruin your gaming experience.
    10. -
    11. Q5: What are some alternatives to God Mod APK?
    12. -
    13. A5: Some alternatives to God Mod APK are normal APK, modded OBB, or hacked data. These are different ways of modifying the game files to get some advantages in the game. However, they also have their own drawbacks and risks, so you should use them with caution.
    14. -

      197e85843d
      -
      -
      \ No newline at end of file diff --git a/spaces/1phancelerku/anime-remove-background/Download emulator black ps2 android with these simple steps.md b/spaces/1phancelerku/anime-remove-background/Download emulator black ps2 android with these simple steps.md deleted file mode 100644 index 990b7d39de39086f8d751f2ce624fa3d8651058b..0000000000000000000000000000000000000000 --- a/spaces/1phancelerku/anime-remove-background/Download emulator black ps2 android with these simple steps.md +++ /dev/null @@ -1,224 +0,0 @@ -
      -

      How to Download and Install Emulator Black PS2 Android

      -

      If you are a fan of PlayStation 2 games and want to play them on your Android device, you might be interested in Emulator Black PS2 Android. This is a powerful and reliable PS2 emulator that can run most of the PS2 games smoothly and with high-quality graphics. In this article, we will show you what Emulator Black PS2 Android is, why you need it, how to download and install it, how to configure and optimize it, and how to solve some common issues. Let's get started!

      -

      What is Emulator Black PS2 Android?

      -

      Emulator Black PS2 Android is a new PS2 emulator that was launched in late 2021 by a developer named Tahlreth. It is based on the PCSX2 emulator, which is a popular and well-established emulator for PC. Tahlreth got the permission from the PCSX2 developers to use their code and licensed it under the LGPL license. Unlike some other shady PS2 emulators on Android, such as DamonPS2, Emulator Black PS2 Android does not steal code or charge money for its features.

      -

      download emulator black ps2 android


      Download Ziphttps://jinyurl.com/2uNKk9



      -

      Emulator Black PS2 Android has many features that make it one of the best PS2 emulators on Android. Some of these features are:

      -
        -
      • It supports both OpenGL and Vulkan graphics renderers, which can improve the graphics quality and performance of the games.
      • -
      • It allows you to adjust various settings, such as resolution, framerate, aspect ratio, anti-aliasing, texture filtering, audio latency, controller layout, and more.
      • -
      • It supports save states, which let you save and load your game progress at any point.
      • -
      • It supports widescreen patches and upscaling, which can enhance the appearance of the games on modern devices.
      • -
      • It supports touchscreen and Bluetooth controller input, which gives you more options to control the games.
      • -
      • It supports loading games from your device storage or external sources, such as Google Drive or Dropbox.
      • -
      -

      Why do you need Emulator Black PS2 Android?

      -

      Emulator Black PS2 Android is a great way to enjoy your favorite PS2 games on your Android device. There are many benefits of using this emulator, such as:

      -
        -
      • You can play hundreds of PS2 games that are not available on any other platform.
      • -
      • You can play PS2 games anytime and anywhere without needing a console or a TV.
      • -
      • You can play PS2 games with better graphics and sound than the original hardware.
      • -
      • You can play PS2 games with more convenience and customization than the original hardware.
      • -
      -

      However, playing PS2 games on Android is not an easy task. There are many challenges that you might face when using a PS2 emulator on Android, such as:

      -
        -
      • You need a powerful device that can handle the high demands of PS2 emulation. The developer of Emulator Black PS2 Android recommends a Snapdragon 845-level processor or better, with four large CPU cores (Cortex-A75 or higher) and an Adreno GPU.
      • -
      • You need enough storage space to store the emulator app and the PS2 game files. The emulator app is about 30 MB, while the PS2 game files can range from 500 MB to 4 GB each.
      • -
      • You need to obtain the PS2 game files legally and ethically. You can either rip them from your own PS2 discs using a PC and a DVD drive, or download them from legitimate sources that have the permission of the game publishers. You should not download or share pirated or illegal PS2 game files.
      • -
      • You need to tweak and test the emulator settings for each game to find the best balance between quality and performance. Not all games will run perfectly on the emulator, and some might require specific settings or patches to work properly.
      • -
      -

      Fortunately, Emulator Black PS2 Android is designed to overcome these challenges and provide you with the best PS2 emulation experience on Android. It has a user-friendly interface, a fast and stable performance, a high compatibility rate, and a helpful community. It also has regular updates and bug fixes that improve its functionality and features.

      -

      How to download and install Emulator Black PS2 Android?

      -

      Downloading and installing Emulator Black PS2 Android is very easy and straightforward. You have two options to get the emulator app on your device:

      -
        -
      1. Download it from the official website. You can visit the website of Emulator Black PS2 Android at https://emulatorblackps2android.com and click on the download button. This will download the latest version of the emulator app as an APK file. You can then install it by tapping on the file and following the instructions.
      2. -
      3. Download it from the Google Play Store. You can also find Emulator Black PS2 Android on the Google Play Store by searching for its name or scanning this QR code: QR code for Emulator Black PS2 Android. This will take you to the app page, where you can tap on the install button. This will download and install the emulator app automatically.
      4. -
      -

      After you have installed the emulator app, you need to grant it some permissions to access your device storage, camera, microphone, and location. These permissions are necessary for the emulator to function properly and load your PS2 games. You can grant these permissions by going to your device settings, finding Emulator Black PS2 Android in the list of apps, and toggling on the permissions.

      -

      download aethersx2 ps2 emulator for android
      -download deus ex play ps2 emulator for android
      -download pro playstation ps2 emulator for android
      -download golden ps2 emulator for android
      -download gold ps2 emulator for android
      -download new ps2 emulator for android
      -download free pro ps2 emulator for android
      -download free hd ps2 emulator for android
      -download pro ppss2 emulator for android
      -download playstation 2 emulator for android apk
      -download best ps2 emulator for android 2023
      -download damonps2 pro ps2 emulator for android
      -download pcsx2 emulator for android phone
      -download playstation 2 games for android emulator
      -download black ps2 game iso for android
      -how to play black ps2 on android with aethersx2
      -how to install deus ex play ps2 emulator on android
      -how to configure pro playstation ps2 emulator on android
      -how to use golden ps2 emulator on android device
      -how to run gold ps2 emulator on android tablet
      -how to set up new ps2 emulator on android smartphone
      -how to optimize free pro ps2 emulator on android performance
      -how to improve free hd ps2 emulator on android graphics
      -how to fix pro ppss2 emulator on android errors
      -how to download playstation 2 bios for android emulator
      -best settings for aethersx2 ps2 emulator on android
      -best games for deus ex play ps2 emulator on android
      -best features of pro playstation ps2 emulator on android
      -best alternatives to golden ps2 emulator on android
      -best tips and tricks for gold ps2 emulator on android
      -new updates for new ps2 emulator on android 2023
      -new cheats for free pro ps2 emulator on android 2023
      -new mods for free hd ps2 emulator on android 2023
      -new roms for pro ppss2 emulator on android 2023
      -new version of playstation 2 emulator for android apk 2023
      -compare aethersx2 vs damonps2 pro ps2 emulator for android
      -compare deus ex play vs pcsx2 ps2 emulator for android phone
      -compare pro playstation vs playstation 2 games for android emulator
      -compare golden vs gold ps2 emulator for android 2023
      -compare new vs free pro ps2 emulator for android performance
      -compare free hd vs pro ppss2 emulator for android graphics
      -compare playstation 2 bios vs playstation 2 iso for android emulator
      -review of aethersx2 ps2 emulator for android 2023
      -review of deus ex play ps2 emulator for android 2023
      -review of pro playstation ps2 emulator for android 2023

      -

      How to load PS2 games on Emulator Black PS2 Android?

      -

      Once you have installed the emulator app and granted it the permissions, you can start loading your PS2 games on it. You have two options to load your PS2 games:

      -
        -
      1. Load them from your device storage. If you have stored your PS2 game files on your device storage, such as your internal memory or SD card, you can load them directly from there. You just need to launch the emulator app, tap on the "Load Game" button, and browse to the folder where you have saved your PS2 game files. You can then select the game file that you want to play and tap on it.
      2. -
      3. Load them from external sources. If you have stored your PS2 game files on external sources, such as Google Drive or Dropbox, you can load them from there as well. You just need to launch the emulator app, tap on the "Load Game" button, and tap on the "Cloud" icon. This will open a menu where you can choose which cloud service you want to use. You can then sign in with your account and access your PS2 game files. You can then select the game file that you want to play and tap on it.
      4. -
      -

      Note that Emulator Black PS2 Android supports both ISO and CSO formats for PS2 game files. ISO is the standard format that preserves all the data of the original disc, while CSO is a compressed format that reduces the file size but may lose some quality or functionality. You can choose whichever format suits your preference and storage space.

      -

      How to configure and optimize Emulator Black PS2 Android?

      -

      Emulator Black PS2 Android has a lot of settings and options that you can adjust to configure and optimize the emulator according to your device and game. You can access these settings by tapping on the "Settings" button on the main menu of the emulator app. Here are some of the main settings and options that you can tweak:

      -

      Graphics settings

      -

      The graphics settings allow you to change the graphics renderer, resolution, framerate, aspect ratio, anti-aliasing, texture filtering, and other options that affect the visual quality and performance of the games. You can find these settings under the "Graphics" tab in the settings menu. Here are some of the graphics settings and what they do:

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        -
      • Widescreen patch: This applies a patch to the game that makes it compatible with the widescreen aspect ratio, without stretching or cropping the image.
      • -
      • Upscaling: This enhances the resolution and quality of the game graphics, making them look more crisp and smooth.
      • -
      • Frame skipping: This skips some frames of the game output, making it run faster but less smoothly.
      • -
      • Vsync: This synchronizes the framerate of the game output with the refresh rate of your device screen, preventing screen tearing and stuttering.
      • -
      -

      Sound settings

      -

      The sound settings allow you to change the sound latency, volume, and quality of the games. You can find these settings under the "Sound" tab in the settings menu. Here are some of the sound settings and what they do:

      -
      SettingDescription
      RendererThis lets you choose between OpenGL and Vulkan as the graphics renderer for the emulator. OpenGL is more compatible and stable, but Vulkan is more powerful and efficient. You can try both and see which one works better for your device and game.
      ResolutionThis lets you choose the resolution of the game output. The higher the resolution, the sharper and clearer the game will look, but it will also consume more resources and battery. You can choose from several presets, such as native (the original resolution of the PS2), 2x native, 3x native, 4x native, or custom (where you can enter your own resolution).
      FramerateThis lets you choose the framerate of the game output. The higher the framerate, the smoother and more fluid the game will run, but it will also consume more resources and battery. You can choose from several presets, such as 30 FPS (the standard framerate of most PS2 games), 60 FPS (the ideal framerate for smooth gameplay), or custom (where you can enter your own framerate).
      Aspect ratioThis lets you choose the aspect ratio of the game output. The aspect ratio is the ratio between the width and height of the screen. You can choose from several presets, such as 4:3 (the original aspect ratio of most PS2 games), 16:9 (the widescreen aspect ratio of modern devices), or custom (where you can enter your own aspect ratio).
      Anti-aliasingThis lets you choose whether to enable or disable anti-aliasing for the game output. Anti-aliasing is a technique that smooths out the jagged edges of the graphics, making them look more realistic and less pixelated. However, it also consumes more resources and battery. You can choose from several levels of anti-aliasing, such as none, 2x, 4x, or 8x.
      Texture filteringThis lets you choose whether to enable or disable texture filtering for the game output. Texture filtering is a technique that improves the quality and sharpness of the textures, making them look more detailed and less blurry. However, it also consumes more resources and battery. You can choose from several levels of texture filtering, such as none, bilinear, trilinear, or anisotropic.
      Other optionsThere are also some other options that you can toggle on or off in the graphics settings, such as:
      - - - - - - - - - - - - - - - - -
      SettingDescription
      LatencyThis lets you choose the latency of the sound output. The latency is the delay between the sound being generated by the emulator and being played by your device. The lower the latency, the more responsive and accurate the sound will be, but it will also consume more resources and battery. You can choose from several presets, such as low, medium, high, or custom (where you can enter your own latency).
      VolumeThis lets you choose the volume of the sound output. You can adjust the volume by using a slider or entering a value between 0 and 100.
      QualityThis lets you choose the quality of the sound output. The quality is the fidelity and clarity of the sound, which depends on factors such as sampling rate, bit depth, and channels. The higher the quality, the better and richer the sound will be, but it will also consume more resources and battery. You can choose from several presets, such as low, medium, high, or custom (where you can enter your own quality).
      -

      Controls settings

      -

      The controls settings allow you to change the input method, layout, sensitivity, and vibration of the games. You can find these settings under the "Controls" tab in the settings menu. Here are some of the controls settings and what they do:

      - - - - - - - - - - - - - - - - - - - - -

      Performance settings

      -

      The performance settings allow you to change the CPU and GPU emulation modes, speed hacks, and power saving options of the games. You can find these settings under the "Performance" tab in the settings menu. Here are some of the performance settings and what they do:

      -
      SettingDescription
      Input methodThis lets you choose between touchscreen and Bluetooth controller as your input method for the games. If you choose touchscreen, you will see a virtual controller on your device screen that mimics the PS2 controller buttons and sticks. If you choose Bluetooth controller, you will need to pair your device with a compatible Bluetooth controller that has enough buttons and sticks to map to the PS2 controller.
      LayoutThis lets you customize the layout of the virtual controller on your device screen. You can drag and drop each button and stick to any position on your screen. You can also resize and rotate them by using pinch and twist gestures. You can save your layout as a preset and load it for different games.
      SensitivityThis lets you adjust the sensitivity of each stick on your virtual or Bluetooth controller. The sensitivity is how fast and responsive the stick is to your input. You can adjust the sensitivity by using a slider or entering a value between 0 and 100.
      VibrationThis lets you enable or disable vibration for your virtual or Bluetooth controller. Vibration is a feature that makes your controller rumble or shake when certain events happen in the game, such as shooting, hitting, or exploding. However, it also consumes more resources and battery.
      - - - - - - - - - - - - - - - - - - - - -
      SettingDescription
      CPU emulation modeThis lets you choose between interpreter and recompiler as the CPU emulation mode for the games. The CPU emulation mode is how the emulator translates the PS2 CPU instructions to your device CPU instructions. Interpreter is more accurate and compatible, but slower and more resource-intensive. Recompiler is faster and more efficient, but less accurate and compatible. You can try both and see which one works better for your device and game.
      GPU emulation modeThis lets you choose between software and hardware as the GPU emulation mode for the games. The GPU emulation mode is how the emulator renders the PS2 graphics to your device screen. Software is more accurate and compatible, but slower and more resource-intensive. Hardware is faster and more efficient, but less accurate and compatible. You can try both and see which one works better for your device and game.
      Speed hacksThis lets you enable or disable some speed hacks for the games. Speed hacks are some tricks that the emulator uses to boost the speed of the games, such as skipping some calculations, frames, or effects. However, they can also cause some glitches, errors, or crashes in some games. You can choose from several presets, such as none, safe, balanced, or aggressive.
      Power savingThis lets you enable or disable some power saving options for the games. Power saving options are some features that the emulator uses to reduce the battery consumption of your device, such as lowering the brightness, sound, or resolution of the games. However, they can also affect the quality and performance of the games. You can choose from several presets, such as none, low, medium, or high.
      -

      Conclusion

      -

      Emulator Black PS2 Android is a fantastic PS2 emulator that can let you play your favorite PS2 games on your Android device with ease and enjoyment. It has many features and settings that you can customize and optimize to suit your preferences and needs. It also has a high compatibility rate and a supportive community that can help you with any issues or questions. If you are looking for a way to relive your PS2 memories or discover new PS2 gems on your Android device, you should definitely give Emulator Black PS2 Android a try!

      -

      Frequently Asked Questions

      -

      Here are some of the frequently asked questions about Emulator Black PS2 Android:

      -
        -
      1. Is Emulator Black PS2 Android free?
      2. -

        Yes, Emulator Black PS2 Android is completely free to download and use. It does not have any ads or in-app purchases. However, if you want to support the developer and the project, you can donate via PayPal or Patreon.

        -
      3. Is Emulator Black PS2 Android legal?
      4. -

        Yes, Emulator Black PS2 Android is legal as long as you use it with your own legally obtained PS2 game files. You should not download or share any pirated or illegal PS2 game files.

        -
      5. Is Emulator Black PS2 Android safe?
      6. -

        Yes, Emulator Black PS2 Android is safe as long as you download it from its official website or the Google Play Store. It does not contain any malware or viruses that can harm your device or data.

        -
      7. What are the minimum requirements for Emulator Black PS2 Android?
      8. -

        The minimum requirements for Emulator Black PS2 Android are:

        -
          -
        • An Android device running Android 7.0 or higher.
        • -
        • A Snapdragon 845-level processor or better, with four large CPU cores (Cortex-A75 or higher) and an Adreno GPU.
        • -
        • At least 4 GB of RAM.
        • -
        • At least 10 GB of free storage space.
        • -
        • A stable internet connection.
        • -
        -
      9. Where can I get more information and help about Emulator Black PS2 Android?
      10. -

        You can get more information and help about Emulator Black PS2 Android by visiting its official website at https://emulatorblackps2android.com, where you can find FAQs, tutorials, guides, forums, blogs, social media links, contact details, and more.

        -
      -

      I hope you enjoyed this article and learned something new about Emulator Black PS2 Android. If you have any feedback or suggestions, please let me know in the comments section below. Thank you for reading and happy gaming!

      197e85843d
      -
      -
      \ No newline at end of file diff --git a/spaces/1phancelerku/anime-remove-background/Enjoy the Smooth and Comprehensive Gameplay of Battle Royale 3D - Warrior63 with Mod APK.md b/spaces/1phancelerku/anime-remove-background/Enjoy the Smooth and Comprehensive Gameplay of Battle Royale 3D - Warrior63 with Mod APK.md deleted file mode 100644 index a0eb4b82b94301b4ac37a5940bb4391179cbac90..0000000000000000000000000000000000000000 --- a/spaces/1phancelerku/anime-remove-background/Enjoy the Smooth and Comprehensive Gameplay of Battle Royale 3D - Warrior63 with Mod APK.md +++ /dev/null @@ -1,98 +0,0 @@ - -

      Battle Royale 3D - Warrior63 Mod APK Download: A Guide for Android Users

      -

      If you are a fan of survival shooting games, you might want to try Battle Royale 3D - Warrior63, a popular mobile game that challenges you to be the last man standing in a fierce combat. In this article, we will tell you everything you need to know about this game, and how to download and install the mod apk version for free. Read on to find out more!

      -

      What is Battle Royale 3D - Warrior63?

      -

      Battle Royale 3D - Warrior63 is a game developed by LQ-GAME, a Chinese studio that specializes in creating action-packed games for Android devices. The game was released in 2020 and has since gained millions of downloads and positive reviews from players around the world.

      -

      battle royale 3d warrior 63 mod apk download


      Download ☆☆☆☆☆ https://jinyurl.com/2uNQig



      -

      The game is inspired by the popular genre of battle royale, where you have to compete with other players in a shrinking map and eliminate them until you are the only survivor. The game features a mega battle map in 4km x 4km, with various terrains such as land, sea, mountains, and buildings. You can also use vehicles and weapons to enhance your mobility and firepower.

      -

      Features of the game

      -

      Some of the features that make Battle Royale 3D - Warrior63 stand out from other similar games are:

      -
        -
      • A variety of weapons, such as pistols, rifles, submachine guns, sniper guns, grenades, and more.
      • -
      • A new weapon control system that makes shooting more smooth and stable.
      • -
      • A new custom key mapping that allows you to personalize your controls for a better gaming experience.
      • -
      • A new player level system that rewards you with coins and diamonds as you progress.
      • -
      • Three different game modes: Death Battle, Team Battle, and Training Challenge.
      • -
      • Optimized enemy direction tips and network stability.
      • -
      • A fix for a weapon picking bug.
      • -
      -

      How to play the game

      -

      The gameplay of Battle Royale 3D - Warrior63 is simple and straightforward. You start by choosing a game mode and entering a match with other players. You can either play solo or team up with your friends. Then, you parachute onto the map and search for weapons and resources. You have to be quick and careful, as the map will shrink over time and force you to move closer to your enemies. You also have to avoid the poison circle and enemy attacks, while looking for opportunities to defeat them. The last player or team alive wins the match.

      -

      Why download the mod apk version?

      -

      While Battle Royale 3D - Warrior63 is free to play, it also contains some in-app purchases that require real money. These include coins and diamonds that can be used to buy new weapons, skins, vehicles, and other items. If you want to enjoy the game without spending any money, you might want to download the mod apk version instead.

      -

      Benefits of the mod apk

      -

      The mod apk version of Battle Royale 3D - Warrior63 is a modified version that gives you some advantages over the original version. Some of the benefits of the mod apk are:

      -
        -
      • Unlimited coins and diamonds that can be used to buy anything you want in the game.
      • -
      • Optimized graphics and performance that make the game run faster and smoother on your device.
      • -
      • Weak enemy mode that makes your opponents easier to kill.
      • -
      -

      How to download and install the mod apk

      -

      To download and install the mod apk version of Battle Royale 3D - Warrior63, you need to follow these steps:

      -
        -
      1. Go to a trusted website that provides the mod apk file for Battle Royale 3D - Warrior63. You can search for it on Google or use this link: .
      2. -
      3. Download the mod apk file to your device. Make sure you have enough storage space and a stable internet connection.
      4. -
      5. Enable the installation of apps from unknown sources on your device. You can do this by going to Settings > Security > Unknown Sources and toggling it on.
      6. -
      7. Locate the mod apk file on your device and tap on it to start the installation process. Follow the instructions on the screen and wait for it to finish.
      8. -
      9. Launch the game and enjoy the mod features.
      10. -
      -

      Tips and tricks for playing Battle Royale 3D - Warrior63

      -

      Now that you have downloaded and installed the mod apk version of Battle Royale 3D - Warrior63, you might want to know some tips and tricks that can help you improve your skills and win more matches. Here are some of them:

      -

      battle royale 3d warrior 63 mod apk free download
      -download battle royale 3d warrior 63 mod apk latest version
      -battle royale 3d warrior 63 mod apk unlimited money
      -how to install battle royale 3d warrior 63 mod apk
      -battle royale 3d warrior 63 mod apk android
      -battle royale 3d warrior 63 mod apk happymod
      -battle royale 3d warrior 63 mod apk offline
      -battle royale 3d warrior 63 mod apk no root
      -battle royale 3d warrior 63 mod apk online
      -battle royale 3d warrior 63 mod apk obb
      -battle royale 3d warrior 63 mod apk revdl
      -battle royale 3d warrior 63 mod apk rexdl
      -battle royale 3d warrior 63 mod apk update
      -battle royale 3d warrior 63 mod apk hack
      -battle royale 3d warrior 63 mod apk cheat
      -battle royale 3d warrior 63 mod apk gameplay
      -battle royale 3d warrior 63 mod apk review
      -battle royale 3d warrior 63 mod apk features
      -battle royale 3d warrior 63 mod apk tips and tricks
      -battle royale 3d warrior 63 mod apk guide
      -battle royale 3d warrior 63 mod apk best weapons
      -battle royale 3d warrior 63 mod apk new map
      -battle royale 3d warrior 63 mod apk custom key mapping
      -battle royale 3d warrior 63 mod apk weak enemy
      -battle royale 3d warrior 63 mod apk optimized
      -battle royale 3d warrior 63 mod apk net energy gain
      -battle royale 3d warrior 63 mod apk death battle mode
      -battle royale 3d warrior 63 mod apk team battle mode
      -battle royale 3d warrior 63 mod apk training challenge mode
      -battle royale 3d warrior 63 mod apk player level system
      -battle royale 3d warrior 63 mod apk windows crossover
      -battle royale 3d warrior 63 mod apk vehicle control mode
      -download game battle royale 3d warrior 63 mod apk for android
      -download game battle royale 3d warrior mega map for android free with unlimited money and weak enemy hack cheat offline online latest version obb rexdl revdl happymod net energy gain vehicle control mode windows crossover player level system death team training challenge modes custom key mapping optimized features tips and tricks guide best weapons new map review gameplay no root install unlimited money and weak enemy hack cheat offline online latest version obb rexdl revdl happymod net energy gain vehicle control mode windows crossover player level system death team training challenge modes custom key mapping optimized features tips and tricks guide best weapons new map review gameplay no root install

      -

      Customize your controls

      -

      One of the best features of Battle Royale 3D - Warrior63 is that it allows you to customize your controls according to your preference. You can access the custom key mapping by tapping on the gear icon on the top right corner of the screen and then selecting Control. You can adjust the size, position, and transparency of the buttons, as well as switch between different control modes. You can also save different control schemes for different game modes. Experiment with different settings until you find the one that suits you best.

      -

      Use vehicles and weapons wisely

      -

      Vehicles and weapons are essential tools for survival in Battle Royale 3D - Warrior63. You can find them scattered around the map, or buy them with coins and diamonds in the shop. Vehicles can help you move faster and escape from danger, but they also make you more visible and vulnerable to enemy fire. Weapons can help you eliminate your enemies, but they also have different characteristics such as range, accuracy, recoil, and ammo capacity. You should always choose the vehicle and weapon that match your play style and situation. For example, if you want to snipe from a distance, you should use a sniper rifle and a motorcycle. If you want to rush into close combat, you should use a submachine gun and a car.

      -

      Avoid the poison circle and enemy attacks

      -

      The poison circle is a deadly mechanic that forces you to move closer to your enemies as the match progresses. It appears as a blue circle on the map that shrinks over time. If you are outside of it, you will lose health gradually until you die. You should always pay attention to the poison circle and plan your movements accordingly. You should also avoid staying in one place for too long, as you might attract enemy attention and get ambushed. You should always be alert and aware of your surroundings, and use cover and camouflage to hide from enemy sight.

      -

      Conclusion

      -

      Battle Royale 3D - Warrior63 is a fun and exciting game that will test your survival skills and reflexes in a realistic 3D environment. You can download the mod apk version of the game for free and enjoy unlimited coins, diamonds, weak enemies, and more. You can also follow our tips and tricks to improve your gameplay and win more matches. Download Battle Royale 3D - Warrior63 mod apk now and join the ultimate battle royale!

      -

      FAQs

      -

      Here are some frequently asked questions about Battle Royale 3D - Warrior63 mod apk:

      -
        -
      • Is Battle Royale 3D - Warrior63 mod apk safe to download?
        -Yes, Battle Royale 3D - Warrior63 mod apk is safe to download as long as you use a trusted website that provides the file. You should also scan the file with an antivirus program before installing it.
      • -
      • Do I need to root my device to use Battle Royale 3D - Warrior63 mod apk?
        -No, you do not need to root your device to use Battle Royale 3D - Warrior63 mod apk. You just need to enable the installation of apps from unknown sources on your device.
      • -
      • Will I get banned for using Battle Royale 3D - Warrior63 mod apk?
        -There is a low risk of getting banned for using Battle Royale 3D - Warrior63 mod apk, as the game does not have a strict anti-cheat system. However, you should still be careful and avoid using obvious cheats such as flying or teleporting.
      • -
      • Can I play Battle Royale 3D - Warrior63 mod apk with my friends?< br> -Yes, you can play Battle Royale 3D - Warrior63 mod apk with your friends. You can either join a team battle mode or create a private room and invite your friends to join. You can also chat with your teammates and coordinate your strategies.
      • -
      • How can I update Battle Royale 3D - Warrior63 mod apk?
        -To update Battle Royale 3D - Warrior63 mod apk, you need to download the latest version of the mod apk file from the same website that you used before. Then, you need to uninstall the old version of the game and install the new one. You should also backup your game data before updating to avoid losing your progress.
      • -

      197e85843d
      -
      -
      \ No newline at end of file diff --git a/spaces/1toTree/lora_test/README.md b/spaces/1toTree/lora_test/README.md deleted file mode 100644 index cb700f3ea029e9d1b882c5490b3421fe0f742605..0000000000000000000000000000000000000000 --- a/spaces/1toTree/lora_test/README.md +++ /dev/null @@ -1,12 +0,0 @@ ---- -title: LoRa ppdiffusers dreambooth -emoji: 🎨🎞️ -colorFrom: pink -colorTo: purple -sdk: gradio -sdk_version: 3.18.0 -app_file: app.py -pinned: false ---- - -Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference \ No newline at end of file diff --git a/spaces/232labs/VToonify/vtoonify/model/raft/core/utils/__init__.py b/spaces/232labs/VToonify/vtoonify/model/raft/core/utils/__init__.py deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/spaces/AI-ANK/PaLM-Kosmos-Vision/README.md b/spaces/AI-ANK/PaLM-Kosmos-Vision/README.md deleted file mode 100644 index 8fab6847eb3e792cd39e8681a50920cba3599267..0000000000000000000000000000000000000000 --- a/spaces/AI-ANK/PaLM-Kosmos-Vision/README.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -title: PaLM Kosmos Vision -emoji: 🚀 -colorFrom: blue -colorTo: gray -sdk: streamlit -sdk_version: 1.28.1 -app_file: app.py -pinned: false -license: mit ---- - -Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference diff --git a/spaces/AIGC-Audio/AudioGPT/NeuralSeq/vocoders/base_vocoder.py b/spaces/AIGC-Audio/AudioGPT/NeuralSeq/vocoders/base_vocoder.py deleted file mode 100644 index fe49a9e4f790ecdc5e76d60a23f96602b59fc48d..0000000000000000000000000000000000000000 --- a/spaces/AIGC-Audio/AudioGPT/NeuralSeq/vocoders/base_vocoder.py +++ /dev/null @@ -1,39 +0,0 @@ -import importlib -VOCODERS = {} - - -def register_vocoder(cls): - VOCODERS[cls.__name__.lower()] = cls - VOCODERS[cls.__name__] = cls - return cls - - -def get_vocoder_cls(hparams): - if hparams['vocoder'] in VOCODERS: - return VOCODERS[hparams['vocoder']] - else: - vocoder_cls = hparams['vocoder'] - pkg = ".".join(vocoder_cls.split(".")[:-1]) - cls_name = vocoder_cls.split(".")[-1] - vocoder_cls = getattr(importlib.import_module(pkg), cls_name) - return vocoder_cls - - -class BaseVocoder: - def spec2wav(self, mel): - """ - - :param mel: [T, 80] - :return: wav: [T'] - """ - - raise NotImplementedError - - @staticmethod - def wav2spec(wav_fn): - """ - - :param wav_fn: str - :return: wav, mel: [T, 80] - """ - raise NotImplementedError diff --git a/spaces/AILab-CVC/SEED-LLaMA/start.sh b/spaces/AILab-CVC/SEED-LLaMA/start.sh deleted file mode 100644 index 4578d224c519561a97c0d6642f36d652da6f1b5c..0000000000000000000000000000000000000000 --- a/spaces/AILab-CVC/SEED-LLaMA/start.sh +++ /dev/null @@ -1,11 +0,0 @@ - -nohup python3 gradio_demo/seed_llama_flask.py \ - --image_transform configs/transform/clip_transform.yaml \ - --tokenizer configs/tokenizer/seed_llama_tokenizer_hf.yaml \ - --model configs/llm/seed_llama_14b_8bit.yaml \ - --port 7890 \ - --llm_device cuda:0 \ - --tokenizer_device cuda:0 \ - --offload_encoder >./output.out & - -python3 gradio_demo/seed_llama_gradio.py --server_port 7860 --request_address http://127.0.0.1:7890/generate --model_type seed-llama-14b \ No newline at end of file diff --git a/spaces/Abrish-Aadi/Chest-Xray-anomaly-detection/README.md b/spaces/Abrish-Aadi/Chest-Xray-anomaly-detection/README.md deleted file mode 100644 index 6cabc36152ee5a8a7042a9eda2140eafbf162cce..0000000000000000000000000000000000000000 --- a/spaces/Abrish-Aadi/Chest-Xray-anomaly-detection/README.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -title: Chest Xray Anomaly Detection -emoji: 🌖 -colorFrom: purple -colorTo: indigo -sdk: gradio -sdk_version: 3.23.0 -app_file: app.py -pinned: false -license: apache-2.0 ---- - -Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference diff --git a/spaces/AchyuthGamer/MagicPrompt-Stable-Diffusion/README.md b/spaces/AchyuthGamer/MagicPrompt-Stable-Diffusion/README.md deleted file mode 100644 index 4572e614f2314c27b0b9bfab0cc886f8db757c09..0000000000000000000000000000000000000000 --- a/spaces/AchyuthGamer/MagicPrompt-Stable-Diffusion/README.md +++ /dev/null @@ -1,14 +0,0 @@ ---- -title: MagicPrompt Stable Diffusion -emoji: 🍄 -colorFrom: red -colorTo: indigo -sdk: gradio -sdk_version: 3.3.1 -app_file: app.py -pinned: false -license: mit -duplicated_from: Gustavosta/MagicPrompt-Stable-Diffusion ---- - -Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference diff --git a/spaces/Adapter/T2I-Adapter/test_adapter.py b/spaces/Adapter/T2I-Adapter/test_adapter.py deleted file mode 100644 index aa8f7ae0cd5817eac836b3ab66d51480aa7bede4..0000000000000000000000000000000000000000 --- a/spaces/Adapter/T2I-Adapter/test_adapter.py +++ /dev/null @@ -1,80 +0,0 @@ -import os - -import cv2 -import torch -from basicsr.utils import tensor2img -from pytorch_lightning import seed_everything -from torch import autocast - -from ldm.inference_base import (diffusion_inference, get_adapters, get_base_argument_parser, get_sd_models) -from ldm.modules.extra_condition import api -from ldm.modules.extra_condition.api import (ExtraCondition, get_adapter_feature, get_cond_model) - -torch.set_grad_enabled(False) - - -def main(): - supported_cond = [e.name for e in ExtraCondition] - parser = get_base_argument_parser() - parser.add_argument( - '--which_cond', - type=str, - required=True, - choices=supported_cond, - help='which condition modality you want to test', - ) - opt = parser.parse_args() - which_cond = opt.which_cond - if opt.outdir is None: - opt.outdir = f'outputs/test-{which_cond}' - os.makedirs(opt.outdir, exist_ok=True) - if opt.resize_short_edge is None: - print(f"you don't specify the resize_shot_edge, so the maximum resolution is set to {opt.max_resolution}") - opt.device = torch.device("cuda") if torch.cuda.is_available() else torch.device("cpu") - - # support two test mode: single image test, and batch test (through a txt file) - if opt.prompt.endswith('.txt'): - assert opt.prompt.endswith('.txt') - image_paths = [] - prompts = [] - with open(opt.prompt, 'r') as f: - lines = f.readlines() - for line in lines: - line = line.strip() - image_paths.append(line.split('; ')[0]) - prompts.append(line.split('; ')[1]) - else: - image_paths = [opt.cond_path] - prompts = [opt.prompt] - print(image_paths) - - # prepare models - sd_model, sampler = get_sd_models(opt) - adapter = get_adapters(opt, getattr(ExtraCondition, which_cond)) - cond_model = None - if opt.cond_inp_type == 'image': - cond_model = get_cond_model(opt, getattr(ExtraCondition, which_cond)) - - process_cond_module = getattr(api, f'get_cond_{which_cond}') - - # inference - with torch.inference_mode(), \ - sd_model.ema_scope(), \ - autocast('cuda'): - for test_idx, (cond_path, prompt) in enumerate(zip(image_paths, prompts)): - seed_everything(opt.seed) - for v_idx in range(opt.n_samples): - # seed_everything(opt.seed+v_idx+test_idx) - cond = process_cond_module(opt, cond_path, opt.cond_inp_type, cond_model) - - base_count = len(os.listdir(opt.outdir)) // 2 - cv2.imwrite(os.path.join(opt.outdir, f'{base_count:05}_{which_cond}.png'), tensor2img(cond)) - - adapter_features, append_to_context = get_adapter_feature(cond, adapter) - opt.prompt = prompt - result = diffusion_inference(opt, sd_model, sampler, adapter_features, append_to_context) - cv2.imwrite(os.path.join(opt.outdir, f'{base_count:05}_result.png'), tensor2img(result)) - - -if __name__ == '__main__': - main() diff --git a/spaces/AgentVerse/agentVerse/ui/src/phaser3-rex-plugins/plugins/shockwavepipeline-plugin.js b/spaces/AgentVerse/agentVerse/ui/src/phaser3-rex-plugins/plugins/shockwavepipeline-plugin.js deleted file mode 100644 index 2a85870ebed3858d7b943bb25adbdc6f1337c9fb..0000000000000000000000000000000000000000 --- a/spaces/AgentVerse/agentVerse/ui/src/phaser3-rex-plugins/plugins/shockwavepipeline-plugin.js +++ /dev/null @@ -1,14 +0,0 @@ -import ShockwavePostFxPipeline from './shockwavepipeline.js'; -import BasePostFxPipelinePlugin from './utils/renderer/postfxpipeline/BasePostFxPipelinePlugin.js'; -import SetValue from './utils/object/SetValue.js'; - -class ShockwavePipelinePlugin extends BasePostFxPipelinePlugin { - constructor(pluginManager) { - super(pluginManager); - this.setPostPipelineClass(ShockwavePostFxPipeline, 'rexShockwavePostFx'); - } -} - -SetValue(window, 'RexPlugins.Pipelines.ShockwavePostFx', ShockwavePostFxPipeline); - -export default ShockwavePipelinePlugin; \ No newline at end of file diff --git a/spaces/AgentVerse/agentVerse/ui/src/phaser3-rex-plugins/templates/ui/maker/builders/utils/SetTextureProperties.js b/spaces/AgentVerse/agentVerse/ui/src/phaser3-rex-plugins/templates/ui/maker/builders/utils/SetTextureProperties.js deleted file mode 100644 index 6f3012e4087b95d485bf50a89e20d2330d476d29..0000000000000000000000000000000000000000 --- a/spaces/AgentVerse/agentVerse/ui/src/phaser3-rex-plugins/templates/ui/maker/builders/utils/SetTextureProperties.js +++ /dev/null @@ -1,22 +0,0 @@ -const ProperiteList = ['tint', 'alpha', 'visible', 'flipX', 'flipY']; - -var SetTextureProperties = function (gameObject, data) { - for (var i = 0, cnt = ProperiteList.length; i < cnt; i++) { - var key = ProperiteList[i]; - var value = data[key]; - if (value !== undefined) { - gameObject[key] = value; - } - } - - if (data.cropResize && !gameObject.resize) { - gameObject.resize = function (width, height) { - gameObject.setCrop(0, 0, width, height); - return gameObject; - } - } - - return gameObject; -} - -export default SetTextureProperties; \ No newline at end of file diff --git a/spaces/AgentVerse/agentVerse/ui/src/phaser3-rex-plugins/templates/ui/pages/methods/HasPage.js b/spaces/AgentVerse/agentVerse/ui/src/phaser3-rex-plugins/templates/ui/pages/methods/HasPage.js deleted file mode 100644 index 6435d95219a42447fc434716fc49b65f4566cf15..0000000000000000000000000000000000000000 --- a/spaces/AgentVerse/agentVerse/ui/src/phaser3-rex-plugins/templates/ui/pages/methods/HasPage.js +++ /dev/null @@ -1,5 +0,0 @@ -var HasPage = function (key) { - return this.sizerChildren.hasOwnProperty(key); -} - -export default HasPage; \ No newline at end of file diff --git a/spaces/AlekseyKorshuk/accompaniment-generator/app.py b/spaces/AlekseyKorshuk/accompaniment-generator/app.py deleted file mode 100644 index e540a93511be8a1c196aac324090f39bb7172cfa..0000000000000000000000000000000000000000 --- a/spaces/AlekseyKorshuk/accompaniment-generator/app.py +++ /dev/null @@ -1,108 +0,0 @@ -import streamlit as st -import numpy as np -import pretty_midi -from accompaniment_generator.generator.base import Generator -import os -import uuid -import time -from midi2audio import FluidSynth -from scipy.io import wavfile - -ABOUT_TEXT = "🤗 Accompaniment Generator - generate accompaniment part with chord using Evolutionary algorithm." -CONTACT_TEXT = """ -_Built by Aleksey Korshuk with love_ ❤️ -[![Follow](https://img.shields.io/github/followers/AlekseyKorshuk?style=social)](https://github.com/AlekseyKorshuk) - -[![Follow](https://img.shields.io/twitter/follow/alekseykorshuk?style=social)](https://twitter.com/intent/follow?screen_name=alekseykorshuk) - -Star project repository: -[![GitHub stars](https://img.shields.io/github/stars/AlekseyKorshuk/accompaniment-generator?style=social)](https://github.com/AlekseyKorshuk/accompaniment-generator) -""" -st.sidebar.markdown( - """ - -

      - -

      -""", - unsafe_allow_html=True, -) - -st.sidebar.markdown(ABOUT_TEXT) -st.sidebar.markdown(CONTACT_TEXT) - - -def inference(audio, num_epoch, chord_duration): - generator = Generator() - if chord_duration == 0.0: - chord_duration = None - output_midi_data = generator(audio, num_epoch=int(num_epoch), chord_duration=chord_duration)[0] - name = uuid.uuid4() - output_midi_data.write(f'{name}.mid') - fs = FluidSynth("font.sf2") - fs.midi_to_audio(f'{name}.mid', f'{name}.wav') - fs.midi_to_audio(audio, f'{name}-init.wav') - # time.sleep(2) - print([f'{name}-init.wav', f'{name}.wav']) - return f'{name}-init.wav', f'{name}.wav' - - -st.title("Accompaniment Generator") - -st.markdown( - "App to generate accompaniment for MIDI music file with Evolutionary algorithm. Check out [project repository](https://github.com/AlekseyKorshuk/accompaniment-generator).") - -article = "

      " \ - "Github Repo" \ - "

      " - -from os import listdir -from os.path import isfile, join - -onlyfiles = [f for f in listdir("./examples") if isfile(join("./examples", f))] - -model_name = st.selectbox( - 'Select example MIDI file (will be used only for empty file field):', - onlyfiles -) - -uploaded_file = st.file_uploader( - 'Upload MIDI file:' -) - -num_epoch = st.number_input("Number of epochs:", - min_value=1, - max_value=1000, - step=1, - value=1, - ) - -chord_duration = st.number_input("Custom chord duration is seconds (leave zero for auto-calculation):", - min_value=0.0, - max_value=1000.0, - step=0.0001, - value=0.0, - format="%.4f" - ) - -generate_image_button = st.button("Generate") - -if generate_image_button: - input_file = f"./examples/{model_name}" - if uploaded_file is not None: - input_file = uploaded_file.name - with open(input_file, 'wb') as f: - f.write(uploaded_file.getvalue()) - # print(uploaded_file.getvalue()) - with st.spinner(text=f"Generating, this may take some time..."): - before, after = inference(input_file, num_epoch, chord_duration) - st.markdown("Before:") - st.audio(before) - st.markdown("After:") - st.audio(after) - if uploaded_file is not None: - os.remove(input_file) diff --git a/spaces/Alichuan/VITS-Umamusume-voice-synthesizer/mel_processing.py b/spaces/Alichuan/VITS-Umamusume-voice-synthesizer/mel_processing.py deleted file mode 100644 index 3e252e76320522a8a4195a60665168f22769aec2..0000000000000000000000000000000000000000 --- a/spaces/Alichuan/VITS-Umamusume-voice-synthesizer/mel_processing.py +++ /dev/null @@ -1,101 +0,0 @@ -import torch -import torch.utils.data -from librosa.filters import mel as librosa_mel_fn - -MAX_WAV_VALUE = 32768.0 - - -def dynamic_range_compression_torch(x, C=1, clip_val=1e-5): - """ - PARAMS - ------ - C: compression factor - """ - return torch.log(torch.clamp(x, min=clip_val) * C) - - -def dynamic_range_decompression_torch(x, C=1): - """ - PARAMS - ------ - C: compression factor used to compress - """ - return torch.exp(x) / C - - -def spectral_normalize_torch(magnitudes): - output = dynamic_range_compression_torch(magnitudes) - return output - - -def spectral_de_normalize_torch(magnitudes): - output = dynamic_range_decompression_torch(magnitudes) - return output - - -mel_basis = {} -hann_window = {} - - -def spectrogram_torch(y, n_fft, sampling_rate, hop_size, win_size, center=False): - if torch.min(y) < -1.: - print('min value is ', torch.min(y)) - if torch.max(y) > 1.: - print('max value is ', torch.max(y)) - - global hann_window - dtype_device = str(y.dtype) + '_' + str(y.device) - wnsize_dtype_device = str(win_size) + '_' + dtype_device - if wnsize_dtype_device not in hann_window: - hann_window[wnsize_dtype_device] = torch.hann_window(win_size).to(dtype=y.dtype, device=y.device) - - y = torch.nn.functional.pad(y.unsqueeze(1), (int((n_fft-hop_size)/2), int((n_fft-hop_size)/2)), mode='reflect') - y = y.squeeze(1) - - spec = torch.stft(y, n_fft, hop_length=hop_size, win_length=win_size, window=hann_window[wnsize_dtype_device], - center=center, pad_mode='reflect', normalized=False, onesided=True, return_complex=False) - - spec = torch.sqrt(spec.pow(2).sum(-1) + 1e-6) - return spec - - -def spec_to_mel_torch(spec, n_fft, num_mels, sampling_rate, fmin, fmax): - global mel_basis - dtype_device = str(spec.dtype) + '_' + str(spec.device) - fmax_dtype_device = str(fmax) + '_' + dtype_device - if fmax_dtype_device not in mel_basis: - mel = librosa_mel_fn(sampling_rate, n_fft, num_mels, fmin, fmax) - mel_basis[fmax_dtype_device] = torch.from_numpy(mel).to(dtype=spec.dtype, device=spec.device) - spec = torch.matmul(mel_basis[fmax_dtype_device], spec) - spec = spectral_normalize_torch(spec) - return spec - - -def mel_spectrogram_torch(y, n_fft, num_mels, sampling_rate, hop_size, win_size, fmin, fmax, center=False): - if torch.min(y) < -1.: - print('min value is ', torch.min(y)) - if torch.max(y) > 1.: - print('max value is ', torch.max(y)) - - global mel_basis, hann_window - dtype_device = str(y.dtype) + '_' + str(y.device) - fmax_dtype_device = str(fmax) + '_' + dtype_device - wnsize_dtype_device = str(win_size) + '_' + dtype_device - if fmax_dtype_device not in mel_basis: - mel = librosa_mel_fn(sampling_rate, n_fft, num_mels, fmin, fmax) - mel_basis[fmax_dtype_device] = torch.from_numpy(mel).to(dtype=y.dtype, device=y.device) - if wnsize_dtype_device not in hann_window: - hann_window[wnsize_dtype_device] = torch.hann_window(win_size).to(dtype=y.dtype, device=y.device) - - y = torch.nn.functional.pad(y.unsqueeze(1), (int((n_fft-hop_size)/2), int((n_fft-hop_size)/2)), mode='reflect') - y = y.squeeze(1) - - spec = torch.stft(y, n_fft, hop_length=hop_size, win_length=win_size, window=hann_window[wnsize_dtype_device], - center=center, pad_mode='reflect', normalized=False, onesided=True) - - spec = torch.sqrt(spec.pow(2).sum(-1) + 1e-6) - - spec = torch.matmul(mel_basis[fmax_dtype_device], spec) - spec = spectral_normalize_torch(spec) - - return spec diff --git a/spaces/Androidonnxfork/CivitAi-to-Diffusers/diffusers/examples/community/multilingual_stable_diffusion.py b/spaces/Androidonnxfork/CivitAi-to-Diffusers/diffusers/examples/community/multilingual_stable_diffusion.py deleted file mode 100644 index ff6c7e68f783519dc64ede847a6fd2a26209da33..0000000000000000000000000000000000000000 --- a/spaces/Androidonnxfork/CivitAi-to-Diffusers/diffusers/examples/community/multilingual_stable_diffusion.py +++ /dev/null @@ -1,436 +0,0 @@ -import inspect -from typing import Callable, List, Optional, Union - -import torch -from transformers import ( - CLIPImageProcessor, - CLIPTextModel, - CLIPTokenizer, - MBart50TokenizerFast, - MBartForConditionalGeneration, - pipeline, -) - -from diffusers import DiffusionPipeline -from diffusers.configuration_utils import FrozenDict -from diffusers.models import AutoencoderKL, UNet2DConditionModel -from diffusers.pipelines.stable_diffusion import StableDiffusionPipelineOutput -from diffusers.pipelines.stable_diffusion.safety_checker import StableDiffusionSafetyChecker -from diffusers.schedulers import DDIMScheduler, LMSDiscreteScheduler, PNDMScheduler -from diffusers.utils import deprecate, logging - - -logger = logging.get_logger(__name__) # pylint: disable=invalid-name - - -def detect_language(pipe, prompt, batch_size): - """helper function to detect language(s) of prompt""" - - if batch_size == 1: - preds = pipe(prompt, top_k=1, truncation=True, max_length=128) - return preds[0]["label"] - else: - detected_languages = [] - for p in prompt: - preds = pipe(p, top_k=1, truncation=True, max_length=128) - detected_languages.append(preds[0]["label"]) - - return detected_languages - - -def translate_prompt(prompt, translation_tokenizer, translation_model, device): - """helper function to translate prompt to English""" - - encoded_prompt = translation_tokenizer(prompt, return_tensors="pt").to(device) - generated_tokens = translation_model.generate(**encoded_prompt, max_new_tokens=1000) - en_trans = translation_tokenizer.batch_decode(generated_tokens, skip_special_tokens=True) - - return en_trans[0] - - -class MultilingualStableDiffusion(DiffusionPipeline): - r""" - Pipeline for text-to-image generation using Stable Diffusion in different languages. - - This model inherits from [`DiffusionPipeline`]. Check the superclass documentation for the generic methods the - library implements for all the pipelines (such as downloading or saving, running on a particular device, etc.) - - Args: - detection_pipeline ([`pipeline`]): - Transformers pipeline to detect prompt's language. - translation_model ([`MBartForConditionalGeneration`]): - Model to translate prompt to English, if necessary. Please refer to the - [model card](https://huggingface.co/docs/transformers/model_doc/mbart) for details. - translation_tokenizer ([`MBart50TokenizerFast`]): - Tokenizer of the translation model. - vae ([`AutoencoderKL`]): - Variational Auto-Encoder (VAE) Model to encode and decode images to and from latent representations. - text_encoder ([`CLIPTextModel`]): - Frozen text-encoder. Stable Diffusion uses the text portion of - [CLIP](https://huggingface.co/docs/transformers/model_doc/clip#transformers.CLIPTextModel), specifically - the [clip-vit-large-patch14](https://huggingface.co/openai/clip-vit-large-patch14) variant. - tokenizer (`CLIPTokenizer`): - Tokenizer of class - [CLIPTokenizer](https://huggingface.co/docs/transformers/v4.21.0/en/model_doc/clip#transformers.CLIPTokenizer). - unet ([`UNet2DConditionModel`]): Conditional U-Net architecture to denoise the encoded image latents. - scheduler ([`SchedulerMixin`]): - A scheduler to be used in combination with `unet` to denoise the encoded image latens. Can be one of - [`DDIMScheduler`], [`LMSDiscreteScheduler`], or [`PNDMScheduler`]. - safety_checker ([`StableDiffusionSafetyChecker`]): - Classification module that estimates whether generated images could be considered offensive or harmful. - Please, refer to the [model card](https://huggingface.co/runwayml/stable-diffusion-v1-5) for details. - feature_extractor ([`CLIPImageProcessor`]): - Model that extracts features from generated images to be used as inputs for the `safety_checker`. - """ - - def __init__( - self, - detection_pipeline: pipeline, - translation_model: MBartForConditionalGeneration, - translation_tokenizer: MBart50TokenizerFast, - vae: AutoencoderKL, - text_encoder: CLIPTextModel, - tokenizer: CLIPTokenizer, - unet: UNet2DConditionModel, - scheduler: Union[DDIMScheduler, PNDMScheduler, LMSDiscreteScheduler], - safety_checker: StableDiffusionSafetyChecker, - feature_extractor: CLIPImageProcessor, - ): - super().__init__() - - if hasattr(scheduler.config, "steps_offset") and scheduler.config.steps_offset != 1: - deprecation_message = ( - f"The configuration file of this scheduler: {scheduler} is outdated. `steps_offset`" - f" should be set to 1 instead of {scheduler.config.steps_offset}. Please make sure " - "to update the config accordingly as leaving `steps_offset` might led to incorrect results" - " in future versions. If you have downloaded this checkpoint from the Hugging Face Hub," - " it would be very nice if you could open a Pull request for the `scheduler/scheduler_config.json`" - " file" - ) - deprecate("steps_offset!=1", "1.0.0", deprecation_message, standard_warn=False) - new_config = dict(scheduler.config) - new_config["steps_offset"] = 1 - scheduler._internal_dict = FrozenDict(new_config) - - if safety_checker is None: - logger.warning( - f"You have disabled the safety checker for {self.__class__} by passing `safety_checker=None`. Ensure" - " that you abide to the conditions of the Stable Diffusion license and do not expose unfiltered" - " results in services or applications open to the public. Both the diffusers team and Hugging Face" - " strongly recommend to keep the safety filter enabled in all public facing circumstances, disabling" - " it only for use-cases that involve analyzing network behavior or auditing its results. For more" - " information, please have a look at https://github.com/huggingface/diffusers/pull/254 ." - ) - - self.register_modules( - detection_pipeline=detection_pipeline, - translation_model=translation_model, - translation_tokenizer=translation_tokenizer, - vae=vae, - text_encoder=text_encoder, - tokenizer=tokenizer, - unet=unet, - scheduler=scheduler, - safety_checker=safety_checker, - feature_extractor=feature_extractor, - ) - - def enable_attention_slicing(self, slice_size: Optional[Union[str, int]] = "auto"): - r""" - Enable sliced attention computation. - - When this option is enabled, the attention module will split the input tensor in slices, to compute attention - in several steps. This is useful to save some memory in exchange for a small speed decrease. - - Args: - slice_size (`str` or `int`, *optional*, defaults to `"auto"`): - When `"auto"`, halves the input to the attention heads, so attention will be computed in two steps. If - a number is provided, uses as many slices as `attention_head_dim // slice_size`. In this case, - `attention_head_dim` must be a multiple of `slice_size`. - """ - if slice_size == "auto": - # half the attention head size is usually a good trade-off between - # speed and memory - slice_size = self.unet.config.attention_head_dim // 2 - self.unet.set_attention_slice(slice_size) - - def disable_attention_slicing(self): - r""" - Disable sliced attention computation. If `enable_attention_slicing` was previously invoked, this method will go - back to computing attention in one step. - """ - # set slice_size = `None` to disable `attention slicing` - self.enable_attention_slicing(None) - - @torch.no_grad() - def __call__( - self, - prompt: Union[str, List[str]], - height: int = 512, - width: int = 512, - num_inference_steps: int = 50, - guidance_scale: float = 7.5, - negative_prompt: Optional[Union[str, List[str]]] = None, - num_images_per_prompt: Optional[int] = 1, - eta: float = 0.0, - generator: Optional[torch.Generator] = None, - latents: Optional[torch.FloatTensor] = None, - output_type: Optional[str] = "pil", - return_dict: bool = True, - callback: Optional[Callable[[int, int, torch.FloatTensor], None]] = None, - callback_steps: int = 1, - **kwargs, - ): - r""" - Function invoked when calling the pipeline for generation. - - Args: - prompt (`str` or `List[str]`): - The prompt or prompts to guide the image generation. Can be in different languages. - height (`int`, *optional*, defaults to 512): - The height in pixels of the generated image. - width (`int`, *optional*, defaults to 512): - The width in pixels of the generated image. - num_inference_steps (`int`, *optional*, defaults to 50): - The number of denoising steps. More denoising steps usually lead to a higher quality image at the - expense of slower inference. - guidance_scale (`float`, *optional*, defaults to 7.5): - Guidance scale as defined in [Classifier-Free Diffusion Guidance](https://arxiv.org/abs/2207.12598). - `guidance_scale` is defined as `w` of equation 2. of [Imagen - Paper](https://arxiv.org/pdf/2205.11487.pdf). Guidance scale is enabled by setting `guidance_scale > - 1`. Higher guidance scale encourages to generate images that are closely linked to the text `prompt`, - usually at the expense of lower image quality. - negative_prompt (`str` or `List[str]`, *optional*): - The prompt or prompts not to guide the image generation. Ignored when not using guidance (i.e., ignored - if `guidance_scale` is less than `1`). - num_images_per_prompt (`int`, *optional*, defaults to 1): - The number of images to generate per prompt. - eta (`float`, *optional*, defaults to 0.0): - Corresponds to parameter eta (η) in the DDIM paper: https://arxiv.org/abs/2010.02502. Only applies to - [`schedulers.DDIMScheduler`], will be ignored for others. - generator (`torch.Generator`, *optional*): - A [torch generator](https://pytorch.org/docs/stable/generated/torch.Generator.html) to make generation - deterministic. - latents (`torch.FloatTensor`, *optional*): - Pre-generated noisy latents, sampled from a Gaussian distribution, to be used as inputs for image - generation. Can be used to tweak the same generation with different prompts. If not provided, a latents - tensor will ge generated by sampling using the supplied random `generator`. - output_type (`str`, *optional*, defaults to `"pil"`): - The output format of the generate image. Choose between - [PIL](https://pillow.readthedocs.io/en/stable/): `PIL.Image.Image` or `np.array`. - return_dict (`bool`, *optional*, defaults to `True`): - Whether or not to return a [`~pipelines.stable_diffusion.StableDiffusionPipelineOutput`] instead of a - plain tuple. - callback (`Callable`, *optional*): - A function that will be called every `callback_steps` steps during inference. The function will be - called with the following arguments: `callback(step: int, timestep: int, latents: torch.FloatTensor)`. - callback_steps (`int`, *optional*, defaults to 1): - The frequency at which the `callback` function will be called. If not specified, the callback will be - called at every step. - - Returns: - [`~pipelines.stable_diffusion.StableDiffusionPipelineOutput`] or `tuple`: - [`~pipelines.stable_diffusion.StableDiffusionPipelineOutput`] if `return_dict` is True, otherwise a `tuple. - When returning a tuple, the first element is a list with the generated images, and the second element is a - list of `bool`s denoting whether the corresponding generated image likely represents "not-safe-for-work" - (nsfw) content, according to the `safety_checker`. - """ - if isinstance(prompt, str): - batch_size = 1 - elif isinstance(prompt, list): - batch_size = len(prompt) - else: - raise ValueError(f"`prompt` has to be of type `str` or `list` but is {type(prompt)}") - - if height % 8 != 0 or width % 8 != 0: - raise ValueError(f"`height` and `width` have to be divisible by 8 but are {height} and {width}.") - - if (callback_steps is None) or ( - callback_steps is not None and (not isinstance(callback_steps, int) or callback_steps <= 0) - ): - raise ValueError( - f"`callback_steps` has to be a positive integer but is {callback_steps} of type" - f" {type(callback_steps)}." - ) - - # detect language and translate if necessary - prompt_language = detect_language(self.detection_pipeline, prompt, batch_size) - if batch_size == 1 and prompt_language != "en": - prompt = translate_prompt(prompt, self.translation_tokenizer, self.translation_model, self.device) - - if isinstance(prompt, list): - for index in range(batch_size): - if prompt_language[index] != "en": - p = translate_prompt( - prompt[index], self.translation_tokenizer, self.translation_model, self.device - ) - prompt[index] = p - - # get prompt text embeddings - text_inputs = self.tokenizer( - prompt, - padding="max_length", - max_length=self.tokenizer.model_max_length, - return_tensors="pt", - ) - text_input_ids = text_inputs.input_ids - - if text_input_ids.shape[-1] > self.tokenizer.model_max_length: - removed_text = self.tokenizer.batch_decode(text_input_ids[:, self.tokenizer.model_max_length :]) - logger.warning( - "The following part of your input was truncated because CLIP can only handle sequences up to" - f" {self.tokenizer.model_max_length} tokens: {removed_text}" - ) - text_input_ids = text_input_ids[:, : self.tokenizer.model_max_length] - text_embeddings = self.text_encoder(text_input_ids.to(self.device))[0] - - # duplicate text embeddings for each generation per prompt, using mps friendly method - bs_embed, seq_len, _ = text_embeddings.shape - text_embeddings = text_embeddings.repeat(1, num_images_per_prompt, 1) - text_embeddings = text_embeddings.view(bs_embed * num_images_per_prompt, seq_len, -1) - - # here `guidance_scale` is defined analog to the guidance weight `w` of equation (2) - # of the Imagen paper: https://arxiv.org/pdf/2205.11487.pdf . `guidance_scale = 1` - # corresponds to doing no classifier free guidance. - do_classifier_free_guidance = guidance_scale > 1.0 - # get unconditional embeddings for classifier free guidance - if do_classifier_free_guidance: - uncond_tokens: List[str] - if negative_prompt is None: - uncond_tokens = [""] * batch_size - elif type(prompt) is not type(negative_prompt): - raise TypeError( - f"`negative_prompt` should be the same type to `prompt`, but got {type(negative_prompt)} !=" - f" {type(prompt)}." - ) - elif isinstance(negative_prompt, str): - # detect language and translate it if necessary - negative_prompt_language = detect_language(self.detection_pipeline, negative_prompt, batch_size) - if negative_prompt_language != "en": - negative_prompt = translate_prompt( - negative_prompt, self.translation_tokenizer, self.translation_model, self.device - ) - if isinstance(negative_prompt, str): - uncond_tokens = [negative_prompt] - elif batch_size != len(negative_prompt): - raise ValueError( - f"`negative_prompt`: {negative_prompt} has batch size {len(negative_prompt)}, but `prompt`:" - f" {prompt} has batch size {batch_size}. Please make sure that passed `negative_prompt` matches" - " the batch size of `prompt`." - ) - else: - # detect language and translate it if necessary - if isinstance(negative_prompt, list): - negative_prompt_languages = detect_language(self.detection_pipeline, negative_prompt, batch_size) - for index in range(batch_size): - if negative_prompt_languages[index] != "en": - p = translate_prompt( - negative_prompt[index], self.translation_tokenizer, self.translation_model, self.device - ) - negative_prompt[index] = p - uncond_tokens = negative_prompt - - max_length = text_input_ids.shape[-1] - uncond_input = self.tokenizer( - uncond_tokens, - padding="max_length", - max_length=max_length, - truncation=True, - return_tensors="pt", - ) - uncond_embeddings = self.text_encoder(uncond_input.input_ids.to(self.device))[0] - - # duplicate unconditional embeddings for each generation per prompt, using mps friendly method - seq_len = uncond_embeddings.shape[1] - uncond_embeddings = uncond_embeddings.repeat(1, num_images_per_prompt, 1) - uncond_embeddings = uncond_embeddings.view(batch_size * num_images_per_prompt, seq_len, -1) - - # For classifier free guidance, we need to do two forward passes. - # Here we concatenate the unconditional and text embeddings into a single batch - # to avoid doing two forward passes - text_embeddings = torch.cat([uncond_embeddings, text_embeddings]) - - # get the initial random noise unless the user supplied it - - # Unlike in other pipelines, latents need to be generated in the target device - # for 1-to-1 results reproducibility with the CompVis implementation. - # However this currently doesn't work in `mps`. - latents_shape = (batch_size * num_images_per_prompt, self.unet.config.in_channels, height // 8, width // 8) - latents_dtype = text_embeddings.dtype - if latents is None: - if self.device.type == "mps": - # randn does not work reproducibly on mps - latents = torch.randn(latents_shape, generator=generator, device="cpu", dtype=latents_dtype).to( - self.device - ) - else: - latents = torch.randn(latents_shape, generator=generator, device=self.device, dtype=latents_dtype) - else: - if latents.shape != latents_shape: - raise ValueError(f"Unexpected latents shape, got {latents.shape}, expected {latents_shape}") - latents = latents.to(self.device) - - # set timesteps - self.scheduler.set_timesteps(num_inference_steps) - - # Some schedulers like PNDM have timesteps as arrays - # It's more optimized to move all timesteps to correct device beforehand - timesteps_tensor = self.scheduler.timesteps.to(self.device) - - # scale the initial noise by the standard deviation required by the scheduler - latents = latents * self.scheduler.init_noise_sigma - - # prepare extra kwargs for the scheduler step, since not all schedulers have the same signature - # eta (η) is only used with the DDIMScheduler, it will be ignored for other schedulers. - # eta corresponds to η in DDIM paper: https://arxiv.org/abs/2010.02502 - # and should be between [0, 1] - accepts_eta = "eta" in set(inspect.signature(self.scheduler.step).parameters.keys()) - extra_step_kwargs = {} - if accepts_eta: - extra_step_kwargs["eta"] = eta - - for i, t in enumerate(self.progress_bar(timesteps_tensor)): - # expand the latents if we are doing classifier free guidance - latent_model_input = torch.cat([latents] * 2) if do_classifier_free_guidance else latents - latent_model_input = self.scheduler.scale_model_input(latent_model_input, t) - - # predict the noise residual - noise_pred = self.unet(latent_model_input, t, encoder_hidden_states=text_embeddings).sample - - # perform guidance - if do_classifier_free_guidance: - noise_pred_uncond, noise_pred_text = noise_pred.chunk(2) - noise_pred = noise_pred_uncond + guidance_scale * (noise_pred_text - noise_pred_uncond) - - # compute the previous noisy sample x_t -> x_t-1 - latents = self.scheduler.step(noise_pred, t, latents, **extra_step_kwargs).prev_sample - - # call the callback, if provided - if callback is not None and i % callback_steps == 0: - callback(i, t, latents) - - latents = 1 / 0.18215 * latents - image = self.vae.decode(latents).sample - - image = (image / 2 + 0.5).clamp(0, 1) - - # we always cast to float32 as this does not cause significant overhead and is compatible with bfloat16 - image = image.cpu().permute(0, 2, 3, 1).float().numpy() - - if self.safety_checker is not None: - safety_checker_input = self.feature_extractor(self.numpy_to_pil(image), return_tensors="pt").to( - self.device - ) - image, has_nsfw_concept = self.safety_checker( - images=image, clip_input=safety_checker_input.pixel_values.to(text_embeddings.dtype) - ) - else: - has_nsfw_concept = None - - if output_type == "pil": - image = self.numpy_to_pil(image) - - if not return_dict: - return (image, has_nsfw_concept) - - return StableDiffusionPipelineOutput(images=image, nsfw_content_detected=has_nsfw_concept) diff --git a/spaces/Androidonnxfork/CivitAi-to-Diffusers/diffusers/src/diffusers/commands/fp16_safetensors.py b/spaces/Androidonnxfork/CivitAi-to-Diffusers/diffusers/src/diffusers/commands/fp16_safetensors.py deleted file mode 100644 index 19553c752dce116d01f9816f90ddd3275d8cc302..0000000000000000000000000000000000000000 --- a/spaces/Androidonnxfork/CivitAi-to-Diffusers/diffusers/src/diffusers/commands/fp16_safetensors.py +++ /dev/null @@ -1,138 +0,0 @@ -# Copyright 2023 The HuggingFace Team. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -""" -Usage example: - diffusers-cli fp16_safetensors --ckpt_id=openai/shap-e --fp16 --use_safetensors -""" - -import glob -import json -from argparse import ArgumentParser, Namespace -from importlib import import_module - -import huggingface_hub -import torch -from huggingface_hub import hf_hub_download -from packaging import version - -from ..utils import is_safetensors_available, logging -from . import BaseDiffusersCLICommand - - -def conversion_command_factory(args: Namespace): - return FP16SafetensorsCommand( - args.ckpt_id, - args.fp16, - args.use_safetensors, - args.use_auth_token, - ) - - -class FP16SafetensorsCommand(BaseDiffusersCLICommand): - @staticmethod - def register_subcommand(parser: ArgumentParser): - conversion_parser = parser.add_parser("fp16_safetensors") - conversion_parser.add_argument( - "--ckpt_id", - type=str, - help="Repo id of the checkpoints on which to run the conversion. Example: 'openai/shap-e'.", - ) - conversion_parser.add_argument( - "--fp16", action="store_true", help="If serializing the variables in FP16 precision." - ) - conversion_parser.add_argument( - "--use_safetensors", action="store_true", help="If serializing in the safetensors format." - ) - conversion_parser.add_argument( - "--use_auth_token", - action="store_true", - help="When working with checkpoints having private visibility. When used `huggingface-cli login` needs to be run beforehand.", - ) - conversion_parser.set_defaults(func=conversion_command_factory) - - def __init__(self, ckpt_id: str, fp16: bool, use_safetensors: bool, use_auth_token: bool): - self.logger = logging.get_logger("diffusers-cli/fp16_safetensors") - self.ckpt_id = ckpt_id - self.local_ckpt_dir = f"/tmp/{ckpt_id}" - self.fp16 = fp16 - - if is_safetensors_available(): - self.use_safetensors = use_safetensors - else: - raise ImportError( - "When `use_safetensors` is set to True, the `safetensors` library needs to be installed. Install it via `pip install safetensors`." - ) - - if not self.use_safetensors and not self.fp16: - raise NotImplementedError( - "When `use_safetensors` and `fp16` both are False, then this command is of no use." - ) - - self.use_auth_token = use_auth_token - - def run(self): - if version.parse(huggingface_hub.__version__) < version.parse("0.9.0"): - raise ImportError( - "The huggingface_hub version must be >= 0.9.0 to use this command. Please update your huggingface_hub" - " installation." - ) - else: - from huggingface_hub import create_commit - from huggingface_hub._commit_api import CommitOperationAdd - - model_index = hf_hub_download(repo_id=self.ckpt_id, filename="model_index.json", token=self.use_auth_token) - with open(model_index, "r") as f: - pipeline_class_name = json.load(f)["_class_name"] - pipeline_class = getattr(import_module("diffusers"), pipeline_class_name) - self.logger.info(f"Pipeline class imported: {pipeline_class_name}.") - - # Load the appropriate pipeline. We could have use `DiffusionPipeline` - # here, but just to avoid any rough edge cases. - pipeline = pipeline_class.from_pretrained( - self.ckpt_id, torch_dtype=torch.float16 if self.fp16 else torch.float32, use_auth_token=self.use_auth_token - ) - pipeline.save_pretrained( - self.local_ckpt_dir, - safe_serialization=True if self.use_safetensors else False, - variant="fp16" if self.fp16 else None, - ) - self.logger.info(f"Pipeline locally saved to {self.local_ckpt_dir}.") - - # Fetch all the paths. - if self.fp16: - modified_paths = glob.glob(f"{self.local_ckpt_dir}/*/*.fp16.*") - elif self.use_safetensors: - modified_paths = glob.glob(f"{self.local_ckpt_dir}/*/*.safetensors") - - # Prepare for the PR. - commit_message = f"Serialize variables with FP16: {self.fp16} and safetensors: {self.use_safetensors}." - operations = [] - for path in modified_paths: - operations.append(CommitOperationAdd(path_in_repo="/".join(path.split("/")[4:]), path_or_fileobj=path)) - - # Open the PR. - commit_description = ( - "Variables converted by the [`diffusers`' `fp16_safetensors`" - " CLI](https://github.com/huggingface/diffusers/blob/main/src/diffusers/commands/fp16_safetensors.py)." - ) - hub_pr_url = create_commit( - repo_id=self.ckpt_id, - operations=operations, - commit_message=commit_message, - commit_description=commit_description, - repo_type="model", - create_pr=True, - ).pr_url - self.logger.info(f"PR created here: {hub_pr_url}.") diff --git a/spaces/Andy1621/uniformer_image_detection/configs/hrnet/cascade_mask_rcnn_hrnetv2p_w40_20e_coco.py b/spaces/Andy1621/uniformer_image_detection/configs/hrnet/cascade_mask_rcnn_hrnetv2p_w40_20e_coco.py deleted file mode 100644 index 29b1469fa9f455a3235b323fa3b1e39d5c095f3d..0000000000000000000000000000000000000000 --- a/spaces/Andy1621/uniformer_image_detection/configs/hrnet/cascade_mask_rcnn_hrnetv2p_w40_20e_coco.py +++ /dev/null @@ -1,11 +0,0 @@ -_base_ = './cascade_mask_rcnn_hrnetv2p_w32_20e_coco.py' -# model settings -model = dict( - pretrained='open-mmlab://msra/hrnetv2_w40', - backbone=dict( - type='HRNet', - extra=dict( - stage2=dict(num_channels=(40, 80)), - stage3=dict(num_channels=(40, 80, 160)), - stage4=dict(num_channels=(40, 80, 160, 320)))), - neck=dict(type='HRFPN', in_channels=[40, 80, 160, 320], out_channels=256)) diff --git a/spaces/Andy1621/uniformer_image_detection/configs/hrnet/mask_rcnn_hrnetv2p_w32_2x_coco.py b/spaces/Andy1621/uniformer_image_detection/configs/hrnet/mask_rcnn_hrnetv2p_w32_2x_coco.py deleted file mode 100644 index 63d5d139e7b56843f5dcc85bda48945d56cfc49e..0000000000000000000000000000000000000000 --- a/spaces/Andy1621/uniformer_image_detection/configs/hrnet/mask_rcnn_hrnetv2p_w32_2x_coco.py +++ /dev/null @@ -1,4 +0,0 @@ -_base_ = './mask_rcnn_hrnetv2p_w32_1x_coco.py' -# learning policy -lr_config = dict(step=[16, 22]) -runner = dict(type='EpochBasedRunner', max_epochs=24) diff --git a/spaces/Andy1621/uniformer_image_detection/configs/mask_rcnn/mask_rcnn_x101_32x4d_fpn_1x_coco.py b/spaces/Andy1621/uniformer_image_detection/configs/mask_rcnn/mask_rcnn_x101_32x4d_fpn_1x_coco.py deleted file mode 100644 index d0016d1f1df4534ae27de95c4f7ec9976b3ab6d0..0000000000000000000000000000000000000000 --- a/spaces/Andy1621/uniformer_image_detection/configs/mask_rcnn/mask_rcnn_x101_32x4d_fpn_1x_coco.py +++ /dev/null @@ -1,13 +0,0 @@ -_base_ = './mask_rcnn_r101_fpn_1x_coco.py' -model = dict( - pretrained='open-mmlab://resnext101_32x4d', - backbone=dict( - type='ResNeXt', - depth=101, - groups=32, - base_width=4, - num_stages=4, - out_indices=(0, 1, 2, 3), - frozen_stages=1, - norm_cfg=dict(type='BN', requires_grad=True), - style='pytorch')) diff --git a/spaces/Andy1621/uniformer_image_detection/configs/retinanet/retinanet_r101_caffe_fpn_1x_coco.py b/spaces/Andy1621/uniformer_image_detection/configs/retinanet/retinanet_r101_caffe_fpn_1x_coco.py deleted file mode 100644 index 21d227b044728a30890b93fc769743d2124956c1..0000000000000000000000000000000000000000 --- a/spaces/Andy1621/uniformer_image_detection/configs/retinanet/retinanet_r101_caffe_fpn_1x_coco.py +++ /dev/null @@ -1,4 +0,0 @@ -_base_ = './retinanet_r50_caffe_fpn_1x_coco.py' -model = dict( - pretrained='open-mmlab://detectron2/resnet101_caffe', - backbone=dict(depth=101)) diff --git a/spaces/Andy1621/uniformer_image_segmentation/configs/hrnet/fcn_hr18s_512x512_160k_ade20k.py b/spaces/Andy1621/uniformer_image_segmentation/configs/hrnet/fcn_hr18s_512x512_160k_ade20k.py deleted file mode 100644 index 22a3ce0b38f36efc96595fe1c3ef428fc1575eb0..0000000000000000000000000000000000000000 --- a/spaces/Andy1621/uniformer_image_segmentation/configs/hrnet/fcn_hr18s_512x512_160k_ade20k.py +++ /dev/null @@ -1,9 +0,0 @@ -_base_ = './fcn_hr18_512x512_160k_ade20k.py' -model = dict( - pretrained='open-mmlab://msra/hrnetv2_w18_small', - backbone=dict( - extra=dict( - stage1=dict(num_blocks=(2, )), - stage2=dict(num_blocks=(2, 2)), - stage3=dict(num_modules=3, num_blocks=(2, 2, 2)), - stage4=dict(num_modules=2, num_blocks=(2, 2, 2, 2))))) diff --git a/spaces/AnimalEquality/chatbot/nbs/styles.css b/spaces/AnimalEquality/chatbot/nbs/styles.css deleted file mode 100644 index 66ccc49ee8f0e73901dac02dc4e9224b7d1b2c78..0000000000000000000000000000000000000000 --- a/spaces/AnimalEquality/chatbot/nbs/styles.css +++ /dev/null @@ -1,37 +0,0 @@ -.cell { - margin-bottom: 1rem; -} - -.cell > .sourceCode { - margin-bottom: 0; -} - -.cell-output > pre { - margin-bottom: 0; -} - -.cell-output > pre, .cell-output > .sourceCode > pre, .cell-output-stdout > pre { - margin-left: 0.8rem; - margin-top: 0; - background: none; - border-left: 2px solid lightsalmon; - border-top-left-radius: 0; - border-top-right-radius: 0; -} - -.cell-output > .sourceCode { - border: none; -} - -.cell-output > .sourceCode { - background: none; - margin-top: 0; -} - -div.description { - padding-left: 2px; - padding-top: 5px; - font-style: italic; - font-size: 135%; - opacity: 70%; -} diff --git a/spaces/Artrajz/vits-simple-api/bert_vits2/modules.py b/spaces/Artrajz/vits-simple-api/bert_vits2/modules.py deleted file mode 100644 index 9206f95b0037251225eddc1d64b60f749155135c..0000000000000000000000000000000000000000 --- a/spaces/Artrajz/vits-simple-api/bert_vits2/modules.py +++ /dev/null @@ -1,459 +0,0 @@ -import copy -import math -import numpy as np -import scipy -import torch -from torch import nn -from torch.nn import functional as F - -from torch.nn import Conv1d, ConvTranspose1d, AvgPool1d, Conv2d -from torch.nn.utils import weight_norm, remove_weight_norm - -from bert_vits2 import commons -from bert_vits2.commons import init_weights, get_padding -from bert_vits2.transforms import piecewise_rational_quadratic_transform -from bert_vits2.attentions import Encoder - -LRELU_SLOPE = 0.1 - - -class LayerNorm(nn.Module): - def __init__(self, channels, eps=1e-5): - super().__init__() - self.channels = channels - self.eps = eps - - self.gamma = nn.Parameter(torch.ones(channels)) - self.beta = nn.Parameter(torch.zeros(channels)) - - def forward(self, x): - x = x.transpose(1, -1) - x = F.layer_norm(x, (self.channels,), self.gamma, self.beta, self.eps) - return x.transpose(1, -1) - - -class ConvReluNorm(nn.Module): - def __init__(self, in_channels, hidden_channels, out_channels, kernel_size, n_layers, p_dropout): - super().__init__() - self.in_channels = in_channels - self.hidden_channels = hidden_channels - self.out_channels = out_channels - self.kernel_size = kernel_size - self.n_layers = n_layers - self.p_dropout = p_dropout - assert n_layers > 1, "Number of layers should be larger than 0." - - self.conv_layers = nn.ModuleList() - self.norm_layers = nn.ModuleList() - self.conv_layers.append(nn.Conv1d(in_channels, hidden_channels, kernel_size, padding=kernel_size // 2)) - self.norm_layers.append(LayerNorm(hidden_channels)) - self.relu_drop = nn.Sequential( - nn.ReLU(), - nn.Dropout(p_dropout)) - for _ in range(n_layers - 1): - self.conv_layers.append(nn.Conv1d(hidden_channels, hidden_channels, kernel_size, padding=kernel_size // 2)) - self.norm_layers.append(LayerNorm(hidden_channels)) - self.proj = nn.Conv1d(hidden_channels, out_channels, 1) - self.proj.weight.data.zero_() - self.proj.bias.data.zero_() - - def forward(self, x, x_mask): - x_org = x - for i in range(self.n_layers): - x = self.conv_layers[i](x * x_mask) - x = self.norm_layers[i](x) - x = self.relu_drop(x) - x = x_org + self.proj(x) - return x * x_mask - - -class DDSConv(nn.Module): - """ - Dialted and Depth-Separable Convolution - """ - - def __init__(self, channels, kernel_size, n_layers, p_dropout=0.): - super().__init__() - self.channels = channels - self.kernel_size = kernel_size - self.n_layers = n_layers - self.p_dropout = p_dropout - - self.drop = nn.Dropout(p_dropout) - self.convs_sep = nn.ModuleList() - self.convs_1x1 = nn.ModuleList() - self.norms_1 = nn.ModuleList() - self.norms_2 = nn.ModuleList() - for i in range(n_layers): - dilation = kernel_size ** i - padding = (kernel_size * dilation - dilation) // 2 - self.convs_sep.append(nn.Conv1d(channels, channels, kernel_size, - groups=channels, dilation=dilation, padding=padding - )) - self.convs_1x1.append(nn.Conv1d(channels, channels, 1)) - self.norms_1.append(LayerNorm(channels)) - self.norms_2.append(LayerNorm(channels)) - - def forward(self, x, x_mask, g=None): - if g is not None: - x = x + g - for i in range(self.n_layers): - y = self.convs_sep[i](x * x_mask) - y = self.norms_1[i](y) - y = F.gelu(y) - y = self.convs_1x1[i](y) - y = self.norms_2[i](y) - y = F.gelu(y) - y = self.drop(y) - x = x + y - return x * x_mask - - -class WN(torch.nn.Module): - def __init__(self, hidden_channels, kernel_size, dilation_rate, n_layers, gin_channels=0, p_dropout=0): - super(WN, self).__init__() - assert (kernel_size % 2 == 1) - self.hidden_channels = hidden_channels - self.kernel_size = kernel_size, - self.dilation_rate = dilation_rate - self.n_layers = n_layers - self.gin_channels = gin_channels - self.p_dropout = p_dropout - - self.in_layers = torch.nn.ModuleList() - self.res_skip_layers = torch.nn.ModuleList() - self.drop = nn.Dropout(p_dropout) - - if gin_channels != 0: - cond_layer = torch.nn.Conv1d(gin_channels, 2 * hidden_channels * n_layers, 1) - self.cond_layer = torch.nn.utils.weight_norm(cond_layer, name='weight') - - for i in range(n_layers): - dilation = dilation_rate ** i - padding = int((kernel_size * dilation - dilation) / 2) - in_layer = torch.nn.Conv1d(hidden_channels, 2 * hidden_channels, kernel_size, - dilation=dilation, padding=padding) - in_layer = torch.nn.utils.weight_norm(in_layer, name='weight') - self.in_layers.append(in_layer) - - # last one is not necessary - if i < n_layers - 1: - res_skip_channels = 2 * hidden_channels - else: - res_skip_channels = hidden_channels - - res_skip_layer = torch.nn.Conv1d(hidden_channels, res_skip_channels, 1) - res_skip_layer = torch.nn.utils.weight_norm(res_skip_layer, name='weight') - self.res_skip_layers.append(res_skip_layer) - - def forward(self, x, x_mask, g=None, **kwargs): - output = torch.zeros_like(x) - n_channels_tensor = torch.IntTensor([self.hidden_channels]) - - if g is not None: - g = self.cond_layer(g) - - for i in range(self.n_layers): - x_in = self.in_layers[i](x) - if g is not None: - cond_offset = i * 2 * self.hidden_channels - g_l = g[:, cond_offset:cond_offset + 2 * self.hidden_channels, :] - else: - g_l = torch.zeros_like(x_in) - - acts = commons.fused_add_tanh_sigmoid_multiply( - x_in, - g_l, - n_channels_tensor) - acts = self.drop(acts) - - res_skip_acts = self.res_skip_layers[i](acts) - if i < self.n_layers - 1: - res_acts = res_skip_acts[:, :self.hidden_channels, :] - x = (x + res_acts) * x_mask - output = output + res_skip_acts[:, self.hidden_channels:, :] - else: - output = output + res_skip_acts - return output * x_mask - - def remove_weight_norm(self): - if self.gin_channels != 0: - torch.nn.utils.remove_weight_norm(self.cond_layer) - for l in self.in_layers: - torch.nn.utils.remove_weight_norm(l) - for l in self.res_skip_layers: - torch.nn.utils.remove_weight_norm(l) - - -class ResBlock1(torch.nn.Module): - def __init__(self, channels, kernel_size=3, dilation=(1, 3, 5)): - super(ResBlock1, self).__init__() - self.convs1 = nn.ModuleList([ - weight_norm(Conv1d(channels, channels, kernel_size, 1, dilation=dilation[0], - padding=get_padding(kernel_size, dilation[0]))), - weight_norm(Conv1d(channels, channels, kernel_size, 1, dilation=dilation[1], - padding=get_padding(kernel_size, dilation[1]))), - weight_norm(Conv1d(channels, channels, kernel_size, 1, dilation=dilation[2], - padding=get_padding(kernel_size, dilation[2]))) - ]) - self.convs1.apply(init_weights) - - self.convs2 = nn.ModuleList([ - weight_norm(Conv1d(channels, channels, kernel_size, 1, dilation=1, - padding=get_padding(kernel_size, 1))), - weight_norm(Conv1d(channels, channels, kernel_size, 1, dilation=1, - padding=get_padding(kernel_size, 1))), - weight_norm(Conv1d(channels, channels, kernel_size, 1, dilation=1, - padding=get_padding(kernel_size, 1))) - ]) - self.convs2.apply(init_weights) - - def forward(self, x, x_mask=None): - for c1, c2 in zip(self.convs1, self.convs2): - xt = F.leaky_relu(x, LRELU_SLOPE) - if x_mask is not None: - xt = xt * x_mask - xt = c1(xt) - xt = F.leaky_relu(xt, LRELU_SLOPE) - if x_mask is not None: - xt = xt * x_mask - xt = c2(xt) - x = xt + x - if x_mask is not None: - x = x * x_mask - return x - - def remove_weight_norm(self): - for l in self.convs1: - remove_weight_norm(l) - for l in self.convs2: - remove_weight_norm(l) - - -class ResBlock2(torch.nn.Module): - def __init__(self, channels, kernel_size=3, dilation=(1, 3)): - super(ResBlock2, self).__init__() - self.convs = nn.ModuleList([ - weight_norm(Conv1d(channels, channels, kernel_size, 1, dilation=dilation[0], - padding=get_padding(kernel_size, dilation[0]))), - weight_norm(Conv1d(channels, channels, kernel_size, 1, dilation=dilation[1], - padding=get_padding(kernel_size, dilation[1]))) - ]) - self.convs.apply(init_weights) - - def forward(self, x, x_mask=None): - for c in self.convs: - xt = F.leaky_relu(x, LRELU_SLOPE) - if x_mask is not None: - xt = xt * x_mask - xt = c(xt) - x = xt + x - if x_mask is not None: - x = x * x_mask - return x - - def remove_weight_norm(self): - for l in self.convs: - remove_weight_norm(l) - - -class Log(nn.Module): - def forward(self, x, x_mask, reverse=False, **kwargs): - if not reverse: - y = torch.log(torch.clamp_min(x, 1e-5)) * x_mask - logdet = torch.sum(-y, [1, 2]) - return y, logdet - else: - x = torch.exp(x) * x_mask - return x - - -class Flip(nn.Module): - def forward(self, x, *args, reverse=False, **kwargs): - x = torch.flip(x, [1]) - if not reverse: - logdet = torch.zeros(x.size(0)).to(dtype=x.dtype, device=x.device) - return x, logdet - else: - return x - - -class ElementwiseAffine(nn.Module): - def __init__(self, channels): - super().__init__() - self.channels = channels - self.m = nn.Parameter(torch.zeros(channels, 1)) - self.logs = nn.Parameter(torch.zeros(channels, 1)) - - def forward(self, x, x_mask, reverse=False, **kwargs): - if not reverse: - y = self.m + torch.exp(self.logs) * x - y = y * x_mask - logdet = torch.sum(self.logs * x_mask, [1, 2]) - return y, logdet - else: - x = (x - self.m) * torch.exp(-self.logs) * x_mask - return x - - -class ResidualCouplingLayer(nn.Module): - def __init__(self, - channels, - hidden_channels, - kernel_size, - dilation_rate, - n_layers, - p_dropout=0, - gin_channels=0, - mean_only=False): - assert channels % 2 == 0, "channels should be divisible by 2" - super().__init__() - self.channels = channels - self.hidden_channels = hidden_channels - self.kernel_size = kernel_size - self.dilation_rate = dilation_rate - self.n_layers = n_layers - self.half_channels = channels // 2 - self.mean_only = mean_only - - self.pre = nn.Conv1d(self.half_channels, hidden_channels, 1) - self.enc = WN(hidden_channels, kernel_size, dilation_rate, n_layers, p_dropout=p_dropout, - gin_channels=gin_channels) - self.post = nn.Conv1d(hidden_channels, self.half_channels * (2 - mean_only), 1) - self.post.weight.data.zero_() - self.post.bias.data.zero_() - - def forward(self, x, x_mask, g=None, reverse=False): - x0, x1 = torch.split(x, [self.half_channels] * 2, 1) - h = self.pre(x0) * x_mask - h = self.enc(h, x_mask, g=g) - stats = self.post(h) * x_mask - if not self.mean_only: - m, logs = torch.split(stats, [self.half_channels] * 2, 1) - else: - m = stats - logs = torch.zeros_like(m) - - if not reverse: - x1 = m + x1 * torch.exp(logs) * x_mask - x = torch.cat([x0, x1], 1) - logdet = torch.sum(logs, [1, 2]) - return x, logdet - else: - x1 = (x1 - m) * torch.exp(-logs) * x_mask - x = torch.cat([x0, x1], 1) - return x - - -class ConvFlow(nn.Module): - def __init__(self, in_channels, filter_channels, kernel_size, n_layers, num_bins=10, tail_bound=5.0): - super().__init__() - self.in_channels = in_channels - self.filter_channels = filter_channels - self.kernel_size = kernel_size - self.n_layers = n_layers - self.num_bins = num_bins - self.tail_bound = tail_bound - self.half_channels = in_channels // 2 - - self.pre = nn.Conv1d(self.half_channels, filter_channels, 1) - self.convs = DDSConv(filter_channels, kernel_size, n_layers, p_dropout=0.) - self.proj = nn.Conv1d(filter_channels, self.half_channels * (num_bins * 3 - 1), 1) - self.proj.weight.data.zero_() - self.proj.bias.data.zero_() - - def forward(self, x, x_mask, g=None, reverse=False): - x0, x1 = torch.split(x, [self.half_channels] * 2, 1) - h = self.pre(x0) - h = self.convs(h, x_mask, g=g) - h = self.proj(h) * x_mask - - b, c, t = x0.shape - h = h.reshape(b, c, -1, t).permute(0, 1, 3, 2) # [b, cx?, t] -> [b, c, t, ?] - - unnormalized_widths = h[..., :self.num_bins] / math.sqrt(self.filter_channels) - unnormalized_heights = h[..., self.num_bins:2 * self.num_bins] / math.sqrt(self.filter_channels) - unnormalized_derivatives = h[..., 2 * self.num_bins:] - - x1, logabsdet = piecewise_rational_quadratic_transform(x1, - unnormalized_widths, - unnormalized_heights, - unnormalized_derivatives, - inverse=reverse, - tails='linear', - tail_bound=self.tail_bound - ) - - x = torch.cat([x0, x1], 1) * x_mask - logdet = torch.sum(logabsdet * x_mask, [1, 2]) - if not reverse: - return x, logdet - else: - return x - - -class TransformerCouplingLayer(nn.Module): - def __init__(self, - channels, - hidden_channels, - kernel_size, - n_layers, - n_heads, - p_dropout=0, - filter_channels=0, - mean_only=False, - wn_sharing_parameter=None, - gin_channels=0 - ): - assert channels % 2 == 0, "channels should be divisible by 2" - super().__init__() - self.channels = channels - self.hidden_channels = hidden_channels - self.kernel_size = kernel_size - self.n_layers = n_layers - self.half_channels = channels // 2 - self.mean_only = mean_only - - self.pre = nn.Conv1d(self.half_channels, hidden_channels, 1) - self.enc = Encoder(hidden_channels, filter_channels, n_heads, n_layers, kernel_size, p_dropout, isflow=True, - gin_channels=gin_channels) if wn_sharing_parameter is None else wn_sharing_parameter - self.post = nn.Conv1d(hidden_channels, self.half_channels * (2 - mean_only), 1) - self.post.weight.data.zero_() - self.post.bias.data.zero_() - - def forward(self, x, x_mask, g=None, reverse=False): - x0, x1 = torch.split(x, [self.half_channels] * 2, 1) - h = self.pre(x0) * x_mask - h = self.enc(h, x_mask, g=g) - stats = self.post(h) * x_mask - if not self.mean_only: - m, logs = torch.split(stats, [self.half_channels] * 2, 1) - else: - m = stats - logs = torch.zeros_like(m) - - if not reverse: - x1 = m + x1 * torch.exp(logs) * x_mask - x = torch.cat([x0, x1], 1) - logdet = torch.sum(logs, [1, 2]) - return x, logdet - else: - x1 = (x1 - m) * torch.exp(-logs) * x_mask - x = torch.cat([x0, x1], 1) - return x - - x1, logabsdet = piecewise_rational_quadratic_transform(x1, - unnormalized_widths, - unnormalized_heights, - unnormalized_derivatives, - inverse=reverse, - tails='linear', - tail_bound=self.tail_bound - ) - - x = torch.cat([x0, x1], 1) * x_mask - logdet = torch.sum(logabsdet * x_mask, [1, 2]) - if not reverse: - return x, logdet - else: - return x diff --git a/spaces/Ataturk-Chatbot/HuggingFaceChat/venv/lib/python3.11/site-packages/pip/_vendor/pygments/cmdline.py b/spaces/Ataturk-Chatbot/HuggingFaceChat/venv/lib/python3.11/site-packages/pip/_vendor/pygments/cmdline.py deleted file mode 100644 index de73b06b4cfa3b68a25455148c7e086b32676e95..0000000000000000000000000000000000000000 --- a/spaces/Ataturk-Chatbot/HuggingFaceChat/venv/lib/python3.11/site-packages/pip/_vendor/pygments/cmdline.py +++ /dev/null @@ -1,668 +0,0 @@ -""" - pygments.cmdline - ~~~~~~~~~~~~~~~~ - - Command line interface. - - :copyright: Copyright 2006-2022 by the Pygments team, see AUTHORS. - :license: BSD, see LICENSE for details. -""" - -import os -import sys -import shutil -import argparse -from textwrap import dedent - -from pip._vendor.pygments import __version__, highlight -from pip._vendor.pygments.util import ClassNotFound, OptionError, docstring_headline, \ - guess_decode, guess_decode_from_terminal, terminal_encoding, \ - UnclosingTextIOWrapper -from pip._vendor.pygments.lexers import get_all_lexers, get_lexer_by_name, guess_lexer, \ - load_lexer_from_file, get_lexer_for_filename, find_lexer_class_for_filename -from pip._vendor.pygments.lexers.special import TextLexer -from pip._vendor.pygments.formatters.latex import LatexEmbeddedLexer, LatexFormatter -from pip._vendor.pygments.formatters import get_all_formatters, get_formatter_by_name, \ - load_formatter_from_file, get_formatter_for_filename, find_formatter_class -from pip._vendor.pygments.formatters.terminal import TerminalFormatter -from pip._vendor.pygments.formatters.terminal256 import Terminal256Formatter, TerminalTrueColorFormatter -from pip._vendor.pygments.filters import get_all_filters, find_filter_class -from pip._vendor.pygments.styles import get_all_styles, get_style_by_name - - -def _parse_options(o_strs): - opts = {} - if not o_strs: - return opts - for o_str in o_strs: - if not o_str.strip(): - continue - o_args = o_str.split(',') - for o_arg in o_args: - o_arg = o_arg.strip() - try: - o_key, o_val = o_arg.split('=', 1) - o_key = o_key.strip() - o_val = o_val.strip() - except ValueError: - opts[o_arg] = True - else: - opts[o_key] = o_val - return opts - - -def _parse_filters(f_strs): - filters = [] - if not f_strs: - return filters - for f_str in f_strs: - if ':' in f_str: - fname, fopts = f_str.split(':', 1) - filters.append((fname, _parse_options([fopts]))) - else: - filters.append((f_str, {})) - return filters - - -def _print_help(what, name): - try: - if what == 'lexer': - cls = get_lexer_by_name(name) - print("Help on the %s lexer:" % cls.name) - print(dedent(cls.__doc__)) - elif what == 'formatter': - cls = find_formatter_class(name) - print("Help on the %s formatter:" % cls.name) - print(dedent(cls.__doc__)) - elif what == 'filter': - cls = find_filter_class(name) - print("Help on the %s filter:" % name) - print(dedent(cls.__doc__)) - return 0 - except (AttributeError, ValueError): - print("%s not found!" % what, file=sys.stderr) - return 1 - - -def _print_list(what): - if what == 'lexer': - print() - print("Lexers:") - print("~~~~~~~") - - info = [] - for fullname, names, exts, _ in get_all_lexers(): - tup = (', '.join(names)+':', fullname, - exts and '(filenames ' + ', '.join(exts) + ')' or '') - info.append(tup) - info.sort() - for i in info: - print(('* %s\n %s %s') % i) - - elif what == 'formatter': - print() - print("Formatters:") - print("~~~~~~~~~~~") - - info = [] - for cls in get_all_formatters(): - doc = docstring_headline(cls) - tup = (', '.join(cls.aliases) + ':', doc, cls.filenames and - '(filenames ' + ', '.join(cls.filenames) + ')' or '') - info.append(tup) - info.sort() - for i in info: - print(('* %s\n %s %s') % i) - - elif what == 'filter': - print() - print("Filters:") - print("~~~~~~~~") - - for name in get_all_filters(): - cls = find_filter_class(name) - print("* " + name + ':') - print(" %s" % docstring_headline(cls)) - - elif what == 'style': - print() - print("Styles:") - print("~~~~~~~") - - for name in get_all_styles(): - cls = get_style_by_name(name) - print("* " + name + ':') - print(" %s" % docstring_headline(cls)) - - -def _print_list_as_json(requested_items): - import json - result = {} - if 'lexer' in requested_items: - info = {} - for fullname, names, filenames, mimetypes in get_all_lexers(): - info[fullname] = { - 'aliases': names, - 'filenames': filenames, - 'mimetypes': mimetypes - } - result['lexers'] = info - - if 'formatter' in requested_items: - info = {} - for cls in get_all_formatters(): - doc = docstring_headline(cls) - info[cls.name] = { - 'aliases': cls.aliases, - 'filenames': cls.filenames, - 'doc': doc - } - result['formatters'] = info - - if 'filter' in requested_items: - info = {} - for name in get_all_filters(): - cls = find_filter_class(name) - info[name] = { - 'doc': docstring_headline(cls) - } - result['filters'] = info - - if 'style' in requested_items: - info = {} - for name in get_all_styles(): - cls = get_style_by_name(name) - info[name] = { - 'doc': docstring_headline(cls) - } - result['styles'] = info - - json.dump(result, sys.stdout) - -def main_inner(parser, argns): - if argns.help: - parser.print_help() - return 0 - - if argns.V: - print('Pygments version %s, (c) 2006-2022 by Georg Brandl, Matthäus ' - 'Chajdas and contributors.' % __version__) - return 0 - - def is_only_option(opt): - return not any(v for (k, v) in vars(argns).items() if k != opt) - - # handle ``pygmentize -L`` - if argns.L is not None: - arg_set = set() - for k, v in vars(argns).items(): - if v: - arg_set.add(k) - - arg_set.discard('L') - arg_set.discard('json') - - if arg_set: - parser.print_help(sys.stderr) - return 2 - - # print version - if not argns.json: - main(['', '-V']) - allowed_types = {'lexer', 'formatter', 'filter', 'style'} - largs = [arg.rstrip('s') for arg in argns.L] - if any(arg not in allowed_types for arg in largs): - parser.print_help(sys.stderr) - return 0 - if not largs: - largs = allowed_types - if not argns.json: - for arg in largs: - _print_list(arg) - else: - _print_list_as_json(largs) - return 0 - - # handle ``pygmentize -H`` - if argns.H: - if not is_only_option('H'): - parser.print_help(sys.stderr) - return 2 - what, name = argns.H - if what not in ('lexer', 'formatter', 'filter'): - parser.print_help(sys.stderr) - return 2 - return _print_help(what, name) - - # parse -O options - parsed_opts = _parse_options(argns.O or []) - - # parse -P options - for p_opt in argns.P or []: - try: - name, value = p_opt.split('=', 1) - except ValueError: - parsed_opts[p_opt] = True - else: - parsed_opts[name] = value - - # encodings - inencoding = parsed_opts.get('inencoding', parsed_opts.get('encoding')) - outencoding = parsed_opts.get('outencoding', parsed_opts.get('encoding')) - - # handle ``pygmentize -N`` - if argns.N: - lexer = find_lexer_class_for_filename(argns.N) - if lexer is None: - lexer = TextLexer - - print(lexer.aliases[0]) - return 0 - - # handle ``pygmentize -C`` - if argns.C: - inp = sys.stdin.buffer.read() - try: - lexer = guess_lexer(inp, inencoding=inencoding) - except ClassNotFound: - lexer = TextLexer - - print(lexer.aliases[0]) - return 0 - - # handle ``pygmentize -S`` - S_opt = argns.S - a_opt = argns.a - if S_opt is not None: - f_opt = argns.f - if not f_opt: - parser.print_help(sys.stderr) - return 2 - if argns.l or argns.INPUTFILE: - parser.print_help(sys.stderr) - return 2 - - try: - parsed_opts['style'] = S_opt - fmter = get_formatter_by_name(f_opt, **parsed_opts) - except ClassNotFound as err: - print(err, file=sys.stderr) - return 1 - - print(fmter.get_style_defs(a_opt or '')) - return 0 - - # if no -S is given, -a is not allowed - if argns.a is not None: - parser.print_help(sys.stderr) - return 2 - - # parse -F options - F_opts = _parse_filters(argns.F or []) - - # -x: allow custom (eXternal) lexers and formatters - allow_custom_lexer_formatter = bool(argns.x) - - # select lexer - lexer = None - - # given by name? - lexername = argns.l - if lexername: - # custom lexer, located relative to user's cwd - if allow_custom_lexer_formatter and '.py' in lexername: - try: - filename = None - name = None - if ':' in lexername: - filename, name = lexername.rsplit(':', 1) - - if '.py' in name: - # This can happen on Windows: If the lexername is - # C:\lexer.py -- return to normal load path in that case - name = None - - if filename and name: - lexer = load_lexer_from_file(filename, name, - **parsed_opts) - else: - lexer = load_lexer_from_file(lexername, **parsed_opts) - except ClassNotFound as err: - print('Error:', err, file=sys.stderr) - return 1 - else: - try: - lexer = get_lexer_by_name(lexername, **parsed_opts) - except (OptionError, ClassNotFound) as err: - print('Error:', err, file=sys.stderr) - return 1 - - # read input code - code = None - - if argns.INPUTFILE: - if argns.s: - print('Error: -s option not usable when input file specified', - file=sys.stderr) - return 2 - - infn = argns.INPUTFILE - try: - with open(infn, 'rb') as infp: - code = infp.read() - except Exception as err: - print('Error: cannot read infile:', err, file=sys.stderr) - return 1 - if not inencoding: - code, inencoding = guess_decode(code) - - # do we have to guess the lexer? - if not lexer: - try: - lexer = get_lexer_for_filename(infn, code, **parsed_opts) - except ClassNotFound as err: - if argns.g: - try: - lexer = guess_lexer(code, **parsed_opts) - except ClassNotFound: - lexer = TextLexer(**parsed_opts) - else: - print('Error:', err, file=sys.stderr) - return 1 - except OptionError as err: - print('Error:', err, file=sys.stderr) - return 1 - - elif not argns.s: # treat stdin as full file (-s support is later) - # read code from terminal, always in binary mode since we want to - # decode ourselves and be tolerant with it - code = sys.stdin.buffer.read() # use .buffer to get a binary stream - if not inencoding: - code, inencoding = guess_decode_from_terminal(code, sys.stdin) - # else the lexer will do the decoding - if not lexer: - try: - lexer = guess_lexer(code, **parsed_opts) - except ClassNotFound: - lexer = TextLexer(**parsed_opts) - - else: # -s option needs a lexer with -l - if not lexer: - print('Error: when using -s a lexer has to be selected with -l', - file=sys.stderr) - return 2 - - # process filters - for fname, fopts in F_opts: - try: - lexer.add_filter(fname, **fopts) - except ClassNotFound as err: - print('Error:', err, file=sys.stderr) - return 1 - - # select formatter - outfn = argns.o - fmter = argns.f - if fmter: - # custom formatter, located relative to user's cwd - if allow_custom_lexer_formatter and '.py' in fmter: - try: - filename = None - name = None - if ':' in fmter: - # Same logic as above for custom lexer - filename, name = fmter.rsplit(':', 1) - - if '.py' in name: - name = None - - if filename and name: - fmter = load_formatter_from_file(filename, name, - **parsed_opts) - else: - fmter = load_formatter_from_file(fmter, **parsed_opts) - except ClassNotFound as err: - print('Error:', err, file=sys.stderr) - return 1 - else: - try: - fmter = get_formatter_by_name(fmter, **parsed_opts) - except (OptionError, ClassNotFound) as err: - print('Error:', err, file=sys.stderr) - return 1 - - if outfn: - if not fmter: - try: - fmter = get_formatter_for_filename(outfn, **parsed_opts) - except (OptionError, ClassNotFound) as err: - print('Error:', err, file=sys.stderr) - return 1 - try: - outfile = open(outfn, 'wb') - except Exception as err: - print('Error: cannot open outfile:', err, file=sys.stderr) - return 1 - else: - if not fmter: - if os.environ.get('COLORTERM','') in ('truecolor', '24bit'): - fmter = TerminalTrueColorFormatter(**parsed_opts) - elif '256' in os.environ.get('TERM', ''): - fmter = Terminal256Formatter(**parsed_opts) - else: - fmter = TerminalFormatter(**parsed_opts) - outfile = sys.stdout.buffer - - # determine output encoding if not explicitly selected - if not outencoding: - if outfn: - # output file? use lexer encoding for now (can still be None) - fmter.encoding = inencoding - else: - # else use terminal encoding - fmter.encoding = terminal_encoding(sys.stdout) - - # provide coloring under Windows, if possible - if not outfn and sys.platform in ('win32', 'cygwin') and \ - fmter.name in ('Terminal', 'Terminal256'): # pragma: no cover - # unfortunately colorama doesn't support binary streams on Py3 - outfile = UnclosingTextIOWrapper(outfile, encoding=fmter.encoding) - fmter.encoding = None - try: - import pip._vendor.colorama.initialise as colorama_initialise - except ImportError: - pass - else: - outfile = colorama_initialise.wrap_stream( - outfile, convert=None, strip=None, autoreset=False, wrap=True) - - # When using the LaTeX formatter and the option `escapeinside` is - # specified, we need a special lexer which collects escaped text - # before running the chosen language lexer. - escapeinside = parsed_opts.get('escapeinside', '') - if len(escapeinside) == 2 and isinstance(fmter, LatexFormatter): - left = escapeinside[0] - right = escapeinside[1] - lexer = LatexEmbeddedLexer(left, right, lexer) - - # ... and do it! - if not argns.s: - # process whole input as per normal... - try: - highlight(code, lexer, fmter, outfile) - finally: - if outfn: - outfile.close() - return 0 - else: - # line by line processing of stdin (eg: for 'tail -f')... - try: - while 1: - line = sys.stdin.buffer.readline() - if not line: - break - if not inencoding: - line = guess_decode_from_terminal(line, sys.stdin)[0] - highlight(line, lexer, fmter, outfile) - if hasattr(outfile, 'flush'): - outfile.flush() - return 0 - except KeyboardInterrupt: # pragma: no cover - return 0 - finally: - if outfn: - outfile.close() - - -class HelpFormatter(argparse.HelpFormatter): - def __init__(self, prog, indent_increment=2, max_help_position=16, width=None): - if width is None: - try: - width = shutil.get_terminal_size().columns - 2 - except Exception: - pass - argparse.HelpFormatter.__init__(self, prog, indent_increment, - max_help_position, width) - - -def main(args=sys.argv): - """ - Main command line entry point. - """ - desc = "Highlight an input file and write the result to an output file." - parser = argparse.ArgumentParser(description=desc, add_help=False, - formatter_class=HelpFormatter) - - operation = parser.add_argument_group('Main operation') - lexersel = operation.add_mutually_exclusive_group() - lexersel.add_argument( - '-l', metavar='LEXER', - help='Specify the lexer to use. (Query names with -L.) If not ' - 'given and -g is not present, the lexer is guessed from the filename.') - lexersel.add_argument( - '-g', action='store_true', - help='Guess the lexer from the file contents, or pass through ' - 'as plain text if nothing can be guessed.') - operation.add_argument( - '-F', metavar='FILTER[:options]', action='append', - help='Add a filter to the token stream. (Query names with -L.) ' - 'Filter options are given after a colon if necessary.') - operation.add_argument( - '-f', metavar='FORMATTER', - help='Specify the formatter to use. (Query names with -L.) ' - 'If not given, the formatter is guessed from the output filename, ' - 'and defaults to the terminal formatter if the output is to the ' - 'terminal or an unknown file extension.') - operation.add_argument( - '-O', metavar='OPTION=value[,OPTION=value,...]', action='append', - help='Give options to the lexer and formatter as a comma-separated ' - 'list of key-value pairs. ' - 'Example: `-O bg=light,python=cool`.') - operation.add_argument( - '-P', metavar='OPTION=value', action='append', - help='Give a single option to the lexer and formatter - with this ' - 'you can pass options whose value contains commas and equal signs. ' - 'Example: `-P "heading=Pygments, the Python highlighter"`.') - operation.add_argument( - '-o', metavar='OUTPUTFILE', - help='Where to write the output. Defaults to standard output.') - - operation.add_argument( - 'INPUTFILE', nargs='?', - help='Where to read the input. Defaults to standard input.') - - flags = parser.add_argument_group('Operation flags') - flags.add_argument( - '-v', action='store_true', - help='Print a detailed traceback on unhandled exceptions, which ' - 'is useful for debugging and bug reports.') - flags.add_argument( - '-s', action='store_true', - help='Process lines one at a time until EOF, rather than waiting to ' - 'process the entire file. This only works for stdin, only for lexers ' - 'with no line-spanning constructs, and is intended for streaming ' - 'input such as you get from `tail -f`. ' - 'Example usage: `tail -f sql.log | pygmentize -s -l sql`.') - flags.add_argument( - '-x', action='store_true', - help='Allow custom lexers and formatters to be loaded from a .py file ' - 'relative to the current working directory. For example, ' - '`-l ./customlexer.py -x`. By default, this option expects a file ' - 'with a class named CustomLexer or CustomFormatter; you can also ' - 'specify your own class name with a colon (`-l ./lexer.py:MyLexer`). ' - 'Users should be very careful not to use this option with untrusted ' - 'files, because it will import and run them.') - flags.add_argument('--json', help='Output as JSON. This can ' - 'be only used in conjunction with -L.', - default=False, - action='store_true') - - special_modes_group = parser.add_argument_group( - 'Special modes - do not do any highlighting') - special_modes = special_modes_group.add_mutually_exclusive_group() - special_modes.add_argument( - '-S', metavar='STYLE -f formatter', - help='Print style definitions for STYLE for a formatter ' - 'given with -f. The argument given by -a is formatter ' - 'dependent.') - special_modes.add_argument( - '-L', nargs='*', metavar='WHAT', - help='List lexers, formatters, styles or filters -- ' - 'give additional arguments for the thing(s) you want to list ' - '(e.g. "styles"), or omit them to list everything.') - special_modes.add_argument( - '-N', metavar='FILENAME', - help='Guess and print out a lexer name based solely on the given ' - 'filename. Does not take input or highlight anything. If no specific ' - 'lexer can be determined, "text" is printed.') - special_modes.add_argument( - '-C', action='store_true', - help='Like -N, but print out a lexer name based solely on ' - 'a given content from standard input.') - special_modes.add_argument( - '-H', action='store', nargs=2, metavar=('NAME', 'TYPE'), - help='Print detailed help for the object of type , ' - 'where is one of "lexer", "formatter" or "filter".') - special_modes.add_argument( - '-V', action='store_true', - help='Print the package version.') - special_modes.add_argument( - '-h', '--help', action='store_true', - help='Print this help.') - special_modes_group.add_argument( - '-a', metavar='ARG', - help='Formatter-specific additional argument for the -S (print ' - 'style sheet) mode.') - - argns = parser.parse_args(args[1:]) - - try: - return main_inner(parser, argns) - except BrokenPipeError: - # someone closed our stdout, e.g. by quitting a pager. - return 0 - except Exception: - if argns.v: - print(file=sys.stderr) - print('*' * 65, file=sys.stderr) - print('An unhandled exception occurred while highlighting.', - file=sys.stderr) - print('Please report the whole traceback to the issue tracker at', - file=sys.stderr) - print('.', - file=sys.stderr) - print('*' * 65, file=sys.stderr) - print(file=sys.stderr) - raise - import traceback - info = traceback.format_exception(*sys.exc_info()) - msg = info[-1].strip() - if len(info) >= 3: - # extract relevant file and position info - msg += '\n (f%s)' % info[-2].split('\n')[0].strip()[1:] - print(file=sys.stderr) - print('*** Error while highlighting:', file=sys.stderr) - print(msg, file=sys.stderr) - print('*** If this is a bug you want to report, please rerun with -v.', - file=sys.stderr) - return 1 diff --git a/spaces/Ataturk-Chatbot/HuggingFaceChat/venv/lib/python3.11/site-packages/pip/_vendor/pygments/style.py b/spaces/Ataturk-Chatbot/HuggingFaceChat/venv/lib/python3.11/site-packages/pip/_vendor/pygments/style.py deleted file mode 100644 index 84abbc20599f034626779702abc2303901d83ee5..0000000000000000000000000000000000000000 --- a/spaces/Ataturk-Chatbot/HuggingFaceChat/venv/lib/python3.11/site-packages/pip/_vendor/pygments/style.py +++ /dev/null @@ -1,197 +0,0 @@ -""" - pygments.style - ~~~~~~~~~~~~~~ - - Basic style object. - - :copyright: Copyright 2006-2022 by the Pygments team, see AUTHORS. - :license: BSD, see LICENSE for details. -""" - -from pip._vendor.pygments.token import Token, STANDARD_TYPES - -# Default mapping of ansixxx to RGB colors. -_ansimap = { - # dark - 'ansiblack': '000000', - 'ansired': '7f0000', - 'ansigreen': '007f00', - 'ansiyellow': '7f7fe0', - 'ansiblue': '00007f', - 'ansimagenta': '7f007f', - 'ansicyan': '007f7f', - 'ansigray': 'e5e5e5', - # normal - 'ansibrightblack': '555555', - 'ansibrightred': 'ff0000', - 'ansibrightgreen': '00ff00', - 'ansibrightyellow': 'ffff00', - 'ansibrightblue': '0000ff', - 'ansibrightmagenta': 'ff00ff', - 'ansibrightcyan': '00ffff', - 'ansiwhite': 'ffffff', -} -# mapping of deprecated #ansixxx colors to new color names -_deprecated_ansicolors = { - # dark - '#ansiblack': 'ansiblack', - '#ansidarkred': 'ansired', - '#ansidarkgreen': 'ansigreen', - '#ansibrown': 'ansiyellow', - '#ansidarkblue': 'ansiblue', - '#ansipurple': 'ansimagenta', - '#ansiteal': 'ansicyan', - '#ansilightgray': 'ansigray', - # normal - '#ansidarkgray': 'ansibrightblack', - '#ansired': 'ansibrightred', - '#ansigreen': 'ansibrightgreen', - '#ansiyellow': 'ansibrightyellow', - '#ansiblue': 'ansibrightblue', - '#ansifuchsia': 'ansibrightmagenta', - '#ansiturquoise': 'ansibrightcyan', - '#ansiwhite': 'ansiwhite', -} -ansicolors = set(_ansimap) - - -class StyleMeta(type): - - def __new__(mcs, name, bases, dct): - obj = type.__new__(mcs, name, bases, dct) - for token in STANDARD_TYPES: - if token not in obj.styles: - obj.styles[token] = '' - - def colorformat(text): - if text in ansicolors: - return text - if text[0:1] == '#': - col = text[1:] - if len(col) == 6: - return col - elif len(col) == 3: - return col[0] * 2 + col[1] * 2 + col[2] * 2 - elif text == '': - return '' - elif text.startswith('var') or text.startswith('calc'): - return text - assert False, "wrong color format %r" % text - - _styles = obj._styles = {} - - for ttype in obj.styles: - for token in ttype.split(): - if token in _styles: - continue - ndef = _styles.get(token.parent, None) - styledefs = obj.styles.get(token, '').split() - if not ndef or token is None: - ndef = ['', 0, 0, 0, '', '', 0, 0, 0] - elif 'noinherit' in styledefs and token is not Token: - ndef = _styles[Token][:] - else: - ndef = ndef[:] - _styles[token] = ndef - for styledef in obj.styles.get(token, '').split(): - if styledef == 'noinherit': - pass - elif styledef == 'bold': - ndef[1] = 1 - elif styledef == 'nobold': - ndef[1] = 0 - elif styledef == 'italic': - ndef[2] = 1 - elif styledef == 'noitalic': - ndef[2] = 0 - elif styledef == 'underline': - ndef[3] = 1 - elif styledef == 'nounderline': - ndef[3] = 0 - elif styledef[:3] == 'bg:': - ndef[4] = colorformat(styledef[3:]) - elif styledef[:7] == 'border:': - ndef[5] = colorformat(styledef[7:]) - elif styledef == 'roman': - ndef[6] = 1 - elif styledef == 'sans': - ndef[7] = 1 - elif styledef == 'mono': - ndef[8] = 1 - else: - ndef[0] = colorformat(styledef) - - return obj - - def style_for_token(cls, token): - t = cls._styles[token] - ansicolor = bgansicolor = None - color = t[0] - if color in _deprecated_ansicolors: - color = _deprecated_ansicolors[color] - if color in ansicolors: - ansicolor = color - color = _ansimap[color] - bgcolor = t[4] - if bgcolor in _deprecated_ansicolors: - bgcolor = _deprecated_ansicolors[bgcolor] - if bgcolor in ansicolors: - bgansicolor = bgcolor - bgcolor = _ansimap[bgcolor] - - return { - 'color': color or None, - 'bold': bool(t[1]), - 'italic': bool(t[2]), - 'underline': bool(t[3]), - 'bgcolor': bgcolor or None, - 'border': t[5] or None, - 'roman': bool(t[6]) or None, - 'sans': bool(t[7]) or None, - 'mono': bool(t[8]) or None, - 'ansicolor': ansicolor, - 'bgansicolor': bgansicolor, - } - - def list_styles(cls): - return list(cls) - - def styles_token(cls, ttype): - return ttype in cls._styles - - def __iter__(cls): - for token in cls._styles: - yield token, cls.style_for_token(token) - - def __len__(cls): - return len(cls._styles) - - -class Style(metaclass=StyleMeta): - - #: overall background color (``None`` means transparent) - background_color = '#ffffff' - - #: highlight background color - highlight_color = '#ffffcc' - - #: line number font color - line_number_color = 'inherit' - - #: line number background color - line_number_background_color = 'transparent' - - #: special line number font color - line_number_special_color = '#000000' - - #: special line number background color - line_number_special_background_color = '#ffffc0' - - #: Style definitions for individual token types. - styles = {} - - # Attribute for lexers defined within Pygments. If set - # to True, the style is not shown in the style gallery - # on the website. This is intended for language-specific - # styles. - web_style_gallery_exclude = False diff --git a/spaces/Ataturk-Chatbot/HuggingFaceChat/venv/lib/python3.11/site-packages/pip/_vendor/rich/_extension.py b/spaces/Ataturk-Chatbot/HuggingFaceChat/venv/lib/python3.11/site-packages/pip/_vendor/rich/_extension.py deleted file mode 100644 index cbd6da9be4956ce8558304ed72ffbe88ccd22ba5..0000000000000000000000000000000000000000 --- a/spaces/Ataturk-Chatbot/HuggingFaceChat/venv/lib/python3.11/site-packages/pip/_vendor/rich/_extension.py +++ /dev/null @@ -1,10 +0,0 @@ -from typing import Any - - -def load_ipython_extension(ip: Any) -> None: # pragma: no cover - # prevent circular import - from pip._vendor.rich.pretty import install - from pip._vendor.rich.traceback import install as tr_install - - install() - tr_install() diff --git a/spaces/Ataturk-Chatbot/HuggingFaceChat/venv/lib/python3.11/site-packages/pip/_vendor/rich/_wrap.py b/spaces/Ataturk-Chatbot/HuggingFaceChat/venv/lib/python3.11/site-packages/pip/_vendor/rich/_wrap.py deleted file mode 100644 index c45f193f74ad7385c84f3b935663198415cfaa4b..0000000000000000000000000000000000000000 --- a/spaces/Ataturk-Chatbot/HuggingFaceChat/venv/lib/python3.11/site-packages/pip/_vendor/rich/_wrap.py +++ /dev/null @@ -1,56 +0,0 @@ -import re -from typing import Iterable, List, Tuple - -from ._loop import loop_last -from .cells import cell_len, chop_cells - -re_word = re.compile(r"\s*\S+\s*") - - -def words(text: str) -> Iterable[Tuple[int, int, str]]: - position = 0 - word_match = re_word.match(text, position) - while word_match is not None: - start, end = word_match.span() - word = word_match.group(0) - yield start, end, word - word_match = re_word.match(text, end) - - -def divide_line(text: str, width: int, fold: bool = True) -> List[int]: - divides: List[int] = [] - append = divides.append - line_position = 0 - _cell_len = cell_len - for start, _end, word in words(text): - word_length = _cell_len(word.rstrip()) - if line_position + word_length > width: - if word_length > width: - if fold: - chopped_words = chop_cells(word, max_size=width, position=0) - for last, line in loop_last(chopped_words): - if start: - append(start) - - if last: - line_position = _cell_len(line) - else: - start += len(line) - else: - if start: - append(start) - line_position = _cell_len(word) - elif line_position and start: - append(start) - line_position = _cell_len(word) - else: - line_position += _cell_len(word) - return divides - - -if __name__ == "__main__": # pragma: no cover - from .console import Console - - console = Console(width=10) - console.print("12345 abcdefghijklmnopqrstuvwyxzABCDEFGHIJKLMNOPQRSTUVWXYZ 12345") - print(chop_cells("abcdefghijklmnopqrstuvwxyz", 10, position=2)) diff --git a/spaces/Awesimo/jojogan/e4e/criteria/lpips/networks.py b/spaces/Awesimo/jojogan/e4e/criteria/lpips/networks.py deleted file mode 100644 index 3a0d13ad2d560278f16586da68d3a5eadb26e746..0000000000000000000000000000000000000000 --- a/spaces/Awesimo/jojogan/e4e/criteria/lpips/networks.py +++ /dev/null @@ -1,96 +0,0 @@ -from typing import Sequence - -from itertools import chain - -import torch -import torch.nn as nn -from torchvision import models - -from criteria.lpips.utils import normalize_activation - - -def get_network(net_type: str): - if net_type == 'alex': - return AlexNet() - elif net_type == 'squeeze': - return SqueezeNet() - elif net_type == 'vgg': - return VGG16() - else: - raise NotImplementedError('choose net_type from [alex, squeeze, vgg].') - - -class LinLayers(nn.ModuleList): - def __init__(self, n_channels_list: Sequence[int]): - super(LinLayers, self).__init__([ - nn.Sequential( - nn.Identity(), - nn.Conv2d(nc, 1, 1, 1, 0, bias=False) - ) for nc in n_channels_list - ]) - - for param in self.parameters(): - param.requires_grad = False - - -class BaseNet(nn.Module): - def __init__(self): - super(BaseNet, self).__init__() - - # register buffer - self.register_buffer( - 'mean', torch.Tensor([-.030, -.088, -.188])[None, :, None, None]) - self.register_buffer( - 'std', torch.Tensor([.458, .448, .450])[None, :, None, None]) - - def set_requires_grad(self, state: bool): - for param in chain(self.parameters(), self.buffers()): - param.requires_grad = state - - def z_score(self, x: torch.Tensor): - return (x - self.mean) / self.std - - def forward(self, x: torch.Tensor): - x = self.z_score(x) - - output = [] - for i, (_, layer) in enumerate(self.layers._modules.items(), 1): - x = layer(x) - if i in self.target_layers: - output.append(normalize_activation(x)) - if len(output) == len(self.target_layers): - break - return output - - -class SqueezeNet(BaseNet): - def __init__(self): - super(SqueezeNet, self).__init__() - - self.layers = models.squeezenet1_1(True).features - self.target_layers = [2, 5, 8, 10, 11, 12, 13] - self.n_channels_list = [64, 128, 256, 384, 384, 512, 512] - - self.set_requires_grad(False) - - -class AlexNet(BaseNet): - def __init__(self): - super(AlexNet, self).__init__() - - self.layers = models.alexnet(True).features - self.target_layers = [2, 5, 8, 10, 12] - self.n_channels_list = [64, 192, 384, 256, 256] - - self.set_requires_grad(False) - - -class VGG16(BaseNet): - def __init__(self): - super(VGG16, self).__init__() - - self.layers = models.vgg16(True).features - self.target_layers = [4, 9, 16, 23, 30] - self.n_channels_list = [64, 128, 256, 512, 512] - - self.set_requires_grad(False) \ No newline at end of file diff --git a/spaces/Ayemos/highlight_text_based_on_surprisals/README.md b/spaces/Ayemos/highlight_text_based_on_surprisals/README.md deleted file mode 100644 index 46e0ece540f9204cee0877b6b628aa4cb4f1aee1..0000000000000000000000000000000000000000 --- a/spaces/Ayemos/highlight_text_based_on_surprisals/README.md +++ /dev/null @@ -1,12 +0,0 @@ ---- -title: Highlight text based on readability (=surprisal) -emoji: 🐠 -colorFrom: yellow -colorTo: pink -sdk: gradio -sdk_version: 3.9 -app_file: app.py -pinned: false ---- - -Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference diff --git a/spaces/Bart92/RVC_HF/go-tensorboard.bat b/spaces/Bart92/RVC_HF/go-tensorboard.bat deleted file mode 100644 index cb81c17d3865513adec8eb0b832b7888cd1e4078..0000000000000000000000000000000000000000 --- a/spaces/Bart92/RVC_HF/go-tensorboard.bat +++ /dev/null @@ -1,2 +0,0 @@ -python fixes/tensor-launch.py -pause \ No newline at end of file diff --git a/spaces/Big-Web/MMSD/env/Lib/site-packages/pip/_vendor/pyproject_hooks/_impl.py b/spaces/Big-Web/MMSD/env/Lib/site-packages/pip/_vendor/pyproject_hooks/_impl.py deleted file mode 100644 index 37b0e6531f1544e1ba9b5895c48939fc97441ce7..0000000000000000000000000000000000000000 --- a/spaces/Big-Web/MMSD/env/Lib/site-packages/pip/_vendor/pyproject_hooks/_impl.py +++ /dev/null @@ -1,330 +0,0 @@ -import json -import os -import sys -import tempfile -from contextlib import contextmanager -from os.path import abspath -from os.path import join as pjoin -from subprocess import STDOUT, check_call, check_output - -from ._in_process import _in_proc_script_path - - -def write_json(obj, path, **kwargs): - with open(path, 'w', encoding='utf-8') as f: - json.dump(obj, f, **kwargs) - - -def read_json(path): - with open(path, encoding='utf-8') as f: - return json.load(f) - - -class BackendUnavailable(Exception): - """Will be raised if the backend cannot be imported in the hook process.""" - def __init__(self, traceback): - self.traceback = traceback - - -class BackendInvalid(Exception): - """Will be raised if the backend is invalid.""" - def __init__(self, backend_name, backend_path, message): - super().__init__(message) - self.backend_name = backend_name - self.backend_path = backend_path - - -class HookMissing(Exception): - """Will be raised on missing hooks (if a fallback can't be used).""" - def __init__(self, hook_name): - super().__init__(hook_name) - self.hook_name = hook_name - - -class UnsupportedOperation(Exception): - """May be raised by build_sdist if the backend indicates that it can't.""" - def __init__(self, traceback): - self.traceback = traceback - - -def default_subprocess_runner(cmd, cwd=None, extra_environ=None): - """The default method of calling the wrapper subprocess. - - This uses :func:`subprocess.check_call` under the hood. - """ - env = os.environ.copy() - if extra_environ: - env.update(extra_environ) - - check_call(cmd, cwd=cwd, env=env) - - -def quiet_subprocess_runner(cmd, cwd=None, extra_environ=None): - """Call the subprocess while suppressing output. - - This uses :func:`subprocess.check_output` under the hood. - """ - env = os.environ.copy() - if extra_environ: - env.update(extra_environ) - - check_output(cmd, cwd=cwd, env=env, stderr=STDOUT) - - -def norm_and_check(source_tree, requested): - """Normalise and check a backend path. - - Ensure that the requested backend path is specified as a relative path, - and resolves to a location under the given source tree. - - Return an absolute version of the requested path. - """ - if os.path.isabs(requested): - raise ValueError("paths must be relative") - - abs_source = os.path.abspath(source_tree) - abs_requested = os.path.normpath(os.path.join(abs_source, requested)) - # We have to use commonprefix for Python 2.7 compatibility. So we - # normalise case to avoid problems because commonprefix is a character - # based comparison :-( - norm_source = os.path.normcase(abs_source) - norm_requested = os.path.normcase(abs_requested) - if os.path.commonprefix([norm_source, norm_requested]) != norm_source: - raise ValueError("paths must be inside source tree") - - return abs_requested - - -class BuildBackendHookCaller: - """A wrapper to call the build backend hooks for a source directory. - """ - - def __init__( - self, - source_dir, - build_backend, - backend_path=None, - runner=None, - python_executable=None, - ): - """ - :param source_dir: The source directory to invoke the build backend for - :param build_backend: The build backend spec - :param backend_path: Additional path entries for the build backend spec - :param runner: The :ref:`subprocess runner ` to use - :param python_executable: - The Python executable used to invoke the build backend - """ - if runner is None: - runner = default_subprocess_runner - - self.source_dir = abspath(source_dir) - self.build_backend = build_backend - if backend_path: - backend_path = [ - norm_and_check(self.source_dir, p) for p in backend_path - ] - self.backend_path = backend_path - self._subprocess_runner = runner - if not python_executable: - python_executable = sys.executable - self.python_executable = python_executable - - @contextmanager - def subprocess_runner(self, runner): - """A context manager for temporarily overriding the default - :ref:`subprocess runner `. - - .. code-block:: python - - hook_caller = BuildBackendHookCaller(...) - with hook_caller.subprocess_runner(quiet_subprocess_runner): - ... - """ - prev = self._subprocess_runner - self._subprocess_runner = runner - try: - yield - finally: - self._subprocess_runner = prev - - def _supported_features(self): - """Return the list of optional features supported by the backend.""" - return self._call_hook('_supported_features', {}) - - def get_requires_for_build_wheel(self, config_settings=None): - """Get additional dependencies required for building a wheel. - - :returns: A list of :pep:`dependency specifiers <508>`. - :rtype: list[str] - - .. admonition:: Fallback - - If the build backend does not defined a hook with this name, an - empty list will be returned. - """ - return self._call_hook('get_requires_for_build_wheel', { - 'config_settings': config_settings - }) - - def prepare_metadata_for_build_wheel( - self, metadata_directory, config_settings=None, - _allow_fallback=True): - """Prepare a ``*.dist-info`` folder with metadata for this project. - - :returns: Name of the newly created subfolder within - ``metadata_directory``, containing the metadata. - :rtype: str - - .. admonition:: Fallback - - If the build backend does not define a hook with this name and - ``_allow_fallback`` is truthy, the backend will be asked to build a - wheel via the ``build_wheel`` hook and the dist-info extracted from - that will be returned. - """ - return self._call_hook('prepare_metadata_for_build_wheel', { - 'metadata_directory': abspath(metadata_directory), - 'config_settings': config_settings, - '_allow_fallback': _allow_fallback, - }) - - def build_wheel( - self, wheel_directory, config_settings=None, - metadata_directory=None): - """Build a wheel from this project. - - :returns: - The name of the newly created wheel within ``wheel_directory``. - - .. admonition:: Interaction with fallback - - If the ``build_wheel`` hook was called in the fallback for - :meth:`prepare_metadata_for_build_wheel`, the build backend would - not be invoked. Instead, the previously built wheel will be copied - to ``wheel_directory`` and the name of that file will be returned. - """ - if metadata_directory is not None: - metadata_directory = abspath(metadata_directory) - return self._call_hook('build_wheel', { - 'wheel_directory': abspath(wheel_directory), - 'config_settings': config_settings, - 'metadata_directory': metadata_directory, - }) - - def get_requires_for_build_editable(self, config_settings=None): - """Get additional dependencies required for building an editable wheel. - - :returns: A list of :pep:`dependency specifiers <508>`. - :rtype: list[str] - - .. admonition:: Fallback - - If the build backend does not defined a hook with this name, an - empty list will be returned. - """ - return self._call_hook('get_requires_for_build_editable', { - 'config_settings': config_settings - }) - - def prepare_metadata_for_build_editable( - self, metadata_directory, config_settings=None, - _allow_fallback=True): - """Prepare a ``*.dist-info`` folder with metadata for this project. - - :returns: Name of the newly created subfolder within - ``metadata_directory``, containing the metadata. - :rtype: str - - .. admonition:: Fallback - - If the build backend does not define a hook with this name and - ``_allow_fallback`` is truthy, the backend will be asked to build a - wheel via the ``build_editable`` hook and the dist-info - extracted from that will be returned. - """ - return self._call_hook('prepare_metadata_for_build_editable', { - 'metadata_directory': abspath(metadata_directory), - 'config_settings': config_settings, - '_allow_fallback': _allow_fallback, - }) - - def build_editable( - self, wheel_directory, config_settings=None, - metadata_directory=None): - """Build an editable wheel from this project. - - :returns: - The name of the newly created wheel within ``wheel_directory``. - - .. admonition:: Interaction with fallback - - If the ``build_editable`` hook was called in the fallback for - :meth:`prepare_metadata_for_build_editable`, the build backend - would not be invoked. Instead, the previously built wheel will be - copied to ``wheel_directory`` and the name of that file will be - returned. - """ - if metadata_directory is not None: - metadata_directory = abspath(metadata_directory) - return self._call_hook('build_editable', { - 'wheel_directory': abspath(wheel_directory), - 'config_settings': config_settings, - 'metadata_directory': metadata_directory, - }) - - def get_requires_for_build_sdist(self, config_settings=None): - """Get additional dependencies required for building an sdist. - - :returns: A list of :pep:`dependency specifiers <508>`. - :rtype: list[str] - """ - return self._call_hook('get_requires_for_build_sdist', { - 'config_settings': config_settings - }) - - def build_sdist(self, sdist_directory, config_settings=None): - """Build an sdist from this project. - - :returns: - The name of the newly created sdist within ``wheel_directory``. - """ - return self._call_hook('build_sdist', { - 'sdist_directory': abspath(sdist_directory), - 'config_settings': config_settings, - }) - - def _call_hook(self, hook_name, kwargs): - extra_environ = {'PEP517_BUILD_BACKEND': self.build_backend} - - if self.backend_path: - backend_path = os.pathsep.join(self.backend_path) - extra_environ['PEP517_BACKEND_PATH'] = backend_path - - with tempfile.TemporaryDirectory() as td: - hook_input = {'kwargs': kwargs} - write_json(hook_input, pjoin(td, 'input.json'), indent=2) - - # Run the hook in a subprocess - with _in_proc_script_path() as script: - python = self.python_executable - self._subprocess_runner( - [python, abspath(str(script)), hook_name, td], - cwd=self.source_dir, - extra_environ=extra_environ - ) - - data = read_json(pjoin(td, 'output.json')) - if data.get('unsupported'): - raise UnsupportedOperation(data.get('traceback', '')) - if data.get('no_backend'): - raise BackendUnavailable(data.get('traceback', '')) - if data.get('backend_invalid'): - raise BackendInvalid( - backend_name=self.build_backend, - backend_path=self.backend_path, - message=data.get('backend_error', '') - ) - if data.get('hook_missing'): - raise HookMissing(data.get('missing_hook_name') or hook_name) - return data['return_val'] diff --git a/spaces/Big-Web/MMSD/env/Lib/site-packages/pip/_vendor/tenacity/tornadoweb.py b/spaces/Big-Web/MMSD/env/Lib/site-packages/pip/_vendor/tenacity/tornadoweb.py deleted file mode 100644 index e19c30b18905a39466ab6b51403438605e706caf..0000000000000000000000000000000000000000 --- a/spaces/Big-Web/MMSD/env/Lib/site-packages/pip/_vendor/tenacity/tornadoweb.py +++ /dev/null @@ -1,59 +0,0 @@ -# Copyright 2017 Elisey Zanko -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import sys -import typing - -from pip._vendor.tenacity import BaseRetrying -from pip._vendor.tenacity import DoAttempt -from pip._vendor.tenacity import DoSleep -from pip._vendor.tenacity import RetryCallState - -from tornado import gen - -if typing.TYPE_CHECKING: - from tornado.concurrent import Future - -_RetValT = typing.TypeVar("_RetValT") - - -class TornadoRetrying(BaseRetrying): - def __init__(self, sleep: "typing.Callable[[float], Future[None]]" = gen.sleep, **kwargs: typing.Any) -> None: - super().__init__(**kwargs) - self.sleep = sleep - - @gen.coroutine # type: ignore[misc] - def __call__( - self, - fn: "typing.Callable[..., typing.Union[typing.Generator[typing.Any, typing.Any, _RetValT], Future[_RetValT]]]", - *args: typing.Any, - **kwargs: typing.Any, - ) -> "typing.Generator[typing.Any, typing.Any, _RetValT]": - self.begin() - - retry_state = RetryCallState(retry_object=self, fn=fn, args=args, kwargs=kwargs) - while True: - do = self.iter(retry_state=retry_state) - if isinstance(do, DoAttempt): - try: - result = yield fn(*args, **kwargs) - except BaseException: # noqa: B902 - retry_state.set_exception(sys.exc_info()) # type: ignore[arg-type] - else: - retry_state.set_result(result) - elif isinstance(do, DoSleep): - retry_state.prepare_for_next_attempt() - yield self.sleep(do) - else: - raise gen.Return(do) diff --git a/spaces/Big-Web/MMSD/env/Lib/site-packages/setuptools/_distutils/spawn.py b/spaces/Big-Web/MMSD/env/Lib/site-packages/setuptools/_distutils/spawn.py deleted file mode 100644 index b18ba9db7d2e5919c853e7dcf8d5b7c180607c3f..0000000000000000000000000000000000000000 --- a/spaces/Big-Web/MMSD/env/Lib/site-packages/setuptools/_distutils/spawn.py +++ /dev/null @@ -1,109 +0,0 @@ -"""distutils.spawn - -Provides the 'spawn()' function, a front-end to various platform- -specific functions for launching another program in a sub-process. -Also provides the 'find_executable()' to search the path for a given -executable name. -""" - -import sys -import os -import subprocess - -from distutils.errors import DistutilsExecError -from distutils.debug import DEBUG -from distutils import log - - -def spawn(cmd, search_path=1, verbose=0, dry_run=0, env=None): # noqa: C901 - """Run another program, specified as a command list 'cmd', in a new process. - - 'cmd' is just the argument list for the new process, ie. - cmd[0] is the program to run and cmd[1:] are the rest of its arguments. - There is no way to run a program with a name different from that of its - executable. - - If 'search_path' is true (the default), the system's executable - search path will be used to find the program; otherwise, cmd[0] - must be the exact path to the executable. If 'dry_run' is true, - the command will not actually be run. - - Raise DistutilsExecError if running the program fails in any way; just - return on success. - """ - # cmd is documented as a list, but just in case some code passes a tuple - # in, protect our %-formatting code against horrible death - cmd = list(cmd) - - log.info(subprocess.list2cmdline(cmd)) - if dry_run: - return - - if search_path: - executable = find_executable(cmd[0]) - if executable is not None: - cmd[0] = executable - - env = env if env is not None else dict(os.environ) - - if sys.platform == 'darwin': - from distutils.util import MACOSX_VERSION_VAR, get_macosx_target_ver - - macosx_target_ver = get_macosx_target_ver() - if macosx_target_ver: - env[MACOSX_VERSION_VAR] = macosx_target_ver - - try: - proc = subprocess.Popen(cmd, env=env) - proc.wait() - exitcode = proc.returncode - except OSError as exc: - if not DEBUG: - cmd = cmd[0] - raise DistutilsExecError( - "command {!r} failed: {}".format(cmd, exc.args[-1]) - ) from exc - - if exitcode: - if not DEBUG: - cmd = cmd[0] - raise DistutilsExecError( - "command {!r} failed with exit code {}".format(cmd, exitcode) - ) - - -def find_executable(executable, path=None): - """Tries to find 'executable' in the directories listed in 'path'. - - A string listing directories separated by 'os.pathsep'; defaults to - os.environ['PATH']. Returns the complete filename or None if not found. - """ - _, ext = os.path.splitext(executable) - if (sys.platform == 'win32') and (ext != '.exe'): - executable = executable + '.exe' - - if os.path.isfile(executable): - return executable - - if path is None: - path = os.environ.get('PATH', None) - if path is None: - try: - path = os.confstr("CS_PATH") - except (AttributeError, ValueError): - # os.confstr() or CS_PATH is not available - path = os.defpath - # bpo-35755: Don't use os.defpath if the PATH environment variable is - # set to an empty string - - # PATH='' doesn't match, whereas PATH=':' looks in the current directory - if not path: - return None - - paths = path.split(os.pathsep) - for p in paths: - f = os.path.join(p, executable) - if os.path.isfile(f): - # the file exists, we have a shot at spawn working - return f - return None diff --git a/spaces/CVPR/LIVE/thrust/thrust/detail/reference.h b/spaces/CVPR/LIVE/thrust/thrust/detail/reference.h deleted file mode 100644 index 89bcf63ca7a5d9ba91d242ddaec318a02a832c65..0000000000000000000000000000000000000000 --- a/spaces/CVPR/LIVE/thrust/thrust/detail/reference.h +++ /dev/null @@ -1,178 +0,0 @@ -/* - * Copyright 2008-2013 NVIDIA Corporation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include -#include -#include -#include -#include - - -namespace thrust -{ -namespace detail -{ - -template struct is_wrapped_reference; - -} - -// the base type for all of thrust's system-annotated references. -// for reasonable reference-like semantics, derived types must reimplement the following: -// 1. constructor from pointer -// 2. copy constructor -// 3. templated copy constructor from other reference -// 4. templated assignment from other reference -// 5. assignment from value_type -template - class reference -{ - private: - typedef typename thrust::detail::eval_if< - thrust::detail::is_same::value, - thrust::detail::identity_, - thrust::detail::identity_ - >::type derived_type; - - // hint for is_wrapped_reference lets it know that this type (or a derived type) - // is a wrapped reference - struct wrapped_reference_hint {}; - template friend struct thrust::detail::is_wrapped_reference; - - public: - typedef Pointer pointer; - typedef typename thrust::detail::remove_const::type value_type; - - __host__ __device__ - explicit reference(const pointer &ptr); - -#if THRUST_CPP_DIALECT >= 2011 - reference(const reference &) = default; -#endif - - template - __host__ __device__ - reference(const reference &other, - typename thrust::detail::enable_if_convertible< - typename reference::pointer, - pointer - >::type * = 0); - - __host__ __device__ - derived_type &operator=(const reference &other); - - // XXX this may need an enable_if - template - __host__ __device__ - derived_type &operator=(const reference &other); - - __host__ __device__ - derived_type &operator=(const value_type &x); - - __host__ __device__ - pointer operator&() const; - - __host__ __device__ - operator value_type () const; - - __host__ __device__ - void swap(derived_type &other); - - derived_type &operator++(); - - value_type operator++(int); - - // XXX parameterize the type of rhs - derived_type &operator+=(const value_type &rhs); - - derived_type &operator--(); - - value_type operator--(int); - - // XXX parameterize the type of rhs - derived_type &operator-=(const value_type &rhs); - - // XXX parameterize the type of rhs - derived_type &operator*=(const value_type &rhs); - - // XXX parameterize the type of rhs - derived_type &operator/=(const value_type &rhs); - - // XXX parameterize the type of rhs - derived_type &operator%=(const value_type &rhs); - - // XXX parameterize the type of rhs - derived_type &operator<<=(const value_type &rhs); - - // XXX parameterize the type of rhs - derived_type &operator>>=(const value_type &rhs); - - // XXX parameterize the type of rhs - derived_type &operator&=(const value_type &rhs); - - // XXX parameterize the type of rhs - derived_type &operator|=(const value_type &rhs); - - // XXX parameterize the type of rhs - derived_type &operator^=(const value_type &rhs); - - private: - const pointer m_ptr; - - // allow access to m_ptr for other references - template friend class reference; - - template - __host__ __device__ - inline value_type strip_const_get_value(const System &system) const; - - template - __host__ __device__ - inline void assign_from(OtherPointer src); - - // XXX this helper exists only to avoid warnings about null references from the other assign_from - template - inline __host__ __device__ - void assign_from(System1 *system1, System2 *system2, OtherPointer src); - - template - __host__ __device__ - inline void strip_const_assign_value(const System &system, OtherPointer src); - - // XXX this helper exists only to avoid warnings about null references from the other swap - template - inline __host__ __device__ - void swap(System *system, derived_type &other); - - // XXX this helper exists only to avoid warnings about null references from operator value_type () - template - inline __host__ __device__ - value_type convert_to_value_type(System *system) const; -}; // end reference - -// Output stream operator -template -std::basic_ostream & -operator<<(std::basic_ostream &os, - const reference &y); - -} // end thrust - -#include - diff --git a/spaces/CVPR/LIVE/thrust/thrust/partition.h b/spaces/CVPR/LIVE/thrust/thrust/partition.h deleted file mode 100644 index 3c493e0881639d75faa9516a34588dcfa2ea0fa2..0000000000000000000000000000000000000000 --- a/spaces/CVPR/LIVE/thrust/thrust/partition.h +++ /dev/null @@ -1,1439 +0,0 @@ -/* - * Copyright 2008-2013 NVIDIA Corporation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -/*! \file partition.h - * \brief Reorganizes a range based on a predicate - */ - -#pragma once - -#include -#include -#include - -namespace thrust -{ - - -/*! \addtogroup reordering - * \ingroup algorithms - * - * \addtogroup partitioning - * \ingroup reordering - * \{ - */ - - -/*! \p partition reorders the elements [first, last) based on the function - * object \p pred, such that all of the elements that satisfy \p pred precede the - * elements that fail to satisfy it. The postcondition is that, for some iterator - * \c middle in the range [first, last), pred(*i) is \c true for every - * iterator \c i in the range [first,middle) and \c false for every iterator - * \c i in the range [middle, last). The return value of \p partition is - * \c middle. - * - * Note that the relative order of elements in the two reordered sequences is not - * necessarily the same as it was in the original sequence. A different algorithm, - * \p stable_partition, does guarantee to preserve the relative order. - * - * The algorithm's execution is parallelized as determined by \p exec. - * - * \param exec The execution policy to use for parallelization. - * \param first The beginning of the sequence to reorder. - * \param last The end of the sequence to reorder. - * \param pred A function object which decides to which partition each element of the - * sequence [first, last) belongs. - * \return An iterator referring to the first element of the second partition, that is, - * the sequence of the elements which do not satisfy \p pred. - * - * \tparam DerivedPolicy The name of the derived execution policy. - * \tparam ForwardIterator is a model of Forward Iterator, - * and \p ForwardIterator's \c value_type is convertible to \p Predicate's \c argument_type, - * and \p ForwardIterator is mutable. - * \tparam Predicate is a model of Predicate. - * - * The following code snippet demonstrates how to use \p partition to reorder a - * sequence so that even numbers precede odd numbers using the \p thrust::host execution policy for parallelization: - * - * \code - * #include - * #include - * ... - * struct is_even - * { - * __host__ __device__ - * bool operator()(const int &x) - * { - * return (x % 2) == 0; - * } - * }; - * ... - * int A[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; - * const int N = sizeof(A)/sizeof(int); - * thrust::partition(thrust::host, - * A, A + N, - * is_even()); - * // A is now {2, 4, 6, 8, 10, 1, 3, 5, 7, 9} - * \endcode - * - * \see http://www.sgi.com/tech/stl/partition.html - * \see \p stable_partition - * \see \p partition_copy - */ -template -__host__ __device__ - ForwardIterator partition(const thrust::detail::execution_policy_base &exec, - ForwardIterator first, - ForwardIterator last, - Predicate pred); - - -/*! \p partition reorders the elements [first, last) based on the function - * object \p pred, such that all of the elements that satisfy \p pred precede the - * elements that fail to satisfy it. The postcondition is that, for some iterator - * \c middle in the range [first, last), pred(*i) is \c true for every - * iterator \c i in the range [first,middle) and \c false for every iterator - * \c i in the range [middle, last). The return value of \p partition is - * \c middle. - * - * Note that the relative order of elements in the two reordered sequences is not - * necessarily the same as it was in the original sequence. A different algorithm, - * \p stable_partition, does guarantee to preserve the relative order. - * - * \param first The beginning of the sequence to reorder. - * \param last The end of the sequence to reorder. - * \param pred A function object which decides to which partition each element of the - * sequence [first, last) belongs. - * \return An iterator referring to the first element of the second partition, that is, - * the sequence of the elements which do not satisfy \p pred. - * - * \tparam ForwardIterator is a model of Forward Iterator, - * and \p ForwardIterator's \c value_type is convertible to \p Predicate's \c argument_type, - * and \p ForwardIterator is mutable. - * \tparam Predicate is a model of Predicate. - * - * The following code snippet demonstrates how to use \p partition to reorder a - * sequence so that even numbers precede odd numbers. - * - * \code - * #include - * ... - * struct is_even - * { - * __host__ __device__ - * bool operator()(const int &x) - * { - * return (x % 2) == 0; - * } - * }; - * ... - * int A[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; - * const int N = sizeof(A)/sizeof(int); - * thrust::partition(A, A + N, - * is_even()); - * // A is now {2, 4, 6, 8, 10, 1, 3, 5, 7, 9} - * \endcode - * - * \see http://www.sgi.com/tech/stl/partition.html - * \see \p stable_partition - * \see \p partition_copy - */ -template - ForwardIterator partition(ForwardIterator first, - ForwardIterator last, - Predicate pred); - - -/*! \p partition reorders the elements [first, last) based on the function - * object \p pred applied to a stencil range [stencil, stencil + (last - first)), - * such that all of the elements whose corresponding stencil element satisfies \p pred precede all of the elements whose - * corresponding stencil element fails to satisfy it. The postcondition is that, for some iterator - * \c middle in the range [first, last), pred(*stencil_i) is \c true for every iterator - * \c stencil_i in the range [stencil,stencil + (middle - first)) and \c false for every iterator \c stencil_i - * in the range [stencil + (middle - first), stencil + (last - first)). - * The return value of \p stable_partition is \c middle. - * - * Note that the relative order of elements in the two reordered sequences is not - * necessarily the same as it was in the original sequence. A different algorithm, - * \p stable_partition, does guarantee to preserve the relative order. - * - * The algorithm's execution is parallelized as determined by \p exec. - * - * \param exec The execution policy to use for parallelization. - * \param first The beginning of the sequence to reorder. - * \param last The end of the sequence to reorder. - * \param stencil The beginning of the stencil sequence. - * \param pred A function object which decides to which partition each element of the - * sequence [first, last) belongs. - * \return An iterator referring to the first element of the second partition, that is, - * the sequence of the elements whose stencil elements do not satisfy \p pred. - * - * \tparam DerivedPolicy The name of the derived execution policy. - * \tparam ForwardIterator is a model of Forward Iterator, - * and \p ForwardIterator is mutable. - * \tparam InputIterator is a model of Input Iterator, - * and \p InputIterator's \c value_type is convertible to \p Predicate's \c argument_type. - * \tparam Predicate is a model of Predicate. - * - * \pre The ranges [first,last) and [stencil, stencil + (last - first)) shall not overlap. - * - * The following code snippet demonstrates how to use \p partition to reorder a - * sequence so that even numbers precede odd numbers using the \p thrust::host execution policy for parallelization: - * - * \code - * #include - * #include - * ... - * struct is_even - * { - * __host__ __device__ - * bool operator()(const int &x) - * { - * return (x % 2) == 0; - * } - * }; - * ... - * int A[] = {0, 1, 0, 1, 0, 1, 0, 1, 0, 1}; - * int S[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; - * const int N = sizeof(A)/sizeof(int); - * thrust::partition(thrust::host, A, A + N, S, is_even()); - * // A is now {1, 1, 1, 1, 1, 0, 0, 0, 0, 0} - * // S is unmodified - * \endcode - * - * \see http://www.sgi.com/tech/stl/partition.html - * \see \p stable_partition - * \see \p partition_copy - */ -template -__host__ __device__ - ForwardIterator partition(const thrust::detail::execution_policy_base &exec, - ForwardIterator first, - ForwardIterator last, - InputIterator stencil, - Predicate pred); - - -/*! \p partition reorders the elements [first, last) based on the function - * object \p pred applied to a stencil range [stencil, stencil + (last - first)), - * such that all of the elements whose corresponding stencil element satisfies \p pred precede all of the elements whose - * corresponding stencil element fails to satisfy it. The postcondition is that, for some iterator - * \c middle in the range [first, last), pred(*stencil_i) is \c true for every iterator - * \c stencil_i in the range [stencil,stencil + (middle - first)) and \c false for every iterator \c stencil_i - * in the range [stencil + (middle - first), stencil + (last - first)). - * The return value of \p stable_partition is \c middle. - * - * Note that the relative order of elements in the two reordered sequences is not - * necessarily the same as it was in the original sequence. A different algorithm, - * \p stable_partition, does guarantee to preserve the relative order. - * - * \param first The beginning of the sequence to reorder. - * \param last The end of the sequence to reorder. - * \param stencil The beginning of the stencil sequence. - * \param pred A function object which decides to which partition each element of the - * sequence [first, last) belongs. - * \return An iterator referring to the first element of the second partition, that is, - * the sequence of the elements whose stencil elements do not satisfy \p pred. - * - * \tparam ForwardIterator is a model of Forward Iterator, - * and \p ForwardIterator is mutable. - * \tparam InputIterator is a model of Input Iterator, - * and \p InputIterator's \c value_type is convertible to \p Predicate's \c argument_type. - * \tparam Predicate is a model of Predicate. - * - * \pre The ranges [first,last) and [stencil, stencil + (last - first)) shall not overlap. - * - * The following code snippet demonstrates how to use \p partition to reorder a - * sequence so that even numbers precede odd numbers. - * - * \code - * #include - * ... - * struct is_even - * { - * __host__ __device__ - * bool operator()(const int &x) - * { - * return (x % 2) == 0; - * } - * }; - * ... - * int A[] = {0, 1, 0, 1, 0, 1, 0, 1, 0, 1}; - * int S[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; - * const int N = sizeof(A)/sizeof(int); - * thrust::partition(A, A + N, S, is_even()); - * // A is now {1, 1, 1, 1, 1, 0, 0, 0, 0, 0} - * // S is unmodified - * \endcode - * - * \see http://www.sgi.com/tech/stl/partition.html - * \see \p stable_partition - * \see \p partition_copy - */ -template - ForwardIterator partition(ForwardIterator first, - ForwardIterator last, - InputIterator stencil, - Predicate pred); - - -/*! \p partition_copy differs from \p partition only in that the reordered - * sequence is written to difference output sequences, rather than in place. - * - * \p partition_copy copies the elements [first, last) based on the - * function object \p pred. All of the elements that satisfy \p pred are copied - * to the range beginning at \p out_true and all the elements that fail to satisfy it - * are copied to the range beginning at \p out_false. - * - * The algorithm's execution is parallelized as determined by \p exec. - * - * \param exec The execution policy to use for parallelization. - * \param first The beginning of the sequence to reorder. - * \param last The end of the sequence to reorder. - * \param out_true The destination of the resulting sequence of elements which satisfy \p pred. - * \param out_false The destination of the resulting sequence of elements which fail to satisfy \p pred. - * \param pred A function object which decides to which partition each element of the - * sequence [first, last) belongs. - * \return A \p pair p such that p.first is the end of the output range beginning - * at \p out_true and p.second is the end of the output range beginning at - * \p out_false. - * - * \tparam DerivedPolicy The name of the derived execution policy. - * \tparam InputIterator is a model of Input Iterator, - * and \p InputIterator's \c value_type is convertible to \p Predicate's \c argument_type and \p InputIterator's \c value_type - * is convertible to \p OutputIterator1 and \p OutputIterator2's \c value_types. - * \tparam OutputIterator1 is a model of Output Iterator. - * \tparam OutputIterator2 is a model of Output Iterator. - * \tparam Predicate is a model of Predicate. - * - * \pre The input range shall not overlap with either output range. - * - * The following code snippet demonstrates how to use \p partition_copy to separate a - * sequence into two output sequences of even and odd numbers using the \p thrust::host execution policy for parallelization: - * - * \code - * #include - * #include - * ... - * struct is_even - * { - * __host__ __device__ - * bool operator()(const int &x) - * { - * return (x % 2) == 0; - * } - * }; - * ... - * int A[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; - * int result[10]; - * const int N = sizeof(A)/sizeof(int); - * int *evens = result; - * int *odds = result + 5; - * thrust::partition_copy(thrust::host, A, A + N, evens, odds, is_even()); - * // A remains {1, 2, 3, 4, 5, 6, 7, 8, 9, 10} - * // result is now {2, 4, 6, 8, 10, 1, 3, 5, 7, 9} - * // evens points to {2, 4, 6, 8, 10} - * // odds points to {1, 3, 5, 7, 9} - * \endcode - * - * \note The relative order of elements in the two reordered sequences is not - * necessarily the same as it was in the original sequence. A different algorithm, - * \p stable_partition_copy, does guarantee to preserve the relative order. - * - * \see http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2569.pdf - * \see \p stable_partition_copy - * \see \p partition - */ -template -__host__ __device__ - thrust::pair - partition_copy(const thrust::detail::execution_policy_base &exec, - InputIterator first, - InputIterator last, - OutputIterator1 out_true, - OutputIterator2 out_false, - Predicate pred); - - -/*! \p partition_copy differs from \p partition only in that the reordered - * sequence is written to difference output sequences, rather than in place. - * - * \p partition_copy copies the elements [first, last) based on the - * function object \p pred. All of the elements that satisfy \p pred are copied - * to the range beginning at \p out_true and all the elements that fail to satisfy it - * are copied to the range beginning at \p out_false. - * - * \param first The beginning of the sequence to reorder. - * \param last The end of the sequence to reorder. - * \param out_true The destination of the resulting sequence of elements which satisfy \p pred. - * \param out_false The destination of the resulting sequence of elements which fail to satisfy \p pred. - * \param pred A function object which decides to which partition each element of the - * sequence [first, last) belongs. - * \return A \p pair p such that p.first is the end of the output range beginning - * at \p out_true and p.second is the end of the output range beginning at - * \p out_false. - * - * \tparam InputIterator is a model of Input Iterator, - * and \p InputIterator's \c value_type is convertible to \p Predicate's \c argument_type and \p InputIterator's \c value_type - * is convertible to \p OutputIterator1 and \p OutputIterator2's \c value_types. - * \tparam OutputIterator1 is a model of Output Iterator. - * \tparam OutputIterator2 is a model of Output Iterator. - * \tparam Predicate is a model of Predicate. - * - * \pre The input range shall not overlap with either output range. - * - * The following code snippet demonstrates how to use \p partition_copy to separate a - * sequence into two output sequences of even and odd numbers. - * - * \code - * #include - * ... - * struct is_even - * { - * __host__ __device__ - * bool operator()(const int &x) - * { - * return (x % 2) == 0; - * } - * }; - * ... - * int A[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; - * int result[10]; - * const int N = sizeof(A)/sizeof(int); - * int *evens = result; - * int *odds = result + 5; - * thrust::partition_copy(A, A + N, evens, odds, is_even()); - * // A remains {1, 2, 3, 4, 5, 6, 7, 8, 9, 10} - * // result is now {2, 4, 6, 8, 10, 1, 3, 5, 7, 9} - * // evens points to {2, 4, 6, 8, 10} - * // odds points to {1, 3, 5, 7, 9} - * \endcode - * - * \note The relative order of elements in the two reordered sequences is not - * necessarily the same as it was in the original sequence. A different algorithm, - * \p stable_partition_copy, does guarantee to preserve the relative order. - * - * \see http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2569.pdf - * \see \p stable_partition_copy - * \see \p partition - */ -template - thrust::pair - partition_copy(InputIterator first, - InputIterator last, - OutputIterator1 out_true, - OutputIterator2 out_false, - Predicate pred); - - -/*! \p partition_copy differs from \p partition only in that the reordered - * sequence is written to difference output sequences, rather than in place. - * - * \p partition_copy copies the elements [first, last) based on the - * function object \p pred which is applied to a range of stencil elements. All of the elements - * whose corresponding stencil element satisfies \p pred are copied to the range beginning at \p out_true - * and all the elements whose stencil element fails to satisfy it are copied to the range beginning - * at \p out_false. - * - * The algorithm's execution is parallelized as determined by \p exec. - * - * \param exec The execution policy to use for parallelization. - * \param first The beginning of the sequence to reorder. - * \param last The end of the sequence to reorder. - * \param stencil The beginning of the stencil sequence. - * \param out_true The destination of the resulting sequence of elements which satisfy \p pred. - * \param out_false The destination of the resulting sequence of elements which fail to satisfy \p pred. - * \param pred A function object which decides to which partition each element of the - * sequence [first, last) belongs. - * \return A \p pair p such that p.first is the end of the output range beginning - * at \p out_true and p.second is the end of the output range beginning at - * \p out_false. - * - * \tparam DerivedPolicy The name of the derived execution policy. - * \tparam InputIterator1 is a model of Input Iterator, - * and \p InputIterator's \c value_type is convertible to \p OutputIterator1 and \p OutputIterator2's \c value_types. - * \tparam InputIterator2 is a model of Input Iterator, - * and \p InputIterator2's \c value_type is convertible to \p Predicate's \c argument_type. - * \tparam OutputIterator1 is a model of Output Iterator. - * \tparam OutputIterator2 is a model of Output Iterator. - * \tparam Predicate is a model of Predicate. - * - * \pre The input ranges shall not overlap with either output range. - * - * The following code snippet demonstrates how to use \p partition_copy to separate a - * sequence into two output sequences of even and odd numbers using the \p thrust::host execution - * policy for parallelization. - * - * \code - * #include - * #include - * #include - * ... - * int A[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; - * int S[] = {0, 1, 0, 1, 0, 1, 0, 1, 0, 1}; - * int result[10]; - * const int N = sizeof(A)/sizeof(int); - * int *evens = result; - * int *odds = result + 5; - * thrust::stable_partition_copy(thrust::host, A, A + N, S, evens, odds, thrust::identity()); - * // A remains {1, 2, 3, 4, 5, 6, 7, 8, 9, 10} - * // S remains {0, 1, 0, 1, 0, 1, 0, 1, 0, 1} - * // result is now {2, 4, 6, 8, 10, 1, 3, 5, 7, 9} - * // evens points to {2, 4, 6, 8, 10} - * // odds points to {1, 3, 5, 7, 9} - * \endcode - * - * \note The relative order of elements in the two reordered sequences is not - * necessarily the same as it was in the original sequence. A different algorithm, - * \p stable_partition_copy, does guarantee to preserve the relative order. - * - * \see http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2569.pdf - * \see \p stable_partition_copy - * \see \p partition - */ -template -__host__ __device__ - thrust::pair - partition_copy(const thrust::detail::execution_policy_base &exec, - InputIterator1 first, - InputIterator1 last, - InputIterator2 stencil, - OutputIterator1 out_true, - OutputIterator2 out_false, - Predicate pred); - - -/*! \p partition_copy differs from \p partition only in that the reordered - * sequence is written to difference output sequences, rather than in place. - * - * \p partition_copy copies the elements [first, last) based on the - * function object \p pred which is applied to a range of stencil elements. All of the elements - * whose corresponding stencil element satisfies \p pred are copied to the range beginning at \p out_true - * and all the elements whose stencil element fails to satisfy it are copied to the range beginning - * at \p out_false. - * - * \param first The beginning of the sequence to reorder. - * \param last The end of the sequence to reorder. - * \param stencil The beginning of the stencil sequence. - * \param out_true The destination of the resulting sequence of elements which satisfy \p pred. - * \param out_false The destination of the resulting sequence of elements which fail to satisfy \p pred. - * \param pred A function object which decides to which partition each element of the - * sequence [first, last) belongs. - * \return A \p pair p such that p.first is the end of the output range beginning - * at \p out_true and p.second is the end of the output range beginning at - * \p out_false. - * - * \tparam InputIterator1 is a model of Input Iterator, - * and \p InputIterator's \c value_type is convertible to \p OutputIterator1 and \p OutputIterator2's \c value_types. - * \tparam InputIterator2 is a model of Input Iterator, - * and \p InputIterator2's \c value_type is convertible to \p Predicate's \c argument_type. - * \tparam OutputIterator1 is a model of Output Iterator. - * \tparam OutputIterator2 is a model of Output Iterator. - * \tparam Predicate is a model of Predicate. - * - * \pre The input ranges shall not overlap with either output range. - * - * The following code snippet demonstrates how to use \p partition_copy to separate a - * sequence into two output sequences of even and odd numbers. - * - * \code - * #include - * #include - * ... - * int A[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; - * int S[] = {0, 1, 0, 1, 0, 1, 0, 1, 0, 1}; - * int result[10]; - * const int N = sizeof(A)/sizeof(int); - * int *evens = result; - * int *odds = result + 5; - * thrust::stable_partition_copy(A, A + N, S, evens, odds, thrust::identity()); - * // A remains {1, 2, 3, 4, 5, 6, 7, 8, 9, 10} - * // S remains {0, 1, 0, 1, 0, 1, 0, 1, 0, 1} - * // result is now {2, 4, 6, 8, 10, 1, 3, 5, 7, 9} - * // evens points to {2, 4, 6, 8, 10} - * // odds points to {1, 3, 5, 7, 9} - * \endcode - * - * \note The relative order of elements in the two reordered sequences is not - * necessarily the same as it was in the original sequence. A different algorithm, - * \p stable_partition_copy, does guarantee to preserve the relative order. - * - * \see http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2569.pdf - * \see \p stable_partition_copy - * \see \p partition - */ -template - thrust::pair - partition_copy(InputIterator1 first, - InputIterator1 last, - InputIterator2 stencil, - OutputIterator1 out_true, - OutputIterator2 out_false, - Predicate pred); - - -/*! \p stable_partition is much like \p partition : it reorders the elements in the - * range [first, last) based on the function object \p pred, such that all of - * the elements that satisfy \p pred precede all of the elements that fail to satisfy - * it. The postcondition is that, for some iterator \p middle in the range - * [first, last), pred(*i) is \c true for every iterator \c i in the - * range [first,middle) and \c false for every iterator \c i in the range - * [middle, last). The return value of \p stable_partition is \c middle. - * - * \p stable_partition differs from \p partition in that \p stable_partition is - * guaranteed to preserve relative order. That is, if \c x and \c y are elements in - * [first, last), and \c stencil_x and \c stencil_y are the stencil elements - * in corresponding positions within [stencil, stencil + (last - first)), - * and pred(stencil_x) == pred(stencil_y), and if \c x precedes - * \c y, then it will still be true after \p stable_partition that \c x precedes \c y. - * - * The algorithm's execution is parallelized as determined by \p exec. - * - * \param exec The execution policy to use for parallelization. - * \param first The first element of the sequence to reorder. - * \param last One position past the last element of the sequence to reorder. - * \param pred A function object which decides to which partition each element of the - * sequence [first, last) belongs. - * \return An iterator referring to the first element of the second partition, that is, - * the sequence of the elements which do not satisfy pred. - * - * \tparam DerivedPolicy The name of the derived execution policy. - * \tparam ForwardIterator is a model of Forward Iterator, - * and \p ForwardIterator's \c value_type is convertible to \p Predicate's \c argument_type, - * and \p ForwardIterator is mutable. - * \tparam Predicate is a model of Predicate. - * - * The following code snippet demonstrates how to use \p stable_partition to reorder a - * sequence so that even numbers precede odd numbers using the \p thrust::host execution policy for parallelization: - * - * \code - * #include - * #include - * ... - * struct is_even - * { - * __host__ __device__ - * bool operator()(const int &x) - * { - * return (x % 2) == 0; - * } - * }; - * ... - * int A[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; - * const int N = sizeof(A)/sizeof(int); - * thrust::stable_partition(thrust::host, - * A, A + N, - * is_even()); - * // A is now {2, 4, 6, 8, 10, 1, 3, 5, 7, 9} - * \endcode - * - * \see http://www.sgi.com/tech/stl/stable_partition.html - * \see \p partition - * \see \p stable_partition_copy - */ -template -__host__ __device__ - ForwardIterator stable_partition(const thrust::detail::execution_policy_base &exec, - ForwardIterator first, - ForwardIterator last, - Predicate pred); - - -/*! \p stable_partition is much like \p partition : it reorders the elements in the - * range [first, last) based on the function object \p pred, such that all of - * the elements that satisfy \p pred precede all of the elements that fail to satisfy - * it. The postcondition is that, for some iterator \p middle in the range - * [first, last), pred(*i) is \c true for every iterator \c i in the - * range [first,middle) and \c false for every iterator \c i in the range - * [middle, last). The return value of \p stable_partition is \c middle. - * - * \p stable_partition differs from \p partition in that \p stable_partition is - * guaranteed to preserve relative order. That is, if \c x and \c y are elements in - * [first, last), and \c stencil_x and \c stencil_y are the stencil elements - * in corresponding positions within [stencil, stencil + (last - first)), - * and pred(stencil_x) == pred(stencil_y), and if \c x precedes - * \c y, then it will still be true after \p stable_partition that \c x precedes \c y. - * - * \param first The first element of the sequence to reorder. - * \param last One position past the last element of the sequence to reorder. - * \param pred A function object which decides to which partition each element of the - * sequence [first, last) belongs. - * \return An iterator referring to the first element of the second partition, that is, - * the sequence of the elements which do not satisfy pred. - * - * \tparam ForwardIterator is a model of Forward Iterator, - * and \p ForwardIterator's \c value_type is convertible to \p Predicate's \c argument_type, - * and \p ForwardIterator is mutable. - * \tparam Predicate is a model of Predicate. - * - * The following code snippet demonstrates how to use \p stable_partition to reorder a - * sequence so that even numbers precede odd numbers. - * - * \code - * #include - * ... - * struct is_even - * { - * __host__ __device__ - * bool operator()(const int &x) - * { - * return (x % 2) == 0; - * } - * }; - * ... - * int A[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; - * const int N = sizeof(A)/sizeof(int); - * thrust::stable_partition(A, A + N, - * is_even()); - * // A is now {2, 4, 6, 8, 10, 1, 3, 5, 7, 9} - * \endcode - * - * \see http://www.sgi.com/tech/stl/stable_partition.html - * \see \p partition - * \see \p stable_partition_copy - */ -template - ForwardIterator stable_partition(ForwardIterator first, - ForwardIterator last, - Predicate pred); - - -/*! \p stable_partition is much like \p partition: it reorders the elements in the - * range [first, last) based on the function object \p pred applied to a stencil - * range [stencil, stencil + (last - first)), such that all of - * the elements whose corresponding stencil element satisfies \p pred precede all of the elements whose - * corresponding stencil element fails to satisfy it. The postcondition is that, for some iterator - * \c middle in the range [first, last), pred(*stencil_i) is \c true for every iterator - * \c stencil_i in the range [stencil,stencil + (middle - first)) and \c false for every iterator \c stencil_i - * in the range [stencil + (middle - first), stencil + (last - first)). - * The return value of \p stable_partition is \c middle. - * - * \p stable_partition differs from \p partition in that \p stable_partition is - * guaranteed to preserve relative order. That is, if \c x and \c y are elements in - * [first, last), such that pred(x) == pred(y), and if \c x precedes - * \c y, then it will still be true after \p stable_partition that \c x precedes \c y. - * - * The algorithm's execution is parallelized as determined by \p exec. - * - * \param exec The execution policy to use for parallelization. - * \param first The first element of the sequence to reorder. - * \param last One position past the last element of the sequence to reorder. - * \param stencil The beginning of the stencil sequence. - * \param pred A function object which decides to which partition each element of the - * sequence [first, last) belongs. - * \return An iterator referring to the first element of the second partition, that is, - * the sequence of the elements whose stencil elements do not satisfy \p pred. - * - * \tparam DerivedPolicy The name of the derived execution policy. - * \tparam ForwardIterator is a model of Forward Iterator, - * and \p ForwardIterator is mutable. - * \tparam InputIterator is a model of Input Iterator, - * and \p InputIterator's \c value_type is convertible to \p Predicate's \c argument_type. - * \tparam Predicate is a model of Predicate. - * - * \pre The range [first, last) shall not overlap with the range [stencil, stencil + (last - first)). - * - * The following code snippet demonstrates how to use \p stable_partition to reorder a - * sequence so that even numbers precede odd numbers using the \p thrust::host execution policy for parallelization: - * - * \code - * #include - * #include - * ... - * struct is_even - * { - * __host__ __device__ - * bool operator()(const int &x) - * { - * return (x % 2) == 0; - * } - * }; - * ... - * int A[] = {0, 1, 0, 1, 0, 1, 0, 1, 0, 1}; - * int S[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; - * const int N = sizeof(A)/sizeof(int); - * thrust::stable_partition(thrust::host, A, A + N, S, is_even()); - * // A is now {1, 1, 1, 1, 1, 0, 0, 0, 0, 0} - * // S is unmodified - * \endcode - * - * \see http://www.sgi.com/tech/stl/stable_partition.html - * \see \p partition - * \see \p stable_partition_copy - */ -template -__host__ __device__ - ForwardIterator stable_partition(const thrust::detail::execution_policy_base &exec, - ForwardIterator first, - ForwardIterator last, - InputIterator stencil, - Predicate pred); - - -/*! \p stable_partition is much like \p partition: it reorders the elements in the - * range [first, last) based on the function object \p pred applied to a stencil - * range [stencil, stencil + (last - first)), such that all of - * the elements whose corresponding stencil element satisfies \p pred precede all of the elements whose - * corresponding stencil element fails to satisfy it. The postcondition is that, for some iterator - * \c middle in the range [first, last), pred(*stencil_i) is \c true for every iterator - * \c stencil_i in the range [stencil,stencil + (middle - first)) and \c false for every iterator \c stencil_i - * in the range [stencil + (middle - first), stencil + (last - first)). - * The return value of \p stable_partition is \c middle. - * - * \p stable_partition differs from \p partition in that \p stable_partition is - * guaranteed to preserve relative order. That is, if \c x and \c y are elements in - * [first, last), such that pred(x) == pred(y), and if \c x precedes - * \c y, then it will still be true after \p stable_partition that \c x precedes \c y. - * - * \param first The first element of the sequence to reorder. - * \param last One position past the last element of the sequence to reorder. - * \param stencil The beginning of the stencil sequence. - * \param pred A function object which decides to which partition each element of the - * sequence [first, last) belongs. - * \return An iterator referring to the first element of the second partition, that is, - * the sequence of the elements whose stencil elements do not satisfy \p pred. - * - * \tparam ForwardIterator is a model of Forward Iterator, - * and \p ForwardIterator is mutable. - * \tparam InputIterator is a model of Input Iterator, - * and \p InputIterator's \c value_type is convertible to \p Predicate's \c argument_type. - * \tparam Predicate is a model of Predicate. - * - * \pre The range [first, last) shall not overlap with the range [stencil, stencil + (last - first)). - * - * The following code snippet demonstrates how to use \p stable_partition to reorder a - * sequence so that even numbers precede odd numbers. - * - * \code - * #include - * ... - * struct is_even - * { - * __host__ __device__ - * bool operator()(const int &x) - * { - * return (x % 2) == 0; - * } - * }; - * ... - * int A[] = {0, 1, 0, 1, 0, 1, 0, 1, 0, 1}; - * int S[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; - * const int N = sizeof(A)/sizeof(int); - * thrust::stable_partition(A, A + N, S, is_even()); - * // A is now {1, 1, 1, 1, 1, 0, 0, 0, 0, 0} - * // S is unmodified - * \endcode - * - * \see http://www.sgi.com/tech/stl/stable_partition.html - * \see \p partition - * \see \p stable_partition_copy - */ -template - ForwardIterator stable_partition(ForwardIterator first, - ForwardIterator last, - InputIterator stencil, - Predicate pred); - - -/*! \p stable_partition_copy differs from \p stable_partition only in that the reordered - * sequence is written to different output sequences, rather than in place. - * - * \p stable_partition_copy copies the elements [first, last) based on the - * function object \p pred. All of the elements that satisfy \p pred are copied - * to the range beginning at \p out_true and all the elements that fail to satisfy it - * are copied to the range beginning at \p out_false. - * - * \p stable_partition_copy differs from \p partition_copy in that - * \p stable_partition_copy is guaranteed to preserve relative order. That is, if - * \c x and \c y are elements in [first, last), such that - * pred(x) == pred(y), and if \c x precedes \c y, then it will still be true - * after \p stable_partition_copy that \c x precedes \c y in the output. - * - * The algorithm's execution is parallelized as determined by \p exec. - * - * \param exec The execution policy to use for parallelization. - * \param first The first element of the sequence to reorder. - * \param last One position past the last element of the sequence to reorder. - * \param out_true The destination of the resulting sequence of elements which satisfy \p pred. - * \param out_false The destination of the resulting sequence of elements which fail to satisfy \p pred. - * \param pred A function object which decides to which partition each element of the - * sequence [first, last) belongs. - * \return A \p pair p such that p.first is the end of the output range beginning - * at \p out_true and p.second is the end of the output range beginning at - * \p out_false. - * - * \tparam DerivedPolicy The name of the derived execution policy. - * \tparam InputIterator is a model of Input Iterator, - * and \p InputIterator's \c value_type is convertible to \p Predicate's \c argument_type and \p InputIterator's \c value_type - * is convertible to \p OutputIterator1 and \p OutputIterator2's \c value_types. - * \tparam OutputIterator1 is a model of Output Iterator. - * \tparam OutputIterator2 is a model of Output Iterator. - * \tparam Predicate is a model of Predicate. - * - * \pre The input ranges shall not overlap with either output range. - * - * The following code snippet demonstrates how to use \p stable_partition_copy to - * reorder a sequence so that even numbers precede odd numbers using the \p thrust::host execution policy for parallelization: - * - * \code - * #include - * #include - * ... - * struct is_even - * { - * __host__ __device__ - * bool operator()(const int &x) - * { - * return (x % 2) == 0; - * } - * }; - * ... - * int A[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; - * int result[10]; - * const int N = sizeof(A)/sizeof(int); - * int *evens = result; - * int *odds = result + 5; - * thrust::stable_partition_copy(thrust::host, A, A + N, evens, odds, is_even()); - * // A remains {1, 2, 3, 4, 5, 6, 7, 8, 9, 10} - * // result is now {2, 4, 6, 8, 10, 1, 3, 5, 7, 9} - * // evens points to {2, 4, 6, 8, 10} - * // odds points to {1, 3, 5, 7, 9} - * \endcode - * - * \see http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2569.pdf - * \see \p partition_copy - * \see \p stable_partition - */ -template -__host__ __device__ - thrust::pair - stable_partition_copy(const thrust::detail::execution_policy_base &exec, - InputIterator first, - InputIterator last, - OutputIterator1 out_true, - OutputIterator2 out_false, - Predicate pred); - - -/*! \p stable_partition_copy differs from \p stable_partition only in that the reordered - * sequence is written to different output sequences, rather than in place. - * - * \p stable_partition_copy copies the elements [first, last) based on the - * function object \p pred. All of the elements that satisfy \p pred are copied - * to the range beginning at \p out_true and all the elements that fail to satisfy it - * are copied to the range beginning at \p out_false. - * - * \p stable_partition_copy differs from \p partition_copy in that - * \p stable_partition_copy is guaranteed to preserve relative order. That is, if - * \c x and \c y are elements in [first, last), such that - * pred(x) == pred(y), and if \c x precedes \c y, then it will still be true - * after \p stable_partition_copy that \c x precedes \c y in the output. - * - * \param first The first element of the sequence to reorder. - * \param last One position past the last element of the sequence to reorder. - * \param out_true The destination of the resulting sequence of elements which satisfy \p pred. - * \param out_false The destination of the resulting sequence of elements which fail to satisfy \p pred. - * \param pred A function object which decides to which partition each element of the - * sequence [first, last) belongs. - * \return A \p pair p such that p.first is the end of the output range beginning - * at \p out_true and p.second is the end of the output range beginning at - * \p out_false. - * - * \tparam InputIterator is a model of Input Iterator, - * and \p InputIterator's \c value_type is convertible to \p Predicate's \c argument_type and \p InputIterator's \c value_type - * is convertible to \p OutputIterator1 and \p OutputIterator2's \c value_types. - * \tparam OutputIterator1 is a model of Output Iterator. - * \tparam OutputIterator2 is a model of Output Iterator. - * \tparam Predicate is a model of Predicate. - * - * \pre The input ranges shall not overlap with either output range. - * - * The following code snippet demonstrates how to use \p stable_partition_copy to - * reorder a sequence so that even numbers precede odd numbers. - * - * \code - * #include - * ... - * struct is_even - * { - * __host__ __device__ - * bool operator()(const int &x) - * { - * return (x % 2) == 0; - * } - * }; - * ... - * int A[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; - * int result[10]; - * const int N = sizeof(A)/sizeof(int); - * int *evens = result; - * int *odds = result + 5; - * thrust::stable_partition_copy(A, A + N, evens, odds, is_even()); - * // A remains {1, 2, 3, 4, 5, 6, 7, 8, 9, 10} - * // result is now {2, 4, 6, 8, 10, 1, 3, 5, 7, 9} - * // evens points to {2, 4, 6, 8, 10} - * // odds points to {1, 3, 5, 7, 9} - * \endcode - * - * \see http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2569.pdf - * \see \p partition_copy - * \see \p stable_partition - */ -template - thrust::pair - stable_partition_copy(InputIterator first, - InputIterator last, - OutputIterator1 out_true, - OutputIterator2 out_false, - Predicate pred); - - -/*! \p stable_partition_copy differs from \p stable_partition only in that the reordered - * sequence is written to different output sequences, rather than in place. - * - * \p stable_partition_copy copies the elements [first, last) based on the - * function object \p pred which is applied to a range of stencil elements. All of the elements - * whose corresponding stencil element satisfies \p pred are copied to the range beginning at \p out_true - * and all the elements whose stencil element fails to satisfy it are copied to the range beginning - * at \p out_false. - * - * \p stable_partition_copy differs from \p partition_copy in that - * \p stable_partition_copy is guaranteed to preserve relative order. That is, if - * \c x and \c y are elements in [first, last), such that - * pred(x) == pred(y), and if \c x precedes \c y, then it will still be true - * after \p stable_partition_copy that \c x precedes \c y in the output. - * - * The algorithm's execution is parallelized as determined by \p exec. - * - * \param exec The execution policy to use for parallelization. - * \param first The first element of the sequence to reorder. - * \param last One position past the last element of the sequence to reorder. - * \param stencil The beginning of the stencil sequence. - * \param out_true The destination of the resulting sequence of elements which satisfy \p pred. - * \param out_false The destination of the resulting sequence of elements which fail to satisfy \p pred. - * \param pred A function object which decides to which partition each element of the - * sequence [first, last) belongs. - * \return A \p pair p such that p.first is the end of the output range beginning - * at \p out_true and p.second is the end of the output range beginning at - * \p out_false. - * - * \tparam DerivedPolicy The name of the derived execution policy. - * \tparam InputIterator1 is a model of Input Iterator, - * and \p InputIterator's \c value_type is convertible to \p OutputIterator1 and \p OutputIterator2's \c value_types. - * \tparam InputIterator2 is a model of Input Iterator, - * and \p InputIterator2's \c value_type is convertible to \p Predicate's \c argument_type. - * \tparam OutputIterator1 is a model of Output Iterator. - * \tparam OutputIterator2 is a model of Output Iterator. - * \tparam Predicate is a model of Predicate. - * - * \pre The input ranges shall not overlap with either output range. - * - * The following code snippet demonstrates how to use \p stable_partition_copy to - * reorder a sequence so that even numbers precede odd numbers using the \p thrust::host execution policy for parallelization: - * - * \code - * #include - * #include - * #include - * ... - * int A[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; - * int S[] = {0, 1, 0, 1, 0, 1, 0, 1, 0, 1}; - * int result[10]; - * const int N = sizeof(A)/sizeof(int); - * int *evens = result; - * int *odds = result + 5; - * thrust::stable_partition_copy(thrust::host, A, A + N, S, evens, odds, thrust::identity()); - * // A remains {1, 2, 3, 4, 5, 6, 7, 8, 9, 10} - * // S remains {0, 1, 0, 1, 0, 1, 0, 1, 0, 1} - * // result is now {2, 4, 6, 8, 10, 1, 3, 5, 7, 9} - * // evens points to {2, 4, 6, 8, 10} - * // odds points to {1, 3, 5, 7, 9} - * \endcode - * - * \see http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2569.pdf - * \see \p partition_copy - * \see \p stable_partition - */ -template -__host__ __device__ - thrust::pair - stable_partition_copy(const thrust::detail::execution_policy_base &exec, - InputIterator1 first, - InputIterator1 last, - InputIterator2 stencil, - OutputIterator1 out_true, - OutputIterator2 out_false, - Predicate pred); - - -/*! \p stable_partition_copy differs from \p stable_partition only in that the reordered - * sequence is written to different output sequences, rather than in place. - * - * \p stable_partition_copy copies the elements [first, last) based on the - * function object \p pred which is applied to a range of stencil elements. All of the elements - * whose corresponding stencil element satisfies \p pred are copied to the range beginning at \p out_true - * and all the elements whose stencil element fails to satisfy it are copied to the range beginning - * at \p out_false. - * - * \p stable_partition_copy differs from \p partition_copy in that - * \p stable_partition_copy is guaranteed to preserve relative order. That is, if - * \c x and \c y are elements in [first, last), such that - * pred(x) == pred(y), and if \c x precedes \c y, then it will still be true - * after \p stable_partition_copy that \c x precedes \c y in the output. - * - * \param first The first element of the sequence to reorder. - * \param last One position past the last element of the sequence to reorder. - * \param stencil The beginning of the stencil sequence. - * \param out_true The destination of the resulting sequence of elements which satisfy \p pred. - * \param out_false The destination of the resulting sequence of elements which fail to satisfy \p pred. - * \param pred A function object which decides to which partition each element of the - * sequence [first, last) belongs. - * \return A \p pair p such that p.first is the end of the output range beginning - * at \p out_true and p.second is the end of the output range beginning at - * \p out_false. - * - * \tparam InputIterator1 is a model of Input Iterator, - * and \p InputIterator's \c value_type is convertible to \p OutputIterator1 and \p OutputIterator2's \c value_types. - * \tparam InputIterator2 is a model of Input Iterator, - * and \p InputIterator2's \c value_type is convertible to \p Predicate's \c argument_type. - * \tparam OutputIterator1 is a model of Output Iterator. - * \tparam OutputIterator2 is a model of Output Iterator. - * \tparam Predicate is a model of Predicate. - * - * \pre The input ranges shall not overlap with either output range. - * - * The following code snippet demonstrates how to use \p stable_partition_copy to - * reorder a sequence so that even numbers precede odd numbers. - * - * \code - * #include - * #include - * ... - * int A[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; - * int S[] = {0, 1, 0, 1, 0, 1, 0, 1, 0, 1}; - * int result[10]; - * const int N = sizeof(A)/sizeof(int); - * int *evens = result; - * int *odds = result + 5; - * thrust::stable_partition_copy(A, A + N, S, evens, odds, thrust::identity()); - * // A remains {1, 2, 3, 4, 5, 6, 7, 8, 9, 10} - * // S remains {0, 1, 0, 1, 0, 1, 0, 1, 0, 1} - * // result is now {2, 4, 6, 8, 10, 1, 3, 5, 7, 9} - * // evens points to {2, 4, 6, 8, 10} - * // odds points to {1, 3, 5, 7, 9} - * \endcode - * - * \see http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2569.pdf - * \see \p partition_copy - * \see \p stable_partition - */ -template - thrust::pair - stable_partition_copy(InputIterator1 first, - InputIterator1 last, - InputIterator2 stencil, - OutputIterator1 out_true, - OutputIterator2 out_false, - Predicate pred); - - -/*! \} // end stream_compaction - */ - -/*! \} // end reordering - */ - -/*! \addtogroup searching - * \{ - */ - - -/*! \p partition_point returns an iterator pointing to the end of the true - * partition of a partitioned range. \p partition_point requires the input range - * [first,last) to be a partition; that is, all elements which satisfy - * pred shall appear before those that do not. - * - * The algorithm's execution is parallelized as determined by \p exec. - * - * \param exec The execution policy to use for parallelization. - * \param first The beginning of the range to consider. - * \param last The end of the range to consider. - * \param pred A function object which decides to which partition each element of the - * range [first, last) belongs. - * \return An iterator \c mid such that all_of(first, mid, pred) - * and none_of(mid, last, pred) are both true. - * - * \tparam DerivedPolicy The name of the derived execution policy. - * \tparam ForwardIterator is a model of Forward Iterator, - * and \p ForwardIterator's \c value_type is convertible to \p Predicate's \c argument_type. - * \tparam Predicate is a model of Predicate. - * - * \pre The range [first, last) shall be partitioned by \p pred. - * - * \note Though similar, \p partition_point is not redundant with \p find_if_not. - * \p partition_point's precondition provides an opportunity for a - * faster implemention. - * - * \code - * #include - * #include - * - * struct is_even - * { - * __host__ __device__ - * bool operator()(const int &x) - * { - * return (x % 2) == 0; - * } - * }; - * - * ... - * - * int A[] = {2, 4, 6, 8, 10, 1, 3, 5, 7, 9}; - * int * B = thrust::partition_point(thrust::host, A, A + 10, is_even()); - * // B - A is 5 - * // [A, B) contains only even values - * \endcode - * - * \see \p partition - * \see \p find_if_not - */ -template -__host__ __device__ - ForwardIterator partition_point(const thrust::detail::execution_policy_base &exec, - ForwardIterator first, - ForwardIterator last, - Predicate pred); - - -/*! \p partition_point returns an iterator pointing to the end of the true - * partition of a partitioned range. \p partition_point requires the input range - * [first,last) to be a partition; that is, all elements which satisfy - * pred shall appear before those that do not. - * \param first The beginning of the range to consider. - * \param last The end of the range to consider. - * \param pred A function object which decides to which partition each element of the - * range [first, last) belongs. - * \return An iterator \c mid such that all_of(first, mid, pred) - * and none_of(mid, last, pred) are both true. - * - * \tparam ForwardIterator is a model of Forward Iterator, - * and \p ForwardIterator's \c value_type is convertible to \p Predicate's \c argument_type. - * \tparam Predicate is a model of Predicate. - * - * \pre The range [first, last) shall be partitioned by \p pred. - * - * \note Though similar, \p partition_point is not redundant with \p find_if_not. - * \p partition_point's precondition provides an opportunity for a - * faster implemention. - * - * \code - * #include - * - * struct is_even - * { - * __host__ __device__ - * bool operator()(const int &x) - * { - * return (x % 2) == 0; - * } - * }; - * - * ... - * - * int A[] = {2, 4, 6, 8, 10, 1, 3, 5, 7, 9}; - * int * B = thrust::partition_point(A, A + 10, is_even()); - * // B - A is 5 - * // [A, B) contains only even values - * \endcode - * - * \see \p partition - * \see \p find_if_not - */ -template - ForwardIterator partition_point(ForwardIterator first, - ForwardIterator last, - Predicate pred); - -/*! \} // searching - */ - -/*! \addtogroup reductions - * \{ - * \addtogroup predicates - * \{ - */ - - -/*! \p is_partitioned returns \c true if the given range - * is partitioned with respect to a predicate, and \c false otherwise. - * - * Specifically, \p is_partitioned returns \c true if [first, last) - * is empty of if [first, last) is partitioned by \p pred, i.e. if - * all elements that satisfy \p pred appear before those that do not. - * - * The algorithm's execution is parallelized as determined by \p exec. - * - * \param exec The execution policy to use for parallelization. - * \param first The beginning of the range to consider. - * \param last The end of the range to consider. - * \param pred A function object which decides to which partition each element of the - * range [first, last) belongs. - * \return \c true if the range [first, last) is partitioned with respect - * to \p pred, or if [first, last) is empty. \c false, otherwise. - * - * \tparam DerivedPolicy The name of the derived execution policy. - * \tparam InputIterator is a model of Input Iterator, - * and \p InputIterator's \c value_type is convertible to \p Predicate's \c argument_type. - * \tparam Predicate is a model of Predicate. - * - * \code - * #include - * #include - * - * struct is_even - * { - * __host__ __device__ - * bool operator()(const int &x) - * { - * return (x % 2) == 0; - * } - * }; - * - * ... - * - * int A[] = {2, 4, 6, 8, 10, 1, 3, 5, 7, 9}; - * int B[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; - * - * thrust::is_partitioned(thrust::host, A, A + 10, is_even()); // returns true - * thrust::is_partitioned(thrust::host, B, B + 10, is_even()); // returns false - * \endcode - * - * \see \p partition - */ -template -__host__ __device__ - bool is_partitioned(const thrust::detail::execution_policy_base &exec, - InputIterator first, - InputIterator last, - Predicate pred); - - -/*! \p is_partitioned returns \c true if the given range - * is partitioned with respect to a predicate, and \c false otherwise. - * - * Specifically, \p is_partitioned returns \c true if [first, last) - * is empty of if [first, last) is partitioned by \p pred, i.e. if - * all elements that satisfy \p pred appear before those that do not. - * - * \param first The beginning of the range to consider. - * \param last The end of the range to consider. - * \param pred A function object which decides to which partition each element of the - * range [first, last) belongs. - * \return \c true if the range [first, last) is partitioned with respect - * to \p pred, or if [first, last) is empty. \c false, otherwise. - * - * \tparam InputIterator is a model of Input Iterator, - * and \p InputIterator's \c value_type is convertible to \p Predicate's \c argument_type. - * \tparam Predicate is a model of Predicate. - * - * \code - * #include - * - * struct is_even - * { - * __host__ __device__ - * bool operator()(const int &x) - * { - * return (x % 2) == 0; - * } - * }; - * - * ... - * - * int A[] = {2, 4, 6, 8, 10, 1, 3, 5, 7, 9}; - * int B[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; - * - * thrust::is_partitioned(A, A + 10, is_even()); // returns true - * thrust::is_partitioned(B, B + 10, is_even()); // returns false - * \endcode - * - * \see \p partition - */ -template - bool is_partitioned(InputIterator first, - InputIterator last, - Predicate pred); - - -/*! \} // end predicates - * \} // end reductions - */ - - -} // end thrust - -#include - diff --git a/spaces/CVPR/LIVE/thrust/thrust/random/detail/normal_distribution_base.h b/spaces/CVPR/LIVE/thrust/thrust/random/detail/normal_distribution_base.h deleted file mode 100644 index 2a3bd4470b576465a77a289fee9f959d027e5b03..0000000000000000000000000000000000000000 --- a/spaces/CVPR/LIVE/thrust/thrust/random/detail/normal_distribution_base.h +++ /dev/null @@ -1,149 +0,0 @@ -/* - * Copyright 2008-2013 NVIDIA Corporation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * Copyright Jens Maurer 2000-2001 - * Distributed under the Boost Software License, Version 1.0. (See - * accompanying file LICENSE_1_0.txt or copy at - * http://www.boost.org/LICENSE_1_0.txt) - */ - -#pragma once - -#include -#include -#include -#include -#include - -namespace thrust -{ -namespace random -{ -namespace detail -{ - -// this version samples the normal distribution directly -// and uses the non-standard math function erfcinv -template - class normal_distribution_nvcc -{ - protected: - template - __host__ __device__ - RealType sample(UniformRandomNumberGenerator &urng, const RealType mean, const RealType stddev) - { - typedef typename UniformRandomNumberGenerator::result_type uint_type; - const uint_type urng_range = UniformRandomNumberGenerator::max - UniformRandomNumberGenerator::min; - - // Constants for conversion - const RealType S1 = static_cast(1) / urng_range; - const RealType S2 = S1 / 2; - - RealType S3 = static_cast(-1.4142135623730950488016887242097); // -sqrt(2) - - // Get the integer value - uint_type u = urng() - UniformRandomNumberGenerator::min; - - // Ensure the conversion to float will give a value in the range [0,0.5) - if(u > (urng_range / 2)) - { - u = urng_range - u; - S3 = -S3; - } - - // Convert to floating point in [0,0.5) - RealType p = u*S1 + S2; - - // Apply inverse error function - return mean + stddev * S3 * erfcinv(2 * p); - } - - // no-op - __host__ __device__ - void reset() {} -}; - -// this version samples the normal distribution using -// Marsaglia's "polar method" -template - class normal_distribution_portable -{ - protected: - normal_distribution_portable() - : m_r1(), m_r2(), m_cached_rho(), m_valid(false) - {} - - normal_distribution_portable(const normal_distribution_portable &other) - : m_r1(other.m_r1), m_r2(other.m_r2), m_cached_rho(other.m_cached_rho), m_valid(other.m_valid) - {} - - void reset() - { - m_valid = false; - } - - // note that we promise to call this member function with the same mean and stddev - template - __host__ __device__ - RealType sample(UniformRandomNumberGenerator &urng, const RealType mean, const RealType stddev) - { - // implementation from Boost - // allow for Koenig lookup - using std::sqrt; using std::log; using std::sin; using std::cos; - - if(!m_valid) - { - uniform_real_distribution u01; - m_r1 = u01(urng); - m_r2 = u01(urng); - m_cached_rho = sqrt(-RealType(2) * log(RealType(1)-m_r2)); - - m_valid = true; - } - else - { - m_valid = false; - } - - const RealType pi = RealType(3.14159265358979323846); - - RealType result = m_cached_rho * (m_valid ? - cos(RealType(2)*pi*m_r1) : - sin(RealType(2)*pi*m_r1)); - - return mean + stddev * result; - } - - private: - RealType m_r1, m_r2, m_cached_rho; - bool m_valid; -}; - -template - struct normal_distribution_base -{ -#if THRUST_DEVICE_COMPILER == THRUST_DEVICE_COMPILER_NVCC && !defined(__NVCOMPILER_CUDA__) - typedef normal_distribution_nvcc type; -#else - typedef normal_distribution_portable type; -#endif -}; - -} // end detail -} // end random -} // end thrust - diff --git a/spaces/CVPR/LIVE/thrust/thrust/system/cuda/detail/assign_value.h b/spaces/CVPR/LIVE/thrust/thrust/system/cuda/detail/assign_value.h deleted file mode 100644 index f6fd987bf3f814f389b01499a06b313517b69733..0000000000000000000000000000000000000000 --- a/spaces/CVPR/LIVE/thrust/thrust/system/cuda/detail/assign_value.h +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright 2008-2013 NVIDIA Corporation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#if THRUST_DEVICE_COMPILER == THRUST_DEVICE_COMPILER_NVCC -#include -#include -#include -#include -#include - - -namespace thrust -{ -namespace cuda_cub { - - -template -inline __host__ __device__ - void assign_value(thrust::cuda::execution_policy &exec, Pointer1 dst, Pointer2 src) -{ - // XXX war nvbugs/881631 - struct war_nvbugs_881631 - { - __host__ inline static void host_path(thrust::cuda::execution_policy &exec, Pointer1 dst, Pointer2 src) - { - cuda_cub::copy(exec, src, src + 1, dst); - } - - __device__ inline static void device_path(thrust::cuda::execution_policy &, Pointer1 dst, Pointer2 src) - { - *thrust::raw_pointer_cast(dst) = *thrust::raw_pointer_cast(src); - } - }; - - if (THRUST_IS_HOST_CODE) { - #if THRUST_INCLUDE_HOST_CODE - war_nvbugs_881631::host_path(exec,dst,src); - #endif - } else { - #if THRUST_INCLUDE_DEVICE_CODE - war_nvbugs_881631::device_path(exec,dst,src); - #endif - } -} // end assign_value() - - -template -inline __host__ __device__ - void assign_value(cross_system &systems, Pointer1 dst, Pointer2 src) -{ - // XXX war nvbugs/881631 - struct war_nvbugs_881631 - { - __host__ inline static void host_path(cross_system &systems, Pointer1 dst, Pointer2 src) - { - // rotate the systems so that they are ordered the same as (src, dst) - // for the call to thrust::copy - cross_system rotated_systems = systems.rotate(); - cuda_cub::copy(rotated_systems, src, src + 1, dst); - } - - __device__ inline static void device_path(cross_system &, Pointer1 dst, Pointer2 src) - { - // XXX forward the true cuda::execution_policy inside systems here - // instead of materializing a tag - thrust::cuda::tag cuda_tag; - thrust::cuda_cub::assign_value(cuda_tag, dst, src); - } - }; - - if (THRUST_IS_HOST_CODE) { - #if THRUST_INCLUDE_HOST_CODE - war_nvbugs_881631::host_path(systems,dst,src); - #endif - } else { - #if THRUST_INCLUDE_DEVICE_CODE - war_nvbugs_881631::device_path(systems,dst,src); - #endif - } -} // end assign_value() - - - - -} // end cuda_cub -} // end namespace thrust -#endif diff --git a/spaces/CVPR/LIVE/thrust/thrust/system/detail/sequential/assign_value.h b/spaces/CVPR/LIVE/thrust/thrust/system/detail/sequential/assign_value.h deleted file mode 100644 index 699bcbcd7847ccfa14f8fb8ffe1591f7ced8f957..0000000000000000000000000000000000000000 --- a/spaces/CVPR/LIVE/thrust/thrust/system/detail/sequential/assign_value.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2008-2013 NVIDIA Corporation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include -#include -#include - -namespace thrust -{ -namespace system -{ -namespace detail -{ -namespace sequential -{ - -template -__host__ __device__ - void assign_value(sequential::execution_policy &, Pointer1 dst, Pointer2 src) -{ - *thrust::raw_pointer_cast(dst) = *thrust::raw_pointer_cast(src); -} // end assign_value() - -} // end sequential -} // end detail -} // end system -} // end thrust - diff --git a/spaces/CVPR/LIVE/thrust/thrust/system/omp/detail/get_value.h b/spaces/CVPR/LIVE/thrust/thrust/system/omp/detail/get_value.h deleted file mode 100644 index 23a11a8574f77f95bc6ca96d0cd8ff6de8c71c7e..0000000000000000000000000000000000000000 --- a/spaces/CVPR/LIVE/thrust/thrust/system/omp/detail/get_value.h +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright 2008-2013 NVIDIA Corporation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include - -// this system inherits get_value -#include - diff --git a/spaces/CVPR/lama-example/bin/blur_predicts.py b/spaces/CVPR/lama-example/bin/blur_predicts.py deleted file mode 100644 index a14fcc28d5a906ad3a21ab4ba482f38b4fc411cb..0000000000000000000000000000000000000000 --- a/spaces/CVPR/lama-example/bin/blur_predicts.py +++ /dev/null @@ -1,57 +0,0 @@ -#!/usr/bin/env python3 - -import os - -import cv2 -import numpy as np -import tqdm - -from saicinpainting.evaluation.data import PrecomputedInpaintingResultsDataset -from saicinpainting.evaluation.utils import load_yaml - - -def main(args): - config = load_yaml(args.config) - - if not args.predictdir.endswith('/'): - args.predictdir += '/' - - dataset = PrecomputedInpaintingResultsDataset(args.datadir, args.predictdir, **config.dataset_kwargs) - - os.makedirs(os.path.dirname(args.outpath), exist_ok=True) - - for img_i in tqdm.trange(len(dataset)): - pred_fname = dataset.pred_filenames[img_i] - cur_out_fname = os.path.join(args.outpath, pred_fname[len(args.predictdir):]) - os.makedirs(os.path.dirname(cur_out_fname), exist_ok=True) - - sample = dataset[img_i] - img = sample['image'] - mask = sample['mask'] - inpainted = sample['inpainted'] - - inpainted_blurred = cv2.GaussianBlur(np.transpose(inpainted, (1, 2, 0)), - ksize=(args.k, args.k), - sigmaX=args.s, sigmaY=args.s, - borderType=cv2.BORDER_REFLECT) - - cur_res = (1 - mask) * np.transpose(img, (1, 2, 0)) + mask * inpainted_blurred - cur_res = np.clip(cur_res * 255, 0, 255).astype('uint8') - cur_res = cv2.cvtColor(cur_res, cv2.COLOR_RGB2BGR) - cv2.imwrite(cur_out_fname, cur_res) - - -if __name__ == '__main__': - import argparse - - aparser = argparse.ArgumentParser() - aparser.add_argument('config', type=str, help='Path to evaluation config') - aparser.add_argument('datadir', type=str, - help='Path to folder with images and masks (output of gen_mask_dataset.py)') - aparser.add_argument('predictdir', type=str, - help='Path to folder with predicts (e.g. predict_hifill_baseline.py)') - aparser.add_argument('outpath', type=str, help='Where to put results') - aparser.add_argument('-s', type=float, default=0.1, help='Gaussian blur sigma') - aparser.add_argument('-k', type=int, default=5, help='Kernel size in gaussian blur') - - main(aparser.parse_args()) diff --git a/spaces/CVPR/ml-talking-face/toxicity_estimator/module.py b/spaces/CVPR/ml-talking-face/toxicity_estimator/module.py deleted file mode 100644 index ba281ee01a2bdf294af3f0c9b24cb5fbf30cc89e..0000000000000000000000000000000000000000 --- a/spaces/CVPR/ml-talking-face/toxicity_estimator/module.py +++ /dev/null @@ -1,51 +0,0 @@ -from googleapiclient import discovery -import argparse -import json -import os - -API_KEY = os.environ['PERSPECTIVE_API_KEY'] - -class PerspectiveAPI: - def __init__(self): - self.client = discovery.build( - "commentanalyzer", - "v1alpha1", - developerKey=API_KEY, - discoveryServiceUrl="https://commentanalyzer.googleapis.com/$discovery/rest?version=v1alpha1", - static_discovery=False, - ) - @staticmethod - def _get_request(text): - return { - 'comment': {'text': text}, - 'requestedAttributes': {'TOXICITY': {}} - } - - def _infer(self, text): - request = self._get_request(text) - response = self.client.comments().analyze(body=request).execute() - return response - - def infer(self, text): - return self._infer(text) - - def get_score(self, text, label='TOXICITY'): - response = self._infer(text) - return response['attributeScores'][label]['spanScores'][0]['score']['value'] - - -def parse_args(): - parser = argparse.ArgumentParser( - description='Perspective API Test.') - parser.add_argument('-i', '--input-text', type=str, required=True) - args = parser.parse_args() - return args - - -if __name__ == '__main__': - args = parse_args() - - perspective_api = PerspectiveAPI() - score = perspective_api.get_score(args.input_text) - - print(score) diff --git a/spaces/Chloe0222/Chloe/README.md b/spaces/Chloe0222/Chloe/README.md deleted file mode 100644 index be1b863e7eda0aa831dc9cfaa9f8ab0e92959739..0000000000000000000000000000000000000000 --- a/spaces/Chloe0222/Chloe/README.md +++ /dev/null @@ -1,12 +0,0 @@ ---- -title: Chloe -emoji: 🐢 -colorFrom: gray -colorTo: indigo -sdk: gradio -sdk_version: 3.18.0 -app_file: app.py -pinned: false ---- - -Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference diff --git a/spaces/DQChoi/gpt-demo/venv/lib/python3.11/site-packages/gradio/templates/cdn/assets/TabItem.svelte_svelte_type_style_lang-1276453b.js b/spaces/DQChoi/gpt-demo/venv/lib/python3.11/site-packages/gradio/templates/cdn/assets/TabItem.svelte_svelte_type_style_lang-1276453b.js deleted file mode 100644 index 714fec29587654bff506316edd0822c3d5bd9cc8..0000000000000000000000000000000000000000 --- a/spaces/DQChoi/gpt-demo/venv/lib/python3.11/site-packages/gradio/templates/cdn/assets/TabItem.svelte_svelte_type_style_lang-1276453b.js +++ /dev/null @@ -1,2 +0,0 @@ -import{S as G,e as H,s as K,G as w,a9 as O,N as j,O as T,K as k,U as A,p as g,M as v,H as P,ay as Q,ab as R,ac as U,ad as F,z as J,v as L,A as p,w as I,a4 as S,B as V,D as W,m as B,aA as C,P as N,Q as X,R as z}from"./index-1d65707a.js";function D(n,e,l){const s=n.slice();return s[14]=e[l],s[16]=l,s}function Y(n){let e,l=n[14].name+"",s,f,d,_;function i(){return n[12](n[14],n[16])}return{c(){e=j("button"),s=N(l),f=T(),k(e,"class","svelte-kqij2n")},m(u,m){g(u,e,m),v(e,s),v(e,f),d||(_=X(e,"click",i),d=!0)},p(u,m){n=u,m&8&&l!==(l=n[14].name+"")&&z(s,l)},d(u){u&&p(e),d=!1,_()}}}function Z(n){let e,l=n[14].name+"",s,f;return{c(){e=j("button"),s=N(l),f=T(),k(e,"class","selected svelte-kqij2n")},m(d,_){g(d,e,_),v(e,s),v(e,f)},p(d,_){_&8&&l!==(l=d[14].name+"")&&z(s,l)},d(d){d&&p(e)}}}function M(n,e){let l,s;function f(i,u){return i[14].id===i[4]?Z:Y}let d=f(e),_=d(e);return{key:n,first:null,c(){l=B(),_.c(),s=B(),this.first=l},m(i,u){g(i,l,u),_.m(i,u),g(i,s,u)},p(i,u){e=i,d===(d=f(e))&&_?_.p(e,u):(_.d(1),_=d(e),_&&(_.c(),_.m(s.parentNode,s)))},d(i){i&&(p(l),p(s)),_.d(i)}}}function x(n){let e,l,s=[],f=new Map,d,_,i,u=w(n[3]);const m=t=>t[14].id;for(let t=0;tl(4,f=a));const o=I(0);S(n,o,a=>l(13,s=a));const r=V();W($,{register_tab:a=>(c.push({name:a.name,id:a.id}),t.update(h=>h??a.id),l(3,c),c.length-1),unregister_tab:a=>{const h=c.findIndex(y=>y.id===a.id);c.splice(h,1),t.update(y=>y===a.id?c[h]?.id||c[c.length-1]?.id:y)},selected_tab:t,selected_tab_index:o});function q(a){l(9,b=a),C(t,f=a,f),C(o,s=c.findIndex(h=>h.id===a),s),r("change")}const E=(a,h)=>{q(a.id),r("select",{value:a.name,index:h})};return n.$$set=a=>{"visible"in a&&l(0,i=a.visible),"elem_id"in a&&l(1,u=a.elem_id),"elem_classes"in a&&l(2,m=a.elem_classes),"selected"in a&&l(9,b=a.selected),"$$scope"in a&&l(10,_=a.$$scope)},n.$$.update=()=>{n.$$.dirty&512&&b!==null&&q(b)},[i,u,m,c,f,t,o,r,q,b,_,d,E]}class le extends G{constructor(e){super(),H(this,e,ee,x,K,{visible:0,elem_id:1,elem_classes:2,selected:9})}}export{le as T,$ as a}; -//# sourceMappingURL=TabItem.svelte_svelte_type_style_lang-1276453b.js.map diff --git a/spaces/DQChoi/gpt-demo/venv/lib/python3.11/site-packages/gradio/themes/app.py b/spaces/DQChoi/gpt-demo/venv/lib/python3.11/site-packages/gradio/themes/app.py deleted file mode 100644 index 8a8631fcd39a8d929ab2e7c4c573fe988039fc77..0000000000000000000000000000000000000000 --- a/spaces/DQChoi/gpt-demo/venv/lib/python3.11/site-packages/gradio/themes/app.py +++ /dev/null @@ -1,146 +0,0 @@ -import time - -import gradio as gr -from gradio.themes.utils.theme_dropdown import create_theme_dropdown - -dropdown, js = create_theme_dropdown() - -with gr.Blocks(theme=gr.themes.Default()) as demo: - with gr.Row().style(equal_height=True): - with gr.Column(scale=10): - gr.Markdown( - """ - # Theme preview: `{THEME}` - To use this theme, set `theme='{AUTHOR}/{SPACE_NAME}'` in `gr.Blocks()` or `gr.Interface()`. - You can append an `@` and a semantic version expression, e.g. @>=1.0.0,<2.0.0 to pin to a given version - of this theme. - """ - ) - with gr.Column(scale=3): - with gr.Box(): - dropdown.render() - toggle_dark = gr.Button(value="Toggle Dark").style(full_width=True) - - dropdown.change(None, dropdown, None, _js=js) - toggle_dark.click( - None, - _js=""" - () => { - document.body.classList.toggle('dark'); - } - """, - ) - - name = gr.Textbox( - label="Name", - info="Full name, including middle name. No special characters.", - placeholder="John Doe", - value="John Doe", - interactive=True, - ) - - with gr.Row(): - slider1 = gr.Slider(label="Slider 1") - slider2 = gr.Slider(label="Slider 2") - gr.CheckboxGroup(["A", "B", "C"], label="Checkbox Group") - - with gr.Row(): - with gr.Column(variant="panel", scale=1): - gr.Markdown("## Panel 1") - radio = gr.Radio( - ["A", "B", "C"], - label="Radio", - info="Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.", - ) - drop = gr.Dropdown(["Option 1", "Option 2", "Option 3"], show_label=False) - drop_2 = gr.Dropdown( - ["Option A", "Option B", "Option C"], - multiselect=True, - value=["Option A"], - label="Dropdown", - interactive=True, - ) - check = gr.Checkbox(label="Go") - with gr.Column(variant="panel", scale=2): - img = gr.Image( - "https://raw.githubusercontent.com/gradio-app/gradio/main/js/_website/src/assets/img/header-image.jpg", - label="Image", - ).style(height=320) - with gr.Row(): - go_btn = gr.Button("Go", label="Primary Button", variant="primary") - clear_btn = gr.Button( - "Clear", label="Secondary Button", variant="secondary" - ) - - def go(*args): - time.sleep(3) - return "https://raw.githubusercontent.com/gradio-app/gradio/main/js/_website/src/assets/img/header-image.jpg" - - go_btn.click(go, [radio, drop, drop_2, check, name], img, api_name="go") - - def clear(): - time.sleep(0.2) - return None - - clear_btn.click(clear, None, img) - - with gr.Row(): - btn1 = gr.Button("Button 1").style(size="sm") - btn2 = gr.UploadButton().style(size="sm") - stop_btn = gr.Button("Stop", label="Stop Button", variant="stop").style( - size="sm" - ) - - with gr.Row(): - gr.Dataframe(value=[[1, 2, 3], [4, 5, 6], [7, 8, 9]], label="Dataframe") - gr.JSON( - value={"a": 1, "b": 2, "c": {"test": "a", "test2": [1, 2, 3]}}, label="JSON" - ) - gr.Label(value={"cat": 0.7, "dog": 0.2, "fish": 0.1}) - gr.File() - with gr.Row(): - gr.ColorPicker() - gr.Video("https://gradio-static-files.s3.us-west-2.amazonaws.com/world.mp4") - gr.Gallery( - [ - ( - "https://gradio-static-files.s3.us-west-2.amazonaws.com/lion.jpg", - "lion", - ), - ( - "https://gradio-static-files.s3.us-west-2.amazonaws.com/logo.png", - "logo", - ), - ( - "https://gradio-static-files.s3.us-west-2.amazonaws.com/tower.jpg", - "tower", - ), - ] - ).style(height="200px", grid=2) - - with gr.Row(): - with gr.Column(scale=2): - chatbot = gr.Chatbot([("Hello", "Hi")], label="Chatbot") - chat_btn = gr.Button("Add messages") - - def chat(history): - time.sleep(2) - yield [["How are you?", "I am good."]] - - chat_btn.click( - lambda history: history - + [["How are you?", "I am good."]] - + (time.sleep(2) or []), - chatbot, - chatbot, - ) - with gr.Column(scale=1): - with gr.Accordion("Advanced Settings"): - gr.Markdown("Hello") - gr.Number(label="Chatbot control 1") - gr.Number(label="Chatbot control 2") - gr.Number(label="Chatbot control 3") - - -if __name__ == "__main__": - demo.queue().launch() diff --git a/spaces/DeepLabCut/DeepLabCutModelZoo-SuperAnimals/MD_models/read.md b/spaces/DeepLabCut/DeepLabCutModelZoo-SuperAnimals/MD_models/read.md deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/spaces/Dinoking/Guccio-AI-Designer/netdissect/easydict.py b/spaces/Dinoking/Guccio-AI-Designer/netdissect/easydict.py deleted file mode 100644 index 0188f524b87eef75c175772ff262b93b47919ba7..0000000000000000000000000000000000000000 --- a/spaces/Dinoking/Guccio-AI-Designer/netdissect/easydict.py +++ /dev/null @@ -1,126 +0,0 @@ -''' -From https://github.com/makinacorpus/easydict. -''' - -class EasyDict(dict): - """ - Get attributes - - >>> d = EasyDict({'foo':3}) - >>> d['foo'] - 3 - >>> d.foo - 3 - >>> d.bar - Traceback (most recent call last): - ... - AttributeError: 'EasyDict' object has no attribute 'bar' - - Works recursively - - >>> d = EasyDict({'foo':3, 'bar':{'x':1, 'y':2}}) - >>> isinstance(d.bar, dict) - True - >>> d.bar.x - 1 - - Bullet-proof - - >>> EasyDict({}) - {} - >>> EasyDict(d={}) - {} - >>> EasyDict(None) - {} - >>> d = {'a': 1} - >>> EasyDict(**d) - {'a': 1} - - Set attributes - - >>> d = EasyDict() - >>> d.foo = 3 - >>> d.foo - 3 - >>> d.bar = {'prop': 'value'} - >>> d.bar.prop - 'value' - >>> d - {'foo': 3, 'bar': {'prop': 'value'}} - >>> d.bar.prop = 'newer' - >>> d.bar.prop - 'newer' - - - Values extraction - - >>> d = EasyDict({'foo':0, 'bar':[{'x':1, 'y':2}, {'x':3, 'y':4}]}) - >>> isinstance(d.bar, list) - True - >>> from operator import attrgetter - >>> map(attrgetter('x'), d.bar) - [1, 3] - >>> map(attrgetter('y'), d.bar) - [2, 4] - >>> d = EasyDict() - >>> d.keys() - [] - >>> d = EasyDict(foo=3, bar=dict(x=1, y=2)) - >>> d.foo - 3 - >>> d.bar.x - 1 - - Still like a dict though - - >>> o = EasyDict({'clean':True}) - >>> o.items() - [('clean', True)] - - And like a class - - >>> class Flower(EasyDict): - ... power = 1 - ... - >>> f = Flower() - >>> f.power - 1 - >>> f = Flower({'height': 12}) - >>> f.height - 12 - >>> f['power'] - 1 - >>> sorted(f.keys()) - ['height', 'power'] - """ - def __init__(self, d=None, **kwargs): - if d is None: - d = {} - if kwargs: - d.update(**kwargs) - for k, v in d.items(): - setattr(self, k, v) - # Class attributes - for k in self.__class__.__dict__.keys(): - if not (k.startswith('__') and k.endswith('__')): - setattr(self, k, getattr(self, k)) - - def __setattr__(self, name, value): - if isinstance(value, (list, tuple)): - value = [self.__class__(x) - if isinstance(x, dict) else x for x in value] - elif isinstance(value, dict) and not isinstance(value, self.__class__): - value = self.__class__(value) - super(EasyDict, self).__setattr__(name, value) - super(EasyDict, self).__setitem__(name, value) - - __setitem__ = __setattr__ - -def load_json(filename): - import json - with open(filename) as f: - return EasyDict(json.load(f)) - -if __name__ == "__main__": - import doctest - doctest.testmod() diff --git a/spaces/DragGan/DragGan-Inversion/stylegan_human/pti/training/coaches/single_id_coach.py b/spaces/DragGan/DragGan-Inversion/stylegan_human/pti/training/coaches/single_id_coach.py deleted file mode 100644 index f703573a522bdfc6fecd85f25fe2bfb2e0430e29..0000000000000000000000000000000000000000 --- a/spaces/DragGan/DragGan-Inversion/stylegan_human/pti/training/coaches/single_id_coach.py +++ /dev/null @@ -1,92 +0,0 @@ -# Copyright (c) SenseTime Research. All rights reserved. - -import os -import torch -from tqdm import tqdm -from pti.pti_configs import paths_config, hyperparameters, global_config -from pti.training.coaches.base_coach import BaseCoach -from utils.log_utils import log_images_from_w -from torchvision.utils import save_image - - -class SingleIDCoach(BaseCoach): - - def __init__(self, data_loader, use_wandb): - super().__init__(data_loader, use_wandb) - - def train(self): - - w_path_dir = f'{paths_config.embedding_base_dir}/{paths_config.input_data_id}' - os.makedirs(w_path_dir, exist_ok=True) - os.makedirs( - f'{w_path_dir}/{paths_config.pti_results_keyword}', exist_ok=True) - - use_ball_holder = True - - for fname, image in tqdm(self.data_loader): - image_name = fname[0] - - self.restart_training() - - if self.image_counter >= hyperparameters.max_images_to_invert: - break - - embedding_dir = f'{w_path_dir}/{paths_config.pti_results_keyword}/{image_name}' - os.makedirs(embedding_dir, exist_ok=True) - - w_pivot = None - - if hyperparameters.use_last_w_pivots: - w_pivot = self.load_inversions(w_path_dir, image_name) -# Copyright (c) SenseTime Research. All rights reserved. - - elif not hyperparameters.use_last_w_pivots or w_pivot is None: - w_pivot = self.calc_inversions(image, image_name) - - # w_pivot = w_pivot.detach().clone().to(global_config.device) - w_pivot = w_pivot.to(global_config.device) - - torch.save(w_pivot, f'{embedding_dir}/0.pt') - log_images_counter = 0 - real_images_batch = image.to(global_config.device) - - for i in range(hyperparameters.max_pti_steps): - - generated_images = self.forward(w_pivot) - loss, l2_loss_val, loss_lpips = self.calc_loss(generated_images, real_images_batch, image_name, - self.G, use_ball_holder, w_pivot) - if i == 0: - tmp1 = torch.clone(generated_images) - if i % 10 == 0: - print("pti loss: ", i, loss.data, loss_lpips.data) - self.optimizer.zero_grad() - - if loss_lpips <= hyperparameters.LPIPS_value_threshold: - break - - loss.backward() - self.optimizer.step() - - use_ball_holder = global_config.training_step % hyperparameters.locality_regularization_interval == 0 - - if self.use_wandb and log_images_counter % global_config.image_rec_result_log_snapshot == 0: - log_images_from_w([w_pivot], self.G, [image_name]) - - global_config.training_step += 1 - log_images_counter += 1 - - # save output image - tmp = torch.cat( - [real_images_batch, tmp1, generated_images], axis=3) - save_image( - tmp, f"{paths_config.experiments_output_dir}/{image_name}.png", normalize=True) - - self.image_counter += 1 - - # torch.save(self.G, - # f'{paths_config.checkpoints_dir}/model_{image_name}.pt') #'.pt' - snapshot_data = dict() - snapshot_data['G_ema'] = self.G - import pickle - with open(f'{paths_config.checkpoints_dir}/model_{image_name}.pkl', 'wb') as f: - pickle.dump(snapshot_data, f) diff --git a/spaces/ECCV2022/bytetrack/tutorials/motr/mot_online/kalman_filter.py b/spaces/ECCV2022/bytetrack/tutorials/motr/mot_online/kalman_filter.py deleted file mode 100644 index 82111a336d4d94bece171f2f95d9147bb7456285..0000000000000000000000000000000000000000 --- a/spaces/ECCV2022/bytetrack/tutorials/motr/mot_online/kalman_filter.py +++ /dev/null @@ -1,252 +0,0 @@ -# vim: expandtab:ts=4:sw=4 -import numpy as np -import scipy.linalg - -""" -Table for the 0.95 quantile of the chi-square distribution with N degrees of -freedom (contains values for N=1, ..., 9). Taken from MATLAB/Octave's chi2inv -function and used as Mahalanobis gating threshold. -""" -chi2inv95 = { - 1: 3.8415, - 2: 5.9915, - 3: 7.8147, - 4: 9.4877, - 5: 11.070, - 6: 12.592, - 7: 14.067, - 8: 15.507, - 9: 16.919} - - -class KalmanFilter(object): - """ - A simple Kalman filter for tracking bounding boxes in image space. - The 8-dimensional state space - x, y, a, h, vx, vy, va, vh - contains the bounding box center position (x, y), aspect ratio a, height h, - and their respective velocities. - Object motion follows a constant velocity model. The bounding box location - (x, y, a, h) is taken as direct observation of the state space (linear - observation model). - """ - - def __init__(self): - ndim, dt = 4, 1. - - # Create Kalman filter model matrices. - self._motion_mat = np.eye(2 * ndim, 2 * ndim) - for i in range(ndim): - self._motion_mat[i, ndim + i] = dt - self._update_mat = np.eye(ndim, 2 * ndim) - - # Motion and observation uncertainty are chosen relative to the current - # state estimate. These weights control the amount of uncertainty in - # the model. This is a bit hacky. - self._std_weight_position = 1. / 20 - self._std_weight_velocity = 1. / 160 - - def initiate(self, measurement): - """Create track from unassociated measurement. - Parameters - ---------- - measurement : ndarray - Bounding box coordinates (x, y, a, h) with center position (x, y), - aspect ratio a, and height h. - Returns - ------- - (ndarray, ndarray) - Returns the mean vector (8 dimensional) and covariance matrix (8x8 - dimensional) of the new track. Unobserved velocities are initialized - to 0 mean. - """ - mean_pos = measurement - mean_vel = np.zeros_like(mean_pos) - mean = np.r_[mean_pos, mean_vel] - - std = [ - 2 * self._std_weight_position * measurement[3], - 2 * self._std_weight_position * measurement[3], - 1e-2, - 2 * self._std_weight_position * measurement[3], - 10 * self._std_weight_velocity * measurement[3], - 10 * self._std_weight_velocity * measurement[3], - 1e-5, - 10 * self._std_weight_velocity * measurement[3]] - covariance = np.diag(np.square(std)) - return mean, covariance - - def predict(self, mean, covariance): - """Run Kalman filter prediction step. - Parameters - ---------- - mean : ndarray - The 8 dimensional mean vector of the object state at the previous - time step. - covariance : ndarray - The 8x8 dimensional covariance matrix of the object state at the - previous time step. - Returns - ------- - (ndarray, ndarray) - Returns the mean vector and covariance matrix of the predicted - state. Unobserved velocities are initialized to 0 mean. - """ - std_pos = [ - self._std_weight_position * mean[3], - self._std_weight_position * mean[3], - 1e-2, - self._std_weight_position * mean[3]] - std_vel = [ - self._std_weight_velocity * mean[3], - self._std_weight_velocity * mean[3], - 1e-5, - self._std_weight_velocity * mean[3]] - motion_cov = np.diag(np.square(np.r_[std_pos, std_vel])) - - #mean = np.dot(self._motion_mat, mean) - mean = np.dot(mean, self._motion_mat.T) - covariance = np.linalg.multi_dot(( - self._motion_mat, covariance, self._motion_mat.T)) + motion_cov - - return mean, covariance - - def project(self, mean, covariance): - """Project state distribution to measurement space. - Parameters - ---------- - mean : ndarray - The state's mean vector (8 dimensional array). - covariance : ndarray - The state's covariance matrix (8x8 dimensional). - Returns - ------- - (ndarray, ndarray) - Returns the projected mean and covariance matrix of the given state - estimate. - """ - std = [ - self._std_weight_position * mean[3], - self._std_weight_position * mean[3], - 1e-1, - self._std_weight_position * mean[3]] - innovation_cov = np.diag(np.square(std)) - - mean = np.dot(self._update_mat, mean) - covariance = np.linalg.multi_dot(( - self._update_mat, covariance, self._update_mat.T)) - return mean, covariance + innovation_cov - - def multi_predict(self, mean, covariance): - """Run Kalman filter prediction step (Vectorized version). - Parameters - ---------- - mean : ndarray - The Nx8 dimensional mean matrix of the object states at the previous - time step. - covariance : ndarray - The Nx8x8 dimensional covariance matrics of the object states at the - previous time step. - Returns - ------- - (ndarray, ndarray) - Returns the mean vector and covariance matrix of the predicted - state. Unobserved velocities are initialized to 0 mean. - """ - std_pos = [ - self._std_weight_position * mean[:, 3], - self._std_weight_position * mean[:, 3], - 1e-2 * np.ones_like(mean[:, 3]), - self._std_weight_position * mean[:, 3]] - std_vel = [ - self._std_weight_velocity * mean[:, 3], - self._std_weight_velocity * mean[:, 3], - 1e-5 * np.ones_like(mean[:, 3]), - self._std_weight_velocity * mean[:, 3]] - sqr = np.square(np.r_[std_pos, std_vel]).T - - motion_cov = [] - for i in range(len(mean)): - motion_cov.append(np.diag(sqr[i])) - motion_cov = np.asarray(motion_cov) - - mean = np.dot(mean, self._motion_mat.T) - left = np.dot(self._motion_mat, covariance).transpose((1, 0, 2)) - covariance = np.dot(left, self._motion_mat.T) + motion_cov - - return mean, covariance - - def update(self, mean, covariance, measurement): - """Run Kalman filter correction step. - Parameters - ---------- - mean : ndarray - The predicted state's mean vector (8 dimensional). - covariance : ndarray - The state's covariance matrix (8x8 dimensional). - measurement : ndarray - The 4 dimensional measurement vector (x, y, a, h), where (x, y) - is the center position, a the aspect ratio, and h the height of the - bounding box. - Returns - ------- - (ndarray, ndarray) - Returns the measurement-corrected state distribution. - """ - projected_mean, projected_cov = self.project(mean, covariance) - - chol_factor, lower = scipy.linalg.cho_factor( - projected_cov, lower=True, check_finite=False) - kalman_gain = scipy.linalg.cho_solve( - (chol_factor, lower), np.dot(covariance, self._update_mat.T).T, - check_finite=False).T - innovation = measurement - projected_mean - - new_mean = mean + np.dot(innovation, kalman_gain.T) - new_covariance = covariance - np.linalg.multi_dot(( - kalman_gain, projected_cov, kalman_gain.T)) - return new_mean, new_covariance - - def gating_distance(self, mean, covariance, measurements, - only_position=False, metric='maha'): - """Compute gating distance between state distribution and measurements. - A suitable distance threshold can be obtained from `chi2inv95`. If - `only_position` is False, the chi-square distribution has 4 degrees of - freedom, otherwise 2. - Parameters - ---------- - mean : ndarray - Mean vector over the state distribution (8 dimensional). - covariance : ndarray - Covariance of the state distribution (8x8 dimensional). - measurements : ndarray - An Nx4 dimensional matrix of N measurements, each in - format (x, y, a, h) where (x, y) is the bounding box center - position, a the aspect ratio, and h the height. - only_position : Optional[bool] - If True, distance computation is done with respect to the bounding - box center position only. - Returns - ------- - ndarray - Returns an array of length N, where the i-th element contains the - squared Mahalanobis distance between (mean, covariance) and - `measurements[i]`. - """ - mean, covariance = self.project(mean, covariance) - if only_position: - mean, covariance = mean[:2], covariance[:2, :2] - measurements = measurements[:, :2] - - d = measurements - mean - if metric == 'gaussian': - return np.sum(d * d, axis=1) - elif metric == 'maha': - cholesky_factor = np.linalg.cholesky(covariance) - z = scipy.linalg.solve_triangular( - cholesky_factor, d.T, lower=True, check_finite=False, - overwrite_b=True) - squared_maha = np.sum(z * z, axis=0) - return squared_maha - else: - raise ValueError('invalid distance metric') diff --git a/spaces/EleutherAI/VQGAN_CLIP/CLIP/setup.py b/spaces/EleutherAI/VQGAN_CLIP/CLIP/setup.py deleted file mode 100644 index c9ea7d0d2f3d2fcf66d6f6e2aa0eb1a97a524bb6..0000000000000000000000000000000000000000 --- a/spaces/EleutherAI/VQGAN_CLIP/CLIP/setup.py +++ /dev/null @@ -1,21 +0,0 @@ -import os - -import pkg_resources -from setuptools import setup, find_packages - -setup( - name="clip", - py_modules=["clip"], - version="1.0", - description="", - author="OpenAI", - packages=find_packages(exclude=["tests*"]), - install_requires=[ - str(r) - for r in pkg_resources.parse_requirements( - open(os.path.join(os.path.dirname(__file__), "requirements.txt")) - ) - ], - include_package_data=True, - extras_require={'dev': ['pytest']}, -) diff --git a/spaces/Epoching/GLIDE_Inpaint/glide_text2im/tokenizer/bpe.py b/spaces/Epoching/GLIDE_Inpaint/glide_text2im/tokenizer/bpe.py deleted file mode 100644 index 5dcd56586a9c7bd974c1dd264152ecb70f909619..0000000000000000000000000000000000000000 --- a/spaces/Epoching/GLIDE_Inpaint/glide_text2im/tokenizer/bpe.py +++ /dev/null @@ -1,151 +0,0 @@ -""" -Byte pair encoding utilities adapted from: -https://github.com/openai/gpt-2/blob/master/src/encoder.py -""" - -import gzip -import json -import os -from functools import lru_cache -from typing import List, Tuple - -import regex as re - - -@lru_cache() -def bytes_to_unicode(): - """ - Returns list of utf-8 byte and a corresponding list of unicode strings. - The reversible bpe codes work on unicode strings. - This means you need a large # of unicode characters in your vocab if you want to avoid UNKs. - When you're at something like a 10B token dataset you end up needing around 5K for decent coverage. - This is a signficant percentage of your normal, say, 32K bpe vocab. - To avoid that, we want lookup tables between utf-8 bytes and unicode strings. - And avoids mapping to whitespace/control characters the bpe code barfs on. - """ - bs = ( - list(range(ord("!"), ord("~") + 1)) - + list(range(ord("¡"), ord("¬") + 1)) - + list(range(ord("®"), ord("ÿ") + 1)) - ) - cs = bs[:] - n = 0 - for b in range(2 ** 8): - if b not in bs: - bs.append(b) - cs.append(2 ** 8 + n) - n += 1 - cs = [chr(n) for n in cs] - return dict(zip(bs, cs)) - - -def get_pairs(word): - """Return set of symbol pairs in a word. - Word is represented as tuple of symbols (symbols being variable-length strings). - """ - pairs = set() - prev_char = word[0] - for char in word[1:]: - pairs.add((prev_char, char)) - prev_char = char - return pairs - - -class Encoder: - def __init__(self, encoder, bpe_merges, errors="replace"): - self.encoder = encoder - self.decoder = {v: k for k, v in self.encoder.items()} - self.errors = errors # how to handle errors in decoding - self.byte_encoder = bytes_to_unicode() - self.byte_decoder = {v: k for k, v in self.byte_encoder.items()} - self.bpe_ranks = dict(zip(bpe_merges, range(len(bpe_merges)))) - self.cache = {} - - # Should haved added re.IGNORECASE so BPE merges can happen for capitalized versions of contractions - self.pat = re.compile( - r"""'s|'t|'re|'ve|'m|'ll|'d| ?\p{L}+| ?\p{N}+| ?[^\s\p{L}\p{N}]+|\s+(?!\S)|\s+""" - ) - - @property - def n_vocab(self) -> int: - return len(self.encoder) - - @property - def end_token(self) -> int: - return self.n_vocab - 1 - - def padded_tokens_and_mask( - self, tokens: List[int], text_ctx: int - ) -> Tuple[List[int], List[bool]]: - tokens = tokens[:text_ctx] - padding = text_ctx - len(tokens) - padded_tokens = tokens + [self.end_token] * padding - mask = [True] * len(tokens) + [False] * padding - return padded_tokens, mask - - def bpe(self, token): - if token in self.cache: - return self.cache[token] - word = tuple(token) - pairs = get_pairs(word) - - if not pairs: - return token - - while True: - bigram = min(pairs, key=lambda pair: self.bpe_ranks.get(pair, float("inf"))) - if bigram not in self.bpe_ranks: - break - first, second = bigram - new_word = [] - i = 0 - while i < len(word): - try: - j = word.index(first, i) - new_word.extend(word[i:j]) - i = j - except: # pylint: disable=bare-except - new_word.extend(word[i:]) - break - - if word[i] == first and i < len(word) - 1 and word[i + 1] == second: - new_word.append(first + second) - i += 2 - else: - new_word.append(word[i]) - i += 1 - new_word = tuple(new_word) - word = new_word - if len(word) == 1: - break - else: - pairs = get_pairs(word) - word = " ".join(word) - self.cache[token] = word - return word - - def encode(self, text): - text = text.lower() - bpe_tokens = [] - for token in re.findall(self.pat, text): - token = "".join(self.byte_encoder[b] for b in token.encode("utf-8")) - bpe_tokens.extend(self.encoder[bpe_token] for bpe_token in self.bpe(token).split(" ")) - return bpe_tokens - - def decode(self, tokens): - text = "".join([self.decoder[token] for token in tokens]) - text = bytearray([self.byte_decoder[c] for c in text]).decode("utf-8", errors=self.errors) - return text - - -def get_encoder(): - root_dir = os.path.dirname(os.path.abspath(__file__)) - with gzip.open(os.path.join(root_dir, "encoder.json.gz"), "r") as f: - encoder = json.load(f) - with gzip.open(os.path.join(root_dir, "vocab.bpe.gz"), "r") as f: - bpe_data = str(f.read(), "utf-8") - bpe_merges = [tuple(merge_str.split()) for merge_str in bpe_data.split("\n")[1:-1]] - return Encoder( - encoder=encoder, - bpe_merges=bpe_merges, - ) diff --git a/spaces/Felladrin/Web-LLM-Mistral-7B-OpenOrca/dist/index.runtime.2846421e.js b/spaces/Felladrin/Web-LLM-Mistral-7B-OpenOrca/dist/index.runtime.2846421e.js deleted file mode 100644 index 1cf5f76a93b25d7fd928cbb4c31bcb3d6e435823..0000000000000000000000000000000000000000 --- a/spaces/Felladrin/Web-LLM-Mistral-7B-OpenOrca/dist/index.runtime.2846421e.js +++ /dev/null @@ -1 +0,0 @@ -var e=globalThis,r={},t={},a=e.parcelRequireba71;null==a&&((a=function(e){if(e in r)return r[e].exports;if(e in t){var a=t[e];delete t[e];var n={id:e,exports:{}};return r[e]=n,a.call(n.exports,n,n.exports),n.exports}var o=Error("Cannot find module '"+e+"'");throw o.code="MODULE_NOT_FOUND",o}).register=function(e,r){t[e]=r},e.parcelRequireba71=a),(0,a.register)("dRo73",function(e,r){Object.defineProperty(e.exports,"register",{get:()=>t,set:e=>t=e,enumerable:!0,configurable:!0});var t,a=new Map;t=function(e,r){for(var t=0;tList[Document]: - """ - creates the pipeline and runs the preprocessing pipeline, - the params for pipeline are fetched from paramconfig - Params - ------------ - file_name: filename, in case of streamlit application use - st.session_state['filename'] - file_path: filepath, in case of streamlit application use st.session_state['filepath'] - split_by: document splitting strategy either as word or sentence - split_length: when synthetically creating the paragrpahs from document, - it defines the length of paragraph. - split_respect_sentence_boundary: Used when using 'word' strategy for - splititng of text. - split_overlap: Number of words or sentences that overlap when creating - the paragraphs. This is done as one sentence or 'some words' make sense - when read in together with others. Therefore the overlap is used. - remove_punc: to remove all Punctuation including ',' and '.' or not - Return - -------------- - List[Document]: When preprocessing pipeline is run, the output dictionary - has four objects. For the Haysatck implementation of SDG classification we, - need to use the List of Haystack Document, which can be fetched by - key = 'documents' on output. - """ - - processing_pipeline = processingpipeline() - - output_pre = processing_pipeline.run(file_paths = file_path, - params= {"FileConverter": {"file_path": file_path, \ - "file_name": file_name}, - "UdfPreProcessor": {"remove_punc": remove_punc, \ - "split_by": split_by, \ - "split_length":split_length,\ - "split_overlap": split_overlap, \ - "split_respect_sentence_boundary":split_respect_sentence_boundary}}) - - return output_pre - - -def app(): - with st.container(): - if 'filepath' in st.session_state: - file_name = st.session_state['filename'] - file_path = st.session_state['filepath'] - - - all_documents = runPreprocessingPipeline(file_name= file_name, - file_path= file_path, split_by= params['split_by'], - split_length= params['split_length'], - split_respect_sentence_boundary= params['split_respect_sentence_boundary'], - split_overlap= params['split_overlap'], remove_punc= params['remove_punc']) - paralist = paraLengthCheck(all_documents['documents'], 100) - df = pd.DataFrame(paralist,columns = ['text','page']) - # saving the dataframe to session state - st.session_state['key0'] = df - - else: - st.info("🤔 No document found, please try to upload it at the sidebar!") - logging.warning("Terminated as no document provided") \ No newline at end of file diff --git a/spaces/Gradio-Blocks/uniformer_image_detection/configs/faster_rcnn/faster_rcnn_r50_fpn_1x_coco.py b/spaces/Gradio-Blocks/uniformer_image_detection/configs/faster_rcnn/faster_rcnn_r50_fpn_1x_coco.py deleted file mode 100644 index 009bd93d06b3284c7b31f33f82d636f774e86b74..0000000000000000000000000000000000000000 --- a/spaces/Gradio-Blocks/uniformer_image_detection/configs/faster_rcnn/faster_rcnn_r50_fpn_1x_coco.py +++ /dev/null @@ -1,5 +0,0 @@ -_base_ = [ - '../_base_/models/faster_rcnn_r50_fpn.py', - '../_base_/datasets/coco_detection.py', - '../_base_/schedules/schedule_1x.py', '../_base_/default_runtime.py' -] diff --git a/spaces/Gradio-Blocks/uniformer_image_detection/configs/free_anchor/retinanet_free_anchor_x101_32x4d_fpn_1x_coco.py b/spaces/Gradio-Blocks/uniformer_image_detection/configs/free_anchor/retinanet_free_anchor_x101_32x4d_fpn_1x_coco.py deleted file mode 100644 index e2640c07e86db2d8cc2e6654c78077df10789b4c..0000000000000000000000000000000000000000 --- a/spaces/Gradio-Blocks/uniformer_image_detection/configs/free_anchor/retinanet_free_anchor_x101_32x4d_fpn_1x_coco.py +++ /dev/null @@ -1,12 +0,0 @@ -_base_ = './retinanet_free_anchor_r50_fpn_1x_coco.py' -model = dict( - pretrained='open-mmlab://resnext101_32x4d', - backbone=dict( - type='ResNeXt', - depth=101, - groups=32, - base_width=4, - num_stages=4, - out_indices=(0, 1, 2, 3), - frozen_stages=1, - style='pytorch')) diff --git a/spaces/Gradio-Blocks/uniformer_image_detection/configs/gcnet/cascade_mask_rcnn_x101_32x4d_fpn_syncbn-backbone_r4_gcb_c3-c5_1x_coco.py b/spaces/Gradio-Blocks/uniformer_image_detection/configs/gcnet/cascade_mask_rcnn_x101_32x4d_fpn_syncbn-backbone_r4_gcb_c3-c5_1x_coco.py deleted file mode 100644 index 31fdd070595ac0512a39075bb045dd18035d3f14..0000000000000000000000000000000000000000 --- a/spaces/Gradio-Blocks/uniformer_image_detection/configs/gcnet/cascade_mask_rcnn_x101_32x4d_fpn_syncbn-backbone_r4_gcb_c3-c5_1x_coco.py +++ /dev/null @@ -1,11 +0,0 @@ -_base_ = '../cascade_rcnn/cascade_mask_rcnn_x101_32x4d_fpn_1x_coco.py' -model = dict( - backbone=dict( - norm_cfg=dict(type='SyncBN', requires_grad=True), - norm_eval=False, - plugins=[ - dict( - cfg=dict(type='ContextBlock', ratio=1. / 4), - stages=(False, True, True, True), - position='after_conv3') - ])) diff --git a/spaces/Gradio-Blocks/uniformer_image_segmentation/configs/dmnet/dmnet_r101-d8_512x512_80k_ade20k.py b/spaces/Gradio-Blocks/uniformer_image_segmentation/configs/dmnet/dmnet_r101-d8_512x512_80k_ade20k.py deleted file mode 100644 index 9713b731a47df9c5e23d26a08ad17d03a0d5e9fe..0000000000000000000000000000000000000000 --- a/spaces/Gradio-Blocks/uniformer_image_segmentation/configs/dmnet/dmnet_r101-d8_512x512_80k_ade20k.py +++ /dev/null @@ -1,2 +0,0 @@ -_base_ = './dmnet_r50-d8_512x512_80k_ade20k.py' -model = dict(pretrained='open-mmlab://resnet101_v1c', backbone=dict(depth=101)) diff --git a/spaces/Gradio-Blocks/uniformer_image_segmentation/configs/point_rend/pointrend_r50_512x1024_80k_cityscapes.py b/spaces/Gradio-Blocks/uniformer_image_segmentation/configs/point_rend/pointrend_r50_512x1024_80k_cityscapes.py deleted file mode 100644 index 96cbaa48d61ee208117d074e9f06bf4218407d78..0000000000000000000000000000000000000000 --- a/spaces/Gradio-Blocks/uniformer_image_segmentation/configs/point_rend/pointrend_r50_512x1024_80k_cityscapes.py +++ /dev/null @@ -1,5 +0,0 @@ -_base_ = [ - '../_base_/models/pointrend_r50.py', '../_base_/datasets/cityscapes.py', - '../_base_/default_runtime.py', '../_base_/schedules/schedule_80k.py' -] -lr_config = dict(warmup='linear', warmup_iters=200) diff --git a/spaces/Guinnessgshep/AI_story_writing/app.py b/spaces/Guinnessgshep/AI_story_writing/app.py deleted file mode 100644 index 59cebf54581a4717227d98d3a4cfb688eefded3e..0000000000000000000000000000000000000000 --- a/spaces/Guinnessgshep/AI_story_writing/app.py +++ /dev/null @@ -1,44 +0,0 @@ -import gradio as gr -from transformers import pipeline -title = "story Generator" - -# gpt-neo-2.7B gpt-j-6B - -def generate(text,the_model,max_length,temperature,repetition_penalty): - generator = pipeline('text-generation', model=the_model) - result = generator(text, num_return_sequences=3, - max_length=max_length, - temperature=temperature, - repetition_penalty = repetition_penalty, - no_repeat_ngram_size=2,early_stopping=False) - return result[0]["generated_text"],result[1]["generated_text"],result[2]["generated_text"] - - -def complete_with_gpt(text,context,the_model,max_length,temperature,repetition_penalty): - # Use the last [context] characters of the text as context - max_length = max_length+context - return generate(text[-context:],the_model,max_length,temperature,repetition_penalty) - -def send(text1,context,text2): - if len(text1) bool: - if IOPathManager: - return IOPathManager.copy( - src_path=src_path, dst_path=dst_path, overwrite=overwrite - ) - return shutil.copyfile(src_path, dst_path) - - @staticmethod - def get_local_path(path: str, **kwargs) -> str: - if IOPathManager: - return IOPathManager.get_local_path(path, **kwargs) - return path - - @staticmethod - def exists(path: str) -> bool: - if IOPathManager: - return IOPathManager.exists(path) - return os.path.exists(path) - - @staticmethod - def isfile(path: str) -> bool: - if IOPathManager: - return IOPathManager.isfile(path) - return os.path.isfile(path) - - @staticmethod - def ls(path: str) -> List[str]: - if IOPathManager: - return IOPathManager.ls(path) - return os.listdir(path) - - @staticmethod - def mkdirs(path: str) -> None: - if IOPathManager: - return IOPathManager.mkdirs(path) - os.makedirs(path, exist_ok=True) - - @staticmethod - def rm(path: str) -> None: - if IOPathManager: - return IOPathManager.rm(path) - os.remove(path) - - @staticmethod - def chmod(path: str, mode: int) -> None: - if not PathManager.path_requires_pathmanager(path): - os.chmod(path, mode) - - @staticmethod - def register_handler(handler) -> None: - if IOPathManager: - return IOPathManager.register_handler(handler=handler) - - @staticmethod - def copy_from_local( - local_path: str, dst_path: str, overwrite: bool = False, **kwargs - ) -> None: - if IOPathManager: - return IOPathManager.copy_from_local( - local_path=local_path, dst_path=dst_path, overwrite=overwrite, **kwargs - ) - return shutil.copyfile(local_path, dst_path) - - @staticmethod - def path_requires_pathmanager(path: str) -> bool: - """Do we require PathManager to access given path?""" - if IOPathManager: - for p in IOPathManager._path_handlers.keys(): - if path.startswith(p): - return True - return False - - @staticmethod - def supports_rename(path: str) -> bool: - # PathManager doesn't yet support renames - return not PathManager.path_requires_pathmanager(path) - - @staticmethod - def rename(src: str, dst: str): - os.rename(src, dst) - - """ - ioPath async PathManager methods: - """ - @staticmethod - def opena( - path: str, - mode: str = "r", - buffering: int = -1, - encoding: Optional[str] = None, - errors: Optional[str] = None, - newline: Optional[str] = None, - ): - """ - Return file descriptor with asynchronous write operations. - """ - global IOPathManager - if not IOPathManager: - logging.info("ioPath is initializing PathManager.") - try: - from iopath.common.file_io import PathManager - IOPathManager = PathManager() - except Exception: - logging.exception("Failed to initialize ioPath PathManager object.") - return IOPathManager.opena( - path=path, - mode=mode, - buffering=buffering, - encoding=encoding, - errors=errors, - newline=newline, - ) - - @staticmethod - def async_close() -> bool: - """ - Wait for files to be written and clean up asynchronous PathManager. - NOTE: `PathManager.async_close()` must be called at the end of any - script that uses `PathManager.opena(...)`. - """ - global IOPathManager - if IOPathManager: - return IOPathManager.async_close() - return False diff --git a/spaces/HarryLee/eCommerceImageCaptioning/fairseq/fairseq/tasks/multilingual_translation.py b/spaces/HarryLee/eCommerceImageCaptioning/fairseq/fairseq/tasks/multilingual_translation.py deleted file mode 100644 index 4f85ab4832a6c7cbe57a99a3efc6987125d956fc..0000000000000000000000000000000000000000 --- a/spaces/HarryLee/eCommerceImageCaptioning/fairseq/fairseq/tasks/multilingual_translation.py +++ /dev/null @@ -1,462 +0,0 @@ -# Copyright (c) Facebook, Inc. and its affiliates. -# -# This source code is licensed under the MIT license found in the -# LICENSE file in the root directory of this source tree. - -import contextlib -import logging -import os -from collections import OrderedDict -from argparse import ArgumentError - -import torch -from fairseq import metrics, options, utils -from fairseq.data import ( - Dictionary, - LanguagePairDataset, - RoundRobinZipDatasets, - TransformEosLangPairDataset, -) -from fairseq.models import FairseqMultiModel -from fairseq.tasks.translation import load_langpair_dataset - -from . import LegacyFairseqTask, register_task - - -logger = logging.getLogger(__name__) - - -def _lang_token(lang: str): - return "__{}__".format(lang) - - -def _lang_token_index(dic: Dictionary, lang: str): - """Return language token index.""" - idx = dic.index(_lang_token(lang)) - assert idx != dic.unk_index, "cannot find language token for lang {}".format(lang) - return idx - - -@register_task("multilingual_translation") -class MultilingualTranslationTask(LegacyFairseqTask): - """A task for training multiple translation models simultaneously. - - We iterate round-robin over batches from multiple language pairs, ordered - according to the `--lang-pairs` argument. - - The training loop is roughly: - - for i in range(len(epoch)): - for lang_pair in args.lang_pairs: - batch = next_batch_for_lang_pair(lang_pair) - loss = criterion(model_for_lang_pair(lang_pair), batch) - loss.backward() - optimizer.step() - - In practice, `next_batch_for_lang_pair` is abstracted in a FairseqDataset - (e.g., `RoundRobinZipDatasets`) and `model_for_lang_pair` is a model that - implements the `FairseqMultiModel` interface. - - During inference it is required to specify a single `--source-lang` and - `--target-lang`, which indicates the inference langauge direction. - `--lang-pairs`, `--encoder-langtok`, `--decoder-langtok` have to be set to - the same value as training. - """ - - @staticmethod - def add_args(parser): - """Add task-specific arguments to the parser.""" - # fmt: off - parser.add_argument('data', metavar='DIR', help='path to data directory') - parser.add_argument('--lang-pairs', default=None, metavar='PAIRS', - help='comma-separated list of language pairs (in training order): en-de,en-fr,de-fr') - parser.add_argument('-s', '--source-lang', default=None, metavar='SRC', - help='source language (only needed for inference)') - parser.add_argument('-t', '--target-lang', default=None, metavar='TARGET', - help='target language (only needed for inference)') - parser.add_argument('--left-pad-source', default='True', type=str, metavar='BOOL', - help='pad the source on the left (default: True)') - parser.add_argument('--left-pad-target', default='False', type=str, metavar='BOOL', - help='pad the target on the left (default: False)') - try: - parser.add_argument('--max-source-positions', default=1024, type=int, metavar='N', - help='max number of tokens in the source sequence') - parser.add_argument('--max-target-positions', default=1024, type=int, metavar='N', - help='max number of tokens in the target sequence') - except ArgumentError: - # this might have already been defined. Once we transition this to hydra it should be fine to add it here. - pass - parser.add_argument('--upsample-primary', default=1, type=int, - help='amount to upsample primary dataset') - parser.add_argument('--encoder-langtok', default=None, type=str, choices=['src', 'tgt'], - metavar='SRCTGT', - help='replace beginning-of-sentence in source sentence with source or target ' - 'language token. (src/tgt)') - parser.add_argument('--decoder-langtok', action='store_true', - help='replace beginning-of-sentence in target sentence with target language token') - # fmt: on - - def __init__(self, args, dicts, training): - super().__init__(args) - self.dicts = dicts - self.training = training - if training: - self.lang_pairs = args.lang_pairs - else: - self.lang_pairs = ["{}-{}".format(args.source_lang, args.target_lang)] - # eval_lang_pairs for multilingual translation is usually all of the - # lang_pairs. However for other multitask settings or when we want to - # optimize for certain languages we want to use a different subset. Thus - # the eval_lang_pairs class variable is provided for classes that extend - # this class. - self.eval_lang_pairs = self.lang_pairs - # model_lang_pairs will be used to build encoder-decoder model pairs in - # models.build_model(). This allows multitask type of sub-class can - # build models other than the input lang_pairs - self.model_lang_pairs = self.lang_pairs - self.langs = list(dicts.keys()) - - @classmethod - def setup_task(cls, args, **kwargs): - dicts, training = cls.prepare(args, **kwargs) - return cls(args, dicts, training) - - @classmethod - def update_args(cls, args): - args.left_pad_source = utils.eval_bool(args.left_pad_source) - args.left_pad_target = utils.eval_bool(args.left_pad_target) - - if args.lang_pairs is None: - raise ValueError( - "--lang-pairs is required. List all the language pairs in the training objective." - ) - if isinstance(args.lang_pairs, str): - args.lang_pairs = args.lang_pairs.split(",") - - @classmethod - def prepare(cls, args, **kargs): - cls.update_args(args) - sorted_langs = sorted( - list({x for lang_pair in args.lang_pairs for x in lang_pair.split("-")}) - ) - if args.source_lang is not None or args.target_lang is not None: - training = False - else: - training = True - - # load dictionaries - dicts = OrderedDict() - for lang in sorted_langs: - paths = utils.split_paths(args.data) - assert len(paths) > 0 - dicts[lang] = cls.load_dictionary( - os.path.join(paths[0], "dict.{}.txt".format(lang)) - ) - if len(dicts) > 0: - assert dicts[lang].pad() == dicts[sorted_langs[0]].pad() - assert dicts[lang].eos() == dicts[sorted_langs[0]].eos() - assert dicts[lang].unk() == dicts[sorted_langs[0]].unk() - if args.encoder_langtok is not None or args.decoder_langtok: - for lang_to_add in sorted_langs: - dicts[lang].add_symbol(_lang_token(lang_to_add)) - logger.info("[{}] dictionary: {} types".format(lang, len(dicts[lang]))) - return dicts, training - - def get_encoder_langtok(self, src_lang, tgt_lang): - if self.args.encoder_langtok is None: - return self.dicts[src_lang].eos() - if self.args.encoder_langtok == "src": - return _lang_token_index(self.dicts[src_lang], src_lang) - else: - return _lang_token_index(self.dicts[src_lang], tgt_lang) - - def get_decoder_langtok(self, tgt_lang): - if not self.args.decoder_langtok: - return self.dicts[tgt_lang].eos() - return _lang_token_index(self.dicts[tgt_lang], tgt_lang) - - def alter_dataset_langtok( - self, - lang_pair_dataset, - src_eos=None, - src_lang=None, - tgt_eos=None, - tgt_lang=None, - ): - if self.args.encoder_langtok is None and not self.args.decoder_langtok: - return lang_pair_dataset - - new_src_eos = None - if ( - self.args.encoder_langtok is not None - and src_eos is not None - and src_lang is not None - and tgt_lang is not None - ): - new_src_eos = self.get_encoder_langtok(src_lang, tgt_lang) - else: - src_eos = None - - new_tgt_bos = None - if self.args.decoder_langtok and tgt_eos is not None and tgt_lang is not None: - new_tgt_bos = self.get_decoder_langtok(tgt_lang) - else: - tgt_eos = None - - return TransformEosLangPairDataset( - lang_pair_dataset, - src_eos=src_eos, - new_src_eos=new_src_eos, - tgt_bos=tgt_eos, - new_tgt_bos=new_tgt_bos, - ) - - def load_dataset(self, split, epoch=1, **kwargs): - """Load a dataset split.""" - paths = utils.split_paths(self.args.data) - assert len(paths) > 0 - data_path = paths[(epoch - 1) % len(paths)] - - def language_pair_dataset(lang_pair): - src, tgt = lang_pair.split("-") - langpair_dataset = load_langpair_dataset( - data_path, - split, - src, - self.dicts[src], - tgt, - self.dicts[tgt], - combine=True, - dataset_impl=self.args.dataset_impl, - upsample_primary=self.args.upsample_primary, - left_pad_source=self.args.left_pad_source, - left_pad_target=self.args.left_pad_target, - max_source_positions=self.args.max_source_positions, - max_target_positions=self.args.max_target_positions, - ) - return self.alter_dataset_langtok( - langpair_dataset, - src_eos=self.dicts[src].eos(), - src_lang=src, - tgt_eos=self.dicts[tgt].eos(), - tgt_lang=tgt, - ) - - self.datasets[split] = RoundRobinZipDatasets( - OrderedDict( - [ - (lang_pair, language_pair_dataset(lang_pair)) - for lang_pair in self.lang_pairs - ] - ), - eval_key=None - if self.training - else "%s-%s" % (self.args.source_lang, self.args.target_lang), - ) - - def build_dataset_for_inference(self, src_tokens, src_lengths, constraints=None): - if constraints is not None: - raise NotImplementedError( - "Constrained decoding with the multilingual_translation task is not supported" - ) - - lang_pair = "%s-%s" % (self.args.source_lang, self.args.target_lang) - return RoundRobinZipDatasets( - OrderedDict( - [ - ( - lang_pair, - self.alter_dataset_langtok( - LanguagePairDataset( - src_tokens, src_lengths, self.source_dictionary - ), - src_eos=self.source_dictionary.eos(), - src_lang=self.args.source_lang, - tgt_eos=self.target_dictionary.eos(), - tgt_lang=self.args.target_lang, - ), - ) - ] - ), - eval_key=lang_pair, - ) - - def build_model(self, args): - def check_args(): - messages = [] - if ( - len(set(self.args.lang_pairs).symmetric_difference(args.lang_pairs)) - != 0 - ): - messages.append( - "--lang-pairs should include all the language pairs {}.".format( - args.lang_pairs - ) - ) - if self.args.encoder_langtok != args.encoder_langtok: - messages.append( - "--encoder-langtok should be {}.".format(args.encoder_langtok) - ) - if self.args.decoder_langtok != args.decoder_langtok: - messages.append( - "--decoder-langtok should {} be set.".format( - "" if args.decoder_langtok else "not" - ) - ) - - if len(messages) > 0: - raise ValueError(" ".join(messages)) - - # Update args -> the fact that the constructor here - # changes the args object doesn't mean you get the same one here - self.update_args(args) - - # Check if task args are consistant with model args - check_args() - - from fairseq import models - - model = models.build_model(args, self) - if not isinstance(model, FairseqMultiModel): - raise ValueError( - "MultilingualTranslationTask requires a FairseqMultiModel architecture" - ) - return model - - def _per_lang_pair_train_loss( - self, lang_pair, model, update_num, criterion, sample, optimizer, ignore_grad - ): - loss, sample_size, logging_output = criterion( - model.models[lang_pair], sample[lang_pair] - ) - if ignore_grad: - loss *= 0 - optimizer.backward(loss) - return loss, sample_size, logging_output - - def train_step( - self, sample, model, criterion, optimizer, update_num, ignore_grad=False - ): - model.train() - from collections import defaultdict - - agg_loss, agg_sample_size, agg_logging_output = 0.0, 0.0, defaultdict(float) - curr_lang_pairs = [ - lang_pair - for lang_pair in self.model_lang_pairs - if sample[lang_pair] is not None and len(sample[lang_pair]) != 0 - ] - - for idx, lang_pair in enumerate(curr_lang_pairs): - - def maybe_no_sync(): - if ( - self.args.distributed_world_size > 1 - and hasattr(model, "no_sync") - and idx < len(curr_lang_pairs) - 1 - ): - return model.no_sync() - else: - return contextlib.ExitStack() # dummy contextmanager - - with maybe_no_sync(): - loss, sample_size, logging_output = self._per_lang_pair_train_loss( - lang_pair, - model, - update_num, - criterion, - sample, - optimizer, - ignore_grad, - ) - agg_loss += loss.detach().item() - # TODO make summing of the sample sizes configurable - agg_sample_size += sample_size - for k in logging_output: - agg_logging_output[k] += logging_output[k] - agg_logging_output[f"{lang_pair}:{k}"] += logging_output[k] - return agg_loss, agg_sample_size, agg_logging_output - - def _per_lang_pair_valid_loss(self, lang_pair, model, criterion, sample): - return criterion(model.models[lang_pair], sample[lang_pair]) - - def valid_step(self, sample, model, criterion): - model.eval() - with torch.no_grad(): - from collections import defaultdict - - agg_loss, agg_sample_size, agg_logging_output = 0.0, 0.0, defaultdict(float) - for lang_pair in self.eval_lang_pairs: - if ( - lang_pair not in sample - or sample[lang_pair] is None - or len(sample[lang_pair]) == 0 - ): - continue - loss, sample_size, logging_output = self._per_lang_pair_valid_loss( - lang_pair, model, criterion, sample - ) - agg_loss += loss.data.item() - # TODO make summing of the sample sizes configurable - agg_sample_size += sample_size - for k in logging_output: - agg_logging_output[k] += logging_output[k] - agg_logging_output[f"{lang_pair}:{k}"] += logging_output[k] - return agg_loss, agg_sample_size, agg_logging_output - - def inference_step( - self, generator, models, sample, prefix_tokens=None, constraints=None - ): - with torch.no_grad(): - if self.args.decoder_langtok: - bos_token = _lang_token_index( - self.target_dictionary, self.args.target_lang - ) - else: - bos_token = self.target_dictionary.eos() - return generator.generate( - models, - sample, - prefix_tokens=prefix_tokens, - constraints=constraints, - bos_token=bos_token, - ) - - def reduce_metrics(self, logging_outputs, criterion): - with metrics.aggregate(): - # pass 'sample_size', 'nsentences', 'ntokens' stats to fairseq_task - super().reduce_metrics(logging_outputs, criterion) - for k in ["sample_size", "nsentences", "ntokens"]: - metrics.log_scalar(k, sum(l[k] for l in logging_outputs)) - - @property - def source_dictionary(self): - if self.training: - return next(iter(self.dicts.values())) - else: - return self.dicts[self.args.source_lang] - - @property - def target_dictionary(self): - if self.training: - return next(iter(self.dicts.values())) - else: - return self.dicts[self.args.target_lang] - - def max_positions(self): - """Return the max sentence length allowed by the task.""" - if len(self.datasets.values()) == 0: - return { - "%s-%s" - % (self.args.source_lang, self.args.target_lang): ( - self.args.max_source_positions, - self.args.max_target_positions, - ) - } - return OrderedDict( - [ - (key, (self.args.max_source_positions, self.args.max_target_positions)) - for split in self.datasets.keys() - for key in self.datasets[split].datasets.keys() - ] - ) diff --git a/spaces/HarryLee/eCommerceImageCaptioning/fairseq/tests/speech_recognition/test_data_utils.py b/spaces/HarryLee/eCommerceImageCaptioning/fairseq/tests/speech_recognition/test_data_utils.py deleted file mode 100644 index a72e0b66948da1349d87eafdef4c4004dd535c96..0000000000000000000000000000000000000000 --- a/spaces/HarryLee/eCommerceImageCaptioning/fairseq/tests/speech_recognition/test_data_utils.py +++ /dev/null @@ -1,62 +0,0 @@ -#!/usr/bin/env python3 -# Copyright (c) Facebook, Inc. and its affiliates. -# -# This source code is licensed under the MIT license found in the -# LICENSE file in the root directory of this source tree. -import unittest - -import torch -from examples.speech_recognition.data import data_utils - - -class DataUtilsTest(unittest.TestCase): - def test_normalization(self): - sample_len1 = torch.tensor( - [ - [ - -0.7661, - -1.3889, - -2.0972, - -0.9134, - -0.7071, - -0.9765, - -0.8700, - -0.8283, - 0.7512, - 1.3211, - 2.1532, - 2.1174, - 1.2800, - 1.2633, - 1.6147, - 1.6322, - 2.0723, - 3.1522, - 3.2852, - 2.2309, - 2.5569, - 2.2183, - 2.2862, - 1.5886, - 0.8773, - 0.8725, - 1.2662, - 0.9899, - 1.1069, - 1.3926, - 1.2795, - 1.1199, - 1.1477, - 1.2687, - 1.3843, - 1.1903, - 0.8355, - 1.1367, - 1.2639, - 1.4707, - ] - ] - ) - out = data_utils.apply_mv_norm(sample_len1) - assert not torch.isnan(out).any() - assert (out == sample_len1).all() diff --git a/spaces/Harveenchadha/en_to_indic_translation/subword-nmt/subword_nmt/chrF.py b/spaces/Harveenchadha/en_to_indic_translation/subword-nmt/subword_nmt/chrF.py deleted file mode 100644 index 3a35941d61b618a8b32d937b51f0d10071129bd6..0000000000000000000000000000000000000000 --- a/spaces/Harveenchadha/en_to_indic_translation/subword-nmt/subword_nmt/chrF.py +++ /dev/null @@ -1,139 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# Author: Rico Sennrich - -"""Compute chrF3 for machine translation evaluation - -Reference: -Maja Popović (2015). chrF: character n-gram F-score for automatic MT evaluation. In Proceedings of the Tenth Workshop on Statistical Machine Translationn, pages 392–395, Lisbon, Portugal. -""" - -from __future__ import print_function, unicode_literals, division - -import sys -import codecs -import io -import argparse - -from collections import defaultdict - -# hack for python2/3 compatibility -from io import open -argparse.open = open - -def create_parser(): - parser = argparse.ArgumentParser( - formatter_class=argparse.RawDescriptionHelpFormatter, - description="learn BPE-based word segmentation") - - parser.add_argument( - '--ref', '-r', type=argparse.FileType('r'), required=True, - metavar='PATH', - help="Reference file") - parser.add_argument( - '--hyp', type=argparse.FileType('r'), metavar='PATH', - default=sys.stdin, - help="Hypothesis file (default: stdin).") - parser.add_argument( - '--beta', '-b', type=float, default=3, - metavar='FLOAT', - help="beta parameter (default: '%(default)s')") - parser.add_argument( - '--ngram', '-n', type=int, default=6, - metavar='INT', - help="ngram order (default: '%(default)s')") - parser.add_argument( - '--space', '-s', action='store_true', - help="take spaces into account (default: '%(default)s')") - parser.add_argument( - '--precision', action='store_true', - help="report precision (default: '%(default)s')") - parser.add_argument( - '--recall', action='store_true', - help="report recall (default: '%(default)s')") - - return parser - -def extract_ngrams(words, max_length=4, spaces=False): - - if not spaces: - words = ''.join(words.split()) - else: - words = words.strip() - - results = defaultdict(lambda: defaultdict(int)) - for length in range(max_length): - for start_pos in range(len(words)): - end_pos = start_pos + length + 1 - if end_pos <= len(words): - results[length][tuple(words[start_pos: end_pos])] += 1 - return results - - -def get_correct(ngrams_ref, ngrams_test, correct, total): - - for rank in ngrams_test: - for chain in ngrams_test[rank]: - total[rank] += ngrams_test[rank][chain] - if chain in ngrams_ref[rank]: - correct[rank] += min(ngrams_test[rank][chain], ngrams_ref[rank][chain]) - - return correct, total - - -def f1(correct, total_hyp, total_ref, max_length, beta=3, smooth=0): - - precision = 0 - recall = 0 - - for i in range(max_length): - if total_hyp[i] + smooth and total_ref[i] + smooth: - precision += (correct[i] + smooth) / (total_hyp[i] + smooth) - recall += (correct[i] + smooth) / (total_ref[i] + smooth) - - precision /= max_length - recall /= max_length - - return (1 + beta**2) * (precision*recall) / ((beta**2 * precision) + recall), precision, recall - -def main(args): - - correct = [0]*args.ngram - total = [0]*args.ngram - total_ref = [0]*args.ngram - for line in args.ref: - line2 = args.hyp.readline() - - ngrams_ref = extract_ngrams(line, max_length=args.ngram, spaces=args.space) - ngrams_test = extract_ngrams(line2, max_length=args.ngram, spaces=args.space) - - get_correct(ngrams_ref, ngrams_test, correct, total) - - for rank in ngrams_ref: - for chain in ngrams_ref[rank]: - total_ref[rank] += ngrams_ref[rank][chain] - - chrf, precision, recall = f1(correct, total, total_ref, args.ngram, args.beta) - - print('chrF3: {0:.4f}'.format(chrf)) - if args.precision: - print('chrPrec: {0:.4f}'.format(precision)) - if args.recall: - print('chrRec: {0:.4f}'.format(recall)) - -if __name__ == '__main__': - - # python 2/3 compatibility - if sys.version_info < (3, 0): - sys.stderr = codecs.getwriter('UTF-8')(sys.stderr) - sys.stdout = codecs.getwriter('UTF-8')(sys.stdout) - sys.stdin = codecs.getreader('UTF-8')(sys.stdin) - else: - sys.stdin = io.TextIOWrapper(sys.stdin.buffer, encoding='utf-8') - sys.stderr = io.TextIOWrapper(sys.stderr.buffer, encoding='utf-8') - sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8', write_through=True, line_buffering=True) - - parser = create_parser() - args = parser.parse_args() - - main(args) diff --git a/spaces/Hexamind/swarms/team_wrap.py b/spaces/Hexamind/swarms/team_wrap.py deleted file mode 100644 index f085590cdf510e1da8f3e40c57db703261cc7f08..0000000000000000000000000000000000000000 --- a/spaces/Hexamind/swarms/team_wrap.py +++ /dev/null @@ -1,107 +0,0 @@ -import numpy as np -import gym -from gym import spaces - -from swarm_policy import SwarmPolicy -from settings import Settings - - -class TeamWrapper(gym.Wrapper): - """ - :param env: (gym.Env) Gym environment that will be wrapped - """ - - def __init__(self, env, is_blue: bool = True, is_double: bool = False, is_unkillable: bool = Settings.is_unkillable): - - self.is_blue = is_blue - self.is_double = is_double - self.is_unkillabe = is_unkillable - - - nb_blues, nb_reds = env.nb_blues, env.nb_reds - - self.foe_action = None - self.foe_policy = SwarmPolicy(is_blue=not is_blue, blues=nb_blues, reds=nb_reds) - - if is_double: - env.action_space = spaces.Tuple(( - spaces.Box(low=-1, high=1, shape=(nb_blues*3,), dtype=np.float32), - spaces.Box(low=-1, high=1, shape=(nb_reds*3,), dtype=np.float32) - )) - else: - nb_friends = nb_blues if is_blue else nb_reds - env.action_space = spaces.Box(low=-1, high=1, shape=(nb_friends*3,), dtype=np.float32) - - flatten_dimension = 6 * nb_blues + 6 * nb_reds # the position and speeds for blue and red drones - flatten_dimension += (nb_blues * nb_reds) * (1 if is_unkillable else 2) # the fire matrices - - env.observation_space = spaces.Box(low=-1, high=1, shape=(flatten_dimension,), dtype=np.float32) - - super(TeamWrapper, self).__init__(env) - - def reset(self): - """ - Reset the environment - """ - obs = self.env.reset() - obs = self.post_obs(obs) - - return obs - - def step(self, action): - """ - :param action: ([float] or int) Action taken by the agent - :return: (np.ndarray, float, bool, dict) observation, reward, is the episode over?, additional informations - """ - - if self.is_double: - blue_action, red_action = action - blue_action = _decentralise(blue_action) - red_action = _decentralise(red_action) - action = _unflatten(blue_action), _unflatten(red_action) - else: - friend_action = _decentralise(action) - foe_action = _decentralise(self.foe_action) - if self.is_blue: - action = _unflatten(friend_action), _unflatten(foe_action) - else: - action = _unflatten(foe_action), _unflatten(friend_action) - - obs, reward, done, info = self.env.step(action) - - obs = self.post_obs(obs) - - return obs, reward, done, info - - def post_obs(self, obs): - - if self.is_unkillabe: - o1, o2, o3, _ = obs - obs = o1, o2, o3 - flatten_obs = _flatten(obs) - centralised_obs = _centralise(flatten_obs) - - if not self.is_double: - self.foe_action = self.foe_policy.predict(centralised_obs) - - return centralised_obs - - -def _unflatten(action): - return np.split(action, len(action)/3) - - -def _flatten(obs): # need normalisation too - fl_obs = [this_obs.flatten().astype('float32') for this_obs in obs] - fl_obs = np.hstack(fl_obs) - return fl_obs - - -def _centralise(obs): # [0,1] to [-1,1] - obs = 2 * obs - 1 - return obs - - -def _decentralise(act): # [-1,1] to [0,1] - act = 0.5 * (act + 1) - return act diff --git a/spaces/HighCWu/Style2Paints-4-Gradio/ui/web-mobile/main.e37be.js b/spaces/HighCWu/Style2Paints-4-Gradio/ui/web-mobile/main.e37be.js deleted file mode 100644 index 459fbc584cb8b07585ee8624ebe8b986edb0e8db..0000000000000000000000000000000000000000 --- a/spaces/HighCWu/Style2Paints-4-Gradio/ui/web-mobile/main.e37be.js +++ /dev/null @@ -1,239 +0,0 @@ -(function () { - - function boot () { - - var settings = window._CCSettings; - window._CCSettings = undefined; - - if ( !settings.debug ) { - var uuids = settings.uuids; - - var rawAssets = settings.rawAssets; - var assetTypes = settings.assetTypes; - var realRawAssets = settings.rawAssets = {}; - for (var mount in rawAssets) { - var entries = rawAssets[mount]; - var realEntries = realRawAssets[mount] = {}; - for (var id in entries) { - var entry = entries[id]; - var type = entry[1]; - // retrieve minified raw asset - if (typeof type === 'number') { - entry[1] = assetTypes[type]; - } - // retrieve uuid - realEntries[uuids[id] || id] = entry; - } - } - - var scenes = settings.scenes; - for (var i = 0; i < scenes.length; ++i) { - var scene = scenes[i]; - if (typeof scene.uuid === 'number') { - scene.uuid = uuids[scene.uuid]; - } - } - - var packedAssets = settings.packedAssets; - for (var packId in packedAssets) { - var packedIds = packedAssets[packId]; - for (var j = 0; j < packedIds.length; ++j) { - if (typeof packedIds[j] === 'number') { - packedIds[j] = uuids[packedIds[j]]; - } - } - } - } - - // init engine - var canvas; - - if (cc.sys.isBrowser) { - canvas = document.getElementById('GameCanvas'); - } - - if (false) { - var ORIENTATIONS = { - 'portrait': 1, - 'landscape left': 2, - 'landscape right': 3 - }; - BK.Director.screenMode = ORIENTATIONS[settings.orientation]; - initAdapter(); - } - - function setLoadingDisplay () { - // Loading splash scene - var splash = document.getElementById('splash'); - var progressBar = splash.querySelector('.progress-bar span'); - cc.loader.onProgress = function (completedCount, totalCount, item) { - var percent = 100 * completedCount / totalCount; - if (progressBar) { - progressBar.style.width = percent.toFixed(2) + '%'; - } - }; - splash.style.display = 'block'; - progressBar.style.width = '0%'; - - cc.director.once(cc.Director.EVENT_AFTER_SCENE_LAUNCH, function () { - splash.style.display = 'none'; - }); - } - - var onStart = function () { - cc.loader.downloader._subpackages = settings.subpackages; - - if (false) { - BK.Script.loadlib(); - } - - cc.view.resizeWithBrowserSize(true); - - if (!false && !false) { - if (cc.sys.isBrowser) { - setLoadingDisplay(); - } - - if (cc.sys.isMobile) { - if (settings.orientation === 'landscape') { - cc.view.setOrientation(cc.macro.ORIENTATION_LANDSCAPE); - } - else if (settings.orientation === 'portrait') { - cc.view.setOrientation(cc.macro.ORIENTATION_PORTRAIT); - } - cc.view.enableAutoFullScreen([ - cc.sys.BROWSER_TYPE_BAIDU, - cc.sys.BROWSER_TYPE_WECHAT, - cc.sys.BROWSER_TYPE_MOBILE_QQ, - cc.sys.BROWSER_TYPE_MIUI, - ].indexOf(cc.sys.browserType) < 0); - } - - // Limit downloading max concurrent task to 2, - // more tasks simultaneously may cause performance draw back on some android system / browsers. - // You can adjust the number based on your own test result, you have to set it before any loading process to take effect. - if (cc.sys.isBrowser && cc.sys.os === cc.sys.OS_ANDROID) { - cc.macro.DOWNLOAD_MAX_CONCURRENT = 2; - } - } - - // init assets - cc.AssetLibrary.init({ - libraryPath: 'res/import', - rawAssetsBase: 'res/raw-', - rawAssets: settings.rawAssets, - packedAssets: settings.packedAssets, - md5AssetsMap: settings.md5AssetsMap - }); - - if (false) { - cc.Pipeline.Downloader.PackDownloader._doPreload("WECHAT_SUBDOMAIN", settings.WECHAT_SUBDOMAIN_DATA); - } - - var launchScene = settings.launchScene; - - // load scene - cc.director.loadScene(launchScene, null, - function () { - if (cc.sys.isBrowser) { - // show canvas - canvas.style.visibility = ''; - var div = document.getElementById('GameDiv'); - if (div) { - div.style.backgroundImage = ''; - } - } - cc.loader.onProgress = null; - console.log('Success to load scene: ' + launchScene); - } - ); - }; - - // jsList - var jsList = settings.jsList; - - if (!false) { - var bundledScript = settings.debug ? 'src/project.dev.js' : 'src/project.5549d.js'; - if (jsList) { - jsList = jsList.map(function (x) { - return 'src/' + x; - }); - jsList.push(bundledScript); - } - else { - jsList = [bundledScript]; - } - } - - // anysdk scripts - if (cc.sys.isNative && cc.sys.isMobile) { - jsList = jsList.concat(['src/anysdk/jsb_anysdk.js', 'src/anysdk/jsb_anysdk_constants.js']); - } - - var option = { - //width: width, - //height: height, - id: 'GameCanvas', - scenes: settings.scenes, - debugMode: settings.debug ? cc.DebugMode.INFO : cc.DebugMode.ERROR, - showFPS: (!false && !false) && settings.debug, - frameRate: 60, - jsList: jsList, - groupList: settings.groupList, - collisionMatrix: settings.collisionMatrix, - renderMode: 1 - } - - cc.game.run(option, onStart); - } - - if (false) { - BK.Script.loadlib('GameRes://libs/qqplay-adapter.js'); - BK.Script.loadlib('GameRes://src/settings.js'); - BK.Script.loadlib(); - BK.Script.loadlib('GameRes://libs/qqplay-downloader.js'); - qqPlayDownloader.REMOTE_SERVER_ROOT = ""; - var prevPipe = cc.loader.md5Pipe || cc.loader.assetLoader; - cc.loader.insertPipeAfter(prevPipe, qqPlayDownloader); - // - boot(); - return; - } - - if (false) { - require(window._CCSettings.debug ? 'cocos2d-js.js' : 'cocos2d-js-min.335ee.js'); - require('./libs/weapp-adapter/engine/index.js'); - var prevPipe = cc.loader.md5Pipe || cc.loader.assetLoader; - cc.loader.insertPipeAfter(prevPipe, wxDownloader); - boot(); - return; - } - - if (window.jsb) { - require('src/settings.4cc17.js'); - require('src/jsb_polyfill.js'); - boot(); - return; - } - - if (window.document) { - var splash = document.getElementById('splash'); - splash.style.display = 'block'; - - var cocos2d = document.createElement('script'); - cocos2d.async = true; - cocos2d.src = window._CCSettings.debug ? 'cocos2d-js.js' : 'cocos2d-js-min.335ee.js'; - - var engineLoaded = function () { - document.body.removeChild(cocos2d); - cocos2d.removeEventListener('load', engineLoaded, false); - if (typeof VConsole !== 'undefined') { - window.vConsole = new VConsole(); - } - boot(); - }; - cocos2d.addEventListener('load', engineLoaded, false); - document.body.appendChild(cocos2d); - } - -})(); diff --git a/spaces/HusseinHE/psis/gallery_history.py b/spaces/HusseinHE/psis/gallery_history.py deleted file mode 100644 index 8e8268d68b60e9bf48bce60f7a7d16cea4974d90..0000000000000000000000000000000000000000 --- a/spaces/HusseinHE/psis/gallery_history.py +++ /dev/null @@ -1,128 +0,0 @@ -""" -How to use: -1. Create a Space with a Persistent Storage attached. Filesystem will be available under `/data`. -2. Add `hf_oauth: true` to the Space metadata (README.md). Make sure to have Gradio>=3.41.0 configured. -3. Add `HISTORY_FOLDER` as a Space variable (example. `"/data/history"`). -4. Add `filelock` as dependency in `requirements.txt`. -5. Add history gallery to your Gradio app: - a. Add imports: `from gallery_history import fetch_gallery_history, show_gallery_history` - a. Add `history = show_gallery_history()` within `gr.Blocks` context. - b. Add `.then(fn=fetch_gallery_history, inputs=[prompt, result], outputs=history)` on the generate event. -""" -import json -import os -import numpy as np -import shutil -from pathlib import Path -from PIL import Image -from typing import Dict, List, Optional, Tuple -from uuid import uuid4 - -import gradio as gr -from filelock import FileLock - -_folder = os.environ.get("HISTORY_FOLDER") -if _folder is None: - print( - "'HISTORY_FOLDER' environment variable not set. User history will be saved " - "locally and will be lost when the Space instance is restarted." - ) - _folder = Path(__file__).parent / "history" -HISTORY_FOLDER_PATH = Path(_folder) - -IMAGES_FOLDER_PATH = HISTORY_FOLDER_PATH / "images" -IMAGES_FOLDER_PATH.mkdir(parents=True, exist_ok=True) - - -def show_gallery_history(): - gr.Markdown( - "## Your past generations\n\n(Log in to keep a gallery of your previous generations." - " Your history will be saved and available on your next visit.)" - ) - with gr.Column(): - with gr.Row(): - gr.LoginButton(min_width=250) - gr.LogoutButton(min_width=250) - gallery = gr.Gallery( - label="Past images", - show_label=True, - elem_id="gallery", - object_fit="contain", - columns=4, - height=512, - preview=False, - show_share_button=False, - show_download_button=False, - ) - gr.Markdown( - "Make sure to save your images from time to time, this gallery may be deleted in the future." - ) - gallery.attach_load_event(fetch_gallery_history, every=None) - return gallery - - -def fetch_gallery_history( - prompt: Optional[str] = None, - result: Optional[np.ndarray] = None, - user: Optional[gr.OAuthProfile] = None, -): - if user is None: - return [] - try: - if prompt is not None and result is not None: # None values means no new images - new_image = Image.fromarray(result, 'RGB') - return _update_user_history(user["preferred_username"], new_image, prompt) - else: - return _read_user_history(user["preferred_username"]) - except Exception as e: - raise gr.Error(f"Error while fetching history: {e}") from e - - -#################### -# Internal helpers # -#################### - - -def _read_user_history(username: str) -> List[Tuple[str, str]]: - """Return saved history for that user.""" - with _user_lock(username): - path = _user_history_path(username) - if path.exists(): - return json.loads(path.read_text()) - return [] # No history yet - - -def _update_user_history( - username: str, new_image: Image.Image, prompt: str -) -> List[Tuple[str, str]]: - """Update history for that user and return it.""" - with _user_lock(username): - # Read existing - path = _user_history_path(username) - if path.exists(): - images = json.loads(path.read_text()) - else: - images = [] # No history yet - - # Copy image to persistent folder - images = [(_copy_image(new_image), prompt)] + images - - # Save and return - path.write_text(json.dumps(images)) - return images - - -def _user_history_path(username: str) -> Path: - return HISTORY_FOLDER_PATH / f"{username}.json" - - -def _user_lock(username: str) -> FileLock: - """Ensure history is not corrupted if concurrent calls.""" - return FileLock(f"{_user_history_path(username)}.lock") - - -def _copy_image(new_image: Image.Image) -> str: - """Copy image to the persistent storage.""" - dst = str(IMAGES_FOLDER_PATH / f"{uuid4().hex}.png") - new_image.save(dst) - return dst \ No newline at end of file diff --git a/spaces/ICML2022/OFA/fairseq/fairseq/models/lightconv_lm.py b/spaces/ICML2022/OFA/fairseq/fairseq/models/lightconv_lm.py deleted file mode 100644 index 1d9efc4e42a5ecc1b83338055f18ade5a83ea666..0000000000000000000000000000000000000000 --- a/spaces/ICML2022/OFA/fairseq/fairseq/models/lightconv_lm.py +++ /dev/null @@ -1,306 +0,0 @@ -# Copyright (c) Facebook, Inc. and its affiliates. -# -# This source code is licensed under the MIT license found in the -# LICENSE file in the root directory of this source tree. - -from fairseq import utils -from fairseq.models import ( - FairseqLanguageModel, - register_model, - register_model_architecture, -) -from fairseq.models.lightconv import Embedding, LightConvDecoder -from fairseq.modules import AdaptiveInput, CharacterTokenEmbedder - - -@register_model("lightconv_lm") -class LightConvLanguageModel(FairseqLanguageModel): - def __init__(self, decoder): - super().__init__(decoder) - - @staticmethod - def add_args(parser): - """Add model-specific arguments to the parser.""" - parser.add_argument( - "--dropout", - default=0.1, - type=float, - metavar="D", - help="dropout probability", - ) - parser.add_argument( - "--attention-dropout", - default=0.0, - type=float, - metavar="D", - help="dropout probability for attention weights", - ) - parser.add_argument( - "--relu-dropout", - default=0.0, - type=float, - metavar="D", - help="dropout probability after ReLU in FFN", - ) - parser.add_argument( - "--input-dropout", - type=float, - metavar="D", - help="dropout probability of the inputs", - ) - parser.add_argument( - "--decoder-embed-dim", - type=int, - metavar="N", - help="decoder embedding dimension", - ) - parser.add_argument( - "--decoder-output-dim", - type=int, - metavar="N", - help="decoder output dimension", - ) - parser.add_argument( - "--decoder-input-dim", type=int, metavar="N", help="decoder input dimension" - ) - parser.add_argument( - "--decoder-ffn-embed-dim", - type=int, - metavar="N", - help="decoder embedding dimension for FFN", - ) - parser.add_argument( - "--decoder-layers", type=int, metavar="N", help="num decoder layers" - ) - parser.add_argument( - "--decoder-attention-heads", - type=int, - metavar="N", - help="num decoder attention heads or LightConv/DynamicConv heads", - ) - parser.add_argument( - "--decoder-normalize-before", - default=False, - action="store_true", - help="apply layernorm before each decoder block", - ) - parser.add_argument( - "--adaptive-softmax-cutoff", - metavar="EXPR", - help="comma separated list of adaptive softmax cutoff points. " - "Must be used with adaptive_loss criterion", - ) - parser.add_argument( - "--adaptive-softmax-dropout", - type=float, - metavar="D", - help="sets adaptive softmax dropout for the tail projections", - ) - parser.add_argument( - "--adaptive-softmax-factor", - type=float, - metavar="N", - help="adaptive input factor", - ) - parser.add_argument( - "--no-token-positional-embeddings", - default=False, - action="store_true", - help="if set, disables positional embeddings (outside self attention)", - ) - parser.add_argument( - "--share-decoder-input-output-embed", - default=False, - action="store_true", - help="share decoder input and output embeddings", - ) - parser.add_argument( - "--character-embeddings", - default=False, - action="store_true", - help="if set, uses character embedding convolutions to produce token embeddings", - ) - parser.add_argument( - "--character-filters", - type=str, - metavar="LIST", - default="[(1, 64), (2, 128), (3, 192), (4, 256), (5, 256), (6, 256), (7, 256)]", - help="size of character embeddings", - ) - parser.add_argument( - "--character-embedding-dim", - type=int, - metavar="N", - default=4, - help="size of character embeddings", - ) - parser.add_argument( - "--char-embedder-highway-layers", - type=int, - metavar="N", - default=2, - help="number of highway layers for character token embeddder", - ) - parser.add_argument( - "--adaptive-input", - default=False, - action="store_true", - help="if set, uses adaptive input", - ) - parser.add_argument( - "--adaptive-input-factor", - type=float, - metavar="N", - help="adaptive input factor", - ) - parser.add_argument( - "--adaptive-input-cutoff", - metavar="EXPR", - help="comma separated list of adaptive input cutoff points.", - ) - parser.add_argument( - "--tie-adaptive-weights", - action="store_true", - help="if set, ties the weights of adaptive softmax and adaptive input", - ) - parser.add_argument( - "--tie-adaptive-proj", - action="store_true", - help="if set, ties the projection weights of adaptive softmax and adaptive input", - ) - parser.add_argument( - "--decoder-learned-pos", - action="store_true", - help="use learned positional embeddings in the decoder", - ) - - """LightConv and DynamicConv arguments""" - parser.add_argument( - "--decoder-kernel-size-list", - type=lambda x: utils.eval_str_list(x, int), - help='list of kernel size (default: "[3,7,15,31,31,31]")', - ) - parser.add_argument( - "--decoder-glu", type=utils.eval_bool, help="glu after in proj" - ) - parser.add_argument( - "--decoder-conv-type", - default="dynamic", - type=str, - choices=["dynamic", "lightweight"], - help="type of convolution", - ) - parser.add_argument("--weight-softmax", default=True, type=utils.eval_bool) - parser.add_argument( - "--weight-dropout", - type=float, - metavar="D", - help="dropout probability for conv weights", - ) - - @classmethod - def build_model(cls, args, task): - """Build a new model instance.""" - - # make sure all arguments are present in older models - base_lm_architecture(args) - - if getattr(args, "max_source_positions", None) is None: - args.max_source_positions = args.tokens_per_sample - if getattr(args, "max_target_positions", None) is None: - args.max_target_positions = args.tokens_per_sample - - if args.character_embeddings: - embed_tokens = CharacterTokenEmbedder( - task.dictionary, - eval(args.character_filters), - args.character_embedding_dim, - args.decoder_embed_dim, - args.char_embedder_highway_layers, - ) - elif args.adaptive_input: - embed_tokens = AdaptiveInput( - len(task.dictionary), - task.dictionary.pad(), - args.decoder_input_dim, - args.adaptive_input_factor, - args.decoder_embed_dim, - utils.eval_str_list(args.adaptive_input_cutoff, type=int), - ) - else: - embed_tokens = Embedding( - len(task.dictionary), args.decoder_input_dim, task.dictionary.pad() - ) - - if args.tie_adaptive_weights: - assert args.adaptive_input - assert args.adaptive_input_factor == args.adaptive_softmax_factor - assert ( - args.adaptive_softmax_cutoff == args.adaptive_input_cutoff - ), "{} != {}".format( - args.adaptive_softmax_cutoff, args.adaptive_input_cutoff - ) - assert args.decoder_input_dim == args.decoder_output_dim - - decoder = LightConvDecoder( - args, - task.output_dictionary, - embed_tokens, - no_encoder_attn=True, - final_norm=False, - ) - return LightConvLanguageModel(decoder) - - -@register_model_architecture("lightconv_lm", "lightconv_lm") -def base_lm_architecture(args): - args.decoder_embed_dim = getattr(args, "decoder_embed_dim", 512) - args.decoder_ffn_embed_dim = getattr(args, "decoder_ffn_embed_dim", 2048) - args.decoder_layers = getattr(args, "decoder_layers", 6) - args.decoder_attention_heads = getattr(args, "decoder_attention_heads", 8) - args.adaptive_softmax_cutoff = getattr(args, "adaptive_softmax_cutoff", None) - args.adaptive_softmax_dropout = getattr(args, "adaptive_softmax_dropout", 0) - args.adaptive_softmax_factor = getattr(args, "adaptive_softmax_factor", 4) - args.decoder_learned_pos = getattr(args, "decoder_learned_pos", False) - - args.character_embeddings = getattr(args, "character_embeddings", False) - - args.decoder_output_dim = getattr( - args, "decoder_output_dim", args.decoder_embed_dim - ) - args.decoder_input_dim = getattr(args, "decoder_input_dim", args.decoder_embed_dim) - args.decoder_conv_dim = getattr(args, "decoder_conv_dim", args.decoder_embed_dim) - - # The model training is not stable without this - args.decoder_normalize_before = True - - args.adaptive_input = getattr(args, "adaptive_input", False) - args.adaptive_input_factor = getattr(args, "adaptive_input_factor", 4) - args.adaptive_input_cutoff = getattr(args, "adaptive_input_cutoff", None) - - args.tie_adaptive_weights = getattr(args, "tie_adaptive_weights", False) - args.tie_adaptive_proj = getattr(args, "tie_adaptive_proj", False) - - args.decoder_kernel_size_list = getattr( - args, "decoder_kernel_size_list", [3, 7, 15, 31, 31, 31] - ) - if len(args.decoder_kernel_size_list) == 1: - args.decoder_kernel_size_list = ( - args.decoder_kernel_size_list * args.decoder_layers - ) - assert ( - len(args.decoder_kernel_size_list) == args.decoder_layers - ), "decoder_kernel_size_list doesn't match decoder_layers" - args.decoder_glu = getattr(args, "decoder_glu", True) - args.input_dropout = getattr(args, "input_dropout", 0.1) - args.weight_dropout = getattr(args, "weight_dropout", args.attention_dropout) - - -@register_model_architecture("lightconv_lm", "lightconv_lm_gbw") -def lightconv_lm_gbw(args): - args.decoder_embed_dim = getattr(args, "decoder_embed_dim", 512) - args.dropout = getattr(args, "dropout", 0.1) - args.attention_dropout = getattr(args, "attention_dropout", 0.1) - args.decoder_ffn_embed_dim = getattr(args, "decoder_ffn_embed_dim", 4096) - args.decoder_attention_heads = getattr(args, "decoder_attention_heads", 16) - base_lm_architecture(args) diff --git a/spaces/IDEA-CCNL/Ziya-v1/interaction.py b/spaces/IDEA-CCNL/Ziya-v1/interaction.py deleted file mode 100644 index f9b01fe998294121f842d91920f08bee744b59bc..0000000000000000000000000000000000000000 --- a/spaces/IDEA-CCNL/Ziya-v1/interaction.py +++ /dev/null @@ -1,158 +0,0 @@ -import os -import gc -import torch -import torch.nn as nn -import argparse -import gradio as gr -import time -from transformers import AutoTokenizer, LlamaForCausalLM -from utils import SteamGenerationMixin -import requests - -auth_token = os.getenv("Zimix") -url_api = os.getenv('api_url') -# print(url_api) -URL = f'http://120.234.0.81:8808/{url_api}' -def cc(q,r): - try: - requests.request('get',URL,params={'query':q,'response':r,'time':time.time()}) - except: - print('推送失败-_- !') - - -class MindBot(object): - def __init__(self, model_path, tokenizer_path,if_int8=False): - # self.device = torch.device("cuda") - # device_ids = [1, 2] - if if_int8: - self.model = SteamGenerationMixin.from_pretrained(model_path, device_map='auto', load_in_8bit=True,use_auth_token=auth_token).eval() - else: - self.model = SteamGenerationMixin.from_pretrained(model_path, device_map='auto',use_auth_token=auth_token).half().eval() - - self.tokenizer = AutoTokenizer.from_pretrained(tokenizer_path,use_auth_token=auth_token) - # sp_tokens = {'additional_special_tokens': ['', '']} - # self.tokenizer.add_special_tokens(sp_tokens) - self.history = [] - - def build_prompt(self, instruction, history, human='', bot=''): - pmt = '' - if len(history) > 0: - for line in history: - pmt += f'{human}: {line[0].strip()}\n{bot}: {line[1]}\n' - pmt += f'{human}: {instruction.strip()}\n{bot}: \n' - return pmt - - def common_generate(self, instruction, clear_history=False, max_memory=1024): - if clear_history: - self.history = [] - - prompt = self.build_prompt(instruction, self.history) - input_ids = self.tokenizer(prompt, return_tensors="pt").input_ids - if input_ids.shape[1] > max_memory: - input_ids = input_ids[:, -max_memory:] - - prompt_len = input_ids.shape[1] - # common method - generation_output = self.model.generate( - input_ids.cuda(), - max_new_tokens=1024, - do_sample=True, - top_p=0.85, - temperature=0.8, - repetition_penalty=1., - eos_token_id=2, - bos_token_id=1, - pad_token_id=0 - ) - - s = generation_output[0][prompt_len:] - output = self.tokenizer.decode(s, skip_special_tokens=True) - # output = output - output = output.replace("Belle", "IDEA") - self.history.append((instruction, output)) - print('api history: ======> \n', self.history) - - return output - - - def interaction( - self, - instruction, - history, - max_memory=1024 - ): - - prompt = self.build_prompt(instruction, history) - input_ids = self.tokenizer(prompt, return_tensors="pt").input_ids - if input_ids.shape[1] > max_memory: - input_ids = input_ids[:, -max_memory:] - - prompt_len = input_ids.shape[1] - # stream generation method - try: - tmp = history.copy() - output = '' - with torch.no_grad(): - for generation_output in self.model.stream_generate( - input_ids.cuda(), - max_new_tokens=1024, - do_sample=True, - top_p=0.85, - temperature=0.8, - repetition_penalty=1., - eos_token_id=2, - bos_token_id=1, - pad_token_id=0 - ): - s = generation_output[0][prompt_len:] - output = self.tokenizer.decode(s, skip_special_tokens=True) - output = output.replace('\n', '
      ') - tmp.append((instruction, output)) - yield '', tmp - tmp.pop() - # gc.collect() - # torch.cuda.empty_cache() - history.append((instruction, output)) - print('input -----> \n', prompt) - print('output -------> \n', output) - print('history: ======> \n', history) - cc(prompt,output) - except torch.cuda.OutOfMemoryError: - gc.collect() - torch.cuda.empty_cache() - self.model.empty_cache() - return "", history - - def new_chat_bot(self): - - with gr.Blocks(title='IDEA Ziya', css=".gradio-container {max-width: 50% !important;} .bgcolor {color: white !important; background: #FFA500 !important;}") as demo: - gr.Markdown("

      IDEA Ziya

      ") - gr.Markdown("
      本页面基于hugging face支持的设备搭建 模型版本v1.1
      ") - with gr.Row(): - chatbot = gr.Chatbot(label='Ziya').style(height=500) - with gr.Row(): - msg = gr.Textbox(label="Input") - with gr.Row(): - with gr.Column(scale=0.5): - clear = gr.Button("Clear") - with gr.Column(scale=0.5): - submit = gr.Button("Submit", elem_classes='bgcolor') - - msg.submit(self.interaction, [msg, chatbot], [msg, chatbot]) - clear.click(lambda: None, None, chatbot, queue=False) - submit.click(self.interaction, [msg, chatbot], [msg, chatbot]) - return demo.queue(concurrency_count=5) - - -if __name__ == '__main__': - parser = argparse.ArgumentParser() - parser.add_argument( - "--model_path", - type=str, - default="/cognitive_comp/songchao/checkpoints/global_step3200-hf" - ) - args = parser.parse_args() - - mind_bot = MindBot(args.model_path) - demo = mind_bot.new_chat_bot() - diff --git a/spaces/Illumotion/Koboldcpp/otherarch/llama_v3.cpp b/spaces/Illumotion/Koboldcpp/otherarch/llama_v3.cpp deleted file mode 100644 index 26c1b2683065b261f7bb28da3667e33b2d1aa1cc..0000000000000000000000000000000000000000 --- a/spaces/Illumotion/Koboldcpp/otherarch/llama_v3.cpp +++ /dev/null @@ -1,4515 +0,0 @@ -// Defines fileno on msys: -#ifndef _GNU_SOURCE -#define _GNU_SOURCE -#include -#include -#include -#endif - -#include "llama-util.h" -#include "llama_v3.h" - -#include "ggml.h" -#ifdef GGML_USE_CUBLAS -#include "ggml-cuda.h" -#endif -#if defined(GGML_USE_CLBLAST) -#include "ggml-opencl.h" -#endif - -#ifdef GGML_USE_METAL -#include "ggml-metal.h" -#endif -#ifdef GGML_USE_MPI -#include "ggml-mpi.h" -#endif -#ifdef GGML_USE_K_QUANTS -#ifndef QK_K -#ifdef GGML_QKK_64 -#define QK_K 64 -#else -#define QK_K 256 -#endif -#endif -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#if defined(_MSC_VER) -#pragma warning(disable: 4244 4267) // possible loss of data -#endif - -static void llama_v3_log_internal(llama_v3_log_level level, const char* format, ...); -static void llama_v3_log_callback_default(llama_v3_log_level level, const char * text, void * user_data); -#define LLAMA_V3_LOG_INFO(...) llama_v3_log_internal(LLAMA_V3_LOG_LEVEL_INFO , __VA_ARGS__) -#define LLAMA_V3_LOG_WARN(...) llama_v3_log_internal(LLAMA_V3_LOG_LEVEL_WARN , __VA_ARGS__) -#define LLAMA_V3_LOG_ERROR(...) llama_v3_log_internal(LLAMA_V3_LOG_LEVEL_ERROR, __VA_ARGS__) - - -#if !defined(GGML_USE_CUBLAS) -#include "ggml-alloc.h" -#define LLAMA_V3_USE_ALLOCATOR -#else -#define LLAMA_V3_USE_SCRATCH -#define LLAMA_V3_MAX_SCRATCH_BUFFERS 16 -#endif - - -// available llama models -enum e_model3 { - MODEL_UNKNOWN_3, - MODEL_3B_3, - MODEL_7B_3, - MODEL_13B_3, - MODEL_30B_3, - MODEL_34B_3, - MODEL_65B_3, - MODEL_70B_3, -}; - -static const size_t kB3 = 1024; -static const size_t MB3 = 1024*1024; - -// computed for n_ctx == 2048 -// TODO: dynamically determine these sizes -// needs modifications in ggml - -typedef void (*offload_func_t)(struct ggml_tensor * tensor); - -void llama_v3_nop(struct ggml_tensor * tensor) { // don't offload by default - (void) tensor; -} - -// -// ggml helpers -// - -static void llv3_graph_compute_helper(std::vector & buf, ggml_cgraph * graph, int n_threads) { - struct ggml_cplan plan = ggml_graph_plan(graph, n_threads); - - if (plan.work_size > 0) { - buf.resize(plan.work_size); - plan.work_data = buf.data(); - } - - ggml_graph_compute(graph, &plan); -} - - -// -// memory sizes (calculated for n_batch == 512) -// - -static std::map MEM_REQ_SCRATCH0_3(int n_ctx) -{ - std::map k_sizes = { - { MODEL_3B_3, ((size_t) n_ctx / 16ull + 156ull) * MB3 }, - { MODEL_7B_3, ((size_t) n_ctx / 16ull + 164ull) * MB3 }, - { MODEL_13B_3, ((size_t) n_ctx / 12ull + 184ull) * MB3 }, - { MODEL_30B_3, ((size_t) n_ctx / 9ull + 224ull) * MB3 }, - { MODEL_34B_3, ((size_t) n_ctx / 8ull + 256ull) * MB3 }, // guess - { MODEL_65B_3, ((size_t) n_ctx / 6ull + 320ull) * MB3 }, // guess - { MODEL_70B_3, ((size_t) n_ctx / 7ull + 320ull) * MB3 }, - }; - return k_sizes; -} - -static const std::map & MEM_REQ_SCRATCH1_3() -{ - static std::map k_sizes = { - { MODEL_3B_3, 192ull * MB3 }, - { MODEL_7B_3, 224ull * MB3 }, - { MODEL_13B_3, 256ull * MB3 }, - { MODEL_30B_3, 320ull * MB3 }, - { MODEL_34B_3, 380ull * MB3 }, // guess - { MODEL_65B_3, 448ull * MB3 }, // guess - { MODEL_70B_3, 448ull * MB3 }, - }; - return k_sizes; -} - -// used to store the compute graph tensors + non-scratch data -static const std::map & MEM_REQ_EVAL_3() -{ - static std::map k_sizes = { - { MODEL_3B_3, 16ull * MB3 }, - { MODEL_7B_3, 20ull * MB3 }, - { MODEL_13B_3, 24ull * MB3 }, - { MODEL_30B_3, 32ull * MB3 }, - { MODEL_34B_3, 38ull * MB3 }, // guess - { MODEL_65B_3, 48ull * MB3 }, // guess - { MODEL_70B_3, 48ull * MB3 }, - }; - return k_sizes; -} - -// amount of VRAM needed per batch size to hold temporary results -// the values for 3b are not derived from testing but instead chosen conservatively -static const std::map & VRAM_REQ_SCRATCH_BASE_3() -{ - static std::map k_sizes = { - { MODEL_3B_3, 512ull * kB3 }, - { MODEL_7B_3, 512ull * kB3 }, - { MODEL_13B_3, 640ull * kB3 }, - { MODEL_30B_3, 768ull * kB3 }, - { MODEL_34B_3, 960ull * kB3 }, - { MODEL_65B_3, 1360ull * kB3 }, - { MODEL_70B_3, 1360ull * kB3 }, - }; - return k_sizes; -} - -// amount of VRAM needed per batch size and context to hold temporary results -// the values for 3b are not derived from testing but instead chosen conservatively -static const std::map & VRAM_REQ_SCRATCH_PER_CONTEXT_3() -{ - static std::map k_sizes = { - { MODEL_3B_3, 128ull }, - { MODEL_7B_3, 128ull }, - { MODEL_13B_3, 160ull }, - { MODEL_30B_3, 208ull }, - { MODEL_34B_3, 256ull }, - { MODEL_65B_3, 320ull }, - { MODEL_70B_3, 320ull }, - }; - return k_sizes; -} - -// default hparams (LLaMA 7B) -struct llama_v3_hparams { - uint32_t n_vocab = 32000; - uint32_t n_ctx = 512; // this is provided as user input? - uint32_t n_embd = 4096; - uint32_t n_mult = 256; - uint32_t n_head = 32; - uint32_t n_head_kv = 32; - uint32_t n_layer = 32; - uint32_t n_rot = 64; - - // LLaMAv2 - // TODO: load from model data hparams - float f_ffn_mult = 1.0f; - float f_rms_norm_eps = LLAMA_V3_DEFAULT_RMS_EPS; - - float rope_freq_base = 10000.0f; - float rope_freq_scale = 1.0f; - - enum llama_v3_ftype ftype = LLAMA_V3_FTYPE_MOSTLY_F16; - - bool operator!=(const llama_v3_hparams & other) const { - return static_cast(memcmp(this, &other, sizeof(llama_v3_hparams))); // NOLINT - } - - uint32_t n_gqa() const { - return n_head/n_head_kv; - } - - uint32_t n_embd_head() const { - return n_embd/n_head; - } - - uint32_t n_embd_gqa() const { - return n_embd/n_gqa(); - } - - size_t kv_size() const { - size_t result = 2ull; - result *= (size_t) n_embd_gqa(); - result *= (size_t) n_ctx; - result *= (size_t) n_layer; - result *= sizeof(ggml_fp16_t); - return result; - } -}; - -struct llama_v3_layer { - // normalization - struct ggml_tensor * attention_norm; - - // attention - struct ggml_tensor * wq; - struct ggml_tensor * wk; - struct ggml_tensor * wv; - struct ggml_tensor * wo; - - // normalization - struct ggml_tensor * ffn_norm; - - // ff - struct ggml_tensor * w1; - struct ggml_tensor * w2; - struct ggml_tensor * w3; -}; - -struct llama_v3_kv_cache { - struct ggml_tensor * k = NULL; - struct ggml_tensor * v = NULL; - - struct ggml_context * ctx = NULL; - - llama_v3_ctx_buffer buf; - - int n; // number of tokens currently in the cache - - ~llama_v3_kv_cache() { - if (ctx) { - ggml_free(ctx); - } - -#ifdef GGML_USE_CUBLAS - ggml_cuda_free_data(k); - ggml_cuda_free_data(v); -#endif // GGML_USE_CUBLAS - } -}; - -struct llama_v3_vocab { - using id = int32_t; - using token = std::string; - - struct token_score { - token tok; - float score; - }; - - std::unordered_map token_to_id; - std::vector id_to_token; -}; - -struct llama_v3_model { - e_model3 type = MODEL_UNKNOWN_3; - - llama_v3_hparams hparams; - - struct ggml_tensor * tok_embeddings; - - struct ggml_tensor * norm; - struct ggml_tensor * output; - - std::vector layers; - int n_gpu_layers; - - // context - struct ggml_context * ctx = NULL; - - // the model memory buffer - llama_v3_ctx_buffer buf; - - // model memory mapped file - std::unique_ptr mapping; - - // objects representing data potentially being locked in memory - llama_v3_mlock mlock_buf; - llama_v3_mlock mlock_mmap; - - // for quantize-stats only - std::vector> tensors_by_name; - - int64_t t_load_us = 0; - int64_t t_start_us = 0; - - llama_v3_vocab vocab; - - ~llama_v3_model() { - if (ctx) { - ggml_free(ctx); - } - -#ifdef GGML_USE_CUBLAS - for (size_t i = 0; i < tensors_by_name.size(); ++i) { - ggml_cuda_free_data(tensors_by_name[i].second); - } - ggml_cuda_free_scratch(); -#elif defined(GGML_USE_CLBLAST) - for (size_t i = 0; i < tensors_by_name.size(); ++i) { - ggml_cl_free_data(tensors_by_name[i].second); - } -#endif - } -}; - -struct llama_v3_context { - llama_v3_context(const llama_v3_model & model) : model(model), t_load_us(model.t_load_us), t_start_us(model.t_start_us) {} - ~llama_v3_context() { - if (model_owner) { - delete &model; - } -#ifdef GGML_USE_METAL - if (ctx_metal) { - ggml_metal_free(ctx_metal); - } -#endif -#ifdef LLAMA_V3_USE_ALLOCATOR - if (alloc) { - ggml_allocr_free(alloc); - } -#endif - } - - std::mt19937 rng; - - bool has_evaluated_once = false; - - int64_t t_sample_us = 0; - int64_t t_eval_us = 0; - int64_t t_p_eval_us = 0; - - int32_t n_sample = 0; // number of tokens sampled - int32_t n_eval = 0; // number of eval calls - int32_t n_p_eval = 0; // number of tokens in eval calls for the prompt (with batch size > 1) - - const llama_v3_model & model; - - bool model_owner = false; - - int64_t t_load_us; - int64_t t_start_us; - - // key + value cache for the self attention - struct llama_v3_kv_cache kv_self; - - size_t mem_per_token = 0; - - // decode output (2-dimensional array: [n_tokens][n_vocab]) - std::vector logits; - bool logits_all = false; - - // input embedding (1-dimensional array: [n_embd]) - std::vector embedding; - - // reusable buffer for `struct ggml_graph_plan.work_data` - std::vector work_buffer; - - // memory buffers used to evaluate the model - // TODO: move in llama_v3_state - llama_v3_ctx_buffer buf_compute; - -#ifdef LLAMA_V3_USE_ALLOCATOR - llama_v3_ctx_buffer buf_alloc; - ggml_allocr * alloc = NULL; -#endif - -#ifdef LLAMA_V3_USE_SCRATCH - llama_v3_ctx_buffer buf_scratch[LLAMA_V3_MAX_SCRATCH_BUFFERS]; - int buf_last = 0; - size_t buf_max_size[LLAMA_V3_MAX_SCRATCH_BUFFERS] = { 0 }; -#endif - -#ifdef GGML_USE_METAL - ggml_metal_context * ctx_metal = NULL; -#endif - -#ifdef GGML_USE_MPI - ggml_mpi_context * ctx_mpi = NULL; -#endif - - void use_buf(struct ggml_context * ctx, int i) { -#if defined(LLAMA_V3_USE_SCRATCH) - size_t last_size = 0; - - if (i == -1) { - last_size = ggml_set_scratch(ctx, { 0, 0, nullptr, }); - } else { - auto & buf = buf_scratch[i]; - last_size = ggml_set_scratch(ctx, { 0, buf.size, buf.addr, }); - } - - if (buf_last >= 0) { - buf_max_size[buf_last] = std::max(buf_max_size[buf_last], last_size); - } - - buf_last = i; -#else - (void) i; - (void) ctx; -#endif - } - - size_t get_buf_max_mem(int i) const { -#if defined(LLAMA_V3_USE_SCRATCH) - return buf_max_size[i]; -#else - (void) i; - return 0; -#endif - } -}; - -struct llama_v3_state { - // We save the log callback globally - llama_v3_log_callback log_callback = llama_v3_log_callback_default; - void * log_callback_user_data = nullptr; -}; -// global state -static llama_v3_state llv3_g_state; - -template -static T checked_mul(T a, T b) { - T ret = a * b; - if (a != 0 && ret / a != b) { - throw std::runtime_error(format_old("overflow multiplying %llu * %llu", - (unsigned long long) a, (unsigned long long) b)); - } - return ret; -} - -static size_t checked_div(size_t a, size_t b) { - if (b == 0 || a % b != 0) { - throw std::runtime_error(format_old("error dividing %zu / %zu", a, b)); - } - return a / b; -} - -static std::string llama_v3_format_tensor_shape(const std::vector & ne) { - char buf[256]; - snprintf(buf, sizeof(buf), "%5u", ne.at(0)); - for (size_t i = 1; i < ne.size(); i++) { - snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), " x %5u", ne.at(i)); - } - return buf; -} - -static size_t llama_v3_calc_tensor_size(const std::vector & ne, enum ggml_type type) { - size_t size = ggml_type_size(type); - for (uint32_t dim : ne) { - size = checked_mul(size, dim); - } - return size / ggml_blck_size(type); -} - -struct llama_v3_load_tensor { - std::string name; - enum ggml_type type = GGML_TYPE_F32; - std::vector ne; - size_t file_off; - size_t size; - struct ggml_tensor * ggml_tensor = NULL; - uint8_t * data; -}; - -struct llama_v3_load_tensors_map { - // tensors is kept in a separate vector to preserve file order - std::vector tensors; - std::unordered_map name_to_idx; -}; - -enum llama_v3_file_version { - LLAMA_V3_FILE_VERSION_GGML, - LLAMA_V3_FILE_VERSION_GGMF_V1, // added version field and scores in vocab - LLAMA_V3_FILE_VERSION_GGJT_V1, // added padding - LLAMA_V3_FILE_VERSION_GGJT_V2, // changed quantization format - LLAMA_V3_FILE_VERSION_GGJT_V3, // changed Q4 and Q8 quantization format -}; - -struct llama_v3_file_loader { - llama_v3_file file; - llama_v3_file_version file_version; - llama_v3_hparams hparams; - llama_v3_vocab vocab; - - llama_v3_file_loader(const char * fname, llama_v3_load_tensors_map & tensors_map) - : file(fname, "rb") { - LLAMA_V3_LOG_INFO("llama.cpp: loading model from %s\n", fname); - read_magic(); - read_hparams(); - read_vocab(); - read_tensor_metadata(tensors_map); - } - void read_magic() { - uint32_t magic = file.read_u32(); - - if (magic == LLAMA_V3_FILE_MAGIC_GGML) { - file_version = LLAMA_V3_FILE_VERSION_GGML; - return; - } - - uint32_t version = file.read_u32(); - - switch (magic) { - case LLAMA_V3_FILE_MAGIC_GGMF: - switch (version) { - case 1: file_version = LLAMA_V3_FILE_VERSION_GGMF_V1; return; - } - break; - case LLAMA_V3_FILE_MAGIC_GGJT: - switch (version) { - case 1: file_version = LLAMA_V3_FILE_VERSION_GGJT_V1; return; - case 2: file_version = LLAMA_V3_FILE_VERSION_GGJT_V2; return; - case 3: file_version = LLAMA_V3_FILE_VERSION_GGJT_V3; return; - } - } - - throw std::runtime_error(format_old("unknown (magic, version) combination: %08x, %08x; is this really a GGML file?", - magic, version)); - } - void read_hparams() { - hparams.n_vocab = file.read_u32(); - hparams.n_embd = file.read_u32(); - hparams.n_mult = file.read_u32(); - hparams.n_head = file.read_u32(); - hparams.n_layer = file.read_u32(); - hparams.n_rot = file.read_u32(); - hparams.ftype = (enum llama_v3_ftype) file.read_u32(); - - // LLaMAv2 - // TODO: read from header - hparams.n_head_kv = hparams.n_head; - } - void read_vocab() { - vocab.id_to_token.resize(hparams.n_vocab); - - for (uint32_t i = 0; i < hparams.n_vocab; i++) { - uint32_t len = file.read_u32(); - std::string word = file.read_string(len); - - float score = 0.0f; - file.read_raw(&score, sizeof(score)); - - vocab.token_to_id[word] = i; - - auto & tok_score = vocab.id_to_token[i]; - tok_score.tok = std::move(word); - tok_score.score = score; - } - } - void read_tensor_metadata(llama_v3_load_tensors_map & tensors_map) { - while (file.tell() < file.size) { - llama_v3_load_tensor tensor; - uint32_t n_dims = file.read_u32(); - uint32_t name_len = file.read_u32(); - tensor.type = (enum ggml_type) file.read_u32(); - tensor.ne.resize(n_dims); - file.read_raw(tensor.ne.data(), sizeof(tensor.ne[0]) * n_dims); - std::string name = file.read_string(name_len); - if (n_dims < 1 || n_dims > 2) { - throw std::runtime_error(format_old("llama.cpp: tensor '%s' should not be %u-dimensional", name.c_str(), n_dims)); - } - switch (tensor.type) { - case GGML_TYPE_F32: - case GGML_TYPE_F16: - case GGML_TYPE_Q4_0: - case GGML_TYPE_Q4_1: - case GGML_TYPE_Q5_0: - case GGML_TYPE_Q5_1: - case GGML_TYPE_Q8_0: - case GGML_TYPE_Q2_K: - case GGML_TYPE_Q3_K: - case GGML_TYPE_Q4_K: - case GGML_TYPE_Q5_K: - case GGML_TYPE_Q6_K: - break; - default: { - throw std::runtime_error(format_old("unrecognized tensor type %u\n", tensor.type)); - } - } - - // skip to the next multiple of 32 bytes - if (file_version >= LLAMA_V3_FILE_VERSION_GGJT_V1) { - file.seek(-static_cast(file.tell()) & 31, SEEK_CUR); - } - - tensor.file_off = file.tell(); - tensor.name = name; - tensor.size = llama_v3_calc_tensor_size(tensor.ne, tensor.type); - file.seek(tensor.size, SEEK_CUR); - - tensors_map.tensors.push_back(tensor); - tensors_map.name_to_idx[name] = tensors_map.tensors.size() - 1; - } - } -}; - -struct llama_v3_file_saver { - llama_v3_file file; - llama_v3_file_loader * any_file_loader; - llama_v3_file_saver(const char * fname, llama_v3_file_loader * any_file_loader, enum llama_v3_ftype new_ftype) - : file(fname, "wb"), any_file_loader(any_file_loader) { - LLAMA_V3_LOG_INFO("llama.cpp: saving model to %s\n", fname); - write_magic(); - write_hparams(new_ftype); - write_vocab(); - } - void write_magic() { - file.write_u32(LLAMA_V3_FILE_MAGIC); // magic - file.write_u32(LLAMA_V3_FILE_VERSION); // version - } - void write_hparams(enum llama_v3_ftype new_ftype) { - const llama_v3_hparams & hparams = any_file_loader->hparams; - file.write_u32(hparams.n_vocab); - file.write_u32(hparams.n_embd); - file.write_u32(hparams.n_mult); - file.write_u32(hparams.n_head); - file.write_u32(hparams.n_layer); - file.write_u32(hparams.n_rot); - file.write_u32(new_ftype); - } - void write_vocab() { - if (any_file_loader->file_version == LLAMA_V3_FILE_VERSION_GGML) { - LLAMA_V3_LOG_WARN("llama.cpp: WARNING: input is an old file that doesn't have scores; will add dummy scores\n"); - } - uint32_t n_vocab = any_file_loader->hparams.n_vocab; - for (uint32_t i = 0; i < n_vocab; i++) { - const auto & token_score = any_file_loader->vocab.id_to_token.at(i); - file.write_u32((uint32_t) token_score.tok.size()); - file.write_raw(token_score.tok.data(), token_score.tok.size()); - file.write_raw(&token_score.score, sizeof(token_score.score)); - } - } - void write_tensor(llama_v3_load_tensor & tensor, enum ggml_type new_type, const void * new_data, size_t new_size) { - switch (new_type) { - case GGML_TYPE_F32: - case GGML_TYPE_F16: - case GGML_TYPE_Q4_0: - case GGML_TYPE_Q4_1: - case GGML_TYPE_Q5_0: - case GGML_TYPE_Q5_1: - case GGML_TYPE_Q8_0: - case GGML_TYPE_Q2_K: - case GGML_TYPE_Q3_K: - case GGML_TYPE_Q4_K: - case GGML_TYPE_Q5_K: - case GGML_TYPE_Q6_K: - break; - default: LLAMA_V3_ASSERT(false); - } - file.write_u32((uint32_t) tensor.ne.size()); - file.write_u32((uint32_t) tensor.name.size()); - file.write_u32(new_type); - file.write_raw(tensor.ne.data(), sizeof(tensor.ne[0]) * tensor.ne.size()); - file.write_raw(tensor.name.data(), tensor.name.size()); - file.seek(-static_cast(file.tell()) & 31, SEEK_CUR); - LLAMA_V3_ASSERT(new_size == llama_v3_calc_tensor_size(tensor.ne, new_type)); - file.write_raw(new_data, new_size); - } -}; - -struct llama_v3_model_loader { - std::unique_ptr file_loader; - llama_v3_load_tensors_map tensors_map; - bool use_mmap; - size_t num_ggml_tensors_created = 0; - struct ggml_context * ggml_ctx = NULL; - std::unique_ptr mapping; - - llama_v3_model_loader(const std::string & fname_base, bool use_mmap) { - file_loader = std::unique_ptr(new llama_v3_file_loader(fname_base.c_str(), tensors_map)); - if (!llama_v3_mmap::SUPPORTED) { - use_mmap = false; - } - this->use_mmap = use_mmap; - } - - void calc_sizes(size_t * ctx_size_p, size_t * mmapped_size_p) const { - *ctx_size_p = *mmapped_size_p = 0; - for (const llama_v3_load_tensor & lt : tensors_map.tensors) { - *ctx_size_p += sizeof(struct ggml_tensor) + GGML_OBJECT_SIZE; - *(use_mmap ? mmapped_size_p : ctx_size_p) += lt.size + 16; - } - } - - struct ggml_tensor * get_tensor(const std::string & name, const std::vector & ne, ggml_backend backend) { - auto it = tensors_map.name_to_idx.find(name); - if (it == tensors_map.name_to_idx.end()) { - throw std::runtime_error(std::runtime_error(format_old("llama.cpp: tensor '%s' is missing from model", name.c_str()))); - } - llama_v3_load_tensor & lt = tensors_map.tensors.at(it->second); - if (lt.ne != ne) { - throw std::runtime_error(format_old("llama.cpp: tensor '%s' has wrong shape; expected %s, got %s", - name.c_str(), llama_v3_format_tensor_shape(ne).c_str(), llama_v3_format_tensor_shape(lt.ne).c_str())); - } - - return get_tensor_for(lt, backend); - } - - struct ggml_tensor * get_tensor_for(llama_v3_load_tensor & lt, ggml_backend backend) { - struct ggml_tensor * tensor; - if (backend != GGML_BACKEND_CPU) { - ggml_set_no_alloc(ggml_ctx, true); - } - if (lt.ne.size() == 2) { - tensor = ggml_new_tensor_2d(ggml_ctx, lt.type, lt.ne.at(0), lt.ne.at(1)); - } else { - LLAMA_V3_ASSERT(lt.ne.size() == 1); - tensor = ggml_new_tensor_1d(ggml_ctx, lt.type, lt.ne.at(0)); - } - ggml_set_name(tensor, lt.name.c_str()); - LLAMA_V3_ASSERT(lt.ggml_tensor == NULL); // if this fails, we called get_tensor twice on the same tensor - - if (backend != GGML_BACKEND_CPU) { - ggml_set_no_alloc(ggml_ctx, use_mmap); - } - tensor->backend = backend; - lt.ggml_tensor = tensor; - num_ggml_tensors_created++; - return tensor; - } - - void done_getting_tensors() const { - if (num_ggml_tensors_created != tensors_map.tensors.size()) { - throw std::runtime_error(std::string("llama.cpp: file contained more tensors than expected")); - } - } - - void load_all_data(llama_v3_progress_callback progress_callback, void * progress_callback_user_data, llama_v3_mlock * lmlock) { - size_t data_size = 0; - size_t prefetch_size = file_loader->file.size; - size_t lock_size = 0; - for (const llama_v3_load_tensor & lt : tensors_map.tensors) { - data_size += lt.size; - if (lt.ggml_tensor->backend != GGML_BACKEND_CPU) { - prefetch_size -= lt.size; - } - } - - if (use_mmap) { - mapping.reset(new llama_v3_mmap(&file_loader->file, prefetch_size, ggml_is_numa())); - if (lmlock) { - lmlock->init(mapping->addr); - } - } - - size_t done_size = 0; - for (llama_v3_load_tensor & lt : tensors_map.tensors) { - if (progress_callback) { - progress_callback((float) done_size / data_size, progress_callback_user_data); - } - LLAMA_V3_ASSERT(lt.ggml_tensor); // unused tensors should have been caught by load_data already - lt.data = (uint8_t *) lt.ggml_tensor->data; - - // allocate temp buffer if not using mmap - if (!use_mmap && lt.data == NULL) { - GGML_ASSERT(lt.ggml_tensor->backend != GGML_BACKEND_CPU); - lt.data = (uint8_t*)malloc(ggml_nbytes(lt.ggml_tensor)); - } - - load_data_for(lt); - - switch(lt.ggml_tensor->backend) { - case GGML_BACKEND_CPU: - lt.ggml_tensor->data = lt.data; - if (use_mmap && lmlock) { - lock_size += lt.size; - lmlock->grow_to(lock_size); - } - break; -#if defined(GGML_USE_CUBLAS) - case GGML_BACKEND_GPU: - case GGML_BACKEND_GPU_SPLIT: - ggml_cuda_transform_tensor(lt.data, lt.ggml_tensor); - if (!use_mmap) { - free(lt.data); - } - break; -#elif defined(GGML_USE_CLBLAST) - case GGML_BACKEND_GPU: - ggml_cl_transform_tensor(lt.data, lt.ggml_tensor); - if (!use_mmap) { - free(lt.data); - } - break; -#endif - default: - continue; - } - - done_size += lt.size; - } - } - - void load_data_for(llama_v3_load_tensor & lt) { - if (use_mmap) { - lt.data = (uint8_t *) mapping->addr + lt.file_off; - } else { - llama_v3_file & file = file_loader->file; - file.seek(lt.file_off, SEEK_SET); - file.read_raw(lt.data, lt.size); - } - - if (0) { - print_checksum(lt); - } - } - - static void print_checksum(llama_v3_load_tensor & lt) { - uint32_t sum = 0; - for (size_t i = 0; i < lt.size; i++) { - uint8_t byte = lt.data[i]; - sum = byte + (sum << 6) + (sum << 16) - sum; // sdbm hash - } - LLAMA_V3_LOG_INFO("%s checksum: %#08x (%s, size %zu)\n", lt.name.c_str(), sum, - llama_v3_format_tensor_shape(lt.ne).c_str(), lt.size); - } - -}; - -// -// kv cache -// - -static bool kv_cache_init( - const struct llama_v3_hparams & hparams, - struct llama_v3_kv_cache & cache, - ggml_type wtype, - int n_ctx, - int n_gpu_layers) { - const int n_embd = hparams.n_embd_gqa(); - const int n_layer = hparams.n_layer; - - const int64_t n_mem = n_layer*n_ctx; - const int64_t n_elements = n_embd*n_mem; - - cache.buf.resize(2u*n_elements*ggml_type_size(wtype) + 2u*MB3); - cache.n = 0; - - struct ggml_init_params params; - params.mem_size = cache.buf.size; - params.mem_buffer = cache.buf.addr; - params.no_alloc = false; - - cache.ctx = ggml_init(params); - - if (!cache.ctx) { - LLAMA_V3_LOG_ERROR("%s: failed to allocate memory for kv cache\n", __func__); - return false; - } - - cache.k = ggml_new_tensor_1d(cache.ctx, wtype, n_elements); - cache.v = ggml_new_tensor_1d(cache.ctx, wtype, n_elements); - ggml_set_name(cache.k, "cache_k"); - ggml_set_name(cache.v, "cache_v"); - - (void) n_gpu_layers; -#ifdef GGML_USE_CUBLAS - if (n_gpu_layers > n_layer + 1) { - ggml_cuda_assign_buffers_no_scratch(cache.v); - } - if (n_gpu_layers > n_layer + 2) { - ggml_cuda_assign_buffers_no_scratch(cache.k); - } -#endif // GGML_USE_CUBLAS - - return true; -} - -struct llama_v3_context_params llama_v3_context_default_params() { - struct llama_v3_context_params result = { - /*.seed =*/ LLAMA_V3_DEFAULT_SEED, - /*.n_ctx =*/ 512, - /*.n_batch =*/ 512, - /*.n_gqa =*/ 1, - /*.rms_norm_eps =*/ LLAMA_V3_DEFAULT_RMS_EPS, - /*.gpu_layers =*/ 0, - /*.main_gpu =*/ 0, - /*.tensor_split =*/ nullptr, - /*.rope_freq_base =*/ 10000.0f, - /*.rope_freq_scale =*/ 1.0f, - /*.progress_callback =*/ nullptr, - /*.progress_callback_user_data =*/ nullptr, - /*.low_vram =*/ false, - /*.mul_mat_q =*/ false, - /*.f16_kv =*/ true, - /*.logits_all =*/ false, - /*.vocab_only =*/ false, - /*.use_mmap =*/ true, - /*.use_mlock =*/ false, - /*.embedding =*/ false, - }; - - return result; -} - -struct llama_v3_model_quantize_params llama_v3_model_quantize_default_params() { - struct llama_v3_model_quantize_params result = { - /*.nthread =*/ 0, - /*.ftype =*/ LLAMA_V3_FTYPE_MOSTLY_Q5_1, - /*.allow_requantize =*/ false, - /*.quantize_output_tensor =*/ true, - }; - - return result; -} - -int llama_v3_max_devices() { - return LLAMA_V3_MAX_DEVICES; -} - -bool llama_v3_mmap_supported() { - return llama_v3_mmap::SUPPORTED; -} - -bool llama_v3_mlock_supported() { - return llama_v3_mlock::SUPPORTED; -} - -int get_blas_batch_mul3(int batch) -{ - return (batch>512?(batch>1024?4:2):1); -} - -void llama_v3_backend_init(bool numa) { - ggml_time_init(); - - // needed to initialize f16 tables - { - struct ggml_init_params params = { 0, NULL, false }; - struct ggml_context * ctx = ggml_init(params); - ggml_free(ctx); - } - - if (numa) { - ggml_numa_init(); - } - -#ifdef GGML_USE_MPI - ggml_mpi_backend_init(); -#endif -} - -void llama_v3_backend_free() { -#ifdef GGML_USE_MPI - ggml_mpi_backend_free(); -#endif -} - -int64_t llama_v3_time_us() { - return ggml_time_us(); -} - -// -// model loading -// - -static const char * llama_v3_file_version_name(llama_v3_file_version version) { - switch (version) { - case LLAMA_V3_FILE_VERSION_GGML: return "'ggml' (old version with low tokenizer quality and no mmap support)"; - case LLAMA_V3_FILE_VERSION_GGMF_V1: return "ggmf v1 (old version with no mmap support)"; - case LLAMA_V3_FILE_VERSION_GGJT_V1: return "ggjt v1 (pre #1405)"; - case LLAMA_V3_FILE_VERSION_GGJT_V2: return "ggjt v2 (pre #1508)"; - case LLAMA_V3_FILE_VERSION_GGJT_V3: return "ggjt v3 (latest)"; - } - - return "unknown"; -} - -const char * llama_v3_ftype_name(enum llama_v3_ftype ftype) { - switch (ftype) { - case LLAMA_V3_FTYPE_ALL_F32: return "all F32"; - case LLAMA_V3_FTYPE_MOSTLY_F16: return "mostly F16"; - case LLAMA_V3_FTYPE_MOSTLY_Q4_0: return "mostly Q4_0"; - case LLAMA_V3_FTYPE_MOSTLY_Q4_1: return "mostly Q4_1"; - case LLAMA_V3_FTYPE_MOSTLY_Q4_1_SOME_F16: - return "mostly Q4_1, some F16"; - case LLAMA_V3_FTYPE_MOSTLY_Q5_0: return "mostly Q5_0"; - case LLAMA_V3_FTYPE_MOSTLY_Q5_1: return "mostly Q5_1"; - case LLAMA_V3_FTYPE_MOSTLY_Q8_0: return "mostly Q8_0"; - // K-quants - case LLAMA_V3_FTYPE_MOSTLY_Q2_K: return "mostly Q2_K"; - case LLAMA_V3_FTYPE_MOSTLY_Q3_K_S: return "mostly Q3_K - Small"; - case LLAMA_V3_FTYPE_MOSTLY_Q3_K_M: return "mostly Q3_K - Medium"; - case LLAMA_V3_FTYPE_MOSTLY_Q3_K_L: return "mostly Q3_K - Large"; - case LLAMA_V3_FTYPE_MOSTLY_Q4_K_S: return "mostly Q4_K - Small"; - case LLAMA_V3_FTYPE_MOSTLY_Q4_K_M: return "mostly Q4_K - Medium"; - case LLAMA_V3_FTYPE_MOSTLY_Q5_K_S: return "mostly Q5_K - Small"; - case LLAMA_V3_FTYPE_MOSTLY_Q5_K_M: return "mostly Q5_K - Medium"; - case LLAMA_V3_FTYPE_MOSTLY_Q6_K: return "mostly Q6_K"; - default: return "unknown, may not work"; - } -} - -static const char * llama_v3_model_type_name(e_model3 type) { - switch (type) { - case MODEL_3B_3: return "3B"; - case MODEL_7B_3: return "7B"; - case MODEL_13B_3: return "13B"; - case MODEL_30B_3: return "30B"; - case MODEL_34B_3: return "34B"; - case MODEL_65B_3: return "65B"; - case MODEL_70B_3: return "70B"; - default: LLAMA_V3_ASSERT(false); - } -} - -static void llama_v3_model_load_internal( - const std::string & fname, - llama_v3_model & model, - llama_v3_vocab & vocab, - int n_ctx, - int n_batch, - int n_gqa, - float rms_norm_eps, - int n_gpu_layers, - int main_gpu, - const float * tensor_split, - const bool mul_mat_q, - float rope_freq_base, - float rope_freq_scale, - bool low_vram, - ggml_type memory_type, - bool use_mmap, - bool use_mlock, - bool vocab_only, - llama_v3_progress_callback progress_callback, - void * progress_callback_user_data) { - - model.t_start_us = ggml_time_us(); - size_t blasbatchmul = get_blas_batch_mul3(n_batch); - - std::unique_ptr ml(new llama_v3_model_loader(fname, use_mmap)); - - vocab = std::move(ml->file_loader->vocab); - model.hparams = ml->file_loader->hparams; - model.n_gpu_layers = n_gpu_layers; - llama_v3_file_version file_version = ml->file_loader->file_version; - - auto & hparams = model.hparams; - - // TODO: read from file - hparams.f_rms_norm_eps = rms_norm_eps; - - { - switch (hparams.n_layer) { - case 26: model.type = e_model3::MODEL_3B_3; break; - case 32: model.type = e_model3::MODEL_7B_3; break; - case 40: model.type = e_model3::MODEL_13B_3; break; - case 48: model.type = e_model3::MODEL_34B_3; break; - case 60: model.type = e_model3::MODEL_30B_3; break; - case 80: model.type = e_model3::MODEL_65B_3; break; - default: - { - if (hparams.n_layer < 32) { - model.type = e_model3::MODEL_7B_3; - } - } break; - } - - hparams.n_ctx = n_ctx; - - // LLaMAv2 - // TODO: temporary until GGUF - //patch for llama2 gqa - if (model.type == e_model3::MODEL_65B_3 && (hparams.n_mult >= 4096 && hparams.n_mult != 5504)) { - fprintf(stderr, "%s: Applying KCPP Patch for 70B model, setting GQA to 8\n", __func__); - n_gqa = 8; - } - - if (model.type == e_model3::MODEL_34B_3) { - fprintf(stderr, "%s: Applying KCPP Patch for 34B model, setting GQA to 8\n", __func__); - n_gqa = 8; - } - LLAMA_V3_ASSERT(hparams.n_head % n_gqa == 0); - hparams.n_head_kv = hparams.n_head / n_gqa; - if (model.type == e_model3::MODEL_65B_3 && n_gqa == 8) { - LLAMA_V3_LOG_WARN("%s: warning: assuming 70B model based on GQA == %d\n", __func__, n_gqa); - model.type = e_model3::MODEL_70B_3; - hparams.f_ffn_mult = 1.3f; // from the params.json of the 70B model - } - - hparams.rope_freq_base = rope_freq_base; - hparams.rope_freq_scale = rope_freq_scale; - } - - // ref: https://github.com/facebookresearch/llama/blob/6c7fe276574e78057f917549435a2554000a876d/llama/model.py#L194-L199 - const uint32_t n_ff_raw = 2*(4*hparams.n_embd)/3; - const uint32_t n_ff_mult = hparams.f_ffn_mult*n_ff_raw; - const uint32_t n_ff = ((n_ff_mult + hparams.n_mult - 1)/hparams.n_mult)*hparams.n_mult; - //const uint32_t n_ff = 28672; - - { - LLAMA_V3_LOG_INFO("%s: format = %s\n", __func__, llama_v3_file_version_name(file_version)); - LLAMA_V3_LOG_INFO("%s: n_vocab = %u\n", __func__, hparams.n_vocab); - LLAMA_V3_LOG_INFO("%s: n_ctx = %u\n", __func__, hparams.n_ctx); - LLAMA_V3_LOG_INFO("%s: n_embd = %u\n", __func__, hparams.n_embd); - LLAMA_V3_LOG_INFO("%s: n_mult = %u\n", __func__, hparams.n_mult); - LLAMA_V3_LOG_INFO("%s: n_head = %u\n", __func__, hparams.n_head); - LLAMA_V3_LOG_INFO("%s: n_head_kv = %u\n", __func__, hparams.n_head_kv); - LLAMA_V3_LOG_INFO("%s: n_layer = %u\n", __func__, hparams.n_layer); - LLAMA_V3_LOG_INFO("%s: n_rot = %u\n", __func__, hparams.n_rot); // a.k.a. n_embd_head, n_head_dim - LLAMA_V3_LOG_INFO("%s: n_gqa = %u\n", __func__, hparams.n_gqa()); - LLAMA_V3_LOG_INFO("%s: rnorm_eps = %.1e\n", __func__, hparams.f_rms_norm_eps); - LLAMA_V3_LOG_INFO("%s: n_ff = %u\n", __func__, n_ff); - LLAMA_V3_LOG_INFO("%s: freq_base = %.1f\n", __func__, hparams.rope_freq_base); - LLAMA_V3_LOG_INFO("%s: freq_scale = %g\n", __func__, hparams.rope_freq_scale); - LLAMA_V3_LOG_INFO("%s: ftype = %u (%s)\n", __func__, hparams.ftype, llama_v3_ftype_name(hparams.ftype)); - LLAMA_V3_LOG_INFO("%s: model size = %s\n", __func__, llama_v3_model_type_name(model.type)); - } - - if (file_version < LLAMA_V3_FILE_VERSION_GGJT_V2) { - if (hparams.ftype != LLAMA_V3_FTYPE_ALL_F32 && - hparams.ftype != LLAMA_V3_FTYPE_MOSTLY_F16 && - hparams.ftype != LLAMA_V3_FTYPE_MOSTLY_Q8_0) { - printf("\nthis format is no longer supported (see https://github.com/ggerganov/llama.cpp/pull/1405)"); - } - } - - if (file_version < LLAMA_V3_FILE_VERSION_GGJT_V3) { - if (hparams.ftype == LLAMA_V3_FTYPE_MOSTLY_Q4_0 || - hparams.ftype == LLAMA_V3_FTYPE_MOSTLY_Q4_1 || - hparams.ftype == LLAMA_V3_FTYPE_MOSTLY_Q8_0) { - printf("\nthis format is no longer supported (see https://github.com/ggerganov/llama.cpp/pull/1508)"); - } - } - - if (vocab_only) { - return; - } - - auto & ctx = model.ctx; - - size_t ctx_size; - size_t mmapped_size; - ml->calc_sizes(&ctx_size, &mmapped_size); - LLAMA_V3_LOG_INFO("%s: ggml ctx size = %7.2f MB\n", __func__, ctx_size/1024.0/1024.0); - - // create the ggml context - { - model.buf.resize(ctx_size); - if (use_mlock) { - model.mlock_buf.init (model.buf.addr); - model.mlock_buf.grow_to(model.buf.size); - } - - struct ggml_init_params params = { - /*.mem_size =*/ model.buf.size, - /*.mem_buffer =*/ model.buf.addr, - /*.no_alloc =*/ ml->use_mmap, - }; - - model.ctx = ggml_init(params); - if (!model.ctx) { - throw std::runtime_error(format_old("ggml_init() failed")); - } - } - - (void) main_gpu; - (void) mul_mat_q; -#if defined(GGML_USE_CUBLAS) - LLAMA_V3_LOG_INFO("%s: using CUDA for GPU acceleration\n", __func__); - ggml_cuda_set_main_device(main_gpu); - ggml_cuda_set_mul_mat_q(mul_mat_q); -#define LLAMA_V3_BACKEND_OFFLOAD GGML_BACKEND_GPU -#define LLAMA_V3_BACKEND_OFFLOAD_SPLIT GGML_BACKEND_GPU_SPLIT -#elif defined(GGML_USE_CLBLAST) - LLAMA_V3_LOG_INFO("%s: using OpenCL for GPU acceleration\n", __func__); -#define LLAMA_V3_BACKEND_OFFLOAD GGML_BACKEND_GPU -#define LLAMA_V3_BACKEND_OFFLOAD_SPLIT GGML_BACKEND_GPU -#else -#define LLAMA_V3_BACKEND_OFFLOAD GGML_BACKEND_CPU -#define LLAMA_V3_BACKEND_OFFLOAD_SPLIT GGML_BACKEND_CPU -#endif - - // prepare memory for the weights - size_t vram_weights = 0; - size_t vram_scratch = 0; - { - const uint32_t n_embd = hparams.n_embd; - const uint32_t n_embd_gqa = hparams.n_embd_gqa(); - const uint32_t n_layer = hparams.n_layer; - const uint32_t n_vocab = hparams.n_vocab; - - ml->ggml_ctx = ctx; - - model.tok_embeddings = ml->get_tensor("tok_embeddings.weight", {n_embd, n_vocab}, GGML_BACKEND_CPU); - - // "output" tensor - { - ggml_backend backend_norm; - ggml_backend backend_output; - if (n_gpu_layers > int(n_layer)) { // NOLINT - // norm is not performance relevant on its own but keeping it in VRAM reduces data copying - // on Windows however this is detrimental unless everything is on the GPU -#ifndef _WIN32 - backend_norm = low_vram ? GGML_BACKEND_CPU : LLAMA_V3_BACKEND_OFFLOAD; -#else - backend_norm = low_vram || n_gpu_layers <= (int) n_layer + 2 ? GGML_BACKEND_CPU : LLAMA_V3_BACKEND_OFFLOAD; -#endif // _WIN32 - - backend_output = LLAMA_V3_BACKEND_OFFLOAD_SPLIT; - } else { - backend_norm = GGML_BACKEND_CPU; - backend_output = GGML_BACKEND_CPU; - } - - model.norm = ml->get_tensor("norm.weight", {n_embd}, backend_norm); - model.output = ml->get_tensor("output.weight", {n_embd, n_vocab}, backend_output); - if (backend_norm == GGML_BACKEND_GPU) { - vram_weights += ggml_nbytes(model.norm); - } - if (backend_output == GGML_BACKEND_GPU_SPLIT) { - vram_weights += ggml_nbytes(model.output); - } - } - - const int i_gpu_start = n_layer - n_gpu_layers; - - model.layers.resize(n_layer); - for (uint32_t i = 0; i < n_layer; ++i) { - const ggml_backend backend = int(i) < i_gpu_start ? GGML_BACKEND_CPU : LLAMA_V3_BACKEND_OFFLOAD; // NOLINT - const ggml_backend backend_split = int(i) < i_gpu_start ? GGML_BACKEND_CPU : LLAMA_V3_BACKEND_OFFLOAD_SPLIT; // NOLINT - - auto & layer = model.layers[i]; - - std::string layers_i = "layers." + std::to_string(i); - - layer.attention_norm = ml->get_tensor(layers_i + ".attention_norm.weight", {n_embd}, backend); - - layer.wq = ml->get_tensor(layers_i + ".attention.wq.weight", {n_embd, n_embd}, backend_split); - layer.wk = ml->get_tensor(layers_i + ".attention.wk.weight", {n_embd, n_embd_gqa}, backend_split); - layer.wv = ml->get_tensor(layers_i + ".attention.wv.weight", {n_embd, n_embd_gqa}, backend_split); - layer.wo = ml->get_tensor(layers_i + ".attention.wo.weight", {n_embd, n_embd}, backend_split); - - layer.ffn_norm = ml->get_tensor(layers_i + ".ffn_norm.weight", {n_embd}, backend); - - layer.w1 = ml->get_tensor(layers_i + ".feed_forward.w1.weight", {n_embd, n_ff}, backend_split); - layer.w2 = ml->get_tensor(layers_i + ".feed_forward.w2.weight", { n_ff, n_embd}, backend_split); - layer.w3 = ml->get_tensor(layers_i + ".feed_forward.w3.weight", {n_embd, n_ff}, backend_split); - - if (backend == GGML_BACKEND_GPU) { - vram_weights += - ggml_nbytes(layer.attention_norm) + ggml_nbytes(layer.wq) + ggml_nbytes(layer.wk) + - ggml_nbytes(layer.wv) + ggml_nbytes(layer.wo) + ggml_nbytes(layer.ffn_norm) + - ggml_nbytes(layer.w1) + ggml_nbytes(layer.w2) + ggml_nbytes(layer.w3); - } - } - } - - ml->done_getting_tensors(); - - // print memory requirements - { - const size_t scale = memory_type == GGML_TYPE_F32 ? 2 : 1; - - // this is the total memory required to run the inference - size_t mem_required = - ctx_size + - mmapped_size - vram_weights; // weights in VRAM not in memory - -#ifndef LLAMA_V3_USE_ALLOCATOR - mem_required += - blasbatchmul*MEM_REQ_SCRATCH0_3(hparams.n_ctx).at(model.type) + - blasbatchmul*MEM_REQ_SCRATCH1_3().at(model.type) + - blasbatchmul*MEM_REQ_EVAL_3().at(model.type); -#endif - - // this is the memory required by one llama_v3_state - const size_t mem_required_state = - scale*hparams.kv_size(); - - LLAMA_V3_LOG_INFO("%s: mem required = %7.2f MB (+ %7.2f MB per state)\n", __func__, - mem_required / 1024.0 / 1024.0, mem_required_state / 1024.0 / 1024.0); - - (void) vram_scratch; - (void) n_batch; -#ifdef GGML_USE_CUBLAS - if (low_vram) { - LLAMA_V3_LOG_INFO("%s: not allocating a VRAM scratch buffer due to low VRAM option\n", __func__); - ggml_cuda_set_scratch_size(0); // disable scratch - } else { - const size_t vram_scratch_base = VRAM_REQ_SCRATCH_BASE_3().at(model.type); - const size_t vram_scratch_per_context = VRAM_REQ_SCRATCH_PER_CONTEXT_3().at(model.type); - vram_scratch = n_batch * (vram_scratch_base + n_ctx * vram_scratch_per_context); - ggml_cuda_set_scratch_size(vram_scratch); - if (n_gpu_layers > 0) { - LLAMA_V3_LOG_INFO("%s: allocating batch_size x (%zd kB + n_ctx x %zd B) = %zd MB VRAM for the scratch buffer\n", - __func__, vram_scratch_base / kB3, vram_scratch_per_context, - (vram_scratch + MB3 - 1) / MB3); // round up - } - } -#endif // GGML_USE_CUBLAS - -#if defined(GGML_USE_CUBLAS) || defined(GGML_USE_CLBLAST) - const int n_gpu = std::min(n_gpu_layers, int(hparams.n_layer)); - - LLAMA_V3_LOG_INFO("%s: offloading %d repeating layers to GPU\n", __func__, n_gpu); - if (n_gpu_layers > (int) hparams.n_layer) { - LLAMA_V3_LOG_INFO("%s: offloading non-repeating layers to GPU\n", __func__); - } - size_t vram_kv_cache = 0; - -#ifdef GGML_USE_CUBLAS - const int max_backend_supported_layers = hparams.n_layer + 3; - const int max_offloadable_layers = low_vram ? hparams.n_layer + 1 : hparams.n_layer + 3; - if (n_gpu_layers > (int) hparams.n_layer + 1) { - if (low_vram) { - LLAMA_V3_LOG_INFO("%s: cannot offload v cache to GPU due to low VRAM option\n", __func__); - } else { - LLAMA_V3_LOG_INFO("%s: offloading v cache to GPU\n", __func__); - vram_kv_cache += hparams.kv_size() / 2; - } - } - if (n_gpu_layers > (int) hparams.n_layer + 2) { - if (low_vram) { - LLAMA_V3_LOG_WARN("%s: cannot offload k cache to GPU due to low VRAM option\n", __func__); - } else { - LLAMA_V3_LOG_INFO("%s: offloading k cache to GPU\n", __func__); - vram_kv_cache += hparams.kv_size() / 2; - } - } -#elif defined(GGML_USE_CLBLAST) - const int max_backend_supported_layers = hparams.n_layer + 1; - const int max_offloadable_layers = hparams.n_layer + 1; -#endif // GGML_USE_CUBLAS - - LLAMA_V3_LOG_INFO("%s: offloaded %d/%d layers to GPU\n", - __func__, std::min(n_gpu_layers, max_offloadable_layers), max_backend_supported_layers); - LLAMA_V3_LOG_INFO("%s: total VRAM used: %zu MB\n", - __func__, (vram_weights + vram_scratch + vram_kv_cache + MB3 - 1) / MB3); // round up -#else - (void) n_gpu_layers; -#endif // defined(GGML_USE_CUBLAS) || defined(GGML_USE_CLBLAST) - } - - // populate `tensors_by_name` - for (llama_v3_load_tensor & lt : ml->tensors_map.tensors) { - model.tensors_by_name.emplace_back(lt.name, lt.ggml_tensor); - } - - (void) tensor_split; -#if defined(GGML_USE_CUBLAS) - { - ggml_cuda_set_tensor_split(tensor_split); - } -#endif - - ml->load_all_data(progress_callback, progress_callback_user_data, use_mlock ? &model.mlock_mmap : NULL); - - if (progress_callback) { - progress_callback(1.0f, progress_callback_user_data); - } - - model.mapping = std::move(ml->mapping); - - // loading time will be recalculate after the first eval, so - // we take page faults deferred by mmap() into consideration - model.t_load_us = ggml_time_us() - model.t_start_us; -} - -static bool llama_v3_model_load( - const std::string & fname, - llama_v3_model & model, - llama_v3_vocab & vocab, - int n_ctx, - int n_batch, - int n_gqa, - float rms_norm_eps, - int n_gpu_layers, - int main_gpu, - const float * tensor_split, - const bool mul_mat_q, - float rope_freq_base, - float rope_freq_scale, - bool low_vram, - ggml_type memory_type, - bool use_mmap, - bool use_mlock, - bool vocab_only, - llama_v3_progress_callback progress_callback, - void *progress_callback_user_data) { - try { - llama_v3_model_load_internal(fname, model, vocab, n_ctx, n_batch, n_gqa, rms_norm_eps, n_gpu_layers, - main_gpu, tensor_split, mul_mat_q, rope_freq_base, rope_freq_scale, low_vram, memory_type, - use_mmap, use_mlock, vocab_only, progress_callback, progress_callback_user_data); - return true; - } catch (const std::exception & err) { - LLAMA_V3_LOG_ERROR("error loading model: %s\n", err.what()); - return false; - } -} - -static struct ggml_cgraph * llama_v3_build_graph( - llama_v3_context & lctx, - const llama_v3_token * tokens, - const float * embd, - int n_tokens, - int n_past) { - - LLAMA_V3_ASSERT((!tokens && embd) || (tokens && !embd)); - - const int N = n_tokens; - - const auto & model = lctx.model; - const auto & hparams = model.hparams; - - const auto & kv_self = lctx.kv_self; - - LLAMA_V3_ASSERT(!!kv_self.ctx); - - const int64_t n_embd = hparams.n_embd; - const int64_t n_layer = hparams.n_layer; - const int64_t n_ctx = hparams.n_ctx; - const int64_t n_head = hparams.n_head; - const int64_t n_head_kv = hparams.n_head_kv; - const int64_t n_embd_head = hparams.n_embd_head(); - const int64_t n_embd_gqa = hparams.n_embd_gqa(); - - LLAMA_V3_ASSERT(n_embd_head == hparams.n_rot); - - const float freq_base = hparams.rope_freq_base; - const float freq_scale = hparams.rope_freq_scale; - const float rms_norm_eps = hparams.f_rms_norm_eps; - - const int n_gpu_layers = model.n_gpu_layers; - - auto & mem_per_token = lctx.mem_per_token; - auto & buf_compute = lctx.buf_compute; - - - struct ggml_init_params params = { - /*.mem_size =*/ buf_compute.size, - /*.mem_buffer =*/ buf_compute.addr, - /*.no_alloc =*/ false, - }; - -#ifdef LLAMA_V3_USE_ALLOCATOR - params.no_alloc = true; -#endif - - struct ggml_context * ctx0 = ggml_init(params); - - ggml_cgraph * gf = ggml_new_graph(ctx0); - - struct ggml_tensor * cur; - struct ggml_tensor * inpL; - - if (tokens) { - struct ggml_tensor * inp_tokens = ggml_new_tensor_1d(ctx0, GGML_TYPE_I32, N); - -#ifdef LLAMA_V3_USE_ALLOCATOR - ggml_allocr_alloc(lctx.alloc, inp_tokens); - if (!ggml_allocr_is_measure(lctx.alloc)) { - memcpy(inp_tokens->data, tokens, N*ggml_element_size(inp_tokens)); - } -#else - memcpy(inp_tokens->data, tokens, N*ggml_element_size(inp_tokens)); -#endif - ggml_set_name(inp_tokens, "inp_tokens"); - - inpL = ggml_get_rows(ctx0, model.tok_embeddings, inp_tokens); - } else { -#ifdef GGML_USE_MPI - GGML_ASSERT(false && "not implemented"); -#endif - - inpL = ggml_new_tensor_2d(ctx0, GGML_TYPE_F32, n_embd, N); - -#ifdef LLAMA_V3_USE_ALLOCATOR - ggml_allocr_alloc(lctx.alloc, inpL); - if (!ggml_allocr_is_measure(lctx.alloc)) { - memcpy(inpL->data, embd, N * n_embd * ggml_element_size(inpL)); - } -#else - memcpy(inpL->data, embd, N * n_embd * ggml_element_size(inpL)); -#endif - } - - const int i_gpu_start = n_layer - n_gpu_layers; - (void) i_gpu_start; - - // offload functions set the tensor output backend to GPU - // tensors are GPU-accelerated if any input or the output has been offloaded - // - // with the low VRAM option VRAM scratch is disabled in llama_v3_load_model_internal - // in that case ggml_cuda_assign_buffers has no effect - offload_func_t offload_func_nr = llama_v3_nop; // nr = non-repeating - offload_func_t offload_func_kq = llama_v3_nop; - offload_func_t offload_func_v = llama_v3_nop; - -#ifdef GGML_USE_CUBLAS - if (n_gpu_layers > n_layer) { - offload_func_nr = ggml_cuda_assign_buffers; - } - if (n_gpu_layers > n_layer + 1) { - offload_func_v = ggml_cuda_assign_buffers; - } - if (n_gpu_layers > n_layer + 2) { - offload_func_kq = ggml_cuda_assign_buffers; - } -#endif // GGML_USE_CUBLAS - - struct ggml_tensor * KQ_scale = ggml_new_tensor_1d(ctx0, GGML_TYPE_F32, 1); -#ifdef LLAMA_V3_USE_ALLOCATOR - ggml_allocr_alloc(lctx.alloc, KQ_scale); - if (!ggml_allocr_is_measure(lctx.alloc)) { - ggml_set_f32(KQ_scale, 1.0f/sqrtf(float(n_embd)/n_head)); - } -#else - ggml_set_f32(KQ_scale, 1.0f/sqrtf(float(n_embd)/n_head)); -#endif - ggml_set_name(KQ_scale, "1/sqrt(n_embd_head)"); - - for (int il = 0; il < n_layer; ++il) { - ggml_format_name(inpL, "layer_inp_%d", il); - - offload_func_t offload_func = llama_v3_nop; - -#ifdef GGML_USE_CUBLAS - if (il >= i_gpu_start) { - offload_func = ggml_cuda_assign_buffers; - } -#endif // GGML_USE_CUBLAS - - struct ggml_tensor * inpSA = inpL; - - lctx.use_buf(ctx0, 0); - - // norm - { - cur = ggml_rms_norm(ctx0, inpL, rms_norm_eps); - offload_func(cur); - ggml_set_name(cur, "rms_norm_0"); - - // cur = cur*attention_norm(broadcasted) - cur = ggml_mul(ctx0, cur, model.layers[il].attention_norm); - offload_func(cur); - ggml_set_name(cur, "attention_norm_0"); - } - - // self-attention - { - // compute Q and K and RoPE them - struct ggml_tensor * tmpk = ggml_mul_mat(ctx0, model.layers[il].wk, cur); - offload_func_kq(tmpk); - ggml_set_name(tmpk, "tmpk"); - - struct ggml_tensor * tmpq = ggml_mul_mat(ctx0, model.layers[il].wq, cur); - offload_func_kq(tmpq); - ggml_set_name(tmpq, "tmpq"); - - struct ggml_tensor * KQ_pos = ggml_new_tensor_1d(ctx0, GGML_TYPE_I32, n_tokens); - ggml_set_name(KQ_pos, "KQ_pos"); - -#ifdef LLAMA_V3_USE_ALLOCATOR - offload_func_kq(KQ_pos); //don't offload rope for cublas, its broken now since ring buffer was added - ggml_allocr_alloc(lctx.alloc, KQ_pos); - if (!ggml_allocr_is_measure(lctx.alloc)) { - int * data = (int *) KQ_pos->data; - for (int i = 0; i < N; ++i) { - data[i] = n_past + i; - } - } -#else - { - int * data = (int *) KQ_pos->data; - for (int i = 0; i < N; ++i) { - data[i] = n_past + i; - } - } -#endif - - struct ggml_tensor * Kcur = ggml_rope_custom_inplace(ctx0, ggml_reshape_3d(ctx0, tmpk, n_embd_head, n_head_kv, N), KQ_pos, n_embd_head, 0, 0, freq_base, freq_scale); - offload_func_kq(Kcur); - ggml_set_name(Kcur, "Kcur"); - - struct ggml_tensor * Qcur = ggml_rope_custom_inplace(ctx0, ggml_reshape_3d(ctx0, tmpq, n_embd_head, n_head, N), KQ_pos, n_embd_head, 0, 0, freq_base, freq_scale); - offload_func_kq(Qcur); - ggml_set_name(Qcur, "Qcur"); - - // store key and value to memory - { - // compute the transposed [N, n_embd] V matrix - - struct ggml_tensor * tmpv = ggml_mul_mat(ctx0, model.layers[il].wv, cur); - offload_func_v(tmpv); - ggml_set_name(tmpv, "tmpv"); - - struct ggml_tensor * Vcur = ggml_transpose(ctx0, ggml_reshape_2d(ctx0, tmpv, n_embd_gqa, N)); - offload_func_v(Vcur); - ggml_set_name(Vcur, "Vcur"); - - struct ggml_tensor * k = ggml_view_1d(ctx0, kv_self.k, N*n_embd_gqa, (ggml_element_size(kv_self.k)*n_embd_gqa)*(il*n_ctx + n_past)); - offload_func_kq(k); - ggml_set_name(k, "k"); - - struct ggml_tensor * v = ggml_view_2d(ctx0, kv_self.v, N, n_embd_gqa, - ( n_ctx)*ggml_element_size(kv_self.v), - (il*n_ctx)*ggml_element_size(kv_self.v)*n_embd_gqa + n_past*ggml_element_size(kv_self.v)); - offload_func_v(v); - ggml_set_name(v, "v"); - - // important: storing RoPE-ed version of K in the KV cache! - ggml_build_forward_expand(gf, ggml_cpy(ctx0, Kcur, k)); - ggml_build_forward_expand(gf, ggml_cpy(ctx0, Vcur, v)); - } - - struct ggml_tensor * Q = - ggml_permute(ctx0, - Qcur, - 0, 2, 1, 3); - offload_func_kq(Q); - ggml_set_name(Q, "Q"); - - struct ggml_tensor * K = - ggml_view_3d(ctx0, kv_self.k, - n_embd_head, n_past + N, n_head_kv, - ggml_element_size(kv_self.k)*n_embd_gqa, - ggml_element_size(kv_self.k)*n_embd_head, - ggml_element_size(kv_self.k)*n_embd_gqa*n_ctx*il); - offload_func_kq(K); - ggml_set_name(K, "K"); - - // K * Q - struct ggml_tensor * KQ = ggml_mul_mat(ctx0, K, Q); - offload_func_kq(KQ); - ggml_set_name(KQ, "KQ"); - - // KQ_scaled = KQ / sqrt(n_embd_head) - // KQ_scaled shape [n_past + N, N, n_head, 1] - struct ggml_tensor * KQ_scaled = ggml_scale_inplace(ctx0, KQ, KQ_scale); - offload_func_kq(KQ_scaled); - ggml_set_name(KQ_scaled, "KQ_scaled"); - - // KQ_masked = mask_past(KQ_scaled) - struct ggml_tensor * KQ_masked = ggml_diag_mask_inf_inplace(ctx0, KQ_scaled, n_past); - offload_func_kq(KQ_masked); - ggml_set_name(KQ_masked, "KQ_masked"); - - // KQ = soft_max(KQ_masked) - struct ggml_tensor * KQ_soft_max = ggml_soft_max_inplace(ctx0, KQ_masked); - offload_func_v(KQ_soft_max); - ggml_set_name(KQ_soft_max, "KQ_soft_max"); - - // split cached V into n_head heads - struct ggml_tensor * V = - ggml_view_3d(ctx0, kv_self.v, - n_past + N, n_embd_head, n_head_kv, - ggml_element_size(kv_self.v)*n_ctx, - ggml_element_size(kv_self.v)*n_ctx*n_embd_head, - ggml_element_size(kv_self.v)*n_ctx*n_embd_gqa*il); - offload_func_v(V); - ggml_set_name(V, "V"); - -#if 1 - struct ggml_tensor * KQV = ggml_mul_mat(ctx0, V, KQ_soft_max); - offload_func_v(KQV); - ggml_set_name(KQV, "KQV"); -#else - // make V contiguous in memory to speed up the matmul, however we waste time on the copy - // on M1 this is faster for the perplexity computation, but ~5% slower for the single-token generation - // is there a better way? - struct ggml_tensor * V_cont = ggml_cpy(ctx0, V, ggml_new_tensor_3d(ctx0, kv_self.v->type, n_past + N, n_embd_head, n_head)); - struct ggml_tensor * KQV = ggml_mul_mat(ctx0, V_cont, KQ_soft_max); -#endif - - // KQV_merged = KQV.permute(0, 2, 1, 3) - struct ggml_tensor * KQV_merged = ggml_permute(ctx0, KQV, 0, 2, 1, 3); - offload_func_v(KQV_merged); - ggml_set_name(KQV_merged, "KQV_merged"); - - // cur = KQV_merged.contiguous().view(n_embd, N) - cur = ggml_cpy(ctx0, - KQV_merged, - ggml_new_tensor_2d(ctx0, GGML_TYPE_F32, n_embd, N)); - offload_func_v(cur); - ggml_set_name(cur, "KQV_merged_contiguous"); - - // projection (no bias) - cur = ggml_mul_mat(ctx0, - model.layers[il].wo, - cur); - offload_func(cur); - ggml_set_name(cur, "result_wo"); - } - - lctx.use_buf(ctx0, 1); - - struct ggml_tensor * inpFF = ggml_add(ctx0, cur, inpSA); - offload_func(inpFF); - ggml_set_name(inpFF, "inpFF"); - - // feed-forward network - { - // norm - { - cur = ggml_rms_norm(ctx0, inpFF, rms_norm_eps); - offload_func(cur); - ggml_set_name(cur, "rms_norm_1"); - - // cur = cur*ffn_norm(broadcasted) - cur = ggml_mul(ctx0, cur, model.layers[il].ffn_norm); - offload_func(cur); - ggml_set_name(cur, "ffn_norm"); - } - - struct ggml_tensor * tmp = ggml_mul_mat(ctx0, - model.layers[il].w3, - cur); - offload_func(tmp); - ggml_set_name(tmp, "result_w3"); - - cur = ggml_mul_mat(ctx0, - model.layers[il].w1, - cur); - offload_func(cur); - ggml_set_name(cur, "result_w1"); - - // SILU activation - cur = ggml_silu(ctx0, cur); - offload_func(cur); - ggml_set_name(cur, "silu"); - - cur = ggml_mul(ctx0, cur, tmp); - offload_func(cur); - ggml_set_name(cur, "silu_x_result_w3"); - - cur = ggml_mul_mat(ctx0, - model.layers[il].w2, - cur); - offload_func(cur); - ggml_set_name(cur, "result_w2"); - } - - cur = ggml_add(ctx0, cur, inpFF); - offload_func(cur); - ggml_set_name(cur, "inpFF_+_result_w2"); - - // input for next layer - inpL = cur; - } - - lctx.use_buf(ctx0, 0); - - // norm - { - cur = ggml_rms_norm(ctx0, inpL, rms_norm_eps); - offload_func_nr(cur); - ggml_set_name(cur, "rms_norm_2"); - - // cur = cur*norm(broadcasted) - cur = ggml_mul(ctx0, cur, model.norm); - // offload_func_nr(cur); // TODO CPU + GPU mirrored backend - ggml_set_name(cur, "result_norm"); - } - - // lm_head - cur = ggml_mul_mat(ctx0, model.output, cur); - ggml_set_name(cur, "result_output"); - - lctx.use_buf(ctx0, -1); - - // logits -> probs - //cur = ggml_soft_max_inplace(ctx0, cur); - - ggml_build_forward_expand(gf, cur); - - if (mem_per_token == 0) { - mem_per_token = ggml_used_mem(ctx0)/N; - } - -#if 0 - LLAMA_V3_LOG_INFO("\n%s: used_mem: eval ctx %.3f MB, scratch %.3f MB %.3f MB, work buf %.3f MB, n_past = %d, N = %d\n", __func__, - ggml_used_mem(ctx0)/1024.0/1024.0, - lctx.get_buf_max_mem(0)/1024.0/1024.0, - lctx.get_buf_max_mem(1)/1024.0/1024.0, - lctx.work_buffer.size()/1024.0/1024.0, - n_past, N); -#endif - - ggml_free(ctx0); - - return gf; -} - -// evaluate the transformer -// -// - lctx: llama context -// - tokens: new batch of tokens to process -// - embd embeddings input -// - n_tokens number of tokens -// - n_past: the context size so far -// - n_threads: number of threads to use -// -static bool llama_v3_eval_internal( - llama_v3_context & lctx, - const llama_v3_token * tokens, - const float * embd, - int n_tokens, - int n_past, - int n_threads, - const char * cgraph_fname) { - - LLAMA_V3_ASSERT((!tokens && embd) || (tokens && !embd)); - - LLAMA_V3_ASSERT(n_tokens > 0); - LLAMA_V3_ASSERT(n_past >= 0); - LLAMA_V3_ASSERT(n_threads > 0); - // TODO: keep the values of n_batch and n_ctx - // LLAMA_V3_ASSERT(n_tokens <= n_batch); - // LLAMA_V3_ASSERT(n_past + n_tokens <= n_ctx); - - const int64_t t_start_us = ggml_time_us(); - -#ifdef GGML_USE_MPI - ggml_mpi_eval_init(lctx.ctx_mpi, &n_tokens, &n_past, &n_threads); -#endif - - const int N = n_tokens; - - const auto & model = lctx.model; - const auto & hparams = model.hparams; - - const auto & kv_self = lctx.kv_self; - - LLAMA_V3_ASSERT(!!kv_self.ctx); - - const int64_t n_embd = hparams.n_embd; - const int64_t n_vocab = hparams.n_vocab; - -#ifdef LLAMA_V3_USE_ALLOCATOR - ggml_allocr_reset(lctx.alloc); -#endif - - ggml_cgraph * gf = llama_v3_build_graph(lctx, tokens, embd, n_tokens, n_past); - -#ifdef LLAMA_V3_USE_ALLOCATOR - ggml_allocr_alloc_graph(lctx.alloc, gf); -#endif - - // LLAMA_V3_LOG_INFO("graph build time: %.3f ms (%d nodes, %d leafs)\n", (ggml_time_us() - t_start_us)/1000.0, gf->n_nodes, gf->n_leafs); - - // for big prompts, if BLAS is enabled, it is better to use only one thread - // otherwise, the threads are spin-lock waiting for the BLAS calls and are degrading the performance - n_threads = N >= 32 && ggml_cpu_has_blas() && !ggml_cpu_has_gpublas() ? 1 : n_threads; - - struct ggml_tensor * res = gf->nodes[gf->n_nodes - 1]; - struct ggml_tensor * embeddings = gf->nodes[gf->n_nodes - 2]; - - LLAMA_V3_ASSERT(strcmp(res->name, "result_output") == 0); - LLAMA_V3_ASSERT(strcmp(embeddings->name, "result_norm") == 0); - -#if GGML_USE_MPI - const int64_t n_layer = hparams.n_layer; - ggml_mpi_graph_compute_pre(lctx.ctx_mpi, gf, n_layer); -#endif - -#ifdef GGML_USE_METAL - if (lctx.ctx_metal) { - ggml_metal_set_n_cb (lctx.ctx_metal, n_threads); - ggml_metal_graph_compute(lctx.ctx_metal, gf); - ggml_metal_get_tensor (lctx.ctx_metal, res); - if (!lctx.embedding.empty()) { - ggml_metal_get_tensor(lctx.ctx_metal, embeddings); - } - } else { - llv3_graph_compute_helper(lctx.work_buffer, gf, n_threads); - } -#else - llv3_graph_compute_helper(lctx.work_buffer, gf, n_threads); -#endif - -#if GGML_USE_MPI - ggml_mpi_graph_compute_post(lctx.ctx_mpi, gf, n_layer); -#endif - - // update kv token count - lctx.kv_self.n = n_past + N; - - if (cgraph_fname) { - ggml_graph_export(gf, cgraph_fname); - } - -#ifdef GGML_PERF - // print timing information per ggml operation (for debugging purposes) - // requires GGML_PERF to be defined - ggml_graph_print(gf); -#endif - - // plot the computation graph in dot format (for debugging purposes) - //if (n_past%100 == 0) { - // ggml_graph_dump_dot(gf, NULL, "llama.dot"); - //} - - // extract logits - { - auto & logits_out = lctx.logits; - - if (lctx.logits_all) { - logits_out.resize(n_vocab * N); - memcpy(logits_out.data(), (float *) ggml_get_data(res), sizeof(float)*n_vocab*N); - } else { - // return result for just the last token - logits_out.resize(n_vocab); - memcpy(logits_out.data(), (float *) ggml_get_data(res) + (n_vocab*(N-1)), sizeof(float)*n_vocab); - } - } - - // extract embeddings - if (!lctx.embedding.empty()) { - auto & embedding_out = lctx.embedding; - - embedding_out.resize(n_embd); - memcpy(embedding_out.data(), (float *) ggml_get_data(embeddings) + (n_embd*(N - 1)), sizeof(float)*n_embd); - } - - // measure the performance only for the single-token evals - if (N == 1) { - lctx.t_eval_us += ggml_time_us() - t_start_us; - lctx.n_eval++; - } - else if (N > 1) { - lctx.t_p_eval_us += ggml_time_us() - t_start_us; - lctx.n_p_eval += N; - } - - return true; -} - -// -// tokenizer -// - -static size_t utf8_len3(char src) { - const size_t lookup[] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 3, 4 }; - uint8_t highbits = static_cast(src) >> 4; - return lookup[highbits]; -} - -struct llama_v3_sp_symbol { - using index = int; - index prev; - index next; - const char * text; - size_t n; -}; - -static_assert(std::is_trivially_copyable::value, "llama_v3_sp_symbol is not trivially copyable"); - -struct llama_v3_sp_bigram { - struct comparator { - bool operator()(llama_v3_sp_bigram & l, llama_v3_sp_bigram & r) { - return (l.score < r.score) || (l.score == r.score && l.left > r.left); - } - }; - using queue_storage = std::vector; - using queue = std::priority_queue; - llama_v3_sp_symbol::index left; - llama_v3_sp_symbol::index right; - float score; - size_t size; -}; - -// original implementation: -// https://github.com/ggerganov/llama.cpp/commit/074bea2eb1f1349a0118239c4152914aecaa1be4 -struct llama_v3_tokenizer { - llama_v3_tokenizer(const llama_v3_vocab & vocab): vocab_(vocab) {} - - void tokenize(const std::string & text, std::vector & output) { - // split string into utf8 chars - int index = 0; - size_t offs = 0; - while (offs < text.size()) { - llama_v3_sp_symbol sym; - size_t char_len = std::min(text.size() - offs, utf8_len3(text[offs])); - sym.text = text.c_str() + offs; - sym.n = char_len; - offs += char_len; - sym.prev = index - 1; - sym.next = offs == text.size() ? -1 : index + 1; - index++; - symbols_.emplace_back(sym); - } - - // seed the work queue with all possible 2-character tokens. - for (size_t i = 1; i < symbols_.size(); ++i) { - try_add_bigram(i - 1, i); - } - - // keep substituting the highest frequency pairs for as long as we can. - while (!work_queue_.empty()) { - auto bigram = work_queue_.top(); - work_queue_.pop(); - - auto & left_sym = symbols_[bigram.left]; - auto & right_sym = symbols_[bigram.right]; - - // if one of the symbols already got merged, skip it. - if (left_sym.n == 0 || right_sym.n == 0 || - left_sym.n + right_sym.n != bigram.size) { - continue; - } - - // merge the right sym into the left one - left_sym.n += right_sym.n; - right_sym.n = 0; - - //LLAMA_V3_LOG_INFO("left = '%*s' size = %zu\n", (int) left_sym.n, left_sym.text, bigram.size); - - // remove the right sym from the chain - left_sym.next = right_sym.next; - if (right_sym.next >= 0) { - symbols_[right_sym.next].prev = bigram.left; - } - - // find more substitutions - try_add_bigram(left_sym.prev, bigram.left); - try_add_bigram(bigram.left, left_sym.next); - } - - for (int i = 0; i != -1; i = symbols_[i].next) { - auto & symbol = symbols_[i]; - auto token = vocab_.token_to_id.find(std::string(symbol.text, symbol.n)); - - if (token == vocab_.token_to_id.end()) { - // output any symbols that did not form tokens as bytes. - for (int j = 0; j < (int) symbol.n; ++j) { - // NOTE: old version, before #2420 - not sure what are the implications of this - //llama_v3_vocab::id token_id = static_cast(symbol.text[j]) + 3; - llama_v3_vocab::id token_id = vocab_.token_to_id.at(std::string(1, symbol.text[j])); - output.push_back(token_id); - } - } else { - output.push_back((*token).second); - } - } - } - -private: - void try_add_bigram(int left, int right) { - if (left == -1 || right == -1) { - return; - } - - const std::string text = std::string(symbols_[left].text, symbols_[left].n + symbols_[right].n); - auto token = vocab_.token_to_id.find(text); - - if (token == vocab_.token_to_id.end()) { - return; - } - - if (static_cast((*token).second) >= vocab_.id_to_token.size()) { - return; - } - - const auto &tok_score = vocab_.id_to_token[(*token).second]; - - llama_v3_sp_bigram bigram; - bigram.left = left; - bigram.right = right; - bigram.score = tok_score.score; - bigram.size = text.size(); - work_queue_.push(bigram); - } - - const llama_v3_vocab & vocab_; - std::vector symbols_; - llama_v3_sp_bigram::queue work_queue_; -}; - -std::vector llama_v3_tokenize( - struct llama_v3_context * ctx, - const std::string & text, - bool add_bos) { - // upper limit for the number of tokens - int n_tokens = text.length() + add_bos; - std::vector result(n_tokens); - n_tokens = llama_v3_tokenize(ctx, text.c_str(), result.data(), result.size(), add_bos); - if (n_tokens < 0) { - result.resize(-n_tokens); - int check = llama_v3_tokenize(ctx, text.c_str(), result.data(), result.size(), add_bos); - GGML_ASSERT(check == -n_tokens); - } else { - result.resize(n_tokens); - } - return result; -} - -static std::vector llama_v3_tokenize(const llama_v3_vocab & vocab, const std::string & text, bool bos) { - llama_v3_tokenizer tokenizer(vocab); - std::vector output; - - if (text.empty()) { - return output; - } - - if (bos) { - output.push_back(llama_v3_token_bos()); - } - - tokenizer.tokenize(text, output); - return output; -} - -// -// grammar - internal -// - -struct llama_v3_partial_utf8 { - uint32_t value; // bit value so far (unshifted) - int n_remain; // num bytes remaining; -1 indicates invalid sequence -}; - -struct llama_v3_grammar { - const std::vector> rules; - std::vector> stacks; - - // buffer for partially generated UTF-8 sequence from accepted tokens - llama_v3_partial_utf8 partial_utf8; -}; - -struct llama_v3_grammar_candidate { - size_t index; - const uint32_t * code_points; - llama_v3_partial_utf8 partial_utf8; -}; - -// Decodes a UTF-8 string which may end in an incomplete sequence. Adds a terminating 0 for use as -// pointer. If an invalid sequence is encountered, returns `llama_v3_partial_utf8.n_remain == -1`. -std::pair, llama_v3_partial_utf8> decode_utf8( - const char * src, - llama_v3_partial_utf8 partial_start) { - static const int lookup[] = { 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 2, 2, 3, 4 }; - const char * pos = src; - std::vector code_points; - uint32_t value = partial_start.value; - int n_remain = partial_start.n_remain; - - // continue previous decode, if applicable - while (*pos != 0 && n_remain > 0) { - uint8_t next_byte = static_cast(*pos); - if ((next_byte >> 6) != 2) { - // invalid sequence, abort - code_points.push_back(0); - return std::make_pair(std::move(code_points), llama_v3_partial_utf8{ 0, -1 }); - } - value = (value << 6) + (next_byte & 0x3F); - ++pos; - --n_remain; - } - - if (partial_start.n_remain > 0 && n_remain == 0) { - code_points.push_back(value); - } - - // decode any subsequent utf-8 sequences, which may end in an incomplete one - while (*pos != 0) { - uint8_t first_byte = static_cast(*pos); - uint8_t highbits = first_byte >> 4; - n_remain = lookup[highbits] - 1; - - if (n_remain < 0) { - // invalid sequence, abort - code_points.clear(); - code_points.push_back(0); - return std::make_pair(std::move(code_points), llama_v3_partial_utf8{ 0, n_remain }); - } - - uint8_t mask = (1 << (7 - n_remain)) - 1; - value = first_byte & mask; - ++pos; - while (*pos != 0 && n_remain > 0) { - value = (value << 6) + (static_cast(*pos) & 0x3F); - ++pos; - --n_remain; - } - if (n_remain == 0) { - code_points.push_back(value); - } - } - code_points.push_back(0); - - return std::make_pair(std::move(code_points), llama_v3_partial_utf8{ value, n_remain }); -} - -// returns true iff pos points to the end of one of the definitions of a rule -static bool llama_v3_grammar_is_end_of_sequence(const llama_v3_grammar_element * pos) { - switch (pos->type) { - case LLAMA_V3_GRETYPE_END: return true; - case LLAMA_V3_GRETYPE_ALT: return true; - default: return false; - } -} - -// returns true iff chr satisfies the char range at pos (regular or inverse range) -// asserts that pos is pointing to a char range element -static std::pair llama_v3_grammar_match_char( - const llama_v3_grammar_element * pos, - const uint32_t chr) { - - bool found = false; - bool is_positive_char = pos->type == LLAMA_V3_GRETYPE_CHAR; - LLAMA_V3_ASSERT(is_positive_char || pos->type == LLAMA_V3_GRETYPE_CHAR_NOT); - - do { - if (pos[1].type == LLAMA_V3_GRETYPE_CHAR_RNG_UPPER) { - // inclusive range, e.g. [a-z] - found = found || (pos->value <= chr && chr <= pos[1].value); - pos += 2; - } else { - // exact char match, e.g. [a] or "a" - found = found || pos->value == chr; - pos += 1; - } - } while (pos->type == LLAMA_V3_GRETYPE_CHAR_ALT); - - return std::make_pair(found == is_positive_char, pos); -} - -// returns true iff some continuation of the given partial UTF-8 sequence could satisfy the char -// range at pos (regular or inverse range) -// asserts that pos is pointing to a char range element -static bool llama_v3_grammar_match_partial_char( - const llama_v3_grammar_element * pos, - const llama_v3_partial_utf8 partial_utf8) { - - bool is_positive_char = pos->type == LLAMA_V3_GRETYPE_CHAR; - LLAMA_V3_ASSERT(is_positive_char || pos->type == LLAMA_V3_GRETYPE_CHAR_NOT); - - uint32_t partial_value = partial_utf8.value; - int n_remain = partial_utf8.n_remain; - - // invalid sequence or 7-bit char split across 2 bytes (overlong) - if (n_remain < 0 || (n_remain == 1 && partial_value < 2)) { - return false; - } - - // range of possible code points this partial UTF-8 sequence could complete to - uint32_t low = partial_value << (n_remain * 6); - uint32_t high = low | ((1 << (n_remain * 6)) - 1); - - if (low == 0) { - if (n_remain == 2) { - low = 1 << 11; - } else if (n_remain == 3) { - low = 1 << 16; - } - } - - do { - if (pos[1].type == LLAMA_V3_GRETYPE_CHAR_RNG_UPPER) { - // inclusive range, e.g. [a-z] - if (pos->value <= high && low <= pos[1].value) { - return is_positive_char; - } - pos += 2; - } else { - // exact char match, e.g. [a] or "a" - if (low <= pos->value && pos->value <= high) { - return is_positive_char; - } - pos += 1; - } - } while (pos->type == LLAMA_V3_GRETYPE_CHAR_ALT); - - return !is_positive_char; -} - - -// transforms a grammar pushdown stack into N possible stacks, all ending -// at a character range (terminal element) -static void llama_v3_grammar_advance_stack( - const std::vector> & rules, - const std::vector & stack, - std::vector> & new_stacks) { - - if (stack.empty()) { - new_stacks.push_back(stack); - return; - } - - const llama_v3_grammar_element * pos = stack.back(); - - switch (pos->type) { - case LLAMA_V3_GRETYPE_RULE_REF: { - const size_t rule_id = static_cast(pos->value); - const llama_v3_grammar_element * subpos = rules[rule_id].data(); - do { - // init new stack without the top (pos) - std::vector new_stack(stack.begin(), stack.end() - 1); - if (!llama_v3_grammar_is_end_of_sequence(pos + 1)) { - // if this rule ref is followed by another element, add that to stack - new_stack.push_back(pos + 1); - } - if (!llama_v3_grammar_is_end_of_sequence(subpos)) { - // if alternate is nonempty, add to stack - new_stack.push_back(subpos); - } - llama_v3_grammar_advance_stack(rules, new_stack, new_stacks); - while (!llama_v3_grammar_is_end_of_sequence(subpos)) { - // scan to end of alternate def - subpos++; - } - if (subpos->type == LLAMA_V3_GRETYPE_ALT) { - // there's another alternate def of this rule to process - subpos++; - } else { - break; - } - } while (true); - break; - } - case LLAMA_V3_GRETYPE_CHAR: - case LLAMA_V3_GRETYPE_CHAR_NOT: - new_stacks.push_back(stack); - break; - default: - // end of alternate (LLAMA_V3_GRETYPE_END, LLAMA_V3_GRETYPE_ALT) or middle of char range - // (LLAMA_V3_GRETYPE_CHAR_ALT, LLAMA_V3_GRETYPE_CHAR_RNG_UPPER); stack should never be left on - // those - LLAMA_V3_ASSERT(false); - } -} - -// takes a set of possible pushdown stacks on a grammar, which are required to -// be positioned at a character range (see `llama_v3_grammar_advance_stack`), and -// produces the N possible stacks if the given char is accepted at those -// positions -static std::vector> llama_v3_grammar_accept( - const std::vector> & rules, - const std::vector> & stacks, - const uint32_t chr) { - - std::vector> new_stacks; - - for (const auto & stack : stacks) { - if (stack.empty()) { - continue; - } - - auto match = llama_v3_grammar_match_char(stack.back(), chr); - if (match.first) { - const llama_v3_grammar_element * pos = match.second; - - // update top of stack to next element, if any - std::vector new_stack(stack.begin(), stack.end() - 1); - if (!llama_v3_grammar_is_end_of_sequence(pos)) { - new_stack.push_back(pos); - } - llama_v3_grammar_advance_stack(rules, new_stack, new_stacks); - } - } - - return new_stacks; -} - -static std::vector llama_v3_grammar_reject_candidates( - const std::vector> & rules, - const std::vector> & stacks, - const std::vector & candidates); - -static std::vector llama_v3_grammar_reject_candidates_for_stack( - const std::vector> & rules, - const std::vector & stack, - const std::vector & candidates) { - - std::vector rejects; - - if (stack.empty()) { - for (auto tok : candidates) { - if (*tok.code_points != 0 || tok.partial_utf8.n_remain != 0) { - rejects.push_back(tok); - } - } - return rejects; - } - - const llama_v3_grammar_element * stack_pos = stack.back(); - - std::vector next_candidates; - for (auto tok : candidates) { - if (*tok.code_points == 0) { - // reached end of full codepoints in token, reject iff it ended in a partial sequence - // that cannot satisfy this position in grammar - if (tok.partial_utf8.n_remain != 0 && - !llama_v3_grammar_match_partial_char(stack_pos, tok.partial_utf8)) { - rejects.push_back(tok); - } - } else if (llama_v3_grammar_match_char(stack_pos, *tok.code_points).first) { - next_candidates.push_back({ tok.index, tok.code_points + 1, tok.partial_utf8 }); - } else { - rejects.push_back(tok); - } - } - - auto stack_pos_after = llama_v3_grammar_match_char(stack_pos, 0).second; - - // update top of stack to next element, if any - std::vector stack_after(stack.begin(), stack.end() - 1); - if (!llama_v3_grammar_is_end_of_sequence(stack_pos_after)) { - stack_after.push_back(stack_pos_after); - } - std::vector> next_stacks; - llama_v3_grammar_advance_stack(rules, stack_after, next_stacks); - - auto next_rejects = llama_v3_grammar_reject_candidates(rules, next_stacks, next_candidates); - for (auto tok : next_rejects) { - rejects.push_back({ tok.index, tok.code_points - 1, tok.partial_utf8 }); - } - - return rejects; -} - -static std::vector llama_v3_grammar_reject_candidates( - const std::vector> & rules, - const std::vector> & stacks, - const std::vector & candidates) { - LLAMA_V3_ASSERT(!stacks.empty()); // REVIEW - - if (candidates.empty()) { - return std::vector(); - } - - auto rejects = llama_v3_grammar_reject_candidates_for_stack(rules, stacks.front(), candidates); - - for (size_t i = 1, size = stacks.size(); i < size; ++i) { - rejects = llama_v3_grammar_reject_candidates_for_stack(rules, stacks[i], rejects); - } - return rejects; -} - -// -// grammar - external -// - -struct llama_v3_grammar * llama_v3_grammar_init( - const llama_v3_grammar_element ** rules, - size_t n_rules, - size_t start_rule_index) { - const llama_v3_grammar_element * pos; - - // copy rule definitions into vectors - std::vector> vec_rules(n_rules); - for (size_t i = 0; i < n_rules; i++) { - for (pos = rules[i]; pos->type != LLAMA_V3_GRETYPE_END; pos++) { - vec_rules[i].push_back(*pos); - } - vec_rules[i].push_back({LLAMA_V3_GRETYPE_END, 0}); - } - - // loop over alternates of start rule to build initial stacks - std::vector> stacks; - pos = rules[start_rule_index]; - do { - std::vector stack; - if (!llama_v3_grammar_is_end_of_sequence(pos)) { - // if alternate is nonempty, add to stack - stack.push_back(pos); - } - llama_v3_grammar_advance_stack(vec_rules, stack, stacks); - while (!llama_v3_grammar_is_end_of_sequence(pos)) { - // scan to end of alternate def - pos++; - } - if (pos->type == LLAMA_V3_GRETYPE_ALT) { - // there's another alternate def of this rule to process - pos++; - } else { - break; - } - } while (true); - - return new llama_v3_grammar{ std::move(vec_rules), std::move(stacks), {} }; -} - -void llama_v3_grammar_free(struct llama_v3_grammar * grammar) { - delete grammar; -} - -// -// sampling -// - -void llama_v3_sample_softmax(struct llama_v3_context * ctx, llama_v3_token_data_array * candidates) { - assert(candidates->size > 0); - - const int64_t t_start_sample_us = ggml_time_us(); - - // Sort the logits in descending order - if (!candidates->sorted) { - std::sort(candidates->data, candidates->data + candidates->size, [](const llama_v3_token_data & a, const llama_v3_token_data & b) { - return a.logit > b.logit; - }); - candidates->sorted = true; - } - - float max_l = candidates->data[0].logit; - float cum_sum = 0.0f; - for (size_t i = 0; i < candidates->size; ++i) { - float p = expf(candidates->data[i].logit - max_l); - candidates->data[i].p = p; - cum_sum += p; - } - for (size_t i = 0; i < candidates->size; ++i) { - candidates->data[i].p /= cum_sum; - } - - if (ctx) { - ctx->t_sample_us += ggml_time_us() - t_start_sample_us; - } -} - -void llama_v3_sample_top_k(struct llama_v3_context * ctx, llama_v3_token_data_array * candidates, int k, size_t min_keep) { - const int64_t t_start_sample_us = ggml_time_us(); - - k = std::max(k, (int) min_keep); - k = std::min(k, (int) candidates->size); - - // Sort scores in descending order - if (!candidates->sorted) { - auto comp = [](const llama_v3_token_data & a, const llama_v3_token_data & b) { - return a.logit > b.logit; - }; - if (k == (int) candidates->size) { - std::sort(candidates->data, candidates->data + candidates->size, comp); - } else { - std::partial_sort(candidates->data, candidates->data + k, candidates->data + candidates->size, comp); - } - candidates->sorted = true; - } - candidates->size = k; - - if (ctx) { - ctx->t_sample_us += ggml_time_us() - t_start_sample_us; - } -} - -void llama_v3_sample_top_p(struct llama_v3_context * ctx, llama_v3_token_data_array * candidates, float p, size_t min_keep) { - if (p >= 1.0f) { - return; - } - - llama_v3_sample_softmax(ctx, candidates); - - const int64_t t_start_sample_us = ggml_time_us(); - - // Compute the cumulative probabilities - float cum_sum = 0.0f; - size_t last_idx = candidates->size; - - for (size_t i = 0; i < candidates->size; ++i) { - cum_sum += candidates->data[i].p; - - // Check if the running sum is at least p or if we have kept at least min_keep tokens - // we set the last index to i+1 to indicate that the current iterate should be included in the set - if (cum_sum >= p && i + 1 >= min_keep) { - last_idx = i + 1; - break; - } - } - - // Resize the output vector to keep only the top-p tokens - candidates->size = last_idx; - - if (ctx) { - ctx->t_sample_us += ggml_time_us() - t_start_sample_us; - } -} - -void llama_v3_sample_tail_free(struct llama_v3_context * ctx, llama_v3_token_data_array * candidates, float z, size_t min_keep) { - if (z >= 1.0f || candidates->size <= 2) { - return; - } - - llama_v3_sample_softmax(nullptr, candidates); - const int64_t t_start_sample_us = ggml_time_us(); - - // Compute the first and second derivatives - std::vector first_derivatives(candidates->size - 1); - std::vector second_derivatives(candidates->size - 2); - - for (size_t i = 0; i < first_derivatives.size(); ++i) { - first_derivatives[i] = candidates->data[i].p - candidates->data[i + 1].p; - } - for (size_t i = 0; i < second_derivatives.size(); ++i) { - second_derivatives[i] = first_derivatives[i] - first_derivatives[i + 1]; - } - - // Calculate absolute value of second derivatives - for (size_t i = 0; i < second_derivatives.size(); ++i) { - second_derivatives[i] = abs(second_derivatives[i]); - } - - // Normalize the second derivatives - { - const float second_derivatives_sum = std::accumulate(second_derivatives.begin(), second_derivatives.end(), 0.0f); - - if (second_derivatives_sum > 1e-6f) { - for (float & value : second_derivatives) { - value /= second_derivatives_sum; - } - } else { - for (float & value : second_derivatives) { - value = 1.0f / second_derivatives.size(); - } - } - } - - float cum_sum = 0.0f; - size_t last_idx = candidates->size; - for (size_t i = 0; i < second_derivatives.size(); ++i) { - cum_sum += second_derivatives[i]; - - // Check if the running sum is greater than z or if we have kept at least min_keep tokens - if (cum_sum > z && i >= min_keep) { - last_idx = i; - break; - } - } - - // Resize the output vector to keep only the tokens above the tail location - candidates->size = last_idx; - - if (ctx) { - ctx->t_sample_us += ggml_time_us() - t_start_sample_us; - } -} - - -void llama_v3_sample_typical(struct llama_v3_context * ctx, llama_v3_token_data_array * candidates, float p, size_t min_keep) { - // Reference implementation: - // https://github.com/huggingface/transformers/compare/main...cimeister:typical-sampling:typical-pr - if (p >= 1.0f) { - return; - } - - // Compute the softmax of logits and calculate entropy - llama_v3_sample_softmax(nullptr, candidates); - - const int64_t t_start_sample_us = ggml_time_us(); - - float entropy = 0.0f; - for (size_t i = 0; i < candidates->size; ++i) { - if(candidates->data[i].p>0) - { - entropy += -candidates->data[i].p * logf(candidates->data[i].p); - } - } - - // Compute the absolute difference between negative log probability and entropy for each candidate - std::vector shifted_scores; - for (size_t i = 0; i < candidates->size; ++i) { - float shifted_score = fabsf(-logf(candidates->data[i].p) - entropy); - shifted_scores.push_back(shifted_score); - } - - // Sort tokens based on the shifted_scores and their corresponding indices - std::vector indices(candidates->size); - std::iota(indices.begin(), indices.end(), 0); - - std::sort(indices.begin(), indices.end(), [&](size_t a, size_t b) { - return shifted_scores[a] < shifted_scores[b]; - }); - - // Compute the cumulative probabilities - float cum_sum = 0.0f; - size_t last_idx = indices.size(); - - for (size_t i = 0; i < indices.size(); ++i) { - size_t idx = indices[i]; - cum_sum += candidates->data[idx].p; - - // Check if the running sum is greater than typical or if we have kept at least min_keep tokens - if (cum_sum > p && i >= min_keep - 1) { - last_idx = i + 1; - break; - } - } - - // Resize the output vector to keep only the locally typical tokens - std::vector new_candidates; - for (size_t i = 0; i < last_idx; ++i) { - size_t idx = indices[i]; - new_candidates.push_back(candidates->data[idx]); - } - - // Replace the data in candidates with the new_candidates data - std::copy(new_candidates.begin(), new_candidates.end(), candidates->data); - candidates->size = new_candidates.size(); - - if (ctx) { - ctx->t_sample_us += ggml_time_us() - t_start_sample_us; - } -} - -void llama_v3_sample_temperature(struct llama_v3_context * ctx, llama_v3_token_data_array * candidates_p, float temp) { - const int64_t t_start_sample_us = ggml_time_us(); - - for (size_t i = 0; i < candidates_p->size; ++i) { - candidates_p->data[i].logit /= temp; - } - - if (ctx) { - ctx->t_sample_us += ggml_time_us() - t_start_sample_us; - } -} - -void llama_v3_sample_repetition_penalty(struct llama_v3_context * ctx, llama_v3_token_data_array * candidates, const llama_v3_token * last_tokens, size_t last_tokens_size, float penalty) { - if (last_tokens_size == 0 || penalty == 1.0f) { - return; - } - - const int64_t t_start_sample_us = ggml_time_us(); - - for (size_t i = 0; i < candidates->size; ++i) { - const auto * token_iter = std::find(last_tokens, last_tokens + last_tokens_size, candidates->data[i].id); - if (token_iter == last_tokens + last_tokens_size) { - continue; - } - - // The academic publication that described this technique actually just only divided, but that would cause tokens with negative logits to become more likely, which is obviously wrong. - // This is common fix for this problem, which is to multiply by the penalty instead of dividing. - if (candidates->data[i].logit <= 0) { - candidates->data[i].logit *= penalty; - } else { - candidates->data[i].logit /= penalty; - } - } - - candidates->sorted = false; - - if (ctx) { - ctx->t_sample_us += ggml_time_us() - t_start_sample_us; - } -} - -void llama_v3_sample_frequency_and_presence_penalties(struct llama_v3_context * ctx, llama_v3_token_data_array * candidates, const llama_v3_token * last_tokens_p, size_t last_tokens_size, float alpha_frequency, float alpha_presence) { - if (last_tokens_size == 0 || (alpha_frequency == 0.0f && alpha_presence == 0.0f)) { - return; - } - - const int64_t t_start_sample_us = ggml_time_us(); - - // Create a frequency map to count occurrences of each token in last_tokens - std::unordered_map token_count; - for (size_t i = 0; i < last_tokens_size; ++i) { - token_count[last_tokens_p[i]]++; - } - - // Apply frequency and presence penalties to the candidates - for (size_t i = 0; i < candidates->size; ++i) { - auto token_iter = token_count.find(candidates->data[i].id); - if (token_iter == token_count.end()) { - continue; - } - - int count = token_iter->second; - candidates->data[i].logit -= float(count) * alpha_frequency + float(count > 0) * alpha_presence; - } - - candidates->sorted = false; - - if (ctx) { - ctx->t_sample_us += ggml_time_us() - t_start_sample_us; - } -} - -void llama_v3_sample_grammar(struct llama_v3_context * ctx, llama_v3_token_data_array * candidates, const struct llama_v3_grammar * grammar) { - assert(ctx); - const int64_t t_start_sample_us = ggml_time_us(); - - bool allow_eos = false; - for (const auto & stack : grammar->stacks) { - if (stack.empty()) { - allow_eos = true; - break; - } - } - - const llama_v3_token eos = llama_v3_token_eos(); - - std::vector, llama_v3_partial_utf8>> candidates_decoded; - std::vector candidates_grammar; - - for (size_t i = 0; i < candidates->size; ++i) { - const llama_v3_token id = candidates->data[i].id; - const char * str = llama_v3_token_to_str(ctx, id); - if (id == eos) { - if (!allow_eos) { - candidates->data[i].logit = -INFINITY; - } - } else if (*str == 0) { - candidates->data[i].logit = -INFINITY; - } else { - candidates_decoded.push_back(decode_utf8(str, grammar->partial_utf8)); - candidates_grammar.push_back({ - i, candidates_decoded.back().first.data(), candidates_decoded.back().second - }); - } - } - - const auto rejects = - llama_v3_grammar_reject_candidates(grammar->rules, grammar->stacks, candidates_grammar); - for (auto & reject : rejects) { - candidates->data[reject.index].logit = -INFINITY; - } - - ctx->t_sample_us += ggml_time_us() - t_start_sample_us; -} - -static void llama_v3_log_softmax(float * array, size_t size) { - float max_l = *std::max_element(array, array + size); - float sum = 0.f; - for (size_t i = 0; i < size; ++i) { - float p = expf(array[i] - max_l); - sum += p; - array[i] = p; - } - - for (size_t i = 0; i < size; ++i) { - array[i] = logf(array[i] / sum); - } -} - -void llama_v3_sample_classifier_free_guidance( - struct llama_v3_context * ctx, - llama_v3_token_data_array * candidates, - struct llama_v3_context * guidance_ctx, - float scale) { - int64_t t_start_sample_us = ggml_time_us(); - - assert(ctx); - auto n_vocab = llama_v3_n_vocab(ctx); - assert(n_vocab == (int)candidates->size); - assert(!candidates->sorted); - - std::vector logits_base; - logits_base.reserve(candidates->size); - for (size_t i = 0; i < candidates->size; ++i) { - logits_base.push_back(candidates->data[i].logit); - } - llama_v3_log_softmax(logits_base.data(), candidates->size); - - float* logits_guidance = llama_v3_get_logits(guidance_ctx); - llama_v3_log_softmax(logits_guidance, n_vocab); - - for (int i = 0; i < n_vocab; ++i) { - float logit_guidance = logits_guidance[i]; - float logit_base = logits_base[i]; - candidates->data[i].logit = scale * (logit_base - logit_guidance) + logit_guidance; - } - - if (ctx) { - ctx->t_sample_us += ggml_time_us() - t_start_sample_us; - } -} - -llama_v3_token llama_v3_sample_token_mirostat(struct llama_v3_context * ctx, llama_v3_token_data_array * candidates, float tau, float eta, int m, float * mu) { - assert(ctx); - auto N = float(llama_v3_n_vocab(ctx)); - int64_t t_start_sample_us; - t_start_sample_us = ggml_time_us(); - - llama_v3_sample_softmax(nullptr, candidates); - - // Estimate s_hat using the most probable m tokens - float s_hat = 0.0; - float sum_ti_bi = 0.0; - float sum_ti_sq = 0.0; - for (size_t i = 0; i < size_t(m - 1) && i < candidates->size - 1; ++i) { - float t_i = logf(float(i + 2) / float(i + 1)); - float b_i = logf(candidates->data[i].p / candidates->data[i + 1].p); - sum_ti_bi += t_i * b_i; - sum_ti_sq += t_i * t_i; - } - s_hat = sum_ti_bi / sum_ti_sq; - - // Compute k from the estimated s_hat and target surprise value - float epsilon_hat = s_hat - 1; - float k = powf((epsilon_hat * powf(2, *mu)) / (1 - powf(N, -epsilon_hat)), 1 / s_hat); - - // Sample the next word X using top-k sampling - llama_v3_sample_top_k(nullptr, candidates, int(k), 1); - if (ctx) { - ctx->t_sample_us += ggml_time_us() - t_start_sample_us; - } - llama_v3_token X = llama_v3_sample_token(ctx, candidates); - t_start_sample_us = ggml_time_us(); - - // Compute error as the difference between observed surprise and target surprise value - size_t X_idx = std::distance(candidates->data, std::find_if(candidates->data, candidates->data + candidates->size, [&](const llama_v3_token_data & candidate) { - return candidate.id == X; - })); - float observed_surprise = -log2f(candidates->data[X_idx].p); - float e = observed_surprise - tau; - - // Update mu using the learning rate and error - *mu = *mu - eta * e; - - if (ctx) { - ctx->t_sample_us += ggml_time_us() - t_start_sample_us; - } - return X; -} - -llama_v3_token llama_v3_sample_token_mirostat_v2(struct llama_v3_context * ctx, llama_v3_token_data_array * candidates, float tau, float eta, float * mu) { - int64_t t_start_sample_us; - t_start_sample_us = ggml_time_us(); - - llama_v3_sample_softmax(ctx, candidates); - - // Truncate the words with surprise values greater than mu - candidates->size = std::distance(candidates->data, std::find_if(candidates->data, candidates->data + candidates->size, [&](const llama_v3_token_data & candidate) { - return -log2f(candidate.p) > *mu; - })); - - if (candidates->size == 0) { - candidates->size = 1; - } - - if (ctx) { - ctx->t_sample_us += ggml_time_us() - t_start_sample_us; - } - - // Normalize the probabilities of the remaining words - llama_v3_sample_softmax(ctx, candidates); - - // Sample the next word X from the remaining words - llama_v3_token X = llama_v3_sample_token(ctx, candidates); - t_start_sample_us = ggml_time_us(); - - // Compute error as the difference between observed surprise and target surprise value - size_t X_idx = std::distance(candidates->data, std::find_if(candidates->data, candidates->data + candidates->size, [&](const llama_v3_token_data & candidate) { - return candidate.id == X; - })); - float observed_surprise = -log2f(candidates->data[X_idx].p); - float e = observed_surprise - tau; - - // Update mu using the learning rate and error - *mu = *mu - eta * e; - - if (ctx) { - ctx->t_sample_us += ggml_time_us() - t_start_sample_us; - } - return X; -} - -llama_v3_token llama_v3_sample_token_greedy(struct llama_v3_context * ctx, llama_v3_token_data_array * candidates) { - const int64_t t_start_sample_us = ggml_time_us(); - - // Find max element - auto * max_iter = std::max_element(candidates->data, candidates->data + candidates->size, [](const llama_v3_token_data & a, const llama_v3_token_data & b) { - return a.logit < b.logit; - }); - - llama_v3_token result = max_iter->id; - if (ctx) { - ctx->t_sample_us += ggml_time_us() - t_start_sample_us; - ctx->n_sample++; - } - return result; -} - -llama_v3_token llama_v3_sample_token(struct llama_v3_context * ctx, llama_v3_token_data_array * candidates) { - assert(ctx); - const int64_t t_start_sample_us = ggml_time_us(); - llama_v3_sample_softmax(nullptr, candidates); - - std::vector probs; - probs.reserve(candidates->size); - for (size_t i = 0; i < candidates->size; ++i) { - probs.push_back(candidates->data[i].p); - } - - std::discrete_distribution<> dist(probs.begin(), probs.end()); - auto & rng = ctx->rng; - int idx = dist(rng); - - llama_v3_token result = candidates->data[idx].id; - - ctx->t_sample_us += ggml_time_us() - t_start_sample_us; - ctx->n_sample++; - return result; -} - -void llama_v3_grammar_accept_token(struct llama_v3_context * ctx, struct llama_v3_grammar * grammar, llama_v3_token token) { - const int64_t t_start_sample_us = ggml_time_us(); - - if (token == llama_v3_token_eos()) { - for (const auto & stack : grammar->stacks) { - if (stack.empty()) { - return; - } - } - LLAMA_V3_ASSERT(false); - } - - const char * str = llama_v3_token_to_str(ctx, token); - - // Note terminating 0 in decoded string - const auto decoded = decode_utf8(str, grammar->partial_utf8); - const auto & code_points = decoded.first; - for (auto it = code_points.begin(), end = code_points.end() - 1; it != end; ++it) { - grammar->stacks = llama_v3_grammar_accept(grammar->rules, grammar->stacks, *it); - } - grammar->partial_utf8 = decoded.second; - LLAMA_V3_ASSERT(!grammar->stacks.empty()); - - ctx->t_sample_us += ggml_time_us() - t_start_sample_us; -} - -// -// quantization -// - -static void llama_v3_convert_tensor_internal(const llama_v3_load_tensor & tensor, llama_v3_buffer & output, const int nelements, const int nthread) { - if (output.size < nelements * sizeof(float)) { - output.resize(nelements * sizeof(float)); - } - float * f32_output = (float *) output.addr; - - ggml_type_traits_t qtype; - if (ggml_is_quantized(tensor.type)) { - qtype = ggml_internal_get_type_traits(tensor.type); - if (qtype.to_float == NULL) { - throw std::runtime_error(format_old("type %s unsupported for integer quantization: no dequantization available", ggml_type_name(tensor.type))); - } - } else if (tensor.type != GGML_TYPE_F16) { - throw std::runtime_error(format_old("cannot dequantize/convert tensor type %s", ggml_type_name(tensor.type))); - } - - if (nthread < 2) { - if (tensor.type == GGML_TYPE_F16) { - ggml_fp16_to_fp32_row((ggml_fp16_t *)tensor.data, f32_output, nelements); - } else if (ggml_is_quantized(tensor.type)) { - qtype.to_float(tensor.data, f32_output, nelements); - } else { - LLAMA_V3_ASSERT(false); // unreachable - } - return; - } - - auto block_size = tensor.type == GGML_TYPE_F16 ? 1 : (size_t)ggml_blck_size(tensor.type); - auto block_size_bytes = ggml_type_size(tensor.type); - - LLAMA_V3_ASSERT(nelements % block_size == 0); - auto nblocks = nelements / block_size; - auto blocks_per_thread = nblocks / nthread; - auto spare_blocks = nblocks - (blocks_per_thread * nthread); // if blocks aren't divisible by thread count - - std::vector workers; - for (auto tnum = 0, in_buff_offs = 0, out_buff_offs = 0; tnum < nthread; tnum++) { - auto thr_blocks = blocks_per_thread + (tnum == nthread - 1 ? spare_blocks : 0); // num blocks for this thread - auto thr_elems = thr_blocks * block_size; // number of elements for this thread - auto thr_block_bytes = thr_blocks * block_size_bytes; // number of input bytes for this thread - - auto compute = [qtype] (ggml_type typ, uint8_t * inbuf, float * outbuf, int nels) { - if (typ == GGML_TYPE_F16) { - ggml_fp16_to_fp32_row((ggml_fp16_t *)inbuf, outbuf, nels); - } else { - qtype.to_float(inbuf, outbuf, nels); - } - }; - workers.push_back(std::thread(compute, tensor.type, tensor.data + in_buff_offs, f32_output + out_buff_offs, thr_elems)); - in_buff_offs += thr_block_bytes; - out_buff_offs += thr_elems; - } - for (auto & worker : workers) { - worker.join(); - } - -} - -static void llama_v3_model_quantize_internal(const std::string & fname_inp, const std::string & fname_out, const llama_v3_model_quantize_params * params) { - ggml_type quantized_type; - llama_v3_ftype ftype = params->ftype; - int nthread = params->nthread; - - switch (params->ftype) { - case LLAMA_V3_FTYPE_MOSTLY_Q4_0: quantized_type = GGML_TYPE_Q4_0; break; - case LLAMA_V3_FTYPE_MOSTLY_Q4_1: quantized_type = GGML_TYPE_Q4_1; break; - case LLAMA_V3_FTYPE_MOSTLY_Q5_0: quantized_type = GGML_TYPE_Q5_0; break; - case LLAMA_V3_FTYPE_MOSTLY_Q5_1: quantized_type = GGML_TYPE_Q5_1; break; - case LLAMA_V3_FTYPE_MOSTLY_Q8_0: quantized_type = GGML_TYPE_Q8_0; break; - case LLAMA_V3_FTYPE_MOSTLY_F16: quantized_type = GGML_TYPE_F16; break; - case LLAMA_V3_FTYPE_ALL_F32: quantized_type = GGML_TYPE_F32; break; - -#ifdef GGML_USE_K_QUANTS - // K-quants - case LLAMA_V3_FTYPE_MOSTLY_Q2_K: quantized_type = GGML_TYPE_Q2_K; break; - case LLAMA_V3_FTYPE_MOSTLY_Q3_K_S: - case LLAMA_V3_FTYPE_MOSTLY_Q3_K_M: - case LLAMA_V3_FTYPE_MOSTLY_Q3_K_L: quantized_type = GGML_TYPE_Q3_K; break; - case LLAMA_V3_FTYPE_MOSTLY_Q4_K_S: - case LLAMA_V3_FTYPE_MOSTLY_Q4_K_M: quantized_type = GGML_TYPE_Q4_K; break; - case LLAMA_V3_FTYPE_MOSTLY_Q5_K_S: - case LLAMA_V3_FTYPE_MOSTLY_Q5_K_M: quantized_type = GGML_TYPE_Q5_K; break; - case LLAMA_V3_FTYPE_MOSTLY_Q6_K: quantized_type = GGML_TYPE_Q6_K; break; -#endif - default: throw std::runtime_error(format_old("invalid output file type %d\n", ftype)); - } - - if (nthread <= 0) { - nthread = std::thread::hardware_concurrency(); - } - - std::unique_ptr model_loader(new llama_v3_model_loader(fname_inp, /*use_mmap*/ false)); - llama_v3_file_saver file_saver(fname_out.c_str(), model_loader->file_loader.get(), params->ftype); - -#ifdef GGML_USE_K_QUANTS - int n_attention_wv = 0; - int n_feed_forward_w2 = 0; - for (auto& tensor : model_loader->tensors_map.tensors) { - if (tensor.name.find("attention.wv.weight") != std::string::npos) { - ++n_attention_wv; - } - else if (tensor.name.find("feed_forward.w2.weight") != std::string::npos) { - ++n_feed_forward_w2; - } - } - - int i_attention_wv = 0; - int i_feed_forward_w2 = 0; -#endif - - size_t total_size_org = 0; - size_t total_size_new = 0; - std::vector hist_all(1 << 4, 0); - - std::vector workers; - std::mutex mutex; - - auto use_more_bits = [] (int i_layer, int num_layers) -> bool { - return i_layer < num_layers/8 || i_layer >= 7*num_layers/8 || (i_layer - num_layers/8)%3 == 2; - }; - - size_t idx = 0; - for (llama_v3_load_tensor & tensor : model_loader->tensors_map.tensors) { - llama_v3_buffer read_data; - read_data.resize(tensor.size); - tensor.data = read_data.addr; - model_loader->load_data_for(tensor); - - LLAMA_V3_LOG_INFO("[%4zu/%4zu] %36s - %16s, type = %6s, ", - ++idx, model_loader->tensors_map.tensors.size(), - tensor.name.c_str(), llama_v3_format_tensor_shape(tensor.ne).c_str(), - ggml_type_name(tensor.type)); - - // This used to be a regex, but has an extreme cost to compile times. - bool quantize = tensor.name.rfind("weight") == tensor.name.size() - 6; // ends with 'weight'? - - // quantize only 2D tensors - quantize &= (tensor.ne.size() == 2); - quantize &= params->quantize_output_tensor || tensor.name != "output.weight"; - quantize &= quantized_type != tensor.type; - - enum ggml_type new_type; - void * new_data; - size_t new_size; - llama_v3_buffer work; - - if (!quantize) { - new_type = tensor.type; - new_data = tensor.data; - new_size = tensor.size; - LLAMA_V3_LOG_INFO("size = %8.3f MB\n", tensor.size/1024.0/1024.0); - } else { - new_type = quantized_type; -#ifdef GGML_USE_K_QUANTS - if (tensor.name == "output.weight") { - int nx = tensor.ne.at(0); - int ny = tensor.ne.at(1); - if (nx % QK_K == 0 && ny % QK_K == 0) { - new_type = GGML_TYPE_Q6_K; - } - } else if (tensor.name.find("attention.wv.weight") != std::string::npos) { - if (ftype == LLAMA_V3_FTYPE_MOSTLY_Q3_K_M || ftype == LLAMA_V3_FTYPE_MOSTLY_Q2_K) new_type = GGML_TYPE_Q4_K; - else if (ftype == LLAMA_V3_FTYPE_MOSTLY_Q3_K_L) new_type = GGML_TYPE_Q5_K; - else if ((ftype == LLAMA_V3_FTYPE_MOSTLY_Q4_K_M || ftype == LLAMA_V3_FTYPE_MOSTLY_Q5_K_M) && - use_more_bits(i_attention_wv, n_attention_wv)) new_type = GGML_TYPE_Q6_K; - else if (QK_K == 64 && (ftype == LLAMA_V3_FTYPE_MOSTLY_Q4_K_S || ftype == LLAMA_V3_FTYPE_MOSTLY_Q3_K_S) && - (i_attention_wv < n_attention_wv/8 || i_attention_wv >= 7*n_attention_wv/8)) new_type = GGML_TYPE_Q6_K; - ++i_attention_wv; - } else if (tensor.name.find("feed_forward.w2.weight") != std::string::npos) { - if (ftype == LLAMA_V3_FTYPE_MOSTLY_Q3_K_M || ftype == LLAMA_V3_FTYPE_MOSTLY_Q2_K) new_type = GGML_TYPE_Q4_K; - else if (ftype == LLAMA_V3_FTYPE_MOSTLY_Q3_K_L) new_type = GGML_TYPE_Q5_K; - else if ((ftype == LLAMA_V3_FTYPE_MOSTLY_Q4_K_M || ftype == LLAMA_V3_FTYPE_MOSTLY_Q5_K_M) && - use_more_bits(i_feed_forward_w2, n_feed_forward_w2)) new_type = GGML_TYPE_Q6_K; - //else if (ftype == LLAMA_V3_FTYPE_MOSTLY_Q4_K_S && i_feed_forward_w2 < n_feed_forward_w2/8) new_type = GGML_TYPE_Q6_K; - ++i_feed_forward_w2; - } else if (tensor.name.find("attention.wo.weight") != std::string::npos) { - if (ftype == LLAMA_V3_FTYPE_MOSTLY_Q3_K_M || ftype == LLAMA_V3_FTYPE_MOSTLY_Q2_K) new_type = GGML_TYPE_Q4_K; - else if (ftype == LLAMA_V3_FTYPE_MOSTLY_Q3_K_L) new_type = GGML_TYPE_Q5_K; - } - bool convert_incompatible_tensor = false; - if (new_type == GGML_TYPE_Q2_K || new_type == GGML_TYPE_Q3_K || new_type == GGML_TYPE_Q4_K || - new_type == GGML_TYPE_Q5_K || new_type == GGML_TYPE_Q6_K) { - int nx = tensor.ne.at(0); - int ny = tensor.ne.at(1); - if (nx % QK_K != 0 || ny % QK_K != 0) { - LLAMA_V3_LOG_INFO("\n\nTensor sizes %d x %d are not divisible by %d, required for k-quants.\n",nx,ny,QK_K); - convert_incompatible_tensor = true; - } - } - if (convert_incompatible_tensor) { - if (tensor.name == "output.weight") { - new_type = GGML_TYPE_F16; //fall back to F16 instead of just failing. - LLAMA_V3_LOG_WARN("F16 will be used for this tensor instead.\n"); - } else if (tensor.name == "tok_embeddings.weight") { - new_type = GGML_TYPE_Q4_0; //fall back to Q4_0 instead of just failing. - LLAMA_V3_LOG_WARN("Q4_0 will be used for this tensor instead.\n"); - } else { - throw std::runtime_error("Unsupported tensor size encountered\n"); - } - } -#endif - - float * f32_data; - size_t nelements = tensor.ne.at(0) * tensor.ne.at(1); - llama_v3_buffer f32_conv_buf; - - if (tensor.type == GGML_TYPE_F32) { - f32_data = (float *) tensor.data; - } else if (ggml_is_quantized(tensor.type) && !params->allow_requantize) { - throw std::runtime_error(format_old("requantizing from type %s is disabled", ggml_type_name(tensor.type))); - } else { - llama_v3_convert_tensor_internal(tensor, f32_conv_buf, nelements, nthread); - f32_data = (float *) f32_conv_buf.addr; - } - - LLAMA_V3_LOG_INFO("quantizing to %s .. ", ggml_type_name(new_type)); - fflush(stdout); - - work.resize(nelements * 4); // upper bound on size - new_data = work.addr; - std::vector hist_cur(1 << 4, 0); - - int chunk_size = 32 * 512; - const int nchunk = (nelements + chunk_size - 1)/chunk_size; - const int nthread_use = nthread > 1 ? std::max(1, std::min(nthread, nchunk)) : 1; - if (nthread_use < 2) { - new_size = ggml_quantize_chunk(new_type, f32_data, new_data, 0, nelements, hist_cur.data()); - } else { - size_t counter = 0; - new_size = 0; - auto compute = [&mutex, &counter, &hist_cur, &new_size, new_type, f32_data, new_data, nelements, chunk_size] () { - std::vector local_hist; - size_t local_size = 0; - while (true) { - std::unique_lock lock(mutex); - size_t first = counter; counter += chunk_size; - if (first >= nelements) { - if (!local_hist.empty()) { - for (int j=0; j %8.2f MB | hist: ", tensor.size/1024.0/1024.0, new_size/1024.0/1024.0); - int64_t tot_count = 0; - for (size_t i = 0; i < hist_cur.size(); i++) { - hist_all[i] += hist_cur[i]; - tot_count += hist_cur[i]; - } - - if (tot_count > 0) { - for (size_t i = 0; i < hist_cur.size(); i++) { - LLAMA_V3_LOG_INFO("%5.3f ", hist_cur[i] / float(nelements)); - } - } - LLAMA_V3_LOG_INFO("\n"); - } - total_size_org += tensor.size; - total_size_new += new_size; - file_saver.write_tensor(tensor, new_type, new_data, new_size); - } - - LLAMA_V3_LOG_INFO("%s: model size = %8.2f MB\n", __func__, total_size_org/1024.0/1024.0); - LLAMA_V3_LOG_INFO("%s: quant size = %8.2f MB\n", __func__, total_size_new/1024.0/1024.0); - - { - int64_t sum_all = 0; - for (size_t i = 0; i < hist_all.size(); i++) { - sum_all += hist_all[i]; - } - - if (sum_all > 0) { - LLAMA_V3_LOG_INFO("%s: hist: ", __func__); - for (size_t i = 0; i < hist_all.size(); i++) { - LLAMA_V3_LOG_INFO("%5.3f ", hist_all[i] / float(sum_all)); - } - LLAMA_V3_LOG_INFO("\n"); - } - } -} - - - -// -// interface implementation -// - -struct llama_v3_model * llama_v3_load_model_from_file( - const char * path_model, - struct llama_v3_context_params params) { - ggml_time_init(); - - llama_v3_model * model = new llama_v3_model; - - ggml_type memory_type = params.f16_kv ? GGML_TYPE_F16 : GGML_TYPE_F32; - - if (!llama_v3_model_load(path_model, *model, model->vocab, params.n_ctx, params.n_batch, params.n_gqa, params.rms_norm_eps, params.n_gpu_layers, - params.main_gpu, params.tensor_split, params.mul_mat_q, params.rope_freq_base, params.rope_freq_scale,params.low_vram, - memory_type, params.use_mmap, params.use_mlock, params.vocab_only, params.progress_callback, - params.progress_callback_user_data)) { - LLAMA_V3_LOG_ERROR("%s: failed to load model\n", __func__); - delete model; - return nullptr; - } - - return model; -} - -void llama_v3_free_model(struct llama_v3_model * model) { - delete model; -} - -struct llama_v3_context * llama_v3_new_context_with_model( - struct llama_v3_model * model, - struct llama_v3_context_params params) { - - if (!model) { - return nullptr; - } - - llama_v3_context * ctx = new llama_v3_context(*model); - - if (params.seed == LLAMA_V3_DEFAULT_SEED) { - params.seed = time(NULL); - } - - size_t blasbatchmul = get_blas_batch_mul3(params.n_batch); - - unsigned cur_percentage = 0; - if (params.progress_callback == NULL) { - params.progress_callback_user_data = &cur_percentage; - params.progress_callback = [](float progress, void * ctx) { - unsigned * cur_percentage_p = (unsigned *) ctx; - unsigned percentage = (unsigned) (100 * progress); - while (percentage > *cur_percentage_p) { - *cur_percentage_p = percentage; - LLAMA_V3_LOG_INFO("."); - if (percentage >= 100) { - LLAMA_V3_LOG_INFO("\n"); - } - } - }; - } - - ctx->rng = std::mt19937(params.seed); - ctx->logits_all = params.logits_all; - - ggml_type memory_type = params.f16_kv ? GGML_TYPE_F16 : GGML_TYPE_F32; - - // reserve memory for context buffers - if (!params.vocab_only) { - if (!kv_cache_init(ctx->model.hparams, ctx->kv_self, memory_type, ctx->model.hparams.n_ctx, params.n_gpu_layers)) { - LLAMA_V3_LOG_ERROR("%s: kv_cache_init() failed for self-attention cache\n", __func__); - llama_v3_free(ctx); - return nullptr; - } - - { - const size_t memory_size = ggml_nbytes(ctx->kv_self.k) + ggml_nbytes(ctx->kv_self.v); - LLAMA_V3_LOG_INFO("%s: kv self size = %7.2f MB\n", __func__, memory_size / 1024.0 / 1024.0); - } - - const auto & hparams = ctx->model.hparams; - - // resized during inference - if (params.logits_all) { - ctx->logits.reserve(hparams.n_ctx*hparams.n_vocab); - } else { - ctx->logits.reserve(hparams.n_vocab); - } - - if (params.embedding){ - ctx->embedding.resize(hparams.n_embd); - } - -#ifdef LLAMA_V3_USE_ALLOCATOR - { - static const size_t tensor_alignment = 32; - // the compute buffer is used to store the tensor and graph structs, while the allocator buffer is used for the tensor data - ctx->buf_compute.resize(ggml_tensor_overhead()*GGML_MAX_NODES + ggml_graph_overhead()); - - // create measure allocator - ctx->alloc = ggml_allocr_new_measure(tensor_alignment); - - // build worst-case graph - int n_tokens = std::min((int)hparams.n_ctx, params.n_batch); - int n_past = hparams.n_ctx - n_tokens; - llama_v3_token token = llama_v3_token_bos(); // not actually used by llama_v3_build_graph, but required to choose between token and embedding inputs graph - ggml_cgraph * gf = llama_v3_build_graph(*ctx, &token, NULL, n_tokens, n_past); -#ifdef GGML_USE_METAL - if (params.n_gpu_layers > 0) { - ctx->ctx_metal = ggml_metal_init(1); - if (!ctx->ctx_metal) { - LLAMA_V3_LOG_ERROR("%s: ggml_metal_init() failed\n", __func__); - llama_v3_free(ctx); - return NULL; - } - ggml_metal_graph_find_concurrency(ctx->ctx_metal, gf, false); - ggml_allocr_set_parse_seq(ctx->alloc, ggml_metal_get_concur_list(ctx->ctx_metal), ggml_metal_if_optimized(ctx->ctx_metal)); - } -#endif - // measure memory requirements for the graph - size_t alloc_size = ggml_allocr_alloc_graph(ctx->alloc, gf) + tensor_alignment; - - LLAMA_V3_LOG_INFO("%s: compute buffer total size = %7.2f MB\n", __func__, (ctx->buf_compute.size + alloc_size) / 1024.0 / 1024.0); - - // debug - for comparison with scratch buffer - //size_t prev_req = - // MEM_REQ_SCRATCH0_3(hparams.n_ctx).at(ctx->model.type) + - // MEM_REQ_SCRATCH1_3().at(ctx->model.type) + - // MEM_REQ_EVAL_3().at(ctx->model.type); - //LLAMA_V3_LOG_INFO("%s: (debug) equivalent with scratch buffer = %7.2f MB\n", __func__, prev_req / 1024.0 / 1024.0); - - // recreate allocator with exact memory requirements - ggml_allocr_free(ctx->alloc); - - ctx->buf_alloc.resize(alloc_size); - ctx->alloc = ggml_allocr_new(ctx->buf_alloc.addr, ctx->buf_alloc.size, tensor_alignment); -#ifdef GGML_USE_METAL - if (ctx->ctx_metal) { - ggml_allocr_set_parse_seq(ctx->alloc, ggml_metal_get_concur_list(ctx->ctx_metal), ggml_metal_if_optimized(ctx->ctx_metal)); - } -#endif - } -#else - ctx->buf_compute.resize(blasbatchmul*MEM_REQ_EVAL_3().at(ctx->model.type) + ggml_graph_overhead()); -#endif - -#ifdef LLAMA_V3_USE_SCRATCH - ctx->buf_scratch[0].resize(blasbatchmul*MEM_REQ_SCRATCH0_3(hparams.n_ctx).at(ctx->model.type)); - ctx->buf_scratch[1].resize(blasbatchmul*MEM_REQ_SCRATCH1_3().at(ctx->model.type)); -#endif - } - -#ifdef GGML_USE_METAL - if (params.n_gpu_layers > 0) { - // this allocates all Metal resources and memory buffers - - void * data_ptr = NULL; - size_t data_size = 0; - - if (params.use_mmap) { - data_ptr = ctx->model.mapping->addr; - data_size = ctx->model.mapping->size; - } else { - data_ptr = ggml_get_mem_buffer(ctx->model.ctx); - data_size = ggml_get_mem_size (ctx->model.ctx); - } - - const size_t max_size = ggml_get_max_tensor_size(ctx->model.ctx); - - LLAMA_V3_LOG_INFO("%s: max tensor size = %8.2f MB\n", __func__, max_size/1024.0/1024.0); - -#define LLAMA_V3_METAL_CHECK_BUF(result) \ - if (!(result)) { \ - LLAMA_V3_LOG_ERROR("%s: failed to add buffer\n", __func__); \ - llama_v3_free(ctx); \ - return NULL; \ - } - - LLAMA_V3_METAL_CHECK_BUF(ggml_metal_add_buffer(ctx->ctx_metal, "data", data_ptr, data_size, max_size)); - - LLAMA_V3_METAL_CHECK_BUF(ggml_metal_add_buffer(ctx->ctx_metal, "eval", ctx->buf_compute.addr, ctx->buf_compute.size, 0)); - LLAMA_V3_METAL_CHECK_BUF(ggml_metal_add_buffer(ctx->ctx_metal, "kv", ctx->kv_self.buf.addr, ctx->kv_self.buf.size, 0)); - - LLAMA_V3_METAL_CHECK_BUF(ggml_metal_add_buffer(ctx->ctx_metal, "alloc", ctx->buf_alloc.addr, ctx->buf_alloc.size, 0)); -#undef LLAMA_V3_METAL_CHECK_BUF - } -#endif - -#ifdef GGML_USE_MPI - ctx->ctx_mpi = ggml_mpi_init(); - - if (ggml_mpi_rank(ctx->ctx_mpi) > 0) { - // Enter a blocking eval loop with dummy input, letting rank=0 drive the process - const std::vector tmp(ctx->model.hparams.n_ctx, llama_v3_token_bos()); - while (!llama_v3_eval(ctx, tmp.data(), tmp.size(), 0, 0)) {}; - llama_v3_backend_free(); - exit(1); - } -#endif - - return ctx; -} - -struct llama_v3_context * llama_v3_init_from_file( - const char * path_model, - struct llama_v3_context_params params) { - - struct llama_v3_model * model = llama_v3_load_model_from_file(path_model, params); - if (!model) { - return nullptr; - } - struct llama_v3_context * ctx = llama_v3_new_context_with_model(model, params); - ctx->model_owner = true; - return ctx; -} - -void llama_v3_free(struct llama_v3_context * ctx) { - delete ctx; -} - -int llama_v3_model_quantize( - const char * fname_inp, - const char * fname_out, - const llama_v3_model_quantize_params *params) { - try { - llama_v3_model_quantize_internal(fname_inp, fname_out, params); - return 0; - } catch (const std::exception & err) { - LLAMA_V3_LOG_ERROR("%s: failed to quantize: %s\n", __func__, err.what()); - return 1; - } -} - -int llama_v3_apply_lora_from_file_internal(const struct llama_v3_model & model, const char * path_lora, const char * path_base_model, int n_threads) { - LLAMA_V3_LOG_INFO("%s: applying lora adapter from '%s' - please wait ...\n", __func__, path_lora); - - const int64_t t_start_lora_us = ggml_time_us(); - - auto fin = std::ifstream(path_lora, std::ios::binary); - if (!fin) { - LLAMA_V3_LOG_ERROR("%s: failed to open '%s'\n", __func__, path_lora); - return 1; - } - - // verify magic and version - { - uint32_t magic; - fin.read((char *) &magic, sizeof(magic)); - if (magic != LLAMA_V3_FILE_MAGIC_GGLA) { - LLAMA_V3_LOG_ERROR("%s: bad file magic\n", __func__); - return 1; - } - uint32_t format_version; - fin.read((char *) &format_version, sizeof(format_version)); - - if (format_version != 1) { - LLAMA_V3_LOG_ERROR("%s: unsupported file version\n", __func__ ); - return 1; - } - } - - int32_t lora_r; - int32_t lora_alpha; - fin.read((char *) &lora_r, sizeof(lora_r)); - fin.read((char *) &lora_alpha, sizeof(lora_alpha)); - float scaling = (float)lora_alpha / (float)lora_r; - - LLAMA_V3_LOG_INFO("%s: r = %d, alpha = %d, scaling = %.2f\n", __func__, lora_r, lora_alpha, scaling); - - - // create a temporary ggml context to store the lora tensors - // todo: calculate size from biggest possible tensor - std::vector lora_buf(1024ull * 1024ull * 1024ull); - struct ggml_init_params params; - params.mem_size = lora_buf.size(); - params.mem_buffer = lora_buf.data(); - params.no_alloc = false; - - ggml_context * lora_ctx = ggml_init(params); - std::unordered_map lora_tensors; - - // create a name -> tensor map of the model to accelerate lookups - std::unordered_map model_tensors; - for (const auto & kv: model.tensors_by_name) { - model_tensors.insert(kv); - } - - - // load base model - std::unique_ptr model_loader; - ggml_context * base_ctx = NULL; - llama_v3_buffer base_buf; - if (path_base_model) { - LLAMA_V3_LOG_INFO("%s: loading base model from '%s'\n", __func__, path_base_model); - model_loader.reset(new llama_v3_model_loader(path_base_model, /*use_mmap*/ true)); - - size_t ctx_size; - size_t mmapped_size; - model_loader->calc_sizes(&ctx_size, &mmapped_size); - base_buf.resize(ctx_size); - - ggml_init_params base_params; - base_params.mem_size = base_buf.size; - base_params.mem_buffer = base_buf.addr; - base_params.no_alloc = model_loader->use_mmap; - - base_ctx = ggml_init(base_params); - - model_loader->ggml_ctx = base_ctx; - - // maybe this should in llama_v3_model_loader - if (model_loader->use_mmap) { - model_loader->mapping.reset(new llama_v3_mmap(&model_loader->file_loader->file, /* prefetch */ 0, ggml_is_numa())); - } - } - - // read tensors and apply - bool warned = false; - int n_tensors = 0; - - std::vector work_buffer; - - while (true) { - int32_t n_dims; - int32_t length; - int32_t ftype; - - fin.read(reinterpret_cast(&n_dims), sizeof(n_dims)); - fin.read(reinterpret_cast(&length), sizeof(length)); - fin.read(reinterpret_cast(&ftype), sizeof(ftype)); - if (fin.eof()) { - break; - } - - int32_t ne[2] = { 1, 1 }; - for (int i = 0; i < n_dims; ++i) { - fin.read(reinterpret_cast(&ne[i]), sizeof(ne[i])); - } - - std::string name; - { - char buf[1024]; - fin.read(buf, length); - name = std::string(buf, length); - } - - // check for lora suffix and get the type of tensor - const std::string lora_suffix = ".lora"; - size_t pos = name.rfind(lora_suffix); - if (pos == std::string::npos) { - LLAMA_V3_LOG_ERROR("%s: error: '%s' is not a lora tensor\n", __func__, name.c_str()); - return 1; - } - - std::string lora_type = name.substr(pos + lora_suffix.length()); - std::string base_name = name; - base_name.erase(pos); - // LLAMA_V3_LOG_INFO("%s: %s => %s (lora type %s) \n", __func__, name.c_str(),base_name.c_str(), lora_type.c_str()); - - if (model_tensors.find(base_name) == model_tensors.end()) { - LLAMA_V3_LOG_ERROR("%s: unknown tensor '%s' in lora adapter\n", __func__, name.data()); - return 1; - } - - // create ggml tensor - ggml_type wtype; - switch (ftype) { - case 0: wtype = GGML_TYPE_F32; break; - case 1: wtype = GGML_TYPE_F16; break; - default: - { - LLAMA_V3_LOG_ERROR("%s: invalid tensor data type '%d'\n", - __func__, ftype); - return false; - } - } - ggml_tensor * lora_tensor; - if (n_dims == 2) { - lora_tensor = ggml_new_tensor_2d(lora_ctx, wtype, ne[0], ne[1]); - } - else { - LLAMA_V3_LOG_ERROR("%s: unsupported tensor dimension %d\n", __func__, n_dims); - return 1; - } - ggml_set_name(lora_tensor, "lora_tensor"); - - // load tensor data - size_t offset = fin.tellg(); - size_t tensor_data_size = ggml_nbytes(lora_tensor); - offset = (offset + 31) & -32; - fin.seekg(offset); - fin.read((char*)lora_tensor->data, tensor_data_size); - - lora_tensors[name] = lora_tensor; - - // check if we have both A and B tensors and apply - if (lora_tensors.find(base_name + ".loraA") != lora_tensors.end() && - lora_tensors.find(base_name + ".loraB") != lora_tensors.end()) { - - ggml_tensor * dest_t = model_tensors[base_name]; - - offload_func_t offload_func = llama_v3_nop; - offload_func_t offload_func_force_inplace = llama_v3_nop; - -#ifdef GGML_USE_CUBLAS - if (dest_t->backend == GGML_BACKEND_GPU || dest_t->backend == GGML_BACKEND_GPU_SPLIT) { - if (dest_t->type != GGML_TYPE_F16) { - throw std::runtime_error(format_old( - "%s: error: the simultaneous use of LoRAs and GPU acceleration is only supported for f16 models", __func__)); - } - offload_func = ggml_cuda_assign_buffers; - offload_func_force_inplace = ggml_cuda_assign_buffers_force_inplace; - } -#endif // GGML_USE_CUBLAS - - ggml_tensor * base_t; - if (model_loader) { - // load from base model - if (model_loader->tensors_map.name_to_idx.find(base_name) == model_loader->tensors_map.name_to_idx.end()) { - LLAMA_V3_LOG_ERROR("%s: error: tensor '%s' not found in base model\n", __func__, base_name.c_str()); - return 1; - } - size_t idx = model_loader->tensors_map.name_to_idx[base_name]; - llama_v3_load_tensor & lt = model_loader->tensors_map.tensors[idx]; - base_t = model_loader->get_tensor(base_name, { (uint32_t)dest_t->ne[0], (uint32_t)dest_t->ne[1] }, GGML_BACKEND_CPU); - lt.data = (uint8_t *) lt.ggml_tensor->data; - model_loader->load_data_for(lt); - lt.ggml_tensor->data = lt.data; - } - else { - base_t = dest_t; - } - - if (ggml_is_quantized(base_t->type)) { - if (!warned) { - LLAMA_V3_LOG_WARN("%s: warning: using a lora adapter with a quantized model may result in poor quality, " - "use a f16 or f32 base model with --lora-base\n", __func__); - warned = true; - } - } - - ggml_tensor * loraA = lora_tensors[base_name + ".loraA"]; - GGML_ASSERT(loraA->type == GGML_TYPE_F32); - ggml_set_name(loraA, "loraA"); - - ggml_tensor * loraB = lora_tensors[base_name + ".loraB"]; - GGML_ASSERT(loraB->type == GGML_TYPE_F32); - ggml_set_name(loraB, "loraB"); - - if (base_t->ne[0] != loraA->ne[1] || base_t->ne[1] != loraB->ne[1]) { - LLAMA_V3_LOG_ERROR("%s: incompatible tensor dimensions (%" PRId64 " and %" PRId64 ");" - " are you sure that this adapter is for this model?\n", __func__, base_t->ne[0], loraA->ne[1]); - return 1; - } - - // w = w + BA*s - ggml_tensor * BA = ggml_mul_mat(lora_ctx, loraA, loraB); - offload_func(BA); - ggml_set_name(BA, "BA"); - - if (scaling != 1.0f) { - ggml_tensor * scale_tensor = ggml_new_f32(lora_ctx, scaling); - ggml_set_name(scale_tensor, "scale_tensor"); - - BA = ggml_scale_inplace(lora_ctx, BA, scale_tensor); - offload_func(BA); - ggml_set_name(BA, "BA_scaled"); - } - - ggml_tensor * r; - if (base_t == dest_t) { - r = ggml_add_inplace(lora_ctx, dest_t, BA); - offload_func_force_inplace(r); - ggml_set_name(r, "r_add_inplace"); - } - else { - r = ggml_add(lora_ctx, base_t, BA); - offload_func(r); - ggml_set_name(r, "r_add"); - - r = ggml_cpy(lora_ctx, r, dest_t); - offload_func(r); - ggml_set_name(r, "r_cpy"); - } - - struct ggml_cgraph gf = ggml_build_forward(r); - - llv3_graph_compute_helper(work_buffer, &gf, n_threads); - - // we won't need these tensors again, reset the context to save memory - ggml_free(lora_ctx); - lora_ctx = ggml_init(params); - lora_tensors.clear(); - - n_tensors++; - if (n_tensors % 4 == 0) { - LLAMA_V3_LOG_INFO("."); - } - } - } - - // TODO: this should be in a destructor, it will leak on failure - ggml_free(lora_ctx); - if (base_ctx) { - ggml_free(base_ctx); - } - - const int64_t t_lora_us = ggml_time_us() - t_start_lora_us; - LLAMA_V3_LOG_INFO(" done (%.2f ms)\n", t_lora_us / 1000.0); - - return 0; -} - -int llama_v3_apply_lora_from_file(struct llama_v3_context * ctx, const char * path_lora, const char * path_base_model, int n_threads) { - try { - return llama_v3_apply_lora_from_file_internal(ctx->model, path_lora, path_base_model, n_threads); - } catch (const std::exception & err) { - LLAMA_V3_LOG_ERROR("%s: failed to apply lora adapter: %s\n", __func__, err.what()); - return 1; - } -} - -int llama_v3_model_apply_lora_from_file(const struct llama_v3_model * model, const char * path_lora, const char * path_base_model, int n_threads) { - try { - return llama_v3_apply_lora_from_file_internal(*model, path_lora, path_base_model, n_threads); - } catch (const std::exception & err) { - LLAMA_V3_LOG_ERROR("%s: failed to apply lora adapter: %s\n", __func__, err.what()); - return 1; - } -} - -int llama_v3_get_kv_cache_token_count(const struct llama_v3_context * ctx) { - return ctx->kv_self.n; -} - -#define LLAMA_V3_MAX_RNG_STATE (64*1024) - -void llama_v3_set_rng_seed(struct llama_v3_context * ctx, uint32_t seed) { - if (seed == LLAMA_V3_DEFAULT_SEED) { - seed = time(NULL); - } - ctx->rng.seed(seed); -} - -// Returns the *maximum* size of the state -size_t llama_v3_get_state_size(const struct llama_v3_context * ctx) { - // we don't know size of rng until we actually serialize it. so reserve more than enough memory for its serialized state. - // for reference, std::mt19937(1337) serializes to 6701 bytes. - const size_t s_rng_size = sizeof(size_t); - const size_t s_rng = LLAMA_V3_MAX_RNG_STATE; - const size_t s_logits_capacity = sizeof(size_t); - const size_t s_logits_size = sizeof(size_t); - const size_t s_logits = ctx->logits.capacity() * sizeof(float); - const size_t s_embedding_size = sizeof(size_t); - const size_t s_embedding = ctx->embedding.size() * sizeof(float); - const size_t s_kv_size = sizeof(size_t); - const size_t s_kv_ntok = sizeof(int); - const size_t s_kv = ctx->kv_self.buf.size; - - const size_t s_total = ( - + s_rng_size - + s_rng - + s_logits_capacity - + s_logits_size - + s_logits - + s_embedding_size - + s_embedding - + s_kv_size - + s_kv_ntok - + s_kv - ); - - return s_total; -} - -/** copy state data into either a buffer or file depending on the passed in context - * - * file context: - * llama_v3_file file("/path", "wb"); - * llama_v3_data_file_context data_ctx(&file); - * llama_v3_copy_state_data(ctx, &data_ctx); - * - * buffer context: - * std::vector buf(max_size, 0); - * llama_v3_data_buffer_context data_ctx(&buf.data()); - * llama_v3_copy_state_data(ctx, &data_ctx); - * -*/ -void llama_v3_copy_state_data_internal(struct llama_v3_context * ctx, llama_v3_data_context * data_ctx) { - // copy rng - { - std::stringstream rng_ss; - rng_ss << ctx->rng; - - const size_t rng_size = rng_ss.str().size(); - char rng_buf[LLAMA_V3_MAX_RNG_STATE]; - - memset(&rng_buf[0], 0, LLAMA_V3_MAX_RNG_STATE); - memcpy(&rng_buf[0], rng_ss.str().data(), rng_ss.str().size()); - - data_ctx->write(&rng_size, sizeof(rng_size)); - data_ctx->write(&rng_buf[0], LLAMA_V3_MAX_RNG_STATE); - } - - // copy logits - { - const size_t logits_cap = ctx->logits.capacity(); - const size_t logits_size = ctx->logits.size(); - - data_ctx->write(&logits_cap, sizeof(logits_cap)); - data_ctx->write(&logits_size, sizeof(logits_size)); - - if (logits_size) { - data_ctx->write(ctx->logits.data(), logits_size * sizeof(float)); - } - - // If there is a gap between the size and the capacity, write padding - size_t padding_size = (logits_cap - logits_size) * sizeof(float); - if (padding_size > 0) { - std::vector padding(padding_size, 0); // Create a buffer filled with zeros - data_ctx->write(padding.data(), padding_size); - } - } - - // copy embeddings - { - const size_t embedding_size = ctx->embedding.size(); - - data_ctx->write(&embedding_size, sizeof(embedding_size)); - - if (embedding_size) { - data_ctx->write(ctx->embedding.data(), embedding_size * sizeof(float)); - } - } - - // copy kv cache - { - const auto & kv_self = ctx->kv_self; - const auto & hparams = ctx->model.hparams; - const int n_layer = hparams.n_layer; - const int n_embd = hparams.n_embd_gqa(); - const int n_ctx = hparams.n_ctx; - - const size_t kv_size = kv_self.buf.size; - const int kv_ntok = llama_v3_get_kv_cache_token_count(ctx); - - data_ctx->write(&kv_size, sizeof(kv_size)); - data_ctx->write(&kv_ntok, sizeof(kv_ntok)); - - if (kv_size) { - const size_t elt_size = ggml_element_size(kv_self.k); - - ggml_context * cpy_ctx = ggml_init({ 4096, NULL, /* no_alloc */ true }); - ggml_cgraph gf{}; - - ggml_tensor * kout3d = ggml_new_tensor_3d(cpy_ctx, kv_self.k->type, n_embd, kv_ntok, n_layer); - std::vector kout3d_data(ggml_nbytes(kout3d), 0); - kout3d->data = kout3d_data.data(); - - ggml_tensor * vout3d = ggml_new_tensor_3d(cpy_ctx, kv_self.v->type, kv_ntok, n_embd, n_layer); - std::vector vout3d_data(ggml_nbytes(vout3d), 0); - vout3d->data = vout3d_data.data(); - - ggml_tensor * k3d = ggml_view_3d(cpy_ctx, kv_self.k, - n_embd, kv_ntok, n_layer, - elt_size*n_embd, elt_size*n_embd*n_ctx, 0); - - ggml_tensor * v3d = ggml_view_3d(cpy_ctx, kv_self.v, - kv_ntok, n_embd, n_layer, - elt_size*n_ctx, elt_size*n_ctx*n_embd, 0); - - ggml_build_forward_expand(&gf, ggml_cpy(cpy_ctx, k3d, kout3d)); - ggml_build_forward_expand(&gf, ggml_cpy(cpy_ctx, v3d, vout3d)); - llv3_graph_compute_helper(ctx->work_buffer, &gf, /*n_threads*/ 1); - - ggml_free(cpy_ctx); - - // our data is now in the kout3d_data and vout3d_data buffers - // write them to file - data_ctx->write(kout3d_data.data(), kout3d_data.size()); - data_ctx->write(vout3d_data.data(), vout3d_data.size()); - } - } -} - -size_t llama_v3_copy_state_data(struct llama_v3_context * ctx, uint8_t * dst) { - llama_v3_data_buffer_context data_ctx(dst); - llama_v3_copy_state_data_internal(ctx, &data_ctx); - - return data_ctx.get_size_written(); -} - -// Sets the state reading from the specified source address -size_t llama_v3_set_state_data(struct llama_v3_context * ctx, uint8_t * src) { - uint8_t * inp = src; - - // set rng - { - size_t rng_size; - char rng_buf[LLAMA_V3_MAX_RNG_STATE]; - - memcpy(&rng_size, inp, sizeof(rng_size)); inp += sizeof(rng_size); - memcpy(&rng_buf[0], inp, LLAMA_V3_MAX_RNG_STATE); inp += LLAMA_V3_MAX_RNG_STATE; - - std::stringstream rng_ss; - rng_ss.str(std::string(&rng_buf[0], rng_size)); - rng_ss >> ctx->rng; - - LLAMA_V3_ASSERT(rng_ss.fail() == false); - } - - // set logits - { - size_t logits_cap; - size_t logits_size; - - memcpy(&logits_cap, inp, sizeof(logits_cap)); inp += sizeof(logits_cap); - memcpy(&logits_size, inp, sizeof(logits_size)); inp += sizeof(logits_size); - - LLAMA_V3_ASSERT(ctx->logits.capacity() == logits_cap); - - if (logits_size) { - ctx->logits.resize(logits_size); - memcpy(ctx->logits.data(), inp, logits_size * sizeof(float)); - } - - inp += logits_cap * sizeof(float); - } - - // set embeddings - { - size_t embedding_size; - - memcpy(&embedding_size, inp, sizeof(embedding_size)); inp += sizeof(embedding_size); - - LLAMA_V3_ASSERT(ctx->embedding.capacity() == embedding_size); - - if (embedding_size) { - memcpy(ctx->embedding.data(), inp, embedding_size * sizeof(float)); - inp += embedding_size * sizeof(float); - } - } - - // set kv cache - { - const auto & kv_self = ctx->kv_self; - const auto & hparams = ctx->model.hparams; - const int n_layer = hparams.n_layer; - const int n_embd = hparams.n_embd_gqa(); - const int n_ctx = hparams.n_ctx; - - size_t kv_size; - int kv_ntok; - - memcpy(&kv_size, inp, sizeof(kv_size)); inp += sizeof(kv_size); - memcpy(&kv_ntok, inp, sizeof(kv_ntok)); inp += sizeof(kv_ntok); - - if (kv_size) { - LLAMA_V3_ASSERT(kv_self.buf.size == kv_size); - - const size_t elt_size = ggml_element_size(kv_self.k); - - ggml_context * cpy_ctx = ggml_init({ 4096, NULL, /* no_alloc */ true }); - ggml_cgraph gf{}; - - ggml_tensor * kin3d = ggml_new_tensor_3d(cpy_ctx, kv_self.k->type, n_embd, kv_ntok, n_layer); - kin3d->data = (void *) inp; - inp += ggml_nbytes(kin3d); - - ggml_tensor * vin3d = ggml_new_tensor_3d(cpy_ctx, kv_self.v->type, kv_ntok, n_embd, n_layer); - vin3d->data = (void *) inp; - inp += ggml_nbytes(vin3d); - - ggml_tensor * k3d = ggml_view_3d(cpy_ctx, kv_self.k, - n_embd, kv_ntok, n_layer, - elt_size*n_embd, elt_size*n_embd*n_ctx, 0); - - ggml_tensor * v3d = ggml_view_3d(cpy_ctx, kv_self.v, - kv_ntok, n_embd, n_layer, - elt_size*n_ctx, elt_size*n_ctx*n_embd, 0); - - ggml_build_forward_expand(&gf, ggml_cpy(cpy_ctx, kin3d, k3d)); - ggml_build_forward_expand(&gf, ggml_cpy(cpy_ctx, vin3d, v3d)); - llv3_graph_compute_helper(ctx->work_buffer, &gf, /*n_threads*/ 1); - - ggml_free(cpy_ctx); - } - - ctx->kv_self.n = kv_ntok; - } - - const size_t nread = inp - src; - const size_t max_size = llama_v3_get_state_size(ctx); - - LLAMA_V3_ASSERT(nread <= max_size); - - return nread; -} - -static bool llama_v3_load_session_file_internal(struct llama_v3_context * ctx, const char * path_session, llama_v3_token * tokens_out, size_t n_token_capacity, size_t * n_token_count_out) { - llama_v3_file file(path_session, "rb"); - - // sanity checks - { - const uint32_t magic = file.read_u32(); - const uint32_t version = file.read_u32(); - - if (magic != LLAMA_V3_SESSION_MAGIC || version != LLAMA_V3_SESSION_VERSION) { - LLAMA_V3_LOG_ERROR("%s : unknown (magic, version) for session file: %08x, %08x\n", __func__, magic, version); - return false; - } - - llama_v3_hparams session_hparams; - file.read_raw(&session_hparams, sizeof(llama_v3_hparams)); - - if (session_hparams != ctx->model.hparams) { - LLAMA_V3_LOG_INFO("%s : model hparams didn't match from session file!\n", __func__); - return false; - } - } - - // load the prompt - { - const uint32_t n_token_count = file.read_u32(); - - if (n_token_count > n_token_capacity) { - LLAMA_V3_LOG_ERROR("%s : token count in session file exceeded capacity! %u > %zu\n", __func__, n_token_count, n_token_capacity); - return false; - } - - file.read_raw(tokens_out, sizeof(llama_v3_token) * n_token_count); - *n_token_count_out = n_token_count; - } - - // restore the context state - { - const size_t n_state_size_cur = file.size - file.tell(); - const size_t n_state_size_max = llama_v3_get_state_size(ctx); - - if (n_state_size_cur > n_state_size_max) { - LLAMA_V3_LOG_ERROR("%s : the state size in session file is too big! max %zu, got %zu\n", __func__, n_state_size_max, n_state_size_cur); - return false; - } - - std::vector state_data(n_state_size_max); - file.read_raw(state_data.data(), n_state_size_cur); - - llama_v3_set_state_data(ctx, state_data.data()); - } - - return true; -} - -bool llama_v3_load_session_file(struct llama_v3_context * ctx, const char * path_session, llama_v3_token * tokens_out, size_t n_token_capacity, size_t * n_token_count_out) { - try { - return llama_v3_load_session_file_internal(ctx, path_session, tokens_out, n_token_capacity, n_token_count_out); - } catch (const std::exception & err) { - LLAMA_V3_LOG_ERROR("error loading session file: %s\n", err.what()); - return false; - } -} - -bool llama_v3_save_session_file(struct llama_v3_context * ctx, const char * path_session, const llama_v3_token * tokens, size_t n_token_count) { - llama_v3_file file(path_session, "wb"); - - file.write_u32(LLAMA_V3_SESSION_MAGIC); - file.write_u32(LLAMA_V3_SESSION_VERSION); - - file.write_raw(&ctx->model.hparams, sizeof(llama_v3_hparams)); - - // save the prompt - file.write_u32((uint32_t) n_token_count); - file.write_raw(tokens, sizeof(llama_v3_token) * n_token_count); - - // save the context state using stream saving - llama_v3_data_file_context data_ctx(&file); - llama_v3_copy_state_data_internal(ctx, &data_ctx); - - return true; -} - -int llama_v3_eval( - struct llama_v3_context * ctx, - const llama_v3_token * tokens, - int n_tokens, - int n_past, - int n_threads) { - if (!llama_v3_eval_internal(*ctx, tokens, nullptr, n_tokens, n_past, n_threads, nullptr)) { - LLAMA_V3_LOG_ERROR("%s: failed to eval\n", __func__); - return 1; - } - - // get a more accurate load time, upon first eval - // TODO: fix this - if (!ctx->has_evaluated_once) { - ctx->t_load_us = ggml_time_us() - ctx->t_start_us; - ctx->has_evaluated_once = true; - } - - return 0; -} - - -int llama_v3_eval_embd( - struct llama_v3_context * ctx, - const float * embd, - int n_tokens, - int n_past, - int n_threads) { - if (!llama_v3_eval_internal(*ctx, nullptr, embd, n_tokens, n_past, n_threads, nullptr)) { - LLAMA_V3_LOG_ERROR("%s: failed to eval\n", __func__); - return 1; - } - - // get a more accurate load time, upon first eval - // TODO: fix this - if (!ctx->has_evaluated_once) { - ctx->t_load_us = ggml_time_us() - ctx->t_start_us; - ctx->has_evaluated_once = true; - } - - return 0; -} - -int llama_v3_eval_export(struct llama_v3_context * ctx, const char * fname) { - const int n_batch = 1; - const int n_ctx = 512 - n_batch; - - const std::vector tmp(n_batch, llama_v3_token_bos()); - - if (!llama_v3_eval_internal(*ctx, tmp.data(), nullptr, tmp.size(), n_ctx, 1, fname)) { - LLAMA_V3_LOG_ERROR("%s: failed to eval\n", __func__); - return 1; - } - - return 0; -} - -int llama_v3_tokenize_with_model( - const struct llama_v3_model * model, - const char * text, - llama_v3_token * tokens, - int n_max_tokens, - bool add_bos) { - auto res = llama_v3_tokenize(model->vocab, text, add_bos); - - if (n_max_tokens < (int) res.size()) { - LLAMA_V3_LOG_ERROR("%s: too many tokens\n", __func__); - return -((int) res.size()); - } - - for (size_t i = 0; i < res.size(); i++) { - tokens[i] = res[i]; - } - - return res.size(); -} - -int llama_v3_tokenize( - struct llama_v3_context * ctx, - const char * text, - llama_v3_token * tokens, - int n_max_tokens, - bool add_bos) { - return llama_v3_tokenize_with_model(&ctx->model, text, tokens, n_max_tokens, add_bos); -} - -int llama_v3_n_vocab_from_model(const struct llama_v3_model * model) { - return model->vocab.id_to_token.size(); -} - -int llama_v3_n_ctx_from_model(const struct llama_v3_model * model) { - return model->hparams.n_ctx; -} - -int llama_v3_n_embd_from_model(const struct llama_v3_model * model) { - return model->hparams.n_embd; -} - -int llama_v3_n_vocab(const struct llama_v3_context * ctx) { - return ctx->model.vocab.id_to_token.size(); -} - -int llama_v3_n_ctx(const struct llama_v3_context * ctx) { - return ctx->model.hparams.n_ctx; -} - -int llama_v3_n_embd(const struct llama_v3_context * ctx) { - return ctx->model.hparams.n_embd; -} - -int llama_v3_model_type(const struct llama_v3_model * model, char * buf, size_t buf_size) { - return snprintf(buf, buf_size, "LLaMA %s %s", llama_v3_model_type_name(model->type), llama_v3_ftype_name(model->hparams.ftype)); -} - -int llama_v3_get_vocab_from_model( - const struct llama_v3_model * model, - const char * * strings, - float * scores, - int capacity) { - int n = std::min(capacity, (int) model->vocab.id_to_token.size()); - for (int i = 0; ivocab.id_to_token[i].tok.c_str(); - scores[i] = model->vocab.id_to_token[i].score; - } - return n; -} - -int llama_v3_get_vocab( - const struct llama_v3_context * ctx, - const char * * strings, - float * scores, - int capacity) { - return llama_v3_get_vocab_from_model(&ctx->model, strings, scores, capacity); -} - -float * llama_v3_get_logits(struct llama_v3_context * ctx) { - return ctx->logits.data(); -} - -float * llama_v3_get_embeddings(struct llama_v3_context * ctx) { - return ctx->embedding.data(); -} - -const char * llama_v3_token_to_str_with_model(const struct llama_v3_model * model, llama_v3_token token) { - if (token >= llama_v3_n_vocab_from_model(model)) { - return nullptr; - } - - return model->vocab.id_to_token[token].tok.c_str(); -} - -const char * llama_v3_token_to_str(const struct llama_v3_context * ctx, llama_v3_token token) { - return llama_v3_token_to_str_with_model(&ctx->model, token); -} - -llama_v3_token llama_v3_token_bos() { - return 1; -} - -llama_v3_token llama_v3_token_eos() { - return 2; -} - -llama_v3_token llama_v3_token_nl() { - return 13; -} - -struct llama_v3_timings llama_v3_get_timings(struct llama_v3_context * ctx) { - struct llama_v3_timings result = { - /*.t_start_ms =*/ 1e-3 * ctx->t_start_us, - /*.t_end_ms =*/ 1.00 * ggml_time_ms(), - /*.t_load_ms =*/ 1e-3 * ctx->t_load_us, - /*.t_sample_ms =*/ 1e-3 * ctx->t_sample_us, - /*.t_p_eval_ms =*/ 1e-3 * ctx->t_p_eval_us, - /*.t_eval_ms =*/ 1e-3 * ctx->t_eval_us, - - /*.n_sample =*/ std::max(1, ctx->n_sample), - /*.n_p_eval =*/ std::max(1, ctx->n_p_eval), - /*.n_eval =*/ std::max(1, ctx->n_eval), - }; - - return result; -} - -void llama_v3_print_timings(struct llama_v3_context * ctx) { - const llama_v3_timings timings = llama_v3_get_timings(ctx); - - LLAMA_V3_LOG_INFO("\n"); - LLAMA_V3_LOG_INFO("%s: load time = %8.2f ms\n", __func__, timings.t_load_ms); - LLAMA_V3_LOG_INFO("%s: sample time = %8.2f ms / %5d runs (%8.2f ms per token, %8.2f tokens per second)\n", - __func__, timings.t_sample_ms, timings.n_sample, timings.t_sample_ms / timings.n_sample, 1e3 / timings.t_sample_ms * timings.n_sample); - LLAMA_V3_LOG_INFO("%s: prompt eval time = %8.2f ms / %5d tokens (%8.2f ms per token, %8.2f tokens per second)\n", - __func__, timings.t_p_eval_ms, timings.n_p_eval, timings.t_p_eval_ms / timings.n_p_eval, 1e3 / timings.t_p_eval_ms * timings.n_p_eval); - LLAMA_V3_LOG_INFO("%s: eval time = %8.2f ms / %5d runs (%8.2f ms per token, %8.2f tokens per second)\n", - __func__, timings.t_eval_ms, timings.n_eval, timings.t_eval_ms / timings.n_eval, 1e3 / timings.t_eval_ms * timings.n_eval); - LLAMA_V3_LOG_INFO("%s: total time = %8.2f ms\n", __func__, (timings.t_end_ms - timings.t_start_ms)); -} - -void llama_v3_reset_timings(struct llama_v3_context * ctx) { - ctx->t_start_us = ggml_time_us(); - ctx->t_sample_us = ctx->n_sample = 0; - ctx->t_eval_us = ctx->n_eval = 0; - ctx->t_p_eval_us = ctx->n_p_eval = 0; -} - -const char * llama_v3_print_system_info(void) { - static std::string s; - - s = ""; - s += "AVX = " + std::to_string(ggml_cpu_has_avx()) + " | "; - s += "AVX2 = " + std::to_string(ggml_cpu_has_avx2()) + " | "; - s += "AVX512 = " + std::to_string(ggml_cpu_has_avx512()) + " | "; - s += "AVX512_VBMI = " + std::to_string(ggml_cpu_has_avx512_vbmi()) + " | "; - s += "AVX512_VNNI = " + std::to_string(ggml_cpu_has_avx512_vnni()) + " | "; - s += "FMA = " + std::to_string(ggml_cpu_has_fma()) + " | "; - s += "NEON = " + std::to_string(ggml_cpu_has_neon()) + " | "; - s += "ARM_FMA = " + std::to_string(ggml_cpu_has_arm_fma()) + " | "; - s += "F16C = " + std::to_string(ggml_cpu_has_f16c()) + " | "; - s += "FP16_VA = " + std::to_string(ggml_cpu_has_fp16_va()) + " | "; - s += "WASM_SIMD = " + std::to_string(ggml_cpu_has_wasm_simd()) + " | "; - s += "BLAS = " + std::to_string(ggml_cpu_has_blas()) + " | "; - s += "SSE3 = " + std::to_string(ggml_cpu_has_sse3()) + " | "; - s += "VSX = " + std::to_string(ggml_cpu_has_vsx()) + " | "; - - return s.c_str(); -} - -// For internal test use -const std::vector>& llama_v3_internal_get_tensor_map(struct llama_v3_context * ctx) { - return ctx->model.tensors_by_name; -} - - -void llama_v3_log_set(llama_v3_log_callback log_callback, void * user_data) { - llv3_g_state.log_callback = log_callback ? log_callback : llama_v3_log_callback_default; - llv3_g_state.log_callback_user_data = user_data; -} - -#if defined(_MSC_VER) && !defined(vsnprintf) -#define vsnprintf _vsnprintf -#endif - -static void llama_v3_log_internal_v(llama_v3_log_level level, const char * format, va_list args) { - va_list args_copy; - va_copy(args_copy, args); - char buffer[128]; - int len = vsnprintf(buffer, 128, format, args); - if (len < 128) { - llv3_g_state.log_callback(level, buffer, llv3_g_state.log_callback_user_data); - } else { - char* buffer2 = new char[len+1]; - vsnprintf(buffer2, len+1, format, args_copy); - buffer2[len] = 0; - llv3_g_state.log_callback(level, buffer2, llv3_g_state.log_callback_user_data); - delete[] buffer2; - } - va_end(args_copy); -} - -static void llama_v3_log_internal(llama_v3_log_level level, const char * format, ...) { - va_list args; - va_start(args, format); - llama_v3_log_internal_v(level, format, args); - va_end(args); -} - -static void llama_v3_log_callback_default(llama_v3_log_level level, const char * text, void * user_data) { - (void) level; - (void) user_data; - fputs(text, stderr); - fflush(stderr); -} diff --git a/spaces/JUNGU/VToonify/vtoonify/model/stylegan/op_gpu/conv2d_gradfix.py b/spaces/JUNGU/VToonify/vtoonify/model/stylegan/op_gpu/conv2d_gradfix.py deleted file mode 100644 index bb2f94bbcb8132299fd4d538972d32bd7ff6e7d6..0000000000000000000000000000000000000000 --- a/spaces/JUNGU/VToonify/vtoonify/model/stylegan/op_gpu/conv2d_gradfix.py +++ /dev/null @@ -1,227 +0,0 @@ -import contextlib -import warnings - -import torch -from torch import autograd -from torch.nn import functional as F - -enabled = True -weight_gradients_disabled = False - - -@contextlib.contextmanager -def no_weight_gradients(): - global weight_gradients_disabled - - old = weight_gradients_disabled - weight_gradients_disabled = True - yield - weight_gradients_disabled = old - - -def conv2d(input, weight, bias=None, stride=1, padding=0, dilation=1, groups=1): - if could_use_op(input): - return conv2d_gradfix( - transpose=False, - weight_shape=weight.shape, - stride=stride, - padding=padding, - output_padding=0, - dilation=dilation, - groups=groups, - ).apply(input, weight, bias) - - return F.conv2d( - input=input, - weight=weight, - bias=bias, - stride=stride, - padding=padding, - dilation=dilation, - groups=groups, - ) - - -def conv_transpose2d( - input, - weight, - bias=None, - stride=1, - padding=0, - output_padding=0, - groups=1, - dilation=1, -): - if could_use_op(input): - return conv2d_gradfix( - transpose=True, - weight_shape=weight.shape, - stride=stride, - padding=padding, - output_padding=output_padding, - groups=groups, - dilation=dilation, - ).apply(input, weight, bias) - - return F.conv_transpose2d( - input=input, - weight=weight, - bias=bias, - stride=stride, - padding=padding, - output_padding=output_padding, - dilation=dilation, - groups=groups, - ) - - -def could_use_op(input): - if (not enabled) or (not torch.backends.cudnn.enabled): - return False - - if input.device.type != "cuda": - return False - - if any(torch.__version__.startswith(x) for x in ["1.7.", "1.8."]): - return True - - warnings.warn( - f"conv2d_gradfix not supported on PyTorch {torch.__version__}. Falling back to torch.nn.functional.conv2d()." - ) - - return False - - -def ensure_tuple(xs, ndim): - xs = tuple(xs) if isinstance(xs, (tuple, list)) else (xs,) * ndim - - return xs - - -conv2d_gradfix_cache = dict() - - -def conv2d_gradfix( - transpose, weight_shape, stride, padding, output_padding, dilation, groups -): - ndim = 2 - weight_shape = tuple(weight_shape) - stride = ensure_tuple(stride, ndim) - padding = ensure_tuple(padding, ndim) - output_padding = ensure_tuple(output_padding, ndim) - dilation = ensure_tuple(dilation, ndim) - - key = (transpose, weight_shape, stride, padding, output_padding, dilation, groups) - if key in conv2d_gradfix_cache: - return conv2d_gradfix_cache[key] - - common_kwargs = dict( - stride=stride, padding=padding, dilation=dilation, groups=groups - ) - - def calc_output_padding(input_shape, output_shape): - if transpose: - return [0, 0] - - return [ - input_shape[i + 2] - - (output_shape[i + 2] - 1) * stride[i] - - (1 - 2 * padding[i]) - - dilation[i] * (weight_shape[i + 2] - 1) - for i in range(ndim) - ] - - class Conv2d(autograd.Function): - @staticmethod - def forward(ctx, input, weight, bias): - if not transpose: - out = F.conv2d(input=input, weight=weight, bias=bias, **common_kwargs) - - else: - out = F.conv_transpose2d( - input=input, - weight=weight, - bias=bias, - output_padding=output_padding, - **common_kwargs, - ) - - ctx.save_for_backward(input, weight) - - return out - - @staticmethod - def backward(ctx, grad_output): - input, weight = ctx.saved_tensors - grad_input, grad_weight, grad_bias = None, None, None - - if ctx.needs_input_grad[0]: - p = calc_output_padding( - input_shape=input.shape, output_shape=grad_output.shape - ) - grad_input = conv2d_gradfix( - transpose=(not transpose), - weight_shape=weight_shape, - output_padding=p, - **common_kwargs, - ).apply(grad_output, weight, None) - - if ctx.needs_input_grad[1] and not weight_gradients_disabled: - grad_weight = Conv2dGradWeight.apply(grad_output, input) - - if ctx.needs_input_grad[2]: - grad_bias = grad_output.sum((0, 2, 3)) - - return grad_input, grad_weight, grad_bias - - class Conv2dGradWeight(autograd.Function): - @staticmethod - def forward(ctx, grad_output, input): - op = torch._C._jit_get_operation( - "aten::cudnn_convolution_backward_weight" - if not transpose - else "aten::cudnn_convolution_transpose_backward_weight" - ) - flags = [ - torch.backends.cudnn.benchmark, - torch.backends.cudnn.deterministic, - torch.backends.cudnn.allow_tf32, - ] - grad_weight = op( - weight_shape, - grad_output, - input, - padding, - stride, - dilation, - groups, - *flags, - ) - ctx.save_for_backward(grad_output, input) - - return grad_weight - - @staticmethod - def backward(ctx, grad_grad_weight): - grad_output, input = ctx.saved_tensors - grad_grad_output, grad_grad_input = None, None - - if ctx.needs_input_grad[0]: - grad_grad_output = Conv2d.apply(input, grad_grad_weight, None) - - if ctx.needs_input_grad[1]: - p = calc_output_padding( - input_shape=input.shape, output_shape=grad_output.shape - ) - grad_grad_input = conv2d_gradfix( - transpose=(not transpose), - weight_shape=weight_shape, - output_padding=p, - **common_kwargs, - ).apply(grad_output, grad_grad_weight, None) - - return grad_grad_output, grad_grad_input - - conv2d_gradfix_cache[key] = Conv2d - - return Conv2d diff --git a/spaces/Jesuscriss301/prueba/README.md b/spaces/Jesuscriss301/prueba/README.md deleted file mode 100644 index cae3ff236a2bdf26f0580cfdff317d1f2f249d56..0000000000000000000000000000000000000000 --- a/spaces/Jesuscriss301/prueba/README.md +++ /dev/null @@ -1,37 +0,0 @@ ---- -title: Prueba -emoji: ⚡ -colorFrom: gray -colorTo: blue -sdk: streamlit -app_file: app.py -pinned: false ---- - -# Configuration - -`title`: _string_ -Display title for the Space - -`emoji`: _string_ -Space emoji (emoji-only character allowed) - -`colorFrom`: _string_ -Color for Thumbnail gradient (red, yellow, green, blue, indigo, purple, pink, gray) - -`colorTo`: _string_ -Color for Thumbnail gradient (red, yellow, green, blue, indigo, purple, pink, gray) - -`sdk`: _string_ -Can be either `gradio` or `streamlit` - -`sdk_version` : _string_ -Only applicable for `streamlit` SDK. -See [doc](https://hf.co/docs/hub/spaces) for more info on supported versions. - -`app_file`: _string_ -Path to your main application file (which contains either `gradio` or `streamlit` Python code). -Path is relative to the root of the repository. - -`pinned`: _boolean_ -Whether the Space stays on top of your list. diff --git a/spaces/JunchuanYu/Tools/README.md b/spaces/JunchuanYu/Tools/README.md deleted file mode 100644 index bb161f89ef9245868f2aa2f544ba91480bf4247d..0000000000000000000000000000000000000000 --- a/spaces/JunchuanYu/Tools/README.md +++ /dev/null @@ -1,12 +0,0 @@ ---- -title: AI-Transformer -emoji: 🐨 -colorFrom: yellow -colorTo: red -sdk: gradio -sdk_version: 3.19.1 -app_file: app.py -pinned: false ---- - -Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference diff --git a/spaces/Kangarroar/ApplioRVC-Inference/infer/modules/uvr5/preprocess.py b/spaces/Kangarroar/ApplioRVC-Inference/infer/modules/uvr5/preprocess.py deleted file mode 100644 index 19f11110ea822eeb140fb885c600536290a1adff..0000000000000000000000000000000000000000 --- a/spaces/Kangarroar/ApplioRVC-Inference/infer/modules/uvr5/preprocess.py +++ /dev/null @@ -1,346 +0,0 @@ -import os -import logging - -logger = logging.getLogger(__name__) - -import librosa -import numpy as np -import soundfile as sf -import torch - -from infer.lib.uvr5_pack.lib_v5 import nets_61968KB as Nets -from infer.lib.uvr5_pack.lib_v5 import spec_utils -from infer.lib.uvr5_pack.lib_v5.model_param_init import ModelParameters -from infer.lib.uvr5_pack.lib_v5.nets_new import CascadedNet -from infer.lib.uvr5_pack.utils import inference - - -class AudioPre: - def __init__(self, agg, model_path, device, is_half): - self.model_path = model_path - self.device = device - self.data = { - # Processing Options - "postprocess": False, - "tta": False, - # Constants - "window_size": 512, - "agg": agg, - "high_end_process": "mirroring", - } - mp = ModelParameters("infer/lib/uvr5_pack/lib_v5/modelparams/4band_v2.json") - model = Nets.CascadedASPPNet(mp.param["bins"] * 2) - cpk = torch.load(model_path, map_location="cpu") - model.load_state_dict(cpk) - model.eval() - if is_half: - model = model.half().to(device) - else: - model = model.to(device) - - self.mp = mp - self.model = model - - def _path_audio_(self, music_file, ins_root=None, vocal_root=None, format="flac"): - if ins_root is None and vocal_root is None: - return "No save root." - name = os.path.basename(music_file) - if ins_root is not None: - os.makedirs(ins_root, exist_ok=True) - if vocal_root is not None: - os.makedirs(vocal_root, exist_ok=True) - X_wave, y_wave, X_spec_s, y_spec_s = {}, {}, {}, {} - bands_n = len(self.mp.param["band"]) - # print(bands_n) - for d in range(bands_n, 0, -1): - bp = self.mp.param["band"][d] - if d == bands_n: # high-end band - ( - X_wave[d], - _, - ) = librosa.core.load( # 理论上librosa读取可能对某些音频有bug,应该上ffmpeg读取,但是太麻烦了弃坑 - music_file, - bp["sr"], - False, - dtype=np.float32, - res_type=bp["res_type"], - ) - if X_wave[d].ndim == 1: - X_wave[d] = np.asfortranarray([X_wave[d], X_wave[d]]) - else: # lower bands - X_wave[d] = librosa.core.resample( - X_wave[d + 1], - self.mp.param["band"][d + 1]["sr"], - bp["sr"], - res_type=bp["res_type"], - ) - # Stft of wave source - X_spec_s[d] = spec_utils.wave_to_spectrogram_mt( - X_wave[d], - bp["hl"], - bp["n_fft"], - self.mp.param["mid_side"], - self.mp.param["mid_side_b2"], - self.mp.param["reverse"], - ) - # pdb.set_trace() - if d == bands_n and self.data["high_end_process"] != "none": - input_high_end_h = (bp["n_fft"] // 2 - bp["crop_stop"]) + ( - self.mp.param["pre_filter_stop"] - self.mp.param["pre_filter_start"] - ) - input_high_end = X_spec_s[d][ - :, bp["n_fft"] // 2 - input_high_end_h : bp["n_fft"] // 2, : - ] - - X_spec_m = spec_utils.combine_spectrograms(X_spec_s, self.mp) - aggresive_set = float(self.data["agg"] / 100) - aggressiveness = { - "value": aggresive_set, - "split_bin": self.mp.param["band"][1]["crop_stop"], - } - with torch.no_grad(): - pred, X_mag, X_phase = inference( - X_spec_m, self.device, self.model, aggressiveness, self.data - ) - # Postprocess - if self.data["postprocess"]: - pred_inv = np.clip(X_mag - pred, 0, np.inf) - pred = spec_utils.mask_silence(pred, pred_inv) - y_spec_m = pred * X_phase - v_spec_m = X_spec_m - y_spec_m - - if ins_root is not None: - if self.data["high_end_process"].startswith("mirroring"): - input_high_end_ = spec_utils.mirroring( - self.data["high_end_process"], y_spec_m, input_high_end, self.mp - ) - wav_instrument = spec_utils.cmb_spectrogram_to_wave( - y_spec_m, self.mp, input_high_end_h, input_high_end_ - ) - else: - wav_instrument = spec_utils.cmb_spectrogram_to_wave(y_spec_m, self.mp) - logger.info("%s instruments done" % name) - if format in ["wav", "flac"]: - sf.write( - os.path.join( - ins_root, - "instrument_{}_{}.{}".format(name, self.data["agg"], format), - ), - (np.array(wav_instrument) * 32768).astype("int16"), - self.mp.param["sr"], - ) # - else: - path = os.path.join( - ins_root, "instrument_{}_{}.wav".format(name, self.data["agg"]) - ) - sf.write( - path, - (np.array(wav_instrument) * 32768).astype("int16"), - self.mp.param["sr"], - ) - if os.path.exists(path): - os.system( - "ffmpeg -i %s -vn %s -q:a 2 -y" - % (path, path[:-4] + ".%s" % format) - ) - if vocal_root is not None: - if self.data["high_end_process"].startswith("mirroring"): - input_high_end_ = spec_utils.mirroring( - self.data["high_end_process"], v_spec_m, input_high_end, self.mp - ) - wav_vocals = spec_utils.cmb_spectrogram_to_wave( - v_spec_m, self.mp, input_high_end_h, input_high_end_ - ) - else: - wav_vocals = spec_utils.cmb_spectrogram_to_wave(v_spec_m, self.mp) - logger.info("%s vocals done" % name) - if format in ["wav", "flac"]: - sf.write( - os.path.join( - vocal_root, - "vocal_{}_{}.{}".format(name, self.data["agg"], format), - ), - (np.array(wav_vocals) * 32768).astype("int16"), - self.mp.param["sr"], - ) - else: - path = os.path.join( - vocal_root, "vocal_{}_{}.wav".format(name, self.data["agg"]) - ) - sf.write( - path, - (np.array(wav_vocals) * 32768).astype("int16"), - self.mp.param["sr"], - ) - if os.path.exists(path): - os.system( - "ffmpeg -i %s -vn %s -q:a 2 -y" - % (path, path[:-4] + ".%s" % format) - ) - - -class AudioPreDeEcho: - def __init__(self, agg, model_path, device, is_half): - self.model_path = model_path - self.device = device - self.data = { - # Processing Options - "postprocess": False, - "tta": False, - # Constants - "window_size": 512, - "agg": agg, - "high_end_process": "mirroring", - } - mp = ModelParameters("infer/lib/uvr5_pack/lib_v5/modelparams/4band_v3.json") - nout = 64 if "DeReverb" in model_path else 48 - model = CascadedNet(mp.param["bins"] * 2, nout) - cpk = torch.load(model_path, map_location="cpu") - model.load_state_dict(cpk) - model.eval() - if is_half: - model = model.half().to(device) - else: - model = model.to(device) - - self.mp = mp - self.model = model - - def _path_audio_( - self, music_file, vocal_root=None, ins_root=None, format="flac" - ): # 3个VR模型vocal和ins是反的 - if ins_root is None and vocal_root is None: - return "No save root." - name = os.path.basename(music_file) - if ins_root is not None: - os.makedirs(ins_root, exist_ok=True) - if vocal_root is not None: - os.makedirs(vocal_root, exist_ok=True) - X_wave, y_wave, X_spec_s, y_spec_s = {}, {}, {}, {} - bands_n = len(self.mp.param["band"]) - # print(bands_n) - for d in range(bands_n, 0, -1): - bp = self.mp.param["band"][d] - if d == bands_n: # high-end band - ( - X_wave[d], - _, - ) = librosa.core.load( # 理论上librosa读取可能对某些音频有bug,应该上ffmpeg读取,但是太麻烦了弃坑 - music_file, - bp["sr"], - False, - dtype=np.float32, - res_type=bp["res_type"], - ) - if X_wave[d].ndim == 1: - X_wave[d] = np.asfortranarray([X_wave[d], X_wave[d]]) - else: # lower bands - X_wave[d] = librosa.core.resample( - X_wave[d + 1], - self.mp.param["band"][d + 1]["sr"], - bp["sr"], - res_type=bp["res_type"], - ) - # Stft of wave source - X_spec_s[d] = spec_utils.wave_to_spectrogram_mt( - X_wave[d], - bp["hl"], - bp["n_fft"], - self.mp.param["mid_side"], - self.mp.param["mid_side_b2"], - self.mp.param["reverse"], - ) - # pdb.set_trace() - if d == bands_n and self.data["high_end_process"] != "none": - input_high_end_h = (bp["n_fft"] // 2 - bp["crop_stop"]) + ( - self.mp.param["pre_filter_stop"] - self.mp.param["pre_filter_start"] - ) - input_high_end = X_spec_s[d][ - :, bp["n_fft"] // 2 - input_high_end_h : bp["n_fft"] // 2, : - ] - - X_spec_m = spec_utils.combine_spectrograms(X_spec_s, self.mp) - aggresive_set = float(self.data["agg"] / 100) - aggressiveness = { - "value": aggresive_set, - "split_bin": self.mp.param["band"][1]["crop_stop"], - } - with torch.no_grad(): - pred, X_mag, X_phase = inference( - X_spec_m, self.device, self.model, aggressiveness, self.data - ) - # Postprocess - if self.data["postprocess"]: - pred_inv = np.clip(X_mag - pred, 0, np.inf) - pred = spec_utils.mask_silence(pred, pred_inv) - y_spec_m = pred * X_phase - v_spec_m = X_spec_m - y_spec_m - - if ins_root is not None: - if self.data["high_end_process"].startswith("mirroring"): - input_high_end_ = spec_utils.mirroring( - self.data["high_end_process"], y_spec_m, input_high_end, self.mp - ) - wav_instrument = spec_utils.cmb_spectrogram_to_wave( - y_spec_m, self.mp, input_high_end_h, input_high_end_ - ) - else: - wav_instrument = spec_utils.cmb_spectrogram_to_wave(y_spec_m, self.mp) - logger.info("%s instruments done" % name) - if format in ["wav", "flac"]: - sf.write( - os.path.join( - ins_root, - "instrument_{}_{}.{}".format(name, self.data["agg"], format), - ), - (np.array(wav_instrument) * 32768).astype("int16"), - self.mp.param["sr"], - ) # - else: - path = os.path.join( - ins_root, "instrument_{}_{}.wav".format(name, self.data["agg"]) - ) - sf.write( - path, - (np.array(wav_instrument) * 32768).astype("int16"), - self.mp.param["sr"], - ) - if os.path.exists(path): - os.system( - "ffmpeg -i %s -vn %s -q:a 2 -y" - % (path, path[:-4] + ".%s" % format) - ) - if vocal_root is not None: - if self.data["high_end_process"].startswith("mirroring"): - input_high_end_ = spec_utils.mirroring( - self.data["high_end_process"], v_spec_m, input_high_end, self.mp - ) - wav_vocals = spec_utils.cmb_spectrogram_to_wave( - v_spec_m, self.mp, input_high_end_h, input_high_end_ - ) - else: - wav_vocals = spec_utils.cmb_spectrogram_to_wave(v_spec_m, self.mp) - logger.info("%s vocals done" % name) - if format in ["wav", "flac"]: - sf.write( - os.path.join( - vocal_root, - "vocal_{}_{}.{}".format(name, self.data["agg"], format), - ), - (np.array(wav_vocals) * 32768).astype("int16"), - self.mp.param["sr"], - ) - else: - path = os.path.join( - vocal_root, "vocal_{}_{}.wav".format(name, self.data["agg"]) - ) - sf.write( - path, - (np.array(wav_vocals) * 32768).astype("int16"), - self.mp.param["sr"], - ) - if os.path.exists(path): - os.system( - "ffmpeg -i %s -vn %s -q:a 2 -y" - % (path, path[:-4] + ".%s" % format) - ) diff --git a/spaces/Kangarroar/ApplioRVC-Inference/lib/infer_pack/modules/F0Predictor/__init__.py b/spaces/Kangarroar/ApplioRVC-Inference/lib/infer_pack/modules/F0Predictor/__init__.py deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/spaces/KarmKarma/genshinimpact-rvc-models-v2/lib/infer_pack/onnx_inference.py b/spaces/KarmKarma/genshinimpact-rvc-models-v2/lib/infer_pack/onnx_inference.py deleted file mode 100644 index c78324cbc08414fffcc689f325312de0e51bd6b4..0000000000000000000000000000000000000000 --- a/spaces/KarmKarma/genshinimpact-rvc-models-v2/lib/infer_pack/onnx_inference.py +++ /dev/null @@ -1,143 +0,0 @@ -import onnxruntime -import librosa -import numpy as np -import soundfile - - -class ContentVec: - def __init__(self, vec_path="pretrained/vec-768-layer-12.onnx", device=None): - print("load model(s) from {}".format(vec_path)) - if device == "cpu" or device is None: - providers = ["CPUExecutionProvider"] - elif device == "cuda": - providers = ["CUDAExecutionProvider", "CPUExecutionProvider"] - elif device == "dml": - providers = ["DmlExecutionProvider"] - else: - raise RuntimeError("Unsportted Device") - self.model = onnxruntime.InferenceSession(vec_path, providers=providers) - - def __call__(self, wav): - return self.forward(wav) - - def forward(self, wav): - feats = wav - if feats.ndim == 2: # double channels - feats = feats.mean(-1) - assert feats.ndim == 1, feats.ndim - feats = np.expand_dims(np.expand_dims(feats, 0), 0) - onnx_input = {self.model.get_inputs()[0].name: feats} - logits = self.model.run(None, onnx_input)[0] - return logits.transpose(0, 2, 1) - - -def get_f0_predictor(f0_predictor, hop_length, sampling_rate, **kargs): - if f0_predictor == "pm": - from lib.infer_pack.modules.F0Predictor.PMF0Predictor import PMF0Predictor - - f0_predictor_object = PMF0Predictor( - hop_length=hop_length, sampling_rate=sampling_rate - ) - elif f0_predictor == "harvest": - from lib.infer_pack.modules.F0Predictor.HarvestF0Predictor import HarvestF0Predictor - - f0_predictor_object = HarvestF0Predictor( - hop_length=hop_length, sampling_rate=sampling_rate - ) - elif f0_predictor == "dio": - from lib.infer_pack.modules.F0Predictor.DioF0Predictor import DioF0Predictor - - f0_predictor_object = DioF0Predictor( - hop_length=hop_length, sampling_rate=sampling_rate - ) - else: - raise Exception("Unknown f0 predictor") - return f0_predictor_object - - -class OnnxRVC: - def __init__( - self, - model_path, - sr=40000, - hop_size=512, - vec_path="vec-768-layer-12", - device="cpu", - ): - vec_path = f"pretrained/{vec_path}.onnx" - self.vec_model = ContentVec(vec_path, device) - if device == "cpu" or device is None: - providers = ["CPUExecutionProvider"] - elif device == "cuda": - providers = ["CUDAExecutionProvider", "CPUExecutionProvider"] - elif device == "dml": - providers = ["DmlExecutionProvider"] - else: - raise RuntimeError("Unsportted Device") - self.model = onnxruntime.InferenceSession(model_path, providers=providers) - self.sampling_rate = sr - self.hop_size = hop_size - - def forward(self, hubert, hubert_length, pitch, pitchf, ds, rnd): - onnx_input = { - self.model.get_inputs()[0].name: hubert, - self.model.get_inputs()[1].name: hubert_length, - self.model.get_inputs()[2].name: pitch, - self.model.get_inputs()[3].name: pitchf, - self.model.get_inputs()[4].name: ds, - self.model.get_inputs()[5].name: rnd, - } - return (self.model.run(None, onnx_input)[0] * 32767).astype(np.int16) - - def inference( - self, - raw_path, - sid, - f0_method="dio", - f0_up_key=0, - pad_time=0.5, - cr_threshold=0.02, - ): - f0_min = 50 - f0_max = 1100 - f0_mel_min = 1127 * np.log(1 + f0_min / 700) - f0_mel_max = 1127 * np.log(1 + f0_max / 700) - f0_predictor = get_f0_predictor( - f0_method, - hop_length=self.hop_size, - sampling_rate=self.sampling_rate, - threshold=cr_threshold, - ) - wav, sr = librosa.load(raw_path, sr=self.sampling_rate) - org_length = len(wav) - if org_length / sr > 50.0: - raise RuntimeError("Reached Max Length") - - wav16k = librosa.resample(wav, orig_sr=self.sampling_rate, target_sr=16000) - wav16k = wav16k - - hubert = self.vec_model(wav16k) - hubert = np.repeat(hubert, 2, axis=2).transpose(0, 2, 1).astype(np.float32) - hubert_length = hubert.shape[1] - - pitchf = f0_predictor.compute_f0(wav, hubert_length) - pitchf = pitchf * 2 ** (f0_up_key / 12) - pitch = pitchf.copy() - f0_mel = 1127 * np.log(1 + pitch / 700) - f0_mel[f0_mel > 0] = (f0_mel[f0_mel > 0] - f0_mel_min) * 254 / ( - f0_mel_max - f0_mel_min - ) + 1 - f0_mel[f0_mel <= 1] = 1 - f0_mel[f0_mel > 255] = 255 - pitch = np.rint(f0_mel).astype(np.int64) - - pitchf = pitchf.reshape(1, len(pitchf)).astype(np.float32) - pitch = pitch.reshape(1, len(pitch)) - ds = np.array([sid]).astype(np.int64) - - rnd = np.random.randn(1, 192, hubert_length).astype(np.float32) - hubert_length = np.array([hubert_length]).astype(np.int64) - - out_wav = self.forward(hubert, hubert_length, pitch, pitchf, ds, rnd).squeeze() - out_wav = np.pad(out_wav, (0, 2 * self.hop_size), "constant") - return out_wav[0:org_length] diff --git a/spaces/Kevin676/AutoGPT/autogpt/commands/web_requests.py b/spaces/Kevin676/AutoGPT/autogpt/commands/web_requests.py deleted file mode 100644 index 406338f46fc7b2381e0b1634c628b123ef20b685..0000000000000000000000000000000000000000 --- a/spaces/Kevin676/AutoGPT/autogpt/commands/web_requests.py +++ /dev/null @@ -1,190 +0,0 @@ -"""Browse a webpage and summarize it using the LLM model""" -from __future__ import annotations - -from urllib.parse import urljoin, urlparse - -import requests -from bs4 import BeautifulSoup -from requests import Response -from requests.compat import urljoin - -from autogpt.config import Config -from autogpt.memory import get_memory -from autogpt.processing.html import extract_hyperlinks, format_hyperlinks - -CFG = Config() -memory = get_memory(CFG) - -session = requests.Session() -session.headers.update({"User-Agent": CFG.user_agent}) - - -def is_valid_url(url: str) -> bool: - """Check if the URL is valid - - Args: - url (str): The URL to check - - Returns: - bool: True if the URL is valid, False otherwise - """ - try: - result = urlparse(url) - return all([result.scheme, result.netloc]) - except ValueError: - return False - - -def sanitize_url(url: str) -> str: - """Sanitize the URL - - Args: - url (str): The URL to sanitize - - Returns: - str: The sanitized URL - """ - return urljoin(url, urlparse(url).path) - - -def check_local_file_access(url: str) -> bool: - """Check if the URL is a local file - - Args: - url (str): The URL to check - - Returns: - bool: True if the URL is a local file, False otherwise - """ - local_prefixes = [ - "file:///", - "file://localhost/", - "file://localhost", - "http://localhost", - "http://localhost/", - "https://localhost", - "https://localhost/", - "http://2130706433", - "http://2130706433/", - "https://2130706433", - "https://2130706433/", - "http://127.0.0.1/", - "http://127.0.0.1", - "https://127.0.0.1/", - "https://127.0.0.1", - "https://0.0.0.0/", - "https://0.0.0.0", - "http://0.0.0.0/", - "http://0.0.0.0", - "http://0000", - "http://0000/", - "https://0000", - "https://0000/", - ] - return any(url.startswith(prefix) for prefix in local_prefixes) - - -def get_response( - url: str, timeout: int = 10 -) -> tuple[None, str] | tuple[Response, None]: - """Get the response from a URL - - Args: - url (str): The URL to get the response from - timeout (int): The timeout for the HTTP request - - Returns: - tuple[None, str] | tuple[Response, None]: The response and error message - - Raises: - ValueError: If the URL is invalid - requests.exceptions.RequestException: If the HTTP request fails - """ - try: - # Restrict access to local files - if check_local_file_access(url): - raise ValueError("Access to local files is restricted") - - # Most basic check if the URL is valid: - if not url.startswith("http://") and not url.startswith("https://"): - raise ValueError("Invalid URL format") - - sanitized_url = sanitize_url(url) - - response = session.get(sanitized_url, timeout=timeout) - - # Check if the response contains an HTTP error - if response.status_code >= 400: - return None, f"Error: HTTP {str(response.status_code)} error" - - return response, None - except ValueError as ve: - # Handle invalid URL format - return None, f"Error: {str(ve)}" - - except requests.exceptions.RequestException as re: - # Handle exceptions related to the HTTP request - # (e.g., connection errors, timeouts, etc.) - return None, f"Error: {str(re)}" - - -def scrape_text(url: str) -> str: - """Scrape text from a webpage - - Args: - url (str): The URL to scrape text from - - Returns: - str: The scraped text - """ - response, error_message = get_response(url) - if error_message: - return error_message - if not response: - return "Error: Could not get response" - - soup = BeautifulSoup(response.text, "html.parser") - - for script in soup(["script", "style"]): - script.extract() - - text = soup.get_text() - lines = (line.strip() for line in text.splitlines()) - chunks = (phrase.strip() for line in lines for phrase in line.split(" ")) - text = "\n".join(chunk for chunk in chunks if chunk) - - return text - - -def scrape_links(url: str) -> str | list[str]: - """Scrape links from a webpage - - Args: - url (str): The URL to scrape links from - - Returns: - str | list[str]: The scraped links - """ - response, error_message = get_response(url) - if error_message: - return error_message - if not response: - return "Error: Could not get response" - soup = BeautifulSoup(response.text, "html.parser") - - for script in soup(["script", "style"]): - script.extract() - - hyperlinks = extract_hyperlinks(soup, url) - - return format_hyperlinks(hyperlinks) - - -def create_message(chunk, question): - """Create a message for the user to summarize a chunk of text""" - return { - "role": "user", - "content": f'"""{chunk}""" Using the above text, answer the following' - f' question: "{question}" -- if the question cannot be answered using the' - " text, summarize the text.", - } diff --git a/spaces/LZRi/LZR-Bert-VITS2/attentions.py b/spaces/LZRi/LZR-Bert-VITS2/attentions.py deleted file mode 100644 index ecbdbc8be941a962046fc11fd6739b093112123e..0000000000000000000000000000000000000000 --- a/spaces/LZRi/LZR-Bert-VITS2/attentions.py +++ /dev/null @@ -1,343 +0,0 @@ -import copy -import math -import numpy as np -import torch -from torch import nn -from torch.nn import functional as F - -import commons -import modules -from torch.nn.utils import weight_norm, remove_weight_norm -class LayerNorm(nn.Module): - def __init__(self, channels, eps=1e-5): - super().__init__() - self.channels = channels - self.eps = eps - - self.gamma = nn.Parameter(torch.ones(channels)) - self.beta = nn.Parameter(torch.zeros(channels)) - - def forward(self, x): - x = x.transpose(1, -1) - x = F.layer_norm(x, (self.channels,), self.gamma, self.beta, self.eps) - return x.transpose(1, -1) - - - -@torch.jit.script -def fused_add_tanh_sigmoid_multiply(input_a, input_b, n_channels): - n_channels_int = n_channels[0] - in_act = input_a + input_b - t_act = torch.tanh(in_act[:, :n_channels_int, :]) - s_act = torch.sigmoid(in_act[:, n_channels_int:, :]) - acts = t_act * s_act - return acts - -class Encoder(nn.Module): - def __init__(self, hidden_channels, filter_channels, n_heads, n_layers, kernel_size=1, p_dropout=0., window_size=4, isflow = True, **kwargs): - super().__init__() - self.hidden_channels = hidden_channels - self.filter_channels = filter_channels - self.n_heads = n_heads - self.n_layers = n_layers - self.kernel_size = kernel_size - self.p_dropout = p_dropout - self.window_size = window_size - if isflow: - cond_layer = torch.nn.Conv1d(256, 2*hidden_channels*n_layers, 1) - self.cond_pre = torch.nn.Conv1d(hidden_channels, 2*hidden_channels, 1) - self.cond_layer = weight_norm(cond_layer, name='weight') - self.gin_channels = 256 - self.cond_layer_idx = self.n_layers - if 'gin_channels' in kwargs: - self.gin_channels = kwargs['gin_channels'] - if self.gin_channels != 0: - self.spk_emb_linear = nn.Linear(self.gin_channels, self.hidden_channels) - # vits2 says 3rd block, so idx is 2 by default - self.cond_layer_idx = kwargs['cond_layer_idx'] if 'cond_layer_idx' in kwargs else 2 - print(self.gin_channels, self.cond_layer_idx) - assert self.cond_layer_idx < self.n_layers, 'cond_layer_idx should be less than n_layers' - self.drop = nn.Dropout(p_dropout) - self.attn_layers = nn.ModuleList() - self.norm_layers_1 = nn.ModuleList() - self.ffn_layers = nn.ModuleList() - self.norm_layers_2 = nn.ModuleList() - for i in range(self.n_layers): - self.attn_layers.append(MultiHeadAttention(hidden_channels, hidden_channels, n_heads, p_dropout=p_dropout, window_size=window_size)) - self.norm_layers_1.append(LayerNorm(hidden_channels)) - self.ffn_layers.append(FFN(hidden_channels, hidden_channels, filter_channels, kernel_size, p_dropout=p_dropout)) - self.norm_layers_2.append(LayerNorm(hidden_channels)) - def forward(self, x, x_mask, g=None): - attn_mask = x_mask.unsqueeze(2) * x_mask.unsqueeze(-1) - x = x * x_mask - for i in range(self.n_layers): - if i == self.cond_layer_idx and g is not None: - g = self.spk_emb_linear(g.transpose(1, 2)) - g = g.transpose(1, 2) - x = x + g - x = x * x_mask - y = self.attn_layers[i](x, x, attn_mask) - y = self.drop(y) - x = self.norm_layers_1[i](x + y) - - y = self.ffn_layers[i](x, x_mask) - y = self.drop(y) - x = self.norm_layers_2[i](x + y) - x = x * x_mask - return x - - -class Decoder(nn.Module): - def __init__(self, hidden_channels, filter_channels, n_heads, n_layers, kernel_size=1, p_dropout=0., proximal_bias=False, proximal_init=True, **kwargs): - super().__init__() - self.hidden_channels = hidden_channels - self.filter_channels = filter_channels - self.n_heads = n_heads - self.n_layers = n_layers - self.kernel_size = kernel_size - self.p_dropout = p_dropout - self.proximal_bias = proximal_bias - self.proximal_init = proximal_init - - self.drop = nn.Dropout(p_dropout) - self.self_attn_layers = nn.ModuleList() - self.norm_layers_0 = nn.ModuleList() - self.encdec_attn_layers = nn.ModuleList() - self.norm_layers_1 = nn.ModuleList() - self.ffn_layers = nn.ModuleList() - self.norm_layers_2 = nn.ModuleList() - for i in range(self.n_layers): - self.self_attn_layers.append(MultiHeadAttention(hidden_channels, hidden_channels, n_heads, p_dropout=p_dropout, proximal_bias=proximal_bias, proximal_init=proximal_init)) - self.norm_layers_0.append(LayerNorm(hidden_channels)) - self.encdec_attn_layers.append(MultiHeadAttention(hidden_channels, hidden_channels, n_heads, p_dropout=p_dropout)) - self.norm_layers_1.append(LayerNorm(hidden_channels)) - self.ffn_layers.append(FFN(hidden_channels, hidden_channels, filter_channels, kernel_size, p_dropout=p_dropout, causal=True)) - self.norm_layers_2.append(LayerNorm(hidden_channels)) - - def forward(self, x, x_mask, h, h_mask): - """ - x: decoder input - h: encoder output - """ - self_attn_mask = commons.subsequent_mask(x_mask.size(2)).to(device=x.device, dtype=x.dtype) - encdec_attn_mask = h_mask.unsqueeze(2) * x_mask.unsqueeze(-1) - x = x * x_mask - for i in range(self.n_layers): - y = self.self_attn_layers[i](x, x, self_attn_mask) - y = self.drop(y) - x = self.norm_layers_0[i](x + y) - - y = self.encdec_attn_layers[i](x, h, encdec_attn_mask) - y = self.drop(y) - x = self.norm_layers_1[i](x + y) - - y = self.ffn_layers[i](x, x_mask) - y = self.drop(y) - x = self.norm_layers_2[i](x + y) - x = x * x_mask - return x - - -class MultiHeadAttention(nn.Module): - def __init__(self, channels, out_channels, n_heads, p_dropout=0., window_size=None, heads_share=True, block_length=None, proximal_bias=False, proximal_init=False): - super().__init__() - assert channels % n_heads == 0 - - self.channels = channels - self.out_channels = out_channels - self.n_heads = n_heads - self.p_dropout = p_dropout - self.window_size = window_size - self.heads_share = heads_share - self.block_length = block_length - self.proximal_bias = proximal_bias - self.proximal_init = proximal_init - self.attn = None - - self.k_channels = channels // n_heads - self.conv_q = nn.Conv1d(channels, channels, 1) - self.conv_k = nn.Conv1d(channels, channels, 1) - self.conv_v = nn.Conv1d(channels, channels, 1) - self.conv_o = nn.Conv1d(channels, out_channels, 1) - self.drop = nn.Dropout(p_dropout) - - if window_size is not None: - n_heads_rel = 1 if heads_share else n_heads - rel_stddev = self.k_channels**-0.5 - self.emb_rel_k = nn.Parameter(torch.randn(n_heads_rel, window_size * 2 + 1, self.k_channels) * rel_stddev) - self.emb_rel_v = nn.Parameter(torch.randn(n_heads_rel, window_size * 2 + 1, self.k_channels) * rel_stddev) - - nn.init.xavier_uniform_(self.conv_q.weight) - nn.init.xavier_uniform_(self.conv_k.weight) - nn.init.xavier_uniform_(self.conv_v.weight) - if proximal_init: - with torch.no_grad(): - self.conv_k.weight.copy_(self.conv_q.weight) - self.conv_k.bias.copy_(self.conv_q.bias) - - def forward(self, x, c, attn_mask=None): - q = self.conv_q(x) - k = self.conv_k(c) - v = self.conv_v(c) - - x, self.attn = self.attention(q, k, v, mask=attn_mask) - - x = self.conv_o(x) - return x - - def attention(self, query, key, value, mask=None): - # reshape [b, d, t] -> [b, n_h, t, d_k] - b, d, t_s, t_t = (*key.size(), query.size(2)) - query = query.view(b, self.n_heads, self.k_channels, t_t).transpose(2, 3) - key = key.view(b, self.n_heads, self.k_channels, t_s).transpose(2, 3) - value = value.view(b, self.n_heads, self.k_channels, t_s).transpose(2, 3) - - scores = torch.matmul(query / math.sqrt(self.k_channels), key.transpose(-2, -1)) - if self.window_size is not None: - assert t_s == t_t, "Relative attention is only available for self-attention." - key_relative_embeddings = self._get_relative_embeddings(self.emb_rel_k, t_s) - rel_logits = self._matmul_with_relative_keys(query /math.sqrt(self.k_channels), key_relative_embeddings) - scores_local = self._relative_position_to_absolute_position(rel_logits) - scores = scores + scores_local - if self.proximal_bias: - assert t_s == t_t, "Proximal bias is only available for self-attention." - scores = scores + self._attention_bias_proximal(t_s).to(device=scores.device, dtype=scores.dtype) - if mask is not None: - scores = scores.masked_fill(mask == 0, -1e4) - if self.block_length is not None: - assert t_s == t_t, "Local attention is only available for self-attention." - block_mask = torch.ones_like(scores).triu(-self.block_length).tril(self.block_length) - scores = scores.masked_fill(block_mask == 0, -1e4) - p_attn = F.softmax(scores, dim=-1) # [b, n_h, t_t, t_s] - p_attn = self.drop(p_attn) - output = torch.matmul(p_attn, value) - if self.window_size is not None: - relative_weights = self._absolute_position_to_relative_position(p_attn) - value_relative_embeddings = self._get_relative_embeddings(self.emb_rel_v, t_s) - output = output + self._matmul_with_relative_values(relative_weights, value_relative_embeddings) - output = output.transpose(2, 3).contiguous().view(b, d, t_t) # [b, n_h, t_t, d_k] -> [b, d, t_t] - return output, p_attn - - def _matmul_with_relative_values(self, x, y): - """ - x: [b, h, l, m] - y: [h or 1, m, d] - ret: [b, h, l, d] - """ - ret = torch.matmul(x, y.unsqueeze(0)) - return ret - - def _matmul_with_relative_keys(self, x, y): - """ - x: [b, h, l, d] - y: [h or 1, m, d] - ret: [b, h, l, m] - """ - ret = torch.matmul(x, y.unsqueeze(0).transpose(-2, -1)) - return ret - - def _get_relative_embeddings(self, relative_embeddings, length): - max_relative_position = 2 * self.window_size + 1 - # Pad first before slice to avoid using cond ops. - pad_length = max(length - (self.window_size + 1), 0) - slice_start_position = max((self.window_size + 1) - length, 0) - slice_end_position = slice_start_position + 2 * length - 1 - if pad_length > 0: - padded_relative_embeddings = F.pad( - relative_embeddings, - commons.convert_pad_shape([[0, 0], [pad_length, pad_length], [0, 0]])) - else: - padded_relative_embeddings = relative_embeddings - used_relative_embeddings = padded_relative_embeddings[:,slice_start_position:slice_end_position] - return used_relative_embeddings - - def _relative_position_to_absolute_position(self, x): - """ - x: [b, h, l, 2*l-1] - ret: [b, h, l, l] - """ - batch, heads, length, _ = x.size() - # Concat columns of pad to shift from relative to absolute indexing. - x = F.pad(x, commons.convert_pad_shape([[0,0],[0,0],[0,0],[0,1]])) - - # Concat extra elements so to add up to shape (len+1, 2*len-1). - x_flat = x.view([batch, heads, length * 2 * length]) - x_flat = F.pad(x_flat, commons.convert_pad_shape([[0,0],[0,0],[0,length-1]])) - - # Reshape and slice out the padded elements. - x_final = x_flat.view([batch, heads, length+1, 2*length-1])[:, :, :length, length-1:] - return x_final - - def _absolute_position_to_relative_position(self, x): - """ - x: [b, h, l, l] - ret: [b, h, l, 2*l-1] - """ - batch, heads, length, _ = x.size() - # padd along column - x = F.pad(x, commons.convert_pad_shape([[0, 0], [0, 0], [0, 0], [0, length-1]])) - x_flat = x.view([batch, heads, length**2 + length*(length -1)]) - # add 0's in the beginning that will skew the elements after reshape - x_flat = F.pad(x_flat, commons.convert_pad_shape([[0, 0], [0, 0], [length, 0]])) - x_final = x_flat.view([batch, heads, length, 2*length])[:,:,:,1:] - return x_final - - def _attention_bias_proximal(self, length): - """Bias for self-attention to encourage attention to close positions. - Args: - length: an integer scalar. - Returns: - a Tensor with shape [1, 1, length, length] - """ - r = torch.arange(length, dtype=torch.float32) - diff = torch.unsqueeze(r, 0) - torch.unsqueeze(r, 1) - return torch.unsqueeze(torch.unsqueeze(-torch.log1p(torch.abs(diff)), 0), 0) - - -class FFN(nn.Module): - def __init__(self, in_channels, out_channels, filter_channels, kernel_size, p_dropout=0., activation=None, causal=False): - super().__init__() - self.in_channels = in_channels - self.out_channels = out_channels - self.filter_channels = filter_channels - self.kernel_size = kernel_size - self.p_dropout = p_dropout - self.activation = activation - self.causal = causal - - if causal: - self.padding = self._causal_padding - else: - self.padding = self._same_padding - - self.conv_1 = nn.Conv1d(in_channels, filter_channels, kernel_size) - self.conv_2 = nn.Conv1d(filter_channels, out_channels, kernel_size) - self.drop = nn.Dropout(p_dropout) - - def forward(self, x, x_mask): - x = self.conv_1(self.padding(x * x_mask)) - if self.activation == "gelu": - x = x * torch.sigmoid(1.702 * x) - else: - x = torch.relu(x) - x = self.drop(x) - x = self.conv_2(self.padding(x * x_mask)) - return x * x_mask - - def _causal_padding(self, x): - if self.kernel_size == 1: - return x - pad_l = self.kernel_size - 1 - pad_r = 0 - padding = [[0, 0], [0, 0], [pad_l, pad_r]] - x = F.pad(x, commons.convert_pad_shape(padding)) - return x - - def _same_padding(self, x): - if self.kernel_size == 1: - return x - pad_l = (self.kernel_size - 1) // 2 - pad_r = self.kernel_size // 2 - padding = [[0, 0], [0, 0], [pad_l, pad_r]] - x = F.pad(x, commons.convert_pad_shape(padding)) - return x diff --git a/spaces/Lamai/LAMAIGPT/autogpt/configurator.py b/spaces/Lamai/LAMAIGPT/autogpt/configurator.py deleted file mode 100644 index 1dc3be124f638b8859eb459bcb2d46696f62e2b7..0000000000000000000000000000000000000000 --- a/spaces/Lamai/LAMAIGPT/autogpt/configurator.py +++ /dev/null @@ -1,134 +0,0 @@ -"""Configurator module.""" -import click -from colorama import Back, Fore, Style - -from autogpt import utils -from autogpt.config import Config -from autogpt.logs import logger -from autogpt.memory import get_supported_memory_backends - -CFG = Config() - - -def create_config( - continuous: bool, - continuous_limit: int, - ai_settings_file: str, - skip_reprompt: bool, - speak: bool, - debug: bool, - gpt3only: bool, - gpt4only: bool, - memory_type: str, - browser_name: str, - allow_downloads: bool, - skip_news: bool, -) -> None: - """Updates the config object with the given arguments. - - Args: - continuous (bool): Whether to run in continuous mode - continuous_limit (int): The number of times to run in continuous mode - ai_settings_file (str): The path to the ai_settings.yaml file - skip_reprompt (bool): Whether to skip the re-prompting messages at the beginning of the script - speak (bool): Whether to enable speak mode - debug (bool): Whether to enable debug mode - gpt3only (bool): Whether to enable GPT3.5 only mode - gpt4only (bool): Whether to enable GPT4 only mode - memory_type (str): The type of memory backend to use - browser_name (str): The name of the browser to use when using selenium to scrape the web - allow_downloads (bool): Whether to allow Auto-GPT to download files natively - skips_news (bool): Whether to suppress the output of latest news on startup - """ - CFG.set_debug_mode(False) - CFG.set_continuous_mode(False) - CFG.set_speak_mode(False) - - if debug: - logger.typewriter_log("Debug Mode: ", Fore.GREEN, "ENABLED") - CFG.set_debug_mode(True) - - if continuous: - logger.typewriter_log("Continuous Mode: ", Fore.RED, "ENABLED") - logger.typewriter_log( - "WARNING: ", - Fore.RED, - "Continuous mode is not recommended. It is potentially dangerous and may" - " cause your AI to run forever or carry out actions you would not usually" - " authorise. Use at your own risk.", - ) - CFG.set_continuous_mode(True) - - if continuous_limit: - logger.typewriter_log( - "Continuous Limit: ", Fore.GREEN, f"{continuous_limit}" - ) - CFG.set_continuous_limit(continuous_limit) - - # Check if continuous limit is used without continuous mode - if continuous_limit and not continuous: - raise click.UsageError("--continuous-limit can only be used with --continuous") - - if speak: - logger.typewriter_log("Speak Mode: ", Fore.GREEN, "ENABLED") - CFG.set_speak_mode(True) - - if gpt3only: - logger.typewriter_log("GPT3.5 Only Mode: ", Fore.GREEN, "ENABLED") - CFG.set_smart_llm_model(CFG.fast_llm_model) - - if gpt4only: - logger.typewriter_log("GPT4 Only Mode: ", Fore.GREEN, "ENABLED") - CFG.set_fast_llm_model(CFG.smart_llm_model) - - if memory_type: - supported_memory = get_supported_memory_backends() - chosen = memory_type - if chosen not in supported_memory: - logger.typewriter_log( - "ONLY THE FOLLOWING MEMORY BACKENDS ARE SUPPORTED: ", - Fore.RED, - f"{supported_memory}", - ) - logger.typewriter_log("Defaulting to: ", Fore.YELLOW, CFG.memory_backend) - else: - CFG.memory_backend = chosen - - if skip_reprompt: - logger.typewriter_log("Skip Re-prompt: ", Fore.GREEN, "ENABLED") - CFG.skip_reprompt = True - - if ai_settings_file: - file = ai_settings_file - - # Validate file - (validated, message) = utils.validate_yaml_file(file) - if not validated: - logger.typewriter_log("FAILED FILE VALIDATION", Fore.RED, message) - logger.double_check() - exit(1) - - logger.typewriter_log("Using AI Settings File:", Fore.GREEN, file) - CFG.ai_settings_file = file - CFG.skip_reprompt = True - - if allow_downloads: - logger.typewriter_log("Native Downloading:", Fore.GREEN, "ENABLED") - logger.typewriter_log( - "WARNING: ", - Fore.YELLOW, - f"{Back.LIGHTYELLOW_EX}Auto-GPT will now be able to download and save files to your machine.{Back.RESET} " - + "It is recommended that you monitor any files it downloads carefully.", - ) - logger.typewriter_log( - "WARNING: ", - Fore.YELLOW, - f"{Back.RED + Style.BRIGHT}ALWAYS REMEMBER TO NEVER OPEN FILES YOU AREN'T SURE OF!{Style.RESET_ALL}", - ) - CFG.allow_downloads = True - - if skip_news: - CFG.skip_news = True - - if browser_name: - CFG.selenium_web_browser = browser_name diff --git a/spaces/Lbin123/Lbingo/src/lib/utils.ts b/spaces/Lbin123/Lbingo/src/lib/utils.ts deleted file mode 100644 index 07feedb34e356b1b3cf867872f32d47a96ae12fb..0000000000000000000000000000000000000000 --- a/spaces/Lbin123/Lbingo/src/lib/utils.ts +++ /dev/null @@ -1,138 +0,0 @@ -import { clsx, type ClassValue } from 'clsx' -import { customAlphabet } from 'nanoid' -import { twMerge } from 'tailwind-merge' - -export function cn(...inputs: ClassValue[]) { - return twMerge(clsx(inputs)) -} - -export const nanoid = customAlphabet( - '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz', - 7 -) // 7-character random string - -export function createChunkDecoder() { - const decoder = new TextDecoder() - return function (chunk: Uint8Array | undefined): string { - if (!chunk) return '' - return decoder.decode(chunk, { stream: true }) - } -} - -export function random (start: number, end: number) { - return start + Math.ceil(Math.random() * (end - start)) -} - -export function randomIP() { - return `11.${random(104, 107)}.${random(1, 255)}.${random(1, 255)}` -} - -export function parseHeadersFromCurl(content: string) { - const re = /-H '([^:]+):\s*([^']+)/mg - const headers: HeadersInit = {} - content = content.replaceAll('-H "', '-H \'').replaceAll('" ^', '\'\\').replaceAll('^\\^"', '"') // 将 cmd curl 转成 bash curl - content.replace(re, (_: string, key: string, value: string) => { - headers[key] = value - return '' - }) - - return headers -} - -export const ChunkKeys = ['BING_HEADER', 'BING_HEADER1', 'BING_HEADER2'] -export function encodeHeadersToCookie(content: string) { - const base64Content = btoa(content) - const contentChunks = base64Content.match(/.{1,4000}/g) || [] - return ChunkKeys.map((key, index) => `${key}=${contentChunks[index] ?? ''}`) -} - -export function extraCurlFromCookie(cookies: Partial<{ [key: string]: string }>) { - let base64Content = '' - ChunkKeys.forEach((key) => { - base64Content += (cookies[key] || '') - }) - try { - return atob(base64Content) - } catch(e) { - return '' - } -} - -export function extraHeadersFromCookie(cookies: Partial<{ [key: string]: string }>) { - return parseHeadersFromCurl(extraCurlFromCookie(cookies)) -} - -export function formatDate(input: string | number | Date): string { - const date = new Date(input) - return date.toLocaleDateString('en-US', { - month: 'long', - day: 'numeric', - year: 'numeric' - }) -} - -export function parseCookie(cookie: string, cookieName: string) { - const targetCookie = new RegExp(`(?:[; ]|^)${cookieName}=([^;]*)`).test(cookie) ? RegExp.$1 : cookie - return targetCookie ? decodeURIComponent(targetCookie).trim() : cookie.indexOf('=') === -1 ? cookie.trim() : '' -} - -export function parseCookies(cookie: string, cookieNames: string[]) { - const cookies: { [key: string]: string } = {} - cookieNames.forEach(cookieName => { - cookies[cookieName] = parseCookie(cookie, cookieName) - }) - return cookies -} - -export const DEFAULT_UA = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36 Edg/115.0.0.0' -export const DEFAULT_IP = process.env.BING_IP || randomIP() - -export function parseUA(ua?: string, default_ua = DEFAULT_UA) { - return / EDGE?/i.test(decodeURIComponent(ua || '')) ? decodeURIComponent(ua!.trim()) : default_ua -} - -export function createHeaders(cookies: Partial<{ [key: string]: string }>, defaultHeaders?: Partial<{ [key: string]: string }>) { - let { - BING_COOKIE = process.env.BING_COOKIE, - BING_UA = process.env.BING_UA, - BING_IP = process.env.BING_IP, - BING_HEADER = process.env.BING_HEADER, - } = cookies - - if (BING_HEADER) { - return extraHeadersFromCookie({ - BING_HEADER, - ...cookies, - }) - } - - const ua = parseUA(BING_UA) - - if (!BING_COOKIE) { - BING_COOKIE = defaultHeaders?.IMAGE_BING_COOKIE || 'xxx' // hf 暂时不用 Cookie 也可以正常使用 - } - - const parsedCookie = parseCookie(BING_COOKIE, '_U') - if (!parsedCookie) { - throw new Error('Invalid Cookie') - } - return { - 'x-forwarded-for': BING_IP || DEFAULT_IP, - 'Accept-Encoding': 'gzip, deflate, br', - 'Accept-Language': 'zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6', - 'User-Agent': ua!, - 'x-ms-useragent': 'azsdk-js-api-client-factory/1.0.0-beta.1 core-rest-pipeline/1.10.0 OS/Win32', - cookie: `_U=${parsedCookie}` || '', - } -} - -export class WatchDog { - private tid = 0 - watch(fn: Function, timeout = 2000) { - clearTimeout(this.tid) - this.tid = setTimeout(fn, timeout + Math.random() * 1000) - } - reset() { - clearTimeout(this.tid) - } -} diff --git a/spaces/Liu-LAB/GPT-academic/themes/default.py b/spaces/Liu-LAB/GPT-academic/themes/default.py deleted file mode 100644 index 2611e7aab7e7b6a41a3ef4c21a4f47b22409bebe..0000000000000000000000000000000000000000 --- a/spaces/Liu-LAB/GPT-academic/themes/default.py +++ /dev/null @@ -1,88 +0,0 @@ -import gradio as gr -from toolbox import get_conf -CODE_HIGHLIGHT, ADD_WAIFU, LAYOUT = get_conf('CODE_HIGHLIGHT', 'ADD_WAIFU', 'LAYOUT') - -def adjust_theme(): - - try: - color_er = gr.themes.utils.colors.fuchsia - set_theme = gr.themes.Default( - primary_hue=gr.themes.utils.colors.orange, - neutral_hue=gr.themes.utils.colors.gray, - font=["Helvetica", "Microsoft YaHei", "ui-sans-serif", "sans-serif", "system-ui"], - font_mono=["ui-monospace", "Consolas", "monospace"]) - set_theme.set( - # Colors - input_background_fill_dark="*neutral_800", - # Transition - button_transition="none", - # Shadows - button_shadow="*shadow_drop", - button_shadow_hover="*shadow_drop_lg", - button_shadow_active="*shadow_inset", - input_shadow="0 0 0 *shadow_spread transparent, *shadow_inset", - input_shadow_focus="0 0 0 *shadow_spread *secondary_50, *shadow_inset", - input_shadow_focus_dark="0 0 0 *shadow_spread *neutral_700, *shadow_inset", - checkbox_label_shadow="*shadow_drop", - block_shadow="*shadow_drop", - form_gap_width="1px", - # Button borders - input_border_width="1px", - input_background_fill="white", - # Gradients - stat_background_fill="linear-gradient(to right, *primary_400, *primary_200)", - stat_background_fill_dark="linear-gradient(to right, *primary_400, *primary_600)", - error_background_fill=f"linear-gradient(to right, {color_er.c100}, *background_fill_secondary)", - error_background_fill_dark="*background_fill_primary", - checkbox_label_background_fill="linear-gradient(to top, *neutral_50, white)", - checkbox_label_background_fill_dark="linear-gradient(to top, *neutral_900, *neutral_800)", - checkbox_label_background_fill_hover="linear-gradient(to top, *neutral_100, white)", - checkbox_label_background_fill_hover_dark="linear-gradient(to top, *neutral_900, *neutral_800)", - button_primary_background_fill="linear-gradient(to bottom right, *primary_100, *primary_300)", - button_primary_background_fill_dark="linear-gradient(to bottom right, *primary_500, *primary_600)", - button_primary_background_fill_hover="linear-gradient(to bottom right, *primary_100, *primary_200)", - button_primary_background_fill_hover_dark="linear-gradient(to bottom right, *primary_500, *primary_500)", - button_primary_border_color_dark="*primary_500", - button_secondary_background_fill="linear-gradient(to bottom right, *neutral_100, *neutral_200)", - button_secondary_background_fill_dark="linear-gradient(to bottom right, *neutral_600, *neutral_700)", - button_secondary_background_fill_hover="linear-gradient(to bottom right, *neutral_100, *neutral_100)", - button_secondary_background_fill_hover_dark="linear-gradient(to bottom right, *neutral_600, *neutral_600)", - button_cancel_background_fill=f"linear-gradient(to bottom right, {color_er.c100}, {color_er.c200})", - button_cancel_background_fill_dark=f"linear-gradient(to bottom right, {color_er.c600}, {color_er.c700})", - button_cancel_background_fill_hover=f"linear-gradient(to bottom right, {color_er.c100}, {color_er.c100})", - button_cancel_background_fill_hover_dark=f"linear-gradient(to bottom right, {color_er.c600}, {color_er.c600})", - button_cancel_border_color=color_er.c200, - button_cancel_border_color_dark=color_er.c600, - button_cancel_text_color=color_er.c600, - button_cancel_text_color_dark="white", - ) - - if LAYOUT=="TOP-DOWN": - js = "" - else: - with open('themes/common.js', 'r', encoding='utf8') as f: - js = f"" - - # 添加一个萌萌的看板娘 - if ADD_WAIFU: - js += """ - - - - """ - gradio_original_template_fn = gr.routes.templates.TemplateResponse - def gradio_new_template_fn(*args, **kwargs): - res = gradio_original_template_fn(*args, **kwargs) - res.body = res.body.replace(b'', f'{js}'.encode("utf8")) - res.init_headers() - return res - gr.routes.templates.TemplateResponse = gradio_new_template_fn # override gradio template - except: - set_theme = None - print('gradio版本较旧, 不能自定义字体和颜色') - return set_theme - -with open("themes/default.css", "r", encoding="utf-8") as f: - advanced_css = f.read() -with open("themes/common.css", "r", encoding="utf-8") as f: - advanced_css += f.read() diff --git a/spaces/Loren/Streamlit_OCR_comparator/configs/textdet/dbnetpp/README.md b/spaces/Loren/Streamlit_OCR_comparator/configs/textdet/dbnetpp/README.md deleted file mode 100644 index 995254cb89c1b88bb3698d9d550f8e0ac7ba69f6..0000000000000000000000000000000000000000 --- a/spaces/Loren/Streamlit_OCR_comparator/configs/textdet/dbnetpp/README.md +++ /dev/null @@ -1,33 +0,0 @@ -# DBNetpp - -> [Real-Time Scene Text Detection with Differentiable Binarization and Adaptive Scale Fusion](https://arxiv.org/abs/2202.10304) - - - -## Abstract - -Recently, segmentation-based scene text detection methods have drawn extensive attention in the scene text detection field, because of their superiority in detecting the text instances of arbitrary shapes and extreme aspect ratios, profiting from the pixel-level descriptions. However, the vast majority of the existing segmentation-based approaches are limited to their complex post-processing algorithms and the scale robustness of their segmentation models, where the post-processing algorithms are not only isolated to the model optimization but also time-consuming and the scale robustness is usually strengthened by fusing multi-scale feature maps directly. In this paper, we propose a Differentiable Binarization (DB) module that integrates the binarization process, one of the most important steps in the post-processing procedure, into a segmentation network. Optimized along with the proposed DB module, the segmentation network can produce more accurate results, which enhances the accuracy of text detection with a simple pipeline. Furthermore, an efficient Adaptive Scale Fusion (ASF) module is proposed to improve the scale robustness by fusing features of different scales adaptively. By incorporating the proposed DB and ASF with the segmentation network, our proposed scene text detector consistently achieves state-of-the-art results, in terms of both detection accuracy and speed, on five standard benchmarks. - -
      - -
      - -## Results and models - -### ICDAR2015 - -| Method | Pretrained Model | Training set | Test set | #epochs | Test size | Recall | Precision | Hmean | Download | -| :---------------------------------------: | :-------------------------------------------------: | :-------------: | :------------: | :-----: | :-------: | :----: | :-------: | :---: | :-----------------------------------------: | -| [DBNetpp_r50dcn](/configs/textdet/dbnetpp/dbnetpp_r50dcnv2_fpnc_1200e_icdar2015.py) | [Synthtext](/configs/textdet/dbnetpp/dbnetpp_r50dcnv2_fpnc_100k_iter_synthtext.py) ([model](https://download.openmmlab.com/mmocr/textdet/dbnet/dbnetpp_r50dcnv2_fpnc_100k_iter_synthtext-20220502-db297554.pth) \| [log](https://download.openmmlab.com/mmocr/textdet/dbnet/dbnetpp_r50dcnv2_fpnc_100k_iter_synthtext-20220502-db297554.log.json)) | ICDAR2015 Train | ICDAR2015 Test | 1200 | 1024 | 0.822 | 0.901 | 0.860 | [model](https://download.openmmlab.com/mmocr/textdet/dbnet/dbnetpp_r50dcnv2_fpnc_1200e_icdar2015-20220502-d7a76fff.pth) \| [log](https://download.openmmlab.com/mmocr/textdet/dbnet/dbnetpp_r50dcnv2_fpnc_1200e_icdar2015-20220502-d7a76fff.log.json) | - -## Citation - -```bibtex -@article{liao2022real, - title={Real-Time Scene Text Detection with Differentiable Binarization and Adaptive Scale Fusion}, - author={Liao, Minghui and Zou, Zhisheng and Wan, Zhaoyi and Yao, Cong and Bai, Xiang}, - journal={IEEE Transactions on Pattern Analysis and Machine Intelligence}, - year={2022}, - publisher={IEEE} -} -``` diff --git a/spaces/MMMMQZ/MQZGPT/chatgpt - windows.bat b/spaces/MMMMQZ/MQZGPT/chatgpt - windows.bat deleted file mode 100644 index 0b78fdc3a559abd692e3a9e9af5e482124d13a99..0000000000000000000000000000000000000000 --- a/spaces/MMMMQZ/MQZGPT/chatgpt - windows.bat +++ /dev/null @@ -1,14 +0,0 @@ -@echo off -echo Opening ChuanhuChatGPT... - -REM Open powershell via bat -start powershell.exe -NoExit -Command "python ./ChuanhuChatbot.py" - -REM The web page can be accessed with delayed start http://127.0.0.1:7860/ -ping -n 5 127.0.0.1>nul - -REM access chargpt via your default browser -start "" "http://127.0.0.1:7860/" - - -echo Finished opening ChuanhuChatGPT (http://127.0.0.1:7860/). \ No newline at end of file diff --git a/spaces/Mahiruoshi/lovelive-ShojoKageki-vits/attentions.py b/spaces/Mahiruoshi/lovelive-ShojoKageki-vits/attentions.py deleted file mode 100644 index f8e5112051bae41715bed99a7b6e14ef54b18f60..0000000000000000000000000000000000000000 --- a/spaces/Mahiruoshi/lovelive-ShojoKageki-vits/attentions.py +++ /dev/null @@ -1,392 +0,0 @@ -import math - -import torch -from torch import nn -from torch.nn import functional as F - -import commons -from modules import LayerNorm - - -class Encoder(nn.Module): - def __init__(self, - hidden_channels, - filter_channels, - n_heads, - n_layers, - kernel_size=1, - p_dropout=0., - window_size=4, - **kwargs): - super().__init__() - self.hidden_channels = hidden_channels - self.filter_channels = filter_channels - self.n_heads = n_heads - self.n_layers = n_layers - self.kernel_size = kernel_size - self.p_dropout = p_dropout - self.window_size = window_size - - self.drop = nn.Dropout(p_dropout) - self.attn_layers = nn.ModuleList() - self.norm_layers_1 = nn.ModuleList() - self.ffn_layers = nn.ModuleList() - self.norm_layers_2 = nn.ModuleList() - for i in range(self.n_layers): - self.attn_layers.append( - MultiHeadAttention(hidden_channels, - hidden_channels, - n_heads, - p_dropout=p_dropout, - window_size=window_size)) - self.norm_layers_1.append(LayerNorm(hidden_channels)) - self.ffn_layers.append( - FFN(hidden_channels, - hidden_channels, - filter_channels, - kernel_size, - p_dropout=p_dropout)) - self.norm_layers_2.append(LayerNorm(hidden_channels)) - - def forward(self, x, x_mask): - attn_mask = x_mask.unsqueeze(2) * x_mask.unsqueeze(-1) - x = x * x_mask - for i in range(self.n_layers): - y = self.attn_layers[i](x, x, attn_mask) - y = self.drop(y) - x = self.norm_layers_1[i](x + y) - - y = self.ffn_layers[i](x, x_mask) - y = self.drop(y) - x = self.norm_layers_2[i](x + y) - x = x * x_mask - return x - - -class Decoder(nn.Module): - def __init__(self, - hidden_channels, - filter_channels, - n_heads, - n_layers, - kernel_size=1, - p_dropout=0., - proximal_bias=False, - proximal_init=True, - **kwargs): - super().__init__() - self.hidden_channels = hidden_channels - self.filter_channels = filter_channels - self.n_heads = n_heads - self.n_layers = n_layers - self.kernel_size = kernel_size - self.p_dropout = p_dropout - self.proximal_bias = proximal_bias - self.proximal_init = proximal_init - - self.drop = nn.Dropout(p_dropout) - self.self_attn_layers = nn.ModuleList() - self.norm_layers_0 = nn.ModuleList() - self.encdec_attn_layers = nn.ModuleList() - self.norm_layers_1 = nn.ModuleList() - self.ffn_layers = nn.ModuleList() - self.norm_layers_2 = nn.ModuleList() - for i in range(self.n_layers): - self.self_attn_layers.append( - MultiHeadAttention(hidden_channels, - hidden_channels, - n_heads, - p_dropout=p_dropout, - proximal_bias=proximal_bias, - proximal_init=proximal_init)) - self.norm_layers_0.append(LayerNorm(hidden_channels)) - self.encdec_attn_layers.append( - MultiHeadAttention(hidden_channels, - hidden_channels, - n_heads, - p_dropout=p_dropout)) - self.norm_layers_1.append(LayerNorm(hidden_channels)) - self.ffn_layers.append( - FFN(hidden_channels, - hidden_channels, - filter_channels, - kernel_size, - p_dropout=p_dropout, - causal=True)) - self.norm_layers_2.append(LayerNorm(hidden_channels)) - - def forward(self, x, x_mask, h, h_mask): - """ - x: decoder input - h: encoder output - """ - self_attn_mask = commons.subsequent_mask(x_mask.size(2)).to( - device=x.device, dtype=x.dtype) - encdec_attn_mask = h_mask.unsqueeze(2) * x_mask.unsqueeze(-1) - x = x * x_mask - for i in range(self.n_layers): - y = self.self_attn_layers[i](x, x, self_attn_mask) - y = self.drop(y) - x = self.norm_layers_0[i](x + y) - - y = self.encdec_attn_layers[i](x, h, encdec_attn_mask) - y = self.drop(y) - x = self.norm_layers_1[i](x + y) - - y = self.ffn_layers[i](x, x_mask) - y = self.drop(y) - x = self.norm_layers_2[i](x + y) - x = x * x_mask - return x - - -class MultiHeadAttention(nn.Module): - def __init__(self, - channels, - out_channels, - n_heads, - p_dropout=0., - window_size=None, - heads_share=True, - block_length=None, - proximal_bias=False, - proximal_init=False): - super().__init__() - assert channels % n_heads == 0 - - self.channels = channels - self.out_channels = out_channels - self.n_heads = n_heads - self.p_dropout = p_dropout - self.window_size = window_size - self.heads_share = heads_share - self.block_length = block_length - self.proximal_bias = proximal_bias - self.proximal_init = proximal_init - self.attn = None - - self.k_channels = channels // n_heads - self.conv_q = nn.Conv1d(channels, channels, 1) - self.conv_k = nn.Conv1d(channels, channels, 1) - self.conv_v = nn.Conv1d(channels, channels, 1) - self.conv_o = nn.Conv1d(channels, out_channels, 1) - self.drop = nn.Dropout(p_dropout) - - if window_size is not None: - n_heads_rel = 1 if heads_share else n_heads - rel_stddev = self.k_channels**-0.5 - self.emb_rel_k = nn.Parameter( - torch.randn(n_heads_rel, window_size * 2 + 1, self.k_channels) - * rel_stddev) - self.emb_rel_v = nn.Parameter( - torch.randn(n_heads_rel, window_size * 2 + 1, self.k_channels) - * rel_stddev) - - nn.init.xavier_uniform_(self.conv_q.weight) - nn.init.xavier_uniform_(self.conv_k.weight) - nn.init.xavier_uniform_(self.conv_v.weight) - if proximal_init: - with torch.no_grad(): - self.conv_k.weight.copy_(self.conv_q.weight) - self.conv_k.bias.copy_(self.conv_q.bias) - - def forward(self, x, c, attn_mask=None): - q = self.conv_q(x) - k = self.conv_k(c) - v = self.conv_v(c) - - x, self.attn = self.attention(q, k, v, mask=attn_mask) - - x = self.conv_o(x) - return x - - def attention(self, query, key, value, mask=None): - # reshape [b, d, t] -> [b, n_h, t, d_k] - b, d, t_s, t_t = (*key.size(), query.size(2)) - query = query.view(b, self.n_heads, self.k_channels, - t_t).transpose(2, 3) - key = key.view(b, self.n_heads, self.k_channels, t_s).transpose(2, 3) - value = value.view(b, self.n_heads, self.k_channels, - t_s).transpose(2, 3) - - scores = torch.matmul(query / math.sqrt(self.k_channels), - key.transpose(-2, -1)) - if self.window_size is not None: - msg = "Relative attention is only available for self-attention." - assert t_s == t_t, msg - key_relative_embeddings = self._get_relative_embeddings( - self.emb_rel_k, t_s) - rel_logits = self._matmul_with_relative_keys( - query / math.sqrt(self.k_channels), key_relative_embeddings) - scores_local = self._relative_position_to_absolute_position( - rel_logits) - scores = scores + scores_local - if self.proximal_bias: - msg = "Proximal bias is only available for self-attention." - assert t_s == t_t, msg - scores = scores + self._attention_bias_proximal(t_s).to( - device=scores.device, dtype=scores.dtype) - if mask is not None: - scores = scores.masked_fill(mask == 0, -1e4) - if self.block_length is not None: - msg = "Local attention is only available for self-attention." - assert t_s == t_t, msg - block_mask = torch.ones_like(scores).triu( - -self.block_length).tril(self.block_length) - scores = scores.masked_fill(block_mask == 0, -1e4) - p_attn = F.softmax(scores, dim=-1) # [b, n_h, t_t, t_s] - p_attn = self.drop(p_attn) - output = torch.matmul(p_attn, value) - if self.window_size is not None: - relative_weights = self._absolute_position_to_relative_position( - p_attn) - value_relative_embeddings = self._get_relative_embeddings( - self.emb_rel_v, t_s) - output = output + self._matmul_with_relative_values( - relative_weights, value_relative_embeddings) - output = output.transpose(2, 3).contiguous().view( - b, d, t_t) # [b, n_h, t_t, d_k] -> [b, d, t_t] - return output, p_attn - - def _matmul_with_relative_values(self, x, y): - """ - x: [b, h, l, m] - y: [h or 1, m, d] - ret: [b, h, l, d] - """ - ret = torch.matmul(x, y.unsqueeze(0)) - return ret - - def _matmul_with_relative_keys(self, x, y): - """ - x: [b, h, l, d] - y: [h or 1, m, d] - ret: [b, h, l, m] - """ - ret = torch.matmul(x, y.unsqueeze(0).transpose(-2, -1)) - return ret - - def _get_relative_embeddings(self, relative_embeddings, length): - max_relative_position = 2 * self.window_size + 1 - # Pad first before slice to avoid using cond ops. - pad_length = max(length - (self.window_size + 1), 0) - slice_start_position = max((self.window_size + 1) - length, 0) - slice_end_position = slice_start_position + 2 * length - 1 - if pad_length > 0: - padded_relative_embeddings = F.pad( - relative_embeddings, - commons.convert_pad_shape([[0, 0], [pad_length, pad_length], - [0, 0]])) - else: - padded_relative_embeddings = relative_embeddings - used_relative_embeddings = padded_relative_embeddings[:, - slice_start_position: - slice_end_position] - return used_relative_embeddings - - def _relative_position_to_absolute_position(self, x): - """ - x: [b, h, l, 2*l-1] - ret: [b, h, l, l] - """ - batch, heads, length, _ = x.size() - # Concat columns of pad to shift from relative to absolute indexing. - x = F.pad(x, commons.convert_pad_shape([[0, 0], [0, 0], [0, 0], [0, - 1]])) - - # Concat extra elements so to add up to shape (len+1, 2*len-1). - x_flat = x.view([batch, heads, length * 2 * length]) - x_flat = F.pad( - x_flat, commons.convert_pad_shape([[0, 0], [0, 0], [0, - length - 1]])) - - # Reshape and slice out the padded elements. - x_final = x_flat.view([batch, heads, length + 1, - 2 * length - 1])[:, :, :length, length - 1:] - return x_final - - def _absolute_position_to_relative_position(self, x): - """ - x: [b, h, l, l] - ret: [b, h, l, 2*l-1] - """ - batch, heads, length, _ = x.size() - # padd along column - x = F.pad( - x, - commons.convert_pad_shape([[0, 0], [0, 0], [0, 0], [0, - length - 1]])) - x_flat = x.view([batch, heads, length**2 + length * (length - 1)]) - # add 0's in the beginning that will skew the elements after reshape - x_flat = F.pad( - x_flat, commons.convert_pad_shape([[0, 0], [0, 0], [length, 0]])) - x_final = x_flat.view([batch, heads, length, 2 * length])[:, :, :, 1:] - return x_final - - def _attention_bias_proximal(self, length): - """Bias for self-attention to encourage attention to close positions. - Args: - length: an integer scalar. - Returns: - a Tensor with shape [1, 1, length, length] - """ - r = torch.arange(length, dtype=torch.float32) - diff = torch.unsqueeze(r, 0) - torch.unsqueeze(r, 1) - return torch.unsqueeze( - torch.unsqueeze(-torch.log1p(torch.abs(diff)), 0), 0) - - -class FFN(nn.Module): - def __init__(self, - in_channels, - out_channels, - filter_channels, - kernel_size, - p_dropout=0., - activation=None, - causal=False): - super().__init__() - self.in_channels = in_channels - self.out_channels = out_channels - self.filter_channels = filter_channels - self.kernel_size = kernel_size - self.p_dropout = p_dropout - self.activation = activation - self.causal = causal - - if causal: - self.padding = self._causal_padding - else: - self.padding = self._same_padding - - self.conv_1 = nn.Conv1d(in_channels, filter_channels, kernel_size) - self.conv_2 = nn.Conv1d(filter_channels, out_channels, kernel_size) - self.drop = nn.Dropout(p_dropout) - - def forward(self, x, x_mask): - x = self.conv_1(self.padding(x * x_mask)) - if self.activation == "gelu": - x = x * torch.sigmoid(1.702 * x) - else: - x = torch.relu(x) - x = self.drop(x) - x = self.conv_2(self.padding(x * x_mask)) - return x * x_mask - - def _causal_padding(self, x): - if self.kernel_size == 1: - return x - pad_l = self.kernel_size - 1 - pad_r = 0 - padding = [[0, 0], [0, 0], [pad_l, pad_r]] - x = F.pad(x, commons.convert_pad_shape(padding)) - return x - - def _same_padding(self, x): - if self.kernel_size == 1: - return x - pad_l = (self.kernel_size - 1) // 2 - pad_r = self.kernel_size // 2 - padding = [[0, 0], [0, 0], [pad_l, pad_r]] - x = F.pad(x, commons.convert_pad_shape(padding)) - return x diff --git a/spaces/Mahiruoshi/vits-chatbot/text/__init__.py b/spaces/Mahiruoshi/vits-chatbot/text/__init__.py deleted file mode 100644 index 4e69c354dd24e3243980236eca962cd5945a92fc..0000000000000000000000000000000000000000 --- a/spaces/Mahiruoshi/vits-chatbot/text/__init__.py +++ /dev/null @@ -1,32 +0,0 @@ -""" from https://github.com/keithito/tacotron """ -from text import cleaners - - -def text_to_sequence(text, symbols, cleaner_names): - '''Converts a string of text to a sequence of IDs corresponding to the symbols in the text. - Args: - text: string to convert to a sequence - cleaner_names: names of the cleaner functions to run the text through - Returns: - List of integers corresponding to the symbols in the text - ''' - _symbol_to_id = {s: i for i, s in enumerate(symbols)} - - sequence = [] - - clean_text = _clean_text(text, cleaner_names) - for symbol in clean_text: - if symbol not in _symbol_to_id.keys(): - continue - symbol_id = _symbol_to_id[symbol] - sequence += [symbol_id] - return sequence - - -def _clean_text(text, cleaner_names): - for name in cleaner_names: - cleaner = getattr(cleaners, name) - if not cleaner: - raise Exception('Unknown cleaner: %s' % name) - text = cleaner(text) - return text diff --git a/spaces/Manjushri/OJ-V4-CPU/app.py b/spaces/Manjushri/OJ-V4-CPU/app.py deleted file mode 100644 index 128d28f12cb8b9ece130185bb352c9710e58b45c..0000000000000000000000000000000000000000 --- a/spaces/Manjushri/OJ-V4-CPU/app.py +++ /dev/null @@ -1,28 +0,0 @@ -import gradio as gr -import torch -import numpy as np -import modin.pandas as pd -from PIL import Image -from diffusers import DiffusionPipeline, StableDiffusionLatentUpscalePipeline - -device = "cuda" if torch.cuda.is_available() else "cpu" -pipe = DiffusionPipeline.from_pretrained("prompthero/openjourney-v4", safety_checker=None) -upscaler = StableDiffusionLatentUpscalePipeline.from_pretrained("stabilityai/sd-x2-latent-upscaler", safety_checker=None) -upscaler = upscaler.to(device) -pipe = pipe.to(device) - -def genie (Prompt, scale, steps, seed): - generator = torch.Generator(device=device).manual_seed(seed) - #images = pipe(prompt, num_inference_steps=steps, guidance_scale=scale, generator=generator).images[0] - low_res_latents = pipe(Prompt, num_inference_steps=steps, guidance_scale=scale, generator=generator, output_type="latent").images - upscaled_image = upscaler(prompt='', image=low_res_latents, num_inference_steps=5, guidance_scale=0, generator=generator).images[0] - return upscaled_image - -gr.Interface(fn=genie, inputs=[gr.Textbox(label='What you want the AI to generate. 77 Token Limit.'), - gr.Slider(1, maximum=15, value=10, step=.25), - gr.Slider(1, maximum=50, value=25, step=1), - gr.Slider(minimum=1, step=1, maximum=987654321, randomize=True)], - outputs = 'image', - title = 'OpenJourney V4 with SD 2.1 2X Upscaler - CPU', - description = "OJ V4 CPU. WARNING: Extremely Slow. 35s/Iteration. Expect 8-16mins an image for 15-30 iterations respectively. 50 iterations takes ~28mins.", - article = "Code Monkey: Manjushri").launch(debug=True, max_threads=True) \ No newline at end of file diff --git a/spaces/Manmay/tortoise-tts/tortoise/is_this_from_tortoise.py b/spaces/Manmay/tortoise-tts/tortoise/is_this_from_tortoise.py deleted file mode 100644 index 289844f499fb45694bfb61f395867b81155daf8b..0000000000000000000000000000000000000000 --- a/spaces/Manmay/tortoise-tts/tortoise/is_this_from_tortoise.py +++ /dev/null @@ -1,14 +0,0 @@ -import argparse - -from api import classify_audio_clip -from tortoise.utils.audio import load_audio - -if __name__ == '__main__': - parser = argparse.ArgumentParser() - parser.add_argument('--clip', type=str, help='Path to an audio clip to classify.', default="../examples/favorite_riding_hood.mp3") - args = parser.parse_args() - - clip = load_audio(args.clip, 24000) - clip = clip[:, :220000] - prob = classify_audio_clip(clip) - print(f"This classifier thinks there is a {prob*100}% chance that this clip was generated from Tortoise.") \ No newline at end of file diff --git a/spaces/MattyWhite/ChatGPT-ImageCaptioner2/tools/fix_o365_path.py b/spaces/MattyWhite/ChatGPT-ImageCaptioner2/tools/fix_o365_path.py deleted file mode 100644 index 38716e56c465fc1a2b904a39dd3b9660eafba398..0000000000000000000000000000000000000000 --- a/spaces/MattyWhite/ChatGPT-ImageCaptioner2/tools/fix_o365_path.py +++ /dev/null @@ -1,28 +0,0 @@ -# Copyright (c) Facebook, Inc. and its affiliates. -import argparse -import json -import path -import os - -if __name__ == '__main__': - parser = argparse.ArgumentParser() - parser.add_argument("--ann", default='datasets/objects365/annotations/zhiyuan_objv2_train_fixname.json') - parser.add_argument("--img_dir", default='datasets/objects365/train/') - args = parser.parse_args() - - print('Loading', args.ann) - data = json.load(open(args.ann, 'r')) - images = [] - count = 0 - for x in data['images']: - path = '{}/{}'.format(args.img_dir, x['file_name']) - if os.path.exists(path): - images.append(x) - else: - print(path) - count = count + 1 - print('Missing', count, 'images') - data['images'] = images - out_name = args.ann[:-5] + '_fixmiss.json' - print('Saving to', out_name) - json.dump(data, open(out_name, 'w')) diff --git a/spaces/Metatron/IlluminatiAI-Illuminati_Diffusion_v1.0/README.md b/spaces/Metatron/IlluminatiAI-Illuminati_Diffusion_v1.0/README.md deleted file mode 100644 index 12560f97992a927fee5dd0abd21a2bab240dda79..0000000000000000000000000000000000000000 --- a/spaces/Metatron/IlluminatiAI-Illuminati_Diffusion_v1.0/README.md +++ /dev/null @@ -1,12 +0,0 @@ ---- -title: IlluminatiAI-Illuminati Diffusion V1.0 -emoji: 🐠 -colorFrom: purple -colorTo: blue -sdk: gradio -sdk_version: 3.19.1 -app_file: app.py -pinned: false ---- - -Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference diff --git a/spaces/Mmmm7/M/README.md b/spaces/Mmmm7/M/README.md deleted file mode 100644 index 0df8e7608221add50e4801008a0c53bd84440422..0000000000000000000000000000000000000000 --- a/spaces/Mmmm7/M/README.md +++ /dev/null @@ -1,10 +0,0 @@ ---- -title: M -emoji: 🏆 -colorFrom: red -colorTo: purple -sdk: docker -pinned: false ---- - -Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference diff --git a/spaces/Monster/Llama-2-7B-chat/README.md b/spaces/Monster/Llama-2-7B-chat/README.md deleted file mode 100644 index 537c5d82ef0c17fbfdc2eb140e822a92bb909773..0000000000000000000000000000000000000000 --- a/spaces/Monster/Llama-2-7B-chat/README.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -title: Llama 2 7B Chat GGML -emoji: 🔥 -colorFrom: pink -colorTo: purple -sdk: gradio -sdk_version: 3.39.0 -app_file: app.py -pinned: false -license: llama2 ---- - -Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference diff --git a/spaces/Mountchicken/MAERec-Gradio/tools/dataset_converters/textdet/naf_converter.py b/spaces/Mountchicken/MAERec-Gradio/tools/dataset_converters/textdet/naf_converter.py deleted file mode 100644 index 2e43c8fba909723edd55f7b13b2a9cfa0b6c2e15..0000000000000000000000000000000000000000 --- a/spaces/Mountchicken/MAERec-Gradio/tools/dataset_converters/textdet/naf_converter.py +++ /dev/null @@ -1,197 +0,0 @@ -# Copyright (c) OpenMMLab. All rights reserved. -import argparse -import os.path as osp - -import mmcv -import mmengine - -from mmocr.utils import dump_ocr_data - - -def collect_files(img_dir, gt_dir, split_info): - """Collect all images and their corresponding groundtruth files. - - Args: - img_dir (str): The image directory - gt_dir (str): The groundtruth directory - split_info (dict): The split information for train/val/test - - Returns: - files (list): The list of tuples (img_file, groundtruth_file) - """ - assert isinstance(img_dir, str) - assert img_dir - assert isinstance(gt_dir, str) - assert gt_dir - assert isinstance(split_info, dict) - assert split_info - - ann_list, imgs_list = [], [] - for group in split_info: - for img in split_info[group]: - image_path = osp.join(img_dir, img) - anno_path = osp.join(gt_dir, 'groups', group, - img.replace('jpg', 'json')) - - # Filtering out the missing images - if not osp.exists(image_path) or not osp.exists(anno_path): - continue - - imgs_list.append(image_path) - ann_list.append(anno_path) - - files = list(zip(imgs_list, ann_list)) - assert len(files), f'No images found in {img_dir}' - print(f'Loaded {len(files)} images from {img_dir}') - - return files - - -def collect_annotations(files, nproc=1): - """Collect the annotation information. - - Args: - files (list): The list of tuples (image_file, groundtruth_file) - nproc (int): The number of process to collect annotations - - Returns: - images (list): The list of image information dicts - """ - assert isinstance(files, list) - assert isinstance(nproc, int) - - if nproc > 1: - images = mmengine.track_parallel_progress( - load_img_info, files, nproc=nproc) - else: - images = mmengine.track_progress(load_img_info, files) - - return images - - -def load_img_info(files): - """Load the information of one image. - - Args: - files (tuple): The tuple of (img_file, groundtruth_file) - - Returns: - img_info (dict): The dict of the img and annotation information - """ - assert isinstance(files, tuple) - - img_file, gt_file = files - assert osp.basename(gt_file).split('.')[0] == osp.basename(img_file).split( - '.')[0] - # Read imgs while ignoring orientations - img = mmcv.imread(img_file, 'unchanged') - - img_info = dict( - file_name=osp.join(osp.basename(img_file)), - height=img.shape[0], - width=img.shape[1], - segm_file=osp.join(osp.basename(gt_file))) - - if osp.splitext(gt_file)[1] == '.json': - img_info = load_json_info(gt_file, img_info) - else: - raise NotImplementedError - - return img_info - - -def load_json_info(gt_file, img_info): - """Collect the annotation information. - - Annotation Format - { - 'textBBs': [{ - 'poly_points': [[435,1406], [466,1406], [466,1439], [435,1439]], - "type": "text", - "id": "t1", - }], ... - } - - Some special characters are used in the transcription: - "«text»" indicates that "text" had a strikethrough - "¿" indicates the transcriber could not read a character - "§" indicates the whole line or word was illegible - "" (empty string) is if the field was blank - - Args: - gt_file (str): The path to ground-truth - img_info (dict): The dict of the img and annotation information - - Returns: - img_info (dict): The dict of the img and annotation information - """ - assert isinstance(gt_file, str) - assert isinstance(img_info, dict) - - annotation = mmengine.load(gt_file) - anno_info = [] - - # 'textBBs' contains the printed texts of the table while 'fieldBBs' - # contains the text filled by human. - for box_type in ['textBBs', 'fieldBBs']: - for anno in annotation[box_type]: - # Skip blanks - if box_type == 'fieldBBs': - if anno['type'] == 'blank': - continue - - xs, ys, segmentation = [], [], [] - for p in anno['poly_points']: - xs.append(p[0]) - ys.append(p[1]) - segmentation.append(p[0]) - segmentation.append(p[1]) - x, y = max(0, min(xs)), max(0, min(ys)) - w, h = max(xs) - x, max(ys) - y - bbox = [x, y, w, h] - - anno = dict( - iscrowd=0, - category_id=1, - bbox=bbox, - area=w * h, - segmentation=[segmentation]) - anno_info.append(anno) - - img_info.update(anno_info=anno_info) - - return img_info - - -def parse_args(): - parser = argparse.ArgumentParser( - description='Generate training, val, and test set of NAF ') - parser.add_argument('root_path', help='Root dir path of NAF') - parser.add_argument( - '--nproc', default=1, type=int, help='Number of process') - args = parser.parse_args() - return args - - -def main(): - args = parse_args() - root_path = args.root_path - split_info = mmengine.load( - osp.join(root_path, 'annotations', 'train_valid_test_split.json')) - split_info['training'] = split_info.pop('train') - split_info['val'] = split_info.pop('valid') - for split in ['training', 'val', 'test']: - print(f'Processing {split} set...') - with mmengine.Timer( - print_tmpl='It takes {}s to convert NAF annotation'): - files = collect_files( - osp.join(root_path, 'imgs'), - osp.join(root_path, 'annotations'), split_info[split]) - image_infos = collect_annotations(files, nproc=args.nproc) - dump_ocr_data(image_infos, - osp.join(root_path, 'instances_' + split + '.json'), - 'textdet') - - -if __name__ == '__main__': - main() diff --git a/spaces/MrD05/text-generation-webui-space/download-model.py b/spaces/MrD05/text-generation-webui-space/download-model.py deleted file mode 100644 index d3b4623142bf04408515af17c0cb155c8a92d971..0000000000000000000000000000000000000000 --- a/spaces/MrD05/text-generation-webui-space/download-model.py +++ /dev/null @@ -1,179 +0,0 @@ -''' -Downloads models from Hugging Face to models/model-name. - -Example: -python download-model.py facebook/opt-1.3b - -''' - -import argparse -import base64 -import json -import multiprocessing -import re -import sys -from pathlib import Path - -import requests -import tqdm - -parser = argparse.ArgumentParser() -parser.add_argument('MODEL', type=str, default=None, nargs='?') -parser.add_argument('--branch', type=str, default='main', help='Name of the Git branch to download from.') -parser.add_argument('--threads', type=int, default=1, help='Number of files to download simultaneously.') -parser.add_argument('--text-only', action='store_true', help='Only download text files (txt/json).') -args = parser.parse_args() - -def get_file(args): - url = args[0] - output_folder = args[1] - idx = args[2] - tot = args[3] - - print(f"Downloading file {idx} of {tot}...") - r = requests.get(url, stream=True) - with open(output_folder / Path(url.split('/')[-1]), 'wb') as f: - total_size = int(r.headers.get('content-length', 0)) - block_size = 1024 - t = tqdm.tqdm(total=total_size, unit='iB', unit_scale=True) - for data in r.iter_content(block_size): - t.update(len(data)) - f.write(data) - t.close() - -def sanitize_branch_name(branch_name): - pattern = re.compile(r"^[a-zA-Z0-9._-]+$") - if pattern.match(branch_name): - return branch_name - else: - raise ValueError("Invalid branch name. Only alphanumeric characters, period, underscore and dash are allowed.") - -def select_model_from_default_options(): - models = { - "Pygmalion 6B original": ("PygmalionAI", "pygmalion-6b", "b8344bb4eb76a437797ad3b19420a13922aaabe1"), - "Pygmalion 6B main": ("PygmalionAI", "pygmalion-6b", "main"), - "Pygmalion 6B dev": ("PygmalionAI", "pygmalion-6b", "dev"), - "Pygmalion 2.7B": ("PygmalionAI", "pygmalion-2.7b", "main"), - "Pygmalion 1.3B": ("PygmalionAI", "pygmalion-1.3b", "main"), - "Pygmalion 350m": ("PygmalionAI", "pygmalion-350m", "main"), - "OPT 6.7b": ("facebook", "opt-6.7b", "main"), - "OPT 2.7b": ("facebook", "opt-2.7b", "main"), - "OPT 1.3b": ("facebook", "opt-1.3b", "main"), - "OPT 350m": ("facebook", "opt-350m", "main"), - } - choices = {} - - print("Select the model that you want to download:\n") - for i,name in enumerate(models): - char = chr(ord('A')+i) - choices[char] = name - print(f"{char}) {name}") - char = chr(ord('A')+len(models)) - print(f"{char}) None of the above") - - print() - print("Input> ", end='') - choice = input()[0].strip().upper() - if choice == char: - print("""\nThen type the name of your desired Hugging Face model in the format organization/name. - -Examples: -PygmalionAI/pygmalion-6b -facebook/opt-1.3b -""") - - print("Input> ", end='') - model = input() - branch = "main" - else: - arr = models[choices[choice]] - model = f"{arr[0]}/{arr[1]}" - branch = arr[2] - - return model, branch - -def get_download_links_from_huggingface(model, branch): - base = "https://huggingface.co" - page = f"/api/models/{model}/tree/{branch}" - cursor = b"" - - links = [] - classifications = [] - has_pytorch = False - has_safetensors = False - while True: - url = f"{base}{page}" + (f"?cursor={cursor.decode()}" if cursor else "") - r = requests.get(url) - r.raise_for_status() - content = r.content - - dict = json.loads(content) - if len(dict) == 0: - break - - for i in range(len(dict)): - fname = dict[i]['path'] - - is_pytorch = re.match("pytorch_model.*\.bin", fname) - is_safetensors = re.match("model.*\.safetensors", fname) - is_tokenizer = re.match("tokenizer.*\.model", fname) - is_text = re.match(".*\.(txt|json)", fname) or is_tokenizer - - if any((is_pytorch, is_safetensors, is_text, is_tokenizer)): - if is_text: - links.append(f"https://huggingface.co/{model}/resolve/{branch}/{fname}") - classifications.append('text') - continue - if not args.text_only: - links.append(f"https://huggingface.co/{model}/resolve/{branch}/{fname}") - if is_safetensors: - has_safetensors = True - classifications.append('safetensors') - elif is_pytorch: - has_pytorch = True - classifications.append('pytorch') - - cursor = base64.b64encode(f'{{"file_name":"{dict[-1]["path"]}"}}'.encode()) + b':50' - cursor = base64.b64encode(cursor) - cursor = cursor.replace(b'=', b'%3D') - - # If both pytorch and safetensors are available, download safetensors only - if has_pytorch and has_safetensors: - for i in range(len(classifications)-1, -1, -1): - if classifications[i] == 'pytorch': - links.pop(i) - - return links - -if __name__ == '__main__': - model = args.MODEL - branch = args.branch - if model is None: - model, branch = select_model_from_default_options() - else: - if model[-1] == '/': - model = model[:-1] - branch = args.branch - if branch is None: - branch = "main" - else: - try: - branch = sanitize_branch_name(branch) - except ValueError as err_branch: - print(f"Error: {err_branch}") - sys.exit() - if branch != 'main': - output_folder = Path("models") / (model.split('/')[-1] + f'_{branch}') - else: - output_folder = Path("models") / model.split('/')[-1] - if not output_folder.exists(): - output_folder.mkdir() - - links = get_download_links_from_huggingface(model, branch) - - # Downloading the files - print(f"Downloading the model to {output_folder}") - pool = multiprocessing.Pool(processes=args.threads) - results = pool.map(get_file, [[links[i], output_folder, i+1, len(links)] for i in range(len(links))]) - pool.close() - pool.join() diff --git a/spaces/MrSashkaman/StyleTransfer/main.py b/spaces/MrSashkaman/StyleTransfer/main.py deleted file mode 100644 index ea92666ba4102cf1660acb2694d598cbc80bb82f..0000000000000000000000000000000000000000 --- a/spaces/MrSashkaman/StyleTransfer/main.py +++ /dev/null @@ -1,83 +0,0 @@ -import telebot -from telegram import Update as update -import os -from model import transfer_model -import os.path -import gc - -TOKEN = os.environ['telegram_token'] - -bot = telebot.TeleBot(TOKEN, parse_mode=None) # You can set parse_mode by default. HTML or MARKDOWN - -@bot.message_handler(commands=['start', 'help']) -def send_welcome(message): - bot.reply_to(message, "Этот бот берет две фотографии и применяет стиль одной к другой. \ - Чтобы получить результат отправьте сначала фотографию, которую хотите изменить,\ - а затем фотографию, стиль которой хотите применить к первой") - -@bot.message_handler(content_types=['text']) -def send_instruction(message): - bot.reply_to(message, "Отправьте по очереди сначала фотографию, которую хотите изменить,\ - а затем фотографию, стиль которой вы хотите применить к первой") - - -@bot.message_handler(content_types=['photo']) -def load_img_and_run(message): - - os.makedirs('images/created', exist_ok=True) - os.makedirs('images/original', exist_ok=True) - os.makedirs('images/style', exist_ok=True) - - print(os.getcwd()) - - path_img = 'images/original/img.png' - path_style = 'images/style/style.png' - path_pics = 'images/created' - - if os.path.exists(path_img) == False: - - - file_info_img = bot.get_file(message.photo[-1].file_id) - downloaded_file_img = bot.download_file(file_info_img.file_path) - - - with open(path_img, 'wb') as new_file: - new_file.write(downloaded_file_img) - - bot.reply_to(message, "Добавлено фото для редактирования") - - - elif os.path.exists(path_img) and os.path.exists(path_style) == False: - - - file_info_style = bot.get_file(message.photo[-1].file_id) - downloaded_file_style = bot.download_file(file_info_style.file_path) - src_style = path_style - - with open(path_style, 'wb') as new_file: - new_file.write(downloaded_file_style) - - bot.reply_to(message, "Добавлено фото стиля") - - print('OK0') - - tf_model = transfer_model(num_steps=200, - style_weight=100000, - learning_rate=1, - step_checkpoint=10) - tf_model.run_style_transfer() - - del tf_model - gc.collect() - - print('OK1') - img = open('images/created/result_final.jpg', 'rb') - print('OK2') - bot.send_photo(message.chat.id, img) - - - #os.remove('images/created/result_final.jpg') - os.remove('images/style/style.png') - os.remove('images/original/img.png') - -bot.infinity_polling() \ No newline at end of file diff --git a/spaces/NCTCMumbai/NCTC/models/official/utils/testing/__init__.py b/spaces/NCTCMumbai/NCTC/models/official/utils/testing/__init__.py deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/spaces/Neilblaze/WhisperAnything/app.py b/spaces/Neilblaze/WhisperAnything/app.py deleted file mode 100644 index 538a49d455bbc47124d5b01ad4eb9493ec6c95ff..0000000000000000000000000000000000000000 --- a/spaces/Neilblaze/WhisperAnything/app.py +++ /dev/null @@ -1,36 +0,0 @@ -import whisper -import gradio as gr - -model = whisper.load_model("small") - -def transcribe(audio): - - #time.sleep(3) - # load audio and pad/trim it to fit 30 seconds - audio = whisper.load_audio(audio) - audio = whisper.pad_or_trim(audio) - - # make log-Mel spectrogram and move to the same device as the model - mel = whisper.log_mel_spectrogram(audio).to(model.device) - - # detect the spoken language - _, probs = model.detect_language(mel) - print(f"Detected language: {max(probs, key=probs.get)}") - - # decode the audio - options = whisper.DecodingOptions(fp16 = False, task = "translate") - result = whisper.decode(model, mel, options) - return result.text - - - -gr.Interface( - title = 'WhisperAnything — OpenAI Whisper ASR to EN', - fn=transcribe, - inputs=[ - gr.inputs.Audio(source="microphone", type="filepath") - ], - outputs=[ - "textbox" - ], - live=True).launch() \ No newline at end of file diff --git a/spaces/OFA-Sys/OFA-Generic_Interface/fairseq/examples/stories/README.md b/spaces/OFA-Sys/OFA-Generic_Interface/fairseq/examples/stories/README.md deleted file mode 100644 index 588941eddc5f0280f5254affd40ef49de874c885..0000000000000000000000000000000000000000 --- a/spaces/OFA-Sys/OFA-Generic_Interface/fairseq/examples/stories/README.md +++ /dev/null @@ -1,66 +0,0 @@ -# Hierarchical Neural Story Generation (Fan et al., 2018) - -The following commands provide an example of pre-processing data, training a model, and generating text for story generation with the WritingPrompts dataset. - -## Pre-trained models - -Description | Dataset | Model | Test set(s) ----|---|---|--- -Stories with Convolutional Model
      ([Fan et al., 2018](https://arxiv.org/abs/1805.04833)) | [WritingPrompts](https://dl.fbaipublicfiles.com/fairseq/data/writingPrompts.tar.gz) | [download (.tar.bz2)](https://dl.fbaipublicfiles.com/fairseq/models/stories_checkpoint.tar.bz2) | [download (.tar.bz2)](https://dl.fbaipublicfiles.com/fairseq/data/stories_test.tar.bz2) - -We provide sample stories generated by the [convolutional seq2seq model](https://dl.fbaipublicfiles.com/fairseq/data/seq2seq_stories.txt) and [fusion model](https://dl.fbaipublicfiles.com/fairseq/data/fusion_stories.txt) from [Fan et al., 2018](https://arxiv.org/abs/1805.04833). The corresponding prompts for the fusion model can be found [here](https://dl.fbaipublicfiles.com/fairseq/data/fusion_prompts.txt). Note that there are unk in the file, as we modeled a small full vocabulary (no BPE or pre-training). We did not use these unk prompts for human evaluation. - -## Dataset - -The dataset can be downloaded like this: - -```bash -cd examples/stories -curl https://dl.fbaipublicfiles.com/fairseq/data/writingPrompts.tar.gz | tar xvzf - -``` - -and contains a train, test, and valid split. The dataset is described here: https://arxiv.org/abs/1805.04833. We model only the first 1000 words of each story, including one newLine token. - -## Example usage - -First we will preprocess the dataset. Note that the dataset release is the full data, but the paper models the first 1000 words of each story. Here is example code that trims the dataset to the first 1000 words of each story: -```python -data = ["train", "test", "valid"] -for name in data: - with open(name + ".wp_target") as f: - stories = f.readlines() - stories = [" ".join(i.split()[0:1000]) for i in stories] - with open(name + ".wp_target", "w") as o: - for line in stories: - o.write(line.strip() + "\n") -``` - -Once we've trimmed the data we can binarize it and train our model: -```bash -# Binarize the dataset: -export TEXT=examples/stories/writingPrompts -fairseq-preprocess --source-lang wp_source --target-lang wp_target \ - --trainpref $TEXT/train --validpref $TEXT/valid --testpref $TEXT/test \ - --destdir data-bin/writingPrompts --padding-factor 1 --thresholdtgt 10 --thresholdsrc 10 - -# Train the model: -fairseq-train data-bin/writingPrompts -a fconv_self_att_wp --lr 0.25 --optimizer nag --clip-norm 0.1 --max-tokens 1500 --lr-scheduler reduce_lr_on_plateau --decoder-attention True --encoder-attention False --criterion label_smoothed_cross_entropy --weight-decay .0000001 --label-smoothing 0 --source-lang wp_source --target-lang wp_target --gated-attention True --self-attention True --project-input True --pretrained False - -# Train a fusion model: -# add the arguments: --pretrained True --pretrained-checkpoint path/to/checkpoint - -# Generate: -# Note: to load the pretrained model at generation time, you need to pass in a model-override argument to communicate to the fusion model at generation time where you have placed the pretrained checkpoint. By default, it will load the exact path of the fusion model's pretrained model from training time. You should use model-override if you have moved the pretrained model (or are using our provided models). If you are generating from a non-fusion model, the model-override argument is not necessary. - -fairseq-generate data-bin/writingPrompts --path /path/to/trained/model/checkpoint_best.pt --batch-size 32 --beam 1 --sampling --sampling-topk 10 --temperature 0.8 --nbest 1 --model-overrides "{'pretrained_checkpoint':'/path/to/pretrained/model/checkpoint'}" -``` - -## Citation -```bibtex -@inproceedings{fan2018hierarchical, - title = {Hierarchical Neural Story Generation}, - author = {Fan, Angela and Lewis, Mike and Dauphin, Yann}, - booktitle = {Conference of the Association for Computational Linguistics (ACL)}, - year = 2018, -} -``` diff --git a/spaces/OFA-Sys/OFA-Image_Caption/fairseq/examples/speech_recognition/kaldi/kaldi_initializer.py b/spaces/OFA-Sys/OFA-Image_Caption/fairseq/examples/speech_recognition/kaldi/kaldi_initializer.py deleted file mode 100644 index 6d2a2a4b6b809ba1106f9a57cb6f241dc083e670..0000000000000000000000000000000000000000 --- a/spaces/OFA-Sys/OFA-Image_Caption/fairseq/examples/speech_recognition/kaldi/kaldi_initializer.py +++ /dev/null @@ -1,698 +0,0 @@ -#!/usr/bin/env python3 - -# Copyright (c) Facebook, Inc. and its affiliates. -# -# This source code is licensed under the MIT license found in the -# LICENSE file in the root directory of this source tree. - -from dataclasses import dataclass -import hydra -from hydra.core.config_store import ConfigStore -import logging -from omegaconf import MISSING, OmegaConf -import os -import os.path as osp -from pathlib import Path -import subprocess -from typing import Optional - -from fairseq.data.dictionary import Dictionary -from fairseq.dataclass import FairseqDataclass - -script_dir = Path(__file__).resolve().parent -config_path = script_dir / "config" - - -logger = logging.getLogger(__name__) - - -@dataclass -class KaldiInitializerConfig(FairseqDataclass): - data_dir: str = MISSING - fst_dir: Optional[str] = None - in_labels: str = MISSING - out_labels: Optional[str] = None - wav2letter_lexicon: Optional[str] = None - lm_arpa: str = MISSING - kaldi_root: str = MISSING - blank_symbol: str = "" - silence_symbol: Optional[str] = None - - -def create_units(fst_dir: Path, in_labels: str, vocab: Dictionary) -> Path: - in_units_file = fst_dir / f"kaldi_dict.{in_labels}.txt" - if not in_units_file.exists(): - - logger.info(f"Creating {in_units_file}") - - with open(in_units_file, "w") as f: - print(" 0", file=f) - i = 1 - for symb in vocab.symbols[vocab.nspecial :]: - if not symb.startswith("madeupword"): - print(f"{symb} {i}", file=f) - i += 1 - return in_units_file - - -def create_lexicon( - cfg: KaldiInitializerConfig, - fst_dir: Path, - unique_label: str, - in_units_file: Path, - out_words_file: Path, -) -> (Path, Path): - - disambig_in_units_file = fst_dir / f"kaldi_dict.{cfg.in_labels}_disambig.txt" - lexicon_file = fst_dir / f"kaldi_lexicon.{unique_label}.txt" - disambig_lexicon_file = fst_dir / f"kaldi_lexicon.{unique_label}_disambig.txt" - if ( - not lexicon_file.exists() - or not disambig_lexicon_file.exists() - or not disambig_in_units_file.exists() - ): - logger.info(f"Creating {lexicon_file} (in units file: {in_units_file})") - - assert cfg.wav2letter_lexicon is not None or cfg.in_labels == cfg.out_labels - - if cfg.wav2letter_lexicon is not None: - lm_words = set() - with open(out_words_file, "r") as lm_dict_f: - for line in lm_dict_f: - lm_words.add(line.split()[0]) - - num_skipped = 0 - total = 0 - with open(cfg.wav2letter_lexicon, "r") as w2l_lex_f, open( - lexicon_file, "w" - ) as out_f: - for line in w2l_lex_f: - items = line.rstrip().split("\t") - assert len(items) == 2, items - if items[0] in lm_words: - print(items[0], items[1], file=out_f) - else: - num_skipped += 1 - logger.debug( - f"Skipping word {items[0]} as it was not found in LM" - ) - total += 1 - if num_skipped > 0: - logger.warning( - f"Skipped {num_skipped} out of {total} words as they were not found in LM" - ) - else: - with open(in_units_file, "r") as in_f, open(lexicon_file, "w") as out_f: - for line in in_f: - symb = line.split()[0] - if symb != "" and symb != "" and symb != "": - print(symb, symb, file=out_f) - - lex_disambig_path = ( - Path(cfg.kaldi_root) / "egs/wsj/s5/utils/add_lex_disambig.pl" - ) - res = subprocess.run( - [lex_disambig_path, lexicon_file, disambig_lexicon_file], - check=True, - capture_output=True, - ) - ndisambig = int(res.stdout) - disamib_path = Path(cfg.kaldi_root) / "egs/wsj/s5/utils/add_disambig.pl" - res = subprocess.run( - [disamib_path, "--include-zero", in_units_file, str(ndisambig)], - check=True, - capture_output=True, - ) - with open(disambig_in_units_file, "wb") as f: - f.write(res.stdout) - - return disambig_lexicon_file, disambig_in_units_file - - -def create_G( - kaldi_root: Path, fst_dir: Path, lm_arpa: Path, arpa_base: str -) -> (Path, Path): - - out_words_file = fst_dir / f"kaldi_dict.{arpa_base}.txt" - grammar_graph = fst_dir / f"G_{arpa_base}.fst" - if not grammar_graph.exists() or not out_words_file.exists(): - logger.info(f"Creating {grammar_graph}") - arpa2fst = kaldi_root / "src/lmbin/arpa2fst" - subprocess.run( - [ - arpa2fst, - "--disambig-symbol=#0", - f"--write-symbol-table={out_words_file}", - lm_arpa, - grammar_graph, - ], - check=True, - ) - return grammar_graph, out_words_file - - -def create_L( - kaldi_root: Path, - fst_dir: Path, - unique_label: str, - lexicon_file: Path, - in_units_file: Path, - out_words_file: Path, -) -> Path: - lexicon_graph = fst_dir / f"L.{unique_label}.fst" - - if not lexicon_graph.exists(): - logger.info(f"Creating {lexicon_graph} (in units: {in_units_file})") - make_lex = kaldi_root / "egs/wsj/s5/utils/make_lexicon_fst.pl" - fstcompile = kaldi_root / "tools/openfst-1.6.7/bin/fstcompile" - fstaddselfloops = kaldi_root / "src/fstbin/fstaddselfloops" - fstarcsort = kaldi_root / "tools/openfst-1.6.7/bin/fstarcsort" - - def write_disambig_symbol(file): - with open(file, "r") as f: - for line in f: - items = line.rstrip().split() - if items[0] == "#0": - out_path = str(file) + "_disamig" - with open(out_path, "w") as out_f: - print(items[1], file=out_f) - return out_path - - return None - - in_disambig_sym = write_disambig_symbol(in_units_file) - assert in_disambig_sym is not None - out_disambig_sym = write_disambig_symbol(out_words_file) - assert out_disambig_sym is not None - - try: - with open(lexicon_graph, "wb") as out_f: - res = subprocess.run( - [make_lex, lexicon_file], capture_output=True, check=True - ) - assert len(res.stderr) == 0, res.stderr.decode("utf-8") - res = subprocess.run( - [ - fstcompile, - f"--isymbols={in_units_file}", - f"--osymbols={out_words_file}", - "--keep_isymbols=false", - "--keep_osymbols=false", - ], - input=res.stdout, - capture_output=True, - ) - assert len(res.stderr) == 0, res.stderr.decode("utf-8") - res = subprocess.run( - [fstaddselfloops, in_disambig_sym, out_disambig_sym], - input=res.stdout, - capture_output=True, - check=True, - ) - res = subprocess.run( - [fstarcsort, "--sort_type=olabel"], - input=res.stdout, - capture_output=True, - check=True, - ) - out_f.write(res.stdout) - except subprocess.CalledProcessError as e: - logger.error(f"cmd: {e.cmd}, err: {e.stderr.decode('utf-8')}") - os.remove(lexicon_graph) - raise - except AssertionError: - os.remove(lexicon_graph) - raise - - return lexicon_graph - - -def create_LG( - kaldi_root: Path, - fst_dir: Path, - unique_label: str, - lexicon_graph: Path, - grammar_graph: Path, -) -> Path: - lg_graph = fst_dir / f"LG.{unique_label}.fst" - - if not lg_graph.exists(): - logger.info(f"Creating {lg_graph}") - - fsttablecompose = kaldi_root / "src/fstbin/fsttablecompose" - fstdeterminizestar = kaldi_root / "src/fstbin/fstdeterminizestar" - fstminimizeencoded = kaldi_root / "src/fstbin/fstminimizeencoded" - fstpushspecial = kaldi_root / "src/fstbin/fstpushspecial" - fstarcsort = kaldi_root / "tools/openfst-1.6.7/bin/fstarcsort" - - try: - with open(lg_graph, "wb") as out_f: - res = subprocess.run( - [fsttablecompose, lexicon_graph, grammar_graph], - capture_output=True, - check=True, - ) - res = subprocess.run( - [ - fstdeterminizestar, - "--use-log=true", - ], - input=res.stdout, - capture_output=True, - ) - res = subprocess.run( - [fstminimizeencoded], - input=res.stdout, - capture_output=True, - check=True, - ) - res = subprocess.run( - [fstpushspecial], - input=res.stdout, - capture_output=True, - check=True, - ) - res = subprocess.run( - [fstarcsort, "--sort_type=ilabel"], - input=res.stdout, - capture_output=True, - check=True, - ) - out_f.write(res.stdout) - except subprocess.CalledProcessError as e: - logger.error(f"cmd: {e.cmd}, err: {e.stderr.decode('utf-8')}") - os.remove(lg_graph) - raise - - return lg_graph - - -def create_H( - kaldi_root: Path, - fst_dir: Path, - disambig_out_units_file: Path, - in_labels: str, - vocab: Dictionary, - blk_sym: str, - silence_symbol: Optional[str], -) -> (Path, Path, Path): - h_graph = ( - fst_dir / f"H.{in_labels}{'_' + silence_symbol if silence_symbol else ''}.fst" - ) - h_out_units_file = fst_dir / f"kaldi_dict.h_out.{in_labels}.txt" - disambig_in_units_file_int = Path(str(h_graph) + "isym_disambig.int") - disambig_out_units_file_int = Path(str(disambig_out_units_file) + ".int") - if ( - not h_graph.exists() - or not h_out_units_file.exists() - or not disambig_in_units_file_int.exists() - ): - logger.info(f"Creating {h_graph}") - eps_sym = "" - - num_disambig = 0 - osymbols = [] - - with open(disambig_out_units_file, "r") as f, open( - disambig_out_units_file_int, "w" - ) as out_f: - for line in f: - symb, id = line.rstrip().split() - if line.startswith("#"): - num_disambig += 1 - print(id, file=out_f) - else: - if len(osymbols) == 0: - assert symb == eps_sym, symb - osymbols.append((symb, id)) - - i_idx = 0 - isymbols = [(eps_sym, 0)] - - imap = {} - - for i, s in enumerate(vocab.symbols): - i_idx += 1 - isymbols.append((s, i_idx)) - imap[s] = i_idx - - fst_str = [] - - node_idx = 0 - root_node = node_idx - - special_symbols = [blk_sym] - if silence_symbol is not None: - special_symbols.append(silence_symbol) - - for ss in special_symbols: - fst_str.append("{} {} {} {}".format(root_node, root_node, ss, eps_sym)) - - for symbol, _ in osymbols: - if symbol == eps_sym or symbol.startswith("#"): - continue - - node_idx += 1 - # 1. from root to emitting state - fst_str.append("{} {} {} {}".format(root_node, node_idx, symbol, symbol)) - # 2. from emitting state back to root - fst_str.append("{} {} {} {}".format(node_idx, root_node, eps_sym, eps_sym)) - # 3. from emitting state to optional blank state - pre_node = node_idx - node_idx += 1 - for ss in special_symbols: - fst_str.append("{} {} {} {}".format(pre_node, node_idx, ss, eps_sym)) - # 4. from blank state back to root - fst_str.append("{} {} {} {}".format(node_idx, root_node, eps_sym, eps_sym)) - - fst_str.append("{}".format(root_node)) - - fst_str = "\n".join(fst_str) - h_str = str(h_graph) - isym_file = h_str + ".isym" - - with open(isym_file, "w") as f: - for sym, id in isymbols: - f.write("{} {}\n".format(sym, id)) - - with open(h_out_units_file, "w") as f: - for sym, id in osymbols: - f.write("{} {}\n".format(sym, id)) - - with open(disambig_in_units_file_int, "w") as f: - disam_sym_id = len(isymbols) - for _ in range(num_disambig): - f.write("{}\n".format(disam_sym_id)) - disam_sym_id += 1 - - fstcompile = kaldi_root / "tools/openfst-1.6.7/bin/fstcompile" - fstaddselfloops = kaldi_root / "src/fstbin/fstaddselfloops" - fstarcsort = kaldi_root / "tools/openfst-1.6.7/bin/fstarcsort" - - try: - with open(h_graph, "wb") as out_f: - res = subprocess.run( - [ - fstcompile, - f"--isymbols={isym_file}", - f"--osymbols={h_out_units_file}", - "--keep_isymbols=false", - "--keep_osymbols=false", - ], - input=str.encode(fst_str), - capture_output=True, - check=True, - ) - res = subprocess.run( - [ - fstaddselfloops, - disambig_in_units_file_int, - disambig_out_units_file_int, - ], - input=res.stdout, - capture_output=True, - check=True, - ) - res = subprocess.run( - [fstarcsort, "--sort_type=olabel"], - input=res.stdout, - capture_output=True, - check=True, - ) - out_f.write(res.stdout) - except subprocess.CalledProcessError as e: - logger.error(f"cmd: {e.cmd}, err: {e.stderr.decode('utf-8')}") - os.remove(h_graph) - raise - return h_graph, h_out_units_file, disambig_in_units_file_int - - -def create_HLGa( - kaldi_root: Path, - fst_dir: Path, - unique_label: str, - h_graph: Path, - lg_graph: Path, - disambig_in_words_file_int: Path, -) -> Path: - hlga_graph = fst_dir / f"HLGa.{unique_label}.fst" - - if not hlga_graph.exists(): - logger.info(f"Creating {hlga_graph}") - - fsttablecompose = kaldi_root / "src/fstbin/fsttablecompose" - fstdeterminizestar = kaldi_root / "src/fstbin/fstdeterminizestar" - fstrmsymbols = kaldi_root / "src/fstbin/fstrmsymbols" - fstrmepslocal = kaldi_root / "src/fstbin/fstrmepslocal" - fstminimizeencoded = kaldi_root / "src/fstbin/fstminimizeencoded" - - try: - with open(hlga_graph, "wb") as out_f: - res = subprocess.run( - [ - fsttablecompose, - h_graph, - lg_graph, - ], - capture_output=True, - check=True, - ) - res = subprocess.run( - [fstdeterminizestar, "--use-log=true"], - input=res.stdout, - capture_output=True, - check=True, - ) - res = subprocess.run( - [fstrmsymbols, disambig_in_words_file_int], - input=res.stdout, - capture_output=True, - check=True, - ) - res = subprocess.run( - [fstrmepslocal], - input=res.stdout, - capture_output=True, - check=True, - ) - res = subprocess.run( - [fstminimizeencoded], - input=res.stdout, - capture_output=True, - check=True, - ) - out_f.write(res.stdout) - except subprocess.CalledProcessError as e: - logger.error(f"cmd: {e.cmd}, err: {e.stderr.decode('utf-8')}") - os.remove(hlga_graph) - raise - - return hlga_graph - - -def create_HLa( - kaldi_root: Path, - fst_dir: Path, - unique_label: str, - h_graph: Path, - l_graph: Path, - disambig_in_words_file_int: Path, -) -> Path: - hla_graph = fst_dir / f"HLa.{unique_label}.fst" - - if not hla_graph.exists(): - logger.info(f"Creating {hla_graph}") - - fsttablecompose = kaldi_root / "src/fstbin/fsttablecompose" - fstdeterminizestar = kaldi_root / "src/fstbin/fstdeterminizestar" - fstrmsymbols = kaldi_root / "src/fstbin/fstrmsymbols" - fstrmepslocal = kaldi_root / "src/fstbin/fstrmepslocal" - fstminimizeencoded = kaldi_root / "src/fstbin/fstminimizeencoded" - - try: - with open(hla_graph, "wb") as out_f: - res = subprocess.run( - [ - fsttablecompose, - h_graph, - l_graph, - ], - capture_output=True, - check=True, - ) - res = subprocess.run( - [fstdeterminizestar, "--use-log=true"], - input=res.stdout, - capture_output=True, - check=True, - ) - res = subprocess.run( - [fstrmsymbols, disambig_in_words_file_int], - input=res.stdout, - capture_output=True, - check=True, - ) - res = subprocess.run( - [fstrmepslocal], - input=res.stdout, - capture_output=True, - check=True, - ) - res = subprocess.run( - [fstminimizeencoded], - input=res.stdout, - capture_output=True, - check=True, - ) - out_f.write(res.stdout) - except subprocess.CalledProcessError as e: - logger.error(f"cmd: {e.cmd}, err: {e.stderr.decode('utf-8')}") - os.remove(hla_graph) - raise - - return hla_graph - - -def create_HLG( - kaldi_root: Path, - fst_dir: Path, - unique_label: str, - hlga_graph: Path, - prefix: str = "HLG", -) -> Path: - hlg_graph = fst_dir / f"{prefix}.{unique_label}.fst" - - if not hlg_graph.exists(): - logger.info(f"Creating {hlg_graph}") - - add_self_loop = script_dir / "add-self-loop-simple" - kaldi_src = kaldi_root / "src" - kaldi_lib = kaldi_src / "lib" - - try: - if not add_self_loop.exists(): - fst_include = kaldi_root / "tools/openfst-1.6.7/include" - add_self_loop_src = script_dir / "add-self-loop-simple.cc" - - subprocess.run( - [ - "c++", - f"-I{kaldi_src}", - f"-I{fst_include}", - f"-L{kaldi_lib}", - add_self_loop_src, - "-lkaldi-base", - "-lkaldi-fstext", - "-o", - add_self_loop, - ], - check=True, - ) - - my_env = os.environ.copy() - my_env["LD_LIBRARY_PATH"] = f"{kaldi_lib}:{my_env['LD_LIBRARY_PATH']}" - - subprocess.run( - [ - add_self_loop, - hlga_graph, - hlg_graph, - ], - check=True, - capture_output=True, - env=my_env, - ) - except subprocess.CalledProcessError as e: - logger.error(f"cmd: {e.cmd}, err: {e.stderr.decode('utf-8')}") - raise - - return hlg_graph - - -def initalize_kaldi(cfg: KaldiInitializerConfig) -> Path: - if cfg.fst_dir is None: - cfg.fst_dir = osp.join(cfg.data_dir, "kaldi") - if cfg.out_labels is None: - cfg.out_labels = cfg.in_labels - - kaldi_root = Path(cfg.kaldi_root) - data_dir = Path(cfg.data_dir) - fst_dir = Path(cfg.fst_dir) - fst_dir.mkdir(parents=True, exist_ok=True) - - arpa_base = osp.splitext(osp.basename(cfg.lm_arpa))[0] - unique_label = f"{cfg.in_labels}.{arpa_base}" - - with open(data_dir / f"dict.{cfg.in_labels}.txt", "r") as f: - vocab = Dictionary.load(f) - - in_units_file = create_units(fst_dir, cfg.in_labels, vocab) - - grammar_graph, out_words_file = create_G( - kaldi_root, fst_dir, Path(cfg.lm_arpa), arpa_base - ) - - disambig_lexicon_file, disambig_L_in_units_file = create_lexicon( - cfg, fst_dir, unique_label, in_units_file, out_words_file - ) - - h_graph, h_out_units_file, disambig_in_units_file_int = create_H( - kaldi_root, - fst_dir, - disambig_L_in_units_file, - cfg.in_labels, - vocab, - cfg.blank_symbol, - cfg.silence_symbol, - ) - lexicon_graph = create_L( - kaldi_root, - fst_dir, - unique_label, - disambig_lexicon_file, - disambig_L_in_units_file, - out_words_file, - ) - lg_graph = create_LG( - kaldi_root, fst_dir, unique_label, lexicon_graph, grammar_graph - ) - hlga_graph = create_HLGa( - kaldi_root, fst_dir, unique_label, h_graph, lg_graph, disambig_in_units_file_int - ) - hlg_graph = create_HLG(kaldi_root, fst_dir, unique_label, hlga_graph) - - # for debugging - # hla_graph = create_HLa(kaldi_root, fst_dir, unique_label, h_graph, lexicon_graph, disambig_in_units_file_int) - # hl_graph = create_HLG(kaldi_root, fst_dir, unique_label, hla_graph, prefix="HL_looped") - # create_HLG(kaldi_root, fst_dir, "phnc", h_graph, prefix="H_looped") - - return hlg_graph - - -@hydra.main(config_path=config_path, config_name="kaldi_initializer") -def cli_main(cfg: KaldiInitializerConfig) -> None: - container = OmegaConf.to_container(cfg, resolve=True, enum_to_str=True) - cfg = OmegaConf.create(container) - OmegaConf.set_struct(cfg, True) - initalize_kaldi(cfg) - - -if __name__ == "__main__": - - logging.root.setLevel(logging.INFO) - logging.basicConfig(level=logging.INFO) - - try: - from hydra._internal.utils import ( - get_args, - ) # pylint: disable=import-outside-toplevel - - cfg_name = get_args().config_name or "kaldi_initializer" - except ImportError: - logger.warning("Failed to get config name from hydra args") - cfg_name = "kaldi_initializer" - - cs = ConfigStore.instance() - cs.store(name=cfg_name, node=KaldiInitializerConfig) - - cli_main() diff --git a/spaces/OFA-Sys/OFA-Image_Caption/models/ofa/unify_transformer.py b/spaces/OFA-Sys/OFA-Image_Caption/models/ofa/unify_transformer.py deleted file mode 100644 index d03a5d332e5fcd7ff0085b026b2eb79e8acfd4f8..0000000000000000000000000000000000000000 --- a/spaces/OFA-Sys/OFA-Image_Caption/models/ofa/unify_transformer.py +++ /dev/null @@ -1,1510 +0,0 @@ -# Copyright (c) Facebook, Inc. and its affiliates. -# -# This source code is licensed under the MIT license found in the -# LICENSE file in the root directory of this source tree. - -import math -import random -from typing import Any, Dict, List, Optional, Tuple - -import torch -import torch.nn as nn -import torch.nn.functional as F -from fairseq import utils -from fairseq.distributed import fsdp_wrap -from fairseq.models import ( - FairseqEncoder, - FairseqEncoderDecoderModel, - FairseqIncrementalDecoder, - register_model, - register_model_architecture, -) -from fairseq.modules import ( - AdaptiveSoftmax, - BaseLayer, - FairseqDropout, - LayerDropModuleList, - LayerNorm, - SinusoidalPositionalEmbedding, - GradMultiply -) -from fairseq.modules.checkpoint_activations import checkpoint_wrapper -from fairseq.modules.quant_noise import quant_noise as apply_quant_noise_ -from torch import Tensor - -from .unify_transformer_layer import TransformerEncoderLayer, TransformerDecoderLayer -from .resnet import ResNet - - -DEFAULT_MAX_SOURCE_POSITIONS = 1024 -DEFAULT_MAX_TARGET_POSITIONS = 1024 - - -DEFAULT_MIN_PARAMS_TO_WRAP = int(1e8) - - -def BatchNorm2d(out_chan, momentum=0.1, eps=1e-3): - return nn.SyncBatchNorm.convert_sync_batchnorm( - nn.BatchNorm2d(out_chan, momentum=momentum, eps=eps) - ) - - -def make_token_bucket_position(bucket_size, max_position=DEFAULT_MAX_SOURCE_POSITIONS): - context_pos = torch.arange(max_position, dtype=torch.long)[:, None] - memory_pos = torch.arange(max_position, dtype=torch.long)[None, :] - relative_pos = context_pos - memory_pos - sign = torch.sign(relative_pos) - mid = bucket_size // 2 - abs_pos = torch.where((relative_pos -mid), mid-1, torch.abs(relative_pos)) - log_pos = torch.ceil(torch.log(abs_pos/mid)/math.log((max_position-1)/mid) * (mid-1)) + mid - log_pos = log_pos.int() - bucket_pos = torch.where(abs_pos.le(mid), relative_pos, log_pos*sign).long() - return bucket_pos + bucket_size - 1 - - -def make_image_bucket_position(bucket_size, num_relative_distance): - coords_h = torch.arange(bucket_size) - coords_w = torch.arange(bucket_size) - coords = torch.stack(torch.meshgrid([coords_h, coords_w])) # 2, Wh, Ww - coords_flatten = torch.flatten(coords, 1) # 2, Wh*Ww - relative_coords = coords_flatten[:, :, None] - coords_flatten[:, None, :] # 2, Wh*Ww, Wh*Ww - relative_coords = relative_coords.permute(1, 2, 0).contiguous() # Wh*Ww, Wh*Ww, 2 - relative_coords[:, :, 0] += bucket_size - 1 # shift to start from 0 - relative_coords[:, :, 1] += bucket_size - 1 - relative_coords[:, :, 0] *= 2 * bucket_size - 1 - relative_position_index = torch.zeros(size=(bucket_size * bucket_size + 1,) * 2, dtype=relative_coords.dtype) - relative_position_index[1:, 1:] = relative_coords.sum(-1) # Wh*Ww, Wh*Ww - relative_position_index[0, 0:] = num_relative_distance - 3 - relative_position_index[0:, 0] = num_relative_distance - 2 - relative_position_index[0, 0] = num_relative_distance - 1 - return relative_position_index - - -@register_model("unify_transformer") -class TransformerModel(FairseqEncoderDecoderModel): - """ - Transformer model from `"Attention Is All You Need" (Vaswani, et al, 2017) - `_. - - Args: - encoder (TransformerEncoder): the encoder - decoder (TransformerDecoder): the decoder - - The Transformer model provides the following named architectures and - command-line arguments: - - .. argparse:: - :ref: fairseq.models.transformer_parser - :prog: - """ - - def __init__(self, args, encoder, decoder): - super().__init__(encoder, decoder) - self.args = args - self.supports_align_args = True - - @staticmethod - def add_args(parser): - """Add model-specific arguments to the parser.""" - # fmt: off - parser.add_argument('--activation-fn', - choices=utils.get_available_activation_fns(), - help='activation function to use') - parser.add_argument('--dropout', type=float, metavar='D', - help='dropout probability') - parser.add_argument('--attention-dropout', type=float, metavar='D', - help='dropout probability for attention weights') - parser.add_argument('--activation-dropout', '--relu-dropout', type=float, metavar='D', - help='dropout probability after activation in FFN.') - parser.add_argument('--encoder-embed-path', type=str, metavar='STR', - help='path to pre-trained encoder embedding') - parser.add_argument('--encoder-embed-dim', type=int, metavar='N', - help='encoder embedding dimension') - parser.add_argument('--encoder-ffn-embed-dim', type=int, metavar='N', - help='encoder embedding dimension for FFN') - parser.add_argument('--encoder-layers', type=int, metavar='N', - help='num encoder layers') - parser.add_argument('--encoder-attention-heads', type=int, metavar='N', - help='num encoder attention heads') - parser.add_argument('--encoder-normalize-before', action='store_true', - help='apply layernorm before each encoder block') - parser.add_argument('--encoder-learned-pos', action='store_true', - help='use learned positional embeddings in the encoder') - parser.add_argument('--decoder-embed-path', type=str, metavar='STR', - help='path to pre-trained decoder embedding') - parser.add_argument('--decoder-embed-dim', type=int, metavar='N', - help='decoder embedding dimension') - parser.add_argument('--decoder-ffn-embed-dim', type=int, metavar='N', - help='decoder embedding dimension for FFN') - parser.add_argument('--decoder-layers', type=int, metavar='N', - help='num decoder layers') - parser.add_argument('--decoder-attention-heads', type=int, metavar='N', - help='num decoder attention heads') - parser.add_argument('--decoder-learned-pos', action='store_true', - help='use learned positional embeddings in the decoder') - parser.add_argument('--decoder-normalize-before', action='store_true', - help='apply layernorm before each decoder block') - parser.add_argument('--decoder-output-dim', type=int, metavar='N', - help='decoder output dimension (extra linear layer ' - 'if different from decoder embed dim') - parser.add_argument('--share-decoder-input-output-embed', action='store_true', - help='share decoder input and output embeddings') - parser.add_argument('--share-all-embeddings', action='store_true', - help='share encoder, decoder and output embeddings' - ' (requires shared dictionary and embed dim)') - parser.add_argument('--no-token-positional-embeddings', default=False, action='store_true', - help='if set, disables positional embeddings (outside self attention)') - parser.add_argument('--adaptive-softmax-cutoff', metavar='EXPR', - help='comma separated list of adaptive softmax cutoff points. ' - 'Must be used with adaptive_loss criterion'), - parser.add_argument('--adaptive-softmax-dropout', type=float, metavar='D', - help='sets adaptive softmax dropout for the tail projections') - parser.add_argument('--layernorm-embedding', action='store_true', - help='add layernorm to embedding') - parser.add_argument('--no-scale-embedding', action='store_true', - help='if True, dont scale embeddings') - parser.add_argument('--checkpoint-activations', action='store_true', - help='checkpoint activations at each layer, which saves GPU ' - 'memory usage at the cost of some additional compute') - parser.add_argument('--offload-activations', action='store_true', - help='checkpoint activations at each layer, then save to gpu. Sets --checkpoint-activations.') - # args for "Cross+Self-Attention for Transformer Models" (Peitz et al., 2019) - parser.add_argument('--no-cross-attention', default=False, action='store_true', - help='do not perform cross-attention') - parser.add_argument('--cross-self-attention', default=False, action='store_true', - help='perform cross+self-attention') - # args for "Reducing Transformer Depth on Demand with Structured Dropout" (Fan et al., 2019) - parser.add_argument('--encoder-layerdrop', type=float, metavar='D', default=0, - help='LayerDrop probability for encoder') - parser.add_argument('--decoder-layerdrop', type=float, metavar='D', default=0, - help='LayerDrop probability for decoder') - parser.add_argument('--encoder-layers-to-keep', default=None, - help='which layers to *keep* when pruning as a comma-separated list') - parser.add_argument('--decoder-layers-to-keep', default=None, - help='which layers to *keep* when pruning as a comma-separated list') - # args for Training with Quantization Noise for Extreme Model Compression ({Fan*, Stock*} et al., 2020) - parser.add_argument('--quant-noise-pq', type=float, metavar='D', default=0, - help='iterative PQ quantization noise at training time') - parser.add_argument('--quant-noise-pq-block-size', type=int, metavar='D', default=8, - help='block size of quantization noise at training time') - parser.add_argument('--quant-noise-scalar', type=float, metavar='D', default=0, - help='scalar quantization noise and scalar quantization at training time') - # args for Fully Sharded Data Parallel (FSDP) training - parser.add_argument( - '--min-params-to-wrap', type=int, metavar='D', default=DEFAULT_MIN_PARAMS_TO_WRAP, - help=( - 'minimum number of params for a layer to be wrapped with FSDP() when ' - 'training with --ddp-backend=fully_sharded. Smaller values will ' - 'improve memory efficiency, but may make torch.distributed ' - 'communication less efficient due to smaller input sizes. This option ' - 'is set to 0 (i.e., always wrap) when --checkpoint-activations or ' - '--offload-activations are passed.' - ) - ) - - parser.add_argument('--resnet-drop-path-rate', type=float, - help='resnet drop path rate') - parser.add_argument('--encoder-drop-path-rate', type=float, - help='encoder drop path rate') - parser.add_argument('--decoder-drop-path-rate', type=float, - help='encoder drop path rate') - - parser.add_argument('--token-bucket-size', type=int, - help='token bucket size') - parser.add_argument('--image-bucket-size', type=int, - help='image bucket size') - - parser.add_argument('--attn-scale-factor', type=float, - help='attention scale factor') - parser.add_argument('--freeze-resnet', action='store_true', - help='freeze resnet') - parser.add_argument('--freeze-encoder-embedding', action='store_true', - help='freeze encoder token embedding') - parser.add_argument('--freeze-decoder-embedding', action='store_true', - help='freeze decoder token embedding') - parser.add_argument('--add-type-embedding', action='store_true', - help='add source/region/patch type embedding') - - parser.add_argument('--resnet-type', choices=['resnet50', 'resnet101', 'resnet152'], - help='resnet type') - parser.add_argument('--resnet-model-path', type=str, metavar='STR', - help='path to load resnet') - parser.add_argument('--code-image-size', type=int, - help='code image size') - parser.add_argument('--patch-layernorm-embedding', action='store_true', - help='add layernorm to patch embedding') - parser.add_argument('--code-layernorm-embedding', action='store_true', - help='add layernorm to code embedding') - parser.add_argument('--entangle-position-embedding', action='store_true', - help='entangle position embedding') - parser.add_argument('--disable-entangle', action='store_true', - help='disable entangle') - parser.add_argument('--sync-bn', action='store_true', - help='sync batchnorm') - - parser.add_argument('--scale-attn', action='store_true', - help='scale attn') - parser.add_argument('--scale-fc', action='store_true', - help='scale fc') - parser.add_argument('--scale-heads', action='store_true', - help='scale heads') - parser.add_argument('--scale-resids', action='store_true', - help='scale resids') - # fmt: on - - @classmethod - def build_model(cls, args, task): - """Build a new model instance.""" - - # make sure all arguments are present in older models - base_architecture(args) - - if args.encoder_layers_to_keep: - args.encoder_layers = len(args.encoder_layers_to_keep.split(",")) - if args.decoder_layers_to_keep: - args.decoder_layers = len(args.decoder_layers_to_keep.split(",")) - - if getattr(args, "max_source_positions", None) is None: - args.max_source_positions = DEFAULT_MAX_SOURCE_POSITIONS - if getattr(args, "max_target_positions", None) is None: - args.max_target_positions = DEFAULT_MAX_TARGET_POSITIONS - - src_dict, tgt_dict = task.source_dictionary, task.target_dictionary - - if args.share_all_embeddings: - if src_dict != tgt_dict: - raise ValueError("--share-all-embeddings requires a joined dictionary") - if args.encoder_embed_dim != args.decoder_embed_dim: - raise ValueError( - "--share-all-embeddings requires --encoder-embed-dim to match --decoder-embed-dim" - ) - if args.decoder_embed_path and ( - args.decoder_embed_path != args.encoder_embed_path - ): - raise ValueError( - "--share-all-embeddings not compatible with --decoder-embed-path" - ) - encoder_embed_tokens = cls.build_embedding( - args, src_dict, args.encoder_embed_dim, args.encoder_embed_path - ) - decoder_embed_tokens = encoder_embed_tokens - args.share_decoder_input_output_embed = True - else: - encoder_embed_tokens = cls.build_embedding( - args, src_dict, args.encoder_embed_dim, args.encoder_embed_path - ) - decoder_embed_tokens = cls.build_embedding( - args, tgt_dict, args.decoder_embed_dim, args.decoder_embed_path - ) - if getattr(args, "freeze_encoder_embedding", False): - encoder_embed_tokens.weight.requires_grad = False - if getattr(args, "freeze_decoder_embedding", False): - decoder_embed_tokens.weight.requires_grad = False - if getattr(args, "offload_activations", False): - args.checkpoint_activations = True # offloading implies checkpointing - encoder = cls.build_encoder(args, src_dict, encoder_embed_tokens) - decoder = cls.build_decoder(args, tgt_dict, decoder_embed_tokens) - if not args.share_all_embeddings: - min_params_to_wrap = getattr( - args, "min_params_to_wrap", DEFAULT_MIN_PARAMS_TO_WRAP - ) - # fsdp_wrap is a no-op when --ddp-backend != fully_sharded - encoder = fsdp_wrap(encoder, min_num_params=min_params_to_wrap) - decoder = fsdp_wrap(decoder, min_num_params=min_params_to_wrap) - return cls(args, encoder, decoder) - - @classmethod - def build_embedding(cls, args, dictionary, embed_dim, path=None): - num_embeddings = len(dictionary) - padding_idx = dictionary.pad() - - emb = Embedding(num_embeddings, embed_dim, padding_idx) - # if provided, load from preloaded dictionaries - if path: - embed_dict = utils.parse_embedding(path) - utils.load_embedding(embed_dict, dictionary, emb) - return emb - - @classmethod - def build_encoder(cls, args, src_dict, embed_tokens): - return TransformerEncoder(args, src_dict, embed_tokens) - - @classmethod - def build_decoder(cls, args, tgt_dict, embed_tokens): - return TransformerDecoder( - args, - tgt_dict, - embed_tokens, - no_encoder_attn=getattr(args, "no_cross_attention", False), - ) - - # TorchScript doesn't support optional arguments with variable length (**kwargs). - # Current workaround is to add union of all arguments in child classes. - def forward( - self, - src_tokens, - src_lengths, - prev_output_tokens, - return_all_hiddens: bool = True, - features_only: bool = False, - alignment_layer: Optional[int] = None, - alignment_heads: Optional[int] = None, - ): - """ - Run the forward pass for an encoder-decoder model. - - Copied from the base class, but without ``**kwargs``, - which are not supported by TorchScript. - """ - encoder_out = self.encoder( - src_tokens, src_lengths=src_lengths, return_all_hiddens=return_all_hiddens - ) - decoder_out = self.decoder( - prev_output_tokens, - encoder_out=encoder_out, - features_only=features_only, - alignment_layer=alignment_layer, - alignment_heads=alignment_heads, - src_lengths=src_lengths, - return_all_hiddens=return_all_hiddens, - ) - return decoder_out - - # Since get_normalized_probs is in the Fairseq Model which is not scriptable, - # I rewrite the get_normalized_probs from Base Class to call the - # helper function in the Base Class. - @torch.jit.export - def get_normalized_probs( - self, - net_output: Tuple[Tensor, Optional[Dict[str, List[Optional[Tensor]]]]], - log_probs: bool, - sample: Optional[Dict[str, Tensor]] = None, - ): - """Get normalized probabilities (or log probs) from a net's output.""" - return self.get_normalized_probs_scriptable(net_output, log_probs, sample) - - -class TransformerEncoder(FairseqEncoder): - """ - Transformer encoder consisting of *args.encoder_layers* layers. Each layer - is a :class:`TransformerEncoderLayer`. - - Args: - args (argparse.Namespace): parsed command-line arguments - dictionary (~fairseq.data.Dictionary): encoding dictionary - embed_tokens (torch.nn.Embedding): input embedding - """ - - def __init__(self, args, dictionary, embed_tokens): - self.args = args - super().__init__(dictionary) - self.register_buffer("version", torch.Tensor([3])) - - self.dropout_module = FairseqDropout( - args.dropout, module_name=self.__class__.__name__ - ) - self.encoder_layerdrop = args.encoder_layerdrop - - embed_dim = embed_tokens.embedding_dim - self.padding_idx = embed_tokens.padding_idx - self.max_source_positions = args.max_source_positions - self.num_attention_heads = args.encoder_attention_heads - - self.embed_tokens = embed_tokens - - self.embed_scale = 1.0 if args.no_scale_embedding else math.sqrt(embed_dim) - - if getattr(args, "layernorm_embedding", False): - self.layernorm_embedding = LayerNorm(embed_dim) - else: - self.layernorm_embedding = None - - if getattr(args, "add_type_embedding", False): - self.type_embedding = Embedding(2, embed_dim, padding_idx=None) - else: - self.type_embedding = None - - if getattr(args, "sync_bn", False): - norm_layer = BatchNorm2d - else: - norm_layer = None - - if args.resnet_type == 'resnet101': - self.embed_images = ResNet([3, 4, 23], norm_layer=norm_layer, drop_path_rate=args.resnet_drop_path_rate) - elif args.resnet_type == 'resnet152': - self.embed_images = ResNet([3, 8, 36], norm_layer=norm_layer, drop_path_rate=args.resnet_drop_path_rate) - else: - raise NotImplementedError - self.image_proj = Linear(1024, embed_dim) - if getattr(args, "resnet_model_path", None): - print("load resnet {}".format(args.resnet_model_path)) - resnet_state_dict = torch.load(self.args.resnet_model_path) - self.embed_images.load_state_dict(resnet_state_dict) - if getattr(args, "patch_layernorm_embedding", False): - self.patch_layernorm_embedding = LayerNorm(embed_dim) - else: - self.patch_layernorm_embedding = None - - self.embed_positions = Embedding(args.max_source_positions + 2, embed_dim) - self.embed_image_positions = Embedding(args.image_bucket_size ** 2 + 1, embed_dim) - self.pos_ln = LayerNorm(embed_dim) - self.image_pos_ln = LayerNorm(embed_dim) - self.pos_scaling = float(embed_dim / args.encoder_attention_heads * args.attn_scale_factor) ** -0.5 - self.pos_q_linear = nn.Linear(embed_dim, embed_dim) - self.pos_k_linear = nn.Linear(embed_dim, embed_dim) - - if not args.adaptive_input and args.quant_noise_pq > 0: - self.quant_noise = apply_quant_noise_( - nn.Linear(embed_dim, embed_dim, bias=False), - args.quant_noise_pq, - args.quant_noise_pq_block_size, - ) - else: - self.quant_noise = None - - if self.encoder_layerdrop > 0.0: - self.layers = LayerDropModuleList(p=self.encoder_layerdrop) - else: - self.layers = nn.ModuleList([]) - - dpr = [x.item() for x in torch.linspace(0, args.encoder_drop_path_rate, args.encoder_layers)] - self.layers.extend( - [self.build_encoder_layer(args, drop_path_rate=dpr[i]) for i in range(args.encoder_layers)] - ) - self.num_layers = len(self.layers) - - if args.encoder_normalize_before: - self.layer_norm = LayerNorm(embed_dim) - else: - self.layer_norm = None - - token_bucket_size = args.token_bucket_size - token_num_rel_dis = 2 * token_bucket_size - 1 - token_rp_bucket = make_token_bucket_position(token_bucket_size) - self.token_rel_pos_table_list = nn.ModuleList( - [Embedding(token_num_rel_dis, self.num_attention_heads, zero_init=True) for _ in range(args.encoder_layers)] - ) - - image_bucket_size = args.image_bucket_size - image_num_rel_dis = (2 * image_bucket_size - 1) * (2 * image_bucket_size - 1) + 3 - image_rp_bucket = make_image_bucket_position(image_bucket_size, image_num_rel_dis) - self.image_rel_pos_table_list = nn.ModuleList( - [Embedding(image_num_rel_dis, self.num_attention_heads, zero_init=True) for _ in range(args.encoder_layers)] - ) - - self.register_buffer("token_rp_bucket", token_rp_bucket) - self.register_buffer("image_rp_bucket", image_rp_bucket) - self.entangle_position_embedding = args.entangle_position_embedding - - def train(self, mode=True): - super(TransformerEncoder, self).train(mode) - if getattr(self.args, "freeze_resnet", False): - for m in self.embed_images.modules(): - if isinstance(m, nn.BatchNorm2d): - m.eval() - m.weight.requires_grad = False - m.bias.requires_grad = False - - def build_encoder_layer(self, args, drop_path_rate=0.0): - layer = TransformerEncoderLayer(args, drop_path_rate=drop_path_rate) - checkpoint = getattr(args, "checkpoint_activations", False) - if checkpoint: - offload_to_cpu = getattr(args, "offload_activations", False) - layer = checkpoint_wrapper(layer, offload_to_cpu=offload_to_cpu) - # if we are checkpointing, enforce that FSDP always wraps the - # checkpointed layer, regardless of layer size - min_params_to_wrap = ( - getattr(args, "min_params_to_wrap", DEFAULT_MIN_PARAMS_TO_WRAP) - if not checkpoint else 0 - ) - layer = fsdp_wrap(layer, min_num_params=min_params_to_wrap) - return layer - - def get_rel_pos_bias(self, x, idx): - seq_len = x.size(1) - rp_bucket = self.token_rp_bucket[:seq_len, :seq_len] - values = F.embedding(rp_bucket, self.token_rel_pos_table_list[idx].weight) - values = values.unsqueeze(0).expand(x.size(0), -1, -1, -1) - values = values.permute([0, 3, 1, 2]) - return values.contiguous() - - def get_image_rel_pos_bias(self, image_position_ids, idx): - bsz, seq_len = image_position_ids.shape - rp_bucket_size = self.image_rp_bucket.size(1) - - rp_bucket = self.image_rp_bucket.unsqueeze(0).expand( - bsz, rp_bucket_size, rp_bucket_size - ).gather(1, image_position_ids[:, :, None].expand(bsz, seq_len, rp_bucket_size) - ).gather(2, image_position_ids[:, None, :].expand(bsz, seq_len, seq_len)) - values = F.embedding(rp_bucket, self.image_rel_pos_table_list[idx].weight) - values = values.permute(0, 3, 1, 2) - return values - - def get_patch_images_info(self, patch_images, sample_patch_num, device): - image_embed = self.embed_images(patch_images) - h, w = image_embed.shape[-2:] - image_num_patches = h * w - image_padding_mask = patch_images.new_zeros((patch_images.size(0), image_num_patches)).bool() - image_position_idx = torch.arange(w).unsqueeze(0).expand(h, w) + \ - torch.arange(h).unsqueeze(1) * self.args.image_bucket_size + 1 - image_position_idx = image_position_idx.view(-1).to(device) - image_position_ids = image_position_idx[None, :].expand(patch_images.size(0), image_num_patches) - - image_embed = image_embed.flatten(2).transpose(1, 2) - if sample_patch_num is not None: - patch_orders = [ - random.sample(range(image_num_patches), k=sample_patch_num) - for _ in range(patch_images.size(0)) - ] - patch_orders = torch.LongTensor(patch_orders).to(device) - image_embed = image_embed.gather( - 1, patch_orders.unsqueeze(2).expand(-1, -1, image_embed.size(2)) - ) - image_num_patches = sample_patch_num - image_padding_mask = image_padding_mask.gather(1, patch_orders) - image_position_ids = image_position_ids.gather(1, patch_orders) - image_pos_embed = self.embed_image_positions(image_position_ids) - - return image_embed, image_num_patches, image_padding_mask, image_position_ids, image_pos_embed - - def forward_embedding( - self, - src_tokens, - image_embed: Optional[torch.Tensor] = None, - image_embed_2: Optional[torch.Tensor] = None, - token_embedding: Optional[torch.Tensor] = None, - pos_embed: Optional[torch.Tensor] = None, - image_pos_embed: Optional[torch.Tensor] = None, - image_pos_embed_2: Optional[torch.Tensor] = None - ): - # embed tokens and positions - if token_embedding is None: - token_embedding = self.embed_tokens(src_tokens) - x = embed = self.embed_scale * token_embedding - if self.entangle_position_embedding and pos_embed is not None: - x += pos_embed - if self.type_embedding is not None: - x += self.type_embedding(src_tokens.new_zeros(x.size()[:2])) - if self.layernorm_embedding is not None: - x = self.layernorm_embedding(x) - x = self.dropout_module(x) - if self.quant_noise is not None: - x = self.quant_noise(x) - - # embed raw images - if image_embed is not None: - image_embed = self.image_proj(image_embed) - image_x = image_embed = self.embed_scale * image_embed - if self.entangle_position_embedding and image_pos_embed is not None: - image_x += image_pos_embed - if self.type_embedding is not None: - image_x += self.type_embedding(src_tokens.new_ones(image_x.size()[:2])) - if self.patch_layernorm_embedding is not None: - image_x = self.patch_layernorm_embedding(image_x) - image_x = self.dropout_module(image_x) - if self.quant_noise is not None: - image_x = self.quant_noise(image_x) - x = torch.cat([image_x, x], dim=1) - embed = torch.cat([image_embed, embed], dim=1) - - if image_embed_2 is not None: - assert self.type_embedding is not None - image_embed_2 = self.image_proj(image_embed_2) - image_x_2 = image_embed_2 = self.embed_scale * image_embed_2 - if self.entangle_position_embedding and image_pos_embed_2 is not None: - image_x_2 += image_pos_embed_2 - if self.type_embedding is not None: - image_x_2 += self.type_embedding(src_tokens.new_full(image_x_2.size()[:2], fill_value=2)) - if self.patch_layernorm_embedding is not None: - image_x_2 = self.patch_layernorm_embedding(image_x_2) - image_x_2 = self.dropout_module(image_x_2) - if self.quant_noise is not None: - image_x_2 = self.quant_noise(image_x_2) - x = torch.cat([image_x_2, x], dim=1) - embed = torch.cat([image_embed_2, embed], dim=1) - - return x, embed - - def forward( - self, - src_tokens, - src_lengths, - patch_images: Optional[torch.Tensor] = None, - patch_images_2: Optional[torch.Tensor] = None, - patch_masks: Optional[torch.Tensor] = None, - code_masks: Optional[torch.Tensor] = None, - return_all_hiddens: bool = False, - token_embeddings: Optional[torch.Tensor] = None, - sample_patch_num: Optional[int] = None - ): - """ - Args: - src_tokens (LongTensor): tokens in the source language of shape - `(batch, src_len)` - src_lengths (torch.LongTensor): lengths of each source sentence of - shape `(batch)` - return_all_hiddens (bool, optional): also return all of the - intermediate hidden states (default: False). - token_embeddings (torch.Tensor, optional): precomputed embeddings - default `None` will recompute embeddings - - Returns: - dict: - - **encoder_out** (Tensor): the last encoder layer's output of - shape `(src_len, batch, embed_dim)` - - **encoder_padding_mask** (ByteTensor): the positions of - padding elements of shape `(batch, src_len)` - - **encoder_embedding** (Tensor): the (scaled) embedding lookup - of shape `(batch, src_len, embed_dim)` - - **encoder_states** (List[Tensor]): all intermediate - hidden states of shape `(src_len, batch, embed_dim)`. - Only populated if *return_all_hiddens* is True. - """ - return self.forward_scriptable(src_tokens, - src_lengths, - patch_images, - patch_images_2, - patch_masks, - return_all_hiddens, - token_embeddings, - sample_patch_num) - - # TorchScript doesn't support super() method so that the scriptable Subclass - # can't access the base class model in Torchscript. - # Current workaround is to add a helper function with different name and - # call the helper function from scriptable Subclass. - def forward_scriptable( - self, - src_tokens, - src_lengths, - patch_images: Optional[torch.Tensor] = None, - patch_images_2: Optional[torch.Tensor] = None, - patch_masks: Optional[torch.Tensor] = None, - return_all_hiddens: bool = False, - token_embeddings: Optional[torch.Tensor] = None, - sample_patch_num: Optional[int] = None - ): - """ - Args: - src_tokens (LongTensor): tokens in the source language of shape - `(batch, src_len)` - src_lengths (torch.LongTensor): lengths of each source sentence of - shape `(batch)` - return_all_hiddens (bool, optional): also return all of the - intermediate hidden states (default: False). - token_embeddings (torch.Tensor, optional): precomputed embeddings - default `None` will recompute embeddings - - Returns: - dict: - - **encoder_out** (Tensor): the last encoder layer's output of - shape `(src_len, batch, embed_dim)` - - **encoder_padding_mask** (ByteTensor): the positions of - padding elements of shape `(batch, src_len)` - - **encoder_embedding** (Tensor): the (scaled) embedding lookup - of shape `(batch, src_len, embed_dim)` - - **encoder_states** (List[Tensor]): all intermediate - hidden states of shape `(src_len, batch, embed_dim)`. - Only populated if *return_all_hiddens* is True. - """ - image_embed = None - image_embed_2 = None - image_pos_embed = None - image_pos_embed_2 = None - if patch_images is not None: - image_embed, image_num_patches, image_padding_mask, image_position_ids, image_pos_embed = \ - self.get_patch_images_info(patch_images, sample_patch_num, src_tokens.device) - image_padding_mask[~patch_masks] = True - if patch_images_2 is not None: - image_embed_2, image_num_patches_2, image_padding_mask_2, image_position_ids_2, image_pos_embed_2 = \ - self.get_patch_images_info(patch_images_2, sample_patch_num, src_tokens.device) - image_padding_mask_2[~patch_masks] = True - - encoder_padding_mask = src_tokens.eq(self.padding_idx) - if patch_images is not None: - encoder_padding_mask = torch.cat([image_padding_mask, encoder_padding_mask], dim=1) - if patch_images_2 is not None: - encoder_padding_mask = torch.cat([image_padding_mask_2, encoder_padding_mask], dim=1) - has_pads = (src_tokens.device.type == "xla" or encoder_padding_mask.any()) - - pos_embed = self.embed_positions(utils.new_arange(src_tokens)) - x, encoder_embedding = self.forward_embedding( - src_tokens, image_embed, image_embed_2, token_embeddings, - pos_embed, image_pos_embed, image_pos_embed_2 - ) - - # account for padding while computing the representation - if has_pads: - x = x * (1 - encoder_padding_mask.unsqueeze(-1).type_as(x)) - - # B x T x C -> T x B x C - x = x.transpose(0, 1) - - pos_embed = self.pos_ln(pos_embed) - if patch_images is not None: - image_pos_embed = self.image_pos_ln(image_pos_embed) - pos_embed = torch.cat([image_pos_embed, pos_embed], dim=1) - if patch_images_2 is not None: - image_pos_embed_2 = self.image_pos_ln(image_pos_embed_2) - pos_embed = torch.cat([image_pos_embed_2, pos_embed], dim=1) - - pos_q = self.pos_q_linear(pos_embed).view( - x.size(1), x.size(0), self.num_attention_heads, -1 - ).transpose(1, 2) * self.pos_scaling - pos_k = self.pos_k_linear(pos_embed).view( - x.size(1), x.size(0), self.num_attention_heads, -1 - ).transpose(1, 2) - abs_pos_bias = torch.matmul(pos_q, pos_k.transpose(2, 3)) - - encoder_states = [] - - if return_all_hiddens: - encoder_states.append(x) - - # encoder layers - for idx, layer in enumerate(self.layers): - self_attn_bias = abs_pos_bias.clone() - self_attn_bias[:, :, -src_tokens.size(1):, -src_tokens.size(1):] += self.get_rel_pos_bias(src_tokens, idx) - if patch_images_2 is not None: - self_attn_bias[:, :, :image_num_patches_2, :image_num_patches_2] += \ - self.get_image_rel_pos_bias(image_position_ids_2, idx) - self_attn_bias[:, :, image_num_patches_2:image_num_patches_2+image_num_patches, image_num_patches_2:image_num_patches_2+image_num_patches] += \ - self.get_image_rel_pos_bias(image_position_ids, idx) - elif patch_images is not None: - self_attn_bias[:, :, :x.size(0) - src_tokens.size(1), :x.size(0) - src_tokens.size(1)] += \ - self.get_image_rel_pos_bias(image_position_ids, idx) - self_attn_bias = self_attn_bias.reshape(-1, x.size(0), x.size(0)) - - x = layer( - x, encoder_padding_mask=encoder_padding_mask if has_pads else None, self_attn_bias=self_attn_bias - ) - if return_all_hiddens: - assert encoder_states is not None - encoder_states.append(x) - - if self.layer_norm is not None: - x = self.layer_norm(x) - - # The Pytorch Mobile lite interpreter does not supports returning NamedTuple in - # `forward` so we use a dictionary instead. - # TorchScript does not support mixed values so the values are all lists. - # The empty list is equivalent to None. - return { - "encoder_out": [x], # T x B x C - "encoder_padding_mask": [encoder_padding_mask], # B x T - "encoder_embedding": [], # B x T x C - "encoder_states": encoder_states, # List[T x B x C] - "src_tokens": [], - "src_lengths": [], - "position_embeddings": [pos_embed], # B x T x C - } - - @torch.jit.export - def reorder_encoder_out(self, encoder_out: Dict[str, List[Tensor]], new_order): - """ - Reorder encoder output according to *new_order*. - - Args: - encoder_out: output from the ``forward()`` method - new_order (LongTensor): desired order - - Returns: - *encoder_out* rearranged according to *new_order* - """ - if len(encoder_out["encoder_out"]) == 0: - new_encoder_out = [] - else: - new_encoder_out = [encoder_out["encoder_out"][0].index_select(1, new_order)] - if len(encoder_out["encoder_padding_mask"]) == 0: - new_encoder_padding_mask = [] - else: - new_encoder_padding_mask = [ - encoder_out["encoder_padding_mask"][0].index_select(0, new_order) - ] - if len(encoder_out["encoder_embedding"]) == 0: - new_encoder_embedding = [] - else: - new_encoder_embedding = [ - encoder_out["encoder_embedding"][0].index_select(0, new_order) - ] - - if len(encoder_out["src_tokens"]) == 0: - new_src_tokens = [] - else: - new_src_tokens = [(encoder_out["src_tokens"][0]).index_select(0, new_order)] - - if len(encoder_out["src_lengths"]) == 0: - new_src_lengths = [] - else: - new_src_lengths = [(encoder_out["src_lengths"][0]).index_select(0, new_order)] - - if len(encoder_out["position_embeddings"]) == 0: - new_position_embeddings = [] - else: - new_position_embeddings = [(encoder_out["position_embeddings"][0]).index_select(0, new_order)] - - encoder_states = encoder_out["encoder_states"] - if len(encoder_states) > 0: - for idx, state in enumerate(encoder_states): - encoder_states[idx] = state.index_select(1, new_order) - - return { - "encoder_out": new_encoder_out, # T x B x C - "encoder_padding_mask": new_encoder_padding_mask, # B x T - "encoder_embedding": new_encoder_embedding, # B x T x C - "encoder_states": encoder_states, # List[T x B x C] - "src_tokens": new_src_tokens, # B x T - "src_lengths": new_src_lengths, # B x 1 - "position_embeddings": new_position_embeddings, # B x T x C - } - - def max_positions(self): - """Maximum input length supported by the encoder.""" - if self.embed_positions is None: - return self.max_source_positions - return self.max_source_positions - - def upgrade_state_dict_named(self, state_dict, name): - """Upgrade a (possibly old) state dict for new versions of fairseq.""" - if isinstance(self.embed_positions, SinusoidalPositionalEmbedding): - weights_key = "{}.embed_positions.weights".format(name) - if weights_key in state_dict: - print("deleting {0}".format(weights_key)) - del state_dict[weights_key] - state_dict[ - "{}.embed_positions._float_tensor".format(name) - ] = torch.FloatTensor(1) - for i in range(self.num_layers): - # update layer norms - self.layers[i].upgrade_state_dict_named( - state_dict, "{}.layers.{}".format(name, i) - ) - - # version_key = "{}.version".format(name) - # if utils.item(state_dict.get(version_key, torch.Tensor([1]))[0]) < 2: - # # earlier checkpoints did not normalize after the stack of layers - # self.layer_norm = None - # self.normalize = False - # state_dict[version_key] = torch.Tensor([1]) - - prefix = name + "." if name != "" else "" - for param_name, param_tensor in self.state_dict().items(): - if (prefix + param_name) not in state_dict and param_name in self.state_dict(): - state_dict[prefix + param_name] = self.state_dict()[param_name] - - if len(state_dict["encoder.embed_image_positions.weight"]) < len(self.state_dict()["embed_image_positions.weight"]): - num_posids_to_add = len(self.state_dict()["embed_image_positions.weight"]) - len(state_dict["encoder.embed_image_positions.weight"]) - embed_dim = state_dict["encoder.embed_image_positions.weight"].size(1) - new_pos_embed_to_add = torch.zeros(num_posids_to_add, embed_dim) - nn.init.normal_(new_pos_embed_to_add, mean=0, std=embed_dim ** -0.5) - new_pos_embed_to_add = new_pos_embed_to_add.to( - dtype=state_dict["encoder.embed_image_positions.weight"].dtype, - ) - state_dict["encoder.embed_image_positions.weight"] = torch.cat( - [state_dict["encoder.embed_image_positions.weight"], new_pos_embed_to_add] - ) - return state_dict - - -class TransformerDecoder(FairseqIncrementalDecoder): - """ - Transformer decoder consisting of *args.decoder_layers* layers. Each layer - is a :class:`TransformerDecoderLayer`. - - Args: - args (argparse.Namespace): parsed command-line arguments - dictionary (~fairseq.data.Dictionary): decoding dictionary - embed_tokens (torch.nn.Embedding): output embedding - no_encoder_attn (bool, optional): whether to attend to encoder outputs - (default: False). - """ - - def __init__( - self, - args, - dictionary, - embed_tokens, - no_encoder_attn=False, - output_projection=None, - ): - self.args = args - super().__init__(dictionary) - self.register_buffer("version", torch.Tensor([3])) - self._future_mask = torch.empty(0) - - self.dropout_module = FairseqDropout( - args.dropout, module_name=self.__class__.__name__ - ) - self.decoder_layerdrop = args.decoder_layerdrop - self.share_input_output_embed = args.share_decoder_input_output_embed - self.num_attention_heads = args.decoder_attention_heads - - input_embed_dim = embed_tokens.embedding_dim - embed_dim = args.decoder_embed_dim - self.embed_dim = embed_dim - self.output_embed_dim = args.decoder_output_dim - - self.padding_idx = embed_tokens.padding_idx - self.max_target_positions = args.max_target_positions - - self.embed_tokens = embed_tokens - - self.embed_scale = 1.0 if args.no_scale_embedding else math.sqrt(embed_dim) - - if not args.adaptive_input and args.quant_noise_pq > 0: - self.quant_noise = apply_quant_noise_( - nn.Linear(embed_dim, embed_dim, bias=False), - args.quant_noise_pq, - args.quant_noise_pq_block_size, - ) - else: - self.quant_noise = None - - self.project_in_dim = ( - Linear(input_embed_dim, embed_dim, bias=False) - if embed_dim != input_embed_dim - else None - ) - - if getattr(args, "layernorm_embedding", False): - self.layernorm_embedding = LayerNorm(embed_dim) - else: - self.layernorm_embedding = None - - self.window_size = args.code_image_size // 8 - - self.embed_positions = Embedding(args.max_target_positions + 2, embed_dim) - self.embed_image_positions = Embedding(args.image_bucket_size ** 2 + 1, embed_dim) - self.pos_ln = LayerNorm(embed_dim) - self.image_pos_ln = LayerNorm(embed_dim) - self.pos_scaling = float(embed_dim / self.num_attention_heads * args.attn_scale_factor) ** -0.5 - self.self_pos_q_linear = nn.Linear(embed_dim, embed_dim) - self.self_pos_k_linear = nn.Linear(embed_dim, embed_dim) - self.cross_pos_q_linear = nn.Linear(embed_dim, embed_dim) - self.cross_pos_k_linear = nn.Linear(embed_dim, embed_dim) - - if getattr(args, "code_layernorm_embedding", False): - self.code_layernorm_embedding = LayerNorm(embed_dim) - else: - self.code_layernorm_embedding = None - - self.cross_self_attention = getattr(args, "cross_self_attention", False) - - if self.decoder_layerdrop > 0.0: - self.layers = LayerDropModuleList(p=self.decoder_layerdrop) - else: - self.layers = nn.ModuleList([]) - - dpr = [x.item() for x in torch.linspace(0, args.decoder_drop_path_rate, args.decoder_layers)] - self.layers.extend( - [ - self.build_decoder_layer(args, no_encoder_attn, drop_path_rate=dpr[i]) - for i in range(args.decoder_layers) - ] - ) - self.num_layers = len(self.layers) - - if args.decoder_normalize_before: - self.layer_norm = LayerNorm(embed_dim) - else: - self.layer_norm = None - - self.project_out_dim = ( - Linear(embed_dim, self.output_embed_dim, bias=False) - if embed_dim != self.output_embed_dim and not args.tie_adaptive_weights - else None - ) - - self.adaptive_softmax = None - self.output_projection = output_projection - if self.output_projection is None: - self.build_output_projection(args, dictionary, embed_tokens) - - token_bucket_size = args.token_bucket_size - token_num_rel_dis = 2 * token_bucket_size - 1 - token_rp_bucket = make_token_bucket_position(token_bucket_size) - self.token_rel_pos_table_list = nn.ModuleList( - [Embedding(token_num_rel_dis, self.num_attention_heads, zero_init=True) for _ in range(args.decoder_layers)] - ) - - image_bucket_size = args.image_bucket_size - image_num_rel_dis = (2 * image_bucket_size - 1) * (2 * image_bucket_size - 1) + 3 - image_rp_bucket = make_image_bucket_position(image_bucket_size, image_num_rel_dis) - image_position_idx = torch.arange(self.window_size).unsqueeze(0).expand(self.window_size, self.window_size) + \ - torch.arange(self.window_size).unsqueeze(1) * image_bucket_size + 1 - image_position_idx = torch.cat([torch.tensor([0]), image_position_idx.view(-1)]) - image_position_idx = torch.cat([image_position_idx, torch.tensor([1024] * 768)]) - self.image_rel_pos_table_list = nn.ModuleList( - [Embedding(image_num_rel_dis, self.num_attention_heads, zero_init=True) for _ in range(args.decoder_layers)] - ) - - self.register_buffer("token_rp_bucket", token_rp_bucket) - self.register_buffer("image_rp_bucket", image_rp_bucket) - self.register_buffer("image_position_idx", image_position_idx) - self.entangle_position_embedding = args.entangle_position_embedding - - def build_output_projection(self, args, dictionary, embed_tokens): - if args.adaptive_softmax_cutoff is not None: - self.adaptive_softmax = AdaptiveSoftmax( - len(dictionary), - self.output_embed_dim, - utils.eval_str_list(args.adaptive_softmax_cutoff, type=int), - dropout=args.adaptive_softmax_dropout, - adaptive_inputs=embed_tokens if args.tie_adaptive_weights else None, - factor=args.adaptive_softmax_factor, - tie_proj=args.tie_adaptive_proj, - ) - elif self.share_input_output_embed: - self.output_projection = nn.Linear( - self.embed_tokens.weight.shape[1], - self.embed_tokens.weight.shape[0], - bias=False, - ) - self.output_projection.weight = self.embed_tokens.weight - else: - self.output_projection = nn.Linear( - self.output_embed_dim, len(dictionary), bias=False - ) - nn.init.normal_( - self.output_projection.weight, mean=0, std=self.output_embed_dim ** -0.5 - ) - num_base_layers = getattr(args, "base_layers", 0) - for i in range(num_base_layers): - self.layers.insert(((i+1) * args.decoder_layers) // (num_base_layers + 1), BaseLayer(args)) - - def build_decoder_layer(self, args, no_encoder_attn=False, drop_path_rate=0.0): - layer = TransformerDecoderLayer(args, no_encoder_attn, drop_path_rate=drop_path_rate) - checkpoint = getattr(args, "checkpoint_activations", False) - if checkpoint: - offload_to_cpu = getattr(args, "offload_activations", False) - layer = checkpoint_wrapper(layer, offload_to_cpu=offload_to_cpu) - # if we are checkpointing, enforce that FSDP always wraps the - # checkpointed layer, regardless of layer size - min_params_to_wrap = ( - getattr(args, "min_params_to_wrap", DEFAULT_MIN_PARAMS_TO_WRAP) - if not checkpoint else 0 - ) - layer = fsdp_wrap(layer, min_num_params=min_params_to_wrap) - return layer - - def get_rel_pos_bias(self, x, idx): - seq_len = x.size(1) - rp_bucket = self.token_rp_bucket[:seq_len, :seq_len] - values = F.embedding(rp_bucket, self.token_rel_pos_table_list[idx].weight) - values = values.permute([2, 0, 1]) - return values.contiguous() - - def get_image_rel_pos_bias(self, x, idx): - seq_len = x.size(1) - image_position_idx = self.image_position_idx[:seq_len] - rp_bucket = self.image_rp_bucket[image_position_idx][:, image_position_idx] - values = F.embedding(rp_bucket, self.image_rel_pos_table_list[idx].weight) - values = values.permute(2, 0, 1) - return values - - def get_pos_info(self, tokens, tgt_pos_embed, src_pos_embed=None, use_image=False): - batch_size = tokens.size(0) - tgt_len = tokens.size(1) - tgt_pos_embed = self.image_pos_ln(tgt_pos_embed) if use_image else self.pos_ln(tgt_pos_embed) - if src_pos_embed is not None: - src_len = src_pos_embed.size(1) - pos_q = self.cross_pos_q_linear(tgt_pos_embed).view( - batch_size, tgt_len, self.num_attention_heads, -1 - ).transpose(1, 2) * self.pos_scaling - pos_k = self.cross_pos_k_linear(src_pos_embed).view( - batch_size, src_len, self.num_attention_heads, -1 - ).transpose(1, 2) - else: - src_len = tgt_pos_embed.size(1) - pos_q = self.self_pos_q_linear(tgt_pos_embed).view( - batch_size, tgt_len, self.num_attention_heads, -1 - ).transpose(1, 2) * self.pos_scaling - pos_k = self.self_pos_k_linear(tgt_pos_embed).view( - batch_size, src_len, self.num_attention_heads, -1 - ).transpose(1, 2) - abs_pos_bias = torch.matmul(pos_q, pos_k.transpose(2, 3)) - return abs_pos_bias - - def forward( - self, - prev_output_tokens, - code_masks: Optional[torch.Tensor] = None, - encoder_out: Optional[Dict[str, List[Tensor]]] = None, - incremental_state: Optional[Dict[str, Dict[str, Optional[Tensor]]]] = None, - features_only: bool = False, - full_context_alignment: bool = False, - alignment_layer: Optional[int] = None, - alignment_heads: Optional[int] = None, - src_lengths: Optional[Any] = None, - return_all_hiddens: bool = False, - ): - """ - Args: - prev_output_tokens (LongTensor): previous decoder outputs of shape - `(batch, tgt_len)`, for teacher forcing - encoder_out (optional): output from the encoder, used for - encoder-side attention, should be of size T x B x C - incremental_state (dict): dictionary used for storing state during - :ref:`Incremental decoding` - features_only (bool, optional): only return features without - applying output layer (default: False). - full_context_alignment (bool, optional): don't apply - auto-regressive mask to self-attention (default: False). - - Returns: - tuple: - - the decoder's output of shape `(batch, tgt_len, vocab)` - - a dictionary with any model-specific outputs - """ - - x, extra = self.extract_features( - prev_output_tokens, - code_masks=code_masks, - encoder_out=encoder_out, - incremental_state=incremental_state, - full_context_alignment=full_context_alignment, - alignment_layer=alignment_layer, - alignment_heads=alignment_heads, - ) - - if not features_only: - x = self.output_layer(x) - return x, extra - - def extract_features( - self, - prev_output_tokens, - code_masks: Optional[torch.Tensor], - encoder_out: Optional[Dict[str, List[Tensor]]], - incremental_state: Optional[Dict[str, Dict[str, Optional[Tensor]]]] = None, - full_context_alignment: bool = False, - alignment_layer: Optional[int] = None, - alignment_heads: Optional[int] = None, - ): - return self.extract_features_scriptable( - prev_output_tokens, - code_masks, - encoder_out, - incremental_state, - full_context_alignment, - alignment_layer, - alignment_heads, - ) - - """ - A scriptable subclass of this class has an extract_features method and calls - super().extract_features, but super() is not supported in torchscript. A copy of - this function is made to be used in the subclass instead. - """ - - def extract_features_scriptable( - self, - prev_output_tokens, - code_masks: Optional[torch.Tensor], - encoder_out: Optional[Dict[str, List[Tensor]]], - incremental_state: Optional[Dict[str, Dict[str, Optional[Tensor]]]] = None, - full_context_alignment: bool = False, - alignment_layer: Optional[int] = None, - alignment_heads: Optional[int] = None, - ): - """ - Similar to *forward* but only return features. - - Includes several features from "Jointly Learning to Align and - Translate with Transformer Models" (Garg et al., EMNLP 2019). - - Args: - full_context_alignment (bool, optional): don't apply - auto-regressive mask to self-attention (default: False). - alignment_layer (int, optional): return mean alignment over - heads at this layer (default: last layer). - alignment_heads (int, optional): only average alignment over - this many heads (default: all heads). - - Returns: - tuple: - - the decoder's features of shape `(batch, tgt_len, embed_dim)` - - a dictionary with any model-specific outputs - """ - bs, slen = prev_output_tokens.size() - if alignment_layer is None: - alignment_layer = self.num_layers - 1 - - enc: Optional[Tensor] = None - padding_mask: Optional[Tensor] = None - if encoder_out is not None and len(encoder_out["encoder_out"]) > 0: - enc = encoder_out["encoder_out"][0] - assert ( - enc.size()[1] == bs - ), f"Expected enc.shape == (t, {bs}, c) got {enc.shape}" - if encoder_out is not None and len(encoder_out["encoder_padding_mask"]) > 0: - padding_mask = encoder_out["encoder_padding_mask"][0] - - bsz, tgt_len = prev_output_tokens.shape - token_position_idx = utils.new_arange(prev_output_tokens) - tgt_pos_embed = self.embed_positions(token_position_idx) - if code_masks is not None and torch.any(code_masks): - image_position_idx = self.image_position_idx[:prev_output_tokens.size(1)].unsqueeze(0).expand(bsz, tgt_len) - tgt_pos_embed[code_masks] = self.embed_image_positions(image_position_idx)[code_masks] - - # self attn position bias - self_abs_pos_bias = self.get_pos_info(prev_output_tokens, tgt_pos_embed, use_image=False) - if code_masks is not None and torch.any(code_masks): - self_image_abs_pos_bias = self.get_pos_info(prev_output_tokens, tgt_pos_embed, use_image=True) - self_abs_pos_bias[code_masks] = self_image_abs_pos_bias[code_masks] - # cross attn position bias - src_pos_embed = encoder_out['position_embeddings'][0] - cross_abs_pos_bias = self.get_pos_info(prev_output_tokens, tgt_pos_embed, src_pos_embed=src_pos_embed) - if code_masks is not None and torch.any(code_masks): - cross_image_abs_pos_bias = self.get_pos_info(prev_output_tokens, tgt_pos_embed, src_pos_embed=src_pos_embed, use_image=True) - cross_abs_pos_bias[code_masks] = cross_image_abs_pos_bias[code_masks] - cross_abs_pos_bias = cross_abs_pos_bias.reshape(-1, *cross_abs_pos_bias.size()[-2:]) - - all_prev_output_tokens = prev_output_tokens.clone() - if incremental_state is not None: - prev_output_tokens = prev_output_tokens[:, -1:] - cross_abs_pos_bias = cross_abs_pos_bias[:, -1:, :] - tgt_pos_embed = tgt_pos_embed[:, -1:, :] - - # embed tokens and positions - x = self.embed_scale * self.embed_tokens(prev_output_tokens) - - if self.quant_noise is not None: - x = self.quant_noise(x) - - if self.project_in_dim is not None: - x = self.project_in_dim(x) - - if self.entangle_position_embedding is not None and not self.args.disable_entangle: - x += tgt_pos_embed - - if self.layernorm_embedding is not None: - if code_masks is None or not code_masks.any() or not getattr(self, "code_layernorm_embedding", False): - x = self.layernorm_embedding(x) - elif code_masks is not None and code_masks.all(): - x = self.code_layernorm_embedding(x) - else: - x[~code_masks] = self.layernorm_embedding(x[~code_masks]) - x[code_masks] = self.code_layernorm_embedding(x[code_masks]) - - x = self.dropout_module(x) - - # B x T x C -> T x B x C - x = x.transpose(0, 1) - - self_attn_padding_mask: Optional[Tensor] = None - if self.cross_self_attention or prev_output_tokens.eq(self.padding_idx).any(): - self_attn_padding_mask = prev_output_tokens.eq(self.padding_idx) - - # decoder layers - attn: Optional[Tensor] = None - inner_states: List[Optional[Tensor]] = [x] - for idx, layer in enumerate(self.layers): - if incremental_state is None and not full_context_alignment: - self_attn_mask = self.buffered_future_mask(x) - else: - self_attn_mask = None - - self_attn_bias = self_abs_pos_bias.clone() - if code_masks is None or not code_masks.any(): - self_attn_bias += self.get_rel_pos_bias(all_prev_output_tokens, idx).unsqueeze(0) - elif code_masks is not None and code_masks.all(): - self_attn_bias += self.get_image_rel_pos_bias(all_prev_output_tokens, idx).unsqueeze(0) - else: - self_attn_bias[~code_masks] += self.get_rel_pos_bias(all_prev_output_tokens, idx).unsqueeze(0) - self_attn_bias[code_masks] += self.get_image_rel_pos_bias(all_prev_output_tokens, idx).unsqueeze(0) - self_attn_bias = self_attn_bias.reshape(-1, *self_attn_bias.size()[-2:]) - if incremental_state is not None: - self_attn_bias = self_attn_bias[:, -1:, :] - - x, layer_attn, _ = layer( - x, - enc, - padding_mask, - incremental_state, - self_attn_mask=self_attn_mask, - self_attn_padding_mask=self_attn_padding_mask, - need_attn=bool((idx == alignment_layer)), - need_head_weights=bool((idx == alignment_layer)), - self_attn_bias=self_attn_bias, - cross_attn_bias=cross_abs_pos_bias - ) - inner_states.append(x) - if layer_attn is not None and idx == alignment_layer: - attn = layer_attn.float().to(x) - - if attn is not None: - if alignment_heads is not None: - attn = attn[:alignment_heads] - - # average probabilities over heads - attn = attn.mean(dim=0) - - if self.layer_norm is not None: - x = self.layer_norm(x) - - # T x B x C -> B x T x C - x = x.transpose(0, 1) - - if self.project_out_dim is not None: - x = self.project_out_dim(x) - - return x, {"attn": [attn], "inner_states": inner_states} - - def output_layer(self, features): - """Project features to the vocabulary size.""" - if self.adaptive_softmax is None: - # project back to size of vocabulary - return self.output_projection(features) - else: - return features - - def max_positions(self): - """Maximum output length supported by the decoder.""" - if self.embed_positions is None: - return self.max_target_positions - return self.max_target_positions - - def buffered_future_mask(self, tensor): - dim = tensor.size(0) - # self._future_mask.device != tensor.device is not working in TorchScript. This is a workaround. - if ( - self._future_mask.size(0) == 0 - or (not self._future_mask.device == tensor.device) - or self._future_mask.size(0) < dim - ): - self._future_mask = torch.triu( - utils.fill_with_neg_inf(torch.zeros([dim, dim])), 1 - ) - self._future_mask = self._future_mask.to(tensor) - return self._future_mask[:dim, :dim] - - def upgrade_state_dict_named(self, state_dict, name): - """Upgrade a (possibly old) state dict for new versions of fairseq.""" - if isinstance(self.embed_positions, SinusoidalPositionalEmbedding): - weights_key = "{}.embed_positions.weights".format(name) - if weights_key in state_dict: - del state_dict[weights_key] - state_dict[ - "{}.embed_positions._float_tensor".format(name) - ] = torch.FloatTensor(1) - - if f"{name}.output_projection.weight" not in state_dict: - if self.share_input_output_embed: - embed_out_key = f"{name}.embed_tokens.weight" - else: - embed_out_key = f"{name}.embed_out" - if embed_out_key in state_dict: - state_dict[f"{name}.output_projection.weight"] = state_dict[ - embed_out_key - ] - if not self.share_input_output_embed: - del state_dict[embed_out_key] - - for i in range(self.num_layers): - # update layer norms - self.layers[i].upgrade_state_dict_named( - state_dict, "{}.layers.{}".format(name, i) - ) - - # version_key = "{}.version".format(name) - # if utils.item(state_dict.get(version_key, torch.Tensor([1]))[0]) <= 2: - # # earlier checkpoints did not normalize after the stack of layers - # self.layer_norm = None - # self.normalize = False - # state_dict[version_key] = torch.Tensor([1]) - - prefix = name + "." if name != "" else "" - image_params = ["image_position_idx"] - for image_param in image_params: - state_dict[prefix + image_param] = self.state_dict()[image_param] - for param_name, param_tensor in self.state_dict().items(): - if (prefix + param_name) not in state_dict and param_name in self.state_dict(): - state_dict[prefix + param_name] = self.state_dict()[param_name] - - if len(state_dict["decoder.embed_image_positions.weight"]) < len(self.state_dict()["embed_image_positions.weight"]): - num_posids_to_add = len(self.state_dict()["embed_image_positions.weight"]) - len(state_dict["decoder.embed_image_positions.weight"]) - embed_dim = state_dict["decoder.embed_image_positions.weight"].size(1) - new_pos_embed_to_add = torch.zeros(num_posids_to_add, embed_dim) - nn.init.normal_(new_pos_embed_to_add, mean=0, std=embed_dim ** -0.5) - new_pos_embed_to_add = new_pos_embed_to_add.to( - dtype=state_dict["decoder.embed_image_positions.weight"].dtype, - ) - state_dict["decoder.embed_image_positions.weight"] = torch.cat( - [state_dict["decoder.embed_image_positions.weight"], new_pos_embed_to_add] - ) - return state_dict - - -def Embedding(num_embeddings, embedding_dim, padding_idx=None, zero_init=False): - m = nn.Embedding(num_embeddings, embedding_dim, padding_idx=padding_idx) - nn.init.normal_(m.weight, mean=0, std=embedding_dim ** -0.5) - if padding_idx is not None: - nn.init.constant_(m.weight[padding_idx], 0) - if zero_init: - nn.init.constant_(m.weight, 0) - return m - - -def Linear(in_features, out_features, bias=True): - m = nn.Linear(in_features, out_features, bias) - nn.init.xavier_uniform_(m.weight) - if bias: - nn.init.constant_(m.bias, 0.0) - return m - - -@register_model_architecture("unify_transformer", "unify_transformer") -def base_architecture(args): - args.encoder_embed_path = getattr(args, "encoder_embed_path", None) - args.encoder_embed_dim = getattr(args, "encoder_embed_dim", 512) - args.encoder_ffn_embed_dim = getattr(args, "encoder_ffn_embed_dim", 2048) - args.encoder_layers = getattr(args, "encoder_layers", 6) - args.encoder_attention_heads = getattr(args, "encoder_attention_heads", 8) - args.encoder_normalize_before = getattr(args, "encoder_normalize_before", False) - args.encoder_learned_pos = getattr(args, "encoder_learned_pos", False) - args.decoder_embed_path = getattr(args, "decoder_embed_path", None) - args.decoder_embed_dim = getattr(args, "decoder_embed_dim", args.encoder_embed_dim) - args.decoder_ffn_embed_dim = getattr( - args, "decoder_ffn_embed_dim", args.encoder_ffn_embed_dim - ) - args.decoder_layers = getattr(args, "decoder_layers", 6) - args.decoder_attention_heads = getattr(args, "decoder_attention_heads", 8) - args.decoder_normalize_before = getattr(args, "decoder_normalize_before", False) - args.decoder_learned_pos = getattr(args, "decoder_learned_pos", False) - args.attention_dropout = getattr(args, "attention_dropout", 0.0) - args.activation_dropout = getattr(args, "activation_dropout", 0.0) - args.activation_fn = getattr(args, "activation_fn", "relu") - args.dropout = getattr(args, "dropout", 0.1) - args.adaptive_softmax_cutoff = getattr(args, "adaptive_softmax_cutoff", None) - args.adaptive_softmax_dropout = getattr(args, "adaptive_softmax_dropout", 0) - args.share_decoder_input_output_embed = getattr( - args, "share_decoder_input_output_embed", False - ) - args.share_all_embeddings = getattr(args, "share_all_embeddings", False) - args.no_token_positional_embeddings = getattr( - args, "no_token_positional_embeddings", False - ) - args.adaptive_input = getattr(args, "adaptive_input", False) - args.no_cross_attention = getattr(args, "no_cross_attention", False) - args.cross_self_attention = getattr(args, "cross_self_attention", False) - - args.decoder_output_dim = getattr( - args, "decoder_output_dim", args.decoder_embed_dim - ) - args.decoder_input_dim = getattr(args, "decoder_input_dim", args.decoder_embed_dim) - - args.no_scale_embedding = getattr(args, "no_scale_embedding", False) - args.layernorm_embedding = getattr(args, "layernorm_embedding", False) - args.tie_adaptive_weights = getattr(args, "tie_adaptive_weights", False) - args.checkpoint_activations = getattr(args, "checkpoint_activations", False) - args.offload_activations = getattr(args, "offload_activations", False) - if args.offload_activations: - args.checkpoint_activations = True - args.encoder_layers_to_keep = getattr(args, "encoder_layers_to_keep", None) - args.decoder_layers_to_keep = getattr(args, "decoder_layers_to_keep", None) - args.encoder_layerdrop = getattr(args, "encoder_layerdrop", 0) - args.decoder_layerdrop = getattr(args, "decoder_layerdrop", 0) - args.quant_noise_pq = getattr(args, "quant_noise_pq", 0) - args.quant_noise_pq_block_size = getattr(args, "quant_noise_pq_block_size", 8) - args.quant_noise_scalar = getattr(args, "quant_noise_scalar", 0) \ No newline at end of file diff --git a/spaces/OFA-Sys/OFA-Image_Caption/run_scripts/caption/train_caption_stage2.sh b/spaces/OFA-Sys/OFA-Image_Caption/run_scripts/caption/train_caption_stage2.sh deleted file mode 100644 index 16839236c08622e788c70cad6f27b65b3c9b17fe..0000000000000000000000000000000000000000 --- a/spaces/OFA-Sys/OFA-Image_Caption/run_scripts/caption/train_caption_stage2.sh +++ /dev/null @@ -1,101 +0,0 @@ -#!/usr/bin/env - -log_dir=./stage2_logs -save_dir=./stage2_checkpoints -mkdir -p $log_dir $save_dir - -bpe_dir=../../utils/BPE -user_dir=../../ofa_module - -data_dir=../../dataset/caption_data -data=${data_dir}/caption_stage2_train.tsv,${data_dir}/caption_val.tsv -restore_file=../../checkpoints/caption_stage1_best.pt -selected_cols=1,4,2 - -task=caption -arch=ofa_large -criterion=scst_reward_criterion -label_smoothing=0.1 -lr=1e-5 -max_epoch=5 -warmup_ratio=0.06 -batch_size=2 -update_freq=4 -resnet_drop_path_rate=0.0 -encoder_drop_path_rate=0.0 -decoder_drop_path_rate=0.0 -dropout=0.0 -attention_dropout=0.0 -max_src_length=80 -max_tgt_length=20 -num_bins=1000 -patch_image_size=480 -eval_cider_cached=${data_dir}/cider_cached_tokens/coco-valid-words.p -scst_cider_cached=${data_dir}/cider_cached_tokens/coco-train-words.p - -for lr in {1e-5,}; do - echo "lr "${lr} - for max_epoch in {4,}; do - echo "max_epoch "${max_epoch} - - log_file=${log_dir}/${lr}"_"${max_epoch}".log" - save_path=${save_dir}/${lr}"_"${max_epoch} - mkdir -p $save_path - - CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7 python3 ../../train.py \ - $data \ - --selected-cols=${selected_cols} \ - --bpe-dir=${bpe_dir} \ - --user-dir=${user_dir} \ - --restore-file=${restore_file} \ - --reset-optimizer --reset-dataloader --reset-meters \ - --save-dir=${save_path} \ - --task=${task} \ - --arch=${arch} \ - --criterion=${criterion} \ - --batch-size=${batch_size} \ - --update-freq=${update_freq} \ - --encoder-normalize-before \ - --decoder-normalize-before \ - --share-decoder-input-output-embed \ - --share-all-embeddings \ - --layernorm-embedding \ - --patch-layernorm-embedding \ - --code-layernorm-embedding \ - --resnet-drop-path-rate=${resnet_drop_path_rate} \ - --encoder-drop-path-rate=${encoder_drop_path_rate} \ - --decoder-drop-path-rate=${decoder_drop_path_rate} \ - --dropout=${dropout} \ - --attention-dropout=${attention_dropout} \ - --weight-decay=0.01 --optimizer=adam --adam-betas="(0.9,0.999)" --adam-eps=1e-08 --clip-norm=1.0 \ - --lr-scheduler=polynomial_decay --lr=${lr} \ - --max-epoch=${max_epoch} --warmup-ratio=${warmup_ratio} \ - --log-format=simple --log-interval=10 \ - --fixed-validation-seed=7 \ - --no-epoch-checkpoints --keep-best-checkpoints=1 \ - --save-interval=1 --validate-interval=1 \ - --save-interval-updates=500 --validate-interval-updates=500 \ - --eval-cider \ - --eval-cider-cached-tokens=${eval_cider_cached} \ - --eval-args='{"beam":5,"max_len_b":16,"no_repeat_ngram_size":3}' \ - --best-checkpoint-metric=cider --maximize-best-checkpoint-metric \ - --max-src-length=${max_src_length} \ - --max-tgt-length=${max_tgt_length} \ - --find-unused-parameters \ - --freeze-encoder-embedding \ - --freeze-decoder-embedding \ - --add-type-embedding \ - --scale-attn \ - --scale-fc \ - --scale-heads \ - --disable-entangle \ - --num-bins=${num_bins} \ - --patch-image-size=${patch_image_size} \ - --scst \ - --scst-cider-cached-tokens=${scst_cider_cached} \ - --scst-args='{"beam":5,"max_len_b":16,"no_repeat_ngram_size":3}' \ - --memory-efficient-fp16 \ - --fp16-scale-window=512 \ - --num-workers=0 >> ${log_file} 2>&1 - done -done \ No newline at end of file diff --git a/spaces/OFA-Sys/OFA-vqa/fairseq/examples/speech_synthesis/evaluation/eval_asr.py b/spaces/OFA-Sys/OFA-vqa/fairseq/examples/speech_synthesis/evaluation/eval_asr.py deleted file mode 100644 index 005a11bfb34ca477ad9e133acd60f249e66cda47..0000000000000000000000000000000000000000 --- a/spaces/OFA-Sys/OFA-vqa/fairseq/examples/speech_synthesis/evaluation/eval_asr.py +++ /dev/null @@ -1,128 +0,0 @@ -# Copyright (c) Facebook, Inc. and its affiliates. -# -# This source code is licensed under the MIT license found in the -# LICENSE file in the root directory of this source tree. - -import argparse -import editdistance -import re -import shutil -import soundfile as sf -import subprocess -from pathlib import Path - -from examples.speech_to_text.data_utils import load_tsv_to_dicts - - -def preprocess_text(text): - text = "|".join(re.sub(r"[^A-Z' ]", " ", text.upper()).split()) - text = " ".join(text) - return text - - -def prepare_w2v_data( - dict_dir, sample_rate, label, audio_paths, texts, split, data_dir -): - data_dir.mkdir(parents=True, exist_ok=True) - shutil.copyfile( - dict_dir / f"dict.{label}.txt", - data_dir / f"dict.{label}.txt" - ) - with open(data_dir / f"{split}.tsv", "w") as f: - f.write("/\n") - for audio_path in audio_paths: - wav, sr = sf.read(audio_path) - assert sr == sample_rate, f"{sr} != sample_rate" - nsample = len(wav) - f.write(f"{audio_path}\t{nsample}\n") - with open(data_dir / f"{split}.{label}", "w") as f: - for text in texts: - text = preprocess_text(text) - f.write(f"{text}\n") - - -def run_asr(asr_dir, split, w2v_ckpt, w2v_label, res_dir): - """ - results will be saved at - {res_dir}/{ref,hypo}.word-{w2v_ckpt.filename}-{split}.txt - """ - cmd = ["python", "-m", "examples.speech_recognition.infer"] - cmd += [str(asr_dir.resolve())] - cmd += ["--task", "audio_finetuning", "--nbest", "1", "--quiet"] - cmd += ["--w2l-decoder", "viterbi", "--criterion", "ctc"] - cmd += ["--post-process", "letter", "--max-tokens", "4000000"] - cmd += ["--path", str(w2v_ckpt.resolve()), "--labels", w2v_label] - cmd += ["--gen-subset", split, "--results-path", str(res_dir.resolve())] - - print(f"running cmd:\n{' '.join(cmd)}") - subprocess.run(cmd, check=True) - - -def compute_error_rate(hyp_wrd_path, ref_wrd_path, unit="word"): - """each line is " (None-)" """ - tokenize_line = { - "word": lambda x: re.sub(r" \(.*\)$", "", x.rstrip()).split(), - "char": lambda x: list(re.sub(r" \(.*\)$", "", x.rstrip())) - }.get(unit) - if tokenize_line is None: - raise ValueError(f"{unit} not supported") - - inds = [int(re.sub(r"\D*(\d*)\D*", r"\1", line)) - for line in open(hyp_wrd_path)] - hyps = [tokenize_line(line) for line in open(hyp_wrd_path)] - refs = [tokenize_line(line) for line in open(ref_wrd_path)] - assert(len(hyps) == len(refs)) - err_rates = [ - editdistance.eval(hyp, ref) / len(ref) for hyp, ref in zip(hyps, refs) - ] - ind_to_err_rates = {i: e for i, e in zip(inds, err_rates)} - return ind_to_err_rates - - -def main(args): - samples = load_tsv_to_dicts(args.raw_manifest) - ids = [ - sample[args.id_header] if args.id_header else "" for sample in samples - ] - audio_paths = [sample[args.audio_header] for sample in samples] - texts = [sample[args.text_header] for sample in samples] - - prepare_w2v_data( - args.w2v_dict_dir, - args.w2v_sample_rate, - args.w2v_label, - audio_paths, - texts, - args.split, - args.asr_dir - ) - run_asr(args.asr_dir, args.split, args.w2v_ckpt, args.w2v_label, args.asr_dir) - ind_to_err_rates = compute_error_rate( - args.asr_dir / f"hypo.word-{args.w2v_ckpt.name}-{args.split}.txt", - args.asr_dir / f"ref.word-{args.w2v_ckpt.name}-{args.split}.txt", - args.err_unit, - ) - - uer_path = args.asr_dir / f"uer_{args.err_unit}.{args.split}.tsv" - with open(uer_path, "w") as f: - f.write("id\taudio\tuer\n") - for ind, (id_, audio_path) in enumerate(zip(ids, audio_paths)): - f.write(f"{id_}\t{audio_path}\t{ind_to_err_rates[ind]:.4f}\n") - - -if __name__ == "__main__": - parser = argparse.ArgumentParser() - parser.add_argument("--raw-manifest", required=True, type=Path) - parser.add_argument("--asr-dir", required=True, type=Path) - parser.add_argument("--id-header", default="id", type=str) - parser.add_argument("--audio-header", default="audio", type=str) - parser.add_argument("--text-header", default="src_text", type=str) - parser.add_argument("--split", default="raw", type=str) - parser.add_argument("--w2v-ckpt", required=True, type=Path) - parser.add_argument("--w2v-dict-dir", required=True, type=Path) - parser.add_argument("--w2v-sample-rate", default=16000, type=int) - parser.add_argument("--w2v-label", default="ltr", type=str) - parser.add_argument("--err-unit", default="word", type=str) - args = parser.parse_args() - - main(args) diff --git a/spaces/OFA-Sys/OFA-vqa/fairseq/tests/test_huffman.py b/spaces/OFA-Sys/OFA-vqa/fairseq/tests/test_huffman.py deleted file mode 100644 index a8cd5222b468b2dbf22f13c9dd34c484a0c30205..0000000000000000000000000000000000000000 --- a/spaces/OFA-Sys/OFA-vqa/fairseq/tests/test_huffman.py +++ /dev/null @@ -1,201 +0,0 @@ -# Copyright (c) Facebook, Inc. and its affiliates. -# -# This source code is licensed under the MIT license found in the -# LICENSE file in the root directory of this source tree. - -import os -import random -import string -import typing as tp -import unittest -from collections import Counter -from tempfile import NamedTemporaryFile, TemporaryDirectory - -from fairseq.data import Dictionary, indexed_dataset -from fairseq.data.huffman import ( - HuffmanCodeBuilder, - HuffmanCoder, - HuffmanMMapIndexedDataset, - HuffmanMMapIndexedDatasetBuilder, -) - -POPULATION = string.ascii_letters + string.digits - - -def make_sentence() -> tp.List[str]: - length = random.randint(10, 50) - return random.choices( - population=POPULATION, k=length, weights=range(1, len(POPULATION) + 1) - ) - - -def make_data(length=1000) -> tp.List[tp.List[str]]: - return ( - [make_sentence() for _ in range(0, length)] - # add all the symbols at least once - + [list(string.ascii_letters), list(string.digits)] - ) - - -def make_counts(data: tp.List[tp.List[str]]) -> Counter: - return Counter([symbol for sentence in data for symbol in sentence]) - - -def make_code_builder(data: tp.List[tp.List[str]]) -> HuffmanCodeBuilder: - builder = HuffmanCodeBuilder() - for sentence in data: - builder.add_symbols(*sentence) - return builder - - -class TestCodeBuilder(unittest.TestCase): - def test_code_builder_can_count(self): - data = make_data() - counts = make_counts(data) - builder = make_code_builder(data) - - self.assertEqual(builder.symbols, counts) - - def test_code_builder_can_add(self): - data = make_data() - counts = make_counts(data) - builder = make_code_builder(data) - - new_builder = builder + builder - - self.assertEqual(new_builder.symbols, counts + counts) - - def test_code_builder_can_io(self): - data = make_data() - builder = make_code_builder(data) - - with NamedTemporaryFile() as tmp_fp: - builder.to_file(tmp_fp.name) - other_builder = HuffmanCodeBuilder.from_file(tmp_fp.name) - - self.assertEqual(builder.symbols, other_builder.symbols) - - -class TestCoder(unittest.TestCase): - def test_coder_can_io(self): - data = make_data() - builder = make_code_builder(data) - coder = builder.build_code() - - with NamedTemporaryFile() as tmp_fp: - coder.to_file(tmp_fp.name) - other_coder = HuffmanCoder.from_file(tmp_fp.name) - - self.assertEqual(coder, other_coder) - - def test_coder_can_encode_decode(self): - data = make_data() - builder = make_code_builder(data) - coder = builder.build_code() - - encoded = [coder.encode(sentence) for sentence in data] - decoded = [[n.symbol for n in coder.decode(enc)] for enc in encoded] - - self.assertEqual(decoded, data) - - unseen_data = make_data() - unseen_encoded = [coder.encode(sentence) for sentence in unseen_data] - unseen_decoded = [ - [n.symbol for n in coder.decode(enc)] for enc in unseen_encoded - ] - self.assertEqual(unseen_decoded, unseen_data) - - -def build_dataset(prefix, data, coder): - with HuffmanMMapIndexedDatasetBuilder(prefix, coder) as builder: - for sentence in data: - builder.add_item(sentence) - - -def sizes(data): - return [len(sentence) for sentence in data] - - -class TestHuffmanDataset(unittest.TestCase): - def test_huffman_can_encode_decode(self): - data = make_data() - builder = make_code_builder(data) - coder = builder.build_code() - - with TemporaryDirectory() as dirname: - prefix = os.path.join(dirname, "test1") - build_dataset(prefix, data, coder) - dataset = HuffmanMMapIndexedDataset(prefix) - - self.assertEqual(len(dataset), len(data)) - decoded = [list(dataset.get_symbols(i)) for i in range(0, len(dataset))] - - self.assertEqual(decoded, data) - data_sizes = [i.item() for i in dataset.sizes] - self.assertEqual(data_sizes, sizes(data)) - - def test_huffman_compresses(self): - data = make_data() - builder = make_code_builder(data) - coder = builder.build_code() - - with TemporaryDirectory() as dirname: - prefix = os.path.join(dirname, "huffman") - build_dataset(prefix, data, coder) - - prefix_mmap = os.path.join(dirname, "mmap") - mmap_builder = indexed_dataset.make_builder( - indexed_dataset.data_file_path(prefix_mmap), - "mmap", - vocab_size=len(POPULATION), - ) - dictionary = Dictionary() - for c in POPULATION: - dictionary.add_symbol(c) - dictionary.finalize() - for sentence in data: - mmap_builder.add_item(dictionary.encode_line(" ".join(sentence))) - mmap_builder.finalize(indexed_dataset.index_file_path(prefix_mmap)) - - huff_size = os.stat(indexed_dataset.data_file_path(prefix)).st_size - mmap_size = os.stat(indexed_dataset.data_file_path(prefix_mmap)).st_size - self.assertLess(huff_size, mmap_size) - - def test_huffman_can_append(self): - data1 = make_data() - builder = make_code_builder(data1) - coder = builder.build_code() - - with TemporaryDirectory() as dirname: - prefix1 = os.path.join(dirname, "test1") - build_dataset(prefix1, data1, coder) - - data2 = make_data() - prefix2 = os.path.join(dirname, "test2") - build_dataset(prefix2, data2, coder) - - prefix3 = os.path.join(dirname, "test3") - - with HuffmanMMapIndexedDatasetBuilder(prefix3, coder) as builder: - builder.append(prefix1) - builder.append(prefix2) - - dataset = HuffmanMMapIndexedDataset(prefix3) - - self.assertEqual(len(dataset), len(data1) + len(data2)) - - decoded1 = [list(dataset.get_symbols(i)) for i in range(0, len(data1))] - self.assertEqual(decoded1, data1) - - decoded2 = [ - list(dataset.get_symbols(i)) for i in range(len(data1), len(dataset)) - ] - self.assertEqual(decoded2, data2) - - data_sizes = [i.item() for i in dataset.sizes] - self.assertEqual(data_sizes[: len(data1)], sizes(data1)) - self.assertEqual(data_sizes[len(data1) : len(dataset)], sizes(data2)) - - -if __name__ == "__main__": - unittest.main() diff --git a/spaces/OkamiFeng/Bark-with-Voice-Cloning/bark/generation.py b/spaces/OkamiFeng/Bark-with-Voice-Cloning/bark/generation.py deleted file mode 100644 index ad474d770235c7b665218e64699fb0b0b1b8cc3f..0000000000000000000000000000000000000000 --- a/spaces/OkamiFeng/Bark-with-Voice-Cloning/bark/generation.py +++ /dev/null @@ -1,864 +0,0 @@ -import contextlib -import gc -import os -import re -import requests -import gc -import sys - -from encodec import EncodecModel -import funcy -import logging -import numpy as np -from scipy.special import softmax -import torch -import torch.nn.functional as F -import tqdm -from transformers import BertTokenizer -from huggingface_hub import hf_hub_download, hf_hub_url - -from .model import GPTConfig, GPT -from .model_fine import FineGPT, FineGPTConfig -from .settings import initenv - -initenv(sys.argv) -global_force_cpu = os.environ.get("BARK_FORCE_CPU", False) -if ( - global_force_cpu != True and - torch.cuda.is_available() and - hasattr(torch.cuda, "amp") and - hasattr(torch.cuda.amp, "autocast") and - hasattr(torch.cuda, "is_bf16_supported") and - torch.cuda.is_bf16_supported() -): - autocast = funcy.partial(torch.cuda.amp.autocast, dtype=torch.bfloat16) -else: - @contextlib.contextmanager - def autocast(): - yield - - -# hold models in global scope to lazy load -global models -models = {} - -global models_devices -models_devices = {} - - -CONTEXT_WINDOW_SIZE = 1024 - -SEMANTIC_RATE_HZ = 49.9 -SEMANTIC_VOCAB_SIZE = 10_000 - -CODEBOOK_SIZE = 1024 -N_COARSE_CODEBOOKS = 2 -N_FINE_CODEBOOKS = 8 -COARSE_RATE_HZ = 75 - -SAMPLE_RATE = 24_000 - - -SUPPORTED_LANGS = [ - ("English", "en"), - ("German", "de"), - ("Spanish", "es"), - ("French", "fr"), - ("Hindi", "hi"), - ("Italian", "it"), - ("Japanese", "ja"), - ("Korean", "ko"), - ("Polish", "pl"), - ("Portuguese", "pt"), - ("Russian", "ru"), - ("Turkish", "tr"), - ("Chinese", "zh"), -] - -ALLOWED_PROMPTS = {"announcer"} -for _, lang in SUPPORTED_LANGS: - for prefix in ("", f"v2{os.path.sep}"): - for n in range(10): - ALLOWED_PROMPTS.add(f"{prefix}{lang}_speaker_{n}") - - -logger = logging.getLogger(__name__) - - -CUR_PATH = os.path.dirname(os.path.abspath(__file__)) - - -#default_cache_dir = os.path.join(os.path.expanduser("~"), ".cache") -#CACHE_DIR = os.path.join(os.getenv("XDG_CACHE_HOME", default_cache_dir), "suno", "bark_v0") -#CACHE_DIR = os.path.join(os.getcwd(), "models" -CACHE_DIR = "./models" - - -def _cast_bool_env_var(s): - return s.lower() in ('true', '1', 't') - -USE_SMALL_MODELS = _cast_bool_env_var(os.environ.get("SUNO_USE_SMALL_MODELS", "False")) -GLOBAL_ENABLE_MPS = _cast_bool_env_var(os.environ.get("SUNO_ENABLE_MPS", "False")) -OFFLOAD_CPU = _cast_bool_env_var(os.environ.get("SUNO_OFFLOAD_CPU", "False")) - -REMOTE_MODEL_PATHS = { - "text_small": { - "repo_id": "suno/bark", - "file_name": "text.pt", - }, - "coarse_small": { - "repo_id": "suno/bark", - "file_name": "coarse.pt", - }, - "fine_small": { - "repo_id": "suno/bark", - "file_name": "fine.pt", - }, - "text": { - "repo_id": "suno/bark", - "file_name": "text_2.pt", - }, - "coarse": { - "repo_id": "suno/bark", - "file_name": "coarse_2.pt", - }, - "fine": { - "repo_id": "suno/bark", - "file_name": "fine_2.pt", - }, -} - - -if not hasattr(torch.nn.functional, 'scaled_dot_product_attention') and torch.cuda.is_available(): - logger.warning( - "torch version does not support flash attention. You will get faster" + - " inference speed by upgrade torch to newest nightly version." - ) - - -def grab_best_device(use_gpu=True): - if torch.cuda.device_count() > 0 and use_gpu: - device = "cuda" - elif torch.backends.mps.is_available() and use_gpu and GLOBAL_ENABLE_MPS: - device = "mps" - else: - device = "cpu" - return device - - -def _get_ckpt_path(model_type, use_small=False): - key = model_type - if use_small or USE_SMALL_MODELS: - key += "_small" - return os.path.join(CACHE_DIR, REMOTE_MODEL_PATHS[key]["file_name"]) - -""" -def _download(from_hf_path, file_name, destfilename): - os.makedirs(CACHE_DIR, exist_ok=True) - hf_hub_download(repo_id=from_hf_path, filename=file_name, local_dir=CACHE_DIR, local_dir_use_symlinks=False) - # Bug in original repo? Downloaded name differs from expected... - if not os.path.exists(destfilename): - localname = os.path.join(CACHE_DIR, file_name) - os.rename(localname, destfilename) -""" -def _download(from_hf_path, file_name): - os.makedirs(CACHE_DIR, exist_ok=True) - hf_hub_download(repo_id=from_hf_path, filename=file_name, local_dir=CACHE_DIR) - - -class InferenceContext: - def __init__(self, benchmark=False): - # we can't expect inputs to be the same length, so disable benchmarking by default - self._chosen_cudnn_benchmark = benchmark - self._cudnn_benchmark = None - - def __enter__(self): - self._cudnn_benchmark = torch.backends.cudnn.benchmark - torch.backends.cudnn.benchmark = self._chosen_cudnn_benchmark - - def __exit__(self, exc_type, exc_value, exc_traceback): - torch.backends.cudnn.benchmark = self._cudnn_benchmark - - -if torch.cuda.is_available(): - torch.backends.cuda.matmul.allow_tf32 = True - torch.backends.cudnn.allow_tf32 = True - - -@contextlib.contextmanager -def _inference_mode(): - with InferenceContext(), torch.inference_mode(), torch.no_grad(), autocast(): - yield - - -def _clear_cuda_cache(): - if torch.cuda.is_available(): - torch.cuda.empty_cache() - torch.cuda.synchronize() - - -def clean_models(model_key=None): - global models - model_keys = [model_key] if model_key is not None else models.keys() - for k in model_keys: - if k in models: - del models[k] - _clear_cuda_cache() - gc.collect() - - -def _load_model(ckpt_path, device, use_small=False, model_type="text"): - if model_type == "text": - ConfigClass = GPTConfig - ModelClass = GPT - elif model_type == "coarse": - ConfigClass = GPTConfig - ModelClass = GPT - elif model_type == "fine": - ConfigClass = FineGPTConfig - ModelClass = FineGPT - else: - raise NotImplementedError() - - # Force-remove Models to allow running on >12Gb GPU - # CF: Probably not needed anymore - #global models - #models.clear() - #gc.collect() - #torch.cuda.empty_cache() - # to here... - - model_key = f"{model_type}_small" if use_small or USE_SMALL_MODELS else model_type - model_info = REMOTE_MODEL_PATHS[model_key] - if not os.path.exists(ckpt_path): - logger.info(f"{model_type} model not found, downloading into `{CACHE_DIR}`.") - ## added next two lines to make it super clear which model is being downloaded - remote_filename = hf_hub_url(model_info["repo_id"], model_info["file_name"]) - print(f"Downloading {model_key} {model_info['repo_id']} remote model file {remote_filename} {model_info['file_name']} to {CACHE_DIR}") - _download(model_info["repo_id"], model_info["file_name"]) - # add next line to make it super clear which model is being loaded - print(f"Loading {model_key} model from {ckpt_path} to {device}") # added - checkpoint = torch.load(ckpt_path, map_location=device) - # this is a hack - model_args = checkpoint["model_args"] - if "input_vocab_size" not in model_args: - model_args["input_vocab_size"] = model_args["vocab_size"] - model_args["output_vocab_size"] = model_args["vocab_size"] - del model_args["vocab_size"] - gptconf = ConfigClass(**checkpoint["model_args"]) - model = ModelClass(gptconf) - state_dict = checkpoint["model"] - # fixup checkpoint - unwanted_prefix = "_orig_mod." - for k, v in list(state_dict.items()): - if k.startswith(unwanted_prefix): - state_dict[k[len(unwanted_prefix) :]] = state_dict.pop(k) - extra_keys = set(state_dict.keys()) - set(model.state_dict().keys()) - extra_keys = set([k for k in extra_keys if not k.endswith(".attn.bias")]) - missing_keys = set(model.state_dict().keys()) - set(state_dict.keys()) - missing_keys = set([k for k in missing_keys if not k.endswith(".attn.bias")]) - if len(extra_keys) != 0: - raise ValueError(f"extra keys found: {extra_keys}") - if len(missing_keys) != 0: - raise ValueError(f"missing keys: {missing_keys}") - model.load_state_dict(state_dict, strict=False) - n_params = model.get_num_params() - val_loss = checkpoint["best_val_loss"].item() - logger.info(f"model loaded: {round(n_params/1e6,1)}M params, {round(val_loss,3)} loss") - model.eval() - model.to(device) - del checkpoint, state_dict - _clear_cuda_cache() - if model_type == "text": - tokenizer = BertTokenizer.from_pretrained("bert-base-multilingual-cased") - return { - "model": model, - "tokenizer": tokenizer, - } - return model - - -def _load_codec_model(device): - model = EncodecModel.encodec_model_24khz() - model.set_target_bandwidth(6.0) - model.eval() - model.to(device) - _clear_cuda_cache() - return model - - -def load_model(use_gpu=True, use_small=False, force_reload=False, model_type="text"): - _load_model_f = funcy.partial(_load_model, model_type=model_type, use_small=use_small) - if model_type not in ("text", "coarse", "fine"): - raise NotImplementedError() - global models - global models_devices - device = grab_best_device(use_gpu=use_gpu) - model_key = f"{model_type}" - if OFFLOAD_CPU: - models_devices[model_key] = device - device = "cpu" - if model_key not in models or force_reload: - ckpt_path = _get_ckpt_path(model_type, use_small=use_small) - clean_models(model_key=model_key) - model = _load_model_f(ckpt_path, device) - models[model_key] = model - if model_type == "text": - models[model_key]["model"].to(device) - else: - models[model_key].to(device) - return models[model_key] - - -def load_codec_model(use_gpu=True, force_reload=False): - global models - global models_devices - device = grab_best_device(use_gpu=use_gpu) - if device == "mps": - # encodec doesn't support mps - device = "cpu" - model_key = "codec" - if OFFLOAD_CPU: - models_devices[model_key] = device - device = "cpu" - if model_key not in models or force_reload: - clean_models(model_key=model_key) - model = _load_codec_model(device) - models[model_key] = model - models[model_key].to(device) - return models[model_key] - - -def preload_models( - text_use_gpu=True, - text_use_small=False, - coarse_use_gpu=True, - coarse_use_small=False, - fine_use_gpu=True, - fine_use_small=False, - codec_use_gpu=True, - force_reload=False -): - """Load all the necessary models for the pipeline.""" - if grab_best_device() == "cpu" and ( - text_use_gpu or coarse_use_gpu or fine_use_gpu or codec_use_gpu - ): - logger.warning("No GPU being used. Careful, inference might be very slow!") - _ = load_model( - model_type="text", use_gpu=text_use_gpu, use_small=text_use_small, force_reload=force_reload - ) - _ = load_model( - model_type="coarse", - use_gpu=coarse_use_gpu, - use_small=coarse_use_small, - force_reload=force_reload, - ) - _ = load_model( - model_type="fine", use_gpu=fine_use_gpu, use_small=fine_use_small, force_reload=force_reload - ) - _ = load_codec_model(use_gpu=codec_use_gpu, force_reload=force_reload) - - -#### -# Generation Functionality -#### - - -def _tokenize(tokenizer, text): - return tokenizer.encode(text, add_special_tokens=False) - - -def _detokenize(tokenizer, enc_text): - return tokenizer.decode(enc_text) - - -def _normalize_whitespace(text): - return re.sub(r"\s+", " ", text).strip() - - -TEXT_ENCODING_OFFSET = 10_048 -SEMANTIC_PAD_TOKEN = 10_000 -TEXT_PAD_TOKEN = 129_595 -SEMANTIC_INFER_TOKEN = 129_599 - - -def _load_history_prompt(history_prompt_input): - if isinstance(history_prompt_input, str) and history_prompt_input.endswith(".npz"): - history_prompt = np.load(history_prompt_input) - elif isinstance(history_prompt_input, str): - # make sure this works on non-ubuntu - history_prompt_input = os.path.join(*history_prompt_input.split("/")) -# if history_prompt_input not in ALLOWED_PROMPTS: -# raise ValueError("history prompt not found") - history_prompt = np.load( - os.path.join(CUR_PATH, "assets", "prompts", f"{history_prompt_input}.npz") - ) - elif isinstance(history_prompt_input, dict): - assert("semantic_prompt" in history_prompt_input) - assert("coarse_prompt" in history_prompt_input) - assert("fine_prompt" in history_prompt_input) - history_prompt = history_prompt_input - else: - raise ValueError("history prompt format unrecognized") - return history_prompt - - -def generate_text_semantic( - text, - history_prompt=None, - temp=0.7, - top_k=None, - top_p=None, - silent=False, - min_eos_p=0.2, - max_gen_duration_s=None, - allow_early_stop=True, - use_kv_caching=False, -): - """Generate semantic tokens from text.""" - assert isinstance(text, str) - text = _normalize_whitespace(text) - assert len(text.strip()) > 0 - if history_prompt is not None: - history_prompt = _load_history_prompt(history_prompt) - semantic_history = history_prompt["semantic_prompt"] - assert ( - isinstance(semantic_history, np.ndarray) - and len(semantic_history.shape) == 1 - and len(semantic_history) > 0 - and semantic_history.min() >= 0 - and semantic_history.max() <= SEMANTIC_VOCAB_SIZE - 1 - ) - else: - semantic_history = None - # load models if not yet exist - global models - global models_devices - if "text" not in models: - preload_models() - model_container = models["text"] - model = model_container["model"] - tokenizer = model_container["tokenizer"] - encoded_text = np.array(_tokenize(tokenizer, text)) + TEXT_ENCODING_OFFSET - if OFFLOAD_CPU: - model.to(models_devices["text"]) - device = next(model.parameters()).device - if len(encoded_text) > 256: - p = round((len(encoded_text) - 256) / len(encoded_text) * 100, 1) - logger.warning(f"warning, text too long, lopping of last {p}%") - encoded_text = encoded_text[:256] - encoded_text = np.pad( - encoded_text, - (0, 256 - len(encoded_text)), - constant_values=TEXT_PAD_TOKEN, - mode="constant", - ) - if semantic_history is not None: - semantic_history = semantic_history.astype(np.int64) - # lop off if history is too long, pad if needed - semantic_history = semantic_history[-256:] - semantic_history = np.pad( - semantic_history, - (0, 256 - len(semantic_history)), - constant_values=SEMANTIC_PAD_TOKEN, - mode="constant", - ) - else: - semantic_history = np.array([SEMANTIC_PAD_TOKEN] * 256) - x = torch.from_numpy( - np.hstack([ - encoded_text, semantic_history, np.array([SEMANTIC_INFER_TOKEN]) - ]).astype(np.int64) - )[None] - assert x.shape[1] == 256 + 256 + 1 - with _inference_mode(): - x = x.to(device) - n_tot_steps = 768 - # custom tqdm updates since we don't know when eos will occur - pbar = tqdm.tqdm(disable=silent, total=100) - pbar_state = 0 - tot_generated_duration_s = 0 - kv_cache = None - for n in range(n_tot_steps): - if use_kv_caching and kv_cache is not None: - x_input = x[:, [-1]] - else: - x_input = x - logits, kv_cache = model( - x_input, merge_context=True, use_cache=use_kv_caching, past_kv=kv_cache - ) - relevant_logits = logits[0, 0, :SEMANTIC_VOCAB_SIZE] - if allow_early_stop: - relevant_logits = torch.hstack( - (relevant_logits, logits[0, 0, [SEMANTIC_PAD_TOKEN]]) # eos - ) - if top_p is not None: - # faster to convert to numpy - original_device = relevant_logits.device - relevant_logits = relevant_logits.detach().cpu().type(torch.float32).numpy() - sorted_indices = np.argsort(relevant_logits)[::-1] - sorted_logits = relevant_logits[sorted_indices] - cumulative_probs = np.cumsum(softmax(sorted_logits)) - sorted_indices_to_remove = cumulative_probs > top_p - sorted_indices_to_remove[1:] = sorted_indices_to_remove[:-1].copy() - sorted_indices_to_remove[0] = False - relevant_logits[sorted_indices[sorted_indices_to_remove]] = -np.inf - relevant_logits = torch.from_numpy(relevant_logits) - relevant_logits = relevant_logits.to(original_device) - if top_k is not None: - v, _ = torch.topk(relevant_logits, min(top_k, relevant_logits.size(-1))) - relevant_logits[relevant_logits < v[-1]] = -float("Inf") - probs = F.softmax(relevant_logits / temp, dim=-1) - # multinomial bugged on mps: shuttle to cpu if necessary - inf_device = probs.device - if probs.device.type == "mps": - probs = probs.to("cpu") - item_next = torch.multinomial(probs, num_samples=1) - probs = probs.to(inf_device) - item_next = item_next.to(inf_device) - if allow_early_stop and ( - item_next == SEMANTIC_VOCAB_SIZE - or (min_eos_p is not None and probs[-1] >= min_eos_p) - ): - # eos found, so break - pbar.update(100 - pbar_state) - break - x = torch.cat((x, item_next[None]), dim=1) - tot_generated_duration_s += 1 / SEMANTIC_RATE_HZ - if max_gen_duration_s is not None and tot_generated_duration_s > max_gen_duration_s: - pbar.update(100 - pbar_state) - break - if n == n_tot_steps - 1: - pbar.update(100 - pbar_state) - break - del logits, relevant_logits, probs, item_next - req_pbar_state = np.min([100, int(round(100 * n / n_tot_steps))]) - if req_pbar_state > pbar_state: - pbar.update(req_pbar_state - pbar_state) - pbar_state = req_pbar_state - pbar.close() - out = x.detach().cpu().numpy().squeeze()[256 + 256 + 1 :] - if OFFLOAD_CPU: - model.to("cpu") - assert all(0 <= out) and all(out < SEMANTIC_VOCAB_SIZE) - _clear_cuda_cache() - return out - - -def _flatten_codebooks(arr, offset_size=CODEBOOK_SIZE): - assert len(arr.shape) == 2 - arr = arr.copy() - if offset_size is not None: - for n in range(1, arr.shape[0]): - arr[n, :] += offset_size * n - flat_arr = arr.ravel("F") - return flat_arr - - -COARSE_SEMANTIC_PAD_TOKEN = 12_048 -COARSE_INFER_TOKEN = 12_050 - - -def generate_coarse( - x_semantic, - history_prompt=None, - temp=0.7, - top_k=None, - top_p=None, - silent=False, - max_coarse_history=630, # min 60 (faster), max 630 (more context) - sliding_window_len=60, - use_kv_caching=False, -): - """Generate coarse audio codes from semantic tokens.""" -# CF: Uncommented because it breaks swap voice more than once -# assert ( -# isinstance(x_semantic, np.ndarray) -# and len(x_semantic.shape) == 1 -# and len(x_semantic) > 0 -# and x_semantic.min() >= 0 -# and x_semantic.max() <= SEMANTIC_VOCAB_SIZE - 1 -# ) - assert 60 <= max_coarse_history <= 630 - assert max_coarse_history + sliding_window_len <= 1024 - 256 - semantic_to_coarse_ratio = COARSE_RATE_HZ / SEMANTIC_RATE_HZ * N_COARSE_CODEBOOKS - max_semantic_history = int(np.floor(max_coarse_history / semantic_to_coarse_ratio)) - if history_prompt is not None: - history_prompt = _load_history_prompt(history_prompt) - x_semantic_history = history_prompt["semantic_prompt"] - x_coarse_history = history_prompt["coarse_prompt"] - assert ( - isinstance(x_semantic_history, np.ndarray) - and len(x_semantic_history.shape) == 1 - and len(x_semantic_history) > 0 - and x_semantic_history.min() >= 0 - and x_semantic_history.max() <= SEMANTIC_VOCAB_SIZE - 1 - and isinstance(x_coarse_history, np.ndarray) - and len(x_coarse_history.shape) == 2 - and x_coarse_history.shape[0] == N_COARSE_CODEBOOKS - and x_coarse_history.shape[-1] >= 0 - and x_coarse_history.min() >= 0 - and x_coarse_history.max() <= CODEBOOK_SIZE - 1 - #and ( - # round(x_coarse_history.shape[-1] / len(x_semantic_history), 1) - # == round(semantic_to_coarse_ratio / N_COARSE_CODEBOOKS, 1) - #) - ) - x_coarse_history = _flatten_codebooks(x_coarse_history) + SEMANTIC_VOCAB_SIZE - # trim histories correctly - n_semantic_hist_provided = np.min( - [ - max_semantic_history, - len(x_semantic_history) - len(x_semantic_history) % 2, - int(np.floor(len(x_coarse_history) / semantic_to_coarse_ratio)), - ] - ) - n_coarse_hist_provided = int(round(n_semantic_hist_provided * semantic_to_coarse_ratio)) - x_semantic_history = x_semantic_history[-n_semantic_hist_provided:].astype(np.int32) - x_coarse_history = x_coarse_history[-n_coarse_hist_provided:].astype(np.int32) - # TODO: bit of a hack for time alignment (sounds better) - x_coarse_history = x_coarse_history[:-2] - else: - x_semantic_history = np.array([], dtype=np.int32) - x_coarse_history = np.array([], dtype=np.int32) - # load models if not yet exist - global models - global models_devices - if "coarse" not in models: - preload_models() - model = models["coarse"] - if OFFLOAD_CPU: - model.to(models_devices["coarse"]) - device = next(model.parameters()).device - # start loop - n_steps = int( - round( - np.floor(len(x_semantic) * semantic_to_coarse_ratio / N_COARSE_CODEBOOKS) - * N_COARSE_CODEBOOKS - ) - ) - assert n_steps > 0 and n_steps % N_COARSE_CODEBOOKS == 0 - x_semantic = np.hstack([x_semantic_history, x_semantic]).astype(np.int32) - x_coarse = x_coarse_history.astype(np.int32) - base_semantic_idx = len(x_semantic_history) - with _inference_mode(): - x_semantic_in = torch.from_numpy(x_semantic)[None].to(device) - x_coarse_in = torch.from_numpy(x_coarse)[None].to(device) - n_window_steps = int(np.ceil(n_steps / sliding_window_len)) - n_step = 0 - for _ in tqdm.tqdm(range(n_window_steps), total=n_window_steps, disable=silent): - semantic_idx = base_semantic_idx + int(round(n_step / semantic_to_coarse_ratio)) - # pad from right side - x_in = x_semantic_in[:, np.max([0, semantic_idx - max_semantic_history]) :] - x_in = x_in[:, :256] - x_in = F.pad( - x_in, - (0, 256 - x_in.shape[-1]), - "constant", - COARSE_SEMANTIC_PAD_TOKEN, - ) - x_in = torch.hstack( - [ - x_in, - torch.tensor([COARSE_INFER_TOKEN])[None].to(device), - x_coarse_in[:, -max_coarse_history:], - ] - ) - kv_cache = None - for _ in range(sliding_window_len): - if n_step >= n_steps: - continue - is_major_step = n_step % N_COARSE_CODEBOOKS == 0 - - if use_kv_caching and kv_cache is not None: - x_input = x_in[:, [-1]] - else: - x_input = x_in - - logits, kv_cache = model(x_input, use_cache=use_kv_caching, past_kv=kv_cache) - logit_start_idx = ( - SEMANTIC_VOCAB_SIZE + (1 - int(is_major_step)) * CODEBOOK_SIZE - ) - logit_end_idx = ( - SEMANTIC_VOCAB_SIZE + (2 - int(is_major_step)) * CODEBOOK_SIZE - ) - relevant_logits = logits[0, 0, logit_start_idx:logit_end_idx] - if top_p is not None: - # faster to convert to numpy - original_device = relevant_logits.device - relevant_logits = relevant_logits.detach().cpu().type(torch.float32).numpy() - sorted_indices = np.argsort(relevant_logits)[::-1] - sorted_logits = relevant_logits[sorted_indices] - cumulative_probs = np.cumsum(softmax(sorted_logits)) - sorted_indices_to_remove = cumulative_probs > top_p - sorted_indices_to_remove[1:] = sorted_indices_to_remove[:-1].copy() - sorted_indices_to_remove[0] = False - relevant_logits[sorted_indices[sorted_indices_to_remove]] = -np.inf - relevant_logits = torch.from_numpy(relevant_logits) - relevant_logits = relevant_logits.to(original_device) - if top_k is not None: - v, _ = torch.topk(relevant_logits, min(top_k, relevant_logits.size(-1))) - relevant_logits[relevant_logits < v[-1]] = -float("Inf") - probs = F.softmax(relevant_logits / temp, dim=-1) - # multinomial bugged on mps: shuttle to cpu if necessary - inf_device = probs.device - if probs.device.type == "mps": - probs = probs.to("cpu") - item_next = torch.multinomial(probs, num_samples=1) - probs = probs.to(inf_device) - item_next = item_next.to(inf_device) - item_next += logit_start_idx - x_coarse_in = torch.cat((x_coarse_in, item_next[None]), dim=1) - x_in = torch.cat((x_in, item_next[None]), dim=1) - del logits, relevant_logits, probs, item_next - n_step += 1 - del x_in - del x_semantic_in - if OFFLOAD_CPU: - model.to("cpu") - gen_coarse_arr = x_coarse_in.detach().cpu().numpy().squeeze()[len(x_coarse_history) :] - del x_coarse_in - assert len(gen_coarse_arr) == n_steps - gen_coarse_audio_arr = gen_coarse_arr.reshape(-1, N_COARSE_CODEBOOKS).T - SEMANTIC_VOCAB_SIZE - for n in range(1, N_COARSE_CODEBOOKS): - gen_coarse_audio_arr[n, :] -= n * CODEBOOK_SIZE - _clear_cuda_cache() - return gen_coarse_audio_arr - - -def generate_fine( - x_coarse_gen, - history_prompt=None, - temp=0.5, - silent=True, -): - """Generate full audio codes from coarse audio codes.""" - assert ( - isinstance(x_coarse_gen, np.ndarray) - and len(x_coarse_gen.shape) == 2 - and 1 <= x_coarse_gen.shape[0] <= N_FINE_CODEBOOKS - 1 - and x_coarse_gen.shape[1] > 0 - and x_coarse_gen.min() >= 0 - and x_coarse_gen.max() <= CODEBOOK_SIZE - 1 - ) - if history_prompt is not None: - history_prompt = _load_history_prompt(history_prompt) - x_fine_history = history_prompt["fine_prompt"] - assert ( - isinstance(x_fine_history, np.ndarray) - and len(x_fine_history.shape) == 2 - and x_fine_history.shape[0] == N_FINE_CODEBOOKS - and x_fine_history.shape[1] >= 0 - and x_fine_history.min() >= 0 - and x_fine_history.max() <= CODEBOOK_SIZE - 1 - ) - else: - x_fine_history = None - n_coarse = x_coarse_gen.shape[0] - # load models if not yet exist - global models - global models_devices - if "fine" not in models: - preload_models() - model = models["fine"] - if OFFLOAD_CPU: - model.to(models_devices["fine"]) - device = next(model.parameters()).device - # make input arr - in_arr = np.vstack( - [ - x_coarse_gen, - np.zeros((N_FINE_CODEBOOKS - n_coarse, x_coarse_gen.shape[1])) - + CODEBOOK_SIZE, # padding - ] - ).astype(np.int32) - # prepend history if available (max 512) - if x_fine_history is not None: - x_fine_history = x_fine_history.astype(np.int32) - in_arr = np.hstack( - [ - x_fine_history[:, -512:].astype(np.int32), - in_arr, - ] - ) - n_history = x_fine_history[:, -512:].shape[1] - else: - n_history = 0 - n_remove_from_end = 0 - # need to pad if too short (since non-causal model) - if in_arr.shape[1] < 1024: - n_remove_from_end = 1024 - in_arr.shape[1] - in_arr = np.hstack( - [ - in_arr, - np.zeros((N_FINE_CODEBOOKS, n_remove_from_end), dtype=np.int32) + CODEBOOK_SIZE, - ] - ) - # we can be lazy about fractional loop and just keep overwriting codebooks - n_loops = np.max([0, int(np.ceil((x_coarse_gen.shape[1] - (1024 - n_history)) / 512))]) + 1 - with _inference_mode(): - in_arr = torch.tensor(in_arr.T).to(device) - for n in tqdm.tqdm(range(n_loops), disable=silent): - start_idx = np.min([n * 512, in_arr.shape[0] - 1024]) - start_fill_idx = np.min([n_history + n * 512, in_arr.shape[0] - 512]) - rel_start_fill_idx = start_fill_idx - start_idx - in_buffer = in_arr[start_idx : start_idx + 1024, :][None] - for nn in range(n_coarse, N_FINE_CODEBOOKS): - logits = model(nn, in_buffer) - if temp is None: - relevant_logits = logits[0, rel_start_fill_idx:, :CODEBOOK_SIZE] - codebook_preds = torch.argmax(relevant_logits, -1) - else: - relevant_logits = logits[0, :, :CODEBOOK_SIZE] / temp - probs = F.softmax(relevant_logits, dim=-1) - # multinomial bugged on mps: shuttle to cpu if necessary - inf_device = probs.device - if probs.device.type == "mps": - probs = probs.to("cpu") - codebook_preds = torch.hstack( - [ - torch.multinomial(probs[nnn], num_samples=1).to(inf_device) - for nnn in range(rel_start_fill_idx, 1024) - ] - ) - in_buffer[0, rel_start_fill_idx:, nn] = codebook_preds - del logits, codebook_preds - # transfer over info into model_in and convert to numpy - for nn in range(n_coarse, N_FINE_CODEBOOKS): - in_arr[ - start_fill_idx : start_fill_idx + (1024 - rel_start_fill_idx), nn - ] = in_buffer[0, rel_start_fill_idx:, nn] - del in_buffer - gen_fine_arr = in_arr.detach().cpu().numpy().squeeze().T - del in_arr - if OFFLOAD_CPU: - model.to("cpu") - gen_fine_arr = gen_fine_arr[:, n_history:] - if n_remove_from_end > 0: - gen_fine_arr = gen_fine_arr[:, :-n_remove_from_end] - assert gen_fine_arr.shape[-1] == x_coarse_gen.shape[-1] - _clear_cuda_cache() - return gen_fine_arr - - -def codec_decode(fine_tokens): - """Turn quantized audio codes into audio array using encodec.""" - # load models if not yet exist - global models - global models_devices - if "codec" not in models: - preload_models() - model = models["codec"] - if OFFLOAD_CPU: - model.to(models_devices["codec"]) - device = next(model.parameters()).device - arr = torch.from_numpy(fine_tokens)[None] - arr = arr.to(device) - arr = arr.transpose(0, 1) - emb = model.quantizer.decode(arr) - out = model.decoder(emb) - audio_arr = out.detach().cpu().numpy().squeeze() - del arr, emb, out - if OFFLOAD_CPU: - model.to("cpu") - return audio_arr diff --git a/spaces/Omnibus/MusicGen/audiocraft/quantization/vq.py b/spaces/Omnibus/MusicGen/audiocraft/quantization/vq.py deleted file mode 100644 index f67c3a0cd30d4b8993a36c587f00dc8a451d926f..0000000000000000000000000000000000000000 --- a/spaces/Omnibus/MusicGen/audiocraft/quantization/vq.py +++ /dev/null @@ -1,116 +0,0 @@ -# Copyright (c) Meta Platforms, Inc. and affiliates. -# All rights reserved. -# -# This source code is licensed under the license found in the -# LICENSE file in the root directory of this source tree. - -import math -import typing as tp - -import torch - -from .base import BaseQuantizer, QuantizedResult -from .core_vq import ResidualVectorQuantization - - -class ResidualVectorQuantizer(BaseQuantizer): - """Residual Vector Quantizer. - - Args: - dimension (int): Dimension of the codebooks. - n_q (int): Number of residual vector quantizers used. - q_dropout (bool): Random quantizer drop out at train time. - bins (int): Codebook size. - decay (float): Decay for exponential moving average over the codebooks. - kmeans_init (bool): Whether to use kmeans to initialize the codebooks. - kmeans_iters (int): Number of iterations used for kmeans initialization. - threshold_ema_dead_code (int): Threshold for dead code expiration. Replace any codes - that have an exponential moving average cluster size less than the specified threshold with - randomly selected vector from the current batch. - orthogonal_reg_weight (float): Orthogonal regularization weights. - orthogonal_reg_active_codes_only (bool): Apply orthogonal regularization only on active codes. - orthogonal_reg_max_codes (optional int): Maximum number of codes to consider. - for orthogonal regulariation. - """ - def __init__( - self, - dimension: int = 256, - n_q: int = 8, - q_dropout: bool = False, - bins: int = 1024, - decay: float = 0.99, - kmeans_init: bool = True, - kmeans_iters: int = 10, - threshold_ema_dead_code: int = 2, - orthogonal_reg_weight: float = 0.0, - orthogonal_reg_active_codes_only: bool = False, - orthogonal_reg_max_codes: tp.Optional[int] = None, - ): - super().__init__() - self.max_n_q = n_q - self.n_q = n_q - self.q_dropout = q_dropout - self.dimension = dimension - self.bins = bins - self.decay = decay - self.kmeans_init = kmeans_init - self.kmeans_iters = kmeans_iters - self.threshold_ema_dead_code = threshold_ema_dead_code - self.orthogonal_reg_weight = orthogonal_reg_weight - self.orthogonal_reg_active_codes_only = orthogonal_reg_active_codes_only - self.orthogonal_reg_max_codes = orthogonal_reg_max_codes - self.vq = ResidualVectorQuantization( - dim=self.dimension, - codebook_size=self.bins, - num_quantizers=self.n_q, - decay=self.decay, - kmeans_init=self.kmeans_init, - kmeans_iters=self.kmeans_iters, - threshold_ema_dead_code=self.threshold_ema_dead_code, - orthogonal_reg_weight=self.orthogonal_reg_weight, - orthogonal_reg_active_codes_only=self.orthogonal_reg_active_codes_only, - orthogonal_reg_max_codes=self.orthogonal_reg_max_codes, - channels_last=False - ) - - def forward(self, x: torch.Tensor, frame_rate: int): - n_q = self.n_q - if self.training and self.q_dropout: - n_q = int(torch.randint(1, self.n_q + 1, (1,)).item()) - bw_per_q = math.log2(self.bins) * frame_rate / 1000 - quantized, codes, commit_loss = self.vq(x, n_q=n_q) - codes = codes.transpose(0, 1) - # codes is [B, K, T], with T frames, K nb of codebooks. - bw = torch.tensor(n_q * bw_per_q).to(x) - return QuantizedResult(quantized, codes, bw, penalty=torch.mean(commit_loss)) - - def encode(self, x: torch.Tensor) -> torch.Tensor: - """Encode a given input tensor with the specified frame rate at the given bandwidth. - The RVQ encode method sets the appropriate number of quantizer to use - and returns indices for each quantizer. - """ - n_q = self.n_q - codes = self.vq.encode(x, n_q=n_q) - codes = codes.transpose(0, 1) - # codes is [B, K, T], with T frames, K nb of codebooks. - return codes - - def decode(self, codes: torch.Tensor) -> torch.Tensor: - """Decode the given codes to the quantized representation. - """ - # codes is [B, K, T], with T frames, K nb of codebooks, vq.decode expects [K, B, T]. - codes = codes.transpose(0, 1) - quantized = self.vq.decode(codes) - return quantized - - @property - def total_codebooks(self): - return self.max_n_q - - @property - def num_codebooks(self): - return self.n_q - - def set_num_codebooks(self, n: int): - assert n > 0 and n <= self.max_n_q - self.n_q = n diff --git a/spaces/OpenGVLab/InternGPT/third-party/lama/fetch_data/places_standard_train_prepare.sh b/spaces/OpenGVLab/InternGPT/third-party/lama/fetch_data/places_standard_train_prepare.sh deleted file mode 100644 index aaf429243c5b05c9e3319b01842992cb2ab4c06c..0000000000000000000000000000000000000000 --- a/spaces/OpenGVLab/InternGPT/third-party/lama/fetch_data/places_standard_train_prepare.sh +++ /dev/null @@ -1,16 +0,0 @@ -mkdir -p places_standard_dataset/train - -# untar without folder structure -tar -xvf train_large_places365standard.tar -C places_standard_dataset/train - -# create location config places.yaml -PWD=$(pwd) -DATASET=${PWD}/places_standard_dataset -PLACES=${PWD}/configs/training/location/places_standard.yaml - -touch $PLACES -echo "# @package _group_" >> $PLACES -echo "data_root_dir: ${DATASET}/" >> $PLACES -echo "out_root_dir: ${PWD}/experiments/" >> $PLACES -echo "tb_dir: ${PWD}/tb_logs/" >> $PLACES -echo "pretrained_models: ${PWD}/" >> $PLACES diff --git a/spaces/OpenGVLab/all-seeing/app.py b/spaces/OpenGVLab/all-seeing/app.py deleted file mode 100644 index 832916867df1afae37c39a31869882c8d1736a51..0000000000000000000000000000000000000000 --- a/spaces/OpenGVLab/all-seeing/app.py +++ /dev/null @@ -1,389 +0,0 @@ -import os -import re -import uuid -import random -import json -import shutil -import requests -import argparse -from pathlib import Path -import dataclasses -from io import BytesIO -from functools import partial -from typing import Any, List , Dict, Union, Literal,TypedDict - -import cv2 -import numpy as np -import gradio as gr -from PIL import Image -import gradio.themes.base as ThemeBase -from gradio.themes.utils import colors, fonts, sizes -from utils import draw_points_to_image, in_rectangle - -# IMAGE_PATH = "/mnt/petrelfs/share_data/huangzhenhang/tmp/as_demo_data/sa_img_000000/" -# IMAGE_PATH = "/mnt/petrelfs/share_data/gaozhangwei/as_demo_data/saved_images" -IMAGE_PATH = "./images" -METAFILE_PATH = "./metafile/metafile.json" -SAVE_PATH = "./images" - -class Bot: - def __init__(self): - - img_list = os.listdir(IMAGE_PATH) - self.image_paths = [Path(os.path.join(IMAGE_PATH, img_item)) for img_item in img_list if img_item.endswith(".jpg")] - # self.show_index = random.sample(range(len(self.image_paths)), min(50, len(self.image_paths))) - self.show_index = list(range(min(50, len(self.image_paths)))) - self.gallery_show_paths = [self.image_paths[index] for index in self.show_index] - - with open(METAFILE_PATH,"r") as f: - self.metadata = json.load(f) - - def add_gellary_image(self,user_state:dict,evt: gr.SelectData ): - index = self.show_index[evt.index] - print(f"\nselect No.{index} image", ) - return index, *self.add_image(user_state,type="index",index=index) - - def add_image(self, user_state:dict, - index:int=0, - image_path:str = None, #path - type:Literal["random","image","index"] = "index", - ): - - - if type == "image" and os.path.exists(image_path): - image = Image.open(image_path).convert("RGB") - elif type == "index" and index < len(self.image_paths): - image_path = self.image_paths[index] - image = Image.open(image_path).convert("RGB") - else: - image_path = random.sample(self.image_paths, 1)[0] - image = Image.open(image_path).convert("RGB") - - img_item = os.path.basename(image_path) - print('\nupload an image: ',img_item) - try: - ann_path = self.metadata[img_item] - with open(ann_path,"r") as f: - ann = json.load(f) - except Exception as e: - print(e) - return image, user_state - - - data = {"origin_image":image, - "path":image_path, - "ann":ann["annotations"], - "size": - {"width": - ann["image"]["width"], - "height": - ann["image"]["height"] - } - } - - user_state.update(data) - user_state["points"] = [] - return image, user_state - - def add_points(self, user_state:dict, evt: gr.SelectData): - - - if user_state.get('origin_image', None) is None: - img, user_state = self.add_image(user_state,type="random") - else: - img = user_state["origin_image"] - - # add points - - new_point = [evt.index[0], evt.index[1]] - print("add point: ", new_point ) - - if len(user_state.setdefault("points",[])) == 0 : - user_state["points"].append(new_point) - else: - new_mask_points = [point for point in user_state["points"] - if (new_point[0]- point[0])**2 + (new_point[1]- point[1])**2 > 225] - if len(new_mask_points) == len(user_state["points"]): - new_mask_points.append(new_point) - user_state["points"] = new_mask_points - - if len(user_state["points"]) == 0: - return None, img, user_state - # find bbox - candidate_bboxs = [bbox for bbox in user_state["ann"] if in_rectangle(bbox["box"],user_state["points"])] - if len(candidate_bboxs) > 0: - - size = [bbox["box"][2]*bbox["box"][3] for bbox in candidate_bboxs] - - final_bbox = candidate_bboxs[size.index(min(size))] - x,y,w,h = tuple(final_bbox["box"]) - x1,y1,x2,y2 = int(x),int(y),int(x+w),int(y+h) - user_state["final_ann"] = final_bbox - label = final_bbox["semantic_tag"][0] - np_img = np.array(img) - cv2_image = cv2.cvtColor(np_img, cv2.COLOR_RGB2BGR) - cv2.rectangle(cv2_image, (x1, y1), (x2,y2), (0, 255, 0), 4) - cv2.putText(cv2_image,label, (int(x), int(y) + 50), cv2.FONT_HERSHEY_SIMPLEX, 1.5, (0, 0, 255), 4) - cv2_image_rgb = cv2.cvtColor(cv2_image, cv2.COLOR_BGR2RGB) - new_image = self._blend_bbox(cv2_image_rgb, (x1,y1,x2,y2)) - new_image = Image.fromarray(new_image) - - else: - user_state["final_ann"] = {} - new_image = img.copy() - label = None - # show image - - new_image = draw_points_to_image(new_image,user_state["points"]) - return label, new_image, user_state - - def save_img(self,user_stare:dict): - img_path = user_stare.get("path",None) - if img_path is not None: - name = os.path.basename(img_path) - new_path = os.path.join(SAVE_PATH,name) - if not os.path.exists(new_path): - shutil.copy(img_path, new_path) - print("save image: ",name) - else: - print("The image path already exists.") - return gr.update(value = "Saved!"), user_stare - else: - print("can't find image") - return gr.update(value = "Save failed!"), user_stare - - def add_ann(self, user_state:dict): - - ann = user_state.get("final_ann",{}) - - question = ann.get("question",[]).copy() - question.append("Image caption") - - return gr.update(choices = question), user_state - - def update_answer(self,user_state:dict,evt: gr.SelectData): - - - ann = user_state.get("final_ann",{}) - select_question = evt.value - print("selected question:", select_question ) - - if select_question in ann["question"]: - answer = ann["answer"][min(evt.index,len(ann["answer"]))] - print("selected answer:", answer ) - return answer, user_state - - elif evt.index == len(ann["answer"]): - return ann.get("caption",None), user_state - - else: - print("selected answer: None") - - return None,user_state - - def update_all_answer(self, user_state:dict): - ann = user_state.get("final_ann",{}) - question = ann.get("question",[]).copy() - answer = ann.get("answer",[]).copy() - caption = ann.get("caption", None) - - if caption is None: - return None, user_state - - output = f"""Q1: {question[0]} -A1: {answer[0]} - -Q2: {question[1]} -A2: {answer[1]} - -Q3: {question[2]} -A3: {answer[2]} - -Detailed Caption: {caption} - """ - - return output, user_state - - def _blend_bbox(self, img, bbox): - x1,y1,x2,y2 = bbox - mask = np.zeros_like(img) - mask[y1:y2,x1:x2,:] = 255 - mask = mask.astype(np.uint8) - mask[:,:,0] = 0 - mask[:,:,2] = 0 - new_img_arr = img * (1 - 1/3) + mask * 1/3 - new_img_arr = np.clip(new_img_arr, 0, 255).astype(np.uint8) - # print(new_img_arr.shape) - return new_img_arr - - def clear_points(self,user_state:dict): - print("clear all points") - - user_state["points"] = [] - img = user_state.get("origin_image",None) - return img,user_state - - - - -class Seafoam(ThemeBase.Base): - def __init__( - self, - *, - primary_hue=colors.emerald, - secondary_hue=colors.blue, - neutral_hue=colors.gray, - spacing_size=sizes.spacing_md, - radius_size=sizes.radius_md, - text_size=sizes.text_lg, - font=( - fonts.GoogleFont("Quicksand"), - "ui-sans-serif", - "sans-serif", - ), - font_mono=( - fonts.GoogleFont("IBM Plex Mono"), - "ui-monospace", - "monospace", - ), - ): - super().__init__( - primary_hue=primary_hue, - secondary_hue=secondary_hue, - neutral_hue=neutral_hue, - spacing_size=spacing_size, - radius_size=radius_size, - text_size=text_size, - font=font, - font_mono=font_mono, - ) - super().set( - # body_background_fill="#D8E9EB", - body_background_fill_dark="#111111", - button_primary_background_fill="*primary_300", - button_primary_background_fill_hover="*primary_200", - button_primary_text_color="black", - button_secondary_background_fill="*secondary_300", - button_secondary_background_fill_hover="*secondary_200", - border_color_primary="#0BB9BF", - slider_color="*secondary_300", - slider_color_dark="*secondary_600", - block_title_text_weight="600", - block_border_width="3px", - block_shadow="*shadow_drop_lg", - button_shadow="*shadow_drop_lg", - button_large_padding="10px", - ) - - -css=''' -#image_upload {align-items: center; max-width: 640px} -''' - -def app(**kwargs): - - bot = Bot() - - with gr.Blocks(theme=Seafoam(), css=css) as demo: - - - user_state = gr.State({}) - - # gr.HTML( - # """ - #

      The All-Seeing-1B (AS-1B) dataset Browser

      - # """, - # ) - gr.HTML( - """ -
      -
      -

      The All-Seeing-1B (AS-1B) dataset Browser -

      -
      - -
      -
      - Github    - Paper    -
      -
      - """, - ) - # gr.Markdown('The All-Seeing-1B (AS-1B) dataset Browser image') - - with gr.Row(visible=True) as user_interface: - with gr.Column(scale=0.5, elem_id="text_input") as chat_part: - with gr.Row(visible=True) as semantic_tag: - label = gr.Textbox(show_label=True,label="Semantic Tag",interactive=False) - with gr.Row(visible=False) as question : - question = gr.Dropdown([],label="Question",interactive=True) - with gr.Row(visible=True) as answer: - answer = gr.Textbox(show_label=True,label="Detailed Annotation",interactive=False, lines=12, max_lines=12) - - - with gr.Column(elem_id="visual_input", scale=0.5) as img_part: - # click_img = gr.AnnotatedImage(interactive=True, brush_radius=15, elem_id="image_upload",height=400) - click_img = gr.Image(type="pil", interactive=False, brush_radius=15, elem_id="image_upload",height=392) - - with gr.Row(visible=False) as btn: - select_img = gr.Slider(label="Image Index",minimum=0,maximum=len(bot.image_paths)-1,step=1,value=0) - # add_img_example = gr.Button("🖼️ Image Example", variant="primary") - - clear_btn = gr.Button(value="🗑️ Clear Points", variant="primary", elem_id="pick_btn") - # save_btn = gr.Button(value="Save", variant="primary", elem_id="save_btn") - - with gr.Row(visible=True) as gallery_row: - gallery = gr.Gallery(bot.gallery_show_paths ,label = "Image Gallery",columns = 8,allow_preview =False,height=383) - - # add_img_example.click(bot.add_image, [user_state], [click_img,user_state]).then( - # lambda: None, None, question).then( - # lambda: None, None, label) - - select_img.release(bot.add_image, [user_state,select_img], [click_img,user_state]).then( - lambda: None, None, question).then( - lambda: None, None, label) - click_img.select(bot.add_points,[user_state,],[label, click_img, user_state]).then( - bot.add_ann,[user_state],[question,user_state]).then( - lambda: None, None, question).then( - lambda: None, None, answer).then( - bot.update_all_answer,[user_state],[answer,user_state] - ) - - question.select(bot.update_answer,[user_state],[answer,user_state]) - # pick_btn.click(lambda: gr.update(interactive=False), [], [clear_btn]).then( - # ).then( - # bot.seg_image,[user_state],[click_img,user_state]).then( - # bot.add_image,[click_img, user_state], [ user_state]).then( - # lambda: gr.update(interactive=True), [], [clear_btn]) - - click_img.clear(lambda: {}, None, user_state).then( - lambda: None, None, label).then( - lambda: None, None, question).then( - lambda: None, None, answer) - - clear_btn.click(bot.clear_points,[user_state],[click_img,user_state]).then( - lambda: None, None, label).then( - lambda: None, None, question).then( - lambda: None, None, answer) - - gallery.select(bot.add_gellary_image,[user_state,],[select_img,click_img, user_state]).then( - lambda: None, None, label).then( - lambda: None, None, question).then( - lambda: None, None, answer) - - # save_btn.click(bot.save_img,[user_state],[save_btn,user_state]) - - - demo.queue().launch(**kwargs) - - -if __name__ == "__main__": - parser = argparse.ArgumentParser() - parser.add_argument('--port', type=int, default=10019) - parser.add_argument('--share', action='store_true') - args = parser.parse_args() - - # app(server_name="0.0.0.0", ssl_verify=False, server_port=args.port, share=args.share) - app() - # fire.Fire(app) diff --git a/spaces/OpenMotionLab/MotionGPT/mGPT/metrics/m2t.py b/spaces/OpenMotionLab/MotionGPT/mGPT/metrics/m2t.py deleted file mode 100644 index 3cf1f4cbdc8ba6df5f63291d0ab2dd2640dc3758..0000000000000000000000000000000000000000 --- a/spaces/OpenMotionLab/MotionGPT/mGPT/metrics/m2t.py +++ /dev/null @@ -1,345 +0,0 @@ -from typing import List -import os -import torch -from torch import Tensor -from torchmetrics import Metric -from .utils import * -from bert_score import score as score_bert -import spacy -from mGPT.config import instantiate_from_config - -class M2TMetrics(Metric): - - def __init__(self, - cfg, - w_vectorizer, - dataname='humanml3d', - top_k=3, - bleu_k=4, - R_size=32, - max_text_len=40, - diversity_times=300, - dist_sync_on_step=True, - unit_length=4, - **kwargs): - super().__init__(dist_sync_on_step=dist_sync_on_step) - - self.cfg = cfg - self.dataname = dataname - self.w_vectorizer = w_vectorizer - self.name = "matching, fid, and diversity scores" - # self.text = True if cfg.TRAIN.STAGE in ["diffusion","t2m_gpt"] else False - self.max_text_len = max_text_len - self.top_k = top_k - self.bleu_k = bleu_k - self.R_size = R_size - self.diversity_times = diversity_times - self.unit_length = unit_length - - self.add_state("count", default=torch.tensor(0), dist_reduce_fx="sum") - self.add_state("count_seq", - default=torch.tensor(0), - dist_reduce_fx="sum") - - self.metrics = [] - - # Matching scores - self.add_state("Matching_score", - default=torch.tensor(0.0), - dist_reduce_fx="sum") - self.add_state("gt_Matching_score", - default=torch.tensor(0.0), - dist_reduce_fx="sum") - self.Matching_metrics = ["Matching_score", "gt_Matching_score"] - for k in range(1, top_k + 1): - self.add_state( - f"R_precision_top_{str(k)}", - default=torch.tensor(0.0), - dist_reduce_fx="sum", - ) - self.Matching_metrics.append(f"R_precision_top_{str(k)}") - for k in range(1, top_k + 1): - self.add_state( - f"gt_R_precision_top_{str(k)}", - default=torch.tensor(0.0), - dist_reduce_fx="sum", - ) - self.Matching_metrics.append(f"gt_R_precision_top_{str(k)}") - - self.metrics.extend(self.Matching_metrics) - - # NLG - for k in range(1, top_k + 1): - self.add_state( - f"Bleu_{str(k)}", - default=torch.tensor(0.0), - dist_reduce_fx="sum", - ) - self.metrics.append(f"Bleu_{str(k)}") - - self.add_state("ROUGE_L", - default=torch.tensor(0.0), - dist_reduce_fx="sum") - self.metrics.append("ROUGE_L") - - self.add_state("CIDEr", - default=torch.tensor(0.0), - dist_reduce_fx="sum") - self.metrics.append("CIDEr") - - # Chached batches - self.pred_texts = [] - self.gt_texts = [] - self.add_state("predtext_embeddings", default=[]) - self.add_state("gttext_embeddings", default=[]) - self.add_state("gtmotion_embeddings", default=[]) - - # T2M Evaluator - self._get_t2m_evaluator(cfg) - - self.nlp = spacy.load('en_core_web_sm') - - if self.cfg.model.params.task == 'm2t': - from nlgmetricverse import NLGMetricverse, load_metric - metrics = [ - load_metric("bleu", resulting_name="bleu_1", compute_kwargs={"max_order": 1}), - load_metric("bleu", resulting_name="bleu_4", compute_kwargs={"max_order": 4}), - load_metric("rouge"), - load_metric("cider"), - ] - self.nlg_evaluator = NLGMetricverse(metrics) - - def _get_t2m_evaluator(self, cfg): - """ - load T2M text encoder and motion encoder for evaluating - """ - # init module - self.t2m_textencoder = instantiate_from_config(cfg.METRIC.TM2T.t2m_textencoder) - self.t2m_moveencoder = instantiate_from_config(cfg.METRIC.TM2T.t2m_moveencoder) - self.t2m_motionencoder = instantiate_from_config(cfg.METRIC.TM2T.t2m_motionencoder) - - - # load pretrianed - if self.dataname == "kit": - dataname = "kit" - else: - dataname = "t2m" - - t2m_checkpoint = torch.load(os.path.join( - cfg.METRIC.TM2T.t2m_path, dataname, "text_mot_match/model/finest.tar"), - map_location='cpu') - self.t2m_textencoder.load_state_dict(t2m_checkpoint["text_encoder"]) - self.t2m_moveencoder.load_state_dict( - t2m_checkpoint["movement_encoder"]) - self.t2m_motionencoder.load_state_dict( - t2m_checkpoint["motion_encoder"]) - - # freeze params - self.t2m_textencoder.eval() - self.t2m_moveencoder.eval() - self.t2m_motionencoder.eval() - for p in self.t2m_textencoder.parameters(): - p.requires_grad = False - for p in self.t2m_moveencoder.parameters(): - p.requires_grad = False - for p in self.t2m_motionencoder.parameters(): - p.requires_grad = False - - def _process_text(self, sentence): - sentence = sentence.replace('-', '') - doc = self.nlp(sentence) - word_list = [] - pos_list = [] - for token in doc: - word = token.text - if not word.isalpha(): - continue - if (token.pos_ == 'NOUN' - or token.pos_ == 'VERB') and (word != 'left'): - word_list.append(token.lemma_) - else: - word_list.append(word) - pos_list.append(token.pos_) - return word_list, pos_list - - def _get_text_embeddings(self, texts): - word_embs = [] - pos_ohot = [] - text_lengths = [] - for i, sentence in enumerate(texts): - word_list, pos_list = self._process_text(sentence.strip()) - t_tokens = [ - '%s/%s' % (word_list[i], pos_list[i]) - for i in range(len(word_list)) - ] - - if len(t_tokens) < self.max_text_len: - # pad with "unk" - tokens = ['sos/OTHER'] + t_tokens + ['eos/OTHER'] - sent_len = len(tokens) - tokens = tokens + ['unk/OTHER' - ] * (self.max_text_len + 2 - sent_len) - else: - # crop - tokens = t_tokens[:self.max_text_len] - tokens = ['sos/OTHER'] + tokens + ['eos/OTHER'] - sent_len = len(tokens) - pos_one_hots = [] - word_embeddings = [] - for token in tokens: - word_emb, pos_oh = self.w_vectorizer[token] - pos_one_hots.append(torch.tensor(pos_oh).float()[None]) - word_embeddings.append(torch.tensor(word_emb).float()[None]) - text_lengths.append(sent_len) - pos_ohot.append(torch.cat(pos_one_hots, dim=0)[None]) - word_embs.append(torch.cat(word_embeddings, dim=0)[None]) - - word_embs = torch.cat(word_embs, dim=0).to(self.Matching_score) - pos_ohot = torch.cat(pos_ohot, dim=0).to(self.Matching_score) - text_lengths = torch.tensor(text_lengths).to(self.Matching_score) - - align_idx = np.argsort(text_lengths.data.tolist())[::-1].copy() - - # get text embeddings - text_embeddings = self.t2m_textencoder(word_embs[align_idx], - pos_ohot[align_idx], - text_lengths[align_idx]) - - original_text_embeddings = text_embeddings.clone() - - for idx, sort in enumerate(align_idx): - original_text_embeddings[sort] = text_embeddings[idx] - - return original_text_embeddings - - @torch.no_grad() - def compute(self, sanity_flag): - count = self.count.item() - count_seq = self.count_seq.item() - - # Init metrics dict - metrics = {metric: getattr(self, metric) for metric in self.metrics} - - # Jump in sanity check stage - if sanity_flag: - return metrics - - # Cat cached batches and shuffle - shuffle_idx = torch.randperm(count_seq) - all_motions = torch.cat(self.gtmotion_embeddings, - axis=0).cpu()[shuffle_idx, :] - all_gttexts = torch.cat(self.gttext_embeddings, - axis=0).cpu()[shuffle_idx, :] - all_predtexts = torch.cat(self.predtext_embeddings, - axis=0).cpu()[shuffle_idx, :] - - print("Computing metrics...") - - # Compute r-precision - assert count_seq >= self.R_size - top_k_mat = torch.zeros((self.top_k, )) - for i in range(count_seq // self.R_size): - # [bs=32, 1*256] - group_texts = all_predtexts[i * self.R_size:(i + 1) * self.R_size] - # [bs=32, 1*256] - group_motions = all_motions[i * self.R_size:(i + 1) * self.R_size] - # [bs=32, 32] - dist_mat = euclidean_distance_matrix(group_texts, - group_motions).nan_to_num() - # print(dist_mat[:5]) - self.Matching_score += dist_mat.trace() - argsmax = torch.argsort(dist_mat, dim=1) - top_k_mat += calculate_top_k(argsmax, top_k=self.top_k).sum(axis=0) - - R_count = count_seq // self.R_size * self.R_size - metrics["Matching_score"] = self.Matching_score / R_count - for k in range(self.top_k): - metrics[f"R_precision_top_{str(k+1)}"] = top_k_mat[k] / R_count - - # Compute r-precision with gt - assert count_seq >= self.R_size - top_k_mat = torch.zeros((self.top_k, )) - for i in range(count_seq // self.R_size): - # [bs=32, 1*256] - group_texts = all_gttexts[i * self.R_size:(i + 1) * self.R_size] - # [bs=32, 1*256] - group_motions = all_motions[i * self.R_size:(i + 1) * self.R_size] - # [bs=32, 32] - dist_mat = euclidean_distance_matrix(group_texts, - group_motions).nan_to_num() - # match score - self.gt_Matching_score += dist_mat.trace() - argsmax = torch.argsort(dist_mat, dim=1) - top_k_mat += calculate_top_k(argsmax, top_k=self.top_k).sum(axis=0) - metrics["gt_Matching_score"] = self.gt_Matching_score / R_count - for k in range(self.top_k): - metrics[f"gt_R_precision_top_{str(k+1)}"] = top_k_mat[k] / R_count - - # NLP metrics - scores = self.nlg_evaluator(predictions=self.pred_texts, - references=self.gt_texts) - for k in range(1, self.bleu_k + 1): - metrics[f"Bleu_{str(k)}"] = torch.tensor(scores[f'bleu_{str(k)}'], - device=self.device) - - metrics["ROUGE_L"] = torch.tensor(scores["rouge"]["rougeL"], - device=self.device) - metrics["CIDEr"] = torch.tensor(scores["cider"]['score'],device=self.device) - - # Bert metrics - P, R, F1 = score_bert(self.pred_texts, - self.gt_texts, - lang='en', - rescale_with_baseline=True, - idf=True, - device=self.device, - verbose=False) - - metrics["Bert_F1"] = F1.mean() - - # Reset - self.reset() - self.gt_texts = [] - self.pred_texts = [] - - return {**metrics} - - @torch.no_grad() - def update(self, - feats_ref: Tensor, - pred_texts: List[str], - gt_texts: List[str], - lengths: List[int], - word_embs: Tensor = None, - pos_ohot: Tensor = None, - text_lengths: Tensor = None): - - self.count += sum(lengths) - self.count_seq += len(lengths) - - # motion encoder - m_lens = torch.tensor(lengths, device=feats_ref.device) - align_idx = np.argsort(m_lens.data.tolist())[::-1].copy() - feats_ref = feats_ref[align_idx] - m_lens = m_lens[align_idx] - m_lens = torch.div(m_lens, - self.cfg.DATASET.HUMANML3D.UNIT_LEN, - rounding_mode="floor") - ref_mov = self.t2m_moveencoder(feats_ref[..., :-4]).detach() - m_lens = m_lens // self.unit_length - ref_emb = self.t2m_motionencoder(ref_mov, m_lens) - gtmotion_embeddings = torch.flatten(ref_emb, start_dim=1).detach() - self.gtmotion_embeddings.append(gtmotion_embeddings) - - # text encoder - gttext_emb = self.t2m_textencoder(word_embs, pos_ohot, - text_lengths)[align_idx] - gttext_embeddings = torch.flatten(gttext_emb, start_dim=1).detach() - predtext_emb = self._get_text_embeddings(pred_texts)[align_idx] - predtext_embeddings = torch.flatten(predtext_emb, start_dim=1).detach() - - self.gttext_embeddings.append(gttext_embeddings) - self.predtext_embeddings.append(predtext_embeddings) - - self.pred_texts.extend(pred_texts) - self.gt_texts.extend(gt_texts) diff --git a/spaces/PAIR/PAIR-Diffusion/deform_setup.sh b/spaces/PAIR/PAIR-Diffusion/deform_setup.sh deleted file mode 100644 index e6afa379fb41812699f2efce980c8d86d09ed7f6..0000000000000000000000000000000000000000 --- a/spaces/PAIR/PAIR-Diffusion/deform_setup.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/env bash - -# ln -s ./oneformer/modeling/pixel_decoder/ops/ ./ -# ls -# cd ops/ && bash make.sh && cd .. -echo '----------------------------------------------------------------' -echo '----------------------------------------------------------------' -pip3 freeze | grep MultiScaleDeformableAttention -pip3 freeze | grep torch -pip3 freeze | grep detectron2 -echo '----------------------------------------------------------------' -echo '----------------------------------------------------------------' - -# echo '----------------------------------------------------------------' -# echo '----------------------------------------------------------------' -# cd /home/user/.pyenv/versions/3.8.15/lib/python3.8/site-packages -# ls -# ls | grep MultiScale -# echo '----------------------------------------------------------------' -# echo '----------- \ No newline at end of file diff --git a/spaces/PKUWilliamYang/StyleGANEX/utils/data_utils.py b/spaces/PKUWilliamYang/StyleGANEX/utils/data_utils.py deleted file mode 100644 index f1ba79f4a2d5cc2b97dce76d87bf6e7cdebbc257..0000000000000000000000000000000000000000 --- a/spaces/PKUWilliamYang/StyleGANEX/utils/data_utils.py +++ /dev/null @@ -1,25 +0,0 @@ -""" -Code adopted from pix2pixHD: -https://github.com/NVIDIA/pix2pixHD/blob/master/data/image_folder.py -""" -import os - -IMG_EXTENSIONS = [ - '.jpg', '.JPG', '.jpeg', '.JPEG', - '.png', '.PNG', '.ppm', '.PPM', '.bmp', '.BMP', '.tiff' -] - - -def is_image_file(filename): - return any(filename.endswith(extension) for extension in IMG_EXTENSIONS) - - -def make_dataset(dir): - images = [] - assert os.path.isdir(dir), '%s is not a valid directory' % dir - for root, _, fnames in sorted(os.walk(dir)): - for fname in fnames: - if is_image_file(fname): - path = os.path.join(root, fname) - images.append(path) - return images diff --git a/spaces/PSLD/PSLD/stable-diffusion/setup.py b/spaces/PSLD/PSLD/stable-diffusion/setup.py deleted file mode 100644 index a24d541676407eee1bea271179ffd1d80c6a8e79..0000000000000000000000000000000000000000 --- a/spaces/PSLD/PSLD/stable-diffusion/setup.py +++ /dev/null @@ -1,13 +0,0 @@ -from setuptools import setup, find_packages - -setup( - name='latent-diffusion', - version='0.0.1', - description='', - packages=find_packages(), - install_requires=[ - 'torch', - 'numpy', - 'tqdm', - ], -) \ No newline at end of file diff --git a/spaces/Panel-Org/panel-template/app.py b/spaces/Panel-Org/panel-template/app.py deleted file mode 100644 index 80716243cc0125867750fa75049719e3a22eaf62..0000000000000000000000000000000000000000 --- a/spaces/Panel-Org/panel-template/app.py +++ /dev/null @@ -1,147 +0,0 @@ -import io -import random -from typing import List, Tuple - -import aiohttp -import panel as pn -from PIL import Image -from transformers import CLIPModel, CLIPProcessor - -pn.extension(design="bootstrap", sizing_mode="stretch_width") - -ICON_URLS = { - "brand-github": "https://github.com/holoviz/panel", - "brand-twitter": "https://twitter.com/Panel_Org", - "brand-linkedin": "https://www.linkedin.com/company/panel-org", - "message-circle": "https://discourse.holoviz.org/", - "brand-discord": "https://discord.gg/AXRHnJU6sP", -} - - -async def random_url(_): - pet = random.choice(["cat", "dog"]) - api_url = f"https://api.the{pet}api.com/v1/images/search" - async with aiohttp.ClientSession() as session: - async with session.get(api_url) as resp: - return (await resp.json())[0]["url"] - - -@pn.cache -def load_processor_model( - processor_name: str, model_name: str -) -> Tuple[CLIPProcessor, CLIPModel]: - processor = CLIPProcessor.from_pretrained(processor_name) - model = CLIPModel.from_pretrained(model_name) - return processor, model - - -async def open_image_url(image_url: str) -> Image: - async with aiohttp.ClientSession() as session: - async with session.get(image_url) as resp: - return Image.open(io.BytesIO(await resp.read())) - - -def get_similarity_scores(class_items: List[str], image: Image) -> List[float]: - processor, model = load_processor_model( - "openai/clip-vit-base-patch32", "openai/clip-vit-base-patch32" - ) - inputs = processor( - text=class_items, - images=[image], - return_tensors="pt", # pytorch tensors - ) - outputs = model(**inputs) - logits_per_image = outputs.logits_per_image - class_likelihoods = logits_per_image.softmax(dim=1).detach().numpy() - return class_likelihoods[0] - - -async def process_inputs(class_names: List[str], image_url: str): - """ - High level function that takes in the user inputs and returns the - classification results as panel objects. - """ - try: - main.disabled = True - if not image_url: - yield "##### ⚠️ Provide an image URL" - return - - yield "##### ⚙ Fetching image and running model..." - try: - pil_img = await open_image_url(image_url) - img = pn.pane.Image(pil_img, height=400, align="center") - except Exception as e: - yield f"##### 😔 Something went wrong, please try a different URL!" - return - - class_items = class_names.split(",") - class_likelihoods = get_similarity_scores(class_items, pil_img) - - # build the results column - results = pn.Column("##### 🎉 Here are the results!", img) - - for class_item, class_likelihood in zip(class_items, class_likelihoods): - row_label = pn.widgets.StaticText( - name=class_item.strip(), value=f"{class_likelihood:.2%}", align="center" - ) - row_bar = pn.indicators.Progress( - value=int(class_likelihood * 100), - sizing_mode="stretch_width", - bar_color="secondary", - margin=(0, 10), - design=pn.theme.Material, - ) - results.append(pn.Column(row_label, row_bar)) - yield results - finally: - main.disabled = False - - -# create widgets -randomize_url = pn.widgets.Button(name="Randomize URL", align="end") - -image_url = pn.widgets.TextInput( - name="Image URL to classify", - value=pn.bind(random_url, randomize_url), -) -class_names = pn.widgets.TextInput( - name="Comma separated class names", - placeholder="Enter possible class names, e.g. cat, dog", - value="cat, dog, parrot", -) - -input_widgets = pn.Column( - "##### 😊 Click randomize or paste a URL to start classifying!", - pn.Row(image_url, randomize_url), - class_names, -) - -# add interactivity -interactive_result = pn.panel( - pn.bind(process_inputs, image_url=image_url, class_names=class_names), - height=600, -) - -# add footer -footer_row = pn.Row(pn.Spacer(), align="center") -for icon, url in ICON_URLS.items(): - href_button = pn.widgets.Button(icon=icon, width=35, height=35) - href_button.js_on_click(code=f"window.open('{url}')") - footer_row.append(href_button) -footer_row.append(pn.Spacer()) - -# create dashboard -main = pn.WidgetBox( - input_widgets, - interactive_result, - footer_row, -) - -title = "Panel Demo - Image Classification" -pn.template.BootstrapTemplate( - title=title, - main=main, - main_max_width="min(50%, 698px)", - header_background="#F08080", -).servable(title=title) \ No newline at end of file diff --git a/spaces/Pattr/DrumClassification/lilypond-2.24.2/lib/guile/2.2/ccache/texinfo/reflection.go b/spaces/Pattr/DrumClassification/lilypond-2.24.2/lib/guile/2.2/ccache/texinfo/reflection.go deleted file mode 100644 index a3f6339b485cf80129379dde76ca804c592f9746..0000000000000000000000000000000000000000 Binary files a/spaces/Pattr/DrumClassification/lilypond-2.24.2/lib/guile/2.2/ccache/texinfo/reflection.go and /dev/null differ diff --git a/spaces/Pinwheel/GLIP-BLIP-Object-Detection-VQA/maskrcnn_benchmark/modeling/roi_heads/mask_head/__init__.py b/spaces/Pinwheel/GLIP-BLIP-Object-Detection-VQA/maskrcnn_benchmark/modeling/roi_heads/mask_head/__init__.py deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/spaces/Plsek/CADET/app.py b/spaces/Plsek/CADET/app.py deleted file mode 100644 index 65be5d81339f17ec77133487ef992d966c590788..0000000000000000000000000000000000000000 --- a/spaces/Plsek/CADET/app.py +++ /dev/null @@ -1,294 +0,0 @@ -# Basic libraries -import os -import shutil -import numpy as np -from scipy.ndimage import center_of_mass -import matplotlib.pyplot as plt -from matplotlib.colors import Normalize, LogNorm -from matplotlib.patches import Rectangle - -# Astropy -from astropy.io import fits -from astropy.wcs import WCS -from astropy.nddata import Cutout2D, CCDData - -# Scikit-learn -from sklearn.cluster import DBSCAN - -# Streamlit -import streamlit as st -st.set_option('deprecation.showPyplotGlobalUse', False) -st.set_page_config(page_title="Cavity Detection Tool", layout="wide") - -# HuggingFace hub -from huggingface_hub import from_pretrained_keras -# from tensorflow.keras.models import load_model - - -# Define function to plot the uploaded image -def plot_image(image, scale): - plt.figure(figsize=(4, 4)) - x0 = image.shape[0] // 2 - scale * 128 / 2 - plt.imshow(np.log10(image+1), origin="lower") #, norm=LogNorm()) - plt.gca().add_patch(Rectangle((x0-0.5, x0-0.5), scale*128, scale*128, linewidth=1, edgecolor='w', facecolor='none')) - plt.axis('off') - plt.tight_layout() - with colA: st.pyplot() - -# Define function to plot the prediction -def plot_prediction(pred): - plt.figure(figsize=(4, 4)) - plt.imshow(pred, origin="lower", norm=Normalize(vmin=0, vmax=1)) - plt.axis('off') - with colB: st.pyplot() - -# Define function to plot the decomposed prediction -def plot_decomposed(decomposed): - plt.figure(figsize=(4, 4)) - plt.imshow(decomposed, origin="lower") - N = int(np.max(decomposed)) - for i in range(N): - new = np.where(decomposed == i+1, 1, 0) - x0, y0 = center_of_mass(new) - color = "white" if i <= N//2 else "black" - plt.text(y0, x0, f"{i+1}", ha="center", va="center", fontsize=15, color=color) - plt.axis('off') - with colC: st.pyplot() - -# Define function to cut input image and rebin it to 128x128 pixels -def cut(data0, wcs0, scale=1): - shape = data0.shape[0] - x0 = shape / 2 - size = 128 * scale - cutout = Cutout2D(data0, (x0, x0), (size, size), wcs=wcs0) - data, wcs = cutout.data, cutout.wcs - - # Regrid data - factor = size // 128 - data = data.reshape(128, factor, 128, factor).mean(-1).mean(1) - - # Regrid wcs - ra, dec = wcs.wcs_pix2world(np.array([[63, 63]]),0)[0] - wcs.wcs.cdelt[0] = wcs.wcs.cdelt[0] * factor - wcs.wcs.cdelt[1] = wcs.wcs.cdelt[1] * factor - wcs.wcs.crval[0] = ra - wcs.wcs.crval[1] = dec - wcs.wcs.crpix[0] = 64 / factor - wcs.wcs.crpix[1] = 64 / factor - - return data, wcs - -# Define function to apply cutting and produce a prediction -@st.cache #_data -def cut_n_predict(data, _wcs, scale): - data, wcs = cut(data, _wcs, scale=scale) - image = np.log10(data+1) - - y_pred = 0 - for j in [0,1,2,3]: - rotated = np.rot90(image, j) - pred = model.predict(rotated.reshape(1, 128, 128, 1)).reshape(128 ,128) - pred = np.rot90(pred, -j) - y_pred += pred / 4 - - return y_pred, wcs - -# Define function to decompose prediction into individual cavities -@st.cache #_data -def decompose_cavity(pred, fname, th2=0.7, amin=10): - X, Y = pred.nonzero() - data = np.array([X,Y]).reshape(2, -1) - - # DBSCAN clustering - try: clusters = DBSCAN(eps=1.0, min_samples=3).fit(data.T).labels_ - except: clusters = [] - - N = len(set(clusters)) - cavities = [] - - for i in range(N): - img = np.zeros((128,128)) - b = clusters == i - xi, yi = X[b], Y[b] - img[xi, yi] = pred[xi, yi] - - # # Thresholding #2 - # if not (img > th2).any(): continue - - # Minimal area - if np.sum(img) <= amin: continue - - cavities.append(img) - - # Save raw and decomposed predictions to predictions folder - ccd = CCDData(pred, unit="adu", wcs=wcs) - ccd.write(f"{fname}/predicted.fits", overwrite=True) - image_decomposed = np.zeros((128,128)) - for i, cav in enumerate(cavities): - ccd = CCDData(cav, unit="adu", wcs=wcs) - ccd.write(f"{fname}/decomposed_{i+1}.fits", overwrite=True) - image_decomposed += (i+1) * np.where(cav > 0, 1, 0) - - # shutil.make_archive("predictions", 'zip', "predictions") - - return image_decomposed - -# Define function that loads FITS file and return data & wcs -@st.cache #_data -def load_file(fname): - with fits.open(fname) as hdul: - data = hdul[0].data - wcs = WCS(hdul[0].header) - return data, wcs - -# Define function to load model -@st.cache(allow_output_mutation=True) #_resource -def load_CADET(): - model = from_pretrained_keras("Plsek/CADET-v1") - # model = load_model("CADET.hdf5") - return model - -def reset_all(): - # del st.session_state["threshold"] - st.session_state['threshold'] = 0.0 - st.session_state['example'] = False - -def reset_threshold(): - # del st.session_state["threshold"] - st.session_state['threshold'] = 0.0 - -# Load model -model = load_CADET() - -# Use wide layout and create columns -bordersize = 0.6 -_, col, _ = st.columns([bordersize, 3, bordersize]) - -os.system("rm *.zip") -os.system("rm -R -- */") -# if os.path.exists("predictions"): os.system("rm -r predictions") -# os.system("mkdir -p predictions") - -with col: - with st.container(): - # Create heading and description - st.markdown("

      Cavity Detection Tool (CADET)

      ", unsafe_allow_html=True) - # st.markdown("Cavity Detection Tool (CADET) is a machine learning pipeline trained to detect X-ray cavities from noisy Chandra images of early-type galaxies.") - # st.markdown("To use this tool: upload your image, select the scale of interest, make a prediction, and decompose it into individual cavities!") - # st.markdown("Input images should be FITS files in units of counts, centred at the galaxy center, and point sources should be filled with surrounding background ([dmfilth](https://cxc.cfa.harvard.edu/ciao/ahelp/dmfilth.html)).") - # st.markdown("If you use this tool for your research, please cite [Plšek et al. 2023](https://arxiv.org/abs/2304.05457)") - - # #F3F4F6 - st.markdown("
      \ -Cavity Detection Tool (CADET) is a machine learning pipeline trained to detect X-ray cavities from Chandra images of early-type galaxies, groups, and clusters. \ -If you use this tool in your research, please cite Plšek et al. 2023.\ -
      1) upload FITS file (cropped & centered at the center of the galaxy)
      2) select the scale of interest
      3) make a prediction
      4) decompose into individual cavities. \ -
      ", unsafe_allow_html=True) - -# Input images should be FITS files in units of counts, centred at the galaxy center, and point sources should be filled with surrounding background \ -# (dmfilth).

      \ - - -_, col_1, col_2, _ = st.columns([bordersize, 2.5, 0.5, bordersize]) - -with col_1: - uploaded_file = st.file_uploader("Choose a FITS file", type=['fits'], on_change=reset_all) - -with col_2: - st.markdown("
      ", unsafe_allow_html=True) - if st.button("Example"): st.session_state['example'] = True - - # with col_2: - # st.markdown("### Examples") - # NGC4649 = st.button("NGC4649") - - # with col_3: - # st.markdown("""""", unsafe_allow_html=True) - # NGC5813 = st.button("NGC5813") - - # if NGC4649: - # uploaded_file = "NGC4649_example.fits" - # elif NGC5813: - # uploaded_file = "NGC5813_example.fits" - - # If file is uploaded, read in the data and plot it - - -if 'example' not in st.session_state: - st.session_state['example'] = False - -if uploaded_file is not None: - fname = uploaded_file.name.strip(".fits") - os.system(f'mkdir -p {fname}') - data, wcs = load_file(uploaded_file) - - MIN = np.min(np.where(data == 0, 1, data)) - if MIN < 1: data = data / MIN - -if st.session_state["example"]: - fname = "NGC5813_example" - os.system(f'mkdir -p {fname}') - data, wcs = load_file(f"{fname}.fits") - -if "data" not in locals(): - data, wcs = np.ones((128,128)) * (-1), None - -# Make six columns for buttons -_, col1, col2, col3, col4, col5, col6, _ = st.columns([bordersize,0.5,0.5,0.5,0.5,0.5,0.5,bordersize]) -col1.subheader("Input image") -col3.subheader("Prediction") -col5.subheader("Decomposed") -col6.subheader("") - -# Scale selectbox -with col1: - st.markdown("""""", unsafe_allow_html=True) - max_scale = int(data.shape[0] // 128) - scale = st.selectbox('Scale:',[f"{(i+1)*128}x{(i+1)*128}" for i in range(max_scale)], label_visibility="hidden", on_change=reset_threshold) - scale = int(scale.split("x")[0]) // 128 - -# Detect button -with col3: detect = st.button('Detect', key="detect") - -# Threshold slider -with col4: - st.markdown("") - # st.markdown("""""", unsafe_allow_html=True) - threshold = st.slider("Threshold", min_value=0.0, max_value=1.0, step=0.05, key="threshold") #, label_visibility="hidden") - -# Decompose button -with col5: decompose = st.button('Decompose', key="decompose") - -# Make two columns for plots -_, colA, colB, colC, _ = st.columns([bordersize,1,1,1,bordersize]) - -# NORMALIZE IMAGE -plot_image(data, scale) - -if detect or threshold or st.session_state.get("decompose", False): - - y_pred, wcs = cut_n_predict(data, wcs, scale) - - y_pred_th = np.where(y_pred > threshold, y_pred, 0) - - plot_prediction(y_pred_th) - - if decompose or st.session_state.get("download", False): - image_decomposed = decompose_cavity(y_pred_th, fname) - - plot_decomposed(image_decomposed) - - with col6: - st.markdown("
      ", unsafe_allow_html=True) - # st.markdown("""""", unsafe_allow_html=True) - - # if st.session_state.get("download", False): - - shutil.make_archive(fname, 'zip', fname) - with open(f"{fname}.zip", 'rb') as f: - res = f.read() - - download = st.download_button(label="Download", data=res, key="download", - file_name=f'{fname}_{int(scale*128)}.zip', - # disabled=st.session_state.get("disabled", True), - mime="application/octet-stream") \ No newline at end of file diff --git a/spaces/Priyabrata017/Flamingo/README.md b/spaces/Priyabrata017/Flamingo/README.md deleted file mode 100644 index a768ed7fb09c782065679cf8b11d5250faec3188..0000000000000000000000000000000000000000 --- a/spaces/Priyabrata017/Flamingo/README.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -title: Flamingo -emoji: 📊 -colorFrom: red -colorTo: purple -sdk: gradio -sdk_version: 3.1.7 -app_file: app.py -pinned: false -license: mit ---- - -Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference diff --git a/spaces/Prof-Reza/Audiocraft_Music-Audio_Generation/audiocraft/solvers/builders.py b/spaces/Prof-Reza/Audiocraft_Music-Audio_Generation/audiocraft/solvers/builders.py deleted file mode 100644 index 304d8f08d33a70e8be9388c855b2ae43bdf2683b..0000000000000000000000000000000000000000 --- a/spaces/Prof-Reza/Audiocraft_Music-Audio_Generation/audiocraft/solvers/builders.py +++ /dev/null @@ -1,363 +0,0 @@ -# Copyright (c) Meta Platforms, Inc. and affiliates. -# All rights reserved. -# -# This source code is licensed under the license found in the -# LICENSE file in the root directory of this source tree. - -""" -All the functions to build the relevant solvers and used objects -from the Hydra config. -""" - -from enum import Enum -import logging -import typing as tp - -import dora -import flashy -import omegaconf -import torch -from torch import nn -from torch.optim import Optimizer -# LRScheduler was renamed in some torch versions -try: - from torch.optim.lr_scheduler import LRScheduler # type: ignore -except ImportError: - from torch.optim.lr_scheduler import _LRScheduler as LRScheduler - -from .base import StandardSolver -from .. import adversarial, data, losses, metrics, optim -from ..utils.utils import dict_from_config, get_loader - - -logger = logging.getLogger(__name__) - - -class DatasetType(Enum): - AUDIO = "audio" - MUSIC = "music" - SOUND = "sound" - - -def get_solver(cfg: omegaconf.DictConfig) -> StandardSolver: - """Instantiate solver from config.""" - from .audiogen import AudioGenSolver - from .compression import CompressionSolver - from .musicgen import MusicGenSolver - from .diffusion import DiffusionSolver - klass = { - 'compression': CompressionSolver, - 'musicgen': MusicGenSolver, - 'audiogen': AudioGenSolver, - 'lm': MusicGenSolver, # backward compatibility - 'diffusion': DiffusionSolver, - 'sound_lm': AudioGenSolver, # backward compatibility - }[cfg.solver] - return klass(cfg) # type: ignore - - -def get_optim_parameter_groups(model: nn.Module): - """Create parameter groups for the model using the appropriate method - if defined for each modules, to create the different groups. - - Args: - model (nn.Module): torch model - Returns: - List of parameter groups - """ - seen_params: tp.Set[nn.parameter.Parameter] = set() - other_params = [] - groups = [] - for name, module in model.named_modules(): - if hasattr(module, 'make_optim_group'): - group = module.make_optim_group() - params = set(group['params']) - assert params.isdisjoint(seen_params) - seen_params |= set(params) - groups.append(group) - for param in model.parameters(): - if param not in seen_params: - other_params.append(param) - groups.insert(0, {'params': other_params}) - parameters = groups - return parameters - - -def get_optimizer(params: tp.Union[nn.Module, tp.Iterable[torch.Tensor]], cfg: omegaconf.DictConfig) -> Optimizer: - """Build torch optimizer from config and set of parameters. - Supported optimizers: Adam, AdamW - - Args: - params (nn.Module or iterable of torch.Tensor): Parameters to optimize. - cfg (DictConfig): Optimization-related configuration. - Returns: - torch.optim.Optimizer. - """ - if 'optimizer' not in cfg: - if getattr(cfg, 'optim', None) is not None: - raise KeyError("Optimizer not found in config. Try instantiating optimizer from cfg.optim?") - else: - raise KeyError("Optimizer not found in config.") - - parameters = get_optim_parameter_groups(params) if isinstance(params, nn.Module) else params - optimizer: torch.optim.Optimizer - if cfg.optimizer == 'adam': - optimizer = torch.optim.Adam(parameters, lr=cfg.lr, **cfg.adam) - elif cfg.optimizer == 'adamw': - optimizer = torch.optim.AdamW(parameters, lr=cfg.lr, **cfg.adam) - elif cfg.optimizer == 'dadam': - optimizer = optim.DAdaptAdam(parameters, lr=cfg.lr, **cfg.adam) - else: - raise ValueError(f"Unsupported LR Scheduler: {cfg.lr_scheduler}") - return optimizer - - -def get_lr_scheduler(optimizer: torch.optim.Optimizer, - cfg: omegaconf.DictConfig, - total_updates: int) -> tp.Optional[LRScheduler]: - """Build torch learning rate scheduler from config and associated optimizer. - Supported learning rate schedulers: ExponentialLRScheduler, PlateauLRScheduler - - Args: - optimizer (torch.optim.Optimizer): Optimizer. - cfg (DictConfig): Schedule-related configuration. - total_updates (int): Total number of updates. - Returns: - torch.optim.Optimizer. - """ - if 'lr_scheduler' not in cfg: - raise KeyError("LR Scheduler not found in config") - - lr_sched: tp.Optional[LRScheduler] = None - if cfg.lr_scheduler == 'step': - lr_sched = torch.optim.lr_scheduler.StepLR(optimizer, **cfg.step) - elif cfg.lr_scheduler == 'exponential': - lr_sched = torch.optim.lr_scheduler.ExponentialLR(optimizer, gamma=cfg.exponential) - elif cfg.lr_scheduler == 'cosine': - kwargs = dict_from_config(cfg.cosine) - warmup_steps = kwargs.pop('warmup') - lr_sched = optim.CosineLRScheduler( - optimizer, warmup_steps=warmup_steps, total_steps=total_updates, **kwargs) - elif cfg.lr_scheduler == 'polynomial_decay': - kwargs = dict_from_config(cfg.polynomial_decay) - warmup_steps = kwargs.pop('warmup') - lr_sched = optim.PolynomialDecayLRScheduler( - optimizer, warmup_steps=warmup_steps, total_steps=total_updates, **kwargs) - elif cfg.lr_scheduler == 'inverse_sqrt': - kwargs = dict_from_config(cfg.inverse_sqrt) - warmup_steps = kwargs.pop('warmup') - lr_sched = optim.InverseSquareRootLRScheduler(optimizer, warmup_steps=warmup_steps, **kwargs) - elif cfg.lr_scheduler == 'linear_warmup': - kwargs = dict_from_config(cfg.linear_warmup) - warmup_steps = kwargs.pop('warmup') - lr_sched = optim.LinearWarmupLRScheduler(optimizer, warmup_steps=warmup_steps, **kwargs) - elif cfg.lr_scheduler is not None: - raise ValueError(f"Unsupported LR Scheduler: {cfg.lr_scheduler}") - return lr_sched - - -def get_ema(module_dict: nn.ModuleDict, cfg: omegaconf.DictConfig) -> tp.Optional[optim.ModuleDictEMA]: - """Initialize Exponential Moving Average. - - Args: - module_dict (nn.ModuleDict): ModuleDict for which to compute the EMA. - cfg (omegaconf.DictConfig): Optim EMA configuration. - Returns: - optim.ModuleDictEMA: EMA version of the ModuleDict. - """ - kw: tp.Dict[str, tp.Any] = dict(cfg) - use = kw.pop('use', False) - decay = kw.pop('decay', None) - device = kw.pop('device', None) - if not use: - return None - if len(module_dict) == 0: - raise ValueError("Trying to build EMA but an empty module_dict source is provided!") - ema_module = optim.ModuleDictEMA(module_dict, decay=decay, device=device) - return ema_module - - -def get_loss(loss_name: str, cfg: omegaconf.DictConfig): - """Instantiate loss from configuration.""" - klass = { - 'l1': torch.nn.L1Loss, - 'l2': torch.nn.MSELoss, - 'mel': losses.MelSpectrogramL1Loss, - 'mrstft': losses.MRSTFTLoss, - 'msspec': losses.MultiScaleMelSpectrogramLoss, - 'sisnr': losses.SISNR, - }[loss_name] - kwargs = dict(getattr(cfg, loss_name)) - return klass(**kwargs) - - -def get_balancer(loss_weights: tp.Dict[str, float], cfg: omegaconf.DictConfig) -> losses.Balancer: - """Instantiate loss balancer from configuration for the provided weights.""" - kwargs: tp.Dict[str, tp.Any] = dict_from_config(cfg) - return losses.Balancer(loss_weights, **kwargs) - - -def get_adversary(name: str, cfg: omegaconf.DictConfig) -> nn.Module: - """Initialize adversary from config.""" - klass = { - 'msd': adversarial.MultiScaleDiscriminator, - 'mpd': adversarial.MultiPeriodDiscriminator, - 'msstftd': adversarial.MultiScaleSTFTDiscriminator, - }[name] - adv_cfg: tp.Dict[str, tp.Any] = dict(getattr(cfg, name)) - return klass(**adv_cfg) - - -def get_adversarial_losses(cfg) -> nn.ModuleDict: - """Initialize dict of adversarial losses from config.""" - device = cfg.device - adv_cfg = getattr(cfg, 'adversarial') - adversaries = adv_cfg.get('adversaries', []) - adv_loss_name = adv_cfg['adv_loss'] - feat_loss_name = adv_cfg.get('feat_loss') - normalize = adv_cfg.get('normalize', True) - feat_loss: tp.Optional[adversarial.FeatureMatchingLoss] = None - if feat_loss_name: - assert feat_loss_name in ['l1', 'l2'], f"Feature loss only support L1 or L2 but {feat_loss_name} found." - loss = get_loss(feat_loss_name, cfg) - feat_loss = adversarial.FeatureMatchingLoss(loss, normalize) - loss = adversarial.get_adv_criterion(adv_loss_name) - loss_real = adversarial.get_real_criterion(adv_loss_name) - loss_fake = adversarial.get_fake_criterion(adv_loss_name) - adv_losses = nn.ModuleDict() - for adv_name in adversaries: - adversary = get_adversary(adv_name, cfg).to(device) - optimizer = get_optimizer(adversary.parameters(), cfg.optim) - adv_loss = adversarial.AdversarialLoss( - adversary, - optimizer, - loss=loss, - loss_real=loss_real, - loss_fake=loss_fake, - loss_feat=feat_loss, - normalize=normalize - ) - adv_losses[adv_name] = adv_loss - return adv_losses - - -def get_visqol(cfg: omegaconf.DictConfig) -> metrics.ViSQOL: - """Instantiate ViSQOL metric from config.""" - kwargs = dict_from_config(cfg) - return metrics.ViSQOL(**kwargs) - - -def get_fad(cfg: omegaconf.DictConfig) -> metrics.FrechetAudioDistanceMetric: - """Instantiate Frechet Audio Distance metric from config.""" - kwargs = dict_from_config(cfg.tf) - xp = dora.get_xp() - kwargs['log_folder'] = xp.folder - return metrics.FrechetAudioDistanceMetric(**kwargs) - - -def get_kldiv(cfg: omegaconf.DictConfig) -> metrics.KLDivergenceMetric: - """Instantiate KL-Divergence metric from config.""" - kld_metrics = { - 'passt': metrics.PasstKLDivergenceMetric, - } - klass = kld_metrics[cfg.model] - kwargs = dict_from_config(cfg.get(cfg.model)) - return klass(**kwargs) - - -def get_text_consistency(cfg: omegaconf.DictConfig) -> metrics.TextConsistencyMetric: - """Instantiate Text Consistency metric from config.""" - text_consistency_metrics = { - 'clap': metrics.CLAPTextConsistencyMetric - } - klass = text_consistency_metrics[cfg.model] - kwargs = dict_from_config(cfg.get(cfg.model)) - return klass(**kwargs) - - -def get_chroma_cosine_similarity(cfg: omegaconf.DictConfig) -> metrics.ChromaCosineSimilarityMetric: - """Instantiate Chroma Cosine Similarity metric from config.""" - assert cfg.model == 'chroma_base', "Only support 'chroma_base' method for chroma cosine similarity metric" - kwargs = dict_from_config(cfg.get(cfg.model)) - return metrics.ChromaCosineSimilarityMetric(**kwargs) - - -def get_audio_datasets(cfg: omegaconf.DictConfig, - dataset_type: DatasetType = DatasetType.AUDIO) -> tp.Dict[str, torch.utils.data.DataLoader]: - """Build AudioDataset from configuration. - - Args: - cfg (omegaconf.DictConfig): Configuration. - dataset_type: The type of dataset to create. - Returns: - dict[str, torch.utils.data.DataLoader]: Map of dataloader for each data split. - """ - dataloaders: dict = {} - - sample_rate = cfg.sample_rate - channels = cfg.channels - seed = cfg.seed - max_sample_rate = cfg.datasource.max_sample_rate - max_channels = cfg.datasource.max_channels - - assert cfg.dataset is not None, "Could not find dataset definition in config" - - dataset_cfg = dict_from_config(cfg.dataset) - splits_cfg: dict = {} - splits_cfg['train'] = dataset_cfg.pop('train') - splits_cfg['valid'] = dataset_cfg.pop('valid') - splits_cfg['evaluate'] = dataset_cfg.pop('evaluate') - splits_cfg['generate'] = dataset_cfg.pop('generate') - execute_only_stage = cfg.get('execute_only', None) - - for split, path in cfg.datasource.items(): - if not isinstance(path, str): - continue # skipping this as not a path - if execute_only_stage is not None and split != execute_only_stage: - continue - logger.info(f"Loading audio data split {split}: {str(path)}") - assert ( - cfg.sample_rate <= max_sample_rate - ), f"Expecting a max sample rate of {max_sample_rate} for datasource but {sample_rate} found." - assert ( - cfg.channels <= max_channels - ), f"Expecting a max number of channels of {max_channels} for datasource but {channels} found." - - split_cfg = splits_cfg[split] - split_kwargs = {k: v for k, v in split_cfg.items()} - kwargs = {**dataset_cfg, **split_kwargs} # split kwargs overrides default dataset_cfg - kwargs['sample_rate'] = sample_rate - kwargs['channels'] = channels - - if kwargs.get('permutation_on_files') and cfg.optim.updates_per_epoch: - kwargs['num_samples'] = ( - flashy.distrib.world_size() * cfg.dataset.batch_size * cfg.optim.updates_per_epoch) - - num_samples = kwargs['num_samples'] - shuffle = kwargs['shuffle'] - - return_info = kwargs.pop('return_info') - batch_size = kwargs.pop('batch_size', None) - num_workers = kwargs.pop('num_workers') - - if dataset_type == DatasetType.MUSIC: - dataset = data.music_dataset.MusicDataset.from_meta(path, **kwargs) - elif dataset_type == DatasetType.SOUND: - dataset = data.sound_dataset.SoundDataset.from_meta(path, **kwargs) - elif dataset_type == DatasetType.AUDIO: - dataset = data.info_audio_dataset.InfoAudioDataset.from_meta(path, return_info=return_info, **kwargs) - else: - raise ValueError(f"Dataset type is unsupported: {dataset_type}") - - loader = get_loader( - dataset, - num_samples, - batch_size=batch_size, - num_workers=num_workers, - seed=seed, - collate_fn=dataset.collater if return_info else None, - shuffle=shuffle, - ) - dataloaders[split] = loader - - return dataloaders diff --git a/spaces/Purple11/Grounded-Diffusion/src/taming-transformers/taming/data/coco.py b/spaces/Purple11/Grounded-Diffusion/src/taming-transformers/taming/data/coco.py deleted file mode 100644 index 2b2f7838448cb63dcf96daffe9470d58566d975a..0000000000000000000000000000000000000000 --- a/spaces/Purple11/Grounded-Diffusion/src/taming-transformers/taming/data/coco.py +++ /dev/null @@ -1,176 +0,0 @@ -import os -import json -import albumentations -import numpy as np -from PIL import Image -from tqdm import tqdm -from torch.utils.data import Dataset - -from taming.data.sflckr import SegmentationBase # for examples included in repo - - -class Examples(SegmentationBase): - def __init__(self, size=256, random_crop=False, interpolation="bicubic"): - super().__init__(data_csv="data/coco_examples.txt", - data_root="data/coco_images", - segmentation_root="data/coco_segmentations", - size=size, random_crop=random_crop, - interpolation=interpolation, - n_labels=183, shift_segmentation=True) - - -class CocoBase(Dataset): - """needed for (image, caption, segmentation) pairs""" - def __init__(self, size=None, dataroot="", datajson="", onehot_segmentation=False, use_stuffthing=False, - crop_size=None, force_no_crop=False, given_files=None): - self.split = self.get_split() - self.size = size - if crop_size is None: - self.crop_size = size - else: - self.crop_size = crop_size - - self.onehot = onehot_segmentation # return segmentation as rgb or one hot - self.stuffthing = use_stuffthing # include thing in segmentation - if self.onehot and not self.stuffthing: - raise NotImplemented("One hot mode is only supported for the " - "stuffthings version because labels are stored " - "a bit different.") - - data_json = datajson - with open(data_json) as json_file: - self.json_data = json.load(json_file) - self.img_id_to_captions = dict() - self.img_id_to_filepath = dict() - self.img_id_to_segmentation_filepath = dict() - - assert data_json.split("/")[-1] in ["captions_train2017.json", - "captions_val2017.json"] - if self.stuffthing: - self.segmentation_prefix = ( - "data/cocostuffthings/val2017" if - data_json.endswith("captions_val2017.json") else - "data/cocostuffthings/train2017") - else: - self.segmentation_prefix = ( - "data/coco/annotations/stuff_val2017_pixelmaps" if - data_json.endswith("captions_val2017.json") else - "data/coco/annotations/stuff_train2017_pixelmaps") - - imagedirs = self.json_data["images"] - self.labels = {"image_ids": list()} - for imgdir in tqdm(imagedirs, desc="ImgToPath"): - self.img_id_to_filepath[imgdir["id"]] = os.path.join(dataroot, imgdir["file_name"]) - self.img_id_to_captions[imgdir["id"]] = list() - pngfilename = imgdir["file_name"].replace("jpg", "png") - self.img_id_to_segmentation_filepath[imgdir["id"]] = os.path.join( - self.segmentation_prefix, pngfilename) - if given_files is not None: - if pngfilename in given_files: - self.labels["image_ids"].append(imgdir["id"]) - else: - self.labels["image_ids"].append(imgdir["id"]) - - capdirs = self.json_data["annotations"] - for capdir in tqdm(capdirs, desc="ImgToCaptions"): - # there are in average 5 captions per image - self.img_id_to_captions[capdir["image_id"]].append(np.array([capdir["caption"]])) - - self.rescaler = albumentations.SmallestMaxSize(max_size=self.size) - if self.split=="validation": - self.cropper = albumentations.CenterCrop(height=self.crop_size, width=self.crop_size) - else: - self.cropper = albumentations.RandomCrop(height=self.crop_size, width=self.crop_size) - self.preprocessor = albumentations.Compose( - [self.rescaler, self.cropper], - additional_targets={"segmentation": "image"}) - if force_no_crop: - self.rescaler = albumentations.Resize(height=self.size, width=self.size) - self.preprocessor = albumentations.Compose( - [self.rescaler], - additional_targets={"segmentation": "image"}) - - def __len__(self): - return len(self.labels["image_ids"]) - - def preprocess_image(self, image_path, segmentation_path): - image = Image.open(image_path) - if not image.mode == "RGB": - image = image.convert("RGB") - image = np.array(image).astype(np.uint8) - - segmentation = Image.open(segmentation_path) - if not self.onehot and not segmentation.mode == "RGB": - segmentation = segmentation.convert("RGB") - segmentation = np.array(segmentation).astype(np.uint8) - if self.onehot: - assert self.stuffthing - # stored in caffe format: unlabeled==255. stuff and thing from - # 0-181. to be compatible with the labels in - # https://github.com/nightrome/cocostuff/blob/master/labels.txt - # we shift stuffthing one to the right and put unlabeled in zero - # as long as segmentation is uint8 shifting to right handles the - # latter too - assert segmentation.dtype == np.uint8 - segmentation = segmentation + 1 - - processed = self.preprocessor(image=image, segmentation=segmentation) - image, segmentation = processed["image"], processed["segmentation"] - image = (image / 127.5 - 1.0).astype(np.float32) - - if self.onehot: - assert segmentation.dtype == np.uint8 - # make it one hot - n_labels = 183 - flatseg = np.ravel(segmentation) - onehot = np.zeros((flatseg.size, n_labels), dtype=np.bool) - onehot[np.arange(flatseg.size), flatseg] = True - onehot = onehot.reshape(segmentation.shape + (n_labels,)).astype(int) - segmentation = onehot - else: - segmentation = (segmentation / 127.5 - 1.0).astype(np.float32) - return image, segmentation - - def __getitem__(self, i): - img_path = self.img_id_to_filepath[self.labels["image_ids"][i]] - seg_path = self.img_id_to_segmentation_filepath[self.labels["image_ids"][i]] - image, segmentation = self.preprocess_image(img_path, seg_path) - captions = self.img_id_to_captions[self.labels["image_ids"][i]] - # randomly draw one of all available captions per image - caption = captions[np.random.randint(0, len(captions))] - example = {"image": image, - "caption": [str(caption[0])], - "segmentation": segmentation, - "img_path": img_path, - "seg_path": seg_path, - "filename_": img_path.split(os.sep)[-1] - } - return example - - -class CocoImagesAndCaptionsTrain(CocoBase): - """returns a pair of (image, caption)""" - def __init__(self, size, onehot_segmentation=False, use_stuffthing=False, crop_size=None, force_no_crop=False): - super().__init__(size=size, - dataroot="data/coco/train2017", - datajson="data/coco/annotations/captions_train2017.json", - onehot_segmentation=onehot_segmentation, - use_stuffthing=use_stuffthing, crop_size=crop_size, force_no_crop=force_no_crop) - - def get_split(self): - return "train" - - -class CocoImagesAndCaptionsValidation(CocoBase): - """returns a pair of (image, caption)""" - def __init__(self, size, onehot_segmentation=False, use_stuffthing=False, crop_size=None, force_no_crop=False, - given_files=None): - super().__init__(size=size, - dataroot="data/coco/val2017", - datajson="data/coco/annotations/captions_val2017.json", - onehot_segmentation=onehot_segmentation, - use_stuffthing=use_stuffthing, crop_size=crop_size, force_no_crop=force_no_crop, - given_files=given_files) - - def get_split(self): - return "validation" diff --git a/spaces/RMXK/RVC_HFF/demucs/tasnet.py b/spaces/RMXK/RVC_HFF/demucs/tasnet.py deleted file mode 100644 index ecc1257925ea8f4fbe389ddd6d73ce9fdf45f6d4..0000000000000000000000000000000000000000 --- a/spaces/RMXK/RVC_HFF/demucs/tasnet.py +++ /dev/null @@ -1,452 +0,0 @@ -# Copyright (c) Facebook, Inc. and its affiliates. -# All rights reserved. -# -# This source code is licensed under the license found in the -# LICENSE file in the root directory of this source tree. -# -# Created on 2018/12 -# Author: Kaituo XU -# Modified on 2019/11 by Alexandre Defossez, added support for multiple output channels -# Here is the original license: -# The MIT License (MIT) -# -# Copyright (c) 2018 Kaituo XU -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. - -import math - -import torch -import torch.nn as nn -import torch.nn.functional as F - -from .utils import capture_init - -EPS = 1e-8 - - -def overlap_and_add(signal, frame_step): - outer_dimensions = signal.size()[:-2] - frames, frame_length = signal.size()[-2:] - - subframe_length = math.gcd(frame_length, frame_step) # gcd=Greatest Common Divisor - subframe_step = frame_step // subframe_length - subframes_per_frame = frame_length // subframe_length - output_size = frame_step * (frames - 1) + frame_length - output_subframes = output_size // subframe_length - - subframe_signal = signal.view(*outer_dimensions, -1, subframe_length) - - frame = torch.arange(0, output_subframes, - device=signal.device).unfold(0, subframes_per_frame, subframe_step) - frame = frame.long() # signal may in GPU or CPU - frame = frame.contiguous().view(-1) - - result = signal.new_zeros(*outer_dimensions, output_subframes, subframe_length) - result.index_add_(-2, frame, subframe_signal) - result = result.view(*outer_dimensions, -1) - return result - - -class ConvTasNet(nn.Module): - @capture_init - def __init__(self, - sources, - N=256, - L=20, - B=256, - H=512, - P=3, - X=8, - R=4, - audio_channels=2, - norm_type="gLN", - causal=False, - mask_nonlinear='relu', - samplerate=44100, - segment_length=44100 * 2 * 4): - """ - Args: - sources: list of sources - N: Number of filters in autoencoder - L: Length of the filters (in samples) - B: Number of channels in bottleneck 1 × 1-conv block - H: Number of channels in convolutional blocks - P: Kernel size in convolutional blocks - X: Number of convolutional blocks in each repeat - R: Number of repeats - norm_type: BN, gLN, cLN - causal: causal or non-causal - mask_nonlinear: use which non-linear function to generate mask - """ - super(ConvTasNet, self).__init__() - # Hyper-parameter - self.sources = sources - self.C = len(sources) - self.N, self.L, self.B, self.H, self.P, self.X, self.R = N, L, B, H, P, X, R - self.norm_type = norm_type - self.causal = causal - self.mask_nonlinear = mask_nonlinear - self.audio_channels = audio_channels - self.samplerate = samplerate - self.segment_length = segment_length - # Components - self.encoder = Encoder(L, N, audio_channels) - self.separator = TemporalConvNet( - N, B, H, P, X, R, self.C, norm_type, causal, mask_nonlinear) - self.decoder = Decoder(N, L, audio_channels) - # init - for p in self.parameters(): - if p.dim() > 1: - nn.init.xavier_normal_(p) - - def valid_length(self, length): - return length - - def forward(self, mixture): - """ - Args: - mixture: [M, T], M is batch size, T is #samples - Returns: - est_source: [M, C, T] - """ - mixture_w = self.encoder(mixture) - est_mask = self.separator(mixture_w) - est_source = self.decoder(mixture_w, est_mask) - - # T changed after conv1d in encoder, fix it here - T_origin = mixture.size(-1) - T_conv = est_source.size(-1) - est_source = F.pad(est_source, (0, T_origin - T_conv)) - return est_source - - -class Encoder(nn.Module): - """Estimation of the nonnegative mixture weight by a 1-D conv layer. - """ - def __init__(self, L, N, audio_channels): - super(Encoder, self).__init__() - # Hyper-parameter - self.L, self.N = L, N - # Components - # 50% overlap - self.conv1d_U = nn.Conv1d(audio_channels, N, kernel_size=L, stride=L // 2, bias=False) - - def forward(self, mixture): - """ - Args: - mixture: [M, T], M is batch size, T is #samples - Returns: - mixture_w: [M, N, K], where K = (T-L)/(L/2)+1 = 2T/L-1 - """ - mixture_w = F.relu(self.conv1d_U(mixture)) # [M, N, K] - return mixture_w - - -class Decoder(nn.Module): - def __init__(self, N, L, audio_channels): - super(Decoder, self).__init__() - # Hyper-parameter - self.N, self.L = N, L - self.audio_channels = audio_channels - # Components - self.basis_signals = nn.Linear(N, audio_channels * L, bias=False) - - def forward(self, mixture_w, est_mask): - """ - Args: - mixture_w: [M, N, K] - est_mask: [M, C, N, K] - Returns: - est_source: [M, C, T] - """ - # D = W * M - source_w = torch.unsqueeze(mixture_w, 1) * est_mask # [M, C, N, K] - source_w = torch.transpose(source_w, 2, 3) # [M, C, K, N] - # S = DV - est_source = self.basis_signals(source_w) # [M, C, K, ac * L] - m, c, k, _ = est_source.size() - est_source = est_source.view(m, c, k, self.audio_channels, -1).transpose(2, 3).contiguous() - est_source = overlap_and_add(est_source, self.L // 2) # M x C x ac x T - return est_source - - -class TemporalConvNet(nn.Module): - def __init__(self, N, B, H, P, X, R, C, norm_type="gLN", causal=False, mask_nonlinear='relu'): - """ - Args: - N: Number of filters in autoencoder - B: Number of channels in bottleneck 1 × 1-conv block - H: Number of channels in convolutional blocks - P: Kernel size in convolutional blocks - X: Number of convolutional blocks in each repeat - R: Number of repeats - C: Number of speakers - norm_type: BN, gLN, cLN - causal: causal or non-causal - mask_nonlinear: use which non-linear function to generate mask - """ - super(TemporalConvNet, self).__init__() - # Hyper-parameter - self.C = C - self.mask_nonlinear = mask_nonlinear - # Components - # [M, N, K] -> [M, N, K] - layer_norm = ChannelwiseLayerNorm(N) - # [M, N, K] -> [M, B, K] - bottleneck_conv1x1 = nn.Conv1d(N, B, 1, bias=False) - # [M, B, K] -> [M, B, K] - repeats = [] - for r in range(R): - blocks = [] - for x in range(X): - dilation = 2**x - padding = (P - 1) * dilation if causal else (P - 1) * dilation // 2 - blocks += [ - TemporalBlock(B, - H, - P, - stride=1, - padding=padding, - dilation=dilation, - norm_type=norm_type, - causal=causal) - ] - repeats += [nn.Sequential(*blocks)] - temporal_conv_net = nn.Sequential(*repeats) - # [M, B, K] -> [M, C*N, K] - mask_conv1x1 = nn.Conv1d(B, C * N, 1, bias=False) - # Put together - self.network = nn.Sequential(layer_norm, bottleneck_conv1x1, temporal_conv_net, - mask_conv1x1) - - def forward(self, mixture_w): - """ - Keep this API same with TasNet - Args: - mixture_w: [M, N, K], M is batch size - returns: - est_mask: [M, C, N, K] - """ - M, N, K = mixture_w.size() - score = self.network(mixture_w) # [M, N, K] -> [M, C*N, K] - score = score.view(M, self.C, N, K) # [M, C*N, K] -> [M, C, N, K] - if self.mask_nonlinear == 'softmax': - est_mask = F.softmax(score, dim=1) - elif self.mask_nonlinear == 'relu': - est_mask = F.relu(score) - else: - raise ValueError("Unsupported mask non-linear function") - return est_mask - - -class TemporalBlock(nn.Module): - def __init__(self, - in_channels, - out_channels, - kernel_size, - stride, - padding, - dilation, - norm_type="gLN", - causal=False): - super(TemporalBlock, self).__init__() - # [M, B, K] -> [M, H, K] - conv1x1 = nn.Conv1d(in_channels, out_channels, 1, bias=False) - prelu = nn.PReLU() - norm = chose_norm(norm_type, out_channels) - # [M, H, K] -> [M, B, K] - dsconv = DepthwiseSeparableConv(out_channels, in_channels, kernel_size, stride, padding, - dilation, norm_type, causal) - # Put together - self.net = nn.Sequential(conv1x1, prelu, norm, dsconv) - - def forward(self, x): - """ - Args: - x: [M, B, K] - Returns: - [M, B, K] - """ - residual = x - out = self.net(x) - # TODO: when P = 3 here works fine, but when P = 2 maybe need to pad? - return out + residual # look like w/o F.relu is better than w/ F.relu - # return F.relu(out + residual) - - -class DepthwiseSeparableConv(nn.Module): - def __init__(self, - in_channels, - out_channels, - kernel_size, - stride, - padding, - dilation, - norm_type="gLN", - causal=False): - super(DepthwiseSeparableConv, self).__init__() - # Use `groups` option to implement depthwise convolution - # [M, H, K] -> [M, H, K] - depthwise_conv = nn.Conv1d(in_channels, - in_channels, - kernel_size, - stride=stride, - padding=padding, - dilation=dilation, - groups=in_channels, - bias=False) - if causal: - chomp = Chomp1d(padding) - prelu = nn.PReLU() - norm = chose_norm(norm_type, in_channels) - # [M, H, K] -> [M, B, K] - pointwise_conv = nn.Conv1d(in_channels, out_channels, 1, bias=False) - # Put together - if causal: - self.net = nn.Sequential(depthwise_conv, chomp, prelu, norm, pointwise_conv) - else: - self.net = nn.Sequential(depthwise_conv, prelu, norm, pointwise_conv) - - def forward(self, x): - """ - Args: - x: [M, H, K] - Returns: - result: [M, B, K] - """ - return self.net(x) - - -class Chomp1d(nn.Module): - """To ensure the output length is the same as the input. - """ - def __init__(self, chomp_size): - super(Chomp1d, self).__init__() - self.chomp_size = chomp_size - - def forward(self, x): - """ - Args: - x: [M, H, Kpad] - Returns: - [M, H, K] - """ - return x[:, :, :-self.chomp_size].contiguous() - - -def chose_norm(norm_type, channel_size): - """The input of normlization will be (M, C, K), where M is batch size, - C is channel size and K is sequence length. - """ - if norm_type == "gLN": - return GlobalLayerNorm(channel_size) - elif norm_type == "cLN": - return ChannelwiseLayerNorm(channel_size) - elif norm_type == "id": - return nn.Identity() - else: # norm_type == "BN": - # Given input (M, C, K), nn.BatchNorm1d(C) will accumulate statics - # along M and K, so this BN usage is right. - return nn.BatchNorm1d(channel_size) - - -# TODO: Use nn.LayerNorm to impl cLN to speed up -class ChannelwiseLayerNorm(nn.Module): - """Channel-wise Layer Normalization (cLN)""" - def __init__(self, channel_size): - super(ChannelwiseLayerNorm, self).__init__() - self.gamma = nn.Parameter(torch.Tensor(1, channel_size, 1)) # [1, N, 1] - self.beta = nn.Parameter(torch.Tensor(1, channel_size, 1)) # [1, N, 1] - self.reset_parameters() - - def reset_parameters(self): - self.gamma.data.fill_(1) - self.beta.data.zero_() - - def forward(self, y): - """ - Args: - y: [M, N, K], M is batch size, N is channel size, K is length - Returns: - cLN_y: [M, N, K] - """ - mean = torch.mean(y, dim=1, keepdim=True) # [M, 1, K] - var = torch.var(y, dim=1, keepdim=True, unbiased=False) # [M, 1, K] - cLN_y = self.gamma * (y - mean) / torch.pow(var + EPS, 0.5) + self.beta - return cLN_y - - -class GlobalLayerNorm(nn.Module): - """Global Layer Normalization (gLN)""" - def __init__(self, channel_size): - super(GlobalLayerNorm, self).__init__() - self.gamma = nn.Parameter(torch.Tensor(1, channel_size, 1)) # [1, N, 1] - self.beta = nn.Parameter(torch.Tensor(1, channel_size, 1)) # [1, N, 1] - self.reset_parameters() - - def reset_parameters(self): - self.gamma.data.fill_(1) - self.beta.data.zero_() - - def forward(self, y): - """ - Args: - y: [M, N, K], M is batch size, N is channel size, K is length - Returns: - gLN_y: [M, N, K] - """ - # TODO: in torch 1.0, torch.mean() support dim list - mean = y.mean(dim=1, keepdim=True).mean(dim=2, keepdim=True) # [M, 1, 1] - var = (torch.pow(y - mean, 2)).mean(dim=1, keepdim=True).mean(dim=2, keepdim=True) - gLN_y = self.gamma * (y - mean) / torch.pow(var + EPS, 0.5) + self.beta - return gLN_y - - -if __name__ == "__main__": - torch.manual_seed(123) - M, N, L, T = 2, 3, 4, 12 - K = 2 * T // L - 1 - B, H, P, X, R, C, norm_type, causal = 2, 3, 3, 3, 2, 2, "gLN", False - mixture = torch.randint(3, (M, T)) - # test Encoder - encoder = Encoder(L, N) - encoder.conv1d_U.weight.data = torch.randint(2, encoder.conv1d_U.weight.size()) - mixture_w = encoder(mixture) - print('mixture', mixture) - print('U', encoder.conv1d_U.weight) - print('mixture_w', mixture_w) - print('mixture_w size', mixture_w.size()) - - # test TemporalConvNet - separator = TemporalConvNet(N, B, H, P, X, R, C, norm_type=norm_type, causal=causal) - est_mask = separator(mixture_w) - print('est_mask', est_mask) - - # test Decoder - decoder = Decoder(N, L) - est_mask = torch.randint(2, (B, K, C, N)) - est_source = decoder(mixture_w, est_mask) - print('est_source', est_source) - - # test Conv-TasNet - conv_tasnet = ConvTasNet(N, L, B, H, P, X, R, C, norm_type=norm_type) - est_source = conv_tasnet(mixture) - print('est_source', est_source) - print('est_source size', est_source.size()) diff --git a/spaces/Raspberry-ai/main/.env/lib/python3.11/site-packages/pip/_internal/build_env.py b/spaces/Raspberry-ai/main/.env/lib/python3.11/site-packages/pip/_internal/build_env.py deleted file mode 100644 index cc2b38bab796c1277eefafc5c3b9ad45d430bccd..0000000000000000000000000000000000000000 --- a/spaces/Raspberry-ai/main/.env/lib/python3.11/site-packages/pip/_internal/build_env.py +++ /dev/null @@ -1,310 +0,0 @@ -"""Build Environment used for isolation during sdist building -""" - -import logging -import os -import pathlib -import site -import sys -import textwrap -from collections import OrderedDict -from sysconfig import get_paths -from types import TracebackType -from typing import TYPE_CHECKING, Iterable, List, Optional, Set, Tuple, Type - -from pip._vendor.certifi import where -from pip._vendor.packaging.requirements import Requirement -from pip._vendor.packaging.version import Version - -from pip import __file__ as pip_location -from pip._internal.cli.spinners import open_spinner -from pip._internal.locations import get_platlib, get_prefixed_libs, get_purelib -from pip._internal.metadata import get_default_environment, get_environment -from pip._internal.utils.subprocess import call_subprocess -from pip._internal.utils.temp_dir import TempDirectory, tempdir_kinds - -if TYPE_CHECKING: - from pip._internal.index.package_finder import PackageFinder - -logger = logging.getLogger(__name__) - - -class _Prefix: - def __init__(self, path: str) -> None: - self.path = path - self.setup = False - self.bin_dir = get_paths( - "nt" if os.name == "nt" else "posix_prefix", - vars={"base": path, "platbase": path}, - )["scripts"] - self.lib_dirs = get_prefixed_libs(path) - - -def get_runnable_pip() -> str: - """Get a file to pass to a Python executable, to run the currently-running pip. - - This is used to run a pip subprocess, for installing requirements into the build - environment. - """ - source = pathlib.Path(pip_location).resolve().parent - - if not source.is_dir(): - # This would happen if someone is using pip from inside a zip file. In that - # case, we can use that directly. - return str(source) - - return os.fsdecode(source / "__pip-runner__.py") - - -def _get_system_sitepackages() -> Set[str]: - """Get system site packages - - Usually from site.getsitepackages, - but fallback on `get_purelib()/get_platlib()` if unavailable - (e.g. in a virtualenv created by virtualenv<20) - - Returns normalized set of strings. - """ - if hasattr(site, "getsitepackages"): - system_sites = site.getsitepackages() - else: - # virtualenv < 20 overwrites site.py without getsitepackages - # fallback on get_purelib/get_platlib. - # this is known to miss things, but shouldn't in the cases - # where getsitepackages() has been removed (inside a virtualenv) - system_sites = [get_purelib(), get_platlib()] - return {os.path.normcase(path) for path in system_sites} - - -class BuildEnvironment: - """Creates and manages an isolated environment to install build deps""" - - def __init__(self) -> None: - temp_dir = TempDirectory(kind=tempdir_kinds.BUILD_ENV, globally_managed=True) - - self._prefixes = OrderedDict( - (name, _Prefix(os.path.join(temp_dir.path, name))) - for name in ("normal", "overlay") - ) - - self._bin_dirs: List[str] = [] - self._lib_dirs: List[str] = [] - for prefix in reversed(list(self._prefixes.values())): - self._bin_dirs.append(prefix.bin_dir) - self._lib_dirs.extend(prefix.lib_dirs) - - # Customize site to: - # - ensure .pth files are honored - # - prevent access to system site packages - system_sites = _get_system_sitepackages() - - self._site_dir = os.path.join(temp_dir.path, "site") - if not os.path.exists(self._site_dir): - os.mkdir(self._site_dir) - with open( - os.path.join(self._site_dir, "sitecustomize.py"), "w", encoding="utf-8" - ) as fp: - fp.write( - textwrap.dedent( - """ - import os, site, sys - - # First, drop system-sites related paths. - original_sys_path = sys.path[:] - known_paths = set() - for path in {system_sites!r}: - site.addsitedir(path, known_paths=known_paths) - system_paths = set( - os.path.normcase(path) - for path in sys.path[len(original_sys_path):] - ) - original_sys_path = [ - path for path in original_sys_path - if os.path.normcase(path) not in system_paths - ] - sys.path = original_sys_path - - # Second, add lib directories. - # ensuring .pth file are processed. - for path in {lib_dirs!r}: - assert not path in sys.path - site.addsitedir(path) - """ - ).format(system_sites=system_sites, lib_dirs=self._lib_dirs) - ) - - def __enter__(self) -> None: - self._save_env = { - name: os.environ.get(name, None) - for name in ("PATH", "PYTHONNOUSERSITE", "PYTHONPATH") - } - - path = self._bin_dirs[:] - old_path = self._save_env["PATH"] - if old_path: - path.extend(old_path.split(os.pathsep)) - - pythonpath = [self._site_dir] - - os.environ.update( - { - "PATH": os.pathsep.join(path), - "PYTHONNOUSERSITE": "1", - "PYTHONPATH": os.pathsep.join(pythonpath), - } - ) - - def __exit__( - self, - exc_type: Optional[Type[BaseException]], - exc_val: Optional[BaseException], - exc_tb: Optional[TracebackType], - ) -> None: - for varname, old_value in self._save_env.items(): - if old_value is None: - os.environ.pop(varname, None) - else: - os.environ[varname] = old_value - - def check_requirements( - self, reqs: Iterable[str] - ) -> Tuple[Set[Tuple[str, str]], Set[str]]: - """Return 2 sets: - - conflicting requirements: set of (installed, wanted) reqs tuples - - missing requirements: set of reqs - """ - missing = set() - conflicting = set() - if reqs: - env = ( - get_environment(self._lib_dirs) - if hasattr(self, "_lib_dirs") - else get_default_environment() - ) - for req_str in reqs: - req = Requirement(req_str) - # We're explicitly evaluating with an empty extra value, since build - # environments are not provided any mechanism to select specific extras. - if req.marker is not None and not req.marker.evaluate({"extra": ""}): - continue - dist = env.get_distribution(req.name) - if not dist: - missing.add(req_str) - continue - if isinstance(dist.version, Version): - installed_req_str = f"{req.name}=={dist.version}" - else: - installed_req_str = f"{req.name}==={dist.version}" - if not req.specifier.contains(dist.version, prereleases=True): - conflicting.add((installed_req_str, req_str)) - # FIXME: Consider direct URL? - return conflicting, missing - - def install_requirements( - self, - finder: "PackageFinder", - requirements: Iterable[str], - prefix_as_string: str, - *, - kind: str, - ) -> None: - prefix = self._prefixes[prefix_as_string] - assert not prefix.setup - prefix.setup = True - if not requirements: - return - self._install_requirements( - get_runnable_pip(), - finder, - requirements, - prefix, - kind=kind, - ) - - @staticmethod - def _install_requirements( - pip_runnable: str, - finder: "PackageFinder", - requirements: Iterable[str], - prefix: _Prefix, - *, - kind: str, - ) -> None: - args: List[str] = [ - sys.executable, - pip_runnable, - "install", - "--ignore-installed", - "--no-user", - "--prefix", - prefix.path, - "--no-warn-script-location", - ] - if logger.getEffectiveLevel() <= logging.DEBUG: - args.append("-v") - for format_control in ("no_binary", "only_binary"): - formats = getattr(finder.format_control, format_control) - args.extend( - ( - "--" + format_control.replace("_", "-"), - ",".join(sorted(formats or {":none:"})), - ) - ) - - index_urls = finder.index_urls - if index_urls: - args.extend(["-i", index_urls[0]]) - for extra_index in index_urls[1:]: - args.extend(["--extra-index-url", extra_index]) - else: - args.append("--no-index") - for link in finder.find_links: - args.extend(["--find-links", link]) - - for host in finder.trusted_hosts: - args.extend(["--trusted-host", host]) - if finder.allow_all_prereleases: - args.append("--pre") - if finder.prefer_binary: - args.append("--prefer-binary") - args.append("--") - args.extend(requirements) - extra_environ = {"_PIP_STANDALONE_CERT": where()} - with open_spinner(f"Installing {kind}") as spinner: - call_subprocess( - args, - command_desc=f"pip subprocess to install {kind}", - spinner=spinner, - extra_environ=extra_environ, - ) - - -class NoOpBuildEnvironment(BuildEnvironment): - """A no-op drop-in replacement for BuildEnvironment""" - - def __init__(self) -> None: - pass - - def __enter__(self) -> None: - pass - - def __exit__( - self, - exc_type: Optional[Type[BaseException]], - exc_val: Optional[BaseException], - exc_tb: Optional[TracebackType], - ) -> None: - pass - - def cleanup(self) -> None: - pass - - def install_requirements( - self, - finder: "PackageFinder", - requirements: Iterable[str], - prefix_as_string: str, - *, - kind: str, - ) -> None: - raise NotImplementedError() diff --git a/spaces/Raspberry-ai/main/.env/lib/python3.11/site-packages/pip/_internal/operations/install/__init__.py b/spaces/Raspberry-ai/main/.env/lib/python3.11/site-packages/pip/_internal/operations/install/__init__.py deleted file mode 100644 index 24d6a5dd31fe33b03f90ed0f9ee465253686900c..0000000000000000000000000000000000000000 --- a/spaces/Raspberry-ai/main/.env/lib/python3.11/site-packages/pip/_internal/operations/install/__init__.py +++ /dev/null @@ -1,2 +0,0 @@ -"""For modules related to installing packages. -""" diff --git a/spaces/Realcat/image-matching-webui/third_party/SGMNet/train/config.py b/spaces/Realcat/image-matching-webui/third_party/SGMNet/train/config.py deleted file mode 100644 index 3610e40ff0628b1c5c4a2bc2a73d38a6d2cd65b1..0000000000000000000000000000000000000000 --- a/spaces/Realcat/image-matching-webui/third_party/SGMNet/train/config.py +++ /dev/null @@ -1,137 +0,0 @@ -import argparse - - -def str2bool(v): - return v.lower() in ("true", "1") - - -arg_lists = [] -parser = argparse.ArgumentParser() - - -def add_argument_group(name): - arg = parser.add_argument_group(name) - arg_lists.append(arg) - return arg - - -# ----------------------------------------------------------------------------- -# Network -net_arg = add_argument_group("Network") -net_arg.add_argument( - "--model_name", type=str, default="SGM", help="" "model for training" -) -net_arg.add_argument( - "--config_path", - type=str, - default="configs/sgm.yaml", - help="" "config path for model", -) - -# ----------------------------------------------------------------------------- -# Data -data_arg = add_argument_group("Data") -data_arg.add_argument( - "--rawdata_path", type=str, default="rawdata", help="" "path for rawdata" -) -data_arg.add_argument( - "--dataset_path", type=str, default="dataset", help="" "path for dataset" -) -data_arg.add_argument( - "--desc_path", type=str, default="desc", help="" "path for descriptor(kpt) dir" -) -data_arg.add_argument( - "--num_kpt", type=int, default=1000, help="" "number of kpt for training" -) -data_arg.add_argument( - "--input_normalize", - type=str, - default="img", - help="" "normalize type for input kpt, img or intrinsic", -) -data_arg.add_argument( - "--data_aug", - type=str2bool, - default=True, - help="" "apply kpt coordinate homography augmentation", -) -data_arg.add_argument( - "--desc_suffix", type=str, default="suffix", help="" "desc file suffix" -) - - -# ----------------------------------------------------------------------------- -# Loss -loss_arg = add_argument_group("loss") -loss_arg.add_argument("--momentum", type=float, default=0.9, help="" "momentum") -loss_arg.add_argument( - "--seed_loss_weight", - type=float, - default=250, - help="" "confidence loss weight for sgm", -) -loss_arg.add_argument( - "--mid_loss_weight", type=float, default=1, help="" "midseeding loss weight for sgm" -) -loss_arg.add_argument( - "--inlier_th", - type=float, - default=5e-3, - help="" "inlier threshold for epipolar distance (for sgm and visualization)", -) - - -# ----------------------------------------------------------------------------- -# Training -train_arg = add_argument_group("Train") -train_arg.add_argument("--train_lr", type=float, default=1e-4, help="" "learning rate") -train_arg.add_argument("--train_batch_size", type=int, default=16, help="" "batch size") -train_arg.add_argument( - "--gpu_id", type=str, default="0", help="id(s) for CUDA_VISIBLE_DEVICES" -) -train_arg.add_argument( - "--train_iter", type=int, default=1000000, help="" "training iterations to perform" -) -train_arg.add_argument("--log_base", type=str, default="./log/", help="" "log path") -train_arg.add_argument( - "--val_intv", type=int, default=20000, help="" "validation interval" -) -train_arg.add_argument( - "--save_intv", type=int, default=1000, help="" "summary interval" -) -train_arg.add_argument("--log_intv", type=int, default=100, help="" "log interval") -train_arg.add_argument( - "--decay_rate", type=float, default=0.999996, help="" "lr decay rate" -) -train_arg.add_argument( - "--decay_iter", type=float, default=300000, help="" "lr decay iter" -) -train_arg.add_argument( - "--local_rank", type=int, default=0, help="" "local rank for ddp" -) -train_arg.add_argument( - "--train_vis_folder", - type=str, - default=".", - help="" "visualization folder during training", -) - -# ----------------------------------------------------------------------------- -# Visualization -vis_arg = add_argument_group("Visualization") -vis_arg.add_argument( - "--tqdm_width", type=int, default=79, help="" "width of the tqdm bar" -) - - -def get_config(): - config, unparsed = parser.parse_known_args() - return config, unparsed - - -def print_usage(): - parser.print_usage() - - -# -# config.py ends here diff --git a/spaces/Reself/StableVideo/stablevideo/aggnet.py b/spaces/Reself/StableVideo/stablevideo/aggnet.py deleted file mode 100644 index 41ab5b1d335cc26f3557e3d4db61a2ee5329ea29..0000000000000000000000000000000000000000 --- a/spaces/Reself/StableVideo/stablevideo/aggnet.py +++ /dev/null @@ -1,17 +0,0 @@ -import torch.nn as nn - -class AGGNet(nn.Module): - def __init__(self) -> None: - super().__init__() - self.stage1=nn.Sequential( - nn.Conv2d(in_channels=3,out_channels=64,kernel_size=3,padding=1,bias=False), - nn.ReLU() - ) - self.stage2=nn.Sequential( - nn.ConvTranspose2d(in_channels=64,out_channels=3,kernel_size=3,padding=1,bias=False), - ) - - def forward(self, x): - x1 = self.stage1(x) - x2 = self.stage2(x1) - return x + x2 \ No newline at end of file diff --git a/spaces/Robert001/UniControl-Demo/annotator/uniformer/mmdet/core/evaluation/bbox_overlaps.py b/spaces/Robert001/UniControl-Demo/annotator/uniformer/mmdet/core/evaluation/bbox_overlaps.py deleted file mode 100644 index 93559ea0f25369d552a5365312fa32b9ffec9226..0000000000000000000000000000000000000000 --- a/spaces/Robert001/UniControl-Demo/annotator/uniformer/mmdet/core/evaluation/bbox_overlaps.py +++ /dev/null @@ -1,48 +0,0 @@ -import numpy as np - - -def bbox_overlaps(bboxes1, bboxes2, mode='iou', eps=1e-6): - """Calculate the ious between each bbox of bboxes1 and bboxes2. - - Args: - bboxes1(ndarray): shape (n, 4) - bboxes2(ndarray): shape (k, 4) - mode(str): iou (intersection over union) or iof (intersection - over foreground) - - Returns: - ious(ndarray): shape (n, k) - """ - - assert mode in ['iou', 'iof'] - - bboxes1 = bboxes1.astype(np.float32) - bboxes2 = bboxes2.astype(np.float32) - rows = bboxes1.shape[0] - cols = bboxes2.shape[0] - ious = np.zeros((rows, cols), dtype=np.float32) - if rows * cols == 0: - return ious - exchange = False - if bboxes1.shape[0] > bboxes2.shape[0]: - bboxes1, bboxes2 = bboxes2, bboxes1 - ious = np.zeros((cols, rows), dtype=np.float32) - exchange = True - area1 = (bboxes1[:, 2] - bboxes1[:, 0]) * (bboxes1[:, 3] - bboxes1[:, 1]) - area2 = (bboxes2[:, 2] - bboxes2[:, 0]) * (bboxes2[:, 3] - bboxes2[:, 1]) - for i in range(bboxes1.shape[0]): - x_start = np.maximum(bboxes1[i, 0], bboxes2[:, 0]) - y_start = np.maximum(bboxes1[i, 1], bboxes2[:, 1]) - x_end = np.minimum(bboxes1[i, 2], bboxes2[:, 2]) - y_end = np.minimum(bboxes1[i, 3], bboxes2[:, 3]) - overlap = np.maximum(x_end - x_start, 0) * np.maximum( - y_end - y_start, 0) - if mode == 'iou': - union = area1[i] + area2 - overlap - else: - union = area1[i] if not exchange else area2 - union = np.maximum(union, eps) - ious[i, :] = overlap / union - if exchange: - ious = ious.T - return ious diff --git a/spaces/Robo2000/DatasetAnalyzer-GR/app.py b/spaces/Robo2000/DatasetAnalyzer-GR/app.py deleted file mode 100644 index 4808b175c23bbd4ccf349cdedc5ac90e72bb7c7c..0000000000000000000000000000000000000000 --- a/spaces/Robo2000/DatasetAnalyzer-GR/app.py +++ /dev/null @@ -1,99 +0,0 @@ -from typing import List, Dict -import httpx -import gradio as gr -import pandas as pd - -async def get_splits(dataset_name: str) -> Dict[str, List[Dict]]: - URL = f"https://datasets-server.huggingface.co/splits?dataset={dataset_name}" - async with httpx.AsyncClient() as session: - response = await session.get(URL) - return response.json() - -async def get_valid_datasets() -> Dict[str, List[str]]: - URL = f"https://datasets-server.huggingface.co/valid" - async with httpx.AsyncClient() as session: - response = await session.get(URL) - datasets = response.json()["valid"] - return gr.Dropdown.update(choices=datasets, value="awacke1/ChatbotMemory.csv") - # The one to watch: https://huggingface.co/rungalileo - # rungalileo/medical_transcription_40 - -async def get_first_rows(dataset: str, config: str, split: str) -> Dict[str, Dict[str, List[Dict]]]: - URL = f"https://datasets-server.huggingface.co/first-rows?dataset={dataset}&config={config}&split={split}" - async with httpx.AsyncClient() as session: - response = await session.get(URL) - print(URL) - gr.Markdown(URL) - return response.json() - -def get_df_from_rows(api_output): - dfFromSort = pd.DataFrame([row["row"] for row in api_output["rows"]]) - try: - dfFromSort.sort_values(by=1, axis=1, ascending=True, inplace=False, kind='mergesort', na_position='last', ignore_index=False, key=None) - except: - print("Exception sorting due to keyerror?") - return dfFromSort - -async def update_configs(dataset_name: str): - splits = await get_splits(dataset_name) - all_configs = sorted(set([s["config"] for s in splits["splits"]])) - return (gr.Dropdown.update(choices=all_configs, value=all_configs[0]), - splits) - -async def update_splits(config_name: str, state: gr.State): - splits_for_config = sorted(set([s["split"] for s in state["splits"] if s["config"] == config_name])) - dataset_name = state["splits"][0]["dataset"] - dataset = await update_dataset(splits_for_config[0], config_name, dataset_name) - return (gr.Dropdown.update(choices=splits_for_config, value=splits_for_config[0]), dataset) - -async def update_dataset(split_name: str, config_name: str, dataset_name: str): - rows = await get_first_rows(dataset_name, config_name, split_name) - df = get_df_from_rows(rows) - return df - -# Guido von Roissum: https://www.youtube.com/watch?v=-DVyjdw4t9I -async def update_URL(dataset: str, config: str, split: str) -> str: - URL = f"https://datasets-server.huggingface.co/first-rows?dataset={dataset}&config={config}&split={split}" - URL = f"https://huggingface.co/datasets/{split}" - return (URL) - -async def openurl(URL: str) -> str: - html = f"{URL}" - return (html) - -with gr.Blocks() as demo: - gr.Markdown("

      🥫Datasets🎨

      ") - gr.Markdown("""
      Curated Datasets: Kaggle. NLM UMLS. LOINC. ICD10 Diagnosis. ICD11. Papers,Code,Datasets for SOTA in Medicine. Mental. Behavior. CMS Downloads. CMS CPT and HCPCS Procedures and Services """) - - splits_data = gr.State() - - with gr.Row(): - dataset_name = gr.Dropdown(label="Dataset", interactive=True) - config = gr.Dropdown(label="Subset", interactive=True) - split = gr.Dropdown(label="Split", interactive=True) - - with gr.Row(): - #filterleft = gr.Textbox(label="First Column Filter",placeholder="Filter Column 1") - URLcenter = gr.Textbox(label="Dataset URL", placeholder="URL") - btn = gr.Button("Use Dataset") - #URLoutput = gr.Textbox(label="Output",placeholder="URL Output") - URLoutput = gr.HTML(label="Output",placeholder="URL Output") - - with gr.Row(): - dataset = gr.DataFrame(wrap=True, interactive=True) - - demo.load(get_valid_datasets, inputs=None, outputs=[dataset_name]) - - dataset_name.change(update_configs, inputs=[dataset_name], outputs=[config, splits_data]) - config.change(update_splits, inputs=[config, splits_data], outputs=[split, dataset]) - split.change(update_dataset, inputs=[split, config, dataset_name], outputs=[dataset]) - - dataset_name.change(update_URL, inputs=[split, config, dataset_name], outputs=[URLcenter]) - - btn.click(openurl, [URLcenter], URLoutput) - -demo.launch(debug=True) - -# original: https://huggingface.co/spaces/freddyaboulton/dataset-viewer -- Freddy thanks! Your examples are the best. -# playlist on Gradio and Mermaid: https://www.youtube.com/watch?v=o7kCD4aWMR4&list=PLHgX2IExbFosW7hWNryq8hs2bt2aj91R- -# Link to Mermaid model and code: [![](https://mermaid.ink/img/pako:eNp1U8mO2zAM_RXCZ-eQpZccCmSZTIpOMQESIAdnDrRMx0JkydXSNDOYfy_lpUgD1AfBfnx8fCTlj0SYgpJ5UipzFRVaD4flSQM_YjwafcVJ9-FCfrbYVGA0ZQeLUkt9futiOM72pEh4QFijR9iTf2tzsx3Z0ti6hxslvb_Lm0TSNPvBDhQsg1TFXXAag7NBef_9hdDqFA6knbEbdgvGwu7mjRXVkDOLOV-yNXmytdQEsoROvTfi4EhK9XTSxUNz_mo4uVHm1lPyce-uR1k_n2RHymHRNPAvNXaTT7NVZYwjeDECVbS4UiYUAyc2lc-yFoPXxkujHaAl2G54PCjIpfBssZAGtsZ5KlLYkjWXkMLiuOfjPVhiymr3_x4qS7wicneTFuMW6Gdxlb6Cb7oJvt1LbEpMso08sza8MnqskA9jL27Ij72Jafb0G-tGkQNTdgKOy_XcFP5GDxFbWsJLV3FQid2LWfZsfpHVqAXBCBYa1e2dAHUBu5Ar6dgby0ghPWxQWk2Oh_L0M0h_S2Ep0YHUrXFHXD_msefo5XEkfFWBK8atdkA7mgfoalpATJI0qfnWoCz4b_iI0VPiK6rplMz5taASg_Kn5KQ_mYrBm_1Ni2TubaA0CU2BntYSeQl1Mi9ROfr8A8FBGds?type=png)](https://mermaid.live/edit#pako:eNp1U8mO2zAM_RXCZ-eQpZccCmSZTIpOMQESIAdnDrRMx0JkydXSNDOYfy_lpUgD1AfBfnx8fCTlj0SYgpJ5UipzFRVaD4flSQM_YjwafcVJ9-FCfrbYVGA0ZQeLUkt9futiOM72pEh4QFijR9iTf2tzsx3Z0ti6hxslvb_Lm0TSNPvBDhQsg1TFXXAag7NBef_9hdDqFA6knbEbdgvGwu7mjRXVkDOLOV-yNXmytdQEsoROvTfi4EhK9XTSxUNz_mo4uVHm1lPyce-uR1k_n2RHymHRNPAvNXaTT7NVZYwjeDECVbS4UiYUAyc2lc-yFoPXxkujHaAl2G54PCjIpfBssZAGtsZ5KlLYkjWXkMLiuOfjPVhiymr3_x4qS7wicneTFuMW6Gdxlb6Cb7oJvt1LbEpMso08sza8MnqskA9jL27Ij72Jafb0G-tGkQNTdgKOy_XcFP5GDxFbWsJLV3FQid2LWfZsfpHVqAXBCBYa1e2dAHUBu5Ar6dgby0ghPWxQWk2Oh_L0M0h_S2Ep0YHUrXFHXD_msefo5XEkfFWBK8atdkA7mgfoalpATJI0qfnWoCz4b_iI0VPiK6rplMz5taASg_Kn5KQ_mYrBm_1Ni2TubaA0CU2BntYSeQl1Mi9ROfr8A8FBGds) diff --git a/spaces/Rongjiehuang/ProDiff/utils/os_utils.py b/spaces/Rongjiehuang/ProDiff/utils/os_utils.py deleted file mode 100644 index c78a44c04eadc3feb3c35f88c8a074f59ab23778..0000000000000000000000000000000000000000 --- a/spaces/Rongjiehuang/ProDiff/utils/os_utils.py +++ /dev/null @@ -1,20 +0,0 @@ -import os -import subprocess - - -def link_file(from_file, to_file): - subprocess.check_call( - f'ln -s "`realpath --relative-to="{os.path.dirname(to_file)}" "{from_file}"`" "{to_file}"', shell=True) - - -def move_file(from_file, to_file): - subprocess.check_call(f'mv "{from_file}" "{to_file}"', shell=True) - - -def copy_file(from_file, to_file): - subprocess.check_call(f'cp -r "{from_file}" "{to_file}"', shell=True) - - -def remove_file(*fns): - for f in fns: - subprocess.check_call(f'rm -rf "{f}"', shell=True) \ No newline at end of file diff --git a/spaces/SERER/VITS-Umamusume-voice-synthesizer/ONNXVITS_inference.py b/spaces/SERER/VITS-Umamusume-voice-synthesizer/ONNXVITS_inference.py deleted file mode 100644 index 258b618cd338322365dfa25bec468a0a3f70ccd1..0000000000000000000000000000000000000000 --- a/spaces/SERER/VITS-Umamusume-voice-synthesizer/ONNXVITS_inference.py +++ /dev/null @@ -1,36 +0,0 @@ -import logging -logging.getLogger('numba').setLevel(logging.WARNING) -import IPython.display as ipd -import torch -import commons -import utils -import ONNXVITS_infer -from text import text_to_sequence - -def get_text(text, hps): - text_norm = text_to_sequence(text, hps.symbols, hps.data.text_cleaners) - if hps.data.add_blank: - text_norm = commons.intersperse(text_norm, 0) - text_norm = torch.LongTensor(text_norm) - return text_norm - -hps = utils.get_hparams_from_file("../vits/pretrained_models/uma87.json") - -net_g = ONNXVITS_infer.SynthesizerTrn( - len(hps.symbols), - hps.data.filter_length // 2 + 1, - hps.train.segment_size // hps.data.hop_length, - n_speakers=hps.data.n_speakers, - **hps.model) -_ = net_g.eval() - -_ = utils.load_checkpoint("../vits/pretrained_models/uma_1153000.pth", net_g) - -text1 = get_text("おはようございます。", hps) -stn_tst = text1 -with torch.no_grad(): - x_tst = stn_tst.unsqueeze(0) - x_tst_lengths = torch.LongTensor([stn_tst.size(0)]) - sid = torch.LongTensor([0]) - audio = net_g.infer(x_tst, x_tst_lengths, sid=sid, noise_scale=.667, noise_scale_w=0.8, length_scale=1)[0][0,0].data.cpu().float().numpy() -print(audio) \ No newline at end of file diff --git a/spaces/SERER/VITS-Umamusume-voice-synthesizer/text/shanghainese.py b/spaces/SERER/VITS-Umamusume-voice-synthesizer/text/shanghainese.py deleted file mode 100644 index cb29c24a08d2e406e8399cf7bc9fe5cb43cb9c61..0000000000000000000000000000000000000000 --- a/spaces/SERER/VITS-Umamusume-voice-synthesizer/text/shanghainese.py +++ /dev/null @@ -1,64 +0,0 @@ -import re -import cn2an -import opencc - - -converter = opencc.OpenCC('zaonhe') - -# List of (Latin alphabet, ipa) pairs: -_latin_to_ipa = [(re.compile('%s' % x[0]), x[1]) for x in [ - ('A', 'ᴇ'), - ('B', 'bi'), - ('C', 'si'), - ('D', 'di'), - ('E', 'i'), - ('F', 'ᴇf'), - ('G', 'dʑi'), - ('H', 'ᴇtɕʰ'), - ('I', 'ᴀi'), - ('J', 'dʑᴇ'), - ('K', 'kʰᴇ'), - ('L', 'ᴇl'), - ('M', 'ᴇm'), - ('N', 'ᴇn'), - ('O', 'o'), - ('P', 'pʰi'), - ('Q', 'kʰiu'), - ('R', 'ᴀl'), - ('S', 'ᴇs'), - ('T', 'tʰi'), - ('U', 'ɦiu'), - ('V', 'vi'), - ('W', 'dᴀbɤliu'), - ('X', 'ᴇks'), - ('Y', 'uᴀi'), - ('Z', 'zᴇ') -]] - - -def _number_to_shanghainese(num): - num = cn2an.an2cn(num).replace('一十','十').replace('二十', '廿').replace('二', '两') - return re.sub(r'((?:^|[^三四五六七八九])十|廿)两', r'\1二', num) - - -def number_to_shanghainese(text): - return re.sub(r'\d+(?:\.?\d+)?', lambda x: _number_to_shanghainese(x.group()), text) - - -def latin_to_ipa(text): - for regex, replacement in _latin_to_ipa: - text = re.sub(regex, replacement, text) - return text - - -def shanghainese_to_ipa(text): - text = number_to_shanghainese(text.upper()) - text = converter.convert(text).replace('-','').replace('$',' ') - text = re.sub(r'[A-Z]', lambda x: latin_to_ipa(x.group())+' ', text) - text = re.sub(r'[、;:]', ',', text) - text = re.sub(r'\s*,\s*', ', ', text) - text = re.sub(r'\s*。\s*', '. ', text) - text = re.sub(r'\s*?\s*', '? ', text) - text = re.sub(r'\s*!\s*', '! ', text) - text = re.sub(r'\s*$', '', text) - return text diff --git a/spaces/Sachyyx/Sarah/Dockerfile b/spaces/Sachyyx/Sarah/Dockerfile deleted file mode 100644 index 6c01c09373883afcb4ea34ae2d316cd596e1737b..0000000000000000000000000000000000000000 --- a/spaces/Sachyyx/Sarah/Dockerfile +++ /dev/null @@ -1,21 +0,0 @@ -FROM node:18-bullseye-slim - -RUN apt-get update && \ - -apt-get install -y git - -RUN git clone https://gitgud.io/khanon/oai-reverse-proxy.git /app - -WORKDIR /app - -RUN npm install - -COPY Dockerfile greeting.md* .env* ./ - -RUN npm run build - -EXPOSE 7860 - -ENV NODE_ENV=production - -CMD [ "npm", "start" ] \ No newline at end of file diff --git a/spaces/Sapiensia/diffuse-the-rest/build/_app/immutable/start-b871e127.js b/spaces/Sapiensia/diffuse-the-rest/build/_app/immutable/start-b871e127.js deleted file mode 100644 index f4b44b98404763573d7e5ecd1a0fc2ea4c308d4d..0000000000000000000000000000000000000000 --- a/spaces/Sapiensia/diffuse-the-rest/build/_app/immutable/start-b871e127.js +++ /dev/null @@ -1 +0,0 @@ -var We=Object.defineProperty;var Je=(s,e,n)=>e in s?We(s,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):s[e]=n;var ue=(s,e,n)=>(Je(s,typeof e!="symbol"?e+"":e,n),n);import{S as He,i as Fe,s as Ge,a as Me,e as I,c as Ye,b as V,g as M,t as D,d as Y,f as T,h as z,j as Xe,o as _e,k as Ze,l as Qe,m as xe,n as de,p as J,q as et,r as tt,u as nt,v as B,w as ee,x as K,y as W,z as Ne}from"./chunks/index-032ac624.js";import{g as Ie,f as De,a as Te,s as G,b as ge,i as rt,c as at}from"./chunks/singletons-edb37fb5.js";class re{constructor(e,n){ue(this,"name","HttpError");ue(this,"stack");this.status=e,this.message=n!=null?n:`Error: ${e}`}toString(){return this.message}}class qe{constructor(e,n){this.status=e,this.location=n}}function st(s,e){return s==="/"||e==="ignore"?s:e==="never"?s.endsWith("/")?s.slice(0,-1):s:e==="always"&&!s.endsWith("/")?s+"/":s}function it(s){for(const e in s)s[e]=s[e].replace(/%23/g,"#").replace(/%3[Bb]/g,";").replace(/%2[Cc]/g,",").replace(/%2[Ff]/g,"/").replace(/%3[Ff]/g,"?").replace(/%3[Aa]/g,":").replace(/%40/g,"@").replace(/%26/g,"&").replace(/%3[Dd]/g,"=").replace(/%2[Bb]/g,"+").replace(/%24/g,"$");return s}class ot extends URL{get hash(){throw new Error("url.hash is inaccessible from load. Consider accessing hash from the page store within the script tag of your component.")}}function lt(s){let e=5381,n=s.length;if(typeof s=="string")for(;n;)e=e*33^s.charCodeAt(--n);else for(;n;)e=e*33^s[--n];return(e>>>0).toString(36)}const ae=window.fetch;function ct(s,e){let i=`script[sveltekit\\:data-type="data"][sveltekit\\:data-url=${JSON.stringify(typeof s=="string"?s:s.url)}]`;e&&typeof e.body=="string"&&(i+=`[sveltekit\\:data-body="${lt(e.body)}"]`);const r=document.querySelector(i);if(r&&r.textContent){const{body:u,...t}=JSON.parse(r.textContent);return Promise.resolve(new Response(u,t))}return ae(s,e)}const ft=/^(\.\.\.)?(\w+)(?:=(\w+))?$/;function ut(s){const e=[],n=[];let i=!0;return{pattern:s===""?/^\/$/:new RegExp(`^${s.split(/(?:@[a-zA-Z0-9_-]+)?(?:\/|$)/).map((u,t,l)=>{const d=decodeURIComponent(u),p=/^\[\.\.\.(\w+)(?:=(\w+))?\]$/.exec(d);if(p)return e.push(p[1]),n.push(p[2]),"(?:/(.*))?";const g=t===l.length-1;return d&&"/"+d.split(/\[(.+?)\]/).map((E,P)=>{if(P%2){const $=ft.exec(E);if(!$)throw new Error(`Invalid param: ${E}. Params and matcher names can only have underscores and alphanumeric characters.`);const[,O,Z,Q]=$;return e.push(Z),n.push(Q),O?"(.*?)":"([^/]+?)"}return g&&E.includes(".")&&(i=!1),E.normalize().replace(/%5[Bb]/g,"[").replace(/%5[Dd]/g,"]").replace(/#/g,"%23").replace(/\?/g,"%3F").replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}).join("")}).join("")}${i?"/?":""}$`),names:e,types:n}}function dt(s,e,n,i){const r={};for(let u=0;u{const{pattern:d,names:p,types:g}=ut(i),E={id:i,exec:P=>{const $=d.exec(P);if($)return dt($,p,g,n)},errors:r.map(P=>s[P]),layouts:u.map(P=>s[P]),leaf:s[t],uses_server_data:!!l};return E.errors.length=E.layouts.length=Math.max(E.errors.length,E.layouts.length),E})}function ht(s,e){return new re(s,e)}function mt(s){let e,n,i;var r=s[0][0];function u(t){return{props:{data:t[1],errors:t[4]}}}return r&&(e=new r(u(s))),{c(){e&&B(e.$$.fragment),n=I()},l(t){e&&ee(e.$$.fragment,t),n=I()},m(t,l){e&&K(e,t,l),V(t,n,l),i=!0},p(t,l){const d={};if(l&2&&(d.data=t[1]),l&16&&(d.errors=t[4]),r!==(r=t[0][0])){if(e){M();const p=e;D(p.$$.fragment,1,0,()=>{W(p,1)}),Y()}r?(e=new r(u(t)),B(e.$$.fragment),T(e.$$.fragment,1),K(e,n.parentNode,n)):e=null}else r&&e.$set(d)},i(t){i||(e&&T(e.$$.fragment,t),i=!0)},o(t){e&&D(e.$$.fragment,t),i=!1},d(t){t&&z(n),e&&W(e,t)}}}function _t(s){let e,n,i;var r=s[0][0];function u(t){return{props:{data:t[1],$$slots:{default:[yt]},$$scope:{ctx:t}}}}return r&&(e=new r(u(s))),{c(){e&&B(e.$$.fragment),n=I()},l(t){e&&ee(e.$$.fragment,t),n=I()},m(t,l){e&&K(e,t,l),V(t,n,l),i=!0},p(t,l){const d={};if(l&2&&(d.data=t[1]),l&1053&&(d.$$scope={dirty:l,ctx:t}),r!==(r=t[0][0])){if(e){M();const p=e;D(p.$$.fragment,1,0,()=>{W(p,1)}),Y()}r?(e=new r(u(t)),B(e.$$.fragment),T(e.$$.fragment,1),K(e,n.parentNode,n)):e=null}else r&&e.$set(d)},i(t){i||(e&&T(e.$$.fragment,t),i=!0)},o(t){e&&D(e.$$.fragment,t),i=!1},d(t){t&&z(n),e&&W(e,t)}}}function gt(s){let e,n,i;var r=s[0][1];function u(t){return{props:{data:t[2],errors:t[4]}}}return r&&(e=new r(u(s))),{c(){e&&B(e.$$.fragment),n=I()},l(t){e&&ee(e.$$.fragment,t),n=I()},m(t,l){e&&K(e,t,l),V(t,n,l),i=!0},p(t,l){const d={};if(l&4&&(d.data=t[2]),l&16&&(d.errors=t[4]),r!==(r=t[0][1])){if(e){M();const p=e;D(p.$$.fragment,1,0,()=>{W(p,1)}),Y()}r?(e=new r(u(t)),B(e.$$.fragment),T(e.$$.fragment,1),K(e,n.parentNode,n)):e=null}else r&&e.$set(d)},i(t){i||(e&&T(e.$$.fragment,t),i=!0)},o(t){e&&D(e.$$.fragment,t),i=!1},d(t){t&&z(n),e&&W(e,t)}}}function wt(s){let e,n,i;var r=s[0][1];function u(t){return{props:{data:t[2],$$slots:{default:[bt]},$$scope:{ctx:t}}}}return r&&(e=new r(u(s))),{c(){e&&B(e.$$.fragment),n=I()},l(t){e&&ee(e.$$.fragment,t),n=I()},m(t,l){e&&K(e,t,l),V(t,n,l),i=!0},p(t,l){const d={};if(l&4&&(d.data=t[2]),l&1033&&(d.$$scope={dirty:l,ctx:t}),r!==(r=t[0][1])){if(e){M();const p=e;D(p.$$.fragment,1,0,()=>{W(p,1)}),Y()}r?(e=new r(u(t)),B(e.$$.fragment),T(e.$$.fragment,1),K(e,n.parentNode,n)):e=null}else r&&e.$set(d)},i(t){i||(e&&T(e.$$.fragment,t),i=!0)},o(t){e&&D(e.$$.fragment,t),i=!1},d(t){t&&z(n),e&&W(e,t)}}}function bt(s){let e,n,i;var r=s[0][2];function u(t){return{props:{data:t[3]}}}return r&&(e=new r(u(s))),{c(){e&&B(e.$$.fragment),n=I()},l(t){e&&ee(e.$$.fragment,t),n=I()},m(t,l){e&&K(e,t,l),V(t,n,l),i=!0},p(t,l){const d={};if(l&8&&(d.data=t[3]),r!==(r=t[0][2])){if(e){M();const p=e;D(p.$$.fragment,1,0,()=>{W(p,1)}),Y()}r?(e=new r(u(t)),B(e.$$.fragment),T(e.$$.fragment,1),K(e,n.parentNode,n)):e=null}else r&&e.$set(d)},i(t){i||(e&&T(e.$$.fragment,t),i=!0)},o(t){e&&D(e.$$.fragment,t),i=!1},d(t){t&&z(n),e&&W(e,t)}}}function yt(s){let e,n,i,r;const u=[wt,gt],t=[];function l(d,p){return d[0][2]?0:1}return e=l(s),n=t[e]=u[e](s),{c(){n.c(),i=I()},l(d){n.l(d),i=I()},m(d,p){t[e].m(d,p),V(d,i,p),r=!0},p(d,p){let g=e;e=l(d),e===g?t[e].p(d,p):(M(),D(t[g],1,1,()=>{t[g]=null}),Y(),n=t[e],n?n.p(d,p):(n=t[e]=u[e](d),n.c()),T(n,1),n.m(i.parentNode,i))},i(d){r||(T(n),r=!0)},o(d){D(n),r=!1},d(d){t[e].d(d),d&&z(i)}}}function ze(s){let e,n=s[6]&&Ve(s);return{c(){e=Ze("div"),n&&n.c(),this.h()},l(i){e=Qe(i,"DIV",{id:!0,"aria-live":!0,"aria-atomic":!0,style:!0});var r=xe(e);n&&n.l(r),r.forEach(z),this.h()},h(){de(e,"id","svelte-announcer"),de(e,"aria-live","assertive"),de(e,"aria-atomic","true"),J(e,"position","absolute"),J(e,"left","0"),J(e,"top","0"),J(e,"clip","rect(0 0 0 0)"),J(e,"clip-path","inset(50%)"),J(e,"overflow","hidden"),J(e,"white-space","nowrap"),J(e,"width","1px"),J(e,"height","1px")},m(i,r){V(i,e,r),n&&n.m(e,null)},p(i,r){i[6]?n?n.p(i,r):(n=Ve(i),n.c(),n.m(e,null)):n&&(n.d(1),n=null)},d(i){i&&z(e),n&&n.d()}}}function Ve(s){let e;return{c(){e=et(s[7])},l(n){e=tt(n,s[7])},m(n,i){V(n,e,i)},p(n,i){i&128&&nt(e,n[7])},d(n){n&&z(e)}}}function vt(s){let e,n,i,r,u;const t=[_t,mt],l=[];function d(g,E){return g[0][1]?0:1}e=d(s),n=l[e]=t[e](s);let p=s[5]&&ze(s);return{c(){n.c(),i=Me(),p&&p.c(),r=I()},l(g){n.l(g),i=Ye(g),p&&p.l(g),r=I()},m(g,E){l[e].m(g,E),V(g,i,E),p&&p.m(g,E),V(g,r,E),u=!0},p(g,[E]){let P=e;e=d(g),e===P?l[e].p(g,E):(M(),D(l[P],1,1,()=>{l[P]=null}),Y(),n=l[e],n?n.p(g,E):(n=l[e]=t[e](g),n.c()),T(n,1),n.m(i.parentNode,i)),g[5]?p?p.p(g,E):(p=ze(g),p.c(),p.m(r.parentNode,r)):p&&(p.d(1),p=null)},i(g){u||(T(n),u=!0)},o(g){D(n),u=!1},d(g){l[e].d(g),g&&z(i),p&&p.d(g),g&&z(r)}}}function kt(s,e,n){let{stores:i}=e,{page:r}=e,{components:u}=e,{data_0:t=null}=e,{data_1:l=null}=e,{data_2:d=null}=e,{errors:p}=e;Xe(i.page.notify);let g=!1,E=!1,P=null;return _e(()=>{const $=i.page.subscribe(()=>{g&&(n(6,E=!0),n(7,P=document.title||"untitled page"))});return n(5,g=!0),$}),s.$$set=$=>{"stores"in $&&n(8,i=$.stores),"page"in $&&n(9,r=$.page),"components"in $&&n(0,u=$.components),"data_0"in $&&n(1,t=$.data_0),"data_1"in $&&n(2,l=$.data_1),"data_2"in $&&n(3,d=$.data_2),"errors"in $&&n(4,p=$.errors)},s.$$.update=()=>{s.$$.dirty&768&&i.page.set(r)},[u,t,l,d,p,g,E,P,i,r]}class $t extends He{constructor(e){super(),Fe(this,e,kt,vt,Ge,{stores:8,page:9,components:0,data_0:1,data_1:2,data_2:3,errors:4})}}const Et=function(){const e=document.createElement("link").relList;return e&&e.supports&&e.supports("modulepreload")?"modulepreload":"preload"}(),St=function(s,e){return new URL(s,e).href},Be={},pe=function(e,n,i){return!n||n.length===0?e():Promise.all(n.map(r=>{if(r=St(r,i),r in Be)return;Be[r]=!0;const u=r.endsWith(".css"),t=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${r}"]${t}`))return;const l=document.createElement("link");if(l.rel=u?"stylesheet":Et,u||(l.as="script",l.crossOrigin=""),l.href=r,document.head.appendChild(l),u)return new Promise((d,p)=>{l.addEventListener("load",d),l.addEventListener("error",()=>p(new Error(`Unable to preload CSS for ${r}`)))})})).then(()=>e())},Lt={},se=[()=>pe(()=>import("./chunks/0-be487481.js"),["chunks/0-be487481.js","components/pages/_layout.svelte-f7e87a93.js","assets/+layout-7c2f4ad7.css","chunks/index-032ac624.js"],import.meta.url),()=>pe(()=>import("./chunks/1-d2babf7f.js"),["chunks/1-d2babf7f.js","components/error.svelte-d1ecc611.js","chunks/index-032ac624.js","chunks/singletons-edb37fb5.js"],import.meta.url),()=>pe(()=>import("./chunks/2-314b4446.js"),["chunks/2-314b4446.js","components/pages/_page.svelte-013f0d26.js","assets/+page-376b236d.css","chunks/index-032ac624.js"],import.meta.url)],Rt={"":[[1],[0],2]},Ke="sveltekit:scroll",H="sveltekit:index",he=pt(se,Rt,Lt),we=se[0],be=se[1];we();be();let x={};try{x=JSON.parse(sessionStorage[Ke])}catch{}function me(s){x[s]=ge()}function Ut({target:s,base:e,trailing_slash:n}){var Ue;const i=[],r={id:null,promise:null},u={before_navigate:[],after_navigate:[]};let t={branch:[],error:null,session_id:0,url:null},l=!1,d=!0,p=!1,g=1,E=null,P,$=!0,O=(Ue=history.state)==null?void 0:Ue[H];O||(O=Date.now(),history.replaceState({...history.state,[H]:O},"",location.href));const Z=x[O];Z&&(history.scrollRestoration="manual",scrollTo(Z.x,Z.y));let Q=!1,ie,ye;async function ve(a,{noscroll:f=!1,replaceState:h=!1,keepfocus:o=!1,state:c={}},y){if(typeof a=="string"&&(a=new URL(a,Ie(document))),$)return ce({url:a,scroll:f?ge():null,keepfocus:o,redirect_chain:y,details:{state:c,replaceState:h},accepted:()=>{},blocked:()=>{}});await F(a)}async function ke(a){const f=Re(a);if(!f)throw new Error("Attempted to prefetch a URL that does not belong to this app");return r.promise=Le(f),r.id=f.id,r.promise}async function $e(a,f,h,o){var b,L,U;const c=Re(a),y=ye={};let m=c&&await Le(c);if(!m&&a.origin===location.origin&&a.pathname===location.pathname&&(m=await ne({status:404,error:new Error(`Not found: ${a.pathname}`),url:a,routeId:null})),!m)return await F(a),!1;if(a=(c==null?void 0:c.url)||a,ye!==y)return!1;if(i.length=0,m.type==="redirect")if(f.length>10||f.includes(a.pathname))m=await ne({status:500,error:new Error("Redirect loop"),url:a,routeId:null});else return $?ve(new URL(m.location,a).href,{},[...f,a.pathname]):await F(new URL(m.location,location.href)),!1;else((L=(b=m.props)==null?void 0:b.page)==null?void 0:L.status)>=400&&await G.updated.check()&&await F(a);if(p=!0,h&&h.details){const{details:k}=h,R=k.replaceState?0:1;k.state[H]=O+=R,history[k.replaceState?"replaceState":"pushState"](k.state,"",a)}if(l?(t=m.state,m.props.page&&(m.props.page.url=a),P.$set(m.props)):Ee(m),h){const{scroll:k,keepfocus:R}=h;if(!R){const S=document.body,A=S.getAttribute("tabindex");S.tabIndex=-1,S.focus({preventScroll:!0}),setTimeout(()=>{var w;(w=getSelection())==null||w.removeAllRanges()}),A!==null?S.setAttribute("tabindex",A):S.removeAttribute("tabindex")}if(await Ne(),d){const S=a.hash&&document.getElementById(a.hash.slice(1));k?scrollTo(k.x,k.y):S?S.scrollIntoView():scrollTo(0,0)}}else await Ne();r.promise=null,r.id=null,d=!0,m.props.page&&(ie=m.props.page);const v=m.state.branch[m.state.branch.length-1];$=((U=v==null?void 0:v.node.shared)==null?void 0:U.router)!==!1,o&&o(),p=!1}function Ee(a){t=a.state;const f=document.querySelector("style[data-sveltekit]");if(f&&f.remove(),ie=a.props.page,P=new $t({target:s,props:{...a.props,stores:G},hydrate:!0}),$){const h={from:null,to:new URL(location.href)};u.after_navigate.forEach(o=>o(h))}l=!0}async function te({url:a,params:f,branch:h,status:o,error:c,routeId:y,validation_errors:m}){const v=h.filter(Boolean),b={type:"loaded",state:{url:a,params:f,branch:h,error:c,session_id:g},props:{components:v.map(R=>R.node.component),errors:m}};let L={},U=!1;for(let R=0;RS===v[R]))&&(b.props[`data_${R}`]=L,U=!0);if(!t.url||a.href!==t.url.href||t.error!==c||U){b.props.page={error:c,params:f,routeId:y,status:o,url:a,data:L};const R=(S,A)=>{Object.defineProperty(b.props.page,S,{get:()=>{throw new Error(`$page.${S} has been replaced by $page.url.${A}`)}})};R("origin","origin"),R("path","pathname"),R("query","searchParams")}return b}async function oe({loader:a,parent:f,url:h,params:o,routeId:c,server_data_node:y}){var L,U,k,R,S;let m=null;const v={dependencies:new Set,params:new Set,parent:!1,url:!1},b=await a();if((L=b.shared)!=null&&L.load){let A=function(..._){for(const q of _){const{href:N}=new URL(q,h);v.dependencies.add(N)}};const w={};for(const _ in o)Object.defineProperty(w,_,{get(){return v.params.add(_),o[_]},enumerable:!0});const C=new ot(h),j={routeId:c,params:w,data:(U=y==null?void 0:y.data)!=null?U:null,get url(){return v.url=!0,C},async fetch(_,q){let N;typeof _=="string"?N=_:(N=_.url,q={body:_.method==="GET"||_.method==="HEAD"?void 0:await _.blob(),cache:_.cache,credentials:_.credentials,headers:_.headers,integrity:_.integrity,keepalive:_.keepalive,method:_.method,mode:_.mode,redirect:_.redirect,referrer:_.referrer,referrerPolicy:_.referrerPolicy,signal:_.signal,...q});const X=new URL(N,h).href;return A(X),l?ae(X,q):ct(N,q)},setHeaders:()=>{},depends:A,parent(){return v.parent=!0,f()}};Object.defineProperties(j,{props:{get(){throw new Error("@migration task: Replace `props` with `data` stuff https://github.com/sveltejs/kit/discussions/5774#discussioncomment-3292693")},enumerable:!1},session:{get(){throw new Error("session is no longer available. See https://github.com/sveltejs/kit/discussions/5883")},enumerable:!1},stuff:{get(){throw new Error("@migration task: Remove stuff https://github.com/sveltejs/kit/discussions/5774#discussioncomment-3292693")},enumerable:!1}}),m=(k=await b.shared.load.call(null,j))!=null?k:null}return{node:b,loader:a,server:y,shared:(R=b.shared)!=null&&R.load?{type:"data",data:m,uses:v}:null,data:(S=m!=null?m:y==null?void 0:y.data)!=null?S:null}}function Se(a,f,h){if(!h)return!1;if(h.parent&&f||a.url&&h.url)return!0;for(const o of a.params)if(h.params.has(o))return!0;for(const o of h.dependencies)if(i.some(c=>c(o)))return!0;return!1}function le(a){var f,h;return(a==null?void 0:a.type)==="data"?{type:"data",data:a.data,uses:{dependencies:new Set((f=a.uses.dependencies)!=null?f:[]),params:new Set((h=a.uses.params)!=null?h:[]),parent:!!a.uses.parent,url:!!a.uses.url}}:null}async function Le({id:a,url:f,params:h,route:o}){if(r.id===a&&r.promise)return r.promise;const{errors:c,layouts:y,leaf:m}=o,v=t.url&&{url:a!==t.url.pathname+t.url.search,params:Object.keys(h).filter(w=>t.params[w]!==h[w])};[...c,...y,m].forEach(w=>w==null?void 0:w().catch(()=>{}));const b=[...y,m];let L=null;const U=b.reduce((w,C,j)=>{var N;const _=t.branch[j],q=C&&((_==null?void 0:_.loader)!==C||Se(v,w.some(Boolean),(N=_.server)==null?void 0:N.uses));return w.push(q),w},[]);if(o.uses_server_data&&U.some(Boolean)){try{const w=await ae(`${f.pathname}${f.pathname.endsWith("/")?"":"/"}__data.json${f.search}`,{headers:{"x-sveltekit-invalidated":U.map(C=>C?"1":"").join(",")}});if(L=await w.json(),!w.ok)throw L}catch{F(f);return}if(L.type==="redirect")return L}const k=L==null?void 0:L.nodes;let R=!1;const S=b.map(async(w,C)=>{var X,je,Pe,Ae;if(!w)return;const j=t.branch[C],_=(X=k==null?void 0:k[C])!=null?X:null;if((!_||_.type==="skip")&&w===(j==null?void 0:j.loader)&&!Se(v,R,(je=j.shared)==null?void 0:je.uses))return j;if(R=!0,(_==null?void 0:_.type)==="error")throw _.httperror?ht(_.httperror.status,_.httperror.message):_.error;return oe({loader:w,url:f,params:h,routeId:o.id,parent:async()=>{var Ce;const Oe={};for(let fe=0;fe{});const A=[];for(let w=0;wPromise.resolve({}),server_data_node:le(m)}),b={node:await be(),loader:be,shared:null,server:null,data:null};return await te({url:h,params:c,branch:[v,b],status:a,error:f,routeId:o})}function Re(a){if(a.origin!==location.origin||!a.pathname.startsWith(e))return;const f=decodeURI(a.pathname.slice(e.length)||"/");for(const h of he){const o=h.exec(f);if(o){const c=new URL(a.origin+st(a.pathname,n)+a.search+a.hash);return{id:c.pathname+c.search,route:h,params:it(o),url:c}}}}async function ce({url:a,scroll:f,keepfocus:h,redirect_chain:o,details:c,accepted:y,blocked:m}){const v=t.url;let b=!1;const L={from:v,to:a,cancel:()=>b=!0};if(u.before_navigate.forEach(U=>U(L)),b){m();return}me(O),y(),l&&G.navigating.set({from:t.url,to:a}),await $e(a,o,{scroll:f,keepfocus:h,details:c},()=>{const U={from:v,to:a};u.after_navigate.forEach(k=>k(U)),G.navigating.set(null)})}function F(a){return location.href=a.href,new Promise(()=>{})}return{after_navigate:a=>{_e(()=>(u.after_navigate.push(a),()=>{const f=u.after_navigate.indexOf(a);u.after_navigate.splice(f,1)}))},before_navigate:a=>{_e(()=>(u.before_navigate.push(a),()=>{const f=u.before_navigate.indexOf(a);u.before_navigate.splice(f,1)}))},disable_scroll_handling:()=>{(p||!l)&&(d=!1)},goto:(a,f={})=>ve(a,f,[]),invalidate:a=>{var f,h;if(a===void 0){for(const o of t.branch)(f=o==null?void 0:o.server)==null||f.uses.dependencies.add(""),(h=o==null?void 0:o.shared)==null||h.uses.dependencies.add("");i.push(()=>!0)}else if(typeof a=="function")i.push(a);else{const{href:o}=new URL(a,location.href);i.push(c=>c===o)}return E||(E=Promise.resolve().then(async()=>{await $e(new URL(location.href),[]),E=null})),E},prefetch:async a=>{const f=new URL(a,Ie(document));await ke(f)},prefetch_routes:async a=>{const h=(a?he.filter(o=>a.some(c=>o.exec(c))):he).map(o=>Promise.all([...o.layouts,o.leaf].map(c=>c==null?void 0:c())));await Promise.all(h)},_start_router:()=>{history.scrollRestoration="manual",addEventListener("beforeunload",o=>{let c=!1;const y={from:t.url,to:null,cancel:()=>c=!0};u.before_navigate.forEach(m=>m(y)),c?(o.preventDefault(),o.returnValue=""):history.scrollRestoration="auto"}),addEventListener("visibilitychange",()=>{if(document.visibilityState==="hidden"){me(O);try{sessionStorage[Ke]=JSON.stringify(x)}catch{}}});const a=o=>{const c=De(o);c&&c.href&&c.hasAttribute("sveltekit:prefetch")&&ke(Te(c))};let f;const h=o=>{clearTimeout(f),f=setTimeout(()=>{var c;(c=o.target)==null||c.dispatchEvent(new CustomEvent("sveltekit:trigger_prefetch",{bubbles:!0}))},20)};addEventListener("touchstart",a),addEventListener("mousemove",h),addEventListener("sveltekit:trigger_prefetch",a),addEventListener("click",o=>{if(!$||o.button||o.which!==1||o.metaKey||o.ctrlKey||o.shiftKey||o.altKey||o.defaultPrevented)return;const c=De(o);if(!c||!c.href)return;const y=c instanceof SVGAElement,m=Te(c);if(!y&&!(m.protocol==="https:"||m.protocol==="http:"))return;const v=(c.getAttribute("rel")||"").split(/\s+/);if(c.hasAttribute("download")||v.includes("external")||c.hasAttribute("sveltekit:reload")||(y?c.target.baseVal:c.target))return;const[b,L]=m.href.split("#");if(L!==void 0&&b===location.href.split("#")[0]){Q=!0,me(O),G.page.set({...ie,url:m}),G.page.notify();return}ce({url:m,scroll:c.hasAttribute("sveltekit:noscroll")?ge():null,keepfocus:!1,redirect_chain:[],details:{state:{},replaceState:m.href===location.href},accepted:()=>o.preventDefault(),blocked:()=>o.preventDefault()})}),addEventListener("popstate",o=>{if(o.state&&$){if(o.state[H]===O)return;ce({url:new URL(location.href),scroll:x[o.state[H]],keepfocus:!1,redirect_chain:[],details:null,accepted:()=>{O=o.state[H]},blocked:()=>{const c=O-o.state[H];history.go(c)}})}}),addEventListener("hashchange",()=>{Q&&(Q=!1,history.replaceState({...history.state,[H]:++O},"",location.href))});for(const o of document.querySelectorAll("link"))o.rel==="icon"&&(o.href=o.href);addEventListener("pageshow",o=>{o.persisted&&G.navigating.set(null)})},_hydrate:async({status:a,error:f,node_ids:h,params:o,routeId:c})=>{const y=new URL(location.href);let m;try{const v=(k,R)=>{const S=document.querySelector(`script[sveltekit\\:data-type="${k}"]`);return S!=null&&S.textContent?JSON.parse(S.textContent):R},b=v("server_data",[]),L=v("validation_errors",void 0),U=h.map(async(k,R)=>oe({loader:se[k],url:y,params:o,routeId:c,parent:async()=>{const S={};for(let A=0;A dict: - d = {} - for config_file in version_config_list: - with open(f"configs/{config_file}", "r") as f: - d[config_file] = json.load(f) - return d - - @staticmethod - def arg_parse() -> tuple: - exe = sys.executable or "python" - parser = argparse.ArgumentParser() - parser.add_argument("--port", type=int, default=7865, help="Listen port") - parser.add_argument("--pycmd", type=str, default=exe, help="Python command") - parser.add_argument("--colab", action="store_true", help="Launch in colab") - parser.add_argument( - "--noparallel", action="store_true", help="Disable parallel processing" - ) - parser.add_argument( - "--noautoopen", - action="store_true", - help="Do not open in browser automatically", - ) - parser.add_argument( - "--paperspace", - action="store_true", - help="Note that this argument just shares a gradio link for the web UI. Thus can be used on other non-local CLI systems.", - ) - parser.add_argument( - "--is_cli", - action="store_true", - help="Use the CLI instead of setting up a gradio UI. This flag will launch an RVC text interface where you can execute functions from infer-web.py!", - ) - - parser.add_argument( - "-t", - "--theme", - help = "Theme for Gradio. Format - `JohnSmith9982/small_and_pretty` (no backticks)", - default = "JohnSmith9982/small_and_pretty", - type = str - ) - - parser.add_argument( - "--dml", - action="store_true", - help="Use DirectML backend instead of CUDA." - ) - - cmd_opts = parser.parse_args() - - cmd_opts.port = cmd_opts.port if 0 <= cmd_opts.port <= 65535 else 7865 - - return ( - cmd_opts.pycmd, - cmd_opts.port, - cmd_opts.colab, - cmd_opts.noparallel, - cmd_opts.noautoopen, - cmd_opts.paperspace, - cmd_opts.is_cli, - cmd_opts.theme, - cmd_opts.dml, - ) - - # has_mps is only available in nightly pytorch (for now) and MasOS 12.3+. - # check `getattr` and try it for compatibility - @staticmethod - def has_mps() -> bool: - if not torch.backends.mps.is_available(): - return False - try: - torch.zeros(1).to(torch.device("mps")) - return True - except Exception: - return False - - @staticmethod - def has_xpu() -> bool: - if hasattr(torch, "xpu") and torch.xpu.is_available(): - return True - else: - return False - - def use_fp32_config(self): - for config_file in version_config_list: - self.json_config[config_file]["train"]["fp16_run"] = False - - def device_config(self) -> tuple: - if torch.cuda.is_available(): - if self.has_xpu(): - self.device = self.instead = "xpu:0" - self.is_half = True - i_device = int(self.device.split(":")[-1]) - self.gpu_name = torch.cuda.get_device_name(i_device) - if ( - ("16" in self.gpu_name and "V100" not in self.gpu_name.upper()) - or "P40" in self.gpu_name.upper() - or "P10" in self.gpu_name.upper() - or "1060" in self.gpu_name - or "1070" in self.gpu_name - or "1080" in self.gpu_name - ): - logger.info("Found GPU %s, force to fp32", self.gpu_name) - self.is_half = False - self.use_fp32_config() - else: - logger.info("Found GPU %s", self.gpu_name) - self.gpu_mem = int( - torch.cuda.get_device_properties(i_device).total_memory - / 1024 - / 1024 - / 1024 - + 0.4 - ) - if self.gpu_mem <= 4: - with open("infer/modules/train/preprocess.py", "r") as f: - strr = f.read().replace("3.7", "3.0") - with open("infer/modules/train/preprocess.py", "w") as f: - f.write(strr) - elif self.has_mps(): - logger.info("No supported Nvidia GPU found") - self.device = self.instead = "mps" - self.is_half = False - self.use_fp32_config() - else: - logger.info("No supported Nvidia GPU found") - self.device = self.instead = "cpu" - self.is_half = False - self.use_fp32_config() - - if self.n_cpu == 0: - self.n_cpu = cpu_count() - - if self.is_half: - # 6G显存配置 - x_pad = 3 - x_query = 10 - x_center = 60 - x_max = 65 - else: - # 5G显存配置 - x_pad = 1 - x_query = 6 - x_center = 38 - x_max = 41 - - if self.gpu_mem is not None and self.gpu_mem <= 4: - x_pad = 1 - x_query = 5 - x_center = 30 - x_max = 32 - if self.dml: - logger.info("Use DirectML instead") - if ( - os.path.exists( - "runtime\Lib\site-packages\onnxruntime\capi\DirectML.dll" - ) - == False - ): - try: - os.rename( - "runtime\Lib\site-packages\onnxruntime", - "runtime\Lib\site-packages\onnxruntime-cuda", - ) - except: - pass - try: - os.rename( - "runtime\Lib\site-packages\onnxruntime-dml", - "runtime\Lib\site-packages\onnxruntime", - ) - except: - pass - # if self.device != "cpu": - import torch_directml - - self.device = torch_directml.device(torch_directml.default_device()) - self.is_half = False - else: - if self.instead: - logger.info(f"Use {self.instead} instead") - if ( - os.path.exists( - "runtime\Lib\site-packages\onnxruntime\capi\onnxruntime_providers_cuda.dll" - ) - == False - ): - try: - os.rename( - "runtime\Lib\site-packages\onnxruntime", - "runtime\Lib\site-packages\onnxruntime-dml", - ) - except: - pass - try: - os.rename( - "runtime\Lib\site-packages\onnxruntime-cuda", - "runtime\Lib\site-packages\onnxruntime", - ) - except: - pass - return x_pad, x_query, x_center, x_max diff --git a/spaces/SungBeom/chatwine-korean/.venv/Lib/site-packages/IPython/testing/__init__.py b/spaces/SungBeom/chatwine-korean/.venv/Lib/site-packages/IPython/testing/__init__.py deleted file mode 100644 index 8fcd65ea41a9406de5b11064524849b5bb4579f3..0000000000000000000000000000000000000000 --- a/spaces/SungBeom/chatwine-korean/.venv/Lib/site-packages/IPython/testing/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -"""Testing support (tools to test IPython itself). -""" - -#----------------------------------------------------------------------------- -# Copyright (C) 2009-2011 The IPython Development Team -# -# Distributed under the terms of the BSD License. The full license is in -# the file COPYING, distributed as part of this software. -#----------------------------------------------------------------------------- - - -import os - -#----------------------------------------------------------------------------- -# Constants -#----------------------------------------------------------------------------- - -# We scale all timeouts via this factor, slow machines can increase it -IPYTHON_TESTING_TIMEOUT_SCALE = float(os.getenv( - 'IPYTHON_TESTING_TIMEOUT_SCALE', 1)) diff --git a/spaces/Superlang/ImageProcessor/annotator/oneformer/detectron2/data/build.py b/spaces/Superlang/ImageProcessor/annotator/oneformer/detectron2/data/build.py deleted file mode 100644 index d03137a9aabfc4a056dd671d4c3d0ba6f349fe03..0000000000000000000000000000000000000000 --- a/spaces/Superlang/ImageProcessor/annotator/oneformer/detectron2/data/build.py +++ /dev/null @@ -1,556 +0,0 @@ -# Copyright (c) Facebook, Inc. and its affiliates. -import itertools -import logging -import numpy as np -import operator -import pickle -from typing import Any, Callable, Dict, List, Optional, Union -import torch -import torch.utils.data as torchdata -from tabulate import tabulate -from termcolor import colored - -from annotator.oneformer.detectron2.config import configurable -from annotator.oneformer.detectron2.structures import BoxMode -from annotator.oneformer.detectron2.utils.comm import get_world_size -from annotator.oneformer.detectron2.utils.env import seed_all_rng -from annotator.oneformer.detectron2.utils.file_io import PathManager -from annotator.oneformer.detectron2.utils.logger import _log_api_usage, log_first_n - -from .catalog import DatasetCatalog, MetadataCatalog -from .common import AspectRatioGroupedDataset, DatasetFromList, MapDataset, ToIterableDataset -from .dataset_mapper import DatasetMapper -from .detection_utils import check_metadata_consistency -from .samplers import ( - InferenceSampler, - RandomSubsetTrainingSampler, - RepeatFactorTrainingSampler, - TrainingSampler, -) - -""" -This file contains the default logic to build a dataloader for training or testing. -""" - -__all__ = [ - "build_batch_data_loader", - "build_detection_train_loader", - "build_detection_test_loader", - "get_detection_dataset_dicts", - "load_proposals_into_dataset", - "print_instances_class_histogram", -] - - -def filter_images_with_only_crowd_annotations(dataset_dicts): - """ - Filter out images with none annotations or only crowd annotations - (i.e., images without non-crowd annotations). - A common training-time preprocessing on COCO dataset. - - Args: - dataset_dicts (list[dict]): annotations in Detectron2 Dataset format. - - Returns: - list[dict]: the same format, but filtered. - """ - num_before = len(dataset_dicts) - - def valid(anns): - for ann in anns: - if ann.get("iscrowd", 0) == 0: - return True - return False - - dataset_dicts = [x for x in dataset_dicts if valid(x["annotations"])] - num_after = len(dataset_dicts) - logger = logging.getLogger(__name__) - logger.info( - "Removed {} images with no usable annotations. {} images left.".format( - num_before - num_after, num_after - ) - ) - return dataset_dicts - - -def filter_images_with_few_keypoints(dataset_dicts, min_keypoints_per_image): - """ - Filter out images with too few number of keypoints. - - Args: - dataset_dicts (list[dict]): annotations in Detectron2 Dataset format. - - Returns: - list[dict]: the same format as dataset_dicts, but filtered. - """ - num_before = len(dataset_dicts) - - def visible_keypoints_in_image(dic): - # Each keypoints field has the format [x1, y1, v1, ...], where v is visibility - annotations = dic["annotations"] - return sum( - (np.array(ann["keypoints"][2::3]) > 0).sum() - for ann in annotations - if "keypoints" in ann - ) - - dataset_dicts = [ - x for x in dataset_dicts if visible_keypoints_in_image(x) >= min_keypoints_per_image - ] - num_after = len(dataset_dicts) - logger = logging.getLogger(__name__) - logger.info( - "Removed {} images with fewer than {} keypoints.".format( - num_before - num_after, min_keypoints_per_image - ) - ) - return dataset_dicts - - -def load_proposals_into_dataset(dataset_dicts, proposal_file): - """ - Load precomputed object proposals into the dataset. - - The proposal file should be a pickled dict with the following keys: - - - "ids": list[int] or list[str], the image ids - - "boxes": list[np.ndarray], each is an Nx4 array of boxes corresponding to the image id - - "objectness_logits": list[np.ndarray], each is an N sized array of objectness scores - corresponding to the boxes. - - "bbox_mode": the BoxMode of the boxes array. Defaults to ``BoxMode.XYXY_ABS``. - - Args: - dataset_dicts (list[dict]): annotations in Detectron2 Dataset format. - proposal_file (str): file path of pre-computed proposals, in pkl format. - - Returns: - list[dict]: the same format as dataset_dicts, but added proposal field. - """ - logger = logging.getLogger(__name__) - logger.info("Loading proposals from: {}".format(proposal_file)) - - with PathManager.open(proposal_file, "rb") as f: - proposals = pickle.load(f, encoding="latin1") - - # Rename the key names in D1 proposal files - rename_keys = {"indexes": "ids", "scores": "objectness_logits"} - for key in rename_keys: - if key in proposals: - proposals[rename_keys[key]] = proposals.pop(key) - - # Fetch the indexes of all proposals that are in the dataset - # Convert image_id to str since they could be int. - img_ids = set({str(record["image_id"]) for record in dataset_dicts}) - id_to_index = {str(id): i for i, id in enumerate(proposals["ids"]) if str(id) in img_ids} - - # Assuming default bbox_mode of precomputed proposals are 'XYXY_ABS' - bbox_mode = BoxMode(proposals["bbox_mode"]) if "bbox_mode" in proposals else BoxMode.XYXY_ABS - - for record in dataset_dicts: - # Get the index of the proposal - i = id_to_index[str(record["image_id"])] - - boxes = proposals["boxes"][i] - objectness_logits = proposals["objectness_logits"][i] - # Sort the proposals in descending order of the scores - inds = objectness_logits.argsort()[::-1] - record["proposal_boxes"] = boxes[inds] - record["proposal_objectness_logits"] = objectness_logits[inds] - record["proposal_bbox_mode"] = bbox_mode - - return dataset_dicts - - -def print_instances_class_histogram(dataset_dicts, class_names): - """ - Args: - dataset_dicts (list[dict]): list of dataset dicts. - class_names (list[str]): list of class names (zero-indexed). - """ - num_classes = len(class_names) - hist_bins = np.arange(num_classes + 1) - histogram = np.zeros((num_classes,), dtype=np.int) - for entry in dataset_dicts: - annos = entry["annotations"] - classes = np.asarray( - [x["category_id"] for x in annos if not x.get("iscrowd", 0)], dtype=np.int - ) - if len(classes): - assert classes.min() >= 0, f"Got an invalid category_id={classes.min()}" - assert ( - classes.max() < num_classes - ), f"Got an invalid category_id={classes.max()} for a dataset of {num_classes} classes" - histogram += np.histogram(classes, bins=hist_bins)[0] - - N_COLS = min(6, len(class_names) * 2) - - def short_name(x): - # make long class names shorter. useful for lvis - if len(x) > 13: - return x[:11] + ".." - return x - - data = list( - itertools.chain(*[[short_name(class_names[i]), int(v)] for i, v in enumerate(histogram)]) - ) - total_num_instances = sum(data[1::2]) - data.extend([None] * (N_COLS - (len(data) % N_COLS))) - if num_classes > 1: - data.extend(["total", total_num_instances]) - data = itertools.zip_longest(*[data[i::N_COLS] for i in range(N_COLS)]) - table = tabulate( - data, - headers=["category", "#instances"] * (N_COLS // 2), - tablefmt="pipe", - numalign="left", - stralign="center", - ) - log_first_n( - logging.INFO, - "Distribution of instances among all {} categories:\n".format(num_classes) - + colored(table, "cyan"), - key="message", - ) - - -def get_detection_dataset_dicts( - names, - filter_empty=True, - min_keypoints=0, - proposal_files=None, - check_consistency=True, -): - """ - Load and prepare dataset dicts for instance detection/segmentation and semantic segmentation. - - Args: - names (str or list[str]): a dataset name or a list of dataset names - filter_empty (bool): whether to filter out images without instance annotations - min_keypoints (int): filter out images with fewer keypoints than - `min_keypoints`. Set to 0 to do nothing. - proposal_files (list[str]): if given, a list of object proposal files - that match each dataset in `names`. - check_consistency (bool): whether to check if datasets have consistent metadata. - - Returns: - list[dict]: a list of dicts following the standard dataset dict format. - """ - if isinstance(names, str): - names = [names] - assert len(names), names - dataset_dicts = [DatasetCatalog.get(dataset_name) for dataset_name in names] - - if isinstance(dataset_dicts[0], torchdata.Dataset): - if len(dataset_dicts) > 1: - # ConcatDataset does not work for iterable style dataset. - # We could support concat for iterable as well, but it's often - # not a good idea to concat iterables anyway. - return torchdata.ConcatDataset(dataset_dicts) - return dataset_dicts[0] - - for dataset_name, dicts in zip(names, dataset_dicts): - assert len(dicts), "Dataset '{}' is empty!".format(dataset_name) - - if proposal_files is not None: - assert len(names) == len(proposal_files) - # load precomputed proposals from proposal files - dataset_dicts = [ - load_proposals_into_dataset(dataset_i_dicts, proposal_file) - for dataset_i_dicts, proposal_file in zip(dataset_dicts, proposal_files) - ] - - dataset_dicts = list(itertools.chain.from_iterable(dataset_dicts)) - - has_instances = "annotations" in dataset_dicts[0] - if filter_empty and has_instances: - dataset_dicts = filter_images_with_only_crowd_annotations(dataset_dicts) - if min_keypoints > 0 and has_instances: - dataset_dicts = filter_images_with_few_keypoints(dataset_dicts, min_keypoints) - - if check_consistency and has_instances: - try: - class_names = MetadataCatalog.get(names[0]).thing_classes - check_metadata_consistency("thing_classes", names) - print_instances_class_histogram(dataset_dicts, class_names) - except AttributeError: # class names are not available for this dataset - pass - - assert len(dataset_dicts), "No valid data found in {}.".format(",".join(names)) - return dataset_dicts - - -def build_batch_data_loader( - dataset, - sampler, - total_batch_size, - *, - aspect_ratio_grouping=False, - num_workers=0, - collate_fn=None, -): - """ - Build a batched dataloader. The main differences from `torch.utils.data.DataLoader` are: - 1. support aspect ratio grouping options - 2. use no "batch collation", because this is common for detection training - - Args: - dataset (torch.utils.data.Dataset): a pytorch map-style or iterable dataset. - sampler (torch.utils.data.sampler.Sampler or None): a sampler that produces indices. - Must be provided iff. ``dataset`` is a map-style dataset. - total_batch_size, aspect_ratio_grouping, num_workers, collate_fn: see - :func:`build_detection_train_loader`. - - Returns: - iterable[list]. Length of each list is the batch size of the current - GPU. Each element in the list comes from the dataset. - """ - world_size = get_world_size() - assert ( - total_batch_size > 0 and total_batch_size % world_size == 0 - ), "Total batch size ({}) must be divisible by the number of gpus ({}).".format( - total_batch_size, world_size - ) - batch_size = total_batch_size // world_size - - if isinstance(dataset, torchdata.IterableDataset): - assert sampler is None, "sampler must be None if dataset is IterableDataset" - else: - dataset = ToIterableDataset(dataset, sampler) - - if aspect_ratio_grouping: - data_loader = torchdata.DataLoader( - dataset, - num_workers=num_workers, - collate_fn=operator.itemgetter(0), # don't batch, but yield individual elements - worker_init_fn=worker_init_reset_seed, - ) # yield individual mapped dict - data_loader = AspectRatioGroupedDataset(data_loader, batch_size) - if collate_fn is None: - return data_loader - return MapDataset(data_loader, collate_fn) - else: - return torchdata.DataLoader( - dataset, - batch_size=batch_size, - drop_last=True, - num_workers=num_workers, - collate_fn=trivial_batch_collator if collate_fn is None else collate_fn, - worker_init_fn=worker_init_reset_seed, - ) - - -def _train_loader_from_config(cfg, mapper=None, *, dataset=None, sampler=None): - if dataset is None: - dataset = get_detection_dataset_dicts( - cfg.DATASETS.TRAIN, - filter_empty=cfg.DATALOADER.FILTER_EMPTY_ANNOTATIONS, - min_keypoints=cfg.MODEL.ROI_KEYPOINT_HEAD.MIN_KEYPOINTS_PER_IMAGE - if cfg.MODEL.KEYPOINT_ON - else 0, - proposal_files=cfg.DATASETS.PROPOSAL_FILES_TRAIN if cfg.MODEL.LOAD_PROPOSALS else None, - ) - _log_api_usage("dataset." + cfg.DATASETS.TRAIN[0]) - - if mapper is None: - mapper = DatasetMapper(cfg, True) - - if sampler is None: - sampler_name = cfg.DATALOADER.SAMPLER_TRAIN - logger = logging.getLogger(__name__) - if isinstance(dataset, torchdata.IterableDataset): - logger.info("Not using any sampler since the dataset is IterableDataset.") - sampler = None - else: - logger.info("Using training sampler {}".format(sampler_name)) - if sampler_name == "TrainingSampler": - sampler = TrainingSampler(len(dataset)) - elif sampler_name == "RepeatFactorTrainingSampler": - repeat_factors = RepeatFactorTrainingSampler.repeat_factors_from_category_frequency( - dataset, cfg.DATALOADER.REPEAT_THRESHOLD - ) - sampler = RepeatFactorTrainingSampler(repeat_factors) - elif sampler_name == "RandomSubsetTrainingSampler": - sampler = RandomSubsetTrainingSampler( - len(dataset), cfg.DATALOADER.RANDOM_SUBSET_RATIO - ) - else: - raise ValueError("Unknown training sampler: {}".format(sampler_name)) - - return { - "dataset": dataset, - "sampler": sampler, - "mapper": mapper, - "total_batch_size": cfg.SOLVER.IMS_PER_BATCH, - "aspect_ratio_grouping": cfg.DATALOADER.ASPECT_RATIO_GROUPING, - "num_workers": cfg.DATALOADER.NUM_WORKERS, - } - - -@configurable(from_config=_train_loader_from_config) -def build_detection_train_loader( - dataset, - *, - mapper, - sampler=None, - total_batch_size, - aspect_ratio_grouping=True, - num_workers=0, - collate_fn=None, -): - """ - Build a dataloader for object detection with some default features. - - Args: - dataset (list or torch.utils.data.Dataset): a list of dataset dicts, - or a pytorch dataset (either map-style or iterable). It can be obtained - by using :func:`DatasetCatalog.get` or :func:`get_detection_dataset_dicts`. - mapper (callable): a callable which takes a sample (dict) from dataset and - returns the format to be consumed by the model. - When using cfg, the default choice is ``DatasetMapper(cfg, is_train=True)``. - sampler (torch.utils.data.sampler.Sampler or None): a sampler that produces - indices to be applied on ``dataset``. - If ``dataset`` is map-style, the default sampler is a :class:`TrainingSampler`, - which coordinates an infinite random shuffle sequence across all workers. - Sampler must be None if ``dataset`` is iterable. - total_batch_size (int): total batch size across all workers. - aspect_ratio_grouping (bool): whether to group images with similar - aspect ratio for efficiency. When enabled, it requires each - element in dataset be a dict with keys "width" and "height". - num_workers (int): number of parallel data loading workers - collate_fn: a function that determines how to do batching, same as the argument of - `torch.utils.data.DataLoader`. Defaults to do no collation and return a list of - data. No collation is OK for small batch size and simple data structures. - If your batch size is large and each sample contains too many small tensors, - it's more efficient to collate them in data loader. - - Returns: - torch.utils.data.DataLoader: - a dataloader. Each output from it is a ``list[mapped_element]`` of length - ``total_batch_size / num_workers``, where ``mapped_element`` is produced - by the ``mapper``. - """ - if isinstance(dataset, list): - dataset = DatasetFromList(dataset, copy=False) - if mapper is not None: - dataset = MapDataset(dataset, mapper) - - if isinstance(dataset, torchdata.IterableDataset): - assert sampler is None, "sampler must be None if dataset is IterableDataset" - else: - if sampler is None: - sampler = TrainingSampler(len(dataset)) - assert isinstance(sampler, torchdata.Sampler), f"Expect a Sampler but got {type(sampler)}" - return build_batch_data_loader( - dataset, - sampler, - total_batch_size, - aspect_ratio_grouping=aspect_ratio_grouping, - num_workers=num_workers, - collate_fn=collate_fn, - ) - - -def _test_loader_from_config(cfg, dataset_name, mapper=None): - """ - Uses the given `dataset_name` argument (instead of the names in cfg), because the - standard practice is to evaluate each test set individually (not combining them). - """ - if isinstance(dataset_name, str): - dataset_name = [dataset_name] - - dataset = get_detection_dataset_dicts( - dataset_name, - filter_empty=False, - proposal_files=[ - cfg.DATASETS.PROPOSAL_FILES_TEST[list(cfg.DATASETS.TEST).index(x)] for x in dataset_name - ] - if cfg.MODEL.LOAD_PROPOSALS - else None, - ) - if mapper is None: - mapper = DatasetMapper(cfg, False) - return { - "dataset": dataset, - "mapper": mapper, - "num_workers": cfg.DATALOADER.NUM_WORKERS, - "sampler": InferenceSampler(len(dataset)) - if not isinstance(dataset, torchdata.IterableDataset) - else None, - } - - -@configurable(from_config=_test_loader_from_config) -def build_detection_test_loader( - dataset: Union[List[Any], torchdata.Dataset], - *, - mapper: Callable[[Dict[str, Any]], Any], - sampler: Optional[torchdata.Sampler] = None, - batch_size: int = 1, - num_workers: int = 0, - collate_fn: Optional[Callable[[List[Any]], Any]] = None, -) -> torchdata.DataLoader: - """ - Similar to `build_detection_train_loader`, with default batch size = 1, - and sampler = :class:`InferenceSampler`. This sampler coordinates all workers - to produce the exact set of all samples. - - Args: - dataset: a list of dataset dicts, - or a pytorch dataset (either map-style or iterable). They can be obtained - by using :func:`DatasetCatalog.get` or :func:`get_detection_dataset_dicts`. - mapper: a callable which takes a sample (dict) from dataset - and returns the format to be consumed by the model. - When using cfg, the default choice is ``DatasetMapper(cfg, is_train=False)``. - sampler: a sampler that produces - indices to be applied on ``dataset``. Default to :class:`InferenceSampler`, - which splits the dataset across all workers. Sampler must be None - if `dataset` is iterable. - batch_size: the batch size of the data loader to be created. - Default to 1 image per worker since this is the standard when reporting - inference time in papers. - num_workers: number of parallel data loading workers - collate_fn: same as the argument of `torch.utils.data.DataLoader`. - Defaults to do no collation and return a list of data. - - Returns: - DataLoader: a torch DataLoader, that loads the given detection - dataset, with test-time transformation and batching. - - Examples: - :: - data_loader = build_detection_test_loader( - DatasetRegistry.get("my_test"), - mapper=DatasetMapper(...)) - - # or, instantiate with a CfgNode: - data_loader = build_detection_test_loader(cfg, "my_test") - """ - if isinstance(dataset, list): - dataset = DatasetFromList(dataset, copy=False) - if mapper is not None: - dataset = MapDataset(dataset, mapper) - if isinstance(dataset, torchdata.IterableDataset): - assert sampler is None, "sampler must be None if dataset is IterableDataset" - else: - if sampler is None: - sampler = InferenceSampler(len(dataset)) - return torchdata.DataLoader( - dataset, - batch_size=batch_size, - sampler=sampler, - drop_last=False, - num_workers=num_workers, - collate_fn=trivial_batch_collator if collate_fn is None else collate_fn, - ) - - -def trivial_batch_collator(batch): - """ - A batch collator that does nothing. - """ - return batch - - -def worker_init_reset_seed(worker_id): - initial_seed = torch.initial_seed() % 2**31 - seed_all_rng(initial_seed + worker_id) diff --git a/spaces/Superlang/ImageProcessor/annotator/uniformer/configs/_base_/datasets/hrf.py b/spaces/Superlang/ImageProcessor/annotator/uniformer/configs/_base_/datasets/hrf.py deleted file mode 100644 index 242d790eb1b83e75cf6b7eaa7a35c674099311ad..0000000000000000000000000000000000000000 --- a/spaces/Superlang/ImageProcessor/annotator/uniformer/configs/_base_/datasets/hrf.py +++ /dev/null @@ -1,59 +0,0 @@ -# dataset settings -dataset_type = 'HRFDataset' -data_root = 'data/HRF' -img_norm_cfg = dict( - mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True) -img_scale = (2336, 3504) -crop_size = (256, 256) -train_pipeline = [ - dict(type='LoadImageFromFile'), - dict(type='LoadAnnotations'), - dict(type='Resize', img_scale=img_scale, ratio_range=(0.5, 2.0)), - dict(type='RandomCrop', crop_size=crop_size, cat_max_ratio=0.75), - dict(type='RandomFlip', prob=0.5), - dict(type='PhotoMetricDistortion'), - dict(type='Normalize', **img_norm_cfg), - dict(type='Pad', size=crop_size, pad_val=0, seg_pad_val=255), - dict(type='DefaultFormatBundle'), - dict(type='Collect', keys=['img', 'gt_semantic_seg']) -] -test_pipeline = [ - dict(type='LoadImageFromFile'), - dict( - type='MultiScaleFlipAug', - img_scale=img_scale, - # img_ratios=[0.5, 0.75, 1.0, 1.25, 1.5, 1.75, 2.0], - flip=False, - transforms=[ - dict(type='Resize', keep_ratio=True), - dict(type='RandomFlip'), - dict(type='Normalize', **img_norm_cfg), - dict(type='ImageToTensor', keys=['img']), - dict(type='Collect', keys=['img']) - ]) -] - -data = dict( - samples_per_gpu=4, - workers_per_gpu=4, - train=dict( - type='RepeatDataset', - times=40000, - dataset=dict( - type=dataset_type, - data_root=data_root, - img_dir='images/training', - ann_dir='annotations/training', - pipeline=train_pipeline)), - val=dict( - type=dataset_type, - data_root=data_root, - img_dir='images/validation', - ann_dir='annotations/validation', - pipeline=test_pipeline), - test=dict( - type=dataset_type, - data_root=data_root, - img_dir='images/validation', - ann_dir='annotations/validation', - pipeline=test_pipeline)) diff --git a/spaces/Superlang/ImageProcessor/annotator/uniformer/configs/_base_/models/ocrnet_hr18.py b/spaces/Superlang/ImageProcessor/annotator/uniformer/configs/_base_/models/ocrnet_hr18.py deleted file mode 100644 index c60f62a7cdf3f5c5096a7a7e725e8268fddcb057..0000000000000000000000000000000000000000 --- a/spaces/Superlang/ImageProcessor/annotator/uniformer/configs/_base_/models/ocrnet_hr18.py +++ /dev/null @@ -1,68 +0,0 @@ -# model settings -norm_cfg = dict(type='SyncBN', requires_grad=True) -model = dict( - type='CascadeEncoderDecoder', - num_stages=2, - pretrained='open-mmlab://msra/hrnetv2_w18', - backbone=dict( - type='HRNet', - norm_cfg=norm_cfg, - norm_eval=False, - extra=dict( - stage1=dict( - num_modules=1, - num_branches=1, - block='BOTTLENECK', - num_blocks=(4, ), - num_channels=(64, )), - stage2=dict( - num_modules=1, - num_branches=2, - block='BASIC', - num_blocks=(4, 4), - num_channels=(18, 36)), - stage3=dict( - num_modules=4, - num_branches=3, - block='BASIC', - num_blocks=(4, 4, 4), - num_channels=(18, 36, 72)), - stage4=dict( - num_modules=3, - num_branches=4, - block='BASIC', - num_blocks=(4, 4, 4, 4), - num_channels=(18, 36, 72, 144)))), - decode_head=[ - dict( - type='FCNHead', - in_channels=[18, 36, 72, 144], - channels=sum([18, 36, 72, 144]), - in_index=(0, 1, 2, 3), - input_transform='resize_concat', - kernel_size=1, - num_convs=1, - concat_input=False, - dropout_ratio=-1, - num_classes=19, - norm_cfg=norm_cfg, - align_corners=False, - loss_decode=dict( - type='CrossEntropyLoss', use_sigmoid=False, loss_weight=0.4)), - dict( - type='OCRHead', - in_channels=[18, 36, 72, 144], - in_index=(0, 1, 2, 3), - input_transform='resize_concat', - channels=512, - ocr_channels=256, - dropout_ratio=-1, - num_classes=19, - norm_cfg=norm_cfg, - align_corners=False, - loss_decode=dict( - type='CrossEntropyLoss', use_sigmoid=False, loss_weight=1.0)), - ], - # model training and testing settings - train_cfg=dict(), - test_cfg=dict(mode='whole')) diff --git a/spaces/Superlang/ImageProcessor/annotator/zoe/zoedepth/models/base_models/midas_repo/ros/additions/make_package_cpp.sh b/spaces/Superlang/ImageProcessor/annotator/zoe/zoedepth/models/base_models/midas_repo/ros/additions/make_package_cpp.sh deleted file mode 100644 index d0ef6073a9c9ce40744e1c81d557c1c68255b95e..0000000000000000000000000000000000000000 --- a/spaces/Superlang/ImageProcessor/annotator/zoe/zoedepth/models/base_models/midas_repo/ros/additions/make_package_cpp.sh +++ /dev/null @@ -1,16 +0,0 @@ -cd ~/catkin_ws/src -catkin_create_pkg midas_cpp std_msgs roscpp cv_bridge sensor_msgs image_transport -cd ~/catkin_ws -catkin_make - -chmod +x ~/catkin_ws/devel/setup.bash -printf "\nsource ~/catkin_ws/devel/setup.bash" >> ~/.bashrc -source ~/catkin_ws/devel/setup.bash - - -sudo rosdep init -rosdep update -#rospack depends1 midas_cpp -roscd midas_cpp -#cat package.xml -#rospack depends midas_cpp \ No newline at end of file diff --git a/spaces/Superlang/ImageProcessor/annotator/zoe/zoedepth/models/base_models/midas_repo/run.py b/spaces/Superlang/ImageProcessor/annotator/zoe/zoedepth/models/base_models/midas_repo/run.py deleted file mode 100644 index 5696ef0547af093713ea416d18edd77d11879d0a..0000000000000000000000000000000000000000 --- a/spaces/Superlang/ImageProcessor/annotator/zoe/zoedepth/models/base_models/midas_repo/run.py +++ /dev/null @@ -1,277 +0,0 @@ -"""Compute depth maps for images in the input folder. -""" -import os -import glob -import torch -import utils -import cv2 -import argparse -import time - -import numpy as np - -from imutils.video import VideoStream -from midas.model_loader import default_models, load_model - -first_execution = True -def process(device, model, model_type, image, input_size, target_size, optimize, use_camera): - """ - Run the inference and interpolate. - - Args: - device (torch.device): the torch device used - model: the model used for inference - model_type: the type of the model - image: the image fed into the neural network - input_size: the size (width, height) of the neural network input (for OpenVINO) - target_size: the size (width, height) the neural network output is interpolated to - optimize: optimize the model to half-floats on CUDA? - use_camera: is the camera used? - - Returns: - the prediction - """ - global first_execution - - if "openvino" in model_type: - if first_execution or not use_camera: - print(f" Input resized to {input_size[0]}x{input_size[1]} before entering the encoder") - first_execution = False - - sample = [np.reshape(image, (1, 3, *input_size))] - prediction = model(sample)[model.output(0)][0] - prediction = cv2.resize(prediction, dsize=target_size, - interpolation=cv2.INTER_CUBIC) - else: - sample = torch.from_numpy(image).to(device).unsqueeze(0) - - if optimize and device == torch.device("cuda"): - if first_execution: - print(" Optimization to half-floats activated. Use with caution, because models like Swin require\n" - " float precision to work properly and may yield non-finite depth values to some extent for\n" - " half-floats.") - sample = sample.to(memory_format=torch.channels_last) - sample = sample.half() - - if first_execution or not use_camera: - height, width = sample.shape[2:] - print(f" Input resized to {width}x{height} before entering the encoder") - first_execution = False - - prediction = model.forward(sample) - prediction = ( - torch.nn.functional.interpolate( - prediction.unsqueeze(1), - size=target_size[::-1], - mode="bicubic", - align_corners=False, - ) - .squeeze() - .cpu() - .numpy() - ) - - return prediction - - -def create_side_by_side(image, depth, grayscale): - """ - Take an RGB image and depth map and place them side by side. This includes a proper normalization of the depth map - for better visibility. - - Args: - image: the RGB image - depth: the depth map - grayscale: use a grayscale colormap? - - Returns: - the image and depth map place side by side - """ - depth_min = depth.min() - depth_max = depth.max() - normalized_depth = 255 * (depth - depth_min) / (depth_max - depth_min) - normalized_depth *= 3 - - right_side = np.repeat(np.expand_dims(normalized_depth, 2), 3, axis=2) / 3 - if not grayscale: - right_side = cv2.applyColorMap(np.uint8(right_side), cv2.COLORMAP_INFERNO) - - if image is None: - return right_side - else: - return np.concatenate((image, right_side), axis=1) - - -def run(input_path, output_path, model_path, model_type="dpt_beit_large_512", optimize=False, side=False, height=None, - square=False, grayscale=False): - """Run MonoDepthNN to compute depth maps. - - Args: - input_path (str): path to input folder - output_path (str): path to output folder - model_path (str): path to saved model - model_type (str): the model type - optimize (bool): optimize the model to half-floats on CUDA? - side (bool): RGB and depth side by side in output images? - height (int): inference encoder image height - square (bool): resize to a square resolution? - grayscale (bool): use a grayscale colormap? - """ - print("Initialize") - - # select device - device = torch.device("cuda" if torch.cuda.is_available() else "cpu") - print("Device: %s" % device) - - model, transform, net_w, net_h = load_model(device, model_path, model_type, optimize, height, square) - - # get input - if input_path is not None: - image_names = glob.glob(os.path.join(input_path, "*")) - num_images = len(image_names) - else: - print("No input path specified. Grabbing images from camera.") - - # create output folder - if output_path is not None: - os.makedirs(output_path, exist_ok=True) - - print("Start processing") - - if input_path is not None: - if output_path is None: - print("Warning: No output path specified. Images will be processed but not shown or stored anywhere.") - for index, image_name in enumerate(image_names): - - print(" Processing {} ({}/{})".format(image_name, index + 1, num_images)) - - # input - original_image_rgb = utils.read_image(image_name) # in [0, 1] - image = transform({"image": original_image_rgb})["image"] - - # compute - with torch.no_grad(): - prediction = process(device, model, model_type, image, (net_w, net_h), original_image_rgb.shape[1::-1], - optimize, False) - - # output - if output_path is not None: - filename = os.path.join( - output_path, os.path.splitext(os.path.basename(image_name))[0] + '-' + model_type - ) - if not side: - utils.write_depth(filename, prediction, grayscale, bits=2) - else: - original_image_bgr = np.flip(original_image_rgb, 2) - content = create_side_by_side(original_image_bgr*255, prediction, grayscale) - cv2.imwrite(filename + ".png", content) - utils.write_pfm(filename + ".pfm", prediction.astype(np.float32)) - - else: - with torch.no_grad(): - fps = 1 - video = VideoStream(0).start() - time_start = time.time() - frame_index = 0 - while True: - frame = video.read() - if frame is not None: - original_image_rgb = np.flip(frame, 2) # in [0, 255] (flip required to get RGB) - image = transform({"image": original_image_rgb/255})["image"] - - prediction = process(device, model, model_type, image, (net_w, net_h), - original_image_rgb.shape[1::-1], optimize, True) - - original_image_bgr = np.flip(original_image_rgb, 2) if side else None - content = create_side_by_side(original_image_bgr, prediction, grayscale) - cv2.imshow('MiDaS Depth Estimation - Press Escape to close window ', content/255) - - if output_path is not None: - filename = os.path.join(output_path, 'Camera' + '-' + model_type + '_' + str(frame_index)) - cv2.imwrite(filename + ".png", content) - - alpha = 0.1 - if time.time()-time_start > 0: - fps = (1 - alpha) * fps + alpha * 1 / (time.time()-time_start) # exponential moving average - time_start = time.time() - print(f"\rFPS: {round(fps,2)}", end="") - - if cv2.waitKey(1) == 27: # Escape key - break - - frame_index += 1 - print() - - print("Finished") - - -if __name__ == "__main__": - parser = argparse.ArgumentParser() - - parser.add_argument('-i', '--input_path', - default=None, - help='Folder with input images (if no input path is specified, images are tried to be grabbed ' - 'from camera)' - ) - - parser.add_argument('-o', '--output_path', - default=None, - help='Folder for output images' - ) - - parser.add_argument('-m', '--model_weights', - default=None, - help='Path to the trained weights of model' - ) - - parser.add_argument('-t', '--model_type', - default='dpt_beit_large_512', - help='Model type: ' - 'dpt_beit_large_512, dpt_beit_large_384, dpt_beit_base_384, dpt_swin2_large_384, ' - 'dpt_swin2_base_384, dpt_swin2_tiny_256, dpt_swin_large_384, dpt_next_vit_large_384, ' - 'dpt_levit_224, dpt_large_384, dpt_hybrid_384, midas_v21_384, midas_v21_small_256 or ' - 'openvino_midas_v21_small_256' - ) - - parser.add_argument('-s', '--side', - action='store_true', - help='Output images contain RGB and depth images side by side' - ) - - parser.add_argument('--optimize', dest='optimize', action='store_true', help='Use half-float optimization') - parser.set_defaults(optimize=False) - - parser.add_argument('--height', - type=int, default=None, - help='Preferred height of images feed into the encoder during inference. Note that the ' - 'preferred height may differ from the actual height, because an alignment to multiples of ' - '32 takes place. Many models support only the height chosen during training, which is ' - 'used automatically if this parameter is not set.' - ) - parser.add_argument('--square', - action='store_true', - help='Option to resize images to a square resolution by changing their widths when images are ' - 'fed into the encoder during inference. If this parameter is not set, the aspect ratio of ' - 'images is tried to be preserved if supported by the model.' - ) - parser.add_argument('--grayscale', - action='store_true', - help='Use a grayscale colormap instead of the inferno one. Although the inferno colormap, ' - 'which is used by default, is better for visibility, it does not allow storing 16-bit ' - 'depth values in PNGs but only 8-bit ones due to the precision limitation of this ' - 'colormap.' - ) - - args = parser.parse_args() - - - if args.model_weights is None: - args.model_weights = default_models[args.model_type] - - # set torch options - torch.backends.cudnn.enabled = True - torch.backends.cudnn.benchmark = True - - # compute depth maps - run(args.input_path, args.output_path, args.model_weights, args.model_type, args.optimize, args.side, args.height, - args.square, args.grayscale) diff --git a/spaces/T-1000/runwayml-stable-diffusion-v1-5/app.py b/spaces/T-1000/runwayml-stable-diffusion-v1-5/app.py deleted file mode 100644 index a82df332731f067826d3e1ef79fabceffb74d07e..0000000000000000000000000000000000000000 --- a/spaces/T-1000/runwayml-stable-diffusion-v1-5/app.py +++ /dev/null @@ -1,3 +0,0 @@ -import gradio as gr - -gr.Interface.load("models/runwayml/stable-diffusion-v1-5").launch() \ No newline at end of file diff --git a/spaces/TRI-ML/risk_biased_prediction/risk_biased/utils/loss.py b/spaces/TRI-ML/risk_biased_prediction/risk_biased/utils/loss.py deleted file mode 100644 index 9219e7f2e1a6e79def243fb356f195aa2ddadd2c..0000000000000000000000000000000000000000 --- a/spaces/TRI-ML/risk_biased_prediction/risk_biased/utils/loss.py +++ /dev/null @@ -1,124 +0,0 @@ -from typing import Optional - -import torch -from torch import Tensor -from torch.distributions import MultivariateNormal - - -def reconstruction_loss( - pred: torch.Tensor, truth: torch.Tensor, mask_loss: Optional[torch.Tensor] = None -): - """ - pred (Tensor): (..., time, [x,y,(a),(vx,vy)]) - truth (Tensor): (..., time, [x,y,(a),(vx,vy)]) - mask_loss (Tensor): (..., time) Defaults to None. - """ - min_feat_shape = min(pred.shape[-1], truth.shape[-1]) - if min_feat_shape == 3: - assert pred.shape[-1] == truth.shape[-1] - return reconstruction_loss( - pred[..., :2], truth[..., :2], mask_loss - ) + reconstruction_loss( - torch.stack([torch.cos(pred[..., 2]), torch.sin(pred[..., 2])], -1), - torch.stack([torch.cos(truth[..., 2]), torch.sin(truth[..., 2])], -1), - mask_loss, - ) - elif min_feat_shape >= 5: - assert pred.shape[-1] <= truth.shape[-1] - v_norm = torch.sum(torch.square(truth[..., 3:5]), -1, keepdim=True) - v_mask = v_norm > 1 - return ( - reconstruction_loss(pred[..., :2], truth[..., :2], mask_loss) - + reconstruction_loss( - torch.stack([torch.cos(pred[..., 2]), torch.sin(pred[..., 2])], -1) - * v_mask, - torch.stack([torch.cos(truth[..., 2]), torch.sin(truth[..., 2])], -1) - * v_mask, - mask_loss, - ) - + reconstruction_loss(pred[..., 3:5], truth[..., 3:5], mask_loss) - ) - elif min_feat_shape == 2: - if mask_loss is None: - return torch.mean( - torch.sqrt( - torch.sum( - torch.square(pred[..., :2] - truth[..., :2]), -1 - ).clamp_min(1e-6) - ) - ) - else: - assert mask_loss.any() - mask_loss = mask_loss.float() - return torch.sum( - torch.sqrt( - torch.sum( - torch.square(pred[..., :2] - truth[..., :2]), -1 - ).clamp_min(1e-6) - ) - * mask_loss - ) / torch.sum(mask_loss).clamp_min(1) - - -def map_penalized_reconstruction_loss( - pred: torch.Tensor, - truth: torch.Tensor, - map: torch.Tensor, - mask_map: torch.Tensor, - mask_loss: Optional[torch.Tensor] = None, - map_importance: float = 0.1, -): - """ - pred (Tensor): (batch_size, num_agents, time, [x,y,(a),(vx,vy)]) - truth (Tensor): (batch_size, num_agents, time, [x,y,(a),(vx,vy)]) - map (Tensor): (batch_size, num_objects, object_sequence_length, [x, y, ...]) - mask_map (Tensor): (...) - mask_loss (Tensor): (..., time) Defaults to None. - - """ - # b, a, o, s, f b, a, o, t, s, f - map_distance, _ = ( - (map[:, None, :, :, :2] - pred[:, :, None, -1, None, :2]) - .square() - .sum(-1) - .min(2) - ) - map_distance = map_distance.sqrt().clamp(0.5, 3) - if mask_map is not None: - map_loss = (map_distance * mask_loss[..., -1:]).sum() / mask_loss[..., -1].sum() - else: - map_loss = map_distance.mean() - - rec_loss = reconstruction_loss(pred, truth, mask_loss) - - return rec_loss + map_importance * map_loss - - -def cce_loss_with_logits(pred_logits: torch.Tensor, truth: torch.Tensor): - pred_log = pred_logits.log_softmax(-1) - return -(pred_log * truth).sum(-1).mean() - - -def risk_loss_function( - pred: torch.Tensor, - truth: torch.Tensor, - mask: torch.Tensor, - factor: float = 100.0, -) -> torch.Tensor: - """ - Loss function for the risk comparison. This is assymetric because it is preferred that the model over-estimates - the risk rather than under-estimate it. - Args: - pred: (same_shape) The predicted risks - truth: (same_shape) The reference risks to match - mask: (same_shape) A mask with 1 where the loss should be computed and 0 elsewhere. - approximate_mean_error: An approximation of the mean error obtained after training. The lower this value, - the greater the intensity of the assymetry. - Returns: - Scalar loss value - """ - error = pred - truth - error = error * factor - error = torch.where(error > 1, (error + 1e-6).log(), error.abs()) - error = (error * mask).sum() / mask.sum() - return error diff --git a/spaces/TandCAcceptMe/face-swap-docker/mynewshinyroop/Lib/site-packages/pip/_internal/distributions/sdist.py b/spaces/TandCAcceptMe/face-swap-docker/mynewshinyroop/Lib/site-packages/pip/_internal/distributions/sdist.py deleted file mode 100644 index 4c25647930c6557d10e8a3ee92b68cfe3a07f7d7..0000000000000000000000000000000000000000 --- a/spaces/TandCAcceptMe/face-swap-docker/mynewshinyroop/Lib/site-packages/pip/_internal/distributions/sdist.py +++ /dev/null @@ -1,150 +0,0 @@ -import logging -from typing import Iterable, Set, Tuple - -from pip._internal.build_env import BuildEnvironment -from pip._internal.distributions.base import AbstractDistribution -from pip._internal.exceptions import InstallationError -from pip._internal.index.package_finder import PackageFinder -from pip._internal.metadata import BaseDistribution -from pip._internal.utils.subprocess import runner_with_spinner_message - -logger = logging.getLogger(__name__) - - -class SourceDistribution(AbstractDistribution): - """Represents a source distribution. - - The preparation step for these needs metadata for the packages to be - generated, either using PEP 517 or using the legacy `setup.py egg_info`. - """ - - def get_metadata_distribution(self) -> BaseDistribution: - return self.req.get_dist() - - def prepare_distribution_metadata( - self, - finder: PackageFinder, - build_isolation: bool, - check_build_deps: bool, - ) -> None: - # Load pyproject.toml, to determine whether PEP 517 is to be used - self.req.load_pyproject_toml() - - # Set up the build isolation, if this requirement should be isolated - should_isolate = self.req.use_pep517 and build_isolation - if should_isolate: - # Setup an isolated environment and install the build backend static - # requirements in it. - self._prepare_build_backend(finder) - # Check that if the requirement is editable, it either supports PEP 660 or - # has a setup.py or a setup.cfg. This cannot be done earlier because we need - # to setup the build backend to verify it supports build_editable, nor can - # it be done later, because we want to avoid installing build requirements - # needlessly. Doing it here also works around setuptools generating - # UNKNOWN.egg-info when running get_requires_for_build_wheel on a directory - # without setup.py nor setup.cfg. - self.req.isolated_editable_sanity_check() - # Install the dynamic build requirements. - self._install_build_reqs(finder) - # Check if the current environment provides build dependencies - should_check_deps = self.req.use_pep517 and check_build_deps - if should_check_deps: - pyproject_requires = self.req.pyproject_requires - assert pyproject_requires is not None - conflicting, missing = self.req.build_env.check_requirements( - pyproject_requires - ) - if conflicting: - self._raise_conflicts("the backend dependencies", conflicting) - if missing: - self._raise_missing_reqs(missing) - self.req.prepare_metadata() - - def _prepare_build_backend(self, finder: PackageFinder) -> None: - # Isolate in a BuildEnvironment and install the build-time - # requirements. - pyproject_requires = self.req.pyproject_requires - assert pyproject_requires is not None - - self.req.build_env = BuildEnvironment() - self.req.build_env.install_requirements( - finder, pyproject_requires, "overlay", kind="build dependencies" - ) - conflicting, missing = self.req.build_env.check_requirements( - self.req.requirements_to_check - ) - if conflicting: - self._raise_conflicts("PEP 517/518 supported requirements", conflicting) - if missing: - logger.warning( - "Missing build requirements in pyproject.toml for %s.", - self.req, - ) - logger.warning( - "The project does not specify a build backend, and " - "pip cannot fall back to setuptools without %s.", - " and ".join(map(repr, sorted(missing))), - ) - - def _get_build_requires_wheel(self) -> Iterable[str]: - with self.req.build_env: - runner = runner_with_spinner_message("Getting requirements to build wheel") - backend = self.req.pep517_backend - assert backend is not None - with backend.subprocess_runner(runner): - return backend.get_requires_for_build_wheel() - - def _get_build_requires_editable(self) -> Iterable[str]: - with self.req.build_env: - runner = runner_with_spinner_message( - "Getting requirements to build editable" - ) - backend = self.req.pep517_backend - assert backend is not None - with backend.subprocess_runner(runner): - return backend.get_requires_for_build_editable() - - def _install_build_reqs(self, finder: PackageFinder) -> None: - # Install any extra build dependencies that the backend requests. - # This must be done in a second pass, as the pyproject.toml - # dependencies must be installed before we can call the backend. - if ( - self.req.editable - and self.req.permit_editable_wheels - and self.req.supports_pyproject_editable() - ): - build_reqs = self._get_build_requires_editable() - else: - build_reqs = self._get_build_requires_wheel() - conflicting, missing = self.req.build_env.check_requirements(build_reqs) - if conflicting: - self._raise_conflicts("the backend dependencies", conflicting) - self.req.build_env.install_requirements( - finder, missing, "normal", kind="backend dependencies" - ) - - def _raise_conflicts( - self, conflicting_with: str, conflicting_reqs: Set[Tuple[str, str]] - ) -> None: - format_string = ( - "Some build dependencies for {requirement} " - "conflict with {conflicting_with}: {description}." - ) - error_message = format_string.format( - requirement=self.req, - conflicting_with=conflicting_with, - description=", ".join( - f"{installed} is incompatible with {wanted}" - for installed, wanted in sorted(conflicting_reqs) - ), - ) - raise InstallationError(error_message) - - def _raise_missing_reqs(self, missing: Set[str]) -> None: - format_string = ( - "Some build dependencies for {requirement} are missing: {missing}." - ) - error_message = format_string.format( - requirement=self.req, missing=", ".join(map(repr, sorted(missing))) - ) - raise InstallationError(error_message) diff --git a/spaces/Techis/resume-screening-tool/README.md b/spaces/Techis/resume-screening-tool/README.md deleted file mode 100644 index 2f2046731d601cc8b6662a19752c1a8734b4236c..0000000000000000000000000000000000000000 --- a/spaces/Techis/resume-screening-tool/README.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -title: Resume Screening Tool -emoji: 🐢 -colorFrom: green -colorTo: pink -sdk: gradio -sdk_version: 2.9.1 -app_file: app.py -pinned: false -license: other ---- - -Check out the configuration reference at https://huggingface.co/docs/hub/spaces#reference diff --git a/spaces/ThomasSimonini/Deep-Reinforcement-Learning-Leaderboard/utils.py b/spaces/ThomasSimonini/Deep-Reinforcement-Learning-Leaderboard/utils.py deleted file mode 100644 index 13587c3623fee788f38388fc0917d174580e36f6..0000000000000000000000000000000000000000 --- a/spaces/ThomasSimonini/Deep-Reinforcement-Learning-Leaderboard/utils.py +++ /dev/null @@ -1,14 +0,0 @@ -# Based on Omar Sanseviero work -# Make model clickable link -def make_clickable_model(model_name): - # remove user from model name - model_name_show = ' '.join(model_name.split('/')[1:]) - - link = "https://huggingface.co/" + model_name - return f'{model_name_show}' - -# Make user clickable link -def make_clickable_user(user_id): - link = "https://huggingface.co/" + user_id - return f'{user_id}' - \ No newline at end of file diff --git a/spaces/VoiceHero69/changer/setup_tools/venv.py b/spaces/VoiceHero69/changer/setup_tools/venv.py deleted file mode 100644 index 579c74bf3c6c9230498c6b3e374ffe416313d9a7..0000000000000000000000000000000000000000 --- a/spaces/VoiceHero69/changer/setup_tools/venv.py +++ /dev/null @@ -1,34 +0,0 @@ -import sys - -from .commands import run_command, get_python -from .os import is_windows -import os - -venv_name = 'venv' -venv_activate_path = f'{venv_name}/' + ('Scripts/activate.bat' if is_windows() else 'bin/activate') - - -def get_base_prefix_compat(): - """Get base/real prefix, or sys.prefix if there is none.""" - return getattr(sys, "base_prefix", None) or getattr(sys, "real_prefix", None) or sys.prefix - - -def in_venv(): - return get_base_prefix_compat() != sys.prefix - - -def activate_venv(): - if in_venv(): - return - if not os.path.isdir(venv_name): - print('no venv found, creating venv') - run_command(f'"{get_python()}"', '-m venv venv') - run_command([('call' if is_windows() else 'source', venv_activate_path), ('python', ' '.join([f'"{arg}"' for arg in sys.argv]))]) # Launch the main.py with the venv - exit() # Exit after the venv'ed version exits (maximum depth will be 2 because the venv is already activated in that case) - - -def ensure_venv(): - if not in_venv(): - print('activating venv') - activate_venv() - diff --git a/spaces/Xenova/llama2.c/README.md b/spaces/Xenova/llama2.c/README.md deleted file mode 100644 index 77062dafe628a40e4ea65050ad52106768db2408..0000000000000000000000000000000000000000 --- a/spaces/Xenova/llama2.c/README.md +++ /dev/null @@ -1,11 +0,0 @@ ---- -title: Llama2.c -emoji: 🌍 -colorFrom: green -colorTo: indigo -sdk: docker -pinned: false -app_port: 8080 ---- - -Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference diff --git a/spaces/Xixeo/Text-to-Music/utils.py b/spaces/Xixeo/Text-to-Music/utils.py deleted file mode 100644 index d302528fd6fc9be8d782f78b6c44f4d894147d07..0000000000000000000000000000000000000000 --- a/spaces/Xixeo/Text-to-Music/utils.py +++ /dev/null @@ -1,50 +0,0 @@ -import json -import numpy as np -import httpx - -from constants import MUBERT_TAGS, MUBERT_LICENSE, MUBERT_MODE, MUBERT_TOKEN - - -def get_mubert_tags_embeddings(w2v_model): - return w2v_model.encode(MUBERT_TAGS) - - -def get_pat(email: str): - r = httpx.post('https://api-b2b.mubert.com/v2/GetServiceAccess', - json={ - "method": "GetServiceAccess", - "params": { - "email": email, - "license": MUBERT_LICENSE, - "token": MUBERT_TOKEN, - "mode": MUBERT_MODE, - } - }) - - rdata = json.loads(r.text) - assert rdata['status'] == 1, "probably incorrect e-mail" - pat = rdata['data']['pat'] - return pat - - -def find_similar(em, embeddings, method='cosine'): - scores = [] - for ref in embeddings: - if method == 'cosine': - scores.append(1 - np.dot(ref, em) / (np.linalg.norm(ref) * np.linalg.norm(em))) - if method == 'norm': - scores.append(np.linalg.norm(ref - em)) - return np.array(scores), np.argsort(scores) - - -def get_tags_for_prompts(w2v_model, mubert_tags_embeddings, prompts, top_n=3, debug=False): - prompts_embeddings = w2v_model.encode(prompts) - ret = [] - for i, pe in enumerate(prompts_embeddings): - scores, idxs = find_similar(pe, mubert_tags_embeddings) - top_tags = MUBERT_TAGS[idxs[:top_n]] - top_prob = 1 - scores[idxs[:top_n]] - if debug: - print(f"Prompt: {prompts[i]}\nTags: {', '.join(top_tags)}\nScores: {top_prob}\n\n\n") - ret.append((prompts[i], list(top_tags))) - return ret diff --git a/spaces/XzJosh/JM-Bert-VITS2/text/tone_sandhi.py b/spaces/XzJosh/JM-Bert-VITS2/text/tone_sandhi.py deleted file mode 100644 index 0f45b7a72c5d858bcaab19ac85cfa686bf9a74da..0000000000000000000000000000000000000000 --- a/spaces/XzJosh/JM-Bert-VITS2/text/tone_sandhi.py +++ /dev/null @@ -1,351 +0,0 @@ -# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -from typing import List -from typing import Tuple - -import jieba -from pypinyin import lazy_pinyin -from pypinyin import Style - - -class ToneSandhi(): - def __init__(self): - self.must_neural_tone_words = { - '麻烦', '麻利', '鸳鸯', '高粱', '骨头', '骆驼', '马虎', '首饰', '馒头', '馄饨', '风筝', - '难为', '队伍', '阔气', '闺女', '门道', '锄头', '铺盖', '铃铛', '铁匠', '钥匙', '里脊', - '里头', '部分', '那么', '道士', '造化', '迷糊', '连累', '这么', '这个', '运气', '过去', - '软和', '转悠', '踏实', '跳蚤', '跟头', '趔趄', '财主', '豆腐', '讲究', '记性', '记号', - '认识', '规矩', '见识', '裁缝', '补丁', '衣裳', '衣服', '衙门', '街坊', '行李', '行当', - '蛤蟆', '蘑菇', '薄荷', '葫芦', '葡萄', '萝卜', '荸荠', '苗条', '苗头', '苍蝇', '芝麻', - '舒服', '舒坦', '舌头', '自在', '膏药', '脾气', '脑袋', '脊梁', '能耐', '胳膊', '胭脂', - '胡萝', '胡琴', '胡同', '聪明', '耽误', '耽搁', '耷拉', '耳朵', '老爷', '老实', '老婆', - '老头', '老太', '翻腾', '罗嗦', '罐头', '编辑', '结实', '红火', '累赘', '糨糊', '糊涂', - '精神', '粮食', '簸箕', '篱笆', '算计', '算盘', '答应', '笤帚', '笑语', '笑话', '窟窿', - '窝囊', '窗户', '稳当', '稀罕', '称呼', '秧歌', '秀气', '秀才', '福气', '祖宗', '砚台', - '码头', '石榴', '石头', '石匠', '知识', '眼睛', '眯缝', '眨巴', '眉毛', '相声', '盘算', - '白净', '痢疾', '痛快', '疟疾', '疙瘩', '疏忽', '畜生', '生意', '甘蔗', '琵琶', '琢磨', - '琉璃', '玻璃', '玫瑰', '玄乎', '狐狸', '状元', '特务', '牲口', '牙碜', '牌楼', '爽快', - '爱人', '热闹', '烧饼', '烟筒', '烂糊', '点心', '炊帚', '灯笼', '火候', '漂亮', '滑溜', - '溜达', '温和', '清楚', '消息', '浪头', '活泼', '比方', '正经', '欺负', '模糊', '槟榔', - '棺材', '棒槌', '棉花', '核桃', '栅栏', '柴火', '架势', '枕头', '枇杷', '机灵', '本事', - '木头', '木匠', '朋友', '月饼', '月亮', '暖和', '明白', '时候', '新鲜', '故事', '收拾', - '收成', '提防', '挖苦', '挑剔', '指甲', '指头', '拾掇', '拳头', '拨弄', '招牌', '招呼', - '抬举', '护士', '折腾', '扫帚', '打量', '打算', '打点', '打扮', '打听', '打发', '扎实', - '扁担', '戒指', '懒得', '意识', '意思', '情形', '悟性', '怪物', '思量', '怎么', '念头', - '念叨', '快活', '忙活', '志气', '心思', '得罪', '张罗', '弟兄', '开通', '应酬', '庄稼', - '干事', '帮手', '帐篷', '希罕', '师父', '师傅', '巴结', '巴掌', '差事', '工夫', '岁数', - '屁股', '尾巴', '少爷', '小气', '小伙', '将就', '对头', '对付', '寡妇', '家伙', '客气', - '实在', '官司', '学问', '学生', '字号', '嫁妆', '媳妇', '媒人', '婆家', '娘家', '委屈', - '姑娘', '姐夫', '妯娌', '妥当', '妖精', '奴才', '女婿', '头发', '太阳', '大爷', '大方', - '大意', '大夫', '多少', '多么', '外甥', '壮实', '地道', '地方', '在乎', '困难', '嘴巴', - '嘱咐', '嘟囔', '嘀咕', '喜欢', '喇嘛', '喇叭', '商量', '唾沫', '哑巴', '哈欠', '哆嗦', - '咳嗽', '和尚', '告诉', '告示', '含糊', '吓唬', '后头', '名字', '名堂', '合同', '吆喝', - '叫唤', '口袋', '厚道', '厉害', '千斤', '包袱', '包涵', '匀称', '勤快', '动静', '动弹', - '功夫', '力气', '前头', '刺猬', '刺激', '别扭', '利落', '利索', '利害', '分析', '出息', - '凑合', '凉快', '冷战', '冤枉', '冒失', '养活', '关系', '先生', '兄弟', '便宜', '使唤', - '佩服', '作坊', '体面', '位置', '似的', '伙计', '休息', '什么', '人家', '亲戚', '亲家', - '交情', '云彩', '事情', '买卖', '主意', '丫头', '丧气', '两口', '东西', '东家', '世故', - '不由', '不在', '下水', '下巴', '上头', '上司', '丈夫', '丈人', '一辈', '那个', '菩萨', - '父亲', '母亲', '咕噜', '邋遢', '费用', '冤家', '甜头', '介绍', '荒唐', '大人', '泥鳅', - '幸福', '熟悉', '计划', '扑腾', '蜡烛', '姥爷', '照顾', '喉咙', '吉他', '弄堂', '蚂蚱', - '凤凰', '拖沓', '寒碜', '糟蹋', '倒腾', '报复', '逻辑', '盘缠', '喽啰', '牢骚', '咖喱', - '扫把', '惦记' - } - self.must_not_neural_tone_words = { - "男子", "女子", "分子", "原子", "量子", "莲子", "石子", "瓜子", "电子", "人人", "虎虎" - } - self.punc = ":,;。?!“”‘’':,;.?!" - - # the meaning of jieba pos tag: https://blog.csdn.net/weixin_44174352/article/details/113731041 - # e.g. - # word: "家里" - # pos: "s" - # finals: ['ia1', 'i3'] - def _neural_sandhi(self, word: str, pos: str, - finals: List[str]) -> List[str]: - - # reduplication words for n. and v. e.g. 奶奶, 试试, 旺旺 - for j, item in enumerate(word): - if j - 1 >= 0 and item == word[j - 1] and pos[0] in { - "n", "v", "a" - } and word not in self.must_not_neural_tone_words: - finals[j] = finals[j][:-1] + "5" - ge_idx = word.find("个") - if len(word) >= 1 and word[-1] in "吧呢啊呐噻嘛吖嗨呐哦哒额滴哩哟喽啰耶喔诶": - finals[-1] = finals[-1][:-1] + "5" - elif len(word) >= 1 and word[-1] in "的地得": - finals[-1] = finals[-1][:-1] + "5" - # e.g. 走了, 看着, 去过 - # elif len(word) == 1 and word in "了着过" and pos in {"ul", "uz", "ug"}: - # finals[-1] = finals[-1][:-1] + "5" - elif len(word) > 1 and word[-1] in "们子" and pos in { - "r", "n" - } and word not in self.must_not_neural_tone_words: - finals[-1] = finals[-1][:-1] + "5" - # e.g. 桌上, 地下, 家里 - elif len(word) > 1 and word[-1] in "上下里" and pos in {"s", "l", "f"}: - finals[-1] = finals[-1][:-1] + "5" - # e.g. 上来, 下去 - elif len(word) > 1 and word[-1] in "来去" and word[-2] in "上下进出回过起开": - finals[-1] = finals[-1][:-1] + "5" - # 个做量词 - elif (ge_idx >= 1 and - (word[ge_idx - 1].isnumeric() or - word[ge_idx - 1] in "几有两半多各整每做是")) or word == '个': - finals[ge_idx] = finals[ge_idx][:-1] + "5" - else: - if word in self.must_neural_tone_words or word[ - -2:] in self.must_neural_tone_words: - finals[-1] = finals[-1][:-1] + "5" - - word_list = self._split_word(word) - finals_list = [finals[:len(word_list[0])], finals[len(word_list[0]):]] - for i, word in enumerate(word_list): - # conventional neural in Chinese - if word in self.must_neural_tone_words or word[ - -2:] in self.must_neural_tone_words: - finals_list[i][-1] = finals_list[i][-1][:-1] + "5" - finals = sum(finals_list, []) - return finals - - def _bu_sandhi(self, word: str, finals: List[str]) -> List[str]: - # e.g. 看不懂 - if len(word) == 3 and word[1] == "不": - finals[1] = finals[1][:-1] + "5" - else: - for i, char in enumerate(word): - # "不" before tone4 should be bu2, e.g. 不怕 - if char == "不" and i + 1 < len(word) and finals[i + - 1][-1] == "4": - finals[i] = finals[i][:-1] + "2" - return finals - - def _yi_sandhi(self, word: str, finals: List[str]) -> List[str]: - # "一" in number sequences, e.g. 一零零, 二一零 - if word.find("一") != -1 and all( - [item.isnumeric() for item in word if item != "一"]): - return finals - # "一" between reduplication words shold be yi5, e.g. 看一看 - elif len(word) == 3 and word[1] == "一" and word[0] == word[-1]: - finals[1] = finals[1][:-1] + "5" - # when "一" is ordinal word, it should be yi1 - elif word.startswith("第一"): - finals[1] = finals[1][:-1] + "1" - else: - for i, char in enumerate(word): - if char == "一" and i + 1 < len(word): - # "一" before tone4 should be yi2, e.g. 一段 - if finals[i + 1][-1] == "4": - finals[i] = finals[i][:-1] + "2" - # "一" before non-tone4 should be yi4, e.g. 一天 - else: - # "一" 后面如果是标点,还读一声 - if word[i + 1] not in self.punc: - finals[i] = finals[i][:-1] + "4" - return finals - - def _split_word(self, word: str) -> List[str]: - word_list = jieba.cut_for_search(word) - word_list = sorted(word_list, key=lambda i: len(i), reverse=False) - first_subword = word_list[0] - first_begin_idx = word.find(first_subword) - if first_begin_idx == 0: - second_subword = word[len(first_subword):] - new_word_list = [first_subword, second_subword] - else: - second_subword = word[:-len(first_subword)] - new_word_list = [second_subword, first_subword] - return new_word_list - - def _three_sandhi(self, word: str, finals: List[str]) -> List[str]: - if len(word) == 2 and self._all_tone_three(finals): - finals[0] = finals[0][:-1] + "2" - elif len(word) == 3: - word_list = self._split_word(word) - if self._all_tone_three(finals): - # disyllabic + monosyllabic, e.g. 蒙古/包 - if len(word_list[0]) == 2: - finals[0] = finals[0][:-1] + "2" - finals[1] = finals[1][:-1] + "2" - # monosyllabic + disyllabic, e.g. 纸/老虎 - elif len(word_list[0]) == 1: - finals[1] = finals[1][:-1] + "2" - else: - finals_list = [ - finals[:len(word_list[0])], finals[len(word_list[0]):] - ] - if len(finals_list) == 2: - for i, sub in enumerate(finals_list): - # e.g. 所有/人 - if self._all_tone_three(sub) and len(sub) == 2: - finals_list[i][0] = finals_list[i][0][:-1] + "2" - # e.g. 好/喜欢 - elif i == 1 and not self._all_tone_three(sub) and finals_list[i][0][-1] == "3" and \ - finals_list[0][-1][-1] == "3": - - finals_list[0][-1] = finals_list[0][-1][:-1] + "2" - finals = sum(finals_list, []) - # split idiom into two words who's length is 2 - elif len(word) == 4: - finals_list = [finals[:2], finals[2:]] - finals = [] - for sub in finals_list: - if self._all_tone_three(sub): - sub[0] = sub[0][:-1] + "2" - finals += sub - - return finals - - def _all_tone_three(self, finals: List[str]) -> bool: - return all(x[-1] == "3" for x in finals) - - # merge "不" and the word behind it - # if don't merge, "不" sometimes appears alone according to jieba, which may occur sandhi error - def _merge_bu(self, seg: List[Tuple[str, str]]) -> List[Tuple[str, str]]: - new_seg = [] - last_word = "" - for word, pos in seg: - if last_word == "不": - word = last_word + word - if word != "不": - new_seg.append((word, pos)) - last_word = word[:] - if last_word == "不": - new_seg.append((last_word, 'd')) - last_word = "" - return new_seg - - # function 1: merge "一" and reduplication words in it's left and right, e.g. "听","一","听" ->"听一听" - # function 2: merge single "一" and the word behind it - # if don't merge, "一" sometimes appears alone according to jieba, which may occur sandhi error - # e.g. - # input seg: [('听', 'v'), ('一', 'm'), ('听', 'v')] - # output seg: [['听一听', 'v']] - def _merge_yi(self, seg: List[Tuple[str, str]]) -> List[Tuple[str, str]]: - new_seg = [] - # function 1 - for i, (word, pos) in enumerate(seg): - if i - 1 >= 0 and word == "一" and i + 1 < len(seg) and seg[i - 1][ - 0] == seg[i + 1][0] and seg[i - 1][1] == "v": - new_seg[i - 1][0] = new_seg[i - 1][0] + "一" + new_seg[i - 1][0] - else: - if i - 2 >= 0 and seg[i - 1][0] == "一" and seg[i - 2][ - 0] == word and pos == "v": - continue - else: - new_seg.append([word, pos]) - seg = new_seg - new_seg = [] - # function 2 - for i, (word, pos) in enumerate(seg): - if new_seg and new_seg[-1][0] == "一": - new_seg[-1][0] = new_seg[-1][0] + word - else: - new_seg.append([word, pos]) - return new_seg - - # the first and the second words are all_tone_three - def _merge_continuous_three_tones( - self, seg: List[Tuple[str, str]]) -> List[Tuple[str, str]]: - new_seg = [] - sub_finals_list = [ - lazy_pinyin( - word, neutral_tone_with_five=True, style=Style.FINALS_TONE3) - for (word, pos) in seg - ] - assert len(sub_finals_list) == len(seg) - merge_last = [False] * len(seg) - for i, (word, pos) in enumerate(seg): - if i - 1 >= 0 and self._all_tone_three( - sub_finals_list[i - 1]) and self._all_tone_three( - sub_finals_list[i]) and not merge_last[i - 1]: - # if the last word is reduplication, not merge, because reduplication need to be _neural_sandhi - if not self._is_reduplication(seg[i - 1][0]) and len( - seg[i - 1][0]) + len(seg[i][0]) <= 3: - new_seg[-1][0] = new_seg[-1][0] + seg[i][0] - merge_last[i] = True - else: - new_seg.append([word, pos]) - else: - new_seg.append([word, pos]) - - return new_seg - - def _is_reduplication(self, word: str) -> bool: - return len(word) == 2 and word[0] == word[1] - - # the last char of first word and the first char of second word is tone_three - def _merge_continuous_three_tones_2( - self, seg: List[Tuple[str, str]]) -> List[Tuple[str, str]]: - new_seg = [] - sub_finals_list = [ - lazy_pinyin( - word, neutral_tone_with_five=True, style=Style.FINALS_TONE3) - for (word, pos) in seg - ] - assert len(sub_finals_list) == len(seg) - merge_last = [False] * len(seg) - for i, (word, pos) in enumerate(seg): - if i - 1 >= 0 and sub_finals_list[i - 1][-1][-1] == "3" and sub_finals_list[i][0][-1] == "3" and not \ - merge_last[i - 1]: - # if the last word is reduplication, not merge, because reduplication need to be _neural_sandhi - if not self._is_reduplication(seg[i - 1][0]) and len( - seg[i - 1][0]) + len(seg[i][0]) <= 3: - new_seg[-1][0] = new_seg[-1][0] + seg[i][0] - merge_last[i] = True - else: - new_seg.append([word, pos]) - else: - new_seg.append([word, pos]) - return new_seg - - def _merge_er(self, seg: List[Tuple[str, str]]) -> List[Tuple[str, str]]: - new_seg = [] - for i, (word, pos) in enumerate(seg): - if i - 1 >= 0 and word == "儿" and seg[i-1][0] != "#": - new_seg[-1][0] = new_seg[-1][0] + seg[i][0] - else: - new_seg.append([word, pos]) - return new_seg - - def _merge_reduplication( - self, seg: List[Tuple[str, str]]) -> List[Tuple[str, str]]: - new_seg = [] - for i, (word, pos) in enumerate(seg): - if new_seg and word == new_seg[-1][0]: - new_seg[-1][0] = new_seg[-1][0] + seg[i][0] - else: - new_seg.append([word, pos]) - return new_seg - - def pre_merge_for_modify( - self, seg: List[Tuple[str, str]]) -> List[Tuple[str, str]]: - seg = self._merge_bu(seg) - try: - seg = self._merge_yi(seg) - except: - print("_merge_yi failed") - seg = self._merge_reduplication(seg) - seg = self._merge_continuous_three_tones(seg) - seg = self._merge_continuous_three_tones_2(seg) - seg = self._merge_er(seg) - return seg - - def modified_tone(self, word: str, pos: str, - finals: List[str]) -> List[str]: - finals = self._bu_sandhi(word, finals) - finals = self._yi_sandhi(word, finals) - finals = self._neural_sandhi(word, pos, finals) - finals = self._three_sandhi(word, finals) - return finals diff --git a/spaces/YONG627/456123/yolov5-code-main/models/yolo.py b/spaces/YONG627/456123/yolov5-code-main/models/yolo.py deleted file mode 100644 index 9aac71f0570471c3e882603e337da87df6d40ebb..0000000000000000000000000000000000000000 --- a/spaces/YONG627/456123/yolov5-code-main/models/yolo.py +++ /dev/null @@ -1,400 +0,0 @@ -# YOLOv5 🚀 by Ultralytics, GPL-3.0 license -""" -YOLO-specific modules - -Usage: - $ python models/yolo.py --cfg yolov5s.yaml -""" - -import argparse -import contextlib -import os -import platform -import sys -from copy import deepcopy -from pathlib import Path - -FILE = Path(__file__).resolve() -ROOT = FILE.parents[1] # YOLOv5 root directory -if str(ROOT) not in sys.path: - sys.path.append(str(ROOT)) # add ROOT to PATH -if platform.system() != 'Windows': - ROOT = Path(os.path.relpath(ROOT, Path.cwd())) # relative - -from models.common import * -from models.experimental import * -from utils.autoanchor import check_anchor_order -from utils.general import LOGGER, check_version, check_yaml, make_divisible, print_args -from utils.plots import feature_visualization -from utils.torch_utils import (fuse_conv_and_bn, initialize_weights, model_info, profile, scale_img, select_device, - time_sync) - -try: - import thop # for FLOPs computation -except ImportError: - thop = None - - -class Detect(nn.Module): - # YOLOv5 Detect head for detection models - stride = None # strides computed during build - dynamic = False # force grid reconstruction - export = False # export mode - - def __init__(self, nc=80, anchors=(), ch=(), inplace=True): # detection layer - super().__init__() - self.nc = nc # number of classes - self.no = nc + 5 # number of outputs per anchor - self.nl = len(anchors) # number of detection layers - self.na = len(anchors[0]) // 2 # number of anchors - self.grid = [torch.empty(0) for _ in range(self.nl)] # init grid - self.anchor_grid = [torch.empty(0) for _ in range(self.nl)] # init anchor grid - self.register_buffer('anchors', torch.tensor(anchors).float().view(self.nl, -1, 2)) # shape(nl,na,2) - self.m = nn.ModuleList(nn.Conv2d(x, self.no * self.na, 1) for x in ch) # output conv - self.inplace = inplace # use inplace ops (e.g. slice assignment) - - def forward(self, x): - z = [] # inference output - for i in range(self.nl): - x[i] = self.m[i](x[i]) # conv - bs, _, ny, nx = x[i].shape # x(bs,255,20,20) to x(bs,3,20,20,85) - x[i] = x[i].view(bs, self.na, self.no, ny, nx).permute(0, 1, 3, 4, 2).contiguous() - - if not self.training: # inference - if self.dynamic or self.grid[i].shape[2:4] != x[i].shape[2:4]: - self.grid[i], self.anchor_grid[i] = self._make_grid(nx, ny, i) - - if isinstance(self, Segment): # (boxes + masks) - xy, wh, conf, mask = x[i].split((2, 2, self.nc + 1, self.no - self.nc - 5), 4) - xy = (xy.sigmoid() * 2 + self.grid[i]) * self.stride[i] # xy - wh = (wh.sigmoid() * 2) ** 2 * self.anchor_grid[i] # wh - y = torch.cat((xy, wh, conf.sigmoid(), mask), 4) - else: # Detect (boxes only) - xy, wh, conf = x[i].sigmoid().split((2, 2, self.nc + 1), 4) - xy = (xy * 2 + self.grid[i]) * self.stride[i] # xy - wh = (wh * 2) ** 2 * self.anchor_grid[i] # wh - y = torch.cat((xy, wh, conf), 4) - z.append(y.view(bs, self.na * nx * ny, self.no)) - - return x if self.training else (torch.cat(z, 1),) if self.export else (torch.cat(z, 1), x) - - def _make_grid(self, nx=20, ny=20, i=0, torch_1_10=check_version(torch.__version__, '1.10.0')): - d = self.anchors[i].device - t = self.anchors[i].dtype - shape = 1, self.na, ny, nx, 2 # grid shape - y, x = torch.arange(ny, device=d, dtype=t), torch.arange(nx, device=d, dtype=t) - yv, xv = torch.meshgrid(y, x, indexing='ij') if torch_1_10 else torch.meshgrid(y, x) # torch>=0.7 compatibility - grid = torch.stack((xv, yv), 2).expand(shape) - 0.5 # add grid offset, i.e. y = 2.0 * x - 0.5 - anchor_grid = (self.anchors[i] * self.stride[i]).view((1, self.na, 1, 1, 2)).expand(shape) - return grid, anchor_grid - - -class Segment(Detect): - # YOLOv5 Segment head for segmentation models - def __init__(self, nc=80, anchors=(), nm=32, npr=256, ch=(), inplace=True): - super().__init__(nc, anchors, ch, inplace) - self.nm = nm # number of masks - self.npr = npr # number of protos - self.no = 5 + nc + self.nm # number of outputs per anchor - self.m = nn.ModuleList(nn.Conv2d(x, self.no * self.na, 1) for x in ch) # output conv - self.proto = Proto(ch[0], self.npr, self.nm) # protos - self.detect = Detect.forward - - def forward(self, x): - p = self.proto(x[0]) - x = self.detect(self, x) - return (x, p) if self.training else (x[0], p) if self.export else (x[0], p, x[1]) - - -class BaseModel(nn.Module): - # YOLOv5 base model - def forward(self, x, profile=False, visualize=False): - return self._forward_once(x, profile, visualize) # single-scale inference, train - - def _forward_once(self, x, profile=False, visualize=False): - y, dt = [], [] # outputs - for m in self.model: - if m.f != -1: # if not from previous layer - x = y[m.f] if isinstance(m.f, int) else [x if j == -1 else y[j] for j in m.f] # from earlier layers - if profile: - self._profile_one_layer(m, x, dt) - x = m(x) # run - y.append(x if m.i in self.save else None) # save output - if visualize: - feature_visualization(x, m.type, m.i, save_dir=visualize) - return x - - def _profile_one_layer(self, m, x, dt): - c = m == self.model[-1] # is final layer, copy input as inplace fix - o = thop.profile(m, inputs=(x.copy() if c else x,), verbose=False)[0] / 1E9 * 2 if thop else 0 # FLOPs - t = time_sync() - for _ in range(10): - m(x.copy() if c else x) - dt.append((time_sync() - t) * 100) - if m == self.model[0]: - LOGGER.info(f"{'time (ms)':>10s} {'GFLOPs':>10s} {'params':>10s} module") - LOGGER.info(f'{dt[-1]:10.2f} {o:10.2f} {m.np:10.0f} {m.type}') - if c: - LOGGER.info(f"{sum(dt):10.2f} {'-':>10s} {'-':>10s} Total") - - def fuse(self): # fuse model Conv2d() + BatchNorm2d() layers - LOGGER.info('Fusing layers... ') - for m in self.model.modules(): - if isinstance(m, (Conv, DWConv)) and hasattr(m, 'bn'): - m.conv = fuse_conv_and_bn(m.conv, m.bn) # update conv - delattr(m, 'bn') # remove batchnorm - m.forward = m.forward_fuse # update forward - self.info() - return self - - def info(self, verbose=False, img_size=640): # print model information - model_info(self, verbose, img_size) - - def _apply(self, fn): - # Apply to(), cpu(), cuda(), half() to model tensors that are not parameters or registered buffers - self = super()._apply(fn) - m = self.model[-1] # Detect() - if isinstance(m, (Detect, Segment)): - m.stride = fn(m.stride) - m.grid = list(map(fn, m.grid)) - if isinstance(m.anchor_grid, list): - m.anchor_grid = list(map(fn, m.anchor_grid)) - return self - - -class DetectionModel(BaseModel): - # YOLOv5 detection model - def __init__(self, cfg='yolov5s.yaml', ch=3, nc=None, anchors=None): # model, input channels, number of classes - super().__init__() - if isinstance(cfg, dict): - self.yaml = cfg # model dict - else: # is *.yaml - import yaml # for torch hub - self.yaml_file = Path(cfg).name - with open(cfg, encoding='ascii', errors='ignore') as f: - self.yaml = yaml.safe_load(f) # model dict - - # Define model - ch = self.yaml['ch'] = self.yaml.get('ch', ch) # input channels - if nc and nc != self.yaml['nc']: - LOGGER.info(f"Overriding model.yaml nc={self.yaml['nc']} with nc={nc}") - self.yaml['nc'] = nc # override yaml value - if anchors: - LOGGER.info(f'Overriding model.yaml anchors with anchors={anchors}') - self.yaml['anchors'] = round(anchors) # override yaml value - self.model, self.save = parse_model(deepcopy(self.yaml), ch=[ch]) # model, savelist - self.names = [str(i) for i in range(self.yaml['nc'])] # default names - self.inplace = self.yaml.get('inplace', True) - - # Build strides, anchors - m = self.model[-1] # Detect() - if isinstance(m, (Detect, Segment)): - s = 256 # 2x min stride - m.inplace = self.inplace - forward = lambda x: self.forward(x)[0] if isinstance(m, Segment) else self.forward(x) - m.stride = torch.tensor([s / x.shape[-2] for x in forward(torch.zeros(1, ch, s, s))]) # forward - check_anchor_order(m) - m.anchors /= m.stride.view(-1, 1, 1) - self.stride = m.stride - self._initialize_biases() # only run once - - # Init weights, biases - initialize_weights(self) - self.info() - LOGGER.info('') - - def forward(self, x, augment=False, profile=False, visualize=False): - if augment: - return self._forward_augment(x) # augmented inference, None - return self._forward_once(x, profile, visualize) # single-scale inference, train - - def _forward_augment(self, x): - img_size = x.shape[-2:] # height, width - s = [1, 0.83, 0.67] # scales - f = [None, 3, None] # flips (2-ud, 3-lr) - y = [] # outputs - for si, fi in zip(s, f): - xi = scale_img(x.flip(fi) if fi else x, si, gs=int(self.stride.max())) - yi = self._forward_once(xi)[0] # forward - # cv2.imwrite(f'img_{si}.jpg', 255 * xi[0].cpu().numpy().transpose((1, 2, 0))[:, :, ::-1]) # save - yi = self._descale_pred(yi, fi, si, img_size) - y.append(yi) - y = self._clip_augmented(y) # clip augmented tails - return torch.cat(y, 1), None # augmented inference, train - - def _descale_pred(self, p, flips, scale, img_size): - # de-scale predictions following augmented inference (inverse operation) - if self.inplace: - p[..., :4] /= scale # de-scale - if flips == 2: - p[..., 1] = img_size[0] - p[..., 1] # de-flip ud - elif flips == 3: - p[..., 0] = img_size[1] - p[..., 0] # de-flip lr - else: - x, y, wh = p[..., 0:1] / scale, p[..., 1:2] / scale, p[..., 2:4] / scale # de-scale - if flips == 2: - y = img_size[0] - y # de-flip ud - elif flips == 3: - x = img_size[1] - x # de-flip lr - p = torch.cat((x, y, wh, p[..., 4:]), -1) - return p - - def _clip_augmented(self, y): - # Clip YOLOv5 augmented inference tails - nl = self.model[-1].nl # number of detection layers (P3-P5) - g = sum(4 ** x for x in range(nl)) # grid points - e = 1 # exclude layer count - i = (y[0].shape[1] // g) * sum(4 ** x for x in range(e)) # indices - y[0] = y[0][:, :-i] # large - i = (y[-1].shape[1] // g) * sum(4 ** (nl - 1 - x) for x in range(e)) # indices - y[-1] = y[-1][:, i:] # small - return y - - def _initialize_biases(self, cf=None): # initialize biases into Detect(), cf is class frequency - # https://arxiv.org/abs/1708.02002 section 3.3 - # cf = torch.bincount(torch.tensor(np.concatenate(dataset.labels, 0)[:, 0]).long(), minlength=nc) + 1. - m = self.model[-1] # Detect() module - for mi, s in zip(m.m, m.stride): # from - b = mi.bias.view(m.na, -1) # conv.bias(255) to (3,85) - b.data[:, 4] += math.log(8 / (640 / s) ** 2) # obj (8 objects per 640 image) - b.data[:, 5:5 + m.nc] += math.log(0.6 / (m.nc - 0.99999)) if cf is None else torch.log(cf / cf.sum()) # cls - mi.bias = torch.nn.Parameter(b.view(-1), requires_grad=True) - - -Model = DetectionModel # retain YOLOv5 'Model' class for backwards compatibility - - -class SegmentationModel(DetectionModel): - # YOLOv5 segmentation model - def __init__(self, cfg='yolov5s-seg.yaml', ch=3, nc=None, anchors=None): - super().__init__(cfg, ch, nc, anchors) - - -class ClassificationModel(BaseModel): - # YOLOv5 classification model - def __init__(self, cfg=None, model=None, nc=1000, cutoff=10): # yaml, model, number of classes, cutoff index - super().__init__() - self._from_detection_model(model, nc, cutoff) if model is not None else self._from_yaml(cfg) - - def _from_detection_model(self, model, nc=1000, cutoff=10): - # Create a YOLOv5 classification model from a YOLOv5 detection model - if isinstance(model, DetectMultiBackend): - model = model.model # unwrap DetectMultiBackend - model.model = model.model[:cutoff] # backbone - m = model.model[-1] # last layer - ch = m.conv.in_channels if hasattr(m, 'conv') else m.cv1.conv.in_channels # ch into module - c = Classify(ch, nc) # Classify() - c.i, c.f, c.type = m.i, m.f, 'models.common.Classify' # index, from, type - model.model[-1] = c # replace - self.model = model.model - self.stride = model.stride - self.save = [] - self.nc = nc - - def _from_yaml(self, cfg): - # Create a YOLOv5 classification model from a *.yaml file - self.model = None - - -def parse_model(d, ch): # model_dict, input_channels(3) - # Parse a YOLOv5 model.yaml dictionary - LOGGER.info(f"\n{'':>3}{'from':>18}{'n':>3}{'params':>10} {'module':<40}{'arguments':<30}") - anchors, nc, gd, gw, act = d['anchors'], d['nc'], d['depth_multiple'], d['width_multiple'], d.get('activation') - if act: - Conv.default_act = eval(act) # redefine default activation, i.e. Conv.default_act = nn.SiLU() - LOGGER.info(f"{colorstr('activation:')} {act}") # print - na = (len(anchors[0]) // 2) if isinstance(anchors, list) else anchors # number of anchors - no = na * (nc + 5) # number of outputs = anchors * (classes + 5) - - layers, save, c2 = [], [], ch[-1] # layers, savelist, ch out - for i, (f, n, m, args) in enumerate(d['backbone'] + d['head']): # from, number, module, args - m = eval(m) if isinstance(m, str) else m # eval strings - for j, a in enumerate(args): - with contextlib.suppress(NameError): - args[j] = eval(a) if isinstance(a, str) else a # eval strings - - n = n_ = max(round(n * gd), 1) if n > 1 else n # depth gain - if m in { - Conv, GhostConv, Bottleneck, GhostBottleneck, SPP, SPPF, DWConv, MixConv2d, Focus, CrossConv, - BottleneckCSP, C3, C3TR, C3SPP, C3Ghost, nn.ConvTranspose2d, DWConvTranspose2d, C3x, C2f}: - c1, c2 = ch[f], args[0] - if c2 != no: # if not output - c2 = make_divisible(c2 * gw, 8) - - args = [c1, c2, *args[1:]] - if m in {BottleneckCSP, C3, C3TR, C3Ghost, C3x, C2f}: - args.insert(2, n) # number of repeats - n = 1 - elif m is nn.BatchNorm2d: - args = [ch[f]] - elif m is Concat: - c2 = sum(ch[x] for x in f) - # TODO: channel, gw, gd - elif m in {Detect, Segment}: - args.append([ch[x] for x in f]) - if isinstance(args[1], int): # number of anchors - args[1] = [list(range(args[1] * 2))] * len(f) - if m is Segment: - args[3] = make_divisible(args[3] * gw, 8) - elif m is Contract: - c2 = ch[f] * args[0] ** 2 - elif m is Expand: - c2 = ch[f] // args[0] ** 2 - elif m is SE: - c1 = ch[f] - c2 = args[0] - if c2 != no: # if not output - c2 = make_divisible(c2 * gw, 8) - args = [c1, args[1]] - elif m is MobileNetV3: - c2 = args[0] - args = args[1:] - else: - c2 = ch[f] - - m_ = nn.Sequential(*(m(*args) for _ in range(n))) if n > 1 else m(*args) # module - t = str(m)[8:-2].replace('__main__.', '') # module type - np = sum(x.numel() for x in m_.parameters()) # number params - m_.i, m_.f, m_.type, m_.np = i, f, t, np # attach index, 'from' index, type, number params - LOGGER.info(f'{i:>3}{str(f):>18}{n_:>3}{np:10.0f} {t:<40}{str(args):<30}') # print - save.extend(x % i for x in ([f] if isinstance(f, int) else f) if x != -1) # append to savelist - layers.append(m_) - if i == 0: - ch = [] - ch.append(c2) - return nn.Sequential(*layers), sorted(save) - - -if __name__ == '__main__': - parser = argparse.ArgumentParser() - parser.add_argument('--cfg', type=str, default='yolov5s.yaml', help='model.yaml') - parser.add_argument('--batch-size', type=int, default=1, help='total batch size for all GPUs') - parser.add_argument('--device', default='', help='cuda device, i.e. 0 or 0,1,2,3 or cpu') - parser.add_argument('--profile', action='store_true', help='profile model speed') - parser.add_argument('--line-profile', action='store_true', help='profile model speed layer by layer') - parser.add_argument('--test', action='store_true', help='test all yolo*.yaml') - opt = parser.parse_args() - opt.cfg = check_yaml(opt.cfg) # check YAML - print_args(vars(opt)) - device = select_device(opt.device) - - # Create model - im = torch.rand(opt.batch_size, 3, 640, 640).to(device) - model = Model(opt.cfg).to(device) - - # Options - if opt.line_profile: # profile layer by layer - model(im, profile=True) - - elif opt.profile: # profile forward-backward - results = profile(input=im, ops=[model], n=3) - - elif opt.test: # test all models - for cfg in Path(ROOT / 'models').rglob('yolo*.yaml'): - try: - _ = Model(cfg) - except Exception as e: - print(f'Error in {cfg}: {e}') - - else: # report fused model summary - model.fuse() diff --git a/spaces/YeOldHermit/Super-Resolution-Anime-Diffusion/diffusers/onnx_utils.py b/spaces/YeOldHermit/Super-Resolution-Anime-Diffusion/diffusers/onnx_utils.py deleted file mode 100644 index b2c533ed741f213c28df8d917702e8400a199443..0000000000000000000000000000000000000000 --- a/spaces/YeOldHermit/Super-Resolution-Anime-Diffusion/diffusers/onnx_utils.py +++ /dev/null @@ -1,213 +0,0 @@ -# coding=utf-8 -# Copyright 2022 The HuggingFace Inc. team. -# Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - - -import os -import shutil -from pathlib import Path -from typing import Optional, Union - -import numpy as np - -from huggingface_hub import hf_hub_download - -from .utils import ONNX_EXTERNAL_WEIGHTS_NAME, ONNX_WEIGHTS_NAME, is_onnx_available, logging - - -if is_onnx_available(): - import onnxruntime as ort - - -logger = logging.get_logger(__name__) - -ORT_TO_NP_TYPE = { - "tensor(bool)": np.bool_, - "tensor(int8)": np.int8, - "tensor(uint8)": np.uint8, - "tensor(int16)": np.int16, - "tensor(uint16)": np.uint16, - "tensor(int32)": np.int32, - "tensor(uint32)": np.uint32, - "tensor(int64)": np.int64, - "tensor(uint64)": np.uint64, - "tensor(float16)": np.float16, - "tensor(float)": np.float32, - "tensor(double)": np.float64, -} - - -class OnnxRuntimeModel: - def __init__(self, model=None, **kwargs): - logger.info("`diffusers.OnnxRuntimeModel` is experimental and might change in the future.") - self.model = model - self.model_save_dir = kwargs.get("model_save_dir", None) - self.latest_model_name = kwargs.get("latest_model_name", ONNX_WEIGHTS_NAME) - - def __call__(self, **kwargs): - inputs = {k: np.array(v) for k, v in kwargs.items()} - return self.model.run(None, inputs) - - @staticmethod - def load_model(path: Union[str, Path], provider=None, sess_options=None): - """ - Loads an ONNX Inference session with an ExecutionProvider. Default provider is `CPUExecutionProvider` - - Arguments: - path (`str` or `Path`): - Directory from which to load - provider(`str`, *optional*): - Onnxruntime execution provider to use for loading the model, defaults to `CPUExecutionProvider` - """ - if provider is None: - logger.info("No onnxruntime provider specified, using CPUExecutionProvider") - provider = "CPUExecutionProvider" - - return ort.InferenceSession(path, providers=[provider], sess_options=sess_options) - - def _save_pretrained(self, save_directory: Union[str, Path], file_name: Optional[str] = None, **kwargs): - """ - Save a model and its configuration file to a directory, so that it can be re-loaded using the - [`~optimum.onnxruntime.modeling_ort.ORTModel.from_pretrained`] class method. It will always save the - latest_model_name. - - Arguments: - save_directory (`str` or `Path`): - Directory where to save the model file. - file_name(`str`, *optional*): - Overwrites the default model file name from `"model.onnx"` to `file_name`. This allows you to save the - model with a different name. - """ - model_file_name = file_name if file_name is not None else ONNX_WEIGHTS_NAME - - src_path = self.model_save_dir.joinpath(self.latest_model_name) - dst_path = Path(save_directory).joinpath(model_file_name) - try: - shutil.copyfile(src_path, dst_path) - except shutil.SameFileError: - pass - - # copy external weights (for models >2GB) - src_path = self.model_save_dir.joinpath(ONNX_EXTERNAL_WEIGHTS_NAME) - if src_path.exists(): - dst_path = Path(save_directory).joinpath(ONNX_EXTERNAL_WEIGHTS_NAME) - try: - shutil.copyfile(src_path, dst_path) - except shutil.SameFileError: - pass - - def save_pretrained( - self, - save_directory: Union[str, os.PathLike], - **kwargs, - ): - """ - Save a model to a directory, so that it can be re-loaded using the [`~OnnxModel.from_pretrained`] class - method.: - - Arguments: - save_directory (`str` or `os.PathLike`): - Directory to which to save. Will be created if it doesn't exist. - """ - if os.path.isfile(save_directory): - logger.error(f"Provided path ({save_directory}) should be a directory, not a file") - return - - os.makedirs(save_directory, exist_ok=True) - - # saving model weights/files - self._save_pretrained(save_directory, **kwargs) - - @classmethod - def _from_pretrained( - cls, - model_id: Union[str, Path], - use_auth_token: Optional[Union[bool, str, None]] = None, - revision: Optional[Union[str, None]] = None, - force_download: bool = False, - cache_dir: Optional[str] = None, - file_name: Optional[str] = None, - provider: Optional[str] = None, - sess_options: Optional["ort.SessionOptions"] = None, - **kwargs, - ): - """ - Load a model from a directory or the HF Hub. - - Arguments: - model_id (`str` or `Path`): - Directory from which to load - use_auth_token (`str` or `bool`): - Is needed to load models from a private or gated repository - revision (`str`): - Revision is the specific model version to use. It can be a branch name, a tag name, or a commit id - cache_dir (`Union[str, Path]`, *optional*): - Path to a directory in which a downloaded pretrained model configuration should be cached if the - standard cache should not be used. - force_download (`bool`, *optional*, defaults to `False`): - Whether or not to force the (re-)download of the model weights and configuration files, overriding the - cached versions if they exist. - file_name(`str`): - Overwrites the default model file name from `"model.onnx"` to `file_name`. This allows you to load - different model files from the same repository or directory. - provider(`str`): - The ONNX runtime provider, e.g. `CPUExecutionProvider` or `CUDAExecutionProvider`. - kwargs (`Dict`, *optional*): - kwargs will be passed to the model during initialization - """ - model_file_name = file_name if file_name is not None else ONNX_WEIGHTS_NAME - # load model from local directory - if os.path.isdir(model_id): - model = OnnxRuntimeModel.load_model( - os.path.join(model_id, model_file_name), provider=provider, sess_options=sess_options - ) - kwargs["model_save_dir"] = Path(model_id) - # load model from hub - else: - # download model - model_cache_path = hf_hub_download( - repo_id=model_id, - filename=model_file_name, - use_auth_token=use_auth_token, - revision=revision, - cache_dir=cache_dir, - force_download=force_download, - ) - kwargs["model_save_dir"] = Path(model_cache_path).parent - kwargs["latest_model_name"] = Path(model_cache_path).name - model = OnnxRuntimeModel.load_model(model_cache_path, provider=provider, sess_options=sess_options) - return cls(model=model, **kwargs) - - @classmethod - def from_pretrained( - cls, - model_id: Union[str, Path], - force_download: bool = True, - use_auth_token: Optional[str] = None, - cache_dir: Optional[str] = None, - **model_kwargs, - ): - revision = None - if len(str(model_id).split("@")) == 2: - model_id, revision = model_id.split("@") - - return cls._from_pretrained( - model_id=model_id, - revision=revision, - cache_dir=cache_dir, - force_download=force_download, - use_auth_token=use_auth_token, - **model_kwargs, - ) diff --git a/spaces/YlcldKlns/bing/src/app/page.tsx b/spaces/YlcldKlns/bing/src/app/page.tsx deleted file mode 100644 index 0dff3431b098ce4fe282cc83fc87a93a28a43090..0000000000000000000000000000000000000000 --- a/spaces/YlcldKlns/bing/src/app/page.tsx +++ /dev/null @@ -1,15 +0,0 @@ -import dynamic from 'next/dynamic' - -const DynamicComponentWithNoSSR = dynamic( - () => import('../components/chat'), - { ssr: false } -) - -export default function IndexPage() { - return ( - <> -
      - - - ) -} diff --git a/spaces/YueMafighting/mmpose-estimation/Dockerfile b/spaces/YueMafighting/mmpose-estimation/Dockerfile deleted file mode 100644 index 179cb796c6794ff2784589d3b873ff0ad24e370d..0000000000000000000000000000000000000000 --- a/spaces/YueMafighting/mmpose-estimation/Dockerfile +++ /dev/null @@ -1,63 +0,0 @@ -# FROM nvidia/cuda:11.7.1-cudnn8-devel-ubuntu22.04 -# ENV DEBIAN_FRONTEND=noninteractive -# RUN apt-get update && \ -# apt-get upgrade -y && \ -# apt-get install -y --no-install-recommends \ -# git \ -# zip \ -# unzip \ -# git-lfs \ -# wget \ -# curl \ -# # ffmpeg \ -# ffmpeg \ -# x264 \ -# # python build dependencies \ -# build-essential \ -# libssl-dev \ -# zlib1g-dev \ -# libbz2-dev \ -# libreadline-dev \ -# libsqlite3-dev \ -# libncursesw5-dev \ -# xz-utils \ -# tk-dev \ -# libxml2-dev \ -# libxmlsec1-dev \ -# libffi-dev \ -# liblzma-dev && \ -# apt-get clean && \ -# rm -rf /var/lib/apt/lists/* -# # RUN apt-get update && \ -# # apt-get install zip -# # RUN wget https://github.com/ChenyangQiQi/FateZero/releases/download/v0.0.1/style.zip && unzip style.zip -# RUN useradd -m -u 1000 user -# USER user -# ENV HOME=/home/user \ -# PATH=/home/user/.local/bin:${PATH} -# WORKDIR ${HOME}/app - -# RUN curl https://pyenv.run | bash -# ENV PATH=${HOME}/.pyenv/shims:${HOME}/.pyenv/bin:${PATH} -# ENV PYTHON_VERSION=3.10.9 -# RUN pyenv install ${PYTHON_VERSION} && \ -# pyenv global ${PYTHON_VERSION} && \ -# pyenv rehash && \ -# pip install --no-cache-dir -U pip setuptools wheel - -# RUN pip install --no-cache-dir -U torch==1.13.1 torchvision==0.14.1 -# COPY --chown=1000 requirements.txt /tmp/requirements.txt -# RUN pip install --no-cache-dir -U -r /tmp/requirements.txt - -# COPY --chown=1000 . ${HOME}/app -# RUN ls -a -# # RUN cd ./FateZero/ckpt && bash download.sh -# # RUN cd ./FateZero/data && bash download.sh -# # ENV PYTHONPATH=${HOME}/app \ -# # PYTHONUNBUFFERED=1 \ -# # GRADIO_ALLOW_FLAGGING=never \ -# # GRADIO_NUM_PORTS=1 \ -# # GRADIO_SERVER_NAME=0.0.0.0 \ -# # GRADIO_THEME=huggingface \ -# # SYSTEM=spaces -# # CMD ["python", "app_fatezero.py"] diff --git a/spaces/Yusin/ChatGPT-Speech/modules.py b/spaces/Yusin/ChatGPT-Speech/modules.py deleted file mode 100644 index f5af1fd9a20dc03707889f360a39bb4b784a6df3..0000000000000000000000000000000000000000 --- a/spaces/Yusin/ChatGPT-Speech/modules.py +++ /dev/null @@ -1,387 +0,0 @@ -import math -import torch -from torch import nn -from torch.nn import functional as F - -from torch.nn import Conv1d -from torch.nn.utils import weight_norm, remove_weight_norm - -import commons -from commons import init_weights, get_padding -from transforms import piecewise_rational_quadratic_transform - - -LRELU_SLOPE = 0.1 - - -class LayerNorm(nn.Module): - def __init__(self, channels, eps=1e-5): - super().__init__() - self.channels = channels - self.eps = eps - - self.gamma = nn.Parameter(torch.ones(channels)) - self.beta = nn.Parameter(torch.zeros(channels)) - - def forward(self, x): - x = x.transpose(1, -1) - x = F.layer_norm(x, (self.channels,), self.gamma, self.beta, self.eps) - return x.transpose(1, -1) - - -class ConvReluNorm(nn.Module): - def __init__(self, in_channels, hidden_channels, out_channels, kernel_size, n_layers, p_dropout): - super().__init__() - self.in_channels = in_channels - self.hidden_channels = hidden_channels - self.out_channels = out_channels - self.kernel_size = kernel_size - self.n_layers = n_layers - self.p_dropout = p_dropout - assert n_layers > 1, "Number of layers should be larger than 0." - - self.conv_layers = nn.ModuleList() - self.norm_layers = nn.ModuleList() - self.conv_layers.append(nn.Conv1d(in_channels, hidden_channels, kernel_size, padding=kernel_size//2)) - self.norm_layers.append(LayerNorm(hidden_channels)) - self.relu_drop = nn.Sequential( - nn.ReLU(), - nn.Dropout(p_dropout)) - for _ in range(n_layers-1): - self.conv_layers.append(nn.Conv1d(hidden_channels, hidden_channels, kernel_size, padding=kernel_size//2)) - self.norm_layers.append(LayerNorm(hidden_channels)) - self.proj = nn.Conv1d(hidden_channels, out_channels, 1) - self.proj.weight.data.zero_() - self.proj.bias.data.zero_() - - def forward(self, x, x_mask): - x_org = x - for i in range(self.n_layers): - x = self.conv_layers[i](x * x_mask) - x = self.norm_layers[i](x) - x = self.relu_drop(x) - x = x_org + self.proj(x) - return x * x_mask - - -class DDSConv(nn.Module): - """ - Dialted and Depth-Separable Convolution - """ - def __init__(self, channels, kernel_size, n_layers, p_dropout=0.): - super().__init__() - self.channels = channels - self.kernel_size = kernel_size - self.n_layers = n_layers - self.p_dropout = p_dropout - - self.drop = nn.Dropout(p_dropout) - self.convs_sep = nn.ModuleList() - self.convs_1x1 = nn.ModuleList() - self.norms_1 = nn.ModuleList() - self.norms_2 = nn.ModuleList() - for i in range(n_layers): - dilation = kernel_size ** i - padding = (kernel_size * dilation - dilation) // 2 - self.convs_sep.append(nn.Conv1d(channels, channels, kernel_size, - groups=channels, dilation=dilation, padding=padding - )) - self.convs_1x1.append(nn.Conv1d(channels, channels, 1)) - self.norms_1.append(LayerNorm(channels)) - self.norms_2.append(LayerNorm(channels)) - - def forward(self, x, x_mask, g=None): - if g is not None: - x = x + g - for i in range(self.n_layers): - y = self.convs_sep[i](x * x_mask) - y = self.norms_1[i](y) - y = F.gelu(y) - y = self.convs_1x1[i](y) - y = self.norms_2[i](y) - y = F.gelu(y) - y = self.drop(y) - x = x + y - return x * x_mask - - -class WN(torch.nn.Module): - def __init__(self, hidden_channels, kernel_size, dilation_rate, n_layers, gin_channels=0, p_dropout=0): - super(WN, self).__init__() - assert(kernel_size % 2 == 1) - self.hidden_channels =hidden_channels - self.kernel_size = kernel_size, - self.dilation_rate = dilation_rate - self.n_layers = n_layers - self.gin_channels = gin_channels - self.p_dropout = p_dropout - - self.in_layers = torch.nn.ModuleList() - self.res_skip_layers = torch.nn.ModuleList() - self.drop = nn.Dropout(p_dropout) - - if gin_channels != 0: - cond_layer = torch.nn.Conv1d(gin_channels, 2*hidden_channels*n_layers, 1) - self.cond_layer = torch.nn.utils.weight_norm(cond_layer, name='weight') - - for i in range(n_layers): - dilation = dilation_rate ** i - padding = int((kernel_size * dilation - dilation) / 2) - in_layer = torch.nn.Conv1d(hidden_channels, 2*hidden_channels, kernel_size, - dilation=dilation, padding=padding) - in_layer = torch.nn.utils.weight_norm(in_layer, name='weight') - self.in_layers.append(in_layer) - - # last one is not necessary - if i < n_layers - 1: - res_skip_channels = 2 * hidden_channels - else: - res_skip_channels = hidden_channels - - res_skip_layer = torch.nn.Conv1d(hidden_channels, res_skip_channels, 1) - res_skip_layer = torch.nn.utils.weight_norm(res_skip_layer, name='weight') - self.res_skip_layers.append(res_skip_layer) - - def forward(self, x, x_mask, g=None, **kwargs): - output = torch.zeros_like(x) - n_channels_tensor = torch.IntTensor([self.hidden_channels]) - - if g is not None: - g = self.cond_layer(g) - - for i in range(self.n_layers): - x_in = self.in_layers[i](x) - if g is not None: - cond_offset = i * 2 * self.hidden_channels - g_l = g[:,cond_offset:cond_offset+2*self.hidden_channels,:] - else: - g_l = torch.zeros_like(x_in) - - acts = commons.fused_add_tanh_sigmoid_multiply( - x_in, - g_l, - n_channels_tensor) - acts = self.drop(acts) - - res_skip_acts = self.res_skip_layers[i](acts) - if i < self.n_layers - 1: - res_acts = res_skip_acts[:,:self.hidden_channels,:] - x = (x + res_acts) * x_mask - output = output + res_skip_acts[:,self.hidden_channels:,:] - else: - output = output + res_skip_acts - return output * x_mask - - def remove_weight_norm(self): - if self.gin_channels != 0: - torch.nn.utils.remove_weight_norm(self.cond_layer) - for l in self.in_layers: - torch.nn.utils.remove_weight_norm(l) - for l in self.res_skip_layers: - torch.nn.utils.remove_weight_norm(l) - - -class ResBlock1(torch.nn.Module): - def __init__(self, channels, kernel_size=3, dilation=(1, 3, 5)): - super(ResBlock1, self).__init__() - self.convs1 = nn.ModuleList([ - weight_norm(Conv1d(channels, channels, kernel_size, 1, dilation=dilation[0], - padding=get_padding(kernel_size, dilation[0]))), - weight_norm(Conv1d(channels, channels, kernel_size, 1, dilation=dilation[1], - padding=get_padding(kernel_size, dilation[1]))), - weight_norm(Conv1d(channels, channels, kernel_size, 1, dilation=dilation[2], - padding=get_padding(kernel_size, dilation[2]))) - ]) - self.convs1.apply(init_weights) - - self.convs2 = nn.ModuleList([ - weight_norm(Conv1d(channels, channels, kernel_size, 1, dilation=1, - padding=get_padding(kernel_size, 1))), - weight_norm(Conv1d(channels, channels, kernel_size, 1, dilation=1, - padding=get_padding(kernel_size, 1))), - weight_norm(Conv1d(channels, channels, kernel_size, 1, dilation=1, - padding=get_padding(kernel_size, 1))) - ]) - self.convs2.apply(init_weights) - - def forward(self, x, x_mask=None): - for c1, c2 in zip(self.convs1, self.convs2): - xt = F.leaky_relu(x, LRELU_SLOPE) - if x_mask is not None: - xt = xt * x_mask - xt = c1(xt) - xt = F.leaky_relu(xt, LRELU_SLOPE) - if x_mask is not None: - xt = xt * x_mask - xt = c2(xt) - x = xt + x - if x_mask is not None: - x = x * x_mask - return x - - def remove_weight_norm(self): - for l in self.convs1: - remove_weight_norm(l) - for l in self.convs2: - remove_weight_norm(l) - - -class ResBlock2(torch.nn.Module): - def __init__(self, channels, kernel_size=3, dilation=(1, 3)): - super(ResBlock2, self).__init__() - self.convs = nn.ModuleList([ - weight_norm(Conv1d(channels, channels, kernel_size, 1, dilation=dilation[0], - padding=get_padding(kernel_size, dilation[0]))), - weight_norm(Conv1d(channels, channels, kernel_size, 1, dilation=dilation[1], - padding=get_padding(kernel_size, dilation[1]))) - ]) - self.convs.apply(init_weights) - - def forward(self, x, x_mask=None): - for c in self.convs: - xt = F.leaky_relu(x, LRELU_SLOPE) - if x_mask is not None: - xt = xt * x_mask - xt = c(xt) - x = xt + x - if x_mask is not None: - x = x * x_mask - return x - - def remove_weight_norm(self): - for l in self.convs: - remove_weight_norm(l) - - -class Log(nn.Module): - def forward(self, x, x_mask, reverse=False, **kwargs): - if not reverse: - y = torch.log(torch.clamp_min(x, 1e-5)) * x_mask - logdet = torch.sum(-y, [1, 2]) - return y, logdet - else: - x = torch.exp(x) * x_mask - return x - - -class Flip(nn.Module): - def forward(self, x, *args, reverse=False, **kwargs): - x = torch.flip(x, [1]) - if not reverse: - logdet = torch.zeros(x.size(0)).to(dtype=x.dtype, device=x.device) - return x, logdet - else: - return x - - -class ElementwiseAffine(nn.Module): - def __init__(self, channels): - super().__init__() - self.channels = channels - self.m = nn.Parameter(torch.zeros(channels,1)) - self.logs = nn.Parameter(torch.zeros(channels,1)) - - def forward(self, x, x_mask, reverse=False, **kwargs): - if not reverse: - y = self.m + torch.exp(self.logs) * x - y = y * x_mask - logdet = torch.sum(self.logs * x_mask, [1,2]) - return y, logdet - else: - x = (x - self.m) * torch.exp(-self.logs) * x_mask - return x - - -class ResidualCouplingLayer(nn.Module): - def __init__(self, - channels, - hidden_channels, - kernel_size, - dilation_rate, - n_layers, - p_dropout=0, - gin_channels=0, - mean_only=False): - assert channels % 2 == 0, "channels should be divisible by 2" - super().__init__() - self.channels = channels - self.hidden_channels = hidden_channels - self.kernel_size = kernel_size - self.dilation_rate = dilation_rate - self.n_layers = n_layers - self.half_channels = channels // 2 - self.mean_only = mean_only - - self.pre = nn.Conv1d(self.half_channels, hidden_channels, 1) - self.enc = WN(hidden_channels, kernel_size, dilation_rate, n_layers, p_dropout=p_dropout, gin_channels=gin_channels) - self.post = nn.Conv1d(hidden_channels, self.half_channels * (2 - mean_only), 1) - self.post.weight.data.zero_() - self.post.bias.data.zero_() - - def forward(self, x, x_mask, g=None, reverse=False): - x0, x1 = torch.split(x, [self.half_channels]*2, 1) - h = self.pre(x0) * x_mask - h = self.enc(h, x_mask, g=g) - stats = self.post(h) * x_mask - if not self.mean_only: - m, logs = torch.split(stats, [self.half_channels]*2, 1) - else: - m = stats - logs = torch.zeros_like(m) - - if not reverse: - x1 = m + x1 * torch.exp(logs) * x_mask - x = torch.cat([x0, x1], 1) - logdet = torch.sum(logs, [1,2]) - return x, logdet - else: - x1 = (x1 - m) * torch.exp(-logs) * x_mask - x = torch.cat([x0, x1], 1) - return x - - -class ConvFlow(nn.Module): - def __init__(self, in_channels, filter_channels, kernel_size, n_layers, num_bins=10, tail_bound=5.0): - super().__init__() - self.in_channels = in_channels - self.filter_channels = filter_channels - self.kernel_size = kernel_size - self.n_layers = n_layers - self.num_bins = num_bins - self.tail_bound = tail_bound - self.half_channels = in_channels // 2 - - self.pre = nn.Conv1d(self.half_channels, filter_channels, 1) - self.convs = DDSConv(filter_channels, kernel_size, n_layers, p_dropout=0.) - self.proj = nn.Conv1d(filter_channels, self.half_channels * (num_bins * 3 - 1), 1) - self.proj.weight.data.zero_() - self.proj.bias.data.zero_() - - def forward(self, x, x_mask, g=None, reverse=False): - x0, x1 = torch.split(x, [self.half_channels]*2, 1) - h = self.pre(x0) - h = self.convs(h, x_mask, g=g) - h = self.proj(h) * x_mask - - b, c, t = x0.shape - h = h.reshape(b, c, -1, t).permute(0, 1, 3, 2) # [b, cx?, t] -> [b, c, t, ?] - - unnormalized_widths = h[..., :self.num_bins] / math.sqrt(self.filter_channels) - unnormalized_heights = h[..., self.num_bins:2*self.num_bins] / math.sqrt(self.filter_channels) - unnormalized_derivatives = h[..., 2 * self.num_bins:] - - x1, logabsdet = piecewise_rational_quadratic_transform(x1, - unnormalized_widths, - unnormalized_heights, - unnormalized_derivatives, - inverse=reverse, - tails='linear', - tail_bound=self.tail_bound - ) - - x = torch.cat([x0, x1], 1) * x_mask - logdet = torch.sum(logabsdet * x_mask, [1,2]) - if not reverse: - return x, logdet - else: - return x diff --git a/spaces/abdelrahmantaha/ocr/predict.py b/spaces/abdelrahmantaha/ocr/predict.py deleted file mode 100644 index dcb06e5693d92c86f3b048efa4640d4e43cd479d..0000000000000000000000000000000000000000 --- a/spaces/abdelrahmantaha/ocr/predict.py +++ /dev/null @@ -1,160 +0,0 @@ -import os -import tempfile -import random -import string -from ultralyticsplus import YOLO -import streamlit as st -import numpy as np -import pandas as pd -from process import ( - filter_columns, - extract_text_of_col, - prepare_cols, - process_cols, - finalize_data, -) -from file_utils import ( - get_img, - save_excel_file, - concat_csv, - convert_pdf_to_image, - filter_color, - plot, - delete_file, -) - - - - -class PaddleOCR: - # Load Image Detection model - - def __init__(self, table_version, column_version): - match table_version: - case "v1": - self.table_model = YOLO("model/table.pt") - case "v2": - self.table_model = YOLO("model/table_V3.pt") - match column_version: - case "v1": - self.column_model = YOLO("model/columns.pt") - case "v2": - self.column_model = YOLO("model/column_V3.pt") - - def __call__(self, uploaded, filter=False): - foldername = tempfile.TemporaryDirectory(dir=os.getcwd()) - filename = uploaded.name.split(".")[0] - if uploaded.name.split(".")[1].lower() == "pdf": - pdf_pages = convert_pdf_to_image(uploaded.read()) - for page_enumeration, page in enumerate(pdf_pages, start=1): - self.process_img( - np.asarray(page), - page_enumeration, - filter=filter, - foldername=foldername.name, - filename=filename, - ) - else: - img = get_img(uploaded) - self.process_img( - img, - filter=filter, - foldername=foldername.name, - filename=filename, - ) - - # * concatenate all csv files if many - extra = "".join(random.choices(string.ascii_uppercase, k=5)) - filename = f"{filename}_{extra}.csv" - try: - concat_csv(foldername, filename) - except: - st.warning("No results found") - - foldername.cleanup() - - if os.path.exists(filename): - with open(f"{filename}", "rb") as fp: - st.download_button( - label="Download CSV file", - data=fp, - file_name=filename, - mime="text/csv", - ) - delete_file(filename) - else: - st.warning("No results found") - - def process_img(self, - img, - page_enumeration: int = 0, - filter=False, - foldername: str = "", - filename: str = "", - ): - tables = self.table_model(img, conf=0.75) - tables = tables[0].boxes.xyxy.cpu().numpy() - results = [] - for table in tables: - try: - # * crop the table as an image from the original image - sub_img = img[ - int(table[1].item()) : int(table[3].item()), - int(table[0].item()) : int(table[2].item()), - ] - columns_detect = self.column_model(sub_img, conf=0.5) - cols_data = columns_detect[0].boxes.data.cpu().numpy() - - # * Sort columns according to the x coordinate - cols_data = np.array( - sorted(cols_data, key=lambda x: x[0]), dtype=np.ndarray - ) - - # * merge the duplicated columns - cols_data = filter_columns(cols_data) - st.image(plot(sub_img, cols_data), channels="RGB") - except: - st.warning("No Detection") - - try: - columns = cols_data[:, 0:4] - sub_imgs = [] - for column in columns: - # * Create list of cropped images for each column - sub_imgs.append(sub_img[:, int(column[0]) : int(column[2])]) - cols = [] - thr = 0 - for image in sub_imgs: - if filter: - # * keep only black color in the image - image = filter_color(image) - - # * extract text of each column and get the length threshold - res, threshold = extract_text_of_col(image) - thr += threshold - - # * arrange the rows of each column with respect to row length threshold - cols.append(prepare_cols(res, threshold * 0.6)) - - thr = thr / len(sub_imgs) - - # * append each element in each column to its right place in the dataframe - data = process_cols(cols, thr * 0.6) - - # * merge the related rows together - data: pd.DataFrame = finalize_data(data, page_enumeration) - results.append(data) - except: - st.warning("Text Extraction Failed") - continue - list( - map( - lambda x: save_excel_file( - *x, - foldername, - filename, - page_enumeration, - ), - enumerate(results), - ) - ) \ No newline at end of file diff --git a/spaces/abdvl/datahub_qa_bot/docs/advanced/aspect-versioning.md b/spaces/abdvl/datahub_qa_bot/docs/advanced/aspect-versioning.md deleted file mode 100644 index e398c5c0b2c4117e57bb1633038d918e517e4318..0000000000000000000000000000000000000000 --- a/spaces/abdvl/datahub_qa_bot/docs/advanced/aspect-versioning.md +++ /dev/null @@ -1,47 +0,0 @@ -# Aspect Versioning -As each version of [metadata aspect](../what/aspect.md) is immutable, any update to an existing aspect results in the creation of a new version. Typically one would expect the version number increases sequentially with the largest version number being the latest version, i.e. `v1` (oldest), `v2` (second oldest), ..., `vN` (latest). However, this approach results in major challenges in both rest.li modeling & transaction isolation and therefore requires a rethinking. - -## Rest.li Modeling -As it's common to create dedicated rest.li sub-resources for a specific aspect, e.g. `/datasets/{datasetKey}/ownership`, the concept of versions become an interesting modeling question. Should the sub-resource be a [Simple](https://linkedin.github.io/rest.li/modeling/modeling#simple) or a [Collection](https://linkedin.github.io/rest.li/modeling/modeling#collection) type? - -If Simple, the [GET](https://linkedin.github.io/rest.li/user_guide/restli_server#get) method is expected to return the latest version, and the only way to retrieve non-latest versions is through a custom [ACTION](https://linkedin.github.io/rest.li/user_guide/restli_server#action) method, which is going against the [REST](https://en.wikipedia.org/wiki/Representational_state_transfer) principle. As a result, a Simple sub-resource doesn't seem to a be a good fit. - -If Collection, the version number naturally becomes the key so it's easy to retrieve specific version number using the typical GET method. It's also easy to list all versions using the standard [GET_ALL](https://linkedin.github.io/rest.li/user_guide/restli_server#get_all) method or get a set of versions via [BATCH_GET](https://linkedin.github.io/rest.li/user_guide/restli_server#batch_get). However, Collection resources don't support a simple way to get the latest/largest key directly. To achieve that, one must do one of the following - - - a GET_ALL (assuming descending key order) with a page size of 1 - - a [FINDER](https://linkedin.github.io/rest.li/user_guide/restli_server#finder) with special parameters and a page size of 1 - - a custom ACTION method again - -None of these options seems like a natural way to ask for the latest version of an aspect, which is one of the most common use cases. - -## Transaction Isolation -[Transaction isolation](https://en.wikipedia.org/wiki/Isolation_(database_systems)) is a complex topic so make sure to familiarize yourself with the basics first. - -To support concurrent update of a metadata aspect, the following pseudo DB operations must be run in a single transaction, -``` -1. Retrieve the current max version (Vmax) -2. Write the new value as (Vmax + 1) -``` -Operation 1 above can easily suffer from [Phantom Reads](https://en.wikipedia.org/wiki/Isolation_(database_systems)#Phantom_reads). This subsequently leads to Operation 2 computing the incorrect version and thus overwrites an existing version instead of creating a new one. - -One way to solve this is by enforcing [Serializable](https://en.wikipedia.org/wiki/Isolation_(database_systems)#Serializable) isolation level in DB at the [cost of performance](https://logicalread.com/optimize-mysql-perf-part-2-mc13/#.XjxSRSlKh1N). In reality, very few DB even supports this level of isolation, especially for distributed document stores. It's more common to support [Repeatable Reads](https://en.wikipedia.org/wiki/Isolation_(database_systems)#Repeatable_reads) or [Read Committed](https://en.wikipedia.org/wiki/Isolation_(database_systems)#Read_committed) isolation levels—sadly neither would help in this case. - -Another possible solution is to transactionally keep track of `Vmax` directly in a separate table to avoid the need to compute that through a `select` (thus prevent Phantom Reads). However, cross-table/document/entity transaction is not a feature supported by all distributed document stores, which precludes this as a generalized solution. - -## Solution: Version 0 -The solution to both challenges turns out to be surprisingly simple. Instead of using a "floating" version number to represent the latest version, one can use a "fixed/sentinel" version number instead. In this case we choose Version 0 as we want all non-latest versions to still keep increasing sequentially. In other words, it'd be `v0` (latest), `v1` (oldest), `v2` (second oldest), etc. Alternatively, you can also simply view all the non-zero versions as an audit trail. - -Let's examine how Version 0 can solve the aforementioned challenges. - -### Rest.li Modeling -With Version 0, getting the latest version becomes calling the GET method of a Collection aspect-specific sub-resource with a deterministic key, e.g. `/datasets/{datasetkey}/ownership/0`, which is a lot more natural than using GET_ALL or FINDER. - -### Transaction Isolation -The pseudo DB operations change to the following transaction block with version 0, -``` -1. Retrieve v0 of the aspect -2. Retrieve the current max version (Vmax) -3. Write the old value back as (Vmax + 1) -4. Write the new value back as v0 -``` -While Operation 2 still suffers from potential Phantom Reads and thus corrupting existing version in Operation 3, Repeatable Reads isolation level will ensure that the transaction fails due to [Lost Update](https://codingsight.com/the-lost-update-problem-in-concurrent-transactions/) detected in Operation 4. Note that this happens to also be the [default isolation level](https://dev.mysql.com/doc/refman/8.0/en/innodb-transaction-isolation-levels.html) for InnoDB in MySQL. diff --git a/spaces/abhimanyuniga/chavinlo-gpt4-x-alpaca/Dockerfile b/spaces/abhimanyuniga/chavinlo-gpt4-x-alpaca/Dockerfile deleted file mode 100644 index 94ee76a4f45af463ab7f945633c9258172f9cc80..0000000000000000000000000000000000000000 --- a/spaces/abhimanyuniga/chavinlo-gpt4-x-alpaca/Dockerfile +++ /dev/null @@ -1,2 +0,0 @@ -FROM huggingface/autotrain-advanced:latest -CMD autotrain app --port 7860 diff --git a/spaces/abhishek/sketch-to-image/annotator/uniformer/mmcv/parallel/distributed_deprecated.py b/spaces/abhishek/sketch-to-image/annotator/uniformer/mmcv/parallel/distributed_deprecated.py deleted file mode 100644 index 676937a2085d4da20fa87923041a200fca6214eb..0000000000000000000000000000000000000000 --- a/spaces/abhishek/sketch-to-image/annotator/uniformer/mmcv/parallel/distributed_deprecated.py +++ /dev/null @@ -1,70 +0,0 @@ -# Copyright (c) OpenMMLab. All rights reserved. -import torch -import torch.distributed as dist -import torch.nn as nn -from torch._utils import (_flatten_dense_tensors, _take_tensors, - _unflatten_dense_tensors) - -from annotator.uniformer.mmcv.utils import TORCH_VERSION, digit_version -from .registry import MODULE_WRAPPERS -from .scatter_gather import scatter_kwargs - - -@MODULE_WRAPPERS.register_module() -class MMDistributedDataParallel(nn.Module): - - def __init__(self, - module, - dim=0, - broadcast_buffers=True, - bucket_cap_mb=25): - super(MMDistributedDataParallel, self).__init__() - self.module = module - self.dim = dim - self.broadcast_buffers = broadcast_buffers - - self.broadcast_bucket_size = bucket_cap_mb * 1024 * 1024 - self._sync_params() - - def _dist_broadcast_coalesced(self, tensors, buffer_size): - for tensors in _take_tensors(tensors, buffer_size): - flat_tensors = _flatten_dense_tensors(tensors) - dist.broadcast(flat_tensors, 0) - for tensor, synced in zip( - tensors, _unflatten_dense_tensors(flat_tensors, tensors)): - tensor.copy_(synced) - - def _sync_params(self): - module_states = list(self.module.state_dict().values()) - if len(module_states) > 0: - self._dist_broadcast_coalesced(module_states, - self.broadcast_bucket_size) - if self.broadcast_buffers: - if (TORCH_VERSION != 'parrots' - and digit_version(TORCH_VERSION) < digit_version('1.0')): - buffers = [b.data for b in self.module._all_buffers()] - else: - buffers = [b.data for b in self.module.buffers()] - if len(buffers) > 0: - self._dist_broadcast_coalesced(buffers, - self.broadcast_bucket_size) - - def scatter(self, inputs, kwargs, device_ids): - return scatter_kwargs(inputs, kwargs, device_ids, dim=self.dim) - - def forward(self, *inputs, **kwargs): - inputs, kwargs = self.scatter(inputs, kwargs, - [torch.cuda.current_device()]) - return self.module(*inputs[0], **kwargs[0]) - - def train_step(self, *inputs, **kwargs): - inputs, kwargs = self.scatter(inputs, kwargs, - [torch.cuda.current_device()]) - output = self.module.train_step(*inputs[0], **kwargs[0]) - return output - - def val_step(self, *inputs, **kwargs): - inputs, kwargs = self.scatter(inputs, kwargs, - [torch.cuda.current_device()]) - output = self.module.val_step(*inputs[0], **kwargs[0]) - return output diff --git a/spaces/abhishek/sketch-to-image/annotator/uniformer/mmdet/models/backbones/resnest.py b/spaces/abhishek/sketch-to-image/annotator/uniformer/mmdet/models/backbones/resnest.py deleted file mode 100644 index 48e1d8bfa47348a13f0da0b9ecf32354fa270340..0000000000000000000000000000000000000000 --- a/spaces/abhishek/sketch-to-image/annotator/uniformer/mmdet/models/backbones/resnest.py +++ /dev/null @@ -1,317 +0,0 @@ -import math - -import torch -import torch.nn as nn -import torch.nn.functional as F -import torch.utils.checkpoint as cp -from mmcv.cnn import build_conv_layer, build_norm_layer - -from ..builder import BACKBONES -from ..utils import ResLayer -from .resnet import Bottleneck as _Bottleneck -from .resnet import ResNetV1d - - -class RSoftmax(nn.Module): - """Radix Softmax module in ``SplitAttentionConv2d``. - - Args: - radix (int): Radix of input. - groups (int): Groups of input. - """ - - def __init__(self, radix, groups): - super().__init__() - self.radix = radix - self.groups = groups - - def forward(self, x): - batch = x.size(0) - if self.radix > 1: - x = x.view(batch, self.groups, self.radix, -1).transpose(1, 2) - x = F.softmax(x, dim=1) - x = x.reshape(batch, -1) - else: - x = torch.sigmoid(x) - return x - - -class SplitAttentionConv2d(nn.Module): - """Split-Attention Conv2d in ResNeSt. - - Args: - in_channels (int): Number of channels in the input feature map. - channels (int): Number of intermediate channels. - kernel_size (int | tuple[int]): Size of the convolution kernel. - stride (int | tuple[int]): Stride of the convolution. - padding (int | tuple[int]): Zero-padding added to both sides of - dilation (int | tuple[int]): Spacing between kernel elements. - groups (int): Number of blocked connections from input channels to - output channels. - groups (int): Same as nn.Conv2d. - radix (int): Radix of SpltAtConv2d. Default: 2 - reduction_factor (int): Reduction factor of inter_channels. Default: 4. - conv_cfg (dict): Config dict for convolution layer. Default: None, - which means using conv2d. - norm_cfg (dict): Config dict for normalization layer. Default: None. - dcn (dict): Config dict for DCN. Default: None. - """ - - def __init__(self, - in_channels, - channels, - kernel_size, - stride=1, - padding=0, - dilation=1, - groups=1, - radix=2, - reduction_factor=4, - conv_cfg=None, - norm_cfg=dict(type='BN'), - dcn=None): - super(SplitAttentionConv2d, self).__init__() - inter_channels = max(in_channels * radix // reduction_factor, 32) - self.radix = radix - self.groups = groups - self.channels = channels - self.with_dcn = dcn is not None - self.dcn = dcn - fallback_on_stride = False - if self.with_dcn: - fallback_on_stride = self.dcn.pop('fallback_on_stride', False) - if self.with_dcn and not fallback_on_stride: - assert conv_cfg is None, 'conv_cfg must be None for DCN' - conv_cfg = dcn - self.conv = build_conv_layer( - conv_cfg, - in_channels, - channels * radix, - kernel_size, - stride=stride, - padding=padding, - dilation=dilation, - groups=groups * radix, - bias=False) - # To be consistent with original implementation, starting from 0 - self.norm0_name, norm0 = build_norm_layer( - norm_cfg, channels * radix, postfix=0) - self.add_module(self.norm0_name, norm0) - self.relu = nn.ReLU(inplace=True) - self.fc1 = build_conv_layer( - None, channels, inter_channels, 1, groups=self.groups) - self.norm1_name, norm1 = build_norm_layer( - norm_cfg, inter_channels, postfix=1) - self.add_module(self.norm1_name, norm1) - self.fc2 = build_conv_layer( - None, inter_channels, channels * radix, 1, groups=self.groups) - self.rsoftmax = RSoftmax(radix, groups) - - @property - def norm0(self): - """nn.Module: the normalization layer named "norm0" """ - return getattr(self, self.norm0_name) - - @property - def norm1(self): - """nn.Module: the normalization layer named "norm1" """ - return getattr(self, self.norm1_name) - - def forward(self, x): - x = self.conv(x) - x = self.norm0(x) - x = self.relu(x) - - batch, rchannel = x.shape[:2] - batch = x.size(0) - if self.radix > 1: - splits = x.view(batch, self.radix, -1, *x.shape[2:]) - gap = splits.sum(dim=1) - else: - gap = x - gap = F.adaptive_avg_pool2d(gap, 1) - gap = self.fc1(gap) - - gap = self.norm1(gap) - gap = self.relu(gap) - - atten = self.fc2(gap) - atten = self.rsoftmax(atten).view(batch, -1, 1, 1) - - if self.radix > 1: - attens = atten.view(batch, self.radix, -1, *atten.shape[2:]) - out = torch.sum(attens * splits, dim=1) - else: - out = atten * x - return out.contiguous() - - -class Bottleneck(_Bottleneck): - """Bottleneck block for ResNeSt. - - Args: - inplane (int): Input planes of this block. - planes (int): Middle planes of this block. - groups (int): Groups of conv2. - base_width (int): Base of width in terms of base channels. Default: 4. - base_channels (int): Base of channels for calculating width. - Default: 64. - radix (int): Radix of SpltAtConv2d. Default: 2 - reduction_factor (int): Reduction factor of inter_channels in - SplitAttentionConv2d. Default: 4. - avg_down_stride (bool): Whether to use average pool for stride in - Bottleneck. Default: True. - kwargs (dict): Key word arguments for base class. - """ - expansion = 4 - - def __init__(self, - inplanes, - planes, - groups=1, - base_width=4, - base_channels=64, - radix=2, - reduction_factor=4, - avg_down_stride=True, - **kwargs): - """Bottleneck block for ResNeSt.""" - super(Bottleneck, self).__init__(inplanes, planes, **kwargs) - - if groups == 1: - width = self.planes - else: - width = math.floor(self.planes * - (base_width / base_channels)) * groups - - self.avg_down_stride = avg_down_stride and self.conv2_stride > 1 - - self.norm1_name, norm1 = build_norm_layer( - self.norm_cfg, width, postfix=1) - self.norm3_name, norm3 = build_norm_layer( - self.norm_cfg, self.planes * self.expansion, postfix=3) - - self.conv1 = build_conv_layer( - self.conv_cfg, - self.inplanes, - width, - kernel_size=1, - stride=self.conv1_stride, - bias=False) - self.add_module(self.norm1_name, norm1) - self.with_modulated_dcn = False - self.conv2 = SplitAttentionConv2d( - width, - width, - kernel_size=3, - stride=1 if self.avg_down_stride else self.conv2_stride, - padding=self.dilation, - dilation=self.dilation, - groups=groups, - radix=radix, - reduction_factor=reduction_factor, - conv_cfg=self.conv_cfg, - norm_cfg=self.norm_cfg, - dcn=self.dcn) - delattr(self, self.norm2_name) - - if self.avg_down_stride: - self.avd_layer = nn.AvgPool2d(3, self.conv2_stride, padding=1) - - self.conv3 = build_conv_layer( - self.conv_cfg, - width, - self.planes * self.expansion, - kernel_size=1, - bias=False) - self.add_module(self.norm3_name, norm3) - - def forward(self, x): - - def _inner_forward(x): - identity = x - - out = self.conv1(x) - out = self.norm1(out) - out = self.relu(out) - - if self.with_plugins: - out = self.forward_plugin(out, self.after_conv1_plugin_names) - - out = self.conv2(out) - - if self.avg_down_stride: - out = self.avd_layer(out) - - if self.with_plugins: - out = self.forward_plugin(out, self.after_conv2_plugin_names) - - out = self.conv3(out) - out = self.norm3(out) - - if self.with_plugins: - out = self.forward_plugin(out, self.after_conv3_plugin_names) - - if self.downsample is not None: - identity = self.downsample(x) - - out += identity - - return out - - if self.with_cp and x.requires_grad: - out = cp.checkpoint(_inner_forward, x) - else: - out = _inner_forward(x) - - out = self.relu(out) - - return out - - -@BACKBONES.register_module() -class ResNeSt(ResNetV1d): - """ResNeSt backbone. - - Args: - groups (int): Number of groups of Bottleneck. Default: 1 - base_width (int): Base width of Bottleneck. Default: 4 - radix (int): Radix of SplitAttentionConv2d. Default: 2 - reduction_factor (int): Reduction factor of inter_channels in - SplitAttentionConv2d. Default: 4. - avg_down_stride (bool): Whether to use average pool for stride in - Bottleneck. Default: True. - kwargs (dict): Keyword arguments for ResNet. - """ - - arch_settings = { - 50: (Bottleneck, (3, 4, 6, 3)), - 101: (Bottleneck, (3, 4, 23, 3)), - 152: (Bottleneck, (3, 8, 36, 3)), - 200: (Bottleneck, (3, 24, 36, 3)) - } - - def __init__(self, - groups=1, - base_width=4, - radix=2, - reduction_factor=4, - avg_down_stride=True, - **kwargs): - self.groups = groups - self.base_width = base_width - self.radix = radix - self.reduction_factor = reduction_factor - self.avg_down_stride = avg_down_stride - super(ResNeSt, self).__init__(**kwargs) - - def make_res_layer(self, **kwargs): - """Pack all blocks in a stage into a ``ResLayer``.""" - return ResLayer( - groups=self.groups, - base_width=self.base_width, - base_channels=self.base_channels, - radix=self.radix, - reduction_factor=self.reduction_factor, - avg_down_stride=self.avg_down_stride, - **kwargs) diff --git a/spaces/abhishek/sketch-to-image/annotator/uniformer_base/configs/_base_/models/dnl_r50-d8.py b/spaces/abhishek/sketch-to-image/annotator/uniformer_base/configs/_base_/models/dnl_r50-d8.py deleted file mode 100644 index edb4c174c51e34c103737ba39bfc48bf831e561d..0000000000000000000000000000000000000000 --- a/spaces/abhishek/sketch-to-image/annotator/uniformer_base/configs/_base_/models/dnl_r50-d8.py +++ /dev/null @@ -1,46 +0,0 @@ -# model settings -norm_cfg = dict(type='SyncBN', requires_grad=True) -model = dict( - type='EncoderDecoder', - pretrained='open-mmlab://resnet50_v1c', - backbone=dict( - type='ResNetV1c', - depth=50, - num_stages=4, - out_indices=(0, 1, 2, 3), - dilations=(1, 1, 2, 4), - strides=(1, 2, 1, 1), - norm_cfg=norm_cfg, - norm_eval=False, - style='pytorch', - contract_dilation=True), - decode_head=dict( - type='DNLHead', - in_channels=2048, - in_index=3, - channels=512, - dropout_ratio=0.1, - reduction=2, - use_scale=True, - mode='embedded_gaussian', - num_classes=19, - norm_cfg=norm_cfg, - align_corners=False, - loss_decode=dict( - type='CrossEntropyLoss', use_sigmoid=False, loss_weight=1.0)), - auxiliary_head=dict( - type='FCNHead', - in_channels=1024, - in_index=2, - channels=256, - num_convs=1, - concat_input=False, - dropout_ratio=0.1, - num_classes=19, - norm_cfg=norm_cfg, - align_corners=False, - loss_decode=dict( - type='CrossEntropyLoss', use_sigmoid=False, loss_weight=0.4)), - # model training and testing settings - train_cfg=dict(), - test_cfg=dict(mode='whole')) diff --git a/spaces/abhishek/sketch-to-image/annotator/uniformer_base/mmcv/utils/version_utils.py b/spaces/abhishek/sketch-to-image/annotator/uniformer_base/mmcv/utils/version_utils.py deleted file mode 100644 index 963c45a2e8a86a88413ab6c18c22481fb9831985..0000000000000000000000000000000000000000 --- a/spaces/abhishek/sketch-to-image/annotator/uniformer_base/mmcv/utils/version_utils.py +++ /dev/null @@ -1,90 +0,0 @@ -# Copyright (c) OpenMMLab. All rights reserved. -import os -import subprocess -import warnings - -from packaging.version import parse - - -def digit_version(version_str: str, length: int = 4): - """Convert a version string into a tuple of integers. - - This method is usually used for comparing two versions. For pre-release - versions: alpha < beta < rc. - - Args: - version_str (str): The version string. - length (int): The maximum number of version levels. Default: 4. - - Returns: - tuple[int]: The version info in digits (integers). - """ - assert 'parrots' not in version_str - version = parse(version_str) - assert version.release, f'failed to parse version {version_str}' - release = list(version.release) - release = release[:length] - if len(release) < length: - release = release + [0] * (length - len(release)) - if version.is_prerelease: - mapping = {'a': -3, 'b': -2, 'rc': -1} - val = -4 - # version.pre can be None - if version.pre: - if version.pre[0] not in mapping: - warnings.warn(f'unknown prerelease version {version.pre[0]}, ' - 'version checking may go wrong') - else: - val = mapping[version.pre[0]] - release.extend([val, version.pre[-1]]) - else: - release.extend([val, 0]) - - elif version.is_postrelease: - release.extend([1, version.post]) - else: - release.extend([0, 0]) - return tuple(release) - - -def _minimal_ext_cmd(cmd): - # construct minimal environment - env = {} - for k in ['SYSTEMROOT', 'PATH', 'HOME']: - v = os.environ.get(k) - if v is not None: - env[k] = v - # LANGUAGE is used on win32 - env['LANGUAGE'] = 'C' - env['LANG'] = 'C' - env['LC_ALL'] = 'C' - out = subprocess.Popen( - cmd, stdout=subprocess.PIPE, env=env).communicate()[0] - return out - - -def get_git_hash(fallback='unknown', digits=None): - """Get the git hash of the current repo. - - Args: - fallback (str, optional): The fallback string when git hash is - unavailable. Defaults to 'unknown'. - digits (int, optional): kept digits of the hash. Defaults to None, - meaning all digits are kept. - - Returns: - str: Git commit hash. - """ - - if digits is not None and not isinstance(digits, int): - raise TypeError('digits must be None or an integer') - - try: - out = _minimal_ext_cmd(['git', 'rev-parse', 'HEAD']) - sha = out.strip().decode('ascii') - if digits is not None: - sha = sha[:digits] - except OSError: - sha = fallback - - return sha diff --git a/spaces/abrar-lohia/text-2-character-anim/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/libs/__init__.py b/spaces/abrar-lohia/text-2-character-anim/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/libs/__init__.py deleted file mode 100644 index 8b137891791fe96927ad78e64b0aad7bded08bdc..0000000000000000000000000000000000000000 --- a/spaces/abrar-lohia/text-2-character-anim/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/libs/__init__.py +++ /dev/null @@ -1 +0,0 @@ - diff --git a/spaces/abrar-lohia/text-2-character-anim/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/libs/x11/cursorfont.py b/spaces/abrar-lohia/text-2-character-anim/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/libs/x11/cursorfont.py deleted file mode 100644 index 4a3a3267a84fe281122dfbb92b9a3862db39f0ca..0000000000000000000000000000000000000000 --- a/spaces/abrar-lohia/text-2-character-anim/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/libs/x11/cursorfont.py +++ /dev/null @@ -1,80 +0,0 @@ -# /usr/include/X11/cursorfont.h - -XC_num_glyphs = 154 -XC_X_cursor = 0 -XC_arrow = 2 -XC_based_arrow_down = 4 -XC_based_arrow_up = 6 -XC_boat = 8 -XC_bogosity = 10 -XC_bottom_left_corner = 12 -XC_bottom_right_corner = 14 -XC_bottom_side = 16 -XC_bottom_tee = 18 -XC_box_spiral = 20 -XC_center_ptr = 22 -XC_circle = 24 -XC_clock = 26 -XC_coffee_mug = 28 -XC_cross = 30 -XC_cross_reverse = 32 -XC_crosshair = 34 -XC_diamond_cross = 36 -XC_dot = 38 -XC_dotbox = 40 -XC_double_arrow = 42 -XC_draft_large = 44 -XC_draft_small = 46 -XC_draped_box = 48 -XC_exchange = 50 -XC_fleur = 52 -XC_gobbler = 54 -XC_gumby = 56 -XC_hand1 = 58 -XC_hand2 = 60 -XC_heart = 62 -XC_icon = 64 -XC_iron_cross = 66 -XC_left_ptr = 68 -XC_left_side = 70 -XC_left_tee = 72 -XC_leftbutton = 74 -XC_ll_angle = 76 -XC_lr_angle = 78 -XC_man = 80 -XC_middlebutton = 82 -XC_mouse = 84 -XC_pencil = 86 -XC_pirate = 88 -XC_plus = 90 -XC_question_arrow = 92 -XC_right_ptr = 94 -XC_right_side = 96 -XC_right_tee = 98 -XC_rightbutton = 100 -XC_rtl_logo = 102 -XC_sailboat = 104 -XC_sb_down_arrow = 106 -XC_sb_h_double_arrow = 108 -XC_sb_left_arrow = 110 -XC_sb_right_arrow = 112 -XC_sb_up_arrow = 114 -XC_sb_v_double_arrow = 116 -XC_shuttle = 118 -XC_sizing = 120 -XC_spider = 122 -XC_spraycan = 124 -XC_star = 126 -XC_target = 128 -XC_tcross = 130 -XC_top_left_arrow = 132 -XC_top_left_corner = 134 -XC_top_right_corner = 136 -XC_top_side = 138 -XC_top_tee = 140 -XC_trek = 142 -XC_ul_angle = 144 -XC_umbrella = 146 -XC_ur_angle = 148 -XC_watch = 150 -XC_xterm = 152 diff --git a/spaces/abrar-lohia/text-2-character-anim/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/util.py b/spaces/abrar-lohia/text-2-character-anim/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/util.py deleted file mode 100644 index 6f6314e8c160140afc79ec2512cad004e2149483..0000000000000000000000000000000000000000 --- a/spaces/abrar-lohia/text-2-character-anim/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/util.py +++ /dev/null @@ -1,255 +0,0 @@ -"""Various utility functions used internally by pyglet -""" - -import os -import sys - -import pyglet - - -def asbytes(s): - if isinstance(s, bytes): - return s - elif isinstance(s, str): - return bytes(ord(c) for c in s) - else: - return bytes(s) - - -def asbytes_filename(s): - if isinstance(s, bytes): - return s - elif isinstance(s, str): - return s.encode(encoding=sys.getfilesystemencoding()) - - -def asstr(s): - if s is None: - return '' - if isinstance(s, str): - return s - return s.decode("utf-8") - - -def with_metaclass(meta, *bases): - """ - Function from jinja2/_compat.py. License: BSD. - Use it like this:: - class BaseForm: - pass - class FormType(type): - pass - class Form(with_metaclass(FormType, BaseForm)): - pass - This requires a bit of explanation: the basic idea is to make a - dummy metaclass for one level of class instantiation that replaces - itself with the actual metaclass. Because of internal type checks - we also need to make sure that we downgrade the custom metaclass - for one level to something closer to type (that's why __call__ and - __init__ comes back from type etc.). - This has the advantage over six.with_metaclass of not introducing - dummy classes into the final MRO. - """ - class MetaClass(meta): - __call__ = type.__call__ - __init__ = type.__init__ - - def __new__(cls, name, this_bases, d): - if this_bases is None: - return type.__new__(cls, name, (), d) - return meta(name, bases, d) - - return MetaClass('temporary_class', None, {}) - - -def debug_print(enabled_or_option='debug'): - """Get a debug printer that is enabled based on a boolean input or a pyglet option. - The debug print function returned should be used in an assert. This way it can be - optimized out when running python with the -O flag. - - Usage example:: - - from pyglet.debug import debug_print - _debug_media = debug_print('debug_media') - - def some_func(): - assert _debug_media('My debug statement') - - :parameters: - `enabled_or_options` : bool or str - If a bool is passed, debug printing is enabled if it is True. If str is passed - debug printing is enabled if the pyglet option with that name is True. - - :returns: Function for debug printing. - """ - if isinstance(enabled_or_option, bool): - enabled = enabled_or_option - else: - enabled = pyglet.options.get(enabled_or_option, False) - - if enabled: - def _debug_print(*args, **kwargs): - print(*args, **kwargs) - return True - - else: - def _debug_print(*args, **kwargs): - return True - - return _debug_print - - -class CodecRegistry: - """Utility class for handling adding and querying of codecs.""" - - def __init__(self): - self._decoders = [] - self._encoders = [] - self._decoder_extensions = {} # Map str -> list of matching Decoders - self._encoder_extensions = {} # Map str -> list of matching Encoders - - def get_encoders(self, filename=None): - """Get a list of all encoders. If a `filename` is provided, only - encoders supporting that extension will be returned. An empty list - will be return if no encoders for that extension are available. - """ - if filename: - extension = os.path.splitext(filename)[1].lower() - return self._encoder_extensions.get(extension, []) - return self._encoders - - def get_decoders(self, filename=None): - """Get a list of all decoders. If a `filename` is provided, only - decoders supporting that extension will be returned. An empty list - will be return if no encoders for that extension are available. - """ - if filename: - extension = os.path.splitext(filename)[1].lower() - return self._decoder_extensions.get(extension, []) - return self._decoders - - def add_decoders(self, module): - """Add a decoder module. The module must define `get_decoders`. Once - added, the appropriate decoders defined in the codec will be returned by - CodecRegistry.get_decoders. - """ - for decoder in module.get_decoders(): - self._decoders.append(decoder) - for extension in decoder.get_file_extensions(): - if extension not in self._decoder_extensions: - self._decoder_extensions[extension] = [] - self._decoder_extensions[extension].append(decoder) - - def add_encoders(self, module): - """Add an encoder module. The module must define `get_encoders`. Once - added, the appropriate encoders defined in the codec will be returned by - CodecRegistry.get_encoders. - """ - for encoder in module.get_encoders(): - self._encoders.append(encoder) - for extension in encoder.get_file_extensions(): - if extension not in self._encoder_extensions: - self._encoder_extensions[extension] = [] - self._encoder_extensions[extension].append(encoder) - - def decode(self, filename, file, **kwargs): - """Attempt to decode a file, using the available registered decoders. - Any decoders that match the file extension will be tried first. If no - decoders match the extension, all decoders will then be tried in order. - """ - first_exception = None - - for decoder in self.get_decoders(filename): - try: - return decoder.decode(filename, file, **kwargs) - except DecodeException as e: - if not first_exception: - first_exception = e - if file: - file.seek(0) - - for decoder in self.get_decoders(): - try: - return decoder.decode(filename, file, **kwargs) - except DecodeException: - if file: - file.seek(0) - - if not first_exception: - raise DecodeException(f"No decoders available for this file type: {filename}") - raise first_exception - - def encode(self, media, filename, file=None, **kwargs): - """Attempt to encode a pyglet object to a specified format. All registered - encoders that advertise support for the specific file extension will be tried. - If no encoders are available, an EncodeException will be raised. - """ - - first_exception = None - for encoder in self.get_encoders(filename): - - try: - return encoder.encode(media, filename, file, **kwargs) - except EncodeException as e: - first_exception = first_exception or e - - if not first_exception: - raise EncodeException(f"No Encoders are available for this extension: '{filename}'") - raise first_exception - - -class Decoder: - def get_file_extensions(self): - """Return a list or tuple of accepted file extensions, e.g. ['.wav', '.ogg'] - Lower-case only. - """ - raise NotImplementedError() - - def decode(self, *args, **kwargs): - """Read and decode the given file object and return an approprite - pyglet object. Throws DecodeException if there is an error. - `filename` can be a file type hint. - """ - raise NotImplementedError() - - def __hash__(self): - return hash(self.__class__.__name__) - - def __eq__(self, other): - return self.__class__.__name__ == other.__class__.__name__ - - def __repr__(self): - return "{0}{1}".format(self.__class__.__name__, self.get_file_extensions()) - - -class Encoder: - def get_file_extensions(self): - """Return a list or tuple of accepted file extensions, e.g. ['.wav', '.ogg'] - Lower-case only. - """ - raise NotImplementedError() - - def encode(self, media, filename, file): - """Encode the given media type to the given file. `filename` - provides a hint to the file format desired. options are - encoder-specific, and unknown options should be ignored or - issue warnings. - """ - raise NotImplementedError() - - def __hash__(self): - return hash(self.__class__.__name__) - - def __eq__(self, other): - return self.__class__.__name__ == other.__class__.__name__ - - def __repr__(self): - return "{0}{1}".format(self.__class__.__name__, self.get_file_extensions()) - - -class DecodeException(Exception): - __module__ = "CodecRegistry" - - -class EncodeException(Exception): - __module__ = "CodecRegistry" diff --git a/spaces/actboy/ChatGLM-6B/README.md b/spaces/actboy/ChatGLM-6B/README.md deleted file mode 100644 index 8e5a16beea85682e68823deb6320a28e74b609b0..0000000000000000000000000000000000000000 --- a/spaces/actboy/ChatGLM-6B/README.md +++ /dev/null @@ -1,12 +0,0 @@ ---- -title: ChatGLM 6B -emoji: 📚 -colorFrom: red -colorTo: gray -sdk: gradio -sdk_version: 3.21.0 -app_file: app.py -pinned: false ---- - -Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference diff --git a/spaces/aditi2222/Summarization_english/app.py b/spaces/aditi2222/Summarization_english/app.py deleted file mode 100644 index 273d8de3255afcc04115b9317177da9408d023ab..0000000000000000000000000000000000000000 --- a/spaces/aditi2222/Summarization_english/app.py +++ /dev/null @@ -1,35 +0,0 @@ -import torch - -import gradio as gr - -from transformers import AutoTokenizer, AutoModelForSeq2SeqLM - -tokenizer = AutoTokenizer.from_pretrained("aditi2222/automatic_title_generation") - -model = AutoModelForSeq2SeqLM.from_pretrained("aditi2222/automatic_title_generation") - - -def tokenize_data(text): - # Tokenize the review body - input_ = str(text) + ' ' - max_len = 120 - # tokenize inputs - tokenized_inputs = tokenizer(input_, padding='max_length', truncation=True, max_length=max_len, return_attention_mask=True, return_tensors='pt') - - inputs={"input_ids": tokenized_inputs['input_ids'], - "attention_mask": tokenized_inputs['attention_mask']} - return inputs - -def generate_answers(text): - inputs = tokenize_data(text) - results= model.generate(input_ids= inputs['input_ids'], attention_mask=inputs['attention_mask'], do_sample=True, - max_length=120, - top_k=120, - top_p=0.98, - early_stopping=True, - num_return_sequences=1) - answer = tokenizer.decode(results[0], skip_special_tokens=True) - return answer - -iface = gr.Interface(fn=generate_answers, inputs=['text'], outputs=["text"]) -iface.launch(inline=False, share=True) \ No newline at end of file diff --git a/spaces/akhaliq/VQMIVC/ParallelWaveGAN/parallel_wavegan/layers/upsample.py b/spaces/akhaliq/VQMIVC/ParallelWaveGAN/parallel_wavegan/layers/upsample.py deleted file mode 100644 index 8cc9f2d77cfc8dd8e6f2f08353d607a6665b9394..0000000000000000000000000000000000000000 --- a/spaces/akhaliq/VQMIVC/ParallelWaveGAN/parallel_wavegan/layers/upsample.py +++ /dev/null @@ -1,194 +0,0 @@ -# -*- coding: utf-8 -*- - -"""Upsampling module. - -This code is modified from https://github.com/r9y9/wavenet_vocoder. - -""" - -import numpy as np -import torch -import torch.nn.functional as F - -from parallel_wavegan.layers import Conv1d - - -class Stretch2d(torch.nn.Module): - """Stretch2d module.""" - - def __init__(self, x_scale, y_scale, mode="nearest"): - """Initialize Stretch2d module. - - Args: - x_scale (int): X scaling factor (Time axis in spectrogram). - y_scale (int): Y scaling factor (Frequency axis in spectrogram). - mode (str): Interpolation mode. - - """ - super(Stretch2d, self).__init__() - self.x_scale = x_scale - self.y_scale = y_scale - self.mode = mode - - def forward(self, x): - """Calculate forward propagation. - - Args: - x (Tensor): Input tensor (B, C, F, T). - - Returns: - Tensor: Interpolated tensor (B, C, F * y_scale, T * x_scale), - - """ - return F.interpolate( - x, scale_factor=(self.y_scale, self.x_scale), mode=self.mode - ) - - -class Conv2d(torch.nn.Conv2d): - """Conv2d module with customized initialization.""" - - def __init__(self, *args, **kwargs): - """Initialize Conv2d module.""" - super(Conv2d, self).__init__(*args, **kwargs) - - def reset_parameters(self): - """Reset parameters.""" - self.weight.data.fill_(1.0 / np.prod(self.kernel_size)) - if self.bias is not None: - torch.nn.init.constant_(self.bias, 0.0) - - -class UpsampleNetwork(torch.nn.Module): - """Upsampling network module.""" - - def __init__( - self, - upsample_scales, - nonlinear_activation=None, - nonlinear_activation_params={}, - interpolate_mode="nearest", - freq_axis_kernel_size=1, - use_causal_conv=False, - ): - """Initialize upsampling network module. - - Args: - upsample_scales (list): List of upsampling scales. - nonlinear_activation (str): Activation function name. - nonlinear_activation_params (dict): Arguments for specified activation function. - interpolate_mode (str): Interpolation mode. - freq_axis_kernel_size (int): Kernel size in the direction of frequency axis. - - """ - super(UpsampleNetwork, self).__init__() - self.use_causal_conv = use_causal_conv - self.up_layers = torch.nn.ModuleList() - for scale in upsample_scales: - # interpolation layer - stretch = Stretch2d(scale, 1, interpolate_mode) - self.up_layers += [stretch] - - # conv layer - assert ( - freq_axis_kernel_size - 1 - ) % 2 == 0, "Not support even number freq axis kernel size." - freq_axis_padding = (freq_axis_kernel_size - 1) // 2 - kernel_size = (freq_axis_kernel_size, scale * 2 + 1) - if use_causal_conv: - padding = (freq_axis_padding, scale * 2) - else: - padding = (freq_axis_padding, scale) - conv = Conv2d(1, 1, kernel_size=kernel_size, padding=padding, bias=False) - self.up_layers += [conv] - - # nonlinear - if nonlinear_activation is not None: - nonlinear = getattr(torch.nn, nonlinear_activation)( - **nonlinear_activation_params - ) - self.up_layers += [nonlinear] - - def forward(self, c): - """Calculate forward propagation. - - Args: - c : Input tensor (B, C, T). - - Returns: - Tensor: Upsampled tensor (B, C, T'), where T' = T * prod(upsample_scales). - - """ - c = c.unsqueeze(1) # (B, 1, C, T) - for f in self.up_layers: - if self.use_causal_conv and isinstance(f, Conv2d): - c = f(c)[..., : c.size(-1)] - else: - c = f(c) - return c.squeeze(1) # (B, C, T') - - -class ConvInUpsampleNetwork(torch.nn.Module): - """Convolution + upsampling network module.""" - - def __init__( - self, - upsample_scales, - nonlinear_activation=None, - nonlinear_activation_params={}, - interpolate_mode="nearest", - freq_axis_kernel_size=1, - aux_channels=80, - aux_context_window=0, - use_causal_conv=False, - ): - """Initialize convolution + upsampling network module. - - Args: - upsample_scales (list): List of upsampling scales. - nonlinear_activation (str): Activation function name. - nonlinear_activation_params (dict): Arguments for specified activation function. - mode (str): Interpolation mode. - freq_axis_kernel_size (int): Kernel size in the direction of frequency axis. - aux_channels (int): Number of channels of pre-convolutional layer. - aux_context_window (int): Context window size of the pre-convolutional layer. - use_causal_conv (bool): Whether to use causal structure. - - """ - super(ConvInUpsampleNetwork, self).__init__() - self.aux_context_window = aux_context_window - self.use_causal_conv = use_causal_conv and aux_context_window > 0 - # To capture wide-context information in conditional features - kernel_size = ( - aux_context_window + 1 if use_causal_conv else 2 * aux_context_window + 1 - ) - # NOTE(kan-bayashi): Here do not use padding because the input is already padded - self.conv_in = Conv1d( - aux_channels, aux_channels, kernel_size=kernel_size, bias=False - ) - self.upsample = UpsampleNetwork( - upsample_scales=upsample_scales, - nonlinear_activation=nonlinear_activation, - nonlinear_activation_params=nonlinear_activation_params, - interpolate_mode=interpolate_mode, - freq_axis_kernel_size=freq_axis_kernel_size, - use_causal_conv=use_causal_conv, - ) - - def forward(self, c): - """Calculate forward propagation. - - Args: - c : Input tensor (B, C, T'). - - Returns: - Tensor: Upsampled tensor (B, C, T), - where T = (T' - aux_context_window * 2) * prod(upsample_scales). - - Note: - The length of inputs considers the context window size. - - """ - c_ = self.conv_in(c) - c = c_[:, :, : -self.aux_context_window] if self.use_causal_conv else c_ - return self.upsample(c) diff --git a/spaces/akhaliq/VQMIVC/ParallelWaveGAN/parallel_wavegan/losses/stft_loss.py b/spaces/akhaliq/VQMIVC/ParallelWaveGAN/parallel_wavegan/losses/stft_loss.py deleted file mode 100644 index b5923559d6cae5c335b6febc8b8e2124ce0c4487..0000000000000000000000000000000000000000 --- a/spaces/akhaliq/VQMIVC/ParallelWaveGAN/parallel_wavegan/losses/stft_loss.py +++ /dev/null @@ -1,170 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2019 Tomoki Hayashi -# MIT License (https://opensource.org/licenses/MIT) - -"""STFT-based Loss modules.""" - -import torch -import torch.nn.functional as F - -from distutils.version import LooseVersion - -is_pytorch_17plus = LooseVersion(torch.__version__) >= LooseVersion("1.7") - - -def stft(x, fft_size, hop_size, win_length, window): - """Perform STFT and convert to magnitude spectrogram. - - Args: - x (Tensor): Input signal tensor (B, T). - fft_size (int): FFT size. - hop_size (int): Hop size. - win_length (int): Window length. - window (str): Window function type. - - Returns: - Tensor: Magnitude spectrogram (B, #frames, fft_size // 2 + 1). - - """ - if is_pytorch_17plus: - x_stft = torch.stft( - x, fft_size, hop_size, win_length, window, return_complex=False - ) - else: - x_stft = torch.stft(x, fft_size, hop_size, win_length, window) - real = x_stft[..., 0] - imag = x_stft[..., 1] - - # NOTE(kan-bayashi): clamp is needed to avoid nan or inf - return torch.sqrt(torch.clamp(real ** 2 + imag ** 2, min=1e-7)).transpose(2, 1) - - -class SpectralConvergenceLoss(torch.nn.Module): - """Spectral convergence loss module.""" - - def __init__(self): - """Initilize spectral convergence loss module.""" - super(SpectralConvergenceLoss, self).__init__() - - def forward(self, x_mag, y_mag): - """Calculate forward propagation. - - Args: - x_mag (Tensor): Magnitude spectrogram of predicted signal (B, #frames, #freq_bins). - y_mag (Tensor): Magnitude spectrogram of groundtruth signal (B, #frames, #freq_bins). - - Returns: - Tensor: Spectral convergence loss value. - - """ - return torch.norm(y_mag - x_mag, p="fro") / torch.norm(y_mag, p="fro") - - -class LogSTFTMagnitudeLoss(torch.nn.Module): - """Log STFT magnitude loss module.""" - - def __init__(self): - """Initilize los STFT magnitude loss module.""" - super(LogSTFTMagnitudeLoss, self).__init__() - - def forward(self, x_mag, y_mag): - """Calculate forward propagation. - - Args: - x_mag (Tensor): Magnitude spectrogram of predicted signal (B, #frames, #freq_bins). - y_mag (Tensor): Magnitude spectrogram of groundtruth signal (B, #frames, #freq_bins). - - Returns: - Tensor: Log STFT magnitude loss value. - - """ - return F.l1_loss(torch.log(y_mag), torch.log(x_mag)) - - -class STFTLoss(torch.nn.Module): - """STFT loss module.""" - - def __init__( - self, fft_size=1024, shift_size=120, win_length=600, window="hann_window" - ): - """Initialize STFT loss module.""" - super(STFTLoss, self).__init__() - self.fft_size = fft_size - self.shift_size = shift_size - self.win_length = win_length - self.spectral_convergence_loss = SpectralConvergenceLoss() - self.log_stft_magnitude_loss = LogSTFTMagnitudeLoss() - # NOTE(kan-bayashi): Use register_buffer to fix #223 - self.register_buffer("window", getattr(torch, window)(win_length)) - - def forward(self, x, y): - """Calculate forward propagation. - - Args: - x (Tensor): Predicted signal (B, T). - y (Tensor): Groundtruth signal (B, T). - - Returns: - Tensor: Spectral convergence loss value. - Tensor: Log STFT magnitude loss value. - - """ - x_mag = stft(x, self.fft_size, self.shift_size, self.win_length, self.window) - y_mag = stft(y, self.fft_size, self.shift_size, self.win_length, self.window) - sc_loss = self.spectral_convergence_loss(x_mag, y_mag) - mag_loss = self.log_stft_magnitude_loss(x_mag, y_mag) - - return sc_loss, mag_loss - - -class MultiResolutionSTFTLoss(torch.nn.Module): - """Multi resolution STFT loss module.""" - - def __init__( - self, - fft_sizes=[1024, 2048, 512], - hop_sizes=[120, 240, 50], - win_lengths=[600, 1200, 240], - window="hann_window", - ): - """Initialize Multi resolution STFT loss module. - - Args: - fft_sizes (list): List of FFT sizes. - hop_sizes (list): List of hop sizes. - win_lengths (list): List of window lengths. - window (str): Window function type. - - """ - super(MultiResolutionSTFTLoss, self).__init__() - assert len(fft_sizes) == len(hop_sizes) == len(win_lengths) - self.stft_losses = torch.nn.ModuleList() - for fs, ss, wl in zip(fft_sizes, hop_sizes, win_lengths): - self.stft_losses += [STFTLoss(fs, ss, wl, window)] - - def forward(self, x, y): - """Calculate forward propagation. - - Args: - x (Tensor): Predicted signal (B, T) or (B, #subband, T). - y (Tensor): Groundtruth signal (B, T) or (B, #subband, T). - - Returns: - Tensor: Multi resolution spectral convergence loss value. - Tensor: Multi resolution log STFT magnitude loss value. - - """ - if len(x.shape) == 3: - x = x.view(-1, x.size(2)) # (B, C, T) -> (B x C, T) - y = y.view(-1, y.size(2)) # (B, C, T) -> (B x C, T) - sc_loss = 0.0 - mag_loss = 0.0 - for f in self.stft_losses: - sc_l, mag_l = f(x, y) - sc_loss += sc_l - mag_loss += mag_l - sc_loss /= len(self.stft_losses) - mag_loss /= len(self.stft_losses) - - return sc_loss, mag_loss diff --git a/spaces/akhaliq/deeplab2/model/layers/convolutions_test.py b/spaces/akhaliq/deeplab2/model/layers/convolutions_test.py deleted file mode 100644 index 676135cba31b82a582ae8f04c424e55b839dbcff..0000000000000000000000000000000000000000 --- a/spaces/akhaliq/deeplab2/model/layers/convolutions_test.py +++ /dev/null @@ -1,290 +0,0 @@ -# coding=utf-8 -# Copyright 2021 The Deeplab2 Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -"""Tests for convolutions.""" - -import numpy as np -import tensorflow as tf - -from deeplab2.model.layers import convolutions -from deeplab2.utils import test_utils - - -class ConvolutionsTest(tf.test.TestCase): - - def test_conv2dsame_logging(self): - with self.assertLogs(level='WARN'): - _ = convolutions.Conv2DSame( - output_channels=1, - kernel_size=8, - strides=2, - name='conv', - use_bn=False, - activation=None) - - def test_conv2dsame_conv(self): - conv = convolutions.Conv2DSame( - output_channels=1, - kernel_size=1, - name='conv', - use_bn=False, - activation=None) - input_tensor = tf.random.uniform(shape=(2, 180, 180, 5)) - - predicted_tensor = conv(input_tensor) - expected_tensor = np.dot(input_tensor.numpy(), - conv._conv.get_weights()[0])[..., 0, 0] - - # Compare only up to 5 decimal digits to account for numerical accuracy. - np.testing.assert_almost_equal( - predicted_tensor.numpy(), expected_tensor, decimal=5) - - def test_conv2dsame_relu(self): - conv = convolutions.Conv2DSame( - output_channels=1, - kernel_size=1, - name='conv', - activation='relu', - use_bn=False) - input_tensor = tf.random.uniform(shape=(2, 180, 180, 5)) - - predicted_tensor = conv(input_tensor) - expected_tensor = np.dot(input_tensor.numpy(), - conv._conv.get_weights()[0])[..., 0, 0] - expected_tensor[expected_tensor < 0.0] = 0.0 - - # Compare only up to 5 decimal digits to account for numerical accuracy. - np.testing.assert_almost_equal( - predicted_tensor.numpy(), expected_tensor, decimal=5) - - def test_conv2dsame_relu6(self): - conv = convolutions.Conv2DSame( - output_channels=1, - kernel_size=1, - name='conv', - activation='relu6', - use_bn=False) - input_tensor = tf.random.uniform(shape=(2, 180, 180, 5)) * 10. - - predicted_tensor = conv(input_tensor) - expected_tensor = np.dot(input_tensor.numpy(), - conv._conv.get_weights()[0])[..., 0, 0] - expected_tensor[expected_tensor < 0.0] = 0.0 - expected_tensor[expected_tensor > 6.0] = 6.0 - - # Compare only up to 5 decimal digits to account for numerical accuracy. - np.testing.assert_almost_equal( - predicted_tensor.numpy(), expected_tensor, decimal=5) - - def test_conv2dsame_shape(self): - conv = convolutions.Conv2DSame( - output_channels=64, - kernel_size=7, - strides=2, - name='conv', - use_bias=False, - use_bn=True) - input_tensor = tf.random.uniform(shape=(2, 180, 180, 3)) - - predicted_tensor = conv(input_tensor) - expected_shape = [2, 90, 90, 64] - - self.assertListEqual(predicted_tensor.shape.as_list(), expected_shape) - - @test_utils.test_all_strategies - def test_conv2d_sync_bn(self, strategy): - input_tensor = tf.random.uniform(shape=(2, 180, 180, 3)) - - for bn_layer in test_utils.NORMALIZATION_LAYERS: - with strategy.scope(): - conv = convolutions.Conv2DSame( - output_channels=64, - kernel_size=7, - strides=2, - name='conv', - use_bias=False, - use_bn=True, - bn_layer=bn_layer) - conv(input_tensor) - - def test_depthwise_conv(self): - conv = convolutions.DepthwiseConv2DSame( - kernel_size=1, use_bn=False, use_bias=True, activation=None, - name='conv') - input_tensor = tf.random.uniform(shape=(2, 180, 180, 5)) - - predicted_tensor = conv(input_tensor) - expected_tensor = ( - input_tensor.numpy() * conv._depthwise_conv.get_weights()[0][..., 0]) - - np.testing.assert_equal(predicted_tensor.numpy(), expected_tensor) - - def test_depthwise_relu(self): - conv = convolutions.DepthwiseConv2DSame( - kernel_size=1, use_bn=False, activation='relu', name='conv') - input_tensor = tf.random.uniform(shape=(2, 180, 180, 5)) - - predicted_tensor = conv(input_tensor) - expected_tensor = ( - input_tensor.numpy() * conv._depthwise_conv.get_weights()[0][..., 0]) - expected_tensor[expected_tensor < 0.0] = 0.0 - - np.testing.assert_equal(predicted_tensor.numpy(), expected_tensor) - - def test_depthwise_shape(self): - conv = convolutions.DepthwiseConv2DSame( - kernel_size=3, use_bn=True, use_bias=False, activation='relu', - name='conv') - input_shape = [2, 180, 180, 5] - input_tensor = tf.random.uniform(shape=input_shape) - - predicted_tensor = conv(input_tensor) - expected_shape = input_shape - - self.assertListEqual(predicted_tensor.shape.as_list(), expected_shape) - - def test_depthwise_shape_with_stride2(self): - conv = convolutions.DepthwiseConv2DSame( - kernel_size=3, use_bn=True, use_bias=False, activation='relu', - strides=2, name='conv') - input_shape = [2, 181, 181, 5] - input_tensor = tf.random.uniform(shape=input_shape) - - predicted_tensor = conv(input_tensor) - expected_shape = [2, 91, 91, 5] - - self.assertListEqual(predicted_tensor.shape.as_list(), expected_shape) - - @test_utils.test_all_strategies - def test_depthwise_sync_bn(self, strategy): - input_tensor = tf.random.uniform(shape=(2, 180, 180, 3)) - - for bn_layer in test_utils.NORMALIZATION_LAYERS: - with strategy.scope(): - conv = convolutions.DepthwiseConv2DSame( - kernel_size=7, - name='conv', - use_bn=True, - use_bias=False, - bn_layer=bn_layer, - activation='relu') - _ = conv(input_tensor) - - def test_global_context(self): - input_tensor = tf.random.uniform(shape=(2, 180, 180, 3)) - global_context = convolutions.GlobalContext(name='global_context') - output_tensor = global_context(input_tensor) - # global_context is supposed to not change any values before training. - np.testing.assert_array_almost_equal(input_tensor.numpy(), - output_tensor.numpy()) - - def test_switchable_atrous_conv_class(self): - # Tests Switchable Atrous Convolution by equations. - input_tensor = tf.random.uniform(shape=(3, 180, 180, 32)) - sac_layer = convolutions.SwitchableAtrousConvolution( - 64, - kernel_size=3, - padding='same', - name='sac_conv') - switch_conv = sac_layer._switch - _ = switch_conv(input_tensor) - switch_conv.kernel = tf.random.uniform( - switch_conv.kernel.shape, - minval=-1, - maxval=1, - dtype=switch_conv.kernel.dtype) - switch_conv.bias = tf.random.uniform( - switch_conv.bias.shape, - minval=-1, - maxval=1, - dtype=switch_conv.bias.dtype) - small_conv = tf.keras.layers.Conv2D( - 64, - kernel_size=3, - padding='same', - dilation_rate=1, - name='small_conv') - large_conv = tf.keras.layers.Conv2D( - 64, - kernel_size=3, - padding='same', - dilation_rate=3, - name='large_conv') - _ = small_conv(input_tensor) - _ = large_conv(input_tensor) - outputs = sac_layer(input_tensor) - small_conv.kernel = sac_layer.kernel - large_conv.kernel = sac_layer.kernel - # Compute the expected outputs. - switch_outputs = sac_layer._switch(sac_layer._average_pool(input_tensor)) - large_outputs = large_conv(input_tensor) - small_outputs = small_conv(input_tensor) - expected_outputs = (switch_outputs * large_outputs + - (1 - switch_outputs) * small_outputs) - np.testing.assert_array_almost_equal(expected_outputs.numpy(), - outputs.numpy()) - - def test_switchable_atrous_conv_in_conv2dsame(self): - # Tests Switchable Atrous Convolution in Conv2DSame. - input_tensor = tf.random.uniform(shape=(3, 180, 180, 32)) - layer = convolutions.Conv2DSame( - output_channels=64, - kernel_size=7, - strides=1, - name='conv', - use_bias=False, - use_bn=True, - use_switchable_atrous_conv=True, - use_global_context_in_sac=True) - output_tensor = layer(input_tensor) - np.testing.assert_array_almost_equal(output_tensor.shape.as_list(), - [3, 180, 180, 64]) - - def test_conv1d_shape(self): - conv = convolutions.Conv1D( - output_channels=64, - name='conv', - use_bias=False, - use_bn=True) - input_tensor = tf.random.uniform(shape=(2, 180, 3)) - predicted_tensor = conv(input_tensor) - expected_shape = [2, 180, 64] - self.assertListEqual(predicted_tensor.shape.as_list(), expected_shape) - - def test_separable_conv2d_same_output_shape(self): - conv = convolutions.SeparableConv2DSame( - output_channels=64, - kernel_size=3, - name='conv') - input_tensor = tf.random.uniform(shape=(2, 5, 5, 3)) - predicted_tensor = conv(input_tensor) - expected_shape = [2, 5, 5, 64] - self.assertListEqual(predicted_tensor.shape.as_list(), expected_shape) - - def test_stacked_conv2d_same_output_shape(self): - conv = convolutions.StackedConv2DSame( - num_layers=2, - conv_type='depthwise_separable_conv', - output_channels=64, - kernel_size=3, - name='conv') - input_tensor = tf.random.uniform(shape=(2, 5, 5, 3)) - predicted_tensor = conv(input_tensor) - expected_shape = [2, 5, 5, 64] - self.assertListEqual(predicted_tensor.shape.as_list(), expected_shape) - - -if __name__ == '__main__': - tf.test.main() diff --git a/spaces/akhaliq/lama/models/ade20k/segm_lib/nn/modules/__init__.py b/spaces/akhaliq/lama/models/ade20k/segm_lib/nn/modules/__init__.py deleted file mode 100644 index bc8709d92c610b36e0bcbd7da20c1eb41dc8cfcf..0000000000000000000000000000000000000000 --- a/spaces/akhaliq/lama/models/ade20k/segm_lib/nn/modules/__init__.py +++ /dev/null @@ -1,12 +0,0 @@ -# -*- coding: utf-8 -*- -# File : __init__.py -# Author : Jiayuan Mao -# Email : maojiayuan@gmail.com -# Date : 27/01/2018 -# -# This file is part of Synchronized-BatchNorm-PyTorch. -# https://github.com/vacancy/Synchronized-BatchNorm-PyTorch -# Distributed under MIT License. - -from .batchnorm import SynchronizedBatchNorm1d, SynchronizedBatchNorm2d, SynchronizedBatchNorm3d -from .replicate import DataParallelWithCallback, patch_replication_callback diff --git a/spaces/amitjamadagni/qs-benchmarks/welcome.md b/spaces/amitjamadagni/qs-benchmarks/welcome.md deleted file mode 100644 index d1a214f2b2b158766b9d5c5e30967f2ff858218d..0000000000000000000000000000000000000000 --- a/spaces/amitjamadagni/qs-benchmarks/welcome.md +++ /dev/null @@ -1,390 +0,0 @@ - - - -

      -Performance benchmarks of quantum simulators -

      - -

      -There has been a rapid rise in the development of quantum simulators, both to validate the quantum -hardware and also to explore the limitations of classical simulation, thereby the regime of quantum -advantage. Quantum simulators which are HPC (High Performance Computing) compliant are chosen and -their performance is benchmarked on various compute capabilities as offered by the HPC. -

      - -

      -Notebooks provide the Time to Solution (TtS) performance of the quantum simulators -obtained using a containerized toolchain wherein each simulation package accepts the quantum -algorithm in the QASM2 format, the simulation package and the compute capability on the HPC. -The containerized toolchain allows for portability of the benchmarking scheme, reproducibility -of the performance data, is modular and easily extensible to include other packages. -

      - -
      - -The benchmarked packages include: -
      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      #PackageLanguageSinglethreadMultithreadGPUMPIMulti-GPU
      Single PrecisionDouble PrecisionSingle PrecisionDouble PrecisionSingle PrecisionDouble PrecisionSingle PrecisionDouble Precision
      1QiskitPython
      2CirqPython
      3QsimcirqPython
      4PennylanePython
      5Pennylane-lightningC++
      6QiboPython
      7QibojitPython
      8YaoJulia
      9QuestC
      10QulacsPython
      11Intel-QSC++
      12ProjectqPython
      13QcgpuPython
      14HiQPython
      15HybridqPython
      16SV-SimPython
      17QrackC++
      18QpandaPython
      19CuQuantumPython
      20myQLM (py)Python
      21myQLM (C++)C++
      22BraketPython
      23Q++C++
      -
      - -The quantum algorithms benchmarked include: -
        -
      • Dynamics of the Heisenberg model
      • -
      • Random Quantum Circuit as in the Google Sycamore quantum advantage experiment
      • -
      • Quantum Fourier Transform
      • -
      - - diff --git a/spaces/aodianyun/stable-diffusion-webui/webui-user.bat b/spaces/aodianyun/stable-diffusion-webui/webui-user.bat deleted file mode 100644 index e5a257bef06f5bfcaff1c8b33c64a767eb8b3fe5..0000000000000000000000000000000000000000 --- a/spaces/aodianyun/stable-diffusion-webui/webui-user.bat +++ /dev/null @@ -1,8 +0,0 @@ -@echo off - -set PYTHON= -set GIT= -set VENV_DIR= -set COMMANDLINE_ARGS= - -call webui.bat diff --git a/spaces/arxify/RVC-beta-v2-0618/go-web.bat b/spaces/arxify/RVC-beta-v2-0618/go-web.bat deleted file mode 100644 index db1dec52006bc631e4e68bafd619a3a65f202532..0000000000000000000000000000000000000000 --- a/spaces/arxify/RVC-beta-v2-0618/go-web.bat +++ /dev/null @@ -1,2 +0,0 @@ -runtime\python.exe infer-web.py --pycmd runtime\python.exe --port 7897 -pause diff --git a/spaces/arxify/RVC-beta-v2-0618/runtime/Lib/site-packages/altair/examples/donut_chart.py b/spaces/arxify/RVC-beta-v2-0618/runtime/Lib/site-packages/altair/examples/donut_chart.py deleted file mode 100644 index 32498a56d7eb08aac93f862f8596d3ee1cdf9b1c..0000000000000000000000000000000000000000 --- a/spaces/arxify/RVC-beta-v2-0618/runtime/Lib/site-packages/altair/examples/donut_chart.py +++ /dev/null @@ -1,18 +0,0 @@ -""" -Donut Chart ------------ -This example shows how to make a Donut Chart using ``mark_arc``. -This is adapted from a corresponding Vega-Lite Example: -`Donut Chart `_. -""" -# category: circular plots - -import pandas as pd -import altair as alt - -source = pd.DataFrame({"category": [1, 2, 3, 4, 5, 6], "value": [4, 6, 10, 3, 7, 8]}) - -alt.Chart(source).mark_arc(innerRadius=50).encode( - theta=alt.Theta(field="value", type="quantitative"), - color=alt.Color(field="category", type="nominal"), -) diff --git a/spaces/aseuteurideu/audio_deepfake_detector/README.md b/spaces/aseuteurideu/audio_deepfake_detector/README.md deleted file mode 100644 index a44554dda6d268e0dc16a7e0de293a7b5d1e44d2..0000000000000000000000000000000000000000 --- a/spaces/aseuteurideu/audio_deepfake_detector/README.md +++ /dev/null @@ -1,20 +0,0 @@ ---- -title: Audio Deepfake Detector -emoji: 🚀 -colorFrom: purple -colorTo: pink -sdk: gradio -sdk_version: 3.37.0 -app_file: app.py -pinned: false ---- - -Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference - -### Performing inference with the trained model. - -#### Run the command below to use gradio to run the model. - -```cmd -python app.py -``` \ No newline at end of file diff --git a/spaces/at2507/SM_NLP_RecoSys/Data/Mentor_interviews/Roegelio Cuevas.html b/spaces/at2507/SM_NLP_RecoSys/Data/Mentor_interviews/Roegelio Cuevas.html deleted file mode 100644 index 0439e255e226e7c9f5cd408fda9d8ec2a1b75bdf..0000000000000000000000000000000000000000 --- a/spaces/at2507/SM_NLP_RecoSys/Data/Mentor_interviews/Roegelio Cuevas.html +++ /dev/null @@ -1,134 +0,0 @@ - - - - Roegelio Cuevas - - - - -
      -

      Roegelio Cuevas

      - -
      -
      Now that my current role is more management-oriented and being hands on the past, I see mentorship as an opportunity for me to keep growing as a tech manager while forcing myself to keep hands-on skills through a mentorship experience.
      Additionally, in the past I have learned from people I have mentored as they follow recent threads in the DS/ML space. This allows for a mutually beneficial relationship of common growth for both parties. 

      Looking forward to the opportunity! 


      Interview


      Career
      • Financial sector
      • came from academia
      • as a postdoc I did some self-training, industry was still just picking up
      • landed a fellowship
      • worked for a few startups
      • ran some workshops for IBM (Big data university)
      • scotia bank - models for risk management 
      • Then TD bank - lead DS
      • at SunLife in a "Leadership" position
      • doing mostly management, but wants to keep himself busy by playing with keyboard as much as he can
      • SM will keep his hands dirty
      • teach every now and then (on DS 101)
      • But would rather be working on nice end-to-end projects (MLops and dev ops)
      What are beginners lacking?
      • Folks are starting with the model, and looking for a problem
      • and getting to the nitty-gritty and asking the right questions
      • managing disappointment (you don't need a sophisticated problem)
        • start simple and then get fancy
      • solving business problems
      And how can you add value as a mentor?
      • don't give the answer right away
      • ask a lot of questions, poke for a while, see where they are, where they stand
      • when I see a red flag, I will emphasize on that
      • If I see something that is rescuable, ask leading questions
      • They need to build that confidence with the knowledge that they still need to learn
      • business folks you talk to might not be technical, but that doesn't mean they're not smart
        -
        -
      Questions about SM?
      • Freedom of the mentor?
      • How does a mentor get feedback?
      • What is the vetting process to get more spots?
      • What are the timelines w.r.t. the mentorship and ISA?
      -
      - -
      - - - \ No newline at end of file diff --git a/spaces/awacke1/6-TreemapSunburst/app.py b/spaces/awacke1/6-TreemapSunburst/app.py deleted file mode 100644 index 7e82b33b6fcf4e043710475b5be4d99624c99459..0000000000000000000000000000000000000000 --- a/spaces/awacke1/6-TreemapSunburst/app.py +++ /dev/null @@ -1,230 +0,0 @@ -import streamlit as st -import numpy as np -import plotly.express as px -import pandas as pd -import plotly.graph_objects as go - -st.set_page_config(page_title="Plotly Graphing Libraries",layout='wide') - -import streamlit as st - -uploaded_files = st.file_uploader("Choose a CSV file", accept_multiple_files=True) -for uploaded_file in uploaded_files: - bytes_data = uploaded_file.read() - st.write("filename:", uploaded_file.name) - st.write(bytes_data) - - if st.checkbox("FileDetails"): - - filevalue = uploaded_file.getvalue() - st.write(filevalue) - st.write(uploaded_file.name) - st.write(uploaded_file.type) - st.write(uploaded_file.size) - #st.write(uploaded_file.last_modified) - #st.write(uploaded_file.charset) - st.write(uploaded_file.getbuffer()) - st.write(uploaded_file.getbuffer().nbytes) - st.write(uploaded_file.getbuffer().tobytes()) - st.write(uploaded_file.getbuffer().tolist()) - st.write(uploaded_file.getbuffer().itemsize) - st.write(uploaded_file.getbuffer().ndim) - st.write(uploaded_file.getbuffer().shape) - st.write(uploaded_file.getbuffer().strides) - st.write(uploaded_file.getbuffer().suboffsets) - st.write(uploaded_file.getbuffer().readonly) - st.write(uploaded_file.getbuffer().c_contiguous) - st.write(uploaded_file.getbuffer().f_contiguous) - st.write(uploaded_file.getbuffer().contiguous) - st.write(uploaded_file.getbuffer().itemsize) - st.write(uploaded_file.getbuffer().nbytes) - st.write(uploaded_file.getbuffer().ndim) - st.write(uploaded_file.getbuffer().shape) - st.write(uploaded_file.getbuffer().strides) - st.write(uploaded_file.getbuffer().suboffsets) - st.write(uploaded_file.getbuffer().readonly) - st.write(uploaded_file.getbuffer().c_contiguous) - st.write(uploaded_file.getbuffer().f_contiguous) - st.write(uploaded_file.getbuffer().contiguous) - st.write(uploaded_file.getbuffer().itemsize) - st.write(uploaded_file.getbuffer().nbytes) - st.write(uploaded_file.getbuffer().ndim) - st.write(uploaded_file.getbuffer().shape) - st.write(uploaded_file.getbuffer().strides) - st.write(uploaded_file.getbuffer().suboffsets) - st.write(uploaded_file.getbuffer().readonly) - st.write(uploaded_file.getbuffer().c_contiguous) - st.write(uploaded_file.getbuffer().f_contiguous) - myDF = pd.DataFrame(uploaded_file.getbuffer().tolist()) - - - st.markdown("# Treemaps from upload data file: https://plotly.com/python/treemaps/") - #df = myDF.query("year == 2007") - df = myDF - fig = px.treemap(df, path=[px.Constant("time"), 'message', 'name'], values='content', - color='lifeExp', hover_data=['iso_alpha'], - color_continuous_scale='RdBu', - color_continuous_midpoint=np.average(df['name'], weights=df['content'])) # todo - debug this and get it working with the data - fig.update_layout(margin = dict(t=50, l=25, r=25, b=25)) - #fig.show() - st.plotly_chart(fig, use_container_width=True) - - - - -#show replace - if st.checkbox("replace"): - mydf = st.dataframe(df) - columns = st.selectbox("Select column", df.columns) - old_values = st.multiselect("Current Values",list(df[columns].unique()),list(df[columns].unique())) - with st.form(key='my_form'): - col1,col2 = st.beta_columns(2) - st_input = st.number_input if is_numeric_dtype(df[columns]) else st.text_input - with col1: - old_val = st_input("old value") - with col2: - new_val = st_input("new value") - if st.form_submit_button("Replace"): - df[columns]=df[columns].replace(old_val,new_val) - st.success("{} replace with {} successfully ".format(old_val,new_val)) - excel = df.to_excel(r"F:\book2.xlsx", index = False, header=True,encoding="utf-8") - df =pd.read_excel(r"F:\book2.xlsx") - mydf.add_rows(df) - -st.markdown("WebGL Rendering with 1,000,000 Points") -import plotly.graph_objects as go -import numpy as np -N = 1000000 -fig = go.Figure() -fig.add_trace( - go.Scattergl( - x = np.random.randn(N), - y = np.random.randn(N), - mode = 'markers', - marker = dict( - line = dict( - width = 1, - color = 'DarkSlateGrey') - ) - ) -) -#fig.show() -st.plotly_chart(fig, use_container_width=True) - - - -st.markdown("# WebGL Graph - ScatterGL") -fig = go.Figure() -trace_num = 10 -point_num = 5000 -for i in range(trace_num): - fig.add_trace( - go.Scattergl( - x = np.linspace(0, 1, point_num), - y = np.random.randn(point_num)+(i*5) - ) - ) -fig.update_layout(showlegend=False) -#fig.show() -st.plotly_chart(fig, use_container_width=True) - - -st.markdown("# Treemaps: https://plotly.com/python/treemaps/") -df = px.data.gapminder().query("year == 2007") -fig = px.treemap(df, path=[px.Constant("world"), 'continent', 'country'], values='pop', - color='lifeExp', hover_data=['iso_alpha'], - color_continuous_scale='RdBu', - color_continuous_midpoint=np.average(df['lifeExp'], weights=df['pop'])) -fig.update_layout(margin = dict(t=50, l=25, r=25, b=25)) -#fig.show() -st.plotly_chart(fig, use_container_width=True) - - -st.markdown("# Sunburst: https://plotly.com/python/sunburst-charts/") - - -st.markdown("# Life Expectancy Sunburst") -df = px.data.gapminder().query("year == 2007") -fig = px.sunburst(df, path=['continent', 'country'], values='pop', - color='lifeExp', hover_data=['iso_alpha'], - color_continuous_scale='RdBu', - color_continuous_midpoint=np.average(df['lifeExp'], weights=df['pop'])) -st.plotly_chart(fig, use_container_width=True) - - -st.markdown("# Coffee Aromas and Tastes Sunburst") -df1 = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/718417069ead87650b90472464c7565dc8c2cb1c/sunburst-coffee-flavors-complete.csv') -df2 = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/718417069ead87650b90472464c7565dc8c2cb1c/coffee-flavors.csv') -fig = go.Figure() -fig.add_trace(go.Sunburst( - ids=df1.ids, - labels=df1.labels, - parents=df1.parents, - domain=dict(column=0) -)) -fig.add_trace(go.Sunburst( - ids=df2.ids, - labels=df2.labels, - parents=df2.parents, - domain=dict(column=1), - maxdepth=2 -)) -fig.update_layout( - grid= dict(columns=2, rows=1), - margin = dict(t=0, l=0, r=0, b=0) -) -st.plotly_chart(fig, use_container_width=True) - - - - - -# Sunburst -#data = dict( -# character=["Eve", "Cain", "Seth", "Enos", "Noam", "Abel", "Awan", "Enoch", "Azura"], -# parent=["", "Eve", "Eve", "Seth", "Seth", "Eve", "Eve", "Awan", "Eve" ], -# value=[10, 14, 12, 10, 2, 6, 6, 4, 4]) -#fig = px.sunburst( -# data, -# names='character', -# parents='parent', -# values='value', -#) -#fig.show() -#st.plotly_chart(fig, use_container_width=True) - - -df = px.data.tips() -fig = px.treemap(df, path=[px.Constant("all"), 'sex', 'day', 'time'], - values='total_bill', color='time', - color_discrete_map={'(?)':'lightgrey', 'Lunch':'gold', 'Dinner':'darkblue'}) -fig.update_layout(margin = dict(t=50, l=25, r=25, b=25)) -#fig.show() -fig.update_traces(marker=dict(cornerradius=5)) - -st.plotly_chart(fig, use_container_width=True) - - -df = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/96c0bd/sunburst-coffee-flavors-complete.csv') -fig = go.Figure(go.Treemap( - ids = df.ids, - labels = df.labels, - parents = df.parents, - pathbar_textfont_size=15, - root_color="lightgrey" -)) -fig.update_layout( - uniformtext=dict(minsize=10, mode='hide'), - margin = dict(t=50, l=25, r=25, b=25) -) -#fig.show() -st.plotly_chart(fig, use_container_width=True) - - -df = pd.read_pickle('bloom_dataset.pkl') -fig = px.treemap(df, path=[px.Constant("ROOTS"), 'Macroarea', 'Family', 'Genus', 'Language', 'dataset_name'], - values='num_bytes', maxdepth=4) -fig.update_traces(root_color="pink") -fig.update_layout(margin = dict(t=50, l=25, r=25, b=25)) - -st.plotly_chart(fig, use_container_width=True) \ No newline at end of file diff --git a/spaces/awacke1/CardWriterPro/extract_code.py b/spaces/awacke1/CardWriterPro/extract_code.py deleted file mode 100644 index a11c8ae57e99dce3af3357bb24ea1e49ebe2ea89..0000000000000000000000000000000000000000 --- a/spaces/awacke1/CardWriterPro/extract_code.py +++ /dev/null @@ -1,532 +0,0 @@ -#!/usr/bin/env python3 - -import re - -""" -Extracts code from the file "./Libraries.ts". -(Note that "Libraries.ts", must be in the same directory as -this script). -""" - -file = None - -def read_file(library: str, model_name: str) -> str: - text = file - - match = re.search('const ' + library + '.*', text, re.DOTALL).group() - if match: - text = match[match.index('`') + 1:match.index('`;')].replace('${model.id}', model_name) - - return text - -file = """ -import type { ModelData } from "./Types"; -/** - * Add your new library here. - */ -export enum ModelLibrary { - "adapter-transformers" = "Adapter Transformers", - "allennlp" = "allenNLP", - "asteroid" = "Asteroid", - "diffusers" = "Diffusers", - "espnet" = "ESPnet", - "fairseq" = "Fairseq", - "flair" = "Flair", - "keras" = "Keras", - "nemo" = "NeMo", - "pyannote-audio" = "pyannote.audio", - "sentence-transformers" = "Sentence Transformers", - "sklearn" = "Scikit-learn", - "spacy" = "spaCy", - "speechbrain" = "speechbrain", - "tensorflowtts" = "TensorFlowTTS", - "timm" = "Timm", - "fastai" = "fastai", - "transformers" = "Transformers", - "stanza" = "Stanza", - "fasttext" = "fastText", - "stable-baselines3" = "Stable-Baselines3", - "ml-agents" = "ML-Agents", -} - -export const ALL_MODEL_LIBRARY_KEYS = Object.keys(ModelLibrary) as (keyof typeof ModelLibrary)[]; - - -/** - * Elements configurable by a model library. - */ -export interface LibraryUiElement { - /** - * Name displayed on the main - * call-to-action button on the model page. - */ - btnLabel: string; - /** - * Repo name - */ - repoName: string; - /** - * URL to library's repo - */ - repoUrl: string; - /** - * Code snippet displayed on model page - */ - snippet: (model: ModelData) => string; -} - -function nameWithoutNamespace(modelId: string): string { - const splitted = modelId.split("/"); - return splitted.length === 1 ? splitted[0] : splitted[1]; -} - -//#region snippets - -const adapter_transformers = (model: ModelData) => - `from transformers import ${model.config?.adapter_transformers?.model_class} - -model = ${model.config?.adapter_transformers?.model_class}.from_pretrained("${model.config?.adapter_transformers?.{model.id}}") -model.load_adapter("${model.id}", source="hf")`; - -const allennlpUnknown = (model: ModelData) => - `import allennlp_models -from allennlp.predictors.predictor import Predictor - -predictor = Predictor.from_path("hf://${model.id}")`; - -const allennlpQuestionAnswering = (model: ModelData) => - `import allennlp_models -from allennlp.predictors.predictor import Predictor - -predictor = Predictor.from_path("hf://${model.id}") -predictor_input = {"passage": "My name is Wolfgang and I live in Berlin", "question": "Where do I live?"} -predictions = predictor.predict_json(predictor_input)`; - -const allennlp = (model: ModelData) => { - if (model.tags?.includes("question-answering")) { - return allennlpQuestionAnswering(model); - } - return allennlpUnknown(model); -}; - -const asteroid = (model: ModelData) => - `from asteroid.models import BaseModel - -model = BaseModel.from_pretrained("${model.id}")`; - -const diffusers = (model: ModelData) => - `from diffusers import DiffusionPipeline - -pipeline = DiffusionPipeline.from_pretrained("${model.id}"${model.private ? ", use_auth_token=True" : ""})`; - -const espnetTTS = (model: ModelData) => - `from espnet2.bin.tts_inference import Text2Speech - -model = Text2Speech.from_pretrained("${model.id}") - -speech, *_ = model("text to generate speech from")`; - -const espnetASR = (model: ModelData) => - `from espnet2.bin.asr_inference import Speech2Text - -model = Speech2Text.from_pretrained( - "${model.id}" -) - -speech, rate = soundfile.read("speech.wav") -text, *_ = model(speech)`; - -const espnetUnknown = () => - `unknown model type (must be text-to-speech or automatic-speech-recognition)`; - -const espnet = (model: ModelData) => { - if (model.tags?.includes("text-to-speech")) { - return espnetTTS(model); - } else if (model.tags?.includes("automatic-speech-recognition")) { - return espnetASR(model); - } - return espnetUnknown(); -}; - -const fairseq = (model: ModelData) => - `from fairseq.checkpoint_utils import load_model_ensemble_and_task_from_hf_hub - -models, cfg, task = load_model_ensemble_and_task_from_hf_hub( - "${model.id}" -)`; - - -const flair = (model: ModelData) => - `from flair.models import SequenceTagger - -tagger = SequenceTagger.load("${model.id}")`; - -const keras = (model: ModelData) => - `from huggingface_hub import from_pretrained_keras - -model = from_pretrained_keras("${model.id}") -`; - -const pyannote_audio_pipeline = (model: ModelData) => - `from pyannote.audio import Pipeline - -pipeline = Pipeline.from_pretrained("${model.id}") - -# inference on the whole file -pipeline("file.wav") - -# inference on an excerpt -from pyannote.core import Segment -excerpt = Segment(start=2.0, end=5.0) - -from pyannote.audio import Audio -waveform, sample_rate = Audio().crop("file.wav", excerpt) -pipeline({"waveform": waveform, "sample_rate": sample_rate})`; - -const pyannote_audio_model = (model: ModelData) => - `from pyannote.audio import Model, Inference - -model = Model.from_pretrained("${model.id}") -inference = Inference(model) - -# inference on the whole file -inference("file.wav") - -# inference on an excerpt -from pyannote.core import Segment -excerpt = Segment(start=2.0, end=5.0) -inference.crop("file.wav", excerpt)`; - -const pyannote_audio = (model: ModelData) => { - if (model.tags?.includes("pyannote-audio-pipeline")) { - return pyannote_audio_pipeline(model); - } - return pyannote_audio_model(model); -}; - -const tensorflowttsTextToMel = (model: ModelData) => - `from tensorflow_tts.inference import AutoProcessor, TFAutoModel - -processor = AutoProcessor.from_pretrained("${model.id}") -model = TFAutoModel.from_pretrained("${model.id}") -`; - -const tensorflowttsMelToWav = (model: ModelData) => - `from tensorflow_tts.inference import TFAutoModel - -model = TFAutoModel.from_pretrained("${model.id}") -audios = model.inference(mels) -`; - -const tensorflowttsUnknown = (model: ModelData) => - `from tensorflow_tts.inference import TFAutoModel - -model = TFAutoModel.from_pretrained("${model.id}") -`; - -const tensorflowtts = (model: ModelData) => { - if (model.tags?.includes("text-to-mel")) { - return tensorflowttsTextToMel(model); - } else if (model.tags?.includes("mel-to-wav")) { - return tensorflowttsMelToWav(model); - } - return tensorflowttsUnknown(model); -}; - -const timm = (model: ModelData) => - `import timm - -model = timm.create_model("hf_hub:${model.id}", pretrained=True)`; - -const sklearn = (model: ModelData) => - `from huggingface_hub import hf_hub_download -import joblib - -model = joblib.load( - hf_hub_download("${model.id}", "sklearn_model.joblib") -)`; - -const fastai = (model: ModelData) => - `from huggingface_hub import from_pretrained_fastai - -learn = from_pretrained_fastai("${model.id}")`; - -const sentenceTransformers = (model: ModelData) => - `from sentence_transformers import SentenceTransformer - -model = SentenceTransformer("${model.id}")`; - -const spacy = (model: ModelData) => - `!pip install https://huggingface.co/${model.id}/resolve/main/${nameWithoutNamespace(model.id)}-any-py3-none-any.whl - -# Using spacy.load(). -import spacy -nlp = spacy.load("${nameWithoutNamespace(model.id)}") - -# Importing as module. -import ${nameWithoutNamespace(model.id)} -nlp = ${nameWithoutNamespace(model.id)}.load()`; - -const stanza = (model: ModelData) => - `import stanza - -stanza.download("${nameWithoutNamespace(model.id).replace("stanza-", "")}") -nlp = stanza.Pipeline("${nameWithoutNamespace(model.id).replace("stanza-", "")}")`; - - -const speechBrainMethod = (speechbrainInterface: string) => { - switch (speechbrainInterface) { - case "EncoderClassifier": - return "classify_file"; - case "EncoderDecoderASR": - case "EncoderASR": - return "transcribe_file"; - case "SpectralMaskEnhancement": - return "enhance_file"; - case "SepformerSeparation": - return "separate_file"; - default: - return undefined; - } -}; - -const speechbrain = (model: ModelData) => { - const speechbrainInterface = model.config?.speechbrain?.interface; - if (speechbrainInterface === undefined) { - return `# interface not specified in config.json`; - } - - const speechbrainMethod = speechBrainMethod(speechbrainInterface); - if (speechbrainMethod === undefined) { - return `# interface in config.json invalid`; - } - - return `from speechbrain.pretrained import ${speechbrainInterface} -model = ${speechbrainInterface}.from_hparams( - "${model.id}" -) -model.${speechbrainMethod}("file.wav")`; -}; - -const transformers = (model: ModelData) => { - const info = model.transformersInfo; - if (!info) { - return `# ⚠️ Type of model unknown`; - } - if (info.processor) { - const varName = info.processor === "AutoTokenizer" ? "tokenizer" - : info.processor === "AutoFeatureExtractor" ? "extractor" - : "processor" - ; - return [ - `from transformers import ${info.processor}, ${info.auto_model}`, - "", - `${varName} = ${info.processor}.from_pretrained("${model.id}"${model.private ? ", use_auth_token=True" : ""})`, - "", - `model = ${info.auto_model}.from_pretrained("${model.id}"${model.private ? ", use_auth_token=True" : ""})`, - ].join("\n"); - } else { - return [ - `from transformers import ${info.auto_model}`, - "", - `model = ${info.auto_model}.from_pretrained("${model.id}"${model.private ? ", use_auth_token=True" : ""})`, - ].join("\n"); - } -}; - -const fasttext = (model: ModelData) => - `from huggingface_hub import hf_hub_download -import fasttext - -model = fasttext.load_model(hf_hub_download("${model.id}", "model.bin"))`; - -const stableBaselines3 = (model: ModelData) => - `from huggingface_sb3 import load_from_hub -checkpoint = load_from_hub( - repo_id="${model.id}", - filename="{MODEL FILENAME}.zip", -)`; - -const nemoDomainResolver = (domain: string, model: ModelData): string | undefined => { - const modelName = `${nameWithoutNamespace(model.id)}.nemo`; - - switch (domain) { - case "ASR": - return `import nemo.collections.asr as nemo_asr -asr_model = nemo_asr.models.ASRModel.from_pretrained("${model.id}") - -transcriptions = asr_model.transcribe(["file.wav"])`; - default: - return undefined; - } -}; - -const mlAgents = (model: ModelData) => - `mlagents-load-from-hf --repo-id="${model.id}" --local-dir="./downloads"`; - -const nemo = (model: ModelData) => { - let command: string | undefined = undefined; - // Resolve the tag to a nemo domain/sub-domain - if (model.tags?.includes("automatic-speech-recognition")) { - command = nemoDomainResolver("ASR", model); - } - - return command ?? `# tag did not correspond to a valid NeMo domain.`; -}; - -//#endregion - - - -export const MODEL_LIBRARIES_UI_ELEMENTS: { [key in keyof typeof ModelLibrary]?: LibraryUiElement } = { - // ^^ TODO(remove the optional ? marker when Stanza snippet is available) - "adapter-transformers": { - btnLabel: "Adapter Transformers", - repoName: "adapter-transformers", - repoUrl: "https://github.com/Adapter-Hub/adapter-transformers", - snippet: adapter_transformers, - }, - "allennlp": { - btnLabel: "AllenNLP", - repoName: "AllenNLP", - repoUrl: "https://github.com/allenai/allennlp", - snippet: allennlp, - }, - "asteroid": { - btnLabel: "Asteroid", - repoName: "Asteroid", - repoUrl: "https://github.com/asteroid-team/asteroid", - snippet: asteroid, - }, - "diffusers": { - btnLabel: "Diffusers", - repoName: "🤗/diffusers", - repoUrl: "https://github.com/huggingface/diffusers", - snippet: diffusers, - }, - "espnet": { - btnLabel: "ESPnet", - repoName: "ESPnet", - repoUrl: "https://github.com/espnet/espnet", - snippet: espnet, - }, - "fairseq": { - btnLabel: "Fairseq", - repoName: "fairseq", - repoUrl: "https://github.com/pytorch/fairseq", - snippet: fairseq, - }, - "flair": { - btnLabel: "Flair", - repoName: "Flair", - repoUrl: "https://github.com/flairNLP/flair", - snippet: flair, - }, - "keras": { - btnLabel: "Keras", - repoName: "Keras", - repoUrl: "https://github.com/keras-team/keras", - snippet: keras, - }, - "nemo": { - btnLabel: "NeMo", - repoName: "NeMo", - repoUrl: "https://github.com/NVIDIA/NeMo", - snippet: nemo, - }, - "pyannote-audio": { - btnLabel: "pyannote.audio", - repoName: "pyannote-audio", - repoUrl: "https://github.com/pyannote/pyannote-audio", - snippet: pyannote_audio, - }, - "sentence-transformers": { - btnLabel: "sentence-transformers", - repoName: "sentence-transformers", - repoUrl: "https://github.com/UKPLab/sentence-transformers", - snippet: sentenceTransformers, - }, - "sklearn": { - btnLabel: "Scikit-learn", - repoName: "Scikit-learn", - repoUrl: "https://github.com/scikit-learn/scikit-learn", - snippet: sklearn, - }, - "fastai": { - btnLabel: "fastai", - repoName: "fastai", - repoUrl: "https://github.com/fastai/fastai", - snippet: fastai, - }, - "spacy": { - btnLabel: "spaCy", - repoName: "spaCy", - repoUrl: "https://github.com/explosion/spaCy", - snippet: spacy, - }, - "speechbrain": { - btnLabel: "speechbrain", - repoName: "speechbrain", - repoUrl: "https://github.com/speechbrain/speechbrain", - snippet: speechbrain, - }, - "stanza": { - btnLabel: "Stanza", - repoName: "stanza", - repoUrl: "https://github.com/stanfordnlp/stanza", - snippet: stanza, - }, - "tensorflowtts": { - btnLabel: "TensorFlowTTS", - repoName: "TensorFlowTTS", - repoUrl: "https://github.com/TensorSpeech/TensorFlowTTS", - snippet: tensorflowtts, - }, - "timm": { - btnLabel: "timm", - repoName: "pytorch-image-models", - repoUrl: "https://github.com/rwightman/pytorch-image-models", - snippet: timm, - }, - "transformers": { - btnLabel: "Transformers", - repoName: "🤗/transformers", - repoUrl: "https://github.com/huggingface/transformers", - snippet: transformers, - }, - "fasttext": { - btnLabel: "fastText", - repoName: "fastText", - repoUrl: "https://fasttext.cc/", - snippet: fasttext, - }, - "stable-baselines3": { - btnLabel: "stable-baselines3", - repoName: "stable-baselines3", - repoUrl: "https://github.com/huggingface/huggingface_sb3", - snippet: stableBaselines3, - }, - "ml-agents": { - btnLabel: "ml-agents", - repoName: "ml-agents", - repoUrl: "https://github.com/huggingface/ml-agents", - snippet: mlAgents, - }, -} as const; -""" - - -if __name__ == '__main__': - import sys - library_name = "keras" - model_name = "Distillgpt2" - print(read_file(library_name, model_name)) - - """" - try: - args = sys.argv[1:] - if args: - print(read_file(args[0], args[1])) - except IndexError: - pass - """ \ No newline at end of file diff --git a/spaces/awacke1/Face_Recognition_with_Sentiment/darknet.py b/spaces/awacke1/Face_Recognition_with_Sentiment/darknet.py deleted file mode 100644 index 6dc6918cd0d7b5940a2a21754abaeefd07e99fd4..0000000000000000000000000000000000000000 --- a/spaces/awacke1/Face_Recognition_with_Sentiment/darknet.py +++ /dev/null @@ -1,322 +0,0 @@ -# PyTorch implementation of Darknet -# This is a custom, hard-coded version of darknet with -# YOLOv3 implementation for openimages database. This -# was written to test viability of implementing YOLO -# for face detection followed by emotion / sentiment -# analysis. -# -# Configuration, weights and data are hardcoded. -# Additional options include, ability to create -# subset of data with faces exracted for labelling. -# -# Author : Saikiran Tharimena -# Co-Authors: Kjetil Marinius Sjulsen, Juan Carlos Calvet Lopez -# Project : Emotion / Sentiment Detection from news images -# Date : 12 September 2022 -# Version : v0.1 -# -# (C) Schibsted ASA - -# Libraries -import torch -import torch.nn as nn -import torch.nn.functional as F -from torch.autograd import Variable -import numpy as np -from utils import * - - -def parse_cfg(cfgfile): - """ - Takes a configuration file - - Returns a list of blocks. Each blocks describes a block in the neural - network to be built. Block is represented as a dictionary in the list - - """ - - file = open(cfgfile, 'r') - lines = file.read().split('\n') # store the lines in a list - lines = [x for x in lines if len(x) > 0] # get read of the empty lines - lines = [x for x in lines if x[0] != '#'] # get rid of comments - lines = [x.rstrip().lstrip() for x in lines] # get rid of fringe whitespaces - - block = {} - blocks = [] - - for line in lines: - if line[0] == "[": # This marks the start of a new block - if len(block) != 0: # If block is not empty, implies it is storing values of previous block. - blocks.append(block) # add it the blocks list - block = {} # re-init the block - block["type"] = line[1:-1].rstrip() - else: - key,value = line.split("=") - block[key.rstrip()] = value.lstrip() - blocks.append(block) - - return blocks - - -class EmptyLayer(nn.Module): - def __init__(self): - super(EmptyLayer, self).__init__() - - -class DetectionLayer(nn.Module): - def __init__(self, anchors): - super(DetectionLayer, self).__init__() - self.anchors = anchors - - -def create_modules(blocks): - net_info = blocks[0] #Captures the information about the input and pre-processing - module_list = nn.ModuleList() - prev_filters = 3 - output_filters = [] - - for index, x in enumerate(blocks[1:]): - module = nn.Sequential() - - #check the type of block - #create a new module for the block - #append to module_list - - #If it's a convolutional layer - if (x["type"] == "convolutional"): - #Get the info about the layer - activation = x["activation"] - try: - batch_normalize = int(x["batch_normalize"]) - bias = False - except: - batch_normalize = 0 - bias = True - - filters= int(x["filters"]) - padding = int(x["pad"]) - kernel_size = int(x["size"]) - stride = int(x["stride"]) - - if padding: - pad = (kernel_size - 1) // 2 - else: - pad = 0 - - #Add the convolutional layer - conv = nn.Conv2d(prev_filters, filters, kernel_size, stride, pad, bias = bias) - module.add_module("conv_{0}".format(index), conv) - - #Add the Batch Norm Layer - if batch_normalize: - bn = nn.BatchNorm2d(filters) - module.add_module("batch_norm_{0}".format(index), bn) - - #Check the activation. - #It is either Linear or a Leaky ReLU for YOLO - if activation == "leaky": - activn = nn.LeakyReLU(0.1, inplace = True) - module.add_module("leaky_{0}".format(index), activn) - - #If it's an upsampling layer - #We use Bilinear2dUpsampling - elif (x["type"] == "upsample"): - stride = int(x["stride"]) - upsample = nn.Upsample(scale_factor = 2, mode = "nearest") - module.add_module("upsample_{}".format(index), upsample) - - #If it is a route layer - elif (x["type"] == "route"): - x["layers"] = x["layers"].split(',') - #Start of a route - start = int(x["layers"][0]) - #end, if there exists one. - try: - end = int(x["layers"][1]) - except: - end = 0 - #Positive anotation - if start > 0: - start = start - index - if end > 0: - end = end - index - route = EmptyLayer() - module.add_module("route_{0}".format(index), route) - if end < 0: - filters = output_filters[index + start] + output_filters[index + end] - else: - filters= output_filters[index + start] - - #shortcut corresponds to skip connection - elif x["type"] == "shortcut": - shortcut = EmptyLayer() - module.add_module("shortcut_{}".format(index), shortcut) - - #Yolo is the detection layer - elif x["type"] == "yolo": - mask = x["mask"].split(",") - mask = [int(x) for x in mask] - - anchors = x["anchors"].split(",") - anchors = [int(a) for a in anchors] - anchors = [(anchors[i], anchors[i+1]) for i in range(0, len(anchors),2)] - anchors = [anchors[i] for i in mask] - - detection = DetectionLayer(anchors) - module.add_module("Detection_{}".format(index), detection) - - module_list.append(module) - prev_filters = filters - output_filters.append(filters) - - return (net_info, module_list) - -class Darknet(nn.Module): - def __init__(self, cfgfile): - super(Darknet, self).__init__() - self.blocks = parse_cfg(cfgfile) - self.net_info, self.module_list = create_modules(self.blocks) - - def forward(self, x, CUDA): - modules = self.blocks[1:] - outputs = {} #We cache the outputs for the route layer - - write = 0 - for i, module in enumerate(modules): - module_type = (module["type"]) - - if module_type == "convolutional" or module_type == "upsample": - x = self.module_list[i](x) - - elif module_type == "route": - layers = module["layers"] - layers = [int(a) for a in layers] - - if (layers[0]) > 0: - layers[0] = layers[0] - i - - if len(layers) == 1: - x = outputs[i + (layers[0])] - - else: - if (layers[1]) > 0: - layers[1] = layers[1] - i - - map1 = outputs[i + layers[0]] - map2 = outputs[i + layers[1]] - x = torch.cat((map1, map2), 1) - - - elif module_type == "shortcut": - from_ = int(module["from"]) - x = outputs[i-1] + outputs[i+from_] - - elif module_type == 'yolo': - anchors = self.module_list[i][0].anchors - #Get the input dimensions - inp_dim = int (self.net_info["height"]) - - #Get the number of classes - num_classes = int (module["classes"]) - - #Transform - x = x.data - x = predict_transform(x, inp_dim, anchors, num_classes, CUDA) - if not write: #if no collector has been intialised. - detections = x - write = 1 - - else: - detections = torch.cat((detections, x), 1) - - outputs[i] = x - - return detections - - - def load_weights(self, weightfile): - #Open the weights file - fp = open(weightfile, "rb") - - #The first 5 values are header information - # 1. Major version number - # 2. Minor Version Number - # 3. Subversion number - # 4,5. Images seen by the network (during training) - header = np.fromfile(fp, dtype = np.int32, count = 5) - self.header = torch.from_numpy(header) - self.seen = self.header[3] - - weights = np.fromfile(fp, dtype = np.float32) - - ptr = 0 - for i in range(len(self.module_list)): - module_type = self.blocks[i + 1]["type"] - - #If module_type is convolutional load weights - #Otherwise ignore. - - if module_type == "convolutional": - model = self.module_list[i] - try: - batch_normalize = int(self.blocks[i+1]["batch_normalize"]) - except: - batch_normalize = 0 - - conv = model[0] - - - if (batch_normalize): - bn = model[1] - - #Get the number of weights of Batch Norm Layer - num_bn_biases = bn.bias.numel() - - #Load the weights - bn_biases = torch.from_numpy(weights[ptr:ptr + num_bn_biases]) - ptr += num_bn_biases - - bn_weights = torch.from_numpy(weights[ptr: ptr + num_bn_biases]) - ptr += num_bn_biases - - bn_running_mean = torch.from_numpy(weights[ptr: ptr + num_bn_biases]) - ptr += num_bn_biases - - bn_running_var = torch.from_numpy(weights[ptr: ptr + num_bn_biases]) - ptr += num_bn_biases - - #Cast the loaded weights into dims of model weights. - bn_biases = bn_biases.view_as(bn.bias.data) - bn_weights = bn_weights.view_as(bn.weight.data) - bn_running_mean = bn_running_mean.view_as(bn.running_mean) - bn_running_var = bn_running_var.view_as(bn.running_var) - - #Copy the data to model - bn.bias.data.copy_(bn_biases) - bn.weight.data.copy_(bn_weights) - bn.running_mean.copy_(bn_running_mean) - bn.running_var.copy_(bn_running_var) - - else: - #Number of biases - num_biases = conv.bias.numel() - - #Load the weights - conv_biases = torch.from_numpy(weights[ptr: ptr + num_biases]) - ptr = ptr + num_biases - - #reshape the loaded weights according to the dims of the model weights - conv_biases = conv_biases.view_as(conv.bias.data) - - #Finally copy the data - conv.bias.data.copy_(conv_biases) - - #Let us load the weights for the Convolutional layers - num_weights = conv.weight.numel() - - #Do the same as above for weights - conv_weights = torch.from_numpy(weights[ptr:ptr+num_weights]) - ptr = ptr + num_weights - - conv_weights = conv_weights.view_as(conv.weight.data) - conv.weight.data.copy_(conv_weights) \ No newline at end of file diff --git a/spaces/awacke1/Pandas-Gamification-Mechanics/app.py b/spaces/awacke1/Pandas-Gamification-Mechanics/app.py deleted file mode 100644 index 9c8667cd0c80269c3cbf06c7e2045917cb88ace4..0000000000000000000000000000000000000000 --- a/spaces/awacke1/Pandas-Gamification-Mechanics/app.py +++ /dev/null @@ -1,172 +0,0 @@ -import streamlit as st -import random -import pandas as pd -from datetime import datetime - -# Define the game mechanics - -def generate_scenario(): - scenarios = ['🦸 You are a superhero saving the world from a meteorite', - '🏴‍☠️ You are a pirate searching for treasure on a deserted island', - '👨‍🍳 You are a chef trying to win a cooking competition', - '🕵️ You are a detective solving a murder case'] - return random.choice(scenarios) - -def calculate_score(slider_values): - bluffing_score, deduction_score, humor_score, memory_score, roleplay_score = slider_values - - total_score = bluffing_score + deduction_score + humor_score + memory_score + roleplay_score - return total_score - -def play_game(slider_values): - scenario = generate_scenario() - st.write('🎭 Act out the following scenario: ' + scenario) - total_score = calculate_score(slider_values) - st.write('🎯 Your total score is: ' + str(total_score)) - - # Save game history to a dataframe - game_history_df = pd.DataFrame({'Scenario': [scenario], - 'Bluffing': [slider_values[0]], - 'Deduction': [slider_values[1]], - 'Humor': [slider_values[2]], - 'Memory': [slider_values[3]], - 'Roleplay': [slider_values[4]], - 'Total Score': [total_score]}) - - # Append to existing game history - try: - existing_game_history = pd.read_csv('game_history.csv') - game_history_df = pd.concat([existing_game_history, game_history_df], ignore_index=True) - except: - pass - - return game_history_df - -def save_game_history(game_history_df): - game_history_df.to_csv('game_history.csv', index=False) - st.write('📝 Game history saved!') - st.write(game_history_df) - -def save_simulation_results(simulation_results_df): - filename = datetime.now().strftime('%Y-%m-%d %H-%M-%S') + '.csv' - simulation_results_df.to_csv(filename, index=False) - st.write('📝 Simulation results saved!') - st.write(simulation_results_df) - -def run_simulations(num_simulations): - total_scores = [] - simulation_results_df = pd.DataFrame(columns=['Scenario', 'Bluffing', 'Deduction', 'Humor', 'Memory', 'Roleplay', 'Total Score']) - for i in range(num_simulations): - slider_values = [random.randint(1, 10) for i in range(5)] - total_score = calculate_score(slider_values) - total_scores.append(total_score) - scenario = generate_scenario() - simulation_results_df = simulation_results_df.append({'Scenario': scenario, - 'Bluffing': slider_values[0], - 'Deduction': slider_values[1], - 'Humor': slider_values[2], - 'Memory': slider_values[3], - 'Roleplay': slider_values[4], - 'Total Score': total_score}, ignore_index=True) - st.write('🎲 Average score from ' + str(num_simulations) + ' simulations: ' + str(sum(total_scores)/len(total_scores))) - st.write(simulation_results_df) - save_simulation_results(simulation_results_df) - - -# Define the Streamlit app - -st.title('🎭 Pandas-Gamification-Mechanics - Acting Game Mechanics') -st.write('🎯 Welcome to the Acting Game Mechanics! This game measures your ability to bluff, deduce, use humor, remember details, and role-play. Drag the sliders to the left or right to adjust each skill, and click 🎭 Play to act out a scenario and receive a score.') - -slider_values = [st.slider('🃏 Bluffing', 1, 10, 5), -st.slider('🕵️ Deduction', 1, 10, 5), -st.slider('😂 Humor', 1, 10, 5), -st.slider('🧠 Memory', 1, 10, 5), -st.slider('👥 Roleplay', 1, 10, 5)] - -if st.button('🎭 Play'): - game_history_df = play_game(slider_values) - save_game_history(game_history_df) - -if st.button('🎲 Run simulations'): - num_simulations = st.slider('🔁 Number of simulations', 1, 100000, 1000) - run_simulations(num_simulations) - -if st.button('📝 Show all game history'): - try: - game_history_df = pd.read_csv('game_history.csv') - st.write(game_history_df) - except: - st.write('No game history found') - -if st.button('📝 Download game history'): - try: - game_history_df = pd.read_csv('game_history.csv') - filename = 'game_history_' + datetime.now().strftime('%Y-%m-%d %H-%M-%S') + '.csv' - game_history_df.to_csv(filename, index=False) - st.write('📝 Game history downloaded!') - st.write(game_history_df) - except: - st.write('No game history found') - -if st.button('📝 Download simulation results'): - try: - simulation_results_df = pd.read_csv('simulation_results.csv') - filename = 'simulation_results_' + datetime.now().strftime('%Y-%m-%d %H-%M-%S') + '.csv' - simulation_results_df.to_csv(filename, index=False) - st.write('📝 Simulation results downloaded!') - st.write(simulation_results_df) - except: - st.write('No simulation results found') - -st.markdown(""" -🎭 Acting Game Mechanics -🎯🃏 Bluffing -🕵️ Deduction -😂 Humor -🧠 Memory -👥 Roleplay - -🎭 Acting Game Mechanics: - -Characterization: Act out your character's traits, emotions, and personality. -Improvisation: Think on your feet and come up with responses to unexpected situations. -Scripted Dialogue: Deliver lines from a pre-written script or engage in scripted conversations. -For more information on Acting Game Mechanics, you can visit the Wikipedia page on Role-playing game mechanics: https://en.wikipedia.org/wiki/Acting - -🎯🃏 Bluffing: - -Lying: Convince others that your false information is true. -Concealment: Hide your true intentions or actions. -Misdirection: Lead others to believe something different from what you are doing. -For more information on Bluffing, you can visit the Wikipedia page on Bluff (poker): https://en.wikipedia.org/wiki/Bluff_(poker) - -🕵️ Deduction: - -Clue Analysis: Examine clues to draw conclusions about a mystery. -Logical Reasoning: Use deductive reasoning to arrive at the correct solution. -Pattern Recognition: Recognize and match patterns to uncover hidden information. -For more information on Deduction, you can visit the Wikipedia page on Deduction game: https://en.wikipedia.org/wiki/Deduction - -😂 Humor: - -Parody: Use humorous exaggeration or imitation to make fun of a subject. -Puns: Play with words to create humorous meanings. -Satire: Use irony, sarcasm, and ridicule to critique a topic or individual. -For more information on Humor, you can visit the Wikipedia page on Humor: https://en.wikipedia.org/wiki/Humor - -🧠 Memory: - -Recall: Remember information from previous events or interactions. -Recognition: Identify information you have seen or heard before. -Memorization: Commit information to memory for future use. -For more information on Memory, you can visit the Wikipedia page on Memory game: https://en.wikipedia.org/wiki/Memory - -👥 Roleplay: - -Character Creation: Develop a unique character with specific traits and abilities. -Storytelling: Create a narrative with the characters and the world they inhabit. -Collaborative Play: Work with others to create an immersive experience. -For more information on Roleplay, you can visit the Wikipedia page on Role-playing game: https://en.wikipedia.org/wiki/Role-playing_game - -""") \ No newline at end of file diff --git a/spaces/awacke1/PhysicsRacingDemoWith3DARVR/README.md b/spaces/awacke1/PhysicsRacingDemoWith3DARVR/README.md deleted file mode 100644 index 3063493abfa8cd0512d326f63978fe296985fa27..0000000000000000000000000000000000000000 --- a/spaces/awacke1/PhysicsRacingDemoWith3DARVR/README.md +++ /dev/null @@ -1,19 +0,0 @@ ---- -title: PhysicsRacingDemoWith3DARVR -emoji: 🏎️🕹️ -colorFrom: red -colorTo: indigo -sdk: static -pinned: false -license: apache-2.0 ---- - -

      SimPhysics

      -

      User input: WASD

      -

      This WebGL demo demonstrates PlayCanvas and a physics vehicle simulation that is web based and playable anywhere your browser goes🤗 Inference API.

      -

      Source code is in Readme.md file.

      -

      PlayCanvas project is here

      -
      - -
      - diff --git a/spaces/awacke1/VizLib-Altair/backup-app.py b/spaces/awacke1/VizLib-Altair/backup-app.py deleted file mode 100644 index 980cfef5846e8e02b5bde99e4e651c3a90d1454a..0000000000000000000000000000000000000000 --- a/spaces/awacke1/VizLib-Altair/backup-app.py +++ /dev/null @@ -1,497 +0,0 @@ -import streamlit as st -import pandas as pd -import altair as alt - -largest_hospitals = [ - { - 'name': 'Florida Hospital Orlando', - 'city': 'Orlando', - 'state': 'FL', - 'zip_code': '32803', - 'bed_count': 2411, - 'lat': 28.555149, - 'lng': -81.362244 - }, - { - 'name': 'Cleveland Clinic', - 'city': 'Cleveland', - 'state': 'OH', - 'zip_code': '44195', - 'bed_count': 1730, - 'lat': 41.501642, - 'lng': -81.621223 - }, - { - 'name': 'Mayo Clinic', - 'city': 'Rochester', - 'state': 'MN', - 'zip_code': '55905', - 'bed_count': 1372, - 'lat': 44.019126, - 'lng': -92.463362 - }, - { - 'name': 'NewYork-Presbyterian Hospital-Columbia and Cornell', - 'city': 'New York', - 'state': 'NY', - 'zip_code': '10032', - 'bed_count': 2332, - 'lat': 40.841708, - 'lng': -73.942635 - }, - { - 'name': 'UCHealth University of Colorado Hospital', - 'city': 'Aurora', - 'state': 'CO', - 'zip_code': '80045', - 'bed_count': 672, - 'lat': 39.743943, - 'lng': -104.834322 - }, - { - 'name': 'Houston Methodist Hospital', - 'city': 'Houston', - 'state': 'TX', - 'zip_code': '77030', - 'bed_count': 1063, - 'lat': 29.710773, - 'lng': -95.399676 - }, - { - 'name': 'Johns Hopkins Hospital', - 'city': 'Baltimore', - 'state': 'MD', - 'zip_code': '21287', - 'bed_count': 1293, - 'lat': 39.296154, - 'lng': -76.591972 - }, - { - 'name': 'Massachusetts General Hospital', - 'city': 'Boston', - 'state': 'MA', - 'zip_code': '02114', - 'bed_count': 1032, - 'lat': 42.362251, - 'lng': -71.069405 - }, - { - 'name': 'University of Michigan Hospitals-Michigan Medicine', - 'city': 'Ann Arbor', - 'state': 'MI', - 'zip_code': '48109', - 'bed_count': 1145, - 'lat': 42.285932, - 'lng': -83.730833 - }, - { - 'name': 'Mount Sinai Hospital', - 'city': 'New York', - 'state': 'NY', - 'zip_code': '10029', - 'bed_count': 1168, - 'lat': 40.788127, - 'lng': -73.952826 - } -] - -largest_hospitals_df = pd.DataFrame(largest_hospitals) - -def stacked_bar_chart_with_text_overlay(): - chart = alt.Chart(largest_hospitals_df).mark_bar().encode( - y=alt.Y('state:N', sort='-x'), - x=alt.X('bed_count:Q', stack='normalize'), - color=alt.Color('name:N'), - tooltip=['name', 'city', 'state', 'bed_count'] - ).properties( - width=700, - height=500, - title='Largest Hospitals by State (Stacked Bar Chart with Text Overlay)' - ).configure_axisX( - labelAngle=-45 - ) - text = chart.mark_text(align='left', baseline='middle', dx=3).encode( - text=alt.Text('bed_count:Q', format='.1f') - ) - st.altair_chart(chart + text) - -def bump_chart(): - chart = alt.Chart(largest_hospitals_df).transform_joinaggregate( - rank='rank(bed_count)', - groupby=['state'] - ).transform_filter( - alt.datum.rank <= 3 - ).transform_window( - y='row_number()', - sort=[alt.SortField('bed_count', order='descending')] - ).mark_line().encode( - x=alt.X('bed_count:Q', title='Bed Count'), - y=alt.Y('y:O', axis=None), - color=alt.Color('name:N'), - tooltip=['name', 'city', 'state', 'bed_count'] - ).properties( - width=700, - height=500, - title='Largest Hospitals by State (Bump Chart)' - ) - st.altair_chart(chart) - -def radial_chart(): - chart = alt.Chart(largest_hospitals_df).mark_bar().encode( - x=alt.X('count()', title='Count'), - y=alt.Y('state:N', sort='-x'), - color=alt.Color('bed_count:Q', legend=None), - column=alt.Column('bed_count:Q', bin=alt.Bin(maxbins=10)), - tooltip=['name', 'city', 'state', 'bed_count'] - ).properties( - width=700, - height=500, - title='Largest Hospitals by State (Radial Chart)' - ) - st.altair_chart(chart) - -def trellis_area_sort_chart(): - chart = alt.Chart(largest_hospitals_df).mark_area(opacity=0.8).encode( - x=alt.X('yearmonth(date):T', title='Date'), - y=alt.Y('sum(revenue):Q', stack='center', axis=None), - color=alt.Color('product:N', scale=alt.Scale(scheme='category10')), - row=alt.Row('market:N', header=alt.Header(title='Market')), - column=alt.Column('product:N', header=alt.Header(title='Product')), - tooltip=[alt.Tooltip('product:N'), alt.Tooltip('revenue:Q', format='$,.0f')] - ).properties( - width=300, - height=200, - title='Trellis Area Sort Chart' - ).configure_facet( - spacing=0 - ).configure_view( - stroke=None - ) - st.altair_chart(chart) - -def wind_vector_map(): - source = pd.DataFrame({ - 'lat': largest_hospitals_df['lat'], - 'lon': largest_hospitals_df['lng'], - 'u': [10, 20, 30, 40, 50, -10, -20, -30, -40, -50], - 'v': [-10, -20, -30, -40, -50, 10, 20, 30, 40, 50], - 'names': largest_hospitals_df['name'] - }) - max_speed = 60 - - # Create a layer of the world map - background = alt.Chart( - data=topo_feature('world-110m') - ).mark_geoshape( - fill='white', - stroke='lightgray' - ).properties( - width=700, - height=400 - ).project('naturalEarth1') - - # Add the wind vectors as arrows - vectors = background.mark_arrow( - length=300, - stroke='black', - strokeWidth=0.5 - ).encode( - longitude='lon:Q', - latitude='lat:Q', - angle=alt.Angle('atan2(v, u):Q'), - size=alt.Size(alt.Color('length:Q', legend=None), scale=alt.Scale(range=[0, 0.08]), title='Wind speed'), - opacity=alt.Opacity(alt.Color('length:Q', legend=None), scale=alt.Scale(range=[0, 1]), title='Wind speed'), - tooltip=['names:N', alt.Tooltip('length:Q', format='.1f')] - ).transform_calculate( - # Cartographic rotation for arrows - angle=calc_wind_angle('u', 'v'), - # Vector length - length=calc_wind_speed('u', 'v'), - # Limit vector length - length=alt.datum.length > max_speed ? max_speed : alt.datum.length - ) - - st.altair_chart(background + vectors) - -def table_bubble_plot(): - chart = alt.Chart(largest_hospitals_df).mark_circle().encode( - x=alt.X('bed_count:Q', title='Bed Count'), - y=alt.Y('state:N', sort='-x'), - size=alt.Size('bed_count:Q', title='Bed Count'), - color=alt.Color('bed_count:Q', legend=None), - tooltip=['name', 'city', 'state', 'bed_count'] - ).properties( - width=700, - height=500, - title='Largest Hospitals by State (Table Bubble Plot)' - ) - st.altair_chart(chart) - -def locations_of_us_airports(): - airports = data.airports.url - - states = alt.topo_feature(data.us_10m.url, 'states') - lookup = {'New York City': 'New York', 'Chicago': 'Illinois', 'Los Angeles': 'California', 'San Francisco': 'California', 'Houston': 'Texas'} - - chart = alt.Chart(states).mark_geoshape( - fill='lightgray', - stroke='white' - ).encode( - color=alt.Color('count()', scale=alt.Scale(scheme='yelloworangered')), - tooltip=[alt.Tooltip('state:N'), alt.Tooltip('count():Q')] - ).transform_lookup( - lookup='state', - from_=alt.LookupData(airports, 'state', ['latitude', 'longitude']) - ).transform_fold( - ['latitude', 'longitude'], - as_=['key', 'value'] - ).transform_filter( - (alt.datum.value[0] != 'NaN') & (alt.datum.value[1] != 'NaN') - ).mark_circle( - size=10 - ).encode( - longitude='value:Q', - latitude='key:Q', - color=alt.Color('count()', scale=alt.Scale(scheme='yelloworangered')), - tooltip=[alt.Tooltip('state:N'), alt.Tooltip('count():Q')] - ).properties( - width=700, - height=500, - title='Locations of US Airports' - ) - st.altair_chart(chart) - -def connections_among_us_airports_interactive(): - airports = data.airports.url - routes = data.routes.url - - states = alt.topo_feature(data.us_10m.url, 'states') - - source = pd.read_json(airports) - lookup = {'New York City': 'New York', 'Chicago': 'Illinois', 'Los Angeles': 'California', 'San Francisco': 'California', 'Houston': 'Texas'} - source['state'] = source['state'].apply(lambda x: lookup[x] if x in lookup.keys() else x) - - base = alt.Chart(states).mark_geoshape( - fill='lightgray', - stroke='white' - ).properties( - width=700, - height=400 - ).project('albersUsa') - - airports = base.mark_circle(size=10).encode( - longitude='longitude:Q', - latitude='latitude:Q', - tooltip=['name:N', 'city:N', 'state:N', 'country:N'] - ).transform_lookup( - lookup='iata', - from_=alt.LookupData(airports, 'iata', ['name', 'city', 'state', 'country', 'latitude', 'longitude']) - ).properties(title='US Airports') - - routes = base.mark_geoshape( - stroke='black', - strokeWidth=0.1 - ).encode( - longitude='start_lon:Q', - latitude='start_lat:Q', - longitude2='end_lon:Q', - latitude2='end_lat:Q' - ).transform_lookup( - lookup='start', - from_=alt.LookupData(source, 'iata', ['state', 'latitude', 'longitude']), - as_=['start_state', 'start_lat', 'start_lon'] - ).transform_lookup( - lookup='end', - from_=alt.LookupData(source, 'iata', ['state', 'latitude', 'longitude']), - as_=['end_state', 'end_lat', 'end_lon'] - ).transform_filter( - (alt.datum.start_lat != None) & (alt.datum.start_lon != None) & (alt.datum.end_lat != None) & (alt.datum.end_lon != None) - ).transform_aggregate( - count='count()', - groupby=['start', 'start_state', 'end', 'end_state'] - ).transform_filter( - (alt.datum['count'] > 10) - ).transform_calculate( - start_lon=-alt.datum.start_lon, - end_lon=-alt.datum.end_lon - ) - - chart = (base + routes + airports).configure_view( - width=800, - height=500, - stroke=None - ) - st.altair_chart(chart) - -def one_dot_per_zipcode(): - chart = alt.Chart(largest_hospitals_df).mark_circle().encode( - longitude='lng:Q', - latitude='lat:Q', - size=alt.Size('bed_count:Q', title='Bed Count'), - color=alt.Color('bed_count:Q', legend=None), - tooltip=['name', 'city', 'state', 'zip_code', 'bed_count'] - ).properties( - width=700, - height=500, - title='One Dot Per Zipcode' - ) - st.altair_chart(chart) - -def isotype_visualization_with_emoji(): - chart = alt.Chart(largest_hospitals_df).mark_point().encode( - x=alt.X('bed_count:Q', title='Bed Count'), - y=alt.Y('state:N', sort='-x'), - color=alt.Color('state:N'), - shape=alt.Shape('state:N'), - tooltip=['name', 'city', 'state', 'zip_code', 'bed_count'] - ) - - shape_lookup = {'CO': '🏥', 'FL': '🏥', 'MA': '🏥', 'MD': '🏥', 'MI': '🏥', 'MN': '🏥', 'NY': '🏥', 'OH': '🏥', 'TX': '🏥'} - chart = chart.transform_calculate( - shape=f'"{shape_lookup}"[datum.state]' - ) - - chart = chart.mark_text( - align='center', - baseline='middle', - size=30, - font='Segoe UI Emoji', - dx=0, - dy=0, - ).encode( - text='shape:N' - ).properties( - width=700, - height=500, - title='Isotype Visualization with Emoji' - ) - st.altair_chart(chart) - -def binned_heatmap(): - chart = alt.Chart(largest_hospitals_df).mark_rect().encode( - x=alt.X('bed_count:Q', bin=True), - y=alt.Y('state:N'), - color=alt.Color('count()', scale=alt.Scale(scheme='yelloworangered')), - tooltip=[alt.Tooltip('state:N'), alt.Tooltip('count():Q')] - ).properties( - width=700, - height=500, - title='Binned Heatmap' - ) - st.altair_chart(chart) - -def facetted_scatterplot_with_marginal_histograms(): - brush = alt.selection(type='interval', encodings=['x']) - - base = alt.Chart(largest_hospitals_df).transform_filter( - brush - ).properties( - width=500, - height=500 - ) - - points = base.mark_point().encode( - x=alt.X('bed_count:Q', title='Bed Count'), - y=alt.Y('state:N', sort='-x', title=None), - color=alt.Color('state:N'), - tooltip=['name', 'city', 'state', 'zip_code', 'bed_count'] - ) - - top_hist = base.mark_bar().encode( - x=alt.X('bed_count:Q', title='Bed Count'), - y=alt.Y('count()', title='Number of Hospitals'), - color=alt.condition(brush, alt.ColorValue('gray'), alt.ColorValue('lightgray')), - ).properties( - title='Bed Count Distribution', - width=500, - height=100 - ) - - right_hist = base.mark_bar().encode( - y=alt.X('state:N', title='State'), - x=alt.X('count()', title='Number of Hospitals'), - color=alt.condition(brush, alt.ColorValue('gray'), alt.ColorValue('lightgray')), - ).properties( - title='Hospital Count by State', - width=100, - height=500 - ) - - chart = ((points | top_hist) & right_hist).add_selection( - brush - ).configure_view( - stroke=None - ).properties( - title='Facetted Scatterplot with Marginal Histograms', - width=700, - height=500 - ) - st.altair_chart(chart) - -def ridgeline_plot(): - base = alt.Chart(largest_hospitals_df).transform_density( - 'bed_count', - as_=['bed_count', 'density'], - extent=[0, 3000], - bandwidth=50, - groupby=['state'] - ) - - chart = base.mark_area().encode( - x=alt.X('bed_count:Q', title='Bed Count'), - y=alt.Y('state:N', sort='-x', title=None), - color=alt.Color('state:N'), - opacity=alt.Opacity('density:Q', legend=None, scale=alt.Scale(range=[0.3, 1])) - ).properties( - title='Ridgeline Plot', - width=700, - height=500 - ) - - st.altair_chart(chart) - - -def create_sidebar(): - chart_functions = { - 'Stacked Bar Chart with Text Overlay': stacked_bar_chart, - 'Bump Chart': bump_chart, - 'Radial Chart': radial_chart, - 'Trellis Area Sort Chart': trellis_area_sort_chart, - 'Wind Vector Map': wind_vector_map, - 'Table Bubble Plot': table_bubble_plot, - 'Locations of US Airports': locations_of_us_airports, - 'Connections Among U.S. Airports Interactive': connections_among_us_airports_interactive, - 'One Dot Per Zipcode': one_dot_per_zipcode, - 'Isotype Visualization with Emoji': isotype_visualization_with_emoji, - 'Binned Heatmap': binned_heatmap, - 'Facetted Scatterplot with Marginal Histograms': facetted_scatterplot_with_marginal_histograms, - 'Ridgeline Plot': ridgeline_plot - } - - st.sidebar.title('Charts') - - for chart_name, chart_function in chart_functions.items(): - chart_button = st.sidebar.button(f'{chart_name} {emoji(chart_name)}') - if chart_button: - chart_function() - -def emoji(chart_name): - emojis = { - 'Stacked Bar Chart with Text Overlay': '📊', - 'Bump Chart': '📈', - 'Radial Chart': '🎡', - 'Trellis Area Sort Chart': '📉', - 'Wind Vector Map': '🌬️', - 'Table Bubble Plot': '💬', - 'Locations of US Airports': '✈️', - 'Connections Among U.S. Airports Interactive': '🛫', - 'One Dot Per Zipcode': '📍', - 'Isotype Visualization with Emoji': '😀', - 'Binned Heatmap': '🗺️', - 'Facetted Scatterplot with Marginal Histograms': '🔳', - 'Ridgeline Plot': '🏔️' - } - return emojis.get(chart_name, '') - -create_sidebar() - diff --git a/spaces/awacke1/visual_chatgpt/README.md b/spaces/awacke1/visual_chatgpt/README.md deleted file mode 100644 index bf70f1d5d10febfe9c4cb8308aef7948b4d6048f..0000000000000000000000000000000000000000 --- a/spaces/awacke1/visual_chatgpt/README.md +++ /dev/null @@ -1,14 +0,0 @@ ---- -title: Visual Chatgpt -emoji: 🎨 -colorFrom: yellow -colorTo: yellow -sdk: gradio -sdk_version: 3.20.1 -app_file: app.py -pinned: false -license: osl-3.0 -duplicated_from: microsoft/visual_chatgpt ---- - -Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference diff --git a/spaces/badayvedat/AudioSep/models/CLAP/open_clip/model.py b/spaces/badayvedat/AudioSep/models/CLAP/open_clip/model.py deleted file mode 100644 index 5677da7ec2cebaa44c9328ece4873359f459426a..0000000000000000000000000000000000000000 --- a/spaces/badayvedat/AudioSep/models/CLAP/open_clip/model.py +++ /dev/null @@ -1,935 +0,0 @@ -""" CLAP Model - -Adapted from CLIP: https://github.com/openai/CLIP. Originally MIT License, Copyright (c) 2021 OpenAI. -Adapted to the Audio Task. -""" - -from collections import OrderedDict -from dataclasses import dataclass -from email.mime import audio -from typing import Tuple, Union, Callable, Optional - -import numpy as np -import torch -import torch.nn.functional as F -from torch import nn - -from .timm_model import TimmModel -import logging -from .utils import freeze_batch_norm_2d - -from .pann_model import create_pann_model -from .htsat import create_htsat_model -from transformers import BertModel, RobertaModel, BartModel, RobertaConfig -from transformers.tokenization_utils_base import BatchEncoding - - -class MLPLayers(nn.Module): - def __init__(self, units=[512, 512, 512], nonlin=nn.ReLU(), dropout=0.1): - super(MLPLayers, self).__init__() - self.nonlin = nonlin - self.dropout = dropout - - sequence = [] - for u0, u1 in zip(units[:-1], units[1:]): - sequence.append(nn.Linear(u0, u1)) - sequence.append(self.nonlin) - sequence.append(nn.Dropout(self.dropout)) - sequence = sequence[:-2] - - self.sequential = nn.Sequential(*sequence) - - def forward(self, X): - X = self.sequential(X) - return X - - -class Bottleneck(nn.Module): - expansion = 4 - - def __init__(self, inplanes, planes, stride=1): - super().__init__() - - # all conv layers have stride 1. an avgpool is performed after the second convolution when stride > 1 - self.conv1 = nn.Conv2d(inplanes, planes, 1, bias=False) - self.bn1 = nn.BatchNorm2d(planes) - - self.conv2 = nn.Conv2d(planes, planes, 3, padding=1, bias=False) - self.bn2 = nn.BatchNorm2d(planes) - - self.avgpool = nn.AvgPool2d(stride) if stride > 1 else nn.Identity() - - self.conv3 = nn.Conv2d(planes, planes * self.expansion, 1, bias=False) - self.bn3 = nn.BatchNorm2d(planes * self.expansion) - - self.relu = nn.ReLU(inplace=True) - self.downsample = None - self.stride = stride - - if stride > 1 or inplanes != planes * Bottleneck.expansion: - # downsampling layer is prepended with an avgpool, and the subsequent convolution has stride 1 - self.downsample = nn.Sequential( - OrderedDict( - [ - ("-1", nn.AvgPool2d(stride)), - ( - "0", - nn.Conv2d( - inplanes, - planes * self.expansion, - 1, - stride=1, - bias=False, - ), - ), - ("1", nn.BatchNorm2d(planes * self.expansion)), - ] - ) - ) - - def forward(self, x: torch.Tensor): - identity = x - - out = self.relu(self.bn1(self.conv1(x))) - out = self.relu(self.bn2(self.conv2(out))) - out = self.avgpool(out) - out = self.bn3(self.conv3(out)) - - if self.downsample is not None: - identity = self.downsample(x) - - out += identity - out = self.relu(out) - return out - - -class AttentionPool2d(nn.Module): - def __init__( - self, spacial_dim: int, embed_dim: int, num_heads: int, output_dim: int = None - ): - super().__init__() - self.positional_embedding = nn.Parameter( - torch.randn(spacial_dim**2 + 1, embed_dim) / embed_dim**0.5 - ) - self.k_proj = nn.Linear(embed_dim, embed_dim) - self.q_proj = nn.Linear(embed_dim, embed_dim) - self.v_proj = nn.Linear(embed_dim, embed_dim) - self.c_proj = nn.Linear(embed_dim, output_dim or embed_dim) - self.num_heads = num_heads - - def forward(self, x): - x = x.reshape(x.shape[0], x.shape[1], x.shape[2] * x.shape[3]).permute( - 2, 0, 1 - ) # NCHW -> (HW)NC - x = torch.cat([x.mean(dim=0, keepdim=True), x], dim=0) # (HW+1)NC - x = x + self.positional_embedding[:, None, :].to(x.dtype) # (HW+1)NC - x, _ = F.multi_head_attention_forward( - query=x, - key=x, - value=x, - embed_dim_to_check=x.shape[-1], - num_heads=self.num_heads, - q_proj_weight=self.q_proj.weight, - k_proj_weight=self.k_proj.weight, - v_proj_weight=self.v_proj.weight, - in_proj_weight=None, - in_proj_bias=torch.cat( - [self.q_proj.bias, self.k_proj.bias, self.v_proj.bias] - ), - bias_k=None, - bias_v=None, - add_zero_attn=False, - dropout_p=0, - out_proj_weight=self.c_proj.weight, - out_proj_bias=self.c_proj.bias, - use_separate_proj_weight=True, - training=self.training, - need_weights=False, - ) - - return x[0] - - -class ModifiedResNet(nn.Module): - """ - A ResNet class that is similar to torchvision's but contains the following changes: - - There are now 3 "stem" convolutions as opposed to 1, with an average pool instead of a max pool. - - Performs anti-aliasing strided convolutions, where an avgpool is prepended to convolutions with stride > 1 - - The final pooling layer is a QKV attention instead of an average pool - """ - - def __init__(self, layers, output_dim, heads, image_size=224, width=64): - super().__init__() - self.output_dim = output_dim - self.image_size = image_size - - # the 3-layer stem - self.conv1 = nn.Conv2d( - 3, width // 2, kernel_size=3, stride=2, padding=1, bias=False - ) - self.bn1 = nn.BatchNorm2d(width // 2) - self.conv2 = nn.Conv2d( - width // 2, width // 2, kernel_size=3, padding=1, bias=False - ) - self.bn2 = nn.BatchNorm2d(width // 2) - self.conv3 = nn.Conv2d(width // 2, width, kernel_size=3, padding=1, bias=False) - self.bn3 = nn.BatchNorm2d(width) - self.avgpool = nn.AvgPool2d(2) - self.relu = nn.ReLU(inplace=True) - - # residual layers - self._inplanes = width # this is a *mutable* variable used during construction - self.layer1 = self._make_layer(width, layers[0]) - self.layer2 = self._make_layer(width * 2, layers[1], stride=2) - self.layer3 = self._make_layer(width * 4, layers[2], stride=2) - self.layer4 = self._make_layer(width * 8, layers[3], stride=2) - - embed_dim = width * 32 # the ResNet feature dimension - self.attnpool = AttentionPool2d(image_size // 32, embed_dim, heads, output_dim) - - self.init_parameters() - - def _make_layer(self, planes, blocks, stride=1): - layers = [Bottleneck(self._inplanes, planes, stride)] - - self._inplanes = planes * Bottleneck.expansion - for _ in range(1, blocks): - layers.append(Bottleneck(self._inplanes, planes)) - - return nn.Sequential(*layers) - - def init_parameters(self): - if self.attnpool is not None: - std = self.attnpool.c_proj.in_features**-0.5 - nn.init.normal_(self.attnpool.q_proj.weight, std=std) - nn.init.normal_(self.attnpool.k_proj.weight, std=std) - nn.init.normal_(self.attnpool.v_proj.weight, std=std) - nn.init.normal_(self.attnpool.c_proj.weight, std=std) - - for resnet_block in [self.layer1, self.layer2, self.layer3, self.layer4]: - for name, param in resnet_block.named_parameters(): - if name.endswith("bn3.weight"): - nn.init.zeros_(param) - - def lock(self, unlocked_groups=0, freeze_bn_stats=False): - assert ( - unlocked_groups == 0 - ), "partial locking not currently supported for this model" - for param in self.parameters(): - param.requires_grad = False - if freeze_bn_stats: - freeze_batch_norm_2d(self) - - def stem(self, x): - for conv, bn in [ - (self.conv1, self.bn1), - (self.conv2, self.bn2), - (self.conv3, self.bn3), - ]: - x = self.relu(bn(conv(x))) - x = self.avgpool(x) - return x - - def forward(self, x): - x = self.stem(x) - x = self.layer1(x) - x = self.layer2(x) - x = self.layer3(x) - x = self.layer4(x) - x = self.attnpool(x) - - return x - - -class LayerNorm(nn.LayerNorm): - """Subclass torch's LayerNorm to handle fp16.""" - - def forward(self, x: torch.Tensor): - orig_type = x.dtype - x = F.layer_norm(x, self.normalized_shape, self.weight, self.bias, self.eps) - return x.to(orig_type) - - -class QuickGELU(nn.Module): - # NOTE This is slower than nn.GELU or nn.SiLU and uses more GPU memory - def forward(self, x: torch.Tensor): - return x * torch.sigmoid(1.702 * x) - - -class ResidualAttentionBlock(nn.Module): - def __init__(self, d_model: int, n_head: int, act_layer: Callable = nn.GELU): - super().__init__() - - self.attn = nn.MultiheadAttention(d_model, n_head) - self.ln_1 = LayerNorm(d_model) - self.mlp = nn.Sequential( - OrderedDict( - [ - ("c_fc", nn.Linear(d_model, d_model * 4)), - ("gelu", act_layer()), - ("c_proj", nn.Linear(d_model * 4, d_model)), - ] - ) - ) - self.ln_2 = LayerNorm(d_model) - - def attention(self, x: torch.Tensor, attn_mask: Optional[torch.Tensor] = None): - return self.attn(x, x, x, need_weights=False, attn_mask=attn_mask)[0] - - def forward(self, x: torch.Tensor, attn_mask: Optional[torch.Tensor] = None): - x = x + self.attention(self.ln_1(x), attn_mask=attn_mask) - x = x + self.mlp(self.ln_2(x)) - return x - - -class Transformer(nn.Module): - def __init__( - self, width: int, layers: int, heads: int, act_layer: Callable = nn.GELU - ): - super().__init__() - self.width = width - self.layers = layers - self.resblocks = nn.ModuleList( - [ - ResidualAttentionBlock(width, heads, act_layer=act_layer) - for _ in range(layers) - ] - ) - - def forward(self, x: torch.Tensor, attn_mask: Optional[torch.Tensor] = None): - for r in self.resblocks: - x = r(x, attn_mask=attn_mask) - return x - - -class VisualTransformer(nn.Module): - def __init__( - self, - image_size: int, - patch_size: int, - width: int, - layers: int, - heads: int, - output_dim: int, - act_layer: Callable = nn.GELU, - ): - super().__init__() - self.image_size = image_size - self.output_dim = output_dim - self.conv1 = nn.Conv2d( - in_channels=3, - out_channels=width, - kernel_size=patch_size, - stride=patch_size, - bias=False, - ) - - scale = width**-0.5 - self.class_embedding = nn.Parameter(scale * torch.randn(width)) - self.positional_embedding = nn.Parameter( - scale * torch.randn((image_size // patch_size) ** 2 + 1, width) - ) - self.ln_pre = LayerNorm(width) - - self.text_branch = Transformer(width, layers, heads, act_layer=act_layer) - - self.ln_post = LayerNorm(width) - self.proj = nn.Parameter(scale * torch.randn(width, output_dim)) - - def lock(self, unlocked_groups=0, freeze_bn_stats=False): - assert ( - unlocked_groups == 0 - ), "partial locking not currently supported for this model" - for param in self.parameters(): - param.requires_grad = False - - def forward(self, x: torch.Tensor): - x = self.conv1(x) # shape = [*, width, grid, grid] - x = x.reshape(x.shape[0], x.shape[1], -1) # shape = [*, width, grid ** 2] - x = x.permute(0, 2, 1) # shape = [*, grid ** 2, width] - x = torch.cat( - [ - self.class_embedding.to(x.dtype) - + torch.zeros( - x.shape[0], 1, x.shape[-1], dtype=x.dtype, device=x.device - ), - x, - ], - dim=1, - ) # shape = [*, grid ** 2 + 1, width] - x = x + self.positional_embedding.to(x.dtype) - x = self.ln_pre(x) - - x = x.permute(1, 0, 2) # NLD -> LND - x = self.text_branch(x) - x = x.permute(1, 0, 2) # LND -> NLD - - x = self.ln_post(x[:, 0, :]) - - if self.proj is not None: - x = x @ self.proj - - return x - - -@dataclass -class CLAPVisionCfg: - layers: Union[Tuple[int, int, int, int], int] = 12 - width: int = 768 - patch_size: int = 16 - image_size: Union[Tuple[int, int], int] = 224 - timm_model_name: str = ( - None # a valid model name overrides layers, width, patch_size - ) - timm_model_pretrained: bool = ( - False # use (imagenet) pretrained weights for named model - ) - timm_pool: str = ( - "avg" # feature pooling for timm model ('abs_attn', 'rot_attn', 'avg', '') - ) - timm_proj: str = ( - "linear" # linear projection for timm model output ('linear', 'mlp', '') - ) - - -# Audio Config Class -@dataclass -class CLAPAudioCfp: - model_type: str = "PANN" - model_name: str = "Cnn14" - sample_rate: int = 48000 - # Param - audio_length: int = 1024 - window_size: int = 1024 - hop_size: int = 1024 - fmin: int = 50 - fmax: int = 14000 - class_num: int = 527 - mel_bins: int = 64 - clip_samples: int = 480000 - - -@dataclass -class CLAPTextCfg: - context_length: int - vocab_size: int - width: int - heads: int - layers: int - model_type: str - - -class CLAP(nn.Module): - def __init__( - self, - embed_dim: int, - audio_cfg: CLAPAudioCfp, - text_cfg: CLAPTextCfg, - quick_gelu: bool = False, - enable_fusion: bool = False, - fusion_type: str = "None", - joint_embed_shape: int = 512, - mlp_act: str = "relu", - ): - super().__init__() - if isinstance(audio_cfg, dict): - audio_cfg = CLAPAudioCfp(**audio_cfg) - if isinstance(text_cfg, dict): - text_cfg = CLAPTextCfg(**text_cfg) - - self.audio_cfg = audio_cfg - self.text_cfg = text_cfg - self.enable_fusion = enable_fusion - self.fusion_type = fusion_type - self.joint_embed_shape = joint_embed_shape - self.mlp_act = mlp_act - - self.context_length = text_cfg.context_length - - # OpenAI models are pretrained w/ QuickGELU but native nn.GELU is both faster and more - # memory efficient in recent PyTorch releases (>= 1.10). - # NOTE: timm models always use native GELU regardless of quick_gelu flag. - act_layer = QuickGELU if quick_gelu else nn.GELU - - if mlp_act == "relu": - mlp_act_layer = nn.ReLU() - elif mlp_act == "gelu": - mlp_act_layer = nn.GELU() - else: - raise NotImplementedError - - # audio branch - # audio branch parameters - if audio_cfg.model_type == "PANN": - self.audio_branch = create_pann_model(audio_cfg, enable_fusion, fusion_type) - elif audio_cfg.model_type == "HTSAT": - self.audio_branch = create_htsat_model( - audio_cfg, enable_fusion, fusion_type - ) - else: - logging.error(f"Model config for {audio_cfg.model_type} not found") - raise RuntimeError(f"Model config for {audio_cfg.model_type} not found.") - - # text branch - # text branch parameters - if text_cfg.model_type == "transformer": - self.text_branch = Transformer( - width=text_cfg.width, - layers=text_cfg.layers, - heads=text_cfg.heads, - act_layer=act_layer, - ) - self.vocab_size = text_cfg.vocab_size - self.token_embedding = nn.Embedding(text_cfg.vocab_size, text_cfg.width) - self.positional_embedding = nn.Parameter( - torch.empty(self.context_length, text_cfg.width) - ) - self.ln_final = LayerNorm(text_cfg.width) - self.text_transform = MLPLayers( - units=[ - self.joint_embed_shape, - self.joint_embed_shape, - self.joint_embed_shape, - ], - dropout=0.1, - ) - self.text_projection = nn.Sequential( - nn.Linear(text_cfg.width, self.joint_embed_shape), - mlp_act_layer, - nn.Linear(self.joint_embed_shape, self.joint_embed_shape), - ) - elif text_cfg.model_type == "bert": - self.text_branch = BertModel.from_pretrained("bert-base-uncased") - self.text_transform = MLPLayers( - units=[ - self.joint_embed_shape, - self.joint_embed_shape, - self.joint_embed_shape, - ], - dropout=0.1, - ) - self.text_projection = nn.Sequential( - nn.Linear(768, self.joint_embed_shape), - mlp_act_layer, - nn.Linear(self.joint_embed_shape, self.joint_embed_shape), - ) - elif text_cfg.model_type == "roberta": - self.text_branch = RobertaModel.from_pretrained("roberta-base") - - self.text_transform = MLPLayers( - units=[ - self.joint_embed_shape, - self.joint_embed_shape, - self.joint_embed_shape, - ], - dropout=0.1, - ) - self.text_projection = nn.Sequential( - nn.Linear(768, self.joint_embed_shape), - mlp_act_layer, - nn.Linear(self.joint_embed_shape, self.joint_embed_shape), - ) - elif text_cfg.model_type == "bart": - self.text_branch = BartModel.from_pretrained("facebook/bart-base") - self.text_transform = MLPLayers( - units=[ - self.joint_embed_shape, - self.joint_embed_shape, - self.joint_embed_shape, - ], - dropout=0.1, - ) - self.text_projection = nn.Sequential( - nn.Linear(768, self.joint_embed_shape), - mlp_act_layer, - nn.Linear(self.joint_embed_shape, self.joint_embed_shape), - ) - else: - logging.error(f"Model config for {text_cfg.model_type} not found") - raise RuntimeError(f"Model config for {text_cfg.model_type} not found.") - self.text_branch_type = text_cfg.model_type - # text branch parameters - - # audio branch parameters - self.audio_transform = MLPLayers( - units=[ - self.joint_embed_shape, - self.joint_embed_shape, - self.joint_embed_shape, - ], - dropout=0.1, - ) - - # below here is text branch parameters - - # ============================================================================================================ - self.audio_projection = nn.Sequential( - nn.Linear(embed_dim, self.joint_embed_shape), - mlp_act_layer, - nn.Linear(self.joint_embed_shape, self.joint_embed_shape), - ) - - self.logit_scale_a = nn.Parameter(torch.ones([]) * np.log(1 / 0.07)) - self.logit_scale_t = nn.Parameter(torch.ones([]) * np.log(1 / 0.07)) - self.register_buffer("attn_mask", self.build_attention_mask(), persistent=False) - - self.init_text_branch_parameters() - - def init_text_branch_parameters(self): - if self.text_branch_type == "transformer": - nn.init.normal_(self.token_embedding.weight, std=0.02) - nn.init.normal_(self.positional_embedding, std=0.01) - proj_std = (self.text_branch.width**-0.5) * ( - (2 * self.text_branch.layers) ** -0.5 - ) - attn_std = self.text_branch.width**-0.5 - fc_std = (2 * self.text_branch.width) ** -0.5 - for block in self.text_branch.resblocks: - nn.init.normal_(block.attn.in_proj_weight, std=attn_std) - nn.init.normal_(block.attn.out_proj.weight, std=proj_std) - nn.init.normal_(block.mlp.c_fc.weight, std=fc_std) - nn.init.normal_(block.mlp.c_proj.weight, std=proj_std) - if self.text_branch_type == "bert" or self.text_branch_type == "roberta": - width = self.text_branch.embeddings.word_embeddings.weight.shape[-1] - elif self.text_branch_type == "bart": - width = self.text_branch.shared.weight.shape[-1] - else: - width = self.text_branch.width - nn.init.constant_(self.logit_scale_a, np.log(1 / 0.07)) - nn.init.constant_(self.logit_scale_t, np.log(1 / 0.07)) - - # deprecated - # if hasattr(self.visual, 'init_parameters'): - # self.visual.init_parameters() - - # if self.text_projection is not None: - # nn.init.normal_(self.text_projection, std=width**-0.5) - - def build_attention_mask(self): - # lazily create causal attention mask, with full attention between the vision tokens - # pytorch uses additive attention mask; fill with -inf - mask = torch.empty(self.context_length, self.context_length) - mask.fill_(float("-inf")) - mask.triu_(1) # zero out the lower diagonal - return mask - - def encode_audio(self, audio, device): - return self.audio_branch( - audio, mixup_lambda=None, device=device - ) # mix lambda needs to add - - # def list_of_dict_of_tensor2dict_of_tensor(self, x, device): - # tmp = {} - # for k in x[0].keys(): - # tmp[k] = [] - # for i in range(len(x)): - # tmp[k].append(x[i][k][:77]) - # for k in x[0].keys(): - # tmp[k] = torch.tensor(tmp[k]).to(device=device, non_blocking=True) - # return tmp - - def encode_text(self, text, device): - if self.text_branch_type == "transformer": - text = text.to(device=device, non_blocking=True) - x = self.token_embedding(text) # [batch_size, n_ctx, d_model] - - x = x + self.positional_embedding - x = x.permute(1, 0, 2) # NLD -> LND - x = self.text_branch(x, attn_mask=self.attn_mask) - x = x.permute(1, 0, 2) # LND -> NLD - x = self.ln_final(x) - - # x.shape = [batch_size, n_ctx, transformer.width] - # take features from the eot embedding (eot_token is the highest number in each sequence) - x = self.text_projection(x[torch.arange(x.shape[0]), text.argmax(dim=-1)]) - elif self.text_branch_type == "bert": - # text = self.list_of_dict_of_tensor2dict_of_tensor(text, device) - # text = BatchEncoding(text) - x = self.text_branch( - input_ids=text["input_ids"].to(device=device, non_blocking=True), - attention_mask=text["attention_mask"].to( - device=device, non_blocking=True - ), - token_type_ids=text["token_type_ids"].to( - device=device, non_blocking=True - ), - )["pooler_output"] - x = self.text_projection(x) - elif self.text_branch_type == "roberta": - x = self.text_branch( - input_ids=text["input_ids"].to(device=device, non_blocking=True), - attention_mask=text["attention_mask"].to( - device=device, non_blocking=True - ), - )["pooler_output"] - x = self.text_projection(x) - elif self.text_branch_type == "bart": - x = torch.mean( - self.text_branch( - input_ids=text["input_ids"].to(device=device, non_blocking=True), - attention_mask=text["attention_mask"].to( - device=device, non_blocking=True - ), - )["encoder_last_hidden_state"], - axis=1, - ) - x = self.text_projection(x) - else: - logging.error(f"Model type {self.text_branch_type} not found") - raise RuntimeError(f"Model type {self.text_branch_type} not found.") - return x - - def forward(self, audio, text, device=None): - """Forward audio and text into the CLAP - - Parameters - ---------- - audio: torch.Tensor (batch_size, audio_length) - the time-domain audio input / the batch of mel_spec and longer list. - text: torch.Tensor () // need to add - the text token input - """ - if device is None: - if audio is not None: - device = audio.device - elif text is not None: - device = text.device - if audio is None and text is None: - # a hack to get the logit scale - return self.logit_scale_a.exp(), self.logit_scale_t.exp() - elif audio is None: - return self.encode_text(text, device=device) - elif text is None: - return self.audio_projection( - self.encode_audio(audio, device=device)["embedding"] - ) - audio_features = self.audio_projection( - self.encode_audio(audio, device=device)["embedding"] - ) - audio_features = F.normalize(audio_features, dim=-1) - - text_features = self.encode_text(text, device=device) - # print("text_features", text_features) - # print("text_features.shape", text_features.shape) - # print("text_features.type", type(text_features)) - text_features = F.normalize(text_features, dim=-1) - - audio_features_mlp = self.audio_transform(audio_features) - text_features_mlp = self.text_transform(text_features) - # Four outputs: audio features (basic & MLP), text features (basic & MLP) - return ( - audio_features, - text_features, - audio_features_mlp, - text_features_mlp, - self.logit_scale_a.exp(), - self.logit_scale_t.exp(), - ) - - def get_logit_scale(self): - return self.logit_scale_a.exp(), self.logit_scale_t.exp() - - def get_text_embedding(self, data): - """Get the text embedding from the model - - Parameters - ---------- - data: torch.Tensor - a tensor of text embedding - - Returns - ---------- - text_embed: torch.Tensor - a tensor of text_embeds (N, D) - - """ - device = next(self.parameters()).device - for k in data: - data[k] = data[k].to(device) - text_embeds = self.encode_text(data, device=device) - text_embeds = F.normalize(text_embeds, dim=-1) - - return text_embeds - - def get_audio_embedding(self, data): - """Get the audio embedding from the model - - Parameters - ---------- - data: a list of dict - the audio input dict list from 'get_audio_feature' method - - Returns - ---------- - audio_embed: torch.Tensor - a tensor of audio_embeds (N, D) - - """ - device = next(self.parameters()).device - input_dict = {} - keys = data[0].keys() - for k in keys: - input_dict[k] = torch.cat([d[k].unsqueeze(0) for d in data], dim=0).to( - device - ) - - audio_embeds = self.audio_projection( - self.encode_audio(input_dict, device=device)["embedding"] - ) - audio_embeds = F.normalize(audio_embeds, dim=-1) - - return audio_embeds - - def audio_infer(self, audio, hopsize=None, device=None): - """Forward one audio and produce the audio embedding - - Parameters - ---------- - audio: (audio_length) - the time-domain audio input, notice that it must be only one input - hopsize: int - the overlap hopsize as the sliding window - - Returns - ---------- - output_dict: { - key: [n, (embedding_shape)] if "HTS-AT" - or - key: [(embedding_shape)] if "PANN" - } - the list of key values of the audio branch - - """ - - assert not self.training, "the inference mode must be run at eval stage" - output_dict = {} - # PANN - if self.audio_cfg.model_type == "PANN": - audio_input = audio.unsqueeze(dim=0) - output_dict[key] = self.encode_audio(audio_input, device=device)[ - key - ].squeeze(dim=0) - elif self.audio_cfg.model_type == "HTSAT": - # repeat - audio_len = len(audio) - k = self.audio_cfg.clip_samples // audio_len - if k > 1: - audio = audio.repeat(k) - audio_len = len(audio) - - if hopsize is None: - hopsize = min(hopsize, audio_len) - - if audio_len > self.audio_cfg.clip_samples: - audio_input = [ - audio[pos : pos + self.audio_cfg.clip_samples].clone() - for pos in range( - 0, audio_len - self.audio_cfg.clip_samples, hopsize - ) - ] - audio_input.append(audio[-self.audio_cfg.clip_samples :].clone()) - audio_input = torch.stack(audio_input) - output_dict[key] = self.encode_audio(audio_input, device=device)[key] - else: - audio_input = audio.unsqueeze(dim=0) - output_dict[key] = self.encode_audio(audio_input, device=device)[ - key - ].squeeze(dim=0) - - return output_dict - - -def convert_weights_to_fp16(model: nn.Module): - """Convert applicable model parameters to fp16""" - - def _convert_weights_to_fp16(l): - if isinstance(l, (nn.Conv1d, nn.Conv2d, nn.Linear)): - l.weight.data = l.weight.data.half() - if l.bias is not None: - l.bias.data = l.bias.data.half() - - if isinstance(l, nn.MultiheadAttention): - for attr in [ - *[f"{s}_proj_weight" for s in ["in", "q", "k", "v"]], - "in_proj_bias", - "bias_k", - "bias_v", - ]: - tensor = getattr(l, attr) - if tensor is not None: - tensor.data = tensor.data.half() - - for name in ["text_projection", "proj"]: - if hasattr(l, name): - attr = getattr(l, name) - if attr is not None: - attr.data = attr.data.half() - - model.apply(_convert_weights_to_fp16) - - -# Ignore the state dict of the vision part -def build_model_from_openai_state_dict( - state_dict: dict, model_cfg, enable_fusion: bool = False, fusion_type: str = "None" -): - - embed_dim = model_cfg["embed_dim"] - audio_cfg = model_cfg["audio_cfg"] - text_cfg = model_cfg["text_cfg"] - context_length = state_dict["positional_embedding"].shape[0] - vocab_size = state_dict["token_embedding.weight"].shape[0] - transformer_width = state_dict["ln_final.weight"].shape[0] - transformer_heads = transformer_width // 64 - transformer_layers = len( - set( - k.split(".")[2] - for k in state_dict - if k.startswith(f"transformer.resblocks") - ) - ) - - audio_cfg = CLAPAudioCfp(**audio_cfg) - text_cfg = CLAPTextCfg(**text_cfg) - - model = CLAP( - embed_dim, - audio_cfg=audio_cfg, - text_cfg=text_cfg, - quick_gelu=True, # OpenAI models were trained with QuickGELU - enable_fusion=enable_fusion, - fusion_type=fusion_type, - ) - state_dict["logit_scale_a"] = state_dict["logit_scale"] - state_dict["logit_scale_t"] = state_dict["logit_scale"] - pop_keys = list(state_dict.keys())[::] - # pop the visual branch saved weights - for key in pop_keys: - if key.startswith("visual."): - state_dict.pop(key, None) - - for key in ["logit_scale", "input_resolution", "context_length", "vocab_size"]: - state_dict.pop(key, None) - - # not use fp16 - # convert_weights_to_fp16(model) - model.load_state_dict(state_dict, strict=False) - return model.eval() - - -def trace_model(model, batch_size=256, device=torch.device("cpu")): - model.eval() - audio_length = model.audio_cfg.audio_length - example_audio = torch.ones((batch_size, audio_length), device=device) - example_text = torch.zeros( - (batch_size, model.context_length), dtype=torch.int, device=device - ) - model = torch.jit.trace_module( - model, - inputs=dict( - forward=(example_audio, example_text), - encode_text=(example_text,), - encode_image=(example_audio,), - ), - ) - model.audio_cfg.audio_length = audio_length # Question: what does this do? - return model diff --git a/spaces/banana-projects/web3d/node_modules/three/examples/js/controls/EditorControls.js b/spaces/banana-projects/web3d/node_modules/three/examples/js/controls/EditorControls.js deleted file mode 100644 index f94b028a2994d043de6ab786c8285a74164615a3..0000000000000000000000000000000000000000 --- a/spaces/banana-projects/web3d/node_modules/three/examples/js/controls/EditorControls.js +++ /dev/null @@ -1,315 +0,0 @@ -/** - * @author qiao / https://github.com/qiao - * @author mrdoob / http://mrdoob.com - * @author alteredq / http://alteredqualia.com/ - * @author WestLangley / http://github.com/WestLangley - */ - -THREE.EditorControls = function ( object, domElement ) { - - domElement = ( domElement !== undefined ) ? domElement : document; - - // API - - this.enabled = true; - this.center = new THREE.Vector3(); - this.panSpeed = 0.002; - this.zoomSpeed = 0.1; - this.rotationSpeed = 0.005; - - // internals - - var scope = this; - var vector = new THREE.Vector3(); - var delta = new THREE.Vector3(); - var box = new THREE.Box3(); - - var STATE = { NONE: - 1, ROTATE: 0, ZOOM: 1, PAN: 2 }; - var state = STATE.NONE; - - var center = this.center; - var normalMatrix = new THREE.Matrix3(); - var pointer = new THREE.Vector2(); - var pointerOld = new THREE.Vector2(); - var spherical = new THREE.Spherical(); - var sphere = new THREE.Sphere(); - - // events - - var changeEvent = { type: 'change' }; - - this.focus = function ( target ) { - - var distance; - - box.setFromObject( target ); - - if ( box.isEmpty() === false ) { - - box.getCenter( center ); - distance = box.getBoundingSphere( sphere ).radius; - - } else { - - // Focusing on an Group, AmbientLight, etc - - center.setFromMatrixPosition( target.matrixWorld ); - distance = 0.1; - - } - - delta.set( 0, 0, 1 ); - delta.applyQuaternion( object.quaternion ); - delta.multiplyScalar( distance * 4 ); - - object.position.copy( center ).add( delta ); - - scope.dispatchEvent( changeEvent ); - - }; - - this.pan = function ( delta ) { - - var distance = object.position.distanceTo( center ); - - delta.multiplyScalar( distance * scope.panSpeed ); - delta.applyMatrix3( normalMatrix.getNormalMatrix( object.matrix ) ); - - object.position.add( delta ); - center.add( delta ); - - scope.dispatchEvent( changeEvent ); - - }; - - this.zoom = function ( delta ) { - - var distance = object.position.distanceTo( center ); - - delta.multiplyScalar( distance * scope.zoomSpeed ); - - if ( delta.length() > distance ) return; - - delta.applyMatrix3( normalMatrix.getNormalMatrix( object.matrix ) ); - - object.position.add( delta ); - - scope.dispatchEvent( changeEvent ); - - }; - - this.rotate = function ( delta ) { - - vector.copy( object.position ).sub( center ); - - spherical.setFromVector3( vector ); - - spherical.theta += delta.x * scope.rotationSpeed; - spherical.phi += delta.y * scope.rotationSpeed; - - spherical.makeSafe(); - - vector.setFromSpherical( spherical ); - - object.position.copy( center ).add( vector ); - - object.lookAt( center ); - - scope.dispatchEvent( changeEvent ); - - }; - - // mouse - - function onMouseDown( event ) { - - if ( scope.enabled === false ) return; - - if ( event.button === 0 ) { - - state = STATE.ROTATE; - - } else if ( event.button === 1 ) { - - state = STATE.ZOOM; - - } else if ( event.button === 2 ) { - - state = STATE.PAN; - - } - - pointerOld.set( event.clientX, event.clientY ); - - domElement.addEventListener( 'mousemove', onMouseMove, false ); - domElement.addEventListener( 'mouseup', onMouseUp, false ); - domElement.addEventListener( 'mouseout', onMouseUp, false ); - domElement.addEventListener( 'dblclick', onMouseUp, false ); - - } - - function onMouseMove( event ) { - - if ( scope.enabled === false ) return; - - pointer.set( event.clientX, event.clientY ); - - var movementX = pointer.x - pointerOld.x; - var movementY = pointer.y - pointerOld.y; - - if ( state === STATE.ROTATE ) { - - scope.rotate( delta.set( - movementX, - movementY, 0 ) ); - - } else if ( state === STATE.ZOOM ) { - - scope.zoom( delta.set( 0, 0, movementY ) ); - - } else if ( state === STATE.PAN ) { - - scope.pan( delta.set( - movementX, movementY, 0 ) ); - - } - - pointerOld.set( event.clientX, event.clientY ); - - } - - function onMouseUp( event ) { - - domElement.removeEventListener( 'mousemove', onMouseMove, false ); - domElement.removeEventListener( 'mouseup', onMouseUp, false ); - domElement.removeEventListener( 'mouseout', onMouseUp, false ); - domElement.removeEventListener( 'dblclick', onMouseUp, false ); - - state = STATE.NONE; - - } - - function onMouseWheel( event ) { - - event.preventDefault(); - - // Normalize deltaY due to https://bugzilla.mozilla.org/show_bug.cgi?id=1392460 - scope.zoom( delta.set( 0, 0, event.deltaY > 0 ? 1 : - 1 ) ); - - } - - function contextmenu( event ) { - - event.preventDefault(); - - } - - this.dispose = function () { - - domElement.removeEventListener( 'contextmenu', contextmenu, false ); - domElement.removeEventListener( 'mousedown', onMouseDown, false ); - domElement.removeEventListener( 'wheel', onMouseWheel, false ); - - domElement.removeEventListener( 'mousemove', onMouseMove, false ); - domElement.removeEventListener( 'mouseup', onMouseUp, false ); - domElement.removeEventListener( 'mouseout', onMouseUp, false ); - domElement.removeEventListener( 'dblclick', onMouseUp, false ); - - domElement.removeEventListener( 'touchstart', touchStart, false ); - domElement.removeEventListener( 'touchmove', touchMove, false ); - - }; - - domElement.addEventListener( 'contextmenu', contextmenu, false ); - domElement.addEventListener( 'mousedown', onMouseDown, false ); - domElement.addEventListener( 'wheel', onMouseWheel, false ); - - // touch - - var touches = [ new THREE.Vector3(), new THREE.Vector3(), new THREE.Vector3() ]; - var prevTouches = [ new THREE.Vector3(), new THREE.Vector3(), new THREE.Vector3() ]; - - var prevDistance = null; - - function touchStart( event ) { - - if ( scope.enabled === false ) return; - - switch ( event.touches.length ) { - - case 1: - touches[ 0 ].set( event.touches[ 0 ].pageX, event.touches[ 0 ].pageY, 0 ).divideScalar( window.devicePixelRatio ); - touches[ 1 ].set( event.touches[ 0 ].pageX, event.touches[ 0 ].pageY, 0 ).divideScalar( window.devicePixelRatio ); - break; - - case 2: - touches[ 0 ].set( event.touches[ 0 ].pageX, event.touches[ 0 ].pageY, 0 ).divideScalar( window.devicePixelRatio ); - touches[ 1 ].set( event.touches[ 1 ].pageX, event.touches[ 1 ].pageY, 0 ).divideScalar( window.devicePixelRatio ); - prevDistance = touches[ 0 ].distanceTo( touches[ 1 ] ); - break; - - } - - prevTouches[ 0 ].copy( touches[ 0 ] ); - prevTouches[ 1 ].copy( touches[ 1 ] ); - - } - - - function touchMove( event ) { - - if ( scope.enabled === false ) return; - - event.preventDefault(); - event.stopPropagation(); - - function getClosest( touch, touches ) { - - var closest = touches[ 0 ]; - - for ( var i in touches ) { - - if ( closest.distanceTo( touch ) > touches[ i ].distanceTo( touch ) ) closest = touches[ i ]; - - } - - return closest; - - } - - switch ( event.touches.length ) { - - case 1: - touches[ 0 ].set( event.touches[ 0 ].pageX, event.touches[ 0 ].pageY, 0 ).divideScalar( window.devicePixelRatio ); - touches[ 1 ].set( event.touches[ 0 ].pageX, event.touches[ 0 ].pageY, 0 ).divideScalar( window.devicePixelRatio ); - scope.rotate( touches[ 0 ].sub( getClosest( touches[ 0 ], prevTouches ) ).multiplyScalar( - 1 ) ); - break; - - case 2: - touches[ 0 ].set( event.touches[ 0 ].pageX, event.touches[ 0 ].pageY, 0 ).divideScalar( window.devicePixelRatio ); - touches[ 1 ].set( event.touches[ 1 ].pageX, event.touches[ 1 ].pageY, 0 ).divideScalar( window.devicePixelRatio ); - var distance = touches[ 0 ].distanceTo( touches[ 1 ] ); - scope.zoom( delta.set( 0, 0, prevDistance - distance ) ); - prevDistance = distance; - - - var offset0 = touches[ 0 ].clone().sub( getClosest( touches[ 0 ], prevTouches ) ); - var offset1 = touches[ 1 ].clone().sub( getClosest( touches[ 1 ], prevTouches ) ); - offset0.x = - offset0.x; - offset1.x = - offset1.x; - - scope.pan( offset0.add( offset1 ) ); - - break; - - } - - prevTouches[ 0 ].copy( touches[ 0 ] ); - prevTouches[ 1 ].copy( touches[ 1 ] ); - - } - - domElement.addEventListener( 'touchstart', touchStart, false ); - domElement.addEventListener( 'touchmove', touchMove, false ); - -}; - -THREE.EditorControls.prototype = Object.create( THREE.EventDispatcher.prototype ); -THREE.EditorControls.prototype.constructor = THREE.EditorControls; diff --git a/spaces/banana-projects/web3d/node_modules/three/examples/js/libs/draco/gltf/draco_encoder.js b/spaces/banana-projects/web3d/node_modules/three/examples/js/libs/draco/gltf/draco_encoder.js deleted file mode 100644 index a67cdf20607147c05c53de9d009653efa43ff7c0..0000000000000000000000000000000000000000 --- a/spaces/banana-projects/web3d/node_modules/three/examples/js/libs/draco/gltf/draco_encoder.js +++ /dev/null @@ -1,33 +0,0 @@ -var DracoEncoderModule = function(DracoEncoderModule) { - DracoEncoderModule = DracoEncoderModule || {}; - -var Module=typeof DracoEncoderModule!=="undefined"?DracoEncoderModule:{};var isRuntimeInitialized=false;var isModuleParsed=false;Module["onRuntimeInitialized"]=(function(){isRuntimeInitialized=true;if(isModuleParsed){if(typeof Module["onModuleLoaded"]==="function"){Module["onModuleLoaded"](Module)}}});Module["onModuleParsed"]=(function(){isModuleParsed=true;if(isRuntimeInitialized){if(typeof Module["onModuleLoaded"]==="function"){Module["onModuleLoaded"](Module)}}});function isVersionSupported(versionString){if(typeof versionString!=="string")return false;const version=versionString.split(".");if(version.length<2||version.length>3)return false;if(version[0]==1&&version[1]>=0&&version[1]<=3)return true;if(version[0]!=0||version[1]>10)return false;return true}Module["isVersionSupported"]=isVersionSupported;var moduleOverrides={};var key;for(key in Module){if(Module.hasOwnProperty(key)){moduleOverrides[key]=Module[key]}}Module["arguments"]=[];Module["thisProgram"]="./this.program";Module["quit"]=(function(status,toThrow){throw toThrow});Module["preRun"]=[];Module["postRun"]=[];var ENVIRONMENT_IS_WEB=false;var ENVIRONMENT_IS_WORKER=false;var ENVIRONMENT_IS_NODE=false;var ENVIRONMENT_IS_SHELL=false;if(Module["ENVIRONMENT"]){if(Module["ENVIRONMENT"]==="WEB"){ENVIRONMENT_IS_WEB=true}else if(Module["ENVIRONMENT"]==="WORKER"){ENVIRONMENT_IS_WORKER=true}else if(Module["ENVIRONMENT"]==="NODE"){ENVIRONMENT_IS_NODE=true}else if(Module["ENVIRONMENT"]==="SHELL"){ENVIRONMENT_IS_SHELL=true}else{throw new Error("Module['ENVIRONMENT'] value is not valid. must be one of: WEB|WORKER|NODE|SHELL.")}}else{ENVIRONMENT_IS_WEB=typeof window==="object";ENVIRONMENT_IS_WORKER=typeof importScripts==="function";ENVIRONMENT_IS_NODE=typeof process==="object"&&typeof require==="function"&&!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_WORKER;ENVIRONMENT_IS_SHELL=!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_NODE&&!ENVIRONMENT_IS_WORKER}if(ENVIRONMENT_IS_NODE){var nodeFS;var nodePath;Module["read"]=function shell_read(filename,binary){var ret;ret=tryParseAsDataURI(filename);if(!ret){if(!nodeFS)nodeFS=require("fs");if(!nodePath)nodePath=require("path");filename=nodePath["normalize"](filename);ret=nodeFS["readFileSync"](filename)}return binary?ret:ret.toString()};Module["readBinary"]=function readBinary(filename){var ret=Module["read"](filename,true);if(!ret.buffer){ret=new Uint8Array(ret)}assert(ret.buffer);return ret};if(process["argv"].length>1){Module["thisProgram"]=process["argv"][1].replace(/\\/g,"/")}Module["arguments"]=process["argv"].slice(2);process["on"]("uncaughtException",(function(ex){if(!(ex instanceof ExitStatus)){throw ex}}));process["on"]("unhandledRejection",(function(reason,p){process["exit"](1)}));Module["inspect"]=(function(){return"[Emscripten Module object]"})}else if(ENVIRONMENT_IS_SHELL){if(typeof read!="undefined"){Module["read"]=function shell_read(f){var data=tryParseAsDataURI(f);if(data){return intArrayToString(data)}return read(f)}}Module["readBinary"]=function readBinary(f){var data;data=tryParseAsDataURI(f);if(data){return data}if(typeof readbuffer==="function"){return new Uint8Array(readbuffer(f))}data=read(f,"binary");assert(typeof data==="object");return data};if(typeof scriptArgs!="undefined"){Module["arguments"]=scriptArgs}else if(typeof arguments!="undefined"){Module["arguments"]=arguments}if(typeof quit==="function"){Module["quit"]=(function(status,toThrow){quit(status)})}}else if(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER){Module["read"]=function shell_read(url){try{var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.send(null);return xhr.responseText}catch(err){var data=tryParseAsDataURI(url);if(data){return intArrayToString(data)}throw err}};if(ENVIRONMENT_IS_WORKER){Module["readBinary"]=function readBinary(url){try{var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.responseType="arraybuffer";xhr.send(null);return new Uint8Array(xhr.response)}catch(err){var data=tryParseAsDataURI(url);if(data){return data}throw err}}}Module["readAsync"]=function readAsync(url,onload,onerror){var xhr=new XMLHttpRequest;xhr.open("GET",url,true);xhr.responseType="arraybuffer";xhr.onload=function xhr_onload(){if(xhr.status==200||xhr.status==0&&xhr.response){onload(xhr.response);return}var data=tryParseAsDataURI(url);if(data){onload(data.buffer);return}onerror()};xhr.onerror=onerror;xhr.send(null)};Module["setWindowTitle"]=(function(title){document.title=title})}Module["print"]=typeof console!=="undefined"?console.log.bind(console):typeof print!=="undefined"?print:null;Module["printErr"]=typeof printErr!=="undefined"?printErr:typeof console!=="undefined"&&console.warn.bind(console)||Module["print"];Module.print=Module["print"];Module.printErr=Module["printErr"];for(key in moduleOverrides){if(moduleOverrides.hasOwnProperty(key)){Module[key]=moduleOverrides[key]}}moduleOverrides=undefined;var STACK_ALIGN=16;function staticAlloc(size){assert(!staticSealed);var ret=STATICTOP;STATICTOP=STATICTOP+size+15&-16;return ret}function dynamicAlloc(size){assert(DYNAMICTOP_PTR);var ret=HEAP32[DYNAMICTOP_PTR>>2];var end=ret+size+15&-16;HEAP32[DYNAMICTOP_PTR>>2]=end;if(end>=TOTAL_MEMORY){var success=enlargeMemory();if(!success){HEAP32[DYNAMICTOP_PTR>>2]=ret;return 0}}return ret}function alignMemory(size,factor){if(!factor)factor=STACK_ALIGN;var ret=size=Math.ceil(size/factor)*factor;return ret}function getNativeTypeSize(type){switch(type){case"i1":case"i8":return 1;case"i16":return 2;case"i32":return 4;case"i64":return 8;case"float":return 4;case"double":return 8;default:{if(type[type.length-1]==="*"){return 4}else if(type[0]==="i"){var bits=parseInt(type.substr(1));assert(bits%8===0);return bits/8}else{return 0}}}}function warnOnce(text){if(!warnOnce.shown)warnOnce.shown={};if(!warnOnce.shown[text]){warnOnce.shown[text]=1;Module.printErr(text)}}var jsCallStartIndex=1;var functionPointers=new Array(0);var funcWrappers={};function dynCall(sig,ptr,args){if(args&&args.length){return Module["dynCall_"+sig].apply(null,[ptr].concat(args))}else{return Module["dynCall_"+sig].call(null,ptr)}}var GLOBAL_BASE=8;var ABORT=0;var EXITSTATUS=0;function assert(condition,text){if(!condition){abort("Assertion failed: "+text)}}function getCFunc(ident){var func=Module["_"+ident];assert(func,"Cannot call unknown function "+ident+", make sure it is exported");return func}var JSfuncs={"stackSave":(function(){stackSave()}),"stackRestore":(function(){stackRestore()}),"arrayToC":(function(arr){var ret=stackAlloc(arr.length);writeArrayToMemory(arr,ret);return ret}),"stringToC":(function(str){var ret=0;if(str!==null&&str!==undefined&&str!==0){var len=(str.length<<2)+1;ret=stackAlloc(len);stringToUTF8(str,ret,len)}return ret})};var toC={"string":JSfuncs["stringToC"],"array":JSfuncs["arrayToC"]};function ccall(ident,returnType,argTypes,args,opts){var func=getCFunc(ident);var cArgs=[];var stack=0;if(args){for(var i=0;i>0]=value;break;case"i8":HEAP8[ptr>>0]=value;break;case"i16":HEAP16[ptr>>1]=value;break;case"i32":HEAP32[ptr>>2]=value;break;case"i64":tempI64=[value>>>0,(tempDouble=value,+Math_abs(tempDouble)>=+1?tempDouble>+0?(Math_min(+Math_floor(tempDouble/+4294967296),+4294967295)|0)>>>0:~~+Math_ceil((tempDouble- +(~~tempDouble>>>0))/+4294967296)>>>0:0)],HEAP32[ptr>>2]=tempI64[0],HEAP32[ptr+4>>2]=tempI64[1];break;case"float":HEAPF32[ptr>>2]=value;break;case"double":HEAPF64[ptr>>3]=value;break;default:abort("invalid type for setValue: "+type)}}var ALLOC_STATIC=2;var ALLOC_NONE=4;function allocate(slab,types,allocator,ptr){var zeroinit,size;if(typeof slab==="number"){zeroinit=true;size=slab}else{zeroinit=false;size=slab.length}var singleType=typeof types==="string"?types:null;var ret;if(allocator==ALLOC_NONE){ret=ptr}else{ret=[typeof _malloc==="function"?_malloc:staticAlloc,stackAlloc,staticAlloc,dynamicAlloc][allocator===undefined?ALLOC_STATIC:allocator](Math.max(size,singleType?1:types.length))}if(zeroinit){var stop;ptr=ret;assert((ret&3)==0);stop=ret+(size&~3);for(;ptr>2]=0}stop=ret+size;while(ptr>0]=0}return ret}if(singleType==="i8"){if(slab.subarray||slab.slice){HEAPU8.set(slab,ret)}else{HEAPU8.set(new Uint8Array(slab),ret)}return ret}var i=0,type,typeSize,previousType;while(i>0];hasUtf|=t;if(t==0&&!length)break;i++;if(length&&i==length)break}if(!length)length=i;var ret="";if(hasUtf<128){var MAX_CHUNK=1024;var curr;while(length>0){curr=String.fromCharCode.apply(String,HEAPU8.subarray(ptr,ptr+Math.min(length,MAX_CHUNK)));ret=ret?ret+curr:curr;ptr+=MAX_CHUNK;length-=MAX_CHUNK}return ret}return UTF8ToString(ptr)}var UTF8Decoder=typeof TextDecoder!=="undefined"?new TextDecoder("utf8"):undefined;function UTF8ArrayToString(u8Array,idx){var endPtr=idx;while(u8Array[endPtr])++endPtr;if(endPtr-idx>16&&u8Array.subarray&&UTF8Decoder){return UTF8Decoder.decode(u8Array.subarray(idx,endPtr))}else{var u0,u1,u2,u3,u4,u5;var str="";while(1){u0=u8Array[idx++];if(!u0)return str;if(!(u0&128)){str+=String.fromCharCode(u0);continue}u1=u8Array[idx++]&63;if((u0&224)==192){str+=String.fromCharCode((u0&31)<<6|u1);continue}u2=u8Array[idx++]&63;if((u0&240)==224){u0=(u0&15)<<12|u1<<6|u2}else{u3=u8Array[idx++]&63;if((u0&248)==240){u0=(u0&7)<<18|u1<<12|u2<<6|u3}else{u4=u8Array[idx++]&63;if((u0&252)==248){u0=(u0&3)<<24|u1<<18|u2<<12|u3<<6|u4}else{u5=u8Array[idx++]&63;u0=(u0&1)<<30|u1<<24|u2<<18|u3<<12|u4<<6|u5}}}if(u0<65536){str+=String.fromCharCode(u0)}else{var ch=u0-65536;str+=String.fromCharCode(55296|ch>>10,56320|ch&1023)}}}}function UTF8ToString(ptr){return UTF8ArrayToString(HEAPU8,ptr)}function stringToUTF8Array(str,outU8Array,outIdx,maxBytesToWrite){if(!(maxBytesToWrite>0))return 0;var startIdx=outIdx;var endIdx=outIdx+maxBytesToWrite-1;for(var i=0;i=55296&&u<=57343)u=65536+((u&1023)<<10)|str.charCodeAt(++i)&1023;if(u<=127){if(outIdx>=endIdx)break;outU8Array[outIdx++]=u}else if(u<=2047){if(outIdx+1>=endIdx)break;outU8Array[outIdx++]=192|u>>6;outU8Array[outIdx++]=128|u&63}else if(u<=65535){if(outIdx+2>=endIdx)break;outU8Array[outIdx++]=224|u>>12;outU8Array[outIdx++]=128|u>>6&63;outU8Array[outIdx++]=128|u&63}else if(u<=2097151){if(outIdx+3>=endIdx)break;outU8Array[outIdx++]=240|u>>18;outU8Array[outIdx++]=128|u>>12&63;outU8Array[outIdx++]=128|u>>6&63;outU8Array[outIdx++]=128|u&63}else if(u<=67108863){if(outIdx+4>=endIdx)break;outU8Array[outIdx++]=248|u>>24;outU8Array[outIdx++]=128|u>>18&63;outU8Array[outIdx++]=128|u>>12&63;outU8Array[outIdx++]=128|u>>6&63;outU8Array[outIdx++]=128|u&63}else{if(outIdx+5>=endIdx)break;outU8Array[outIdx++]=252|u>>30;outU8Array[outIdx++]=128|u>>24&63;outU8Array[outIdx++]=128|u>>18&63;outU8Array[outIdx++]=128|u>>12&63;outU8Array[outIdx++]=128|u>>6&63;outU8Array[outIdx++]=128|u&63}}outU8Array[outIdx]=0;return outIdx-startIdx}function stringToUTF8(str,outPtr,maxBytesToWrite){return stringToUTF8Array(str,HEAPU8,outPtr,maxBytesToWrite)}function lengthBytesUTF8(str){var len=0;for(var i=0;i=55296&&u<=57343)u=65536+((u&1023)<<10)|str.charCodeAt(++i)&1023;if(u<=127){++len}else if(u<=2047){len+=2}else if(u<=65535){len+=3}else if(u<=2097151){len+=4}else if(u<=67108863){len+=5}else{len+=6}}return len}var UTF16Decoder=typeof TextDecoder!=="undefined"?new TextDecoder("utf-16le"):undefined;function demangle(func){return func}function demangleAll(text){var regex=/__Z[\w\d_]+/g;return text.replace(regex,(function(x){var y=demangle(x);return x===y?x:x+" ["+y+"]"}))}function jsStackTrace(){var err=new Error;if(!err.stack){try{throw new Error(0)}catch(e){err=e}if(!err.stack){return"(no stack trace available)"}}return err.stack.toString()}var WASM_PAGE_SIZE=65536;var ASMJS_PAGE_SIZE=16777216;var MIN_TOTAL_MEMORY=16777216;function alignUp(x,multiple){if(x%multiple>0){x+=multiple-x%multiple}return x}var buffer,HEAP8,HEAPU8,HEAP16,HEAPU16,HEAP32,HEAPU32,HEAPF32,HEAPF64;function updateGlobalBuffer(buf){Module["buffer"]=buffer=buf}function updateGlobalBufferViews(){Module["HEAP8"]=HEAP8=new Int8Array(buffer);Module["HEAP16"]=HEAP16=new Int16Array(buffer);Module["HEAP32"]=HEAP32=new Int32Array(buffer);Module["HEAPU8"]=HEAPU8=new Uint8Array(buffer);Module["HEAPU16"]=HEAPU16=new Uint16Array(buffer);Module["HEAPU32"]=HEAPU32=new Uint32Array(buffer);Module["HEAPF32"]=HEAPF32=new Float32Array(buffer);Module["HEAPF64"]=HEAPF64=new Float64Array(buffer)}var STATIC_BASE,STATICTOP,staticSealed;var STACK_BASE,STACKTOP,STACK_MAX;var DYNAMIC_BASE,DYNAMICTOP_PTR;STATIC_BASE=STATICTOP=STACK_BASE=STACKTOP=STACK_MAX=DYNAMIC_BASE=DYNAMICTOP_PTR=0;staticSealed=false;function abortOnCannotGrowMemory(){abort("Cannot enlarge memory arrays. Either (1) compile with -s TOTAL_MEMORY=X with X higher than the current value "+TOTAL_MEMORY+", (2) compile with -s ALLOW_MEMORY_GROWTH=1 which allows increasing the size at runtime but prevents some optimizations, (3) set Module.TOTAL_MEMORY to a higher value before the program runs, or (4) if you want malloc to return NULL (0) instead of this abort, compile with -s ABORTING_MALLOC=0 ")}if(!Module["reallocBuffer"])Module["reallocBuffer"]=(function(size){var ret;try{if(ArrayBuffer.transfer){ret=ArrayBuffer.transfer(buffer,size)}else{var oldHEAP8=HEAP8;ret=new ArrayBuffer(size);var temp=new Int8Array(ret);temp.set(oldHEAP8)}}catch(e){return false}var success=_emscripten_replace_memory(ret);if(!success)return false;return ret});function enlargeMemory(){var PAGE_MULTIPLE=Module["usingWasm"]?WASM_PAGE_SIZE:ASMJS_PAGE_SIZE;var LIMIT=2147483648-PAGE_MULTIPLE;if(HEAP32[DYNAMICTOP_PTR>>2]>LIMIT){return false}var OLD_TOTAL_MEMORY=TOTAL_MEMORY;TOTAL_MEMORY=Math.max(TOTAL_MEMORY,MIN_TOTAL_MEMORY);while(TOTAL_MEMORY>2]){if(TOTAL_MEMORY<=536870912){TOTAL_MEMORY=alignUp(2*TOTAL_MEMORY,PAGE_MULTIPLE)}else{TOTAL_MEMORY=Math.min(alignUp((3*TOTAL_MEMORY+2147483648)/4,PAGE_MULTIPLE),LIMIT)}}var replacement=Module["reallocBuffer"](TOTAL_MEMORY);if(!replacement||replacement.byteLength!=TOTAL_MEMORY){TOTAL_MEMORY=OLD_TOTAL_MEMORY;return false}updateGlobalBuffer(replacement);updateGlobalBufferViews();return true}var byteLength;try{byteLength=Function.prototype.call.bind(Object.getOwnPropertyDescriptor(ArrayBuffer.prototype,"byteLength").get);byteLength(new ArrayBuffer(4))}catch(e){byteLength=(function(buffer){return buffer.byteLength})}var TOTAL_STACK=Module["TOTAL_STACK"]||5242880;var TOTAL_MEMORY=Module["TOTAL_MEMORY"]||16777216;if(TOTAL_MEMORY0){var callback=callbacks.shift();if(typeof callback=="function"){callback();continue}var func=callback.func;if(typeof func==="number"){if(callback.arg===undefined){Module["dynCall_v"](func)}else{Module["dynCall_vi"](func,callback.arg)}}else{func(callback.arg===undefined?null:callback.arg)}}}var __ATPRERUN__=[];var __ATINIT__=[];var __ATMAIN__=[];var __ATEXIT__=[];var __ATPOSTRUN__=[];var runtimeInitialized=false;var runtimeExited=false;function preRun(){if(Module["preRun"]){if(typeof Module["preRun"]=="function")Module["preRun"]=[Module["preRun"]];while(Module["preRun"].length){addOnPreRun(Module["preRun"].shift())}}callRuntimeCallbacks(__ATPRERUN__)}function ensureInitRuntime(){if(runtimeInitialized)return;runtimeInitialized=true;callRuntimeCallbacks(__ATINIT__)}function preMain(){callRuntimeCallbacks(__ATMAIN__)}function exitRuntime(){callRuntimeCallbacks(__ATEXIT__);runtimeExited=true}function postRun(){if(Module["postRun"]){if(typeof Module["postRun"]=="function")Module["postRun"]=[Module["postRun"]];while(Module["postRun"].length){addOnPostRun(Module["postRun"].shift())}}callRuntimeCallbacks(__ATPOSTRUN__)}function addOnPreRun(cb){__ATPRERUN__.unshift(cb)}function addOnPreMain(cb){__ATMAIN__.unshift(cb)}function addOnPostRun(cb){__ATPOSTRUN__.unshift(cb)}function writeArrayToMemory(array,buffer){HEAP8.set(array,buffer)}function writeAsciiToMemory(str,buffer,dontAddNull){for(var i=0;i>0]=str.charCodeAt(i)}if(!dontAddNull)HEAP8[buffer>>0]=0}var Math_abs=Math.abs;var Math_cos=Math.cos;var Math_sin=Math.sin;var Math_tan=Math.tan;var Math_acos=Math.acos;var Math_asin=Math.asin;var Math_atan=Math.atan;var Math_atan2=Math.atan2;var Math_exp=Math.exp;var Math_log=Math.log;var Math_sqrt=Math.sqrt;var Math_ceil=Math.ceil;var Math_floor=Math.floor;var Math_pow=Math.pow;var Math_imul=Math.imul;var Math_fround=Math.fround;var Math_round=Math.round;var Math_min=Math.min;var Math_max=Math.max;var Math_clz32=Math.clz32;var Math_trunc=Math.trunc;var runDependencies=0;var runDependencyWatcher=null;var dependenciesFulfilled=null;function addRunDependency(id){runDependencies++;if(Module["monitorRunDependencies"]){Module["monitorRunDependencies"](runDependencies)}}function removeRunDependency(id){runDependencies--;if(Module["monitorRunDependencies"]){Module["monitorRunDependencies"](runDependencies)}if(runDependencies==0){if(runDependencyWatcher!==null){clearInterval(runDependencyWatcher);runDependencyWatcher=null}if(dependenciesFulfilled){var callback=dependenciesFulfilled;dependenciesFulfilled=null;callback()}}}Module["preloadedImages"]={};Module["preloadedAudios"]={};var memoryInitializer=null;var dataURIPrefix="data:application/octet-stream;base64,";function isDataURI(filename){return String.prototype.startsWith?filename.startsWith(dataURIPrefix):filename.indexOf(dataURIPrefix)===0}STATIC_BASE=GLOBAL_BASE;STATICTOP=STATIC_BASE+19728;__ATINIT__.push();memoryInitializer="data:application/octet-stream;base64,HBwAAGQcAAAYAAAAAAAAAPQbAACLHAAAHBwAAKgcAAAYAAAAAAAAAPQbAADRHAAAHBwAAO0cAAAwAAAAAAAAAPQbAAAPHQAAHBwAADQdAAAwAAAAAAAAABwcAADsKQAASAAAAAAAAAAcHAAAZB0AAIAAAAAAAAAAHBwAAL0dAACQAAAAAAAAABwcAAARHgAAoAAAAAAAAAAcHAAARR4AALAAAAAAAAAA9BsAAHAeAAAcHAAAlB4AAMgAAAAAAAAA9BsAADIfAAAcHAAA0B8AAOA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2N4eGFiaXYxMjBfX3NpX2NsYXNzX3R5cGVfaW5mb0UATjEwX19jeHhhYml2MTE3X19jbGFzc190eXBlX2luZm9FAHB0aHJlYWRfb25jZSBmYWlsdXJlIGluIF9fY3hhX2dldF9nbG9iYWxzX2Zhc3QoKQBjYW5ub3QgY3JlYXRlIHB0aHJlYWQga2V5IGZvciBfX2N4YV9nZXRfZ2xvYmFscygpAGNhbm5vdCB6ZXJvIG91dCB0aHJlYWQgdmFsdWUgZm9yIF9fY3hhX2dldF9nbG9iYWxzKCkAdGVybWluYXRlX2hhbmRsZXIgdW5leHBlY3RlZGx5IHJldHVybmVkAFN0MTFsb2dpY19lcnJvcgBTdDEybGVuZ3RoX2Vycm9yAE4xMF9fY3h4YWJpdjExOV9fcG9pbnRlcl90eXBlX2luZm9FAE4xMF9fY3h4YWJpdjExN19fcGJhc2VfdHlwZV9pbmZvRQ==";var tempDoublePtr=STATICTOP;STATICTOP+=16;function ___cxa_allocate_exception(size){return _malloc(size)}function __ZSt18uncaught_exceptionv(){return!!__ZSt18uncaught_exceptionv.uncaught_exception}var EXCEPTIONS={last:0,caught:[],infos:{},deAdjust:(function(adjusted){if(!adjusted||EXCEPTIONS.infos[adjusted])return adjusted;for(var ptr in EXCEPTIONS.infos){var info=EXCEPTIONS.infos[ptr];if(info.adjusted===adjusted){return ptr}}return adjusted}),addRef:(function(ptr){if(!ptr)return;var info=EXCEPTIONS.infos[ptr];info.refcount++}),decRef:(function(ptr){if(!ptr)return;var info=EXCEPTIONS.infos[ptr];assert(info.refcount>0);info.refcount--;if(info.refcount===0&&!info.rethrown){if(info.destructor){Module["dynCall_vi"](info.destructor,ptr)}delete EXCEPTIONS.infos[ptr];___cxa_free_exception(ptr)}}),clearRef:(function(ptr){if(!ptr)return;var info=EXCEPTIONS.infos[ptr];info.refcount=0})};function ___cxa_begin_catch(ptr){var info=EXCEPTIONS.infos[ptr];if(info&&!info.caught){info.caught=true;__ZSt18uncaught_exceptionv.uncaught_exception--}if(info)info.rethrown=false;EXCEPTIONS.caught.push(ptr);EXCEPTIONS.addRef(EXCEPTIONS.deAdjust(ptr));return ptr}function ___cxa_pure_virtual(){ABORT=true;throw"Pure virtual function called!"}function ___resumeException(ptr){if(!EXCEPTIONS.last){EXCEPTIONS.last=ptr}throw ptr+" - Exception catching is disabled, this exception cannot be caught. Compile with -s DISABLE_EXCEPTION_CATCHING=0 or DISABLE_EXCEPTION_CATCHING=2 to catch."}function ___cxa_find_matching_catch(){var thrown=EXCEPTIONS.last;if(!thrown){return(setTempRet0(0),0)|0}var info=EXCEPTIONS.infos[thrown];var throwntype=info.type;if(!throwntype){return(setTempRet0(0),thrown)|0}var typeArray=Array.prototype.slice.call(arguments);var pointer=Module["___cxa_is_pointer_type"](throwntype);if(!___cxa_find_matching_catch.buffer)___cxa_find_matching_catch.buffer=_malloc(4);HEAP32[___cxa_find_matching_catch.buffer>>2]=thrown;thrown=___cxa_find_matching_catch.buffer;for(var i=0;i>2];info.adjusted=thrown;return(setTempRet0(typeArray[i]),thrown)|0}}thrown=HEAP32[thrown>>2];return(setTempRet0(throwntype),thrown)|0}function ___cxa_throw(ptr,type,destructor){EXCEPTIONS.infos[ptr]={ptr:ptr,adjusted:ptr,type:type,destructor:destructor,refcount:0,caught:false,rethrown:false};EXCEPTIONS.last=ptr;if(!("uncaught_exception"in __ZSt18uncaught_exceptionv)){__ZSt18uncaught_exceptionv.uncaught_exception=1}else{__ZSt18uncaught_exceptionv.uncaught_exception++}throw ptr+" - Exception catching is disabled, this exception cannot be caught. Compile with -s DISABLE_EXCEPTION_CATCHING=0 or DISABLE_EXCEPTION_CATCHING=2 to catch."}var cttz_i8=allocate([8,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,6,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,7,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,6,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0],"i8",ALLOC_STATIC);function ___gxx_personality_v0(){}var SYSCALLS={varargs:0,get:(function(varargs){SYSCALLS.varargs+=4;var ret=HEAP32[SYSCALLS.varargs-4>>2];return ret}),getStr:(function(){var ret=Pointer_stringify(SYSCALLS.get());return ret}),get64:(function(){var low=SYSCALLS.get(),high=SYSCALLS.get();if(low>=0)assert(high===0);else assert(high===-1);return low}),getZero:(function(){assert(SYSCALLS.get()===0)})};function ___syscall140(which,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD(),offset_high=SYSCALLS.get(),offset_low=SYSCALLS.get(),result=SYSCALLS.get(),whence=SYSCALLS.get();var offset=offset_low;FS.llseek(stream,offset,whence);HEAP32[result>>2]=stream.position;if(stream.getdents&&offset===0&&whence===0)stream.getdents=null;return 0}catch(e){if(typeof FS==="undefined"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function flush_NO_FILESYSTEM(){var fflush=Module["_fflush"];if(fflush)fflush(0);var printChar=___syscall146.printChar;if(!printChar)return;var buffers=___syscall146.buffers;if(buffers[1].length)printChar(1,10);if(buffers[2].length)printChar(2,10)}function ___syscall146(which,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.get(),iov=SYSCALLS.get(),iovcnt=SYSCALLS.get();var ret=0;if(!___syscall146.buffers){___syscall146.buffers=[null,[],[]];___syscall146.printChar=(function(stream,curr){var buffer=___syscall146.buffers[stream];assert(buffer);if(curr===0||curr===10){(stream===1?Module["print"]:Module["printErr"])(UTF8ArrayToString(buffer,0));buffer.length=0}else{buffer.push(curr)}})}for(var i=0;i>2];var len=HEAP32[iov+(i*8+4)>>2];for(var j=0;j>2]=PTHREAD_SPECIFIC_NEXT_KEY;PTHREAD_SPECIFIC[PTHREAD_SPECIFIC_NEXT_KEY]=0;PTHREAD_SPECIFIC_NEXT_KEY++;return 0}function _pthread_once(ptr,func){if(!_pthread_once.seen)_pthread_once.seen={};if(ptr in _pthread_once.seen)return;Module["dynCall_v"](func);_pthread_once.seen[ptr]=1}function _pthread_setspecific(key,value){if(!(key in PTHREAD_SPECIFIC)){return ERRNO_CODES.EINVAL}PTHREAD_SPECIFIC[key]=value;return 0}function ___setErrNo(value){if(Module["___errno_location"])HEAP32[Module["___errno_location"]()>>2]=value;return value}DYNAMICTOP_PTR=staticAlloc(4);STACK_BASE=STACKTOP=alignMemory(STATICTOP);STACK_MAX=STACK_BASE+TOTAL_STACK;DYNAMIC_BASE=alignMemory(STACK_MAX);HEAP32[DYNAMICTOP_PTR>>2]=DYNAMIC_BASE;staticSealed=true;var ASSERTIONS=false;function intArrayFromString(stringy,dontAddNull,length){var len=length>0?length:lengthBytesUTF8(stringy)+1;var u8array=new Array(len);var numBytesWritten=stringToUTF8Array(stringy,u8array,0,u8array.length);if(dontAddNull)u8array.length=numBytesWritten;return u8array}function intArrayToString(array){var ret=[];for(var i=0;i255){if(ASSERTIONS){assert(false,"Character code "+chr+" ("+String.fromCharCode(chr)+") at offset "+i+" not in 0x00-0xFF.")}chr&=255}ret.push(String.fromCharCode(chr))}return ret.join("")}var decodeBase64=typeof atob==="function"?atob:(function(input){var keyStr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";var output="";var chr1,chr2,chr3;var enc1,enc2,enc3,enc4;var i=0;input=input.replace(/[^A-Za-z0-9\+\/\=]/g,"");do{enc1=keyStr.indexOf(input.charAt(i++));enc2=keyStr.indexOf(input.charAt(i++));enc3=keyStr.indexOf(input.charAt(i++));enc4=keyStr.indexOf(input.charAt(i++));chr1=enc1<<2|enc2>>4;chr2=(enc2&15)<<4|enc3>>2;chr3=(enc3&3)<<6|enc4;output=output+String.fromCharCode(chr1);if(enc3!==64){output=output+String.fromCharCode(chr2)}if(enc4!==64){output=output+String.fromCharCode(chr3)}}while(i2147483648)return false;b=new a(newBuffer);d=new c(newBuffer);f=new e(newBuffer);h=new g(newBuffer);j=new i(newBuffer);l=new k(newBuffer);n=new m(newBuffer);p=new o(newBuffer);buffer=newBuffer;return true} -// EMSCRIPTEN_START_FUNCS -function be(a,b,c,d,e,g){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;g=g|0;var h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0;h=u;u=u+16|0;i=h+4|0;j=h;f[a+72>>2]=e;f[a+64>>2]=g;g=Lq(e>>>0>1073741823?-1:e<<2)|0;k=a+68|0;l=f[k>>2]|0;f[k>>2]=g;if(l|0)Mq(l);l=a+8|0;Mh(l,b,d,e);d=a+56|0;g=f[d>>2]|0;m=f[g+4>>2]|0;n=f[g>>2]|0;o=m-n|0;if((o|0)<=0){u=h;return 1}p=(o>>>2)+-1|0;o=a+16|0;q=a+32|0;r=a+12|0;s=a+28|0;t=a+20|0;v=a+24|0;if(m-n>>2>>>0>p>>>0){w=p;x=n}else{y=g;aq(y)}while(1){f[j>>2]=f[x+(w<<2)>>2];f[i>>2]=f[j>>2];Cc(a,i,b,w);g=X(w,e)|0;n=b+(g<<2)|0;p=c+(g<<2)|0;g=f[l>>2]|0;if((g|0)>0){m=0;z=f[k>>2]|0;A=g;while(1){if((A|0)>0){g=0;do{B=f[z+(g<<2)>>2]|0;C=f[o>>2]|0;if((B|0)>(C|0)){D=f[q>>2]|0;f[D+(g<<2)>>2]=C;E=D}else{D=f[r>>2]|0;C=f[q>>2]|0;f[C+(g<<2)>>2]=(B|0)<(D|0)?D:B;E=C}g=g+1|0}while((g|0)<(f[l>>2]|0));F=E}else F=f[q>>2]|0;g=(f[n+(m<<2)>>2]|0)-(f[F+(m<<2)>>2]|0)|0;C=p+(m<<2)|0;f[C>>2]=g;if((g|0)>=(f[s>>2]|0)){if((g|0)>(f[v>>2]|0)){G=g-(f[t>>2]|0)|0;H=21}}else{G=(f[t>>2]|0)+g|0;H=21}if((H|0)==21){H=0;f[C>>2]=G}m=m+1|0;A=f[l>>2]|0;if((m|0)>=(A|0))break;else z=F}}w=w+-1|0;if((w|0)<=-1){H=5;break}z=f[d>>2]|0;x=f[z>>2]|0;if((f[z+4>>2]|0)-x>>2>>>0<=w>>>0){y=z;H=6;break}}if((H|0)==5){u=h;return 1}else if((H|0)==6)aq(y);return 0}function ce(a,c,d,e){a=a|0;c=c|0;d=d|0;e=e|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0;g=u;u=u+64|0;h=g+48|0;i=g;j=d+1|0;f[h>>2]=0;k=h+4|0;f[k>>2]=0;f[h+8>>2]=0;do if(j)if(j>>>0>536870911)aq(h);else{l=ln(j<<3)|0;f[h>>2]=l;m=l+(j<<3)|0;f[h+8>>2]=m;sj(l|0,0,(d<<3)+8|0)|0;f[k>>2]=m;n=l;o=m;break}else{n=0;o=0}while(0);d=(c|0)>0;if(d){j=0;do{m=n+(f[a+(j<<2)>>2]<<3)|0;l=m;p=Vn(f[l>>2]|0,f[l+4>>2]|0,1,0)|0;l=m;f[l>>2]=p;f[l+4>>2]=I;j=j+1|0}while((j|0)!=(c|0))}j=i+40|0;l=j;f[l>>2]=0;f[l+4>>2]=0;f[i>>2]=0;f[i+4>>2]=0;f[i+8>>2]=0;f[i+12>>2]=0;f[i+16>>2]=0;f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|0;o=Yn(l|0,I|0,3)|0;l=Vn(o|0,I|0,8,0)|0;o=Vn(l|0,I|0,n|0,0)|0;Cl(e,o,I);o=i+24|0;f[o>>2]=(f[e>>2]|0)+(f[j>>2]|0);j=i+28|0;f[j>>2]=0;n=i+32|0;f[n>>2]=4194304;if(d){d=c;c=4194304;do{l=d;d=d+-1|0;p=f[a+(d<<2)>>2]|0;m=f[i>>2]|0;q=f[m+(p<<3)>>2]|0;r=q<<10;if(c>>>0>>0)s=c;else{t=c;while(1){v=f[o>>2]|0;w=f[j>>2]|0;f[j>>2]=w+1;b[v+w>>0]=t;w=(f[n>>2]|0)>>>8;f[n>>2]=w;if(w>>>0>>0){s=w;break}else t=w}}c=(((s>>>0)/(q>>>0)|0)<<20)+((s>>>0)%(q>>>0)|0)+(f[m+(p<<3)+4>>2]|0)|0;f[n>>2]=c}while((l|0)>1)}Mf(i,e);e=f[i>>2]|0;if(e|0){c=i+4|0;i=f[c>>2]|0;if((i|0)!=(e|0))f[c>>2]=i+(~((i+-8-e|0)>>>3)<<3);Oq(e)}e=f[h>>2]|0;if(!e){u=g;return 1}h=f[k>>2]|0;if((h|0)!=(e|0))f[k>>2]=h+(~((h+-8-e|0)>>>3)<<3);Oq(e);u=g;return 1}function ge(a,c,d,e){a=a|0;c=c|0;d=d|0;e=e|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0;g=u;u=u+64|0;h=g+48|0;i=g;j=d+1|0;f[h>>2]=0;k=h+4|0;f[k>>2]=0;f[h+8>>2]=0;do if(j)if(j>>>0>536870911)aq(h);else{l=ln(j<<3)|0;f[h>>2]=l;m=l+(j<<3)|0;f[h+8>>2]=m;sj(l|0,0,(d<<3)+8|0)|0;f[k>>2]=m;n=l;o=m;break}else{n=0;o=0}while(0);d=(c|0)>0;if(d){j=0;do{m=n+(f[a+(j<<2)>>2]<<3)|0;l=m;p=Vn(f[l>>2]|0,f[l+4>>2]|0,1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]=1048576;if(d){d=c;c=1048576;do{l=d;d=d+-1|0;p=f[a+(d<<2)>>2]|0;m=f[i>>2]|0;q=f[m+(p<<3)>>2]|0;r=q<<10;if(c>>>0>>0)s=c;else{t=c;while(1){v=f[o>>2]|0;w=f[j>>2]|0;f[j>>2]=w+1;b[v+w>>0]=t;w=(f[n>>2]|0)>>>8;f[n>>2]=w;if(w>>>0>>0){s=w;break}else t=w}}c=(((s>>>0)/(q>>>0)|0)<<18)+((s>>>0)%(q>>>0)|0)+(f[m+(p<<3)+4>>2]|0)|0;f[n>>2]=c}while((l|0)>1)}Of(i,e);e=f[i>>2]|0;if(e|0){c=i+4|0;i=f[c>>2]|0;if((i|0)!=(e|0))f[c>>2]=i+(~((i+-8-e|0)>>>3)<<3);Oq(e)}e=f[h>>2]|0;if(!e){u=g;return 1}h=f[k>>2]|0;if((h|0)!=(e|0))f[k>>2]=h+(~((h+-8-e|0)>>>3)<<3);Oq(e);u=g;return 1}function je(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,o=0,p=0,q=0,r=0,s=Oa,t=Oa,u=Oa,v=0,w=0,x=0,y=0,z=0;c=f[b>>2]|0;b=a+4|0;d=f[b>>2]|0;e=(d|0)==0;a:do if(!e){g=d+-1|0;h=(g&d|0)==0;if(!h)if(c>>>0>>0)i=c;else i=(c>>>0)%(d>>>0)|0;else i=g&c;j=f[(f[a>>2]|0)+(i<<2)>>2]|0;if(!j)k=i;else{if(h){h=j;while(1){l=f[h>>2]|0;if(!l){k=i;break a}m=f[l+4>>2]|0;if(!((m|0)==(c|0)|(m&g|0)==(i|0))){k=i;break a}if((f[l+8>>2]|0)==(c|0)){o=l;break}else h=l}p=o+12|0;return p|0}else q=j;while(1){h=f[q>>2]|0;if(!h){k=i;break a}g=f[h+4>>2]|0;if((g|0)!=(c|0)){if(g>>>0>>0)r=g;else r=(g>>>0)%(d>>>0)|0;if((r|0)!=(i|0)){k=i;break a}}if((f[h+8>>2]|0)==(c|0)){o=h;break}else q=h}p=o+12|0;return p|0}}else k=0;while(0);q=ln(16)|0;f[q+8>>2]=c;f[q+12>>2]=0;f[q+4>>2]=c;f[q>>2]=0;i=a+12|0;s=$(((f[i>>2]|0)+1|0)>>>0);t=$(d>>>0);u=$(n[a+16>>2]);do if(e|$(u*t)>>0<3|(d+-1&d|0)!=0)&1;j=~~$(W($(s/u)))>>>0;Hi(a,r>>>0>>0?j:r);r=f[b>>2]|0;j=r+-1|0;if(!(j&r)){v=r;w=j&c;break}if(c>>>0>>0){v=r;w=c}else{v=r;w=(c>>>0)%(r>>>0)|0}}else{v=d;w=k}while(0);k=(f[a>>2]|0)+(w<<2)|0;w=f[k>>2]|0;if(!w){d=a+8|0;f[q>>2]=f[d>>2];f[d>>2]=q;f[k>>2]=d;d=f[q>>2]|0;if(d|0){k=f[d+4>>2]|0;d=v+-1|0;if(d&v)if(k>>>0>>0)x=k;else x=(k>>>0)%(v>>>0)|0;else x=k&d;y=(f[a>>2]|0)+(x<<2)|0;z=30}}else{f[q>>2]=f[w>>2];y=w;z=30}if((z|0)==30)f[y>>2]=q;f[i>>2]=(f[i>>2]|0)+1;o=q;p=o+12|0;return p|0}function ke(a,c,d,e){a=a|0;c=c|0;d=d|0;e=e|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0;g=u;u=u+64|0;h=g+48|0;i=g;j=d+1|0;f[h>>2]=0;k=h+4|0;f[k>>2]=0;f[h+8>>2]=0;do if(j)if(j>>>0>536870911)aq(h);else{l=ln(j<<3)|0;f[h>>2]=l;m=l+(j<<3)|0;f[h+8>>2]=m;sj(l|0,0,(d<<3)+8|0)|0;f[k>>2]=m;n=l;o=m;break}else{n=0;o=0}while(0);d=(c|0)>0;if(d){j=0;do{m=n+(f[a+(j<<2)>>2]<<3)|0;l=m;p=Vn(f[l>>2]|0,f[l+4>>2]|0,1,0)|0;l=m;f[l>>2]=p;f[l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|0;p=f[a+(d<<2)>>2]|0;m=f[i>>2]|0;q=f[m+(p<<3)>>2]|0;r=q<<10;if(c>>>0>>0)s=c;else{t=c;while(1){v=f[o>>2]|0;w=f[j>>2]|0;f[j>>2]=w+1;b[v+w>>0]=t;w=(f[n>>2]|0)>>>8;f[n>>2]=w;if(w>>>0>>0){s=w;break}else t=w}}c=(((s>>>0)/(q>>>0)|0)<<13)+((s>>>0)%(q>>>0)|0)+(f[m+(p<<3)+4>>2]|0)|0;f[n>>2]=c}while((l|0)>1)}Uf(i,e);e=f[i>>2]|0;if(e|0){c=i+4|0;i=f[c>>2]|0;if((i|0)!=(e|0))f[c>>2]=i+(~((i+-8-e|0)>>>3)<<3);Oq(e)}e=f[h>>2]|0;if(!e){u=g;return 1}h=f[k>>2]|0;if((h|0)!=(e|0))f[k>>2]=h+(~((h+-8-e|0)>>>3)<<3);Oq(e);u=g;return 1}function ne(a,c,d,e){a=a|0;c=c|0;d=d|0;e=e|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0;g=u;u=u+64|0;h=g+48|0;i=g;j=d+1|0;f[h>>2]=0;k=h+4|0;f[k>>2]=0;f[h+8>>2]=0;do if(j)if(j>>>0>536870911)aq(h);else{l=ln(j<<3)|0;f[h>>2]=l;m=l+(j<<3)|0;f[h+8>>2]=m;sj(l|0,0,(d<<3)+8|0)|0;f[k>>2]=m;n=l;o=m;break}else{n=0;o=0}while(0);d=(c|0)>0;if(d){j=0;do{m=n+(f[a+(j<<2)>>2]<<3)|0;l=m;p=Vn(f[l>>2]|0,f[l+4>>2]|0,1,0)|0;l=m;f[l>>2]=p;f[l+4>>2]=I;j=j+1|0}while((j|0)!=(c|0))}j=i+40|0;l=j;f[l>>2]=0;f[l+4>>2]=0;f[i>>2]=0;f[i+4>>2]=0;f[i+8>>2]=0;f[i+12>>2]=0;f[i+16>>2]=0;f[i+20>>2]=0;cd(i,n,o-n>>3,e)|0;n=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=Vn(l|0,I|0,n|0,0)|0;Cl(e,o,I);o=i+24|0;f[o>>2]=(f[e>>2]|0)+(f[j>>2]|0);j=i+28|0;f[j>>2]=0;n=i+32|0;f[n>>2]=16384;if(d){d=c;c=16384;do{l=d;d=d+-1|0;p=f[a+(d<<2)>>2]|0;m=f[i>>2]|0;q=f[m+(p<<3)>>2]|0;r=q<<10;if(c>>>0>>0)s=c;else{t=c;while(1){v=f[o>>2]|0;w=f[j>>2]|0;f[j>>2]=w+1;b[v+w>>0]=t;w=(f[n>>2]|0)>>>8;f[n>>2]=w;if(w>>>0>>0){s=w;break}else t=w}}c=(((s>>>0)/(q>>>0)|0)<<12)+((s>>>0)%(q>>>0)|0)+(f[m+(p<<3)+4>>2]|0)|0;f[n>>2]=c}while((l|0)>1)}_f(i,e);e=f[i>>2]|0;if(e|0){c=i+4|0;i=f[c>>2]|0;if((i|0)!=(e|0))f[c>>2]=i+(~((i+-8-e|0)>>>3)<<3);Oq(e)}e=f[h>>2]|0;if(!e){u=g;return 1}h=f[k>>2]|0;if((h|0)!=(e|0))f[k>>2]=h+(~((h+-8-e|0)>>>3)<<3);Oq(e);u=g;return 1}function re(a,c,d,e){a=a|0;c=c|0;d=d|0;e=e|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0;g=u;u=u+64|0;h=g+48|0;i=g;j=d+1|0;f[h>>2]=0;k=h+4|0;f[k>>2]=0;f[h+8>>2]=0;do if(j)if(j>>>0>536870911)aq(h);else{l=ln(j<<3)|0;f[h>>2]=l;m=l+(j<<3)|0;f[h+8>>2]=m;sj(l|0,0,(d<<3)+8|0)|0;f[k>>2]=m;n=l;o=m;break}else{n=0;o=0}while(0);d=(c|0)>0;if(d){j=0;do{m=n+(f[a+(j<<2)>>2]<<3)|0;l=m;p=Vn(f[l>>2]|0,f[l+4>>2]|0,1,0)|0;l=m;f[l>>2]=p;f[l+4>>2]=I;j=j+1|0}while((j|0)!=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>2]|0;q=f[m+(p<<3)>>2]|0;r=q<<10;if(c>>>0>>0)s=c;else{t=c;while(1){v=f[o>>2]|0;w=f[j>>2]|0;f[j>>2]=w+1;b[v+w>>0]=t;w=(f[n>>2]|0)>>>8;f[n>>2]=w;if(w>>>0>>0){s=w;break}else t=w}}c=(((s>>>0)/(q>>>0)|0)<<12)+((s>>>0)%(q>>>0)|0)+(f[m+(p<<3)+4>>2]|0)|0;f[n>>2]=c}while((l|0)>1)}_f(i,e);e=f[i>>2]|0;if(e|0){c=i+4|0;i=f[c>>2]|0;if((i|0)!=(e|0))f[c>>2]=i+(~((i+-8-e|0)>>>3)<<3);Oq(e)}e=f[h>>2]|0;if(!e){u=g;return 1}h=f[k>>2]|0;if((h|0)!=(e|0))f[k>>2]=h+(~((h+-8-e|0)>>>3)<<3);Oq(e);u=g;return 1}function ue(a,c,d,e){a=a|0;c=c|0;d=d|0;e=e|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0;g=u;u=u+64|0;h=g+48|0;i=g;j=d+1|0;f[h>>2]=0;k=h+4|0;f[k>>2]=0;f[h+8>>2]=0;do if(j)if(j>>>0>536870911)aq(h);else{l=ln(j<<3)|0;f[h>>2]=l;m=l+(j<<3)|0;f[h+8>>2]=m;sj(l|0,0,(d<<3)+8|0)|0;f[k>>2]=m;n=l;o=m;break}else{n=0;o=0}while(0);d=(c|0)>0;if(d){j=0;do{m=n+(f[a+(j<<2)>>2]<<3)|0;l=m;p=Vn(f[l>>2]|0,f[l+4>>2]|0,1,0)|0;l=m;f[l>>2]=p;f[l+4>>2]=I;j=j+1|0}while((j|0)!=(c|0))}j=i+40|0;l=j;f[l>>2]=0;f[l+4>>2]=0;f[i>>2]=0;f[i+4>>2]=0;f[i+8>>2]=0;f[i+12>>2]=0;f[i+16>>2]=0;f[i+20>>2]=0;jd(i,n,o-n>>3,e)|0;n=i+16|0;o=Tn(f[n>>2]|0,f[n+4>>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-m>>2;o=m;p=l;if(k>>>0<=n>>>0)if(k>>>0>>0?(q=o+(k<<2)|0,(q|0)!=(p|0)):0){o=p+(~((p+-4-q|0)>>>2)<<2)|0;f[i>>2]=o;r=o;s=m}else{r=l;s=m}else{Ci(j,k-n|0);r=f[i>>2]|0;s=f[j>>2]|0}if((r|0)!=(s|0)){s=0;do{r=f[b>>2]|0;f[e>>2]=s;f[d>>2]=f[e>>2];n=hh(r,d)|0;r=f[j>>2]|0;f[r+(s<<2)>>2]=n;s=s+1|0}while(s>>>0<(f[i>>2]|0)-r>>2>>>0)}i=a+92|0;s=f[b>>2]|0;j=f[s>>2]|0;d=(f[s+4>>2]|0)-j>>2;e=a+96|0;r=f[e>>2]|0;n=f[i>>2]|0;k=r-n>>2;m=n;n=r;if(d>>>0<=k>>>0)if(d>>>0>>0?(r=m+(d<<2)|0,(r|0)!=(n|0)):0){f[e>>2]=n+(~((n+-4-r|0)>>>2)<<2);t=s;v=j}else{t=s;v=j}else{Ci(i,d-k|0);k=f[b>>2]|0;t=k;v=f[k>>2]|0}k=f[t+4>>2]|0;if((k|0)!=(v|0)){v=f[i>>2]|0;i=f[t>>2]|0;t=k-i>>2;k=0;do{f[v+(k<<2)>>2]=f[i+(k<<2)>>2];k=k+1|0}while(k>>>0>>0)}t=(f[h>>2]|0)-(f[g>>2]|0)+1|0;g=a+136|0;h=a+140|0;a=f[h>>2]|0;k=f[g>>2]|0;i=(a-k|0)/12|0;v=a;if(t>>>0>i>>>0){Kf(g,t-i|0);u=c;return 1}if(t>>>0>=i>>>0){u=c;return 1}i=k+(t*12|0)|0;if((i|0)==(v|0)){u=c;return 1}else w=v;while(1){v=w+-12|0;f[h>>2]=v;t=f[v>>2]|0;if(!t)x=v;else{v=w+-8|0;k=f[v>>2]|0;if((k|0)!=(t|0))f[v>>2]=k+(~((k+-4-t|0)>>>2)<<2);Oq(t);x=f[h>>2]|0}if((x|0)==(i|0))break;else w=x}u=c;return 1}function we(a,b,c,d){a=a|0;b=b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0;l=(Qa[f[(f[a>>2]|0)+40>>2]&127](a)|0)+52|0;m=b[h>>0]|0;o=f[k>>2]|0;k=f[o+(m*136|0)+132>>2]|0;switch(f[(f[(f[l>>2]|0)+84>>2]|0)+(j<<2)>>2]|0){case 0:{p=k;q=7;break a;break}case 1:{if(b[o+(m*136|0)+28>>0]|0){p=k;q=7;break a}break}default:{}}m=f[(f[c>>2]|0)+44>>2]|0;b[i>>0]=1;o=m+16|0;j=f[o+4>>2]|0;if(!((j|0)>0|(j|0)==0&(f[o>>2]|0)>>>0>0)){f[g>>2]=f[m+4>>2];f[e>>2]=f[g>>2];Me(m,e,i,i+1|0)|0}r=k}else{p=f[a+68>>2]|0;q=7}while(0);if((q|0)==7){q=f[(f[c>>2]|0)+44>>2]|0;b[i>>0]=0;a=q+16|0;h=f[a+4>>2]|0;if(!((h|0)>0|(h|0)==0&(f[a>>2]|0)>>>0>0)){f[g>>2]=f[q+4>>2];f[e>>2]=f[g>>2];Me(q,e,i,i+1|0)|0}r=p}p=f[(f[c>>2]|0)+44>>2]|0;b[i>>0]=r;r=p+16|0;c=f[r+4>>2]|0;if((c|0)>0|(c|0)==0&(f[r>>2]|0)>>>0>0){u=d;return 1}f[g>>2]=f[p+4>>2];f[e>>2]=f[g>>2];Me(p,e,i,i+1|0)|0;u=d;return 1}function ze(a,b,c,d,e,g){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;g=g|0;var h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0;h=u;u=u+16|0;i=h+4|0;j=h;k=a+60|0;f[a+64>>2]=g;g=a+8|0;Mh(g,b,d,e);d=a+56|0;l=f[d>>2]|0;m=f[l+4>>2]|0;n=f[l>>2]|0;o=m-n|0;if((o|0)<=0){u=h;return 1}p=(o>>>2)+-1|0;o=a+68|0;q=a+16|0;r=a+32|0;s=a+12|0;t=a+28|0;v=a+20|0;w=a+24|0;if(m-n>>2>>>0>p>>>0){x=p;y=n}else{z=l;aq(z)}while(1){f[j>>2]=f[y+(x<<2)>>2];f[i>>2]=f[j>>2];ub(k,i,b,x);l=X(x,e)|0;n=b+(l<<2)|0;p=c+(l<<2)|0;l=f[g>>2]|0;if((l|0)>0){m=0;a=o;A=l;while(1){if((A|0)>0){l=0;do{B=f[a+(l<<2)>>2]|0;C=f[q>>2]|0;if((B|0)>(C|0)){D=f[r>>2]|0;f[D+(l<<2)>>2]=C;E=D}else{D=f[s>>2]|0;C=f[r>>2]|0;f[C+(l<<2)>>2]=(B|0)<(D|0)?D:B;E=C}l=l+1|0}while((l|0)<(f[g>>2]|0));F=E}else F=f[r>>2]|0;l=(f[n+(m<<2)>>2]|0)-(f[F+(m<<2)>>2]|0)|0;C=p+(m<<2)|0;f[C>>2]=l;if((l|0)>=(f[t>>2]|0)){if((l|0)>(f[w>>2]|0)){G=l-(f[v>>2]|0)|0;H=18}}else{G=(f[v>>2]|0)+l|0;H=18}if((H|0)==18){H=0;f[C>>2]=G}m=m+1|0;A=f[g>>2]|0;if((m|0)>=(A|0))break;else a=F}}x=x+-1|0;if((x|0)<=-1){H=3;break}a=f[d>>2]|0;y=f[a>>2]|0;if((f[a+4>>2]|0)-y>>2>>>0<=x>>>0){z=a;H=4;break}}if((H|0)==3){u=h;return 1}else if((H|0)==4)aq(z);return 0}function Ae(a,b,c,d,e,g){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;g=g|0;var h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0;h=u;u=u+16|0;i=h+4|0;j=h;k=a+60|0;f[a+64>>2]=g;g=a+8|0;Mh(g,b,d,e);d=a+56|0;l=f[d>>2]|0;m=f[l+4>>2]|0;n=f[l>>2]|0;o=m-n|0;if((o|0)<=0){u=h;return 1}p=(o>>>2)+-1|0;o=a+68|0;q=a+16|0;r=a+32|0;s=a+12|0;t=a+28|0;v=a+20|0;w=a+24|0;if(m-n>>2>>>0>p>>>0){x=p;y=n}else{z=l;aq(z)}while(1){f[j>>2]=f[y+(x<<2)>>2];f[i>>2]=f[j>>2];tb(k,i,b,x);l=X(x,e)|0;n=b+(l<<2)|0;p=c+(l<<2)|0;l=f[g>>2]|0;if((l|0)>0){m=0;a=o;A=l;while(1){if((A|0)>0){l=0;do{B=f[a+(l<<2)>>2]|0;C=f[q>>2]|0;if((B|0)>(C|0)){D=f[r>>2]|0;f[D+(l<<2)>>2]=C;E=D}else{D=f[s>>2]|0;C=f[r>>2]|0;f[C+(l<<2)>>2]=(B|0)<(D|0)?D:B;E=C}l=l+1|0}while((l|0)<(f[g>>2]|0));F=E}else F=f[r>>2]|0;l=(f[n+(m<<2)>>2]|0)-(f[F+(m<<2)>>2]|0)|0;C=p+(m<<2)|0;f[C>>2]=l;if((l|0)>=(f[t>>2]|0)){if((l|0)>(f[w>>2]|0)){G=l-(f[v>>2]|0)|0;H=18}}else{G=(f[v>>2]|0)+l|0;H=18}if((H|0)==18){H=0;f[C>>2]=G}m=m+1|0;A=f[g>>2]|0;if((m|0)>=(A|0))break;else a=F}}x=x+-1|0;if((x|0)<=-1){H=3;break}a=f[d>>2]|0;y=f[a>>2]|0;if((f[a+4>>2]|0)-y>>2>>>0<=x>>>0){z=a;H=4;break}}if((H|0)==3){u=h;return 1}else if((H|0)==4)aq(z);return 0}function Be(a){a=a|0;var b=0,c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0;b=u;u=u+16|0;c=b+4|0;d=b;e=a+12|0;g=f[e>>2]|0;h=(f[g+4>>2]|0)-(f[g>>2]|0)>>2;if(!h){u=b;return 1}i=a+152|0;j=a+140|0;k=a+144|0;l=a+148|0;a=0;m=g;while(1){f[d>>2]=(a>>>0)/3|0;f[c>>2]=f[d>>2];if(!(_j(m,c)|0)?(g=f[e>>2]|0,(f[(f[g+12>>2]|0)+(a<<2)>>2]|0)==-1):0){n=a+1|0;o=((n>>>0)%3|0|0)==0?a+-2|0:n;if((o|0)==-1)p=-1;else p=f[(f[g>>2]|0)+(o<<2)>>2]|0;o=f[i>>2]|0;if((f[o+(p<<2)>>2]|0)==-1){g=f[k>>2]|0;n=f[l>>2]|0;if((g|0)==(n<<5|0)){if((g+1|0)<0){q=11;break}r=n<<6;n=g+32&-32;vi(j,g>>>0<1073741823?(r>>>0>>0?n:r):2147483647);s=f[k>>2]|0;t=f[i>>2]|0}else{s=g;t=o}f[k>>2]=s+1;o=(f[j>>2]|0)+(s>>>5<<2)|0;f[o>>2]=f[o>>2]&~(1<<(s&31));o=t+(p<<2)|0;if((f[o>>2]|0)==-1){r=a;n=o;while(1){f[n>>2]=g;o=r+1|0;a:do if((r|0)!=-1?(v=((o>>>0)%3|0|0)==0?r+-2|0:o,(v|0)!=-1):0){w=f[e>>2]|0;x=f[w+12>>2]|0;y=v;while(1){v=f[x+(y<<2)>>2]|0;if((v|0)==-1)break;z=v+1|0;A=((z>>>0)%3|0|0)==0?v+-2|0:z;if((A|0)==-1){B=-1;C=-1;break a}else y=A}x=y+1|0;A=((x>>>0)%3|0|0)==0?y+-2|0:x;if((A|0)==-1){B=y;C=-1}else{B=y;C=f[(f[w>>2]|0)+(A<<2)>>2]|0}}else{B=-1;C=-1}while(0);n=t+(C<<2)|0;if((f[n>>2]|0)!=-1)break;else r=B}}}}r=a+1|0;if(r>>>0>=h>>>0){q=3;break}a=r;m=f[e>>2]|0}if((q|0)==3){u=b;return 1}else if((q|0)==11)aq(j);return 0}function Ce(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0;d=u;u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=d;return}f[C>>2]=f[C>>2]&~(-1>>>(32-D|0));u=d;return}}function De(a,c,d,e){a=a|0;c=c|0;d=d|0;e=e|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0;a=u;u=u+48|0;g=a+36|0;h=a+24|0;i=a+12|0;j=a;if(!c){k=0;u=a;return k|0}f[g>>2]=0;f[g+4>>2]=0;f[g+8>>2]=0;l=Gj(d)|0;if(l>>>0>4294967279)aq(g);if(l>>>0<11){b[g+11>>0]=l;if(!l)m=g;else{n=g;o=7}}else{p=l+16&-16;q=ln(p)|0;f[g>>2]=q;f[g+8>>2]=p|-2147483648;f[g+4>>2]=l;n=q;o=7}if((o|0)==7){kh(n|0,d|0,l|0)|0;m=n}b[m+l>>0]=0;f[h>>2]=0;f[h+4>>2]=0;f[h+8>>2]=0;l=Gj(e)|0;if(l>>>0>4294967279)aq(h);if(l>>>0<11){b[h+11>>0]=l;if(!l)r=h;else{s=h;o=13}}else{m=l+16&-16;n=ln(m)|0;f[h>>2]=n;f[h+8>>2]=m|-2147483648;f[h+4>>2]=l;s=n;o=13}if((o|0)==13){kh(s|0,e|0,l|0)|0;r=s}b[r+l>>0]=0;f[i>>2]=0;f[i+4>>2]=0;f[i+8>>2]=0;l=Gj(d)|0;if(l>>>0>4294967279)aq(i);if(l>>>0<11){b[i+11>>0]=l;if(!l)t=i;else{v=i;o=19}}else{r=l+16&-16;s=ln(r)|0;f[i>>2]=s;f[i+8>>2]=r|-2147483648;f[i+4>>2]=l;v=s;o=19}if((o|0)==19){kh(v|0,d|0,l|0)|0;t=v}b[t+l>>0]=0;f[j>>2]=0;f[j+4>>2]=0;f[j+8>>2]=0;l=Gj(e)|0;if(l>>>0>4294967279)aq(j);if(l>>>0<11){b[j+11>>0]=l;if(!l)w=j;else{x=j;o=25}}else{t=l+16&-16;v=ln(t)|0;f[j>>2]=v;f[j+8>>2]=t|-2147483648;f[j+4>>2]=l;x=v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[k+20>>2]=0;f[k+24>>2]=0;j=(f[g>>2]|0)+136|0;f[g>>2]=j;i=i+-1|0}while((i|0)!=0);return}i=f[a>>2]|0;j=(h-i|0)/136|0;h=j+c|0;if(h>>>0>31580641)aq(a);k=(e-i|0)/136|0;i=k<<1;e=k>>>0<15790320?(i>>>0>>0?h:i):31580641;do if(e)if(e>>>0>31580641){i=ra(8)|0;Oo(i,16035);f[i>>2]=7256;va(i|0,1112,110)}else{l=ln(e*136|0)|0;break}else l=0;while(0);i=l+(j*136|0)|0;j=i;h=l+(e*136|0)|0;e=c;c=j;l=i;do{f[l>>2]=-1;Ok(l+4|0);b[l+100>>0]=1;k=l+104|0;f[k>>2]=0;f[k+4>>2]=0;f[k+8>>2]=0;f[k+12>>2]=0;f[k+16>>2]=0;f[k+20>>2]=0;f[k+24>>2]=0;l=c+136|0;c=l;e=e+-1|0}while((e|0)!=0);e=f[a>>2]|0;l=f[g>>2]|0;if((l|0)==(e|0)){m=j;n=e;o=e}else{k=l;l=j;j=i;do{k=k+-136|0;Ee(j+-136|0,k);j=l+-136|0;l=j}while((k|0)!=(e|0));m=l;n=f[a>>2]|0;o=f[g>>2]|0}f[a>>2]=m;f[g>>2]=c;f[d>>2]=h;h=n;if((o|0)!=(h|0)){d=o;do{o=f[d+-20>>2]|0;if(o|0){c=d+-16|0;g=f[c>>2]|0;if((g|0)!=(o|0))f[c>>2]=g+(~((g+-4-o|0)>>>2)<<2);Oq(o)}o=f[d+-32>>2]|0;if(o|0){g=d+-28|0;c=f[g>>2]|0;if((c|0)!=(o|0))f[g>>2]=c+(~((c+-4-o|0)>>>2)<<2);Oq(o)}Mi(d+-132|0);d=d+-136|0}while((d|0)!=(h|0))}if(!n)return;Oq(n);return}function He(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0;c=f[b>>2]|0;b=a+12|0;d=(c|0)==-1;e=c+1|0;do if(!d){g=((e>>>0)%3|0|0)==0?c+-2|0:e;if(!((c>>>0)%3|0)){h=g;i=c+2|0;break}else{h=g;i=c+-1|0;break}}else{h=-1;i=-1}while(0);e=d?-1:(c>>>0)/3|0;g=a+28|0;j=(f[g>>2]|0)+(e>>>5<<2)|0;f[j>>2]=1<<(e&31)|f[j>>2];j=a+172|0;e=a+176|0;k=a+280|0;if(((!d?(d=f[(f[(f[b>>2]|0)+12>>2]|0)+(c<<2)>>2]|0,(d|0)!=-1):0)?(a=(d>>>0)/3|0,(f[(f[g>>2]|0)+(a>>>5<<2)>>2]&1<<(a&31)|0)==0):0)?(a=f[j>>2]|0,(f[e>>2]|0)!=(a|0)):0){d=c>>>5;l=1<<(c&31);c=0;m=a;do{a=(f[k>>2]|0)+(c<<5)|0;if(!(l&f[(f[m+(c*136|0)+4>>2]|0)+(d<<2)>>2]))fj(a,0);else fj(a,1);c=c+1|0;m=f[j>>2]|0}while(c>>>0<(((f[e>>2]|0)-m|0)/136|0)>>>0)}if((((h|0)!=-1?(m=f[(f[(f[b>>2]|0)+12>>2]|0)+(h<<2)>>2]|0,(m|0)!=-1):0)?(c=(m>>>0)/3|0,(f[(f[g>>2]|0)+(c>>>5<<2)>>2]&1<<(c&31)|0)==0):0)?(c=f[j>>2]|0,(f[e>>2]|0)!=(c|0)):0){m=h>>>5;d=1<<(h&31);h=0;l=c;do{c=(f[k>>2]|0)+(h<<5)|0;if(!(d&f[(f[l+(h*136|0)+4>>2]|0)+(m<<2)>>2]))fj(c,0);else fj(c,1);h=h+1|0;l=f[j>>2]|0}while(h>>>0<(((f[e>>2]|0)-l|0)/136|0)>>>0)}if((i|0)==-1)return 1;l=f[(f[(f[b>>2]|0)+12>>2]|0)+(i<<2)>>2]|0;if((l|0)==-1)return 1;b=(l>>>0)/3|0;if(f[(f[g>>2]|0)+(b>>>5<<2)>>2]&1<<(b&31)|0)return 1;b=f[j>>2]|0;if((f[e>>2]|0)==(b|0))return 1;g=i>>>5;l=1<<(i&31);i=0;h=b;do{b=(f[k>>2]|0)+(i<<5)|0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=E<$(0.0);D=$(-E);F=$((x?D:E)/C);y=~~$(J($($(F*$(f[c>>2]|0))+$(.5))));f[a+(z<<2)>>2]=x?0-y|0:y;k=k+1|0;if((k|0)==(l|0))break;else z=z+1|0}v=v+1|0;if(v>>>0>=t>>>0)break;else w=w+l|0}Mq(g);u=h;return}function Ke(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0;d=u;u=u+32|0;e=d+16|0;g=d+12|0;h=d+8|0;i=d+4|0;j=d;lp(a);f[a+16>>2]=0;f[a+20>>2]=0;f[a+12>>2]=a+16;k=a+24|0;lp(k);if((a|0)!=(b|0)){f[h>>2]=f[b>>2];f[i>>2]=b+4;f[g>>2]=f[h>>2];f[e>>2]=f[i>>2];Oc(a,g,e)}l=b+24|0;if((k|0)!=(l|0)){f[h>>2]=f[l>>2];f[i>>2]=b+28;f[g>>2]=f[h>>2];f[e>>2]=f[i>>2];Oc(k,g,e)}f[j>>2]=0;k=c+8|0;l=c+12|0;c=f[l>>2]|0;m=f[k>>2]|0;if((c-m|0)<=0){u=d;return}n=b+16|0;b=m;m=c;c=0;while(1){o=f[(f[b+(c<<2)>>2]|0)+56>>2]|0;p=f[n>>2]|0;if(p){q=n;r=p;a:while(1){p=r;while(1){if((f[p+16>>2]|0)>=(o|0))break;s=f[p+4>>2]|0;if(!s){t=q;break a}else p=s}r=f[p>>2]|0;if(!r){t=p;break}else q=p}if((t|0)!=(n|0)?(o|0)>=(f[t+16>>2]|0):0){q=t+20|0;r=Hd(a,j)|0;if((r|0)!=(q|0)){f[h>>2]=f[q>>2];f[i>>2]=t+24;f[g>>2]=f[h>>2];f[e>>2]=f[i>>2];Oc(r,g,e)}v=f[j>>2]|0;w=f[k>>2]|0;x=f[l>>2]|0}else{v=c;w=b;x=m}}else{v=c;w=b;x=m}c=v+1|0;f[j>>2]=c;if((c|0)>=(x-w>>2|0))break;else{b=w;m=x}}u=d;return}function Le(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0;d=u;u=u+16|0;e=d+4|0;g=d;h=d+8|0;i=a+12|0;ci(f[i>>2]|0,c)|0;if(!(f[i>>2]|0)){j=1;u=d;return j|0}k=c+16|0;l=c+4|0;m=h+1|0;n=h+1|0;o=h+1|0;p=0;while(1){q=f[a>>2]|0;r=f[q+(p<<3)>>2]|0;if(r>>>0>63)if(r>>>0>16383)if(r>>>0>4194303){j=0;s=20;break}else{t=2;s=13}else{t=1;s=13}else if(!r){v=p+1|0;w=0;while(1){if(f[q+(v+w<<3)>>2]|0){x=w;break}y=w+1|0;if(y>>>0<63)w=y;else{x=y;break}}b[h>>0]=x<<2|3;w=k;v=f[w+4>>2]|0;if(!((v|0)>0|(v|0)==0&(f[w>>2]|0)>>>0>0)){f[g>>2]=f[l>>2];f[e>>2]=f[g>>2];Me(c,e,h,o)|0}z=x+p|0}else{t=0;s=13}if((s|0)==13){s=0;b[h>>0]=t|r<<2;w=k;v=f[w+4>>2]|0;if(!((v|0)>0|(v|0)==0&(f[w>>2]|0)>>>0>0)){f[g>>2]=f[l>>2];f[e>>2]=f[g>>2];Me(c,e,h,n)|0}if(!t)z=p;else{w=0;do{w=w+1|0;b[h>>0]=r>>>((w<<3)+-2|0);v=k;q=f[v+4>>2]|0;if(!((q|0)>0|(q|0)==0&(f[v>>2]|0)>>>0>0)){f[g>>2]=f[l>>2];f[e>>2]=f[g>>2];Me(c,e,h,m)|0}}while((w|0)<(t|0));z=p}}p=z+1|0;if(p>>>0>=(f[i>>2]|0)>>>0){j=1;s=20;break}}if((s|0)==20){u=d;return j|0}return 0}function Me(a,c,d,e){a=a|0;c=c|0;d=d|0;e=e|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0;g=f[a>>2]|0;h=g;i=(f[c>>2]|0)-h|0;c=g+i|0;j=e-d|0;if((j|0)<=0){k=c;return k|0}l=a+8|0;m=f[l>>2]|0;n=a+4|0;o=f[n>>2]|0;p=o;if((j|0)<=(m-p|0)){q=p-c|0;if((j|0)>(q|0)){r=d+q|0;if((r|0)==(e|0))s=o;else{t=r;u=o;while(1){b[u>>0]=b[t>>0]|0;t=t+1|0;v=(f[n>>2]|0)+1|0;f[n>>2]=v;if((t|0)==(e|0)){s=v;break}else u=v}}if((q|0)>0){w=r;x=s}else{k=c;return k|0}}else{w=e;x=o}s=x-(c+j)|0;r=c+s|0;if(r>>>0>>0){q=r;r=x;do{b[r>>0]=b[q>>0]|0;q=q+1|0;r=(f[n>>2]|0)+1|0;f[n>>2]=r}while((q|0)!=(o|0))}if(s|0)im(x+(0-s)|0,c|0,s|0)|0;if((w|0)==(d|0)){k=c;return k|0}else{y=d;z=c}while(1){b[z>>0]=b[y>>0]|0;y=y+1|0;if((y|0)==(w|0)){k=c;break}else z=z+1|0}return k|0}z=p-h+j|0;if((z|0)<0)aq(a);j=m-h|0;h=j<<1;m=j>>>0<1073741823?(h>>>0>>0?z:h):2147483647;h=c;if(!m)A=0;else A=ln(m)|0;z=A+i|0;i=z;j=A+m|0;if((d|0)==(e|0)){B=i;C=g}else{g=d;d=i;i=z;do{b[i>>0]=b[g>>0]|0;i=d+1|0;d=i;g=g+1|0}while((g|0)!=(e|0));B=d;C=f[a>>2]|0}d=h-C|0;e=z+(0-d)|0;if((d|0)>0)kh(e|0,C|0,d|0)|0;d=(f[n>>2]|0)-h|0;if((d|0)>0){h=B;kh(h|0,c|0,d|0)|0;D=h+d|0;E=f[a>>2]|0}else{D=B;E=C}f[a>>2]=e;f[n>>2]=D;f[l>>2]=j;if(!E){k=z;return k|0}Oq(E);k=z;return k|0}function Ne(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0;e=u;u=u+16|0;g=e;h=f[(f[c+4>>2]|0)+(d<<2)>>2]|0;d=f[c+28>>2]|0;c=f[(f[(f[d+4>>2]|0)+8>>2]|0)+(h<<2)>>2]|0;switch(f[c+28>>2]|0){case 5:case 6:case 3:case 4:case 1:case 2:{i=ln(40)|0;zo(i);j=i;k=j;f[a>>2]=k;u=e;return}case 9:{l=3;break}default:{}}if((l|0)==3){i=f[d+48>>2]|0;d=ln(32)|0;f[g>>2]=d;f[g+8>>2]=-2147483616;f[g+4>>2]=17;m=d;n=14495;o=m+17|0;do{b[m>>0]=b[n>>0]|0;m=m+1|0;n=n+1|0}while((m|0)<(o|0));b[d+17>>0]=0;d=i+16|0;n=f[d>>2]|0;if(n){p=d;q=n;a:while(1){n=q;while(1){if((f[n+16>>2]|0)>=(h|0))break;r=f[n+4>>2]|0;if(!r){s=p;break a}else n=r}q=f[n>>2]|0;if(!q){s=n;break}else p=n}if(((s|0)!=(d|0)?(h|0)>=(f[s+16>>2]|0):0)?(h=s+20|0,(Jh(h,g)|0)!=0):0)t=Hk(h,g,-1)|0;else l=12}else l=12;if((l|0)==12)t=Hk(i,g,-1)|0;if((b[g+11>>0]|0)<0)Oq(f[g>>2]|0);if((t|0)>0)if((f[c+56>>2]|0)==1){c=ln(48)|0;m=c;o=m+48|0;do{f[m>>2]=0;m=m+4|0}while((m|0)<(o|0));zo(c);f[c>>2]=2496;f[c+40>>2]=1168;f[c+44>>2]=-1;j=c;k=j;f[a>>2]=k;u=e;return}else{c=ln(64)|0;ym(c);j=c;k=j;f[a>>2]=k;u=e;return}}c=ln(36)|0;Hm(c);j=c;k=j;f[a>>2]=k;u=e;return}function Oe(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0;d=(c|0)==(a|0);b[c+12>>0]=d&1;if(d)return;else e=c;while(1){g=e+8|0;h=f[g>>2]|0;c=h+12|0;if(b[c>>0]|0){i=23;break}j=h+8|0;k=f[j>>2]|0;d=f[k>>2]|0;if((d|0)==(h|0)){l=f[k+4>>2]|0;if(!l){i=7;break}m=l+12|0;if(!(b[m>>0]|0))n=m;else{i=7;break}}else{if(!d){i=16;break}m=d+12|0;if(!(b[m>>0]|0))n=m;else{i=16;break}}b[c>>0]=1;c=(k|0)==(a|0);b[k+12>>0]=c&1;b[n>>0]=1;if(c){i=23;break}else e=k}if((i|0)==7){if((f[h>>2]|0)==(e|0)){o=h;p=k}else{n=h+4|0;a=f[n>>2]|0;c=f[a>>2]|0;f[n>>2]=c;if(!c)q=k;else{f[c+8>>2]=h;q=f[j>>2]|0}f[a+8>>2]=q;q=f[j>>2]|0;f[((f[q>>2]|0)==(h|0)?q:q+4|0)>>2]=a;f[a>>2]=h;f[j>>2]=a;o=a;p=f[a+8>>2]|0}b[o+12>>0]=1;b[p+12>>0]=0;o=f[p>>2]|0;a=o+4|0;q=f[a>>2]|0;f[p>>2]=q;if(q|0)f[q+8>>2]=p;q=p+8|0;f[o+8>>2]=f[q>>2];c=f[q>>2]|0;f[((f[c>>2]|0)==(p|0)?c:c+4|0)>>2]=o;f[a>>2]=p;f[q>>2]=o;return}else if((i|0)==16){if((f[h>>2]|0)==(e|0)){o=e+4|0;q=f[o>>2]|0;f[h>>2]=q;if(!q)r=k;else{f[q+8>>2]=h;r=f[j>>2]|0}f[g>>2]=r;r=f[j>>2]|0;f[((f[r>>2]|0)==(h|0)?r:r+4|0)>>2]=e;f[o>>2]=h;f[j>>2]=e;s=e;t=f[e+8>>2]|0}else{s=h;t=k}b[s+12>>0]=1;b[t+12>>0]=0;s=t+4|0;k=f[s>>2]|0;h=f[k>>2]|0;f[s>>2]=h;if(h|0)f[h+8>>2]=t;h=t+8|0;f[k+8>>2]=f[h>>2];s=f[h>>2]|0;f[((f[s>>2]|0)==(t|0)?s:s+4|0)>>2]=k;f[k>>2]=t;f[h>>2]=k;return}else if((i|0)==23)return}function Pe(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0;d=f[b>>2]|0;b=a+12|0;e=(d|0)==-1;do if(e){g=1;h=-1;i=-1}else{j=d+(((d>>>0)%3|0|0)==0?2:-1)|0;if((j|0)!=-1){k=f[(f[b>>2]|0)+12>>2]|0;l=j;while(1){j=f[k+(l<<2)>>2]|0;if((j|0)==-1){m=0;n=l;break}o=j+1|0;l=((o>>>0)%3|0|0)==0?j+-2|0:o;if((l|0)==-1){m=1;n=-1;break}}if(e){g=m;h=-1;i=n;break}else{p=m;q=n}}else{p=1;q=-1}g=p;h=f[(f[f[b>>2]>>2]|0)+(d<<2)>>2]|0;i=q}while(0);if(c){c=(f[a+84>>2]|0)+(h>>>5<<2)|0;f[c>>2]=f[c>>2]|1<<(h&31);r=1}else r=0;c=f[(f[a+152>>2]|0)+(h<<2)>>2]|0;q=(f[a+140>>2]|0)+(c>>>5<<2)|0;f[q>>2]=f[q>>2]|1<<(c&31);if(!g){g=(((i>>>0)%3|0|0)==0?2:-1)+i|0;if((g|0)==-1){s=-1;t=i}else{s=f[(f[f[b>>2]>>2]|0)+(g<<2)>>2]|0;t=i}}else{s=-1;t=-1}if((s|0)==(h|0)){u=r;return u|0}i=f[a+84>>2]|0;a=r;r=s;s=t;while(1){t=i+(r>>>5<<2)|0;f[t>>2]=f[t>>2]|1<<(r&31);t=a+1|0;g=s+1|0;a:do if((s|0)!=-1?(c=((g>>>0)%3|0|0)==0?s+-2|0:g,(c|0)!=-1):0){q=f[b>>2]|0;d=f[q+12>>2]|0;p=c;while(1){c=f[d+(p<<2)>>2]|0;if((c|0)==-1)break;n=c+1|0;m=((n>>>0)%3|0|0)==0?c+-2|0:n;if((m|0)==-1){v=-1;w=-1;break a}else p=m}d=(((p>>>0)%3|0|0)==0?2:-1)+p|0;if((d|0)==-1){v=-1;w=p}else{v=f[(f[q>>2]|0)+(d<<2)>>2]|0;w=p}}else{v=-1;w=-1}while(0);if((v|0)==(h|0)){u=t;break}else{a=t;r=v;s=w}}return u|0}function Qe(a,c,d,e){a=a|0;c=c|0;d=d|0;e=e|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=Oa,C=Oa,D=Oa,E=Oa;g=u;u=u+16|0;h=g;i=b[d+24>>0]|0;j=i<<24>>24;Rh(a,c,e,j,0,d,1);k=f[a>>2]|0;a=(f[f[k>>2]>>2]|0)+(f[k+48>>2]|0)|0;k=f[c+4>>2]|0;Ap(h);Ko(h,$(n[c+20>>2]),(1<>>0>1073741823?-1:j<<2)|0;if(!e){Mq(k);u=g;return}l=d+68|0;m=d+48|0;o=d+40|0;p=c+8|0;c=h+4|0;q=(b[d+84>>0]|0)==0;if(i<<24>>24>0){r=0;s=0}else{i=0;do{if(q)t=f[(f[l>>2]|0)+(i<<2)>>2]|0;else t=i;v=m;w=f[v>>2]|0;x=f[v+4>>2]|0;v=o;y=f[v>>2]|0;z=un(y|0,f[v+4>>2]|0,t|0,0)|0;v=Vn(z|0,I|0,w|0,x|0)|0;kh(k|0,(f[f[d>>2]>>2]|0)+v|0,y|0)|0;i=i+1|0}while((i|0)!=(e|0));Mq(k);u=g;return}while(1){if(q)A=f[(f[l>>2]|0)+(s<<2)>>2]|0;else A=s;i=m;t=f[i>>2]|0;y=f[i+4>>2]|0;i=o;v=f[i>>2]|0;x=un(v|0,f[i+4>>2]|0,A|0,0)|0;i=Vn(x|0,I|0,t|0,y|0)|0;kh(k|0,(f[f[d>>2]>>2]|0)+i|0,v|0)|0;v=f[p>>2]|0;B=$(n[h>>2]);i=0;y=r;while(1){C=$(n[k+(i<<2)>>2]);D=$(C-$(n[v+(i<<2)>>2]));t=D<$(0.0);C=$(-D);E=$((t?C:D)/B);x=~~$(J($($(E*$(f[c>>2]|0))+$(.5))));f[a+(y<<2)>>2]=t?0-x|0:x;i=i+1|0;if((i|0)==(j|0))break;else y=y+1|0}s=s+1|0;if((s|0)==(e|0))break;else r=r+j|0}Mq(k);u=g;return}function Re(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0;c=a+4|0;d=f[c>>2]|0;e=a+100|0;if(d>>>0<(f[e>>2]|0)>>>0){f[c>>2]=d+1;g=h[d>>0]|0}else g=Si(a)|0;switch(g|0){case 43:case 45:{d=(g|0)==45&1;i=f[c>>2]|0;if(i>>>0<(f[e>>2]|0)>>>0){f[c>>2]=i+1;j=h[i>>0]|0}else j=Si(a)|0;if((b|0)!=0&(j+-48|0)>>>0>9?(f[e>>2]|0)!=0:0){f[c>>2]=(f[c>>2]|0)+-1;k=d;l=j}else{k=d;l=j}break}default:{k=0;l=g}}if((l+-48|0)>>>0>9)if(!(f[e>>2]|0)){m=-2147483648;n=0}else{f[c>>2]=(f[c>>2]|0)+-1;m=-2147483648;n=0}else{g=0;j=l;while(1){g=j+-48+(g*10|0)|0;l=f[c>>2]|0;if(l>>>0<(f[e>>2]|0)>>>0){f[c>>2]=l+1;o=h[l>>0]|0}else o=Si(a)|0;if(!((o+-48|0)>>>0<10&(g|0)<214748364))break;else j=o}j=((g|0)<0)<<31>>31;if((o+-48|0)>>>0<10){l=o;d=g;b=j;while(1){i=un(d|0,b|0,10,0)|0;p=I;q=Vn(l|0,((l|0)<0)<<31>>31|0,-48,-1)|0;r=Vn(q|0,I|0,i|0,p|0)|0;p=I;i=f[c>>2]|0;if(i>>>0<(f[e>>2]|0)>>>0){f[c>>2]=i+1;s=h[i>>0]|0}else s=Si(a)|0;if((s+-48|0)>>>0<10&((p|0)<21474836|(p|0)==21474836&r>>>0<2061584302)){l=s;d=r;b=p}else{t=s;u=r;v=p;break}}}else{t=o;u=g;v=j}if((t+-48|0)>>>0<10)do{t=f[c>>2]|0;if(t>>>0<(f[e>>2]|0)>>>0){f[c>>2]=t+1;w=h[t>>0]|0}else w=Si(a)|0}while((w+-48|0)>>>0<10);if(f[e>>2]|0)f[c>>2]=(f[c>>2]|0)+-1;c=(k|0)!=0;k=Xn(0,0,u|0,v|0)|0;m=c?I:v;n=c?k:u}I=m;return n|0}function Se(a){a=a|0;var b=0,c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0;b=a+1176|0;c=f[b>>2]|0;if(c|0){d=a+1180|0;e=f[d>>2]|0;if((e|0)==(c|0))g=c;else{h=e;while(1){e=h+-12|0;f[d>>2]=e;i=f[e>>2]|0;if(!i)j=e;else{e=h+-8|0;k=f[e>>2]|0;if((k|0)!=(i|0))f[e>>2]=k+(~((k+-4-i|0)>>>2)<<2);Oq(i);j=f[d>>2]|0}if((j|0)==(c|0))break;else h=j}g=f[b>>2]|0}Oq(g)}g=a+1164|0;b=f[g>>2]|0;if(b|0){j=a+1168|0;h=f[j>>2]|0;if((h|0)==(b|0))l=b;else{c=h;while(1){h=c+-12|0;f[j>>2]=h;d=f[h>>2]|0;if(!d)m=h;else{h=c+-8|0;i=f[h>>2]|0;if((i|0)!=(d|0))f[h>>2]=i+(~((i+-4-d|0)>>>2)<<2);Oq(d);m=f[j>>2]|0}if((m|0)==(b|0))break;else c=m}l=f[g>>2]|0}Oq(l)}l=f[a+1152>>2]|0;if(l|0){g=a+1156|0;m=f[g>>2]|0;if((m|0)!=(l|0))f[g>>2]=m+(~((m+-4-l|0)>>>2)<<2);Oq(l)}l=f[a+1140>>2]|0;if(l|0){m=a+1144|0;g=f[m>>2]|0;if((g|0)!=(l|0))f[m>>2]=g+(~((g+-4-l|0)>>>2)<<2);Oq(l)}l=f[a+1128>>2]|0;if(!l){n=a+1108|0;jl(n);o=a+1088|0;jl(o);p=a+1068|0;jl(p);q=a+1036|0;Fj(q);r=a+12|0;Nh(r);return}g=a+1132|0;m=f[g>>2]|0;if((m|0)!=(l|0))f[g>>2]=m+(~((m+-4-l|0)>>>2)<<2);Oq(l);n=a+1108|0;jl(n);o=a+1088|0;jl(o);p=a+1068|0;jl(p);q=a+1036|0;Fj(q);r=a+12|0;Nh(r);return}function Te(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0;d=u;u=u+16|0;e=d;g=a+4|0;h=f[g>>2]|0;i=f[(f[a>>2]|0)+52>>2]|0;if(!h){if(!(Sa[i&31](a,c,0)|0)){j=0;u=d;return j|0}}else if(!(Sa[i&31](a,c,f[(f[h+4>>2]|0)+80>>2]|0)|0)){j=0;u=d;return j|0}if(!(b[a+28>>0]|0)){j=1;u=d;return j|0}h=f[a+8>>2]|0;i=f[a+32>>2]|0;a=f[h+80>>2]|0;f[e>>2]=0;k=e+4|0;f[k>>2]=0;f[e+8>>2]=0;do if(a)if(a>>>0>1073741823)aq(e);else{l=a<<2;m=ln(l)|0;f[e>>2]=m;n=m+(a<<2)|0;f[e+8>>2]=n;sj(m|0,0,l|0)|0;f[k>>2]=n;o=m;p=n;q=m;break}else{o=0;p=0;q=0}while(0);e=f[c+4>>2]|0;a=f[c>>2]|0;c=a;a:do if((e|0)!=(a|0)){m=e-a>>2;if(b[h+84>>0]|0){n=0;while(1){f[o+(f[c+(n<<2)>>2]<<2)>>2]=n;n=n+1|0;if(n>>>0>=m>>>0)break a}}n=f[h+68>>2]|0;l=0;do{f[o+(f[n+(f[c+(l<<2)>>2]<<2)>>2]<<2)>>2]=l;l=l+1|0}while(l>>>0>>0)}while(0);c=f[(f[(f[g>>2]|0)+4>>2]|0)+80>>2]|0;b:do if(c|0){g=f[i+68>>2]|0;if(b[h+84>>0]|0){a=0;while(1){f[g+(a<<2)>>2]=f[o+(a<<2)>>2];a=a+1|0;if(a>>>0>=c>>>0)break b}}a=f[h+68>>2]|0;e=0;do{f[g+(e<<2)>>2]=f[o+(f[a+(e<<2)>>2]<<2)>>2];e=e+1|0}while(e>>>0>>0)}while(0);if(o|0){if((p|0)!=(o|0))f[k>>2]=p+(~((p+-4-o|0)>>>2)<<2);Oq(q)}j=1;u=d;return j|0}function Ue(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0;c=u;u=u+16|0;d=c;f[a>>2]=0;f[a+8>>2]=b;Oh(a+12|0);wn(a+1036|0);vo(a+1068|0);vo(a+1088|0);vo(a+1108|0);e=a+1128|0;f[e>>2]=0;g=a+1132|0;f[g>>2]=0;f[a+1136>>2]=0;h=(b|0)==0;do if(!h)if(b>>>0>1073741823)aq(e);else{i=b<<2;j=ln(i)|0;f[e>>2]=j;k=j+(b<<2)|0;f[a+1136>>2]=k;sj(j|0,0,i|0)|0;f[g>>2]=k;break}while(0);g=a+1140|0;f[g>>2]=0;e=a+1144|0;f[e>>2]=0;f[a+1148>>2]=0;if(!h){k=b<<2;i=ln(k)|0;f[g>>2]=i;g=i+(b<<2)|0;f[a+1148>>2]=g;sj(i|0,0,k|0)|0;f[e>>2]=g}g=a+1152|0;f[g>>2]=0;e=a+1156|0;f[e>>2]=0;f[a+1160>>2]=0;if(!h){k=b<<2;i=ln(k)|0;f[g>>2]=i;g=i+(b<<2)|0;f[a+1160>>2]=g;sj(i|0,0,k|0)|0;f[e>>2]=g}g=b<<5|1;f[d>>2]=0;e=d+4|0;f[e>>2]=0;f[d+8>>2]=0;if(!h){k=b<<2;i=ln(k)|0;f[d>>2]=i;j=i+(b<<2)|0;f[d+8>>2]=j;sj(i|0,0,k|0)|0;f[e>>2]=j}lk(a+1164|0,g,d);j=f[d>>2]|0;if(j|0){k=f[e>>2]|0;if((k|0)!=(j|0))f[e>>2]=k+(~((k+-4-j|0)>>>2)<<2);Oq(j)}f[d>>2]=0;j=d+4|0;f[j>>2]=0;f[d+8>>2]=0;if(!h){h=b<<2;k=ln(h)|0;f[d>>2]=k;e=k+(b<<2)|0;f[d+8>>2]=e;sj(k|0,0,h|0)|0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f[i+12>>2]=f[a+12>>2];f[i+16>>2]=f[a+16>>2];u=g;return}if(!j){u=g;return}j=f[b>>2]|0;b=0;do{a=j+(f[c+(b<<2)>>2]<<2)|0;f[a>>2]=(f[a>>2]|0)+-1;b=b+1|0}while((b|0)!=(d|0));u=g;return}function We(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0.0;a:do if(b>>>0<=20)do switch(b|0){case 9:{d=(f[c>>2]|0)+(4-1)&~(4-1);e=f[d>>2]|0;f[c>>2]=d+4;f[a>>2]=e;break a;break}case 10:{e=(f[c>>2]|0)+(4-1)&~(4-1);d=f[e>>2]|0;f[c>>2]=e+4;e=a;f[e>>2]=d;f[e+4>>2]=((d|0)<0)<<31>>31;break a;break}case 11:{d=(f[c>>2]|0)+(4-1)&~(4-1);e=f[d>>2]|0;f[c>>2]=d+4;d=a;f[d>>2]=e;f[d+4>>2]=0;break a;break}case 12:{d=(f[c>>2]|0)+(8-1)&~(8-1);e=d;g=f[e>>2]|0;h=f[e+4>>2]|0;f[c>>2]=d+8;d=a;f[d>>2]=g;f[d+4>>2]=h;break a;break}case 13:{h=(f[c>>2]|0)+(4-1)&~(4-1);d=f[h>>2]|0;f[c>>2]=h+4;h=(d&65535)<<16>>16;d=a;f[d>>2]=h;f[d+4>>2]=((h|0)<0)<<31>>31;break a;break}case 14:{h=(f[c>>2]|0)+(4-1)&~(4-1);d=f[h>>2]|0;f[c>>2]=h+4;h=a;f[h>>2]=d&65535;f[h+4>>2]=0;break a;break}case 15:{h=(f[c>>2]|0)+(4-1)&~(4-1);d=f[h>>2]|0;f[c>>2]=h+4;h=(d&255)<<24>>24;d=a;f[d>>2]=h;f[d+4>>2]=((h|0)<0)<<31>>31;break a;break}case 16:{h=(f[c>>2]|0)+(4-1)&~(4-1);d=f[h>>2]|0;f[c>>2]=h+4;h=a;f[h>>2]=d&255;f[h+4>>2]=0;break a;break}case 17:{h=(f[c>>2]|0)+(8-1)&~(8-1);i=+p[h>>3];f[c>>2]=h+8;p[a>>3]=i;break a;break}case 18:{h=(f[c>>2]|0)+(8-1)&~(8-1);i=+p[h>>3];f[c>>2]=h+8;p[a>>3]=i;break a;break}default:break a}while(0);while(0);return}function Xe(a){a=a|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0;c=u;u=u+16|0;d=c+4|0;e=c;g=c+8|0;if(!(Qa[f[(f[a>>2]|0)+32>>2]&127](a)|0)){h=0;u=c;return h|0}i=a+44|0;j=f[i>>2]|0;k=a+8|0;l=a+12|0;m=f[l>>2]|0;n=f[k>>2]|0;b[g>>0]=(m-n|0)>>>2;o=j+16|0;p=f[o+4>>2]|0;if((p|0)>0|(p|0)==0&(f[o>>2]|0)>>>0>0){q=k;r=n;s=m}else{f[e>>2]=f[j+4>>2];f[d>>2]=f[e>>2];Me(j,d,g,g+1|0)|0;q=k;r=f[k>>2]|0;s=f[l>>2]|0}a:do if((r|0)!=(s|0)){l=a+4|0;k=r;while(1){g=f[k>>2]|0;k=k+4|0;if(!(Sa[f[(f[g>>2]|0)+8>>2]&31](g,a,f[l>>2]|0)|0)){h=0;break}if((k|0)==(s|0))break a}u=c;return h|0}while(0);if(!(xc(a)|0)){h=0;u=c;return h|0}s=a+32|0;r=f[s>>2]|0;k=a+36|0;l=f[k>>2]|0;b:do if((r|0)!=(l|0)){g=r;do{if(!(Ra[f[(f[a>>2]|0)+40>>2]&127](a,f[g>>2]|0)|0)){h=0;t=18;break}g=g+4|0}while((g|0)!=(l|0));if((t|0)==18){u=c;return h|0}g=f[s>>2]|0;d=f[k>>2]|0;if((g|0)!=(d|0)){j=g;while(1){g=f[(f[q>>2]|0)+(f[j>>2]<<2)>>2]|0;j=j+4|0;if(!(Ra[f[(f[g>>2]|0)+12>>2]&127](g,f[i>>2]|0)|0)){h=0;break}if((j|0)==(d|0))break b}u=c;return h|0}}while(0);h=Qa[f[(f[a>>2]|0)+44>>2]&127](a)|0;u=c;return h|0}function Ye(a,b){a=a|0;b=b|0;ld(a,b);ld(a+32|0,b);ld(a+64|0,b);ld(a+96|0,b);ld(a+128|0,b);ld(a+160|0,b);ld(a+192|0,b);ld(a+224|0,b);ld(a+256|0,b);ld(a+288|0,b);ld(a+320|0,b);ld(a+352|0,b);ld(a+384|0,b);ld(a+416|0,b);ld(a+448|0,b);ld(a+480|0,b);ld(a+512|0,b);ld(a+544|0,b);ld(a+576|0,b);ld(a+608|0,b);ld(a+640|0,b);ld(a+672|0,b);ld(a+704|0,b);ld(a+736|0,b);ld(a+768|0,b);ld(a+800|0,b);ld(a+832|0,b);ld(a+864|0,b);ld(a+896|0,b);ld(a+928|0,b);ld(a+960|0,b);ld(a+992|0,b);ld(a+1024|0,b);return}function Ze(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0;c=u;u=u+32|0;d=c;e=a+4|0;g=f[a>>2]|0;h=(f[e>>2]|0)-g>>2;i=h+1|0;if(i>>>0>1073741823)aq(a);j=a+8|0;k=(f[j>>2]|0)-g|0;g=k>>1;l=k>>2>>>0<536870911?(g>>>0>>0?i:g):1073741823;f[d+12>>2]=0;f[d+16>>2]=a+8;do if(l)if(l>>>0>1073741823){g=ra(8)|0;Oo(g,16035);f[g>>2]=7256;va(g|0,1112,110)}else{m=ln(l<<2)|0;break}else m=0;while(0);f[d>>2]=m;g=m+(h<<2)|0;h=d+8|0;i=d+4|0;f[i>>2]=g;k=m+(l<<2)|0;l=d+12|0;f[l>>2]=k;m=f[b>>2]|0;f[b>>2]=0;f[g>>2]=m;m=g+4|0;f[h>>2]=m;b=f[a>>2]|0;n=f[e>>2]|0;if((n|0)==(b|0)){o=g;p=l;q=h;r=b;s=m;t=n;v=k;w=o;f[a>>2]=w;f[i>>2]=r;f[e>>2]=s;f[q>>2]=t;x=f[j>>2]|0;f[j>>2]=v;f[p>>2]=x;f[d>>2]=r;ki(d);u=c;return}else{y=n;z=g}do{y=y+-4|0;g=f[y>>2]|0;f[y>>2]=0;f[z+-4>>2]=g;z=(f[i>>2]|0)+-4|0;f[i>>2]=z}while((y|0)!=(b|0));o=z;p=l;q=h;r=f[a>>2]|0;s=f[h>>2]|0;t=f[e>>2]|0;v=f[l>>2]|0;w=o;f[a>>2]=w;f[i>>2]=r;f[e>>2]=s;f[q>>2]=t;x=f[j>>2]|0;f[j>>2]=v;f[p>>2]=x;f[d>>2]=r;ki(d);u=c;return}function _e(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0;d=u;u=u+32|0;e=d+12|0;g=d;h=nl(c,0)|0;if(!h){f[a>>2]=0;u=d;return}i=f[c+100>>2]|0;j=f[c+96>>2]|0;c=i-j|0;k=(c|0)/12|0;f[e>>2]=0;l=e+4|0;f[l>>2]=0;f[e+8>>2]=0;m=j;do if(c)if(k>>>0>357913941)aq(e);else{n=ln(c)|0;f[e>>2]=n;f[e+8>>2]=n+(k*12|0);sj(n|0,0,c|0)|0;f[l>>2]=n+c;o=n;break}else o=0;while(0);f[g>>2]=0;f[g+4>>2]=0;f[g+8>>2]=0;a:do if((i|0)!=(j|0)){c=g+4|0;n=g+8|0;if(b[h+84>>0]|0){p=0;while(1){q=m+(p*12|0)|0;f[g>>2]=f[q>>2];f[g+4>>2]=f[q+4>>2];f[g+8>>2]=f[q+8>>2];f[o+(p*12|0)>>2]=f[g>>2];f[o+(p*12|0)+4>>2]=f[c>>2];f[o+(p*12|0)+8>>2]=f[n>>2];p=p+1|0;if(p>>>0>=k>>>0)break a}}p=f[h+68>>2]|0;q=0;do{r=f[p+(f[m+(q*12|0)>>2]<<2)>>2]|0;f[g>>2]=r;s=f[p+(f[m+(q*12|0)+4>>2]<<2)>>2]|0;f[c>>2]=s;t=f[p+(f[m+(q*12|0)+8>>2]<<2)>>2]|0;f[n>>2]=t;f[o+(q*12|0)>>2]=r;f[o+(q*12|0)+4>>2]=s;f[o+(q*12|0)+8>>2]=t;q=q+1|0}while(q>>>0>>0)}while(0);Kj(a,e);a=f[e>>2]|0;if(a|0){e=f[l>>2]|0;if((e|0)!=(a|0))f[l>>2]=e+(~(((e+-12-a|0)>>>0)/12|0)*12|0);Oq(a)}u=d;return}function $e(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0;c=u;u=u+16|0;d=c;f[a>>2]=0;f[a+8>>2]=b;wn(a+12|0);vo(a+44|0);vo(a+64|0);vo(a+84|0);e=a+104|0;f[e>>2]=0;g=a+108|0;f[g>>2]=0;f[a+112>>2]=0;h=(b|0)==0;do if(!h)if(b>>>0>1073741823)aq(e);else{i=b<<2;j=ln(i)|0;f[e>>2]=j;k=j+(b<<2)|0;f[a+112>>2]=k;sj(j|0,0,i|0)|0;f[g>>2]=k;break}while(0);g=a+116|0;f[g>>2]=0;e=a+120|0;f[e>>2]=0;f[a+124>>2]=0;if(!h){k=b<<2;i=ln(k)|0;f[g>>2]=i;g=i+(b<<2)|0;f[a+124>>2]=g;sj(i|0,0,k|0)|0;f[e>>2]=g}g=a+128|0;f[g>>2]=0;e=a+132|0;f[e>>2]=0;f[a+136>>2]=0;if(!h){k=b<<2;i=ln(k)|0;f[g>>2]=i;g=i+(b<<2)|0;f[a+136>>2]=g;sj(i|0,0,k|0)|0;f[e>>2]=g}g=b<<5|1;f[d>>2]=0;e=d+4|0;f[e>>2]=0;f[d+8>>2]=0;if(!h){k=b<<2;i=ln(k)|0;f[d>>2]=i;j=i+(b<<2)|0;f[d+8>>2]=j;sj(i|0,0,k|0)|0;f[e>>2]=j}lk(a+140|0,g,d);j=f[d>>2]|0;if(j|0){k=f[e>>2]|0;if((k|0)!=(j|0))f[e>>2]=k+(~((k+-4-j|0)>>>2)<<2);Oq(j)}f[d>>2]=0;j=d+4|0;f[j>>2]=0;f[d+8>>2]=0;if(!h){h=b<<2;k=ln(h)|0;f[d>>2]=k;e=k+(b<<2)|0;f[d+8>>2]=e;sj(k|0,0,h|0)|0;f[j>>2]=e}lk(a+152|0,g,d);g=f[d>>2]|0;if(!g){u=c;return}d=f[j>>2]|0;if((d|0)!=(g|0))f[j>>2]=d+(~((d+-4-g|0)>>>2)<<2);Oq(g);u=c;return}function af(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0;c=u;u=u+16|0;d=c;f[a>>2]=0;f[a+8>>2]=b;vo(a+12|0);vo(a+32|0);vo(a+52|0);vo(a+72|0);e=a+92|0;f[e>>2]=0;g=a+96|0;f[g>>2]=0;f[a+100>>2]=0;h=(b|0)==0;do if(!h)if(b>>>0>1073741823)aq(e);else{i=b<<2;j=ln(i)|0;f[e>>2]=j;k=j+(b<<2)|0;f[a+100>>2]=k;sj(j|0,0,i|0)|0;f[g>>2]=k;break}while(0);g=a+104|0;f[g>>2]=0;e=a+108|0;f[e>>2]=0;f[a+112>>2]=0;if(!h){k=b<<2;i=ln(k)|0;f[g>>2]=i;g=i+(b<<2)|0;f[a+112>>2]=g;sj(i|0,0,k|0)|0;f[e>>2]=g}g=a+116|0;f[g>>2]=0;e=a+120|0;f[e>>2]=0;f[a+124>>2]=0;if(!h){k=b<<2;i=ln(k)|0;f[g>>2]=i;g=i+(b<<2)|0;f[a+124>>2]=g;sj(i|0,0,k|0)|0;f[e>>2]=g}g=b<<5|1;f[d>>2]=0;e=d+4|0;f[e>>2]=0;f[d+8>>2]=0;if(!h){k=b<<2;i=ln(k)|0;f[d>>2]=i;j=i+(b<<2)|0;f[d+8>>2]=j;sj(i|0,0,k|0)|0;f[e>>2]=j}lk(a+128|0,g,d);j=f[d>>2]|0;if(j|0){k=f[e>>2]|0;if((k|0)!=(j|0))f[e>>2]=k+(~((k+-4-j|0)>>>2)<<2);Oq(j)}f[d>>2]=0;j=d+4|0;f[j>>2]=0;f[d+8>>2]=0;if(!h){h=b<<2;k=ln(h)|0;f[d>>2]=k;e=k+(b<<2)|0;f[d+8>>2]=e;sj(k|0,0,h|0)|0;f[j>>2]=e}lk(a+140|0,g,d);g=f[d>>2]|0;if(!g){u=c;return}d=f[j>>2]|0;if((d|0)!=(g|0))f[j>>2]=d+(~((d+-4-g|0)>>>2)<<2);Oq(g);u=c;return}function bf(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0;d=ln(40)|0;e=d+16|0;pj(e,c);pj(d+28|0,c+12|0);c=a+4|0;g=f[c>>2]|0;do if(g){h=b[d+27>>0]|0;i=h<<24>>24<0;j=i?f[d+20>>2]|0:h&255;h=i?f[e>>2]|0:e;i=g;while(1){k=i+16|0;l=b[k+11>>0]|0;m=l<<24>>24<0;n=m?f[i+20>>2]|0:l&255;l=n>>>0>>0?n:j;if((l|0)!=0?(o=Vk(h,m?f[k>>2]|0:k,l)|0,(o|0)!=0):0)if((o|0)<0)p=7;else p=9;else if(j>>>0>>0)p=7;else p=9;if((p|0)==7){p=0;n=f[i>>2]|0;if(!n){p=8;break}else q=n}else if((p|0)==9){p=0;r=i+4|0;n=f[r>>2]|0;if(!n){p=11;break}else q=n}i=q}if((p|0)==8){s=i;t=i;break}else if((p|0)==11){s=i;t=r;break}}else{s=c;t=c}while(0);f[d>>2]=0;f[d+4>>2]=0;f[d+8>>2]=s;f[t>>2]=d;s=f[f[a>>2]>>2]|0;if(!s){u=d;v=a+4|0;w=f[v>>2]|0;Oe(w,u);x=a+8|0;y=f[x>>2]|0;z=y+1|0;f[x>>2]=z;return d|0}f[a>>2]=s;u=f[t>>2]|0;v=a+4|0;w=f[v>>2]|0;Oe(w,u);x=a+8|0;y=f[x>>2]|0;z=y+1|0;f[x>>2]=z;return d|0}function cf(a){a=a|0;var b=0,c=0,d=0;f[a>>2]=3680;wi(a+200|0);b=f[a+184>>2]|0;if(b|0){c=a+188|0;d=f[c>>2]|0;if((d|0)!=(b|0))f[c>>2]=d+(~((d+-4-b|0)>>>2)<<2);Oq(b)}kj(a+172|0);b=f[a+152>>2]|0;if(b|0){d=a+156|0;c=f[d>>2]|0;if((c|0)!=(b|0))f[d>>2]=c+(~((c+-4-b|0)>>>2)<<2);Oq(b)}b=f[a+140>>2]|0;if(b|0)Oq(b);b=f[a+128>>2]|0;if(b|0){c=b;do{b=c;c=f[c>>2]|0;Oq(b)}while((c|0)!=0)}c=a+120|0;b=f[c>>2]|0;f[c>>2]=0;if(b|0)Oq(b);b=f[a+108>>2]|0;if(b|0){c=a+112|0;d=f[c>>2]|0;if((d|0)!=(b|0))f[c>>2]=d+(~(((d+-12-b|0)>>>0)/12|0)*12|0);Oq(b)}b=f[a+96>>2]|0;if(b|0){d=a+100|0;c=f[d>>2]|0;if((c|0)!=(b|0))f[d>>2]=c+(~((c+-4-b|0)>>>2)<<2);Oq(b)}b=f[a+84>>2]|0;if(b|0)Oq(b);b=f[a+72>>2]|0;if(b|0){c=a+76|0;d=f[c>>2]|0;if((d|0)!=(b|0))f[c>>2]=d+(~((d+-4-b|0)>>>2)<<2);Oq(b)}b=f[a+52>>2]|0;if(b|0){d=a+56|0;c=f[d>>2]|0;if((c|0)!=(b|0))f[d>>2]=c+(~((c+-4-b|0)>>>2)<<2);Oq(b)}b=f[a+40>>2]|0;if(b|0){c=a+44|0;d=f[c>>2]|0;if((d|0)!=(b|0))f[c>>2]=d+(~((d+-4-b|0)>>>2)<<2);Oq(b)}b=f[a+28>>2]|0;if(b|0)Oq(b);b=f[a+16>>2]|0;if(b|0){d=a+20|0;c=f[d>>2]|0;if((c|0)!=(b|0))f[d>>2]=c+(~((c+-4-b|0)>>>2)<<2);Oq(b)}b=a+12|0;a=f[b>>2]|0;f[b>>2]=0;if(!a)return;Ii(a);Oq(a);return}function df(a){a=a|0;var b=0,c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0;b=a+140|0;c=f[b>>2]|0;if(c|0){d=a+144|0;e=f[d>>2]|0;if((e|0)==(c|0))g=c;else{h=e;while(1){e=h+-12|0;f[d>>2]=e;i=f[e>>2]|0;if(!i)j=e;else{e=h+-8|0;k=f[e>>2]|0;if((k|0)!=(i|0))f[e>>2]=k+(~((k+-4-i|0)>>>2)<<2);Oq(i);j=f[d>>2]|0}if((j|0)==(c|0))break;else h=j}g=f[b>>2]|0}Oq(g)}g=a+128|0;b=f[g>>2]|0;if(b|0){j=a+132|0;h=f[j>>2]|0;if((h|0)==(b|0))l=b;else{c=h;while(1){h=c+-12|0;f[j>>2]=h;d=f[h>>2]|0;if(!d)m=h;else{h=c+-8|0;i=f[h>>2]|0;if((i|0)!=(d|0))f[h>>2]=i+(~((i+-4-d|0)>>>2)<<2);Oq(d);m=f[j>>2]|0}if((m|0)==(b|0))break;else c=m}l=f[g>>2]|0}Oq(l)}l=f[a+116>>2]|0;if(l|0){g=a+120|0;m=f[g>>2]|0;if((m|0)!=(l|0))f[g>>2]=m+(~((m+-4-l|0)>>>2)<<2);Oq(l)}l=f[a+104>>2]|0;if(l|0){m=a+108|0;g=f[m>>2]|0;if((g|0)!=(l|0))f[m>>2]=g+(~((g+-4-l|0)>>>2)<<2);Oq(l)}l=f[a+92>>2]|0;if(!l){n=a+72|0;jl(n);o=a+52|0;jl(o);p=a+32|0;jl(p);q=a+12|0;jl(q);return}g=a+96|0;m=f[g>>2]|0;if((m|0)!=(l|0))f[g>>2]=m+(~((m+-4-l|0)>>>2)<<2);Oq(l);n=a+72|0;jl(n);o=a+52|0;jl(o);p=a+32|0;jl(p);q=a+12|0;jl(q);return}function ef(a){a=a|0;var b=0,c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0;b=a+152|0;c=f[b>>2]|0;if(c|0){d=a+156|0;e=f[d>>2]|0;if((e|0)==(c|0))g=c;else{h=e;while(1){e=h+-12|0;f[d>>2]=e;i=f[e>>2]|0;if(!i)j=e;else{e=h+-8|0;k=f[e>>2]|0;if((k|0)!=(i|0))f[e>>2]=k+(~((k+-4-i|0)>>>2)<<2);Oq(i);j=f[d>>2]|0}if((j|0)==(c|0))break;else h=j}g=f[b>>2]|0}Oq(g)}g=a+140|0;b=f[g>>2]|0;if(b|0){j=a+144|0;h=f[j>>2]|0;if((h|0)==(b|0))l=b;else{c=h;while(1){h=c+-12|0;f[j>>2]=h;d=f[h>>2]|0;if(!d)m=h;else{h=c+-8|0;i=f[h>>2]|0;if((i|0)!=(d|0))f[h>>2]=i+(~((i+-4-d|0)>>>2)<<2);Oq(d);m=f[j>>2]|0}if((m|0)==(b|0))break;else c=m}l=f[g>>2]|0}Oq(l)}l=f[a+128>>2]|0;if(l|0){g=a+132|0;m=f[g>>2]|0;if((m|0)!=(l|0))f[g>>2]=m+(~((m+-4-l|0)>>>2)<<2);Oq(l)}l=f[a+116>>2]|0;if(l|0){m=a+120|0;g=f[m>>2]|0;if((g|0)!=(l|0))f[m>>2]=g+(~((g+-4-l|0)>>>2)<<2);Oq(l)}l=f[a+104>>2]|0;if(!l){n=a+84|0;jl(n);o=a+64|0;jl(o);p=a+44|0;jl(p);q=a+12|0;Fj(q);return}g=a+108|0;m=f[g>>2]|0;if((m|0)!=(l|0))f[g>>2]=m+(~((m+-4-l|0)>>>2)<<2);Oq(l);n=a+84|0;jl(n);o=a+64|0;jl(o);p=a+44|0;jl(p);q=a+12|0;Fj(q);return}function ff(a){a=a|0;var b=0,c=0,d=0;f[a>>2]=3480;uj(a+200|0);b=f[a+184>>2]|0;if(b|0){c=a+188|0;d=f[c>>2]|0;if((d|0)!=(b|0))f[c>>2]=d+(~((d+-4-b|0)>>>2)<<2);Oq(b)}kj(a+172|0);b=f[a+152>>2]|0;if(b|0){d=a+156|0;c=f[d>>2]|0;if((c|0)!=(b|0))f[d>>2]=c+(~((c+-4-b|0)>>>2)<<2);Oq(b)}b=f[a+140>>2]|0;if(b|0)Oq(b);b=f[a+128>>2]|0;if(b|0){c=b;do{b=c;c=f[c>>2]|0;Oq(b)}while((c|0)!=0)}c=a+120|0;b=f[c>>2]|0;f[c>>2]=0;if(b|0)Oq(b);b=f[a+108>>2]|0;if(b|0){c=a+112|0;d=f[c>>2]|0;if((d|0)!=(b|0))f[c>>2]=d+(~(((d+-12-b|0)>>>0)/12|0)*12|0);Oq(b)}b=f[a+96>>2]|0;if(b|0){d=a+100|0;c=f[d>>2]|0;if((c|0)!=(b|0))f[d>>2]=c+(~((c+-4-b|0)>>>2)<<2);Oq(b)}b=f[a+84>>2]|0;if(b|0)Oq(b);b=f[a+72>>2]|0;if(b|0){c=a+76|0;d=f[c>>2]|0;if((d|0)!=(b|0))f[c>>2]=d+(~((d+-4-b|0)>>>2)<<2);Oq(b)}b=f[a+52>>2]|0;if(b|0){d=a+56|0;c=f[d>>2]|0;if((c|0)!=(b|0))f[d>>2]=c+(~((c+-4-b|0)>>>2)<<2);Oq(b)}b=f[a+40>>2]|0;if(b|0){c=a+44|0;d=f[c>>2]|0;if((d|0)!=(b|0))f[c>>2]=d+(~((d+-4-b|0)>>>2)<<2);Oq(b)}b=f[a+28>>2]|0;if(b|0)Oq(b);b=f[a+16>>2]|0;if(b|0){d=a+20|0;c=f[d>>2]|0;if((c|0)!=(b|0))f[d>>2]=c+(~((c+-4-b|0)>>>2)<<2);Oq(b)}b=a+12|0;a=f[b>>2]|0;f[b>>2]=0;if(!a)return;Ii(a);Oq(a);return}function gf(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0;e=u;u=u+144|0;g=e+136|0;h=e+104|0;i=e;j=ln(124)|0;k=f[c+8>>2]|0;f[j+4>>2]=0;f[j>>2]=3656;f[j+12>>2]=3636;f[j+100>>2]=0;f[j+104>>2]=0;f[j+108>>2]=0;l=j+16|0;m=l+80|0;do{f[l>>2]=0;l=l+4|0}while((l|0)<(m|0));f[j+112>>2]=k;f[j+116>>2]=d;n=j+120|0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2]=f[a+80>>2]}while(0);if(!e){i=j;u=g;return i|0}Bj(f[(f[c>>2]|0)+(j<<2)>>2]|0,e)|0;i=j;u=g;return i|0}function kf(a,b,c,d,e,g){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;g=g|0;var h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0;d=u;u=u+32|0;h=d+24|0;i=d+16|0;j=d;k=d+8|0;f[a+52>>2]=e;f[a+44>>2]=g;g=Lq(e>>>0>1073741823?-1:e<<2)|0;l=a+48|0;m=f[l>>2]|0;f[l>>2]=g;if(m|0)Mq(m);m=a+36|0;g=f[m>>2]|0;n=f[g+4>>2]|0;o=f[g>>2]|0;p=n-o|0;if((p|0)<=0){u=d;return 1}q=(p>>>2)+-1|0;p=a+8|0;r=i+4|0;s=j+4|0;t=h+4|0;if(n-o>>2>>>0>q>>>0){v=q;w=o}else{x=g;aq(x)}while(1){f[k>>2]=f[w+(v<<2)>>2];f[h>>2]=f[k>>2];Bc(a,h,b,v);g=X(v,e)|0;o=b+(g<<2)|0;q=f[l>>2]|0;n=c+(g<<2)|0;g=f[o+4>>2]|0;y=f[q>>2]|0;z=f[q+4>>2]|0;f[i>>2]=f[o>>2];f[r>>2]=g;f[j>>2]=y;f[s>>2]=z;Od(h,p,i,j);f[n>>2]=f[h>>2];f[n+4>>2]=f[t>>2];v=v+-1|0;if((v|0)<=-1){A=5;break}n=f[m>>2]|0;w=f[n>>2]|0;if((f[n+4>>2]|0)-w>>2>>>0<=v>>>0){x=n;A=6;break}}if((A|0)==5){u=d;return 1}else if((A|0)==6)aq(x);return 0}function lf(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0;d=f[c>>2]|0;c=f[d>>2]|0;e=f[a+4>>2]|0;g=f[d+4>>2]|0;h=e+-1|0;i=(h&e|0)==0;if(!i)if(g>>>0>>0)j=g;else j=(g>>>0)%(e>>>0)|0;else j=h&g;g=(f[a>>2]|0)+(j<<2)|0;k=f[g>>2]|0;while(1){l=f[k>>2]|0;if((l|0)==(d|0))break;else k=l}if((k|0)!=(a+8|0)){l=f[k+4>>2]|0;if(!i)if(l>>>0>>0)m=l;else m=(l>>>0)%(e>>>0)|0;else m=l&h;if((m|0)==(j|0)){n=c;o=21}else o=13}else o=13;do if((o|0)==13){if(c|0){m=f[c+4>>2]|0;if(!i)if(m>>>0>>0)p=m;else p=(m>>>0)%(e>>>0)|0;else p=m&h;if((p|0)==(j|0)){q=c;r=c;o=22;break}}f[g>>2]=0;n=f[d>>2]|0;o=21}while(0);if((o|0)==21){g=n;if(!n)s=g;else{q=n;r=g;o=22}}if((o|0)==22){o=f[q+4>>2]|0;if(!i)if(o>>>0>>0)t=o;else t=(o>>>0)%(e>>>0)|0;else t=o&h;if((t|0)==(j|0))s=r;else{f[(f[a>>2]|0)+(t<<2)>>2]=k;s=f[d>>2]|0}}f[k>>2]=s;f[d>>2]=0;s=a+12|0;f[s>>2]=(f[s>>2]|0)+-1;if(!d)return c|0;s=d+8|0;a=f[d+20>>2]|0;if(a|0){k=d+24|0;if((f[k>>2]|0)!=(a|0))f[k>>2]=a;Oq(a)}if((b[s+11>>0]|0)<0)Oq(f[s>>2]|0);Oq(d);return c|0}function mf(a){a=a|0;var b=0,c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0;b=u;u=u+16|0;c=b+4|0;d=b;f[c>>2]=0;e=c+4|0;f[e>>2]=0;f[c+8>>2]=0;g=a+52|0;h=f[g>>2]|0;i=(f[h+100>>2]|0)-(f[h+96>>2]|0)|0;j=(i|0)/12|0;if(!i){k=0;l=0}else{i=c+8|0;m=0;n=0;o=h;h=0;p=0;while(1){q=f[o+96>>2]|0;r=f[q+(n*12|0)>>2]|0;s=r-m|0;t=((s|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l;r=m}else{q=l;r=m}else{Ch(b,i-j|0,e);q=f[d>>2]|0;r=f[b>>2]|0}n=r;o=q}f[n+(o<<2)>>2]=((f[h>>2]|0)-(f[a>>2]|0)>>2)+-1;u=c;return 1}function pf(a,b,c,d,e,g){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;g=g|0;var h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0;d=u;u=u+32|0;h=d+24|0;i=d+16|0;j=d;k=d+8|0;f[a+52>>2]=e;f[a+44>>2]=g;g=Lq(e>>>0>1073741823?-1:e<<2)|0;l=a+48|0;m=f[l>>2]|0;f[l>>2]=g;if(m|0)Mq(m);m=a+36|0;g=f[m>>2]|0;n=f[g+4>>2]|0;o=f[g>>2]|0;p=n-o|0;if((p|0)<=0){u=d;return 1}q=(p>>>2)+-1|0;p=a+8|0;r=i+4|0;s=j+4|0;t=h+4|0;if(n-o>>2>>>0>q>>>0){v=q;w=o}else{x=g;aq(x)}while(1){f[k>>2]=f[w+(v<<2)>>2];f[h>>2]=f[k>>2];Ac(a,h,b,v);g=X(v,e)|0;o=b+(g<<2)|0;q=f[l>>2]|0;n=c+(g<<2)|0;g=f[o+4>>2]|0;y=f[q>>2]|0;z=f[q+4>>2]|0;f[i>>2]=f[o>>2];f[r>>2]=g;f[j>>2]=y;f[s>>2]=z;Od(h,p,i,j);f[n>>2]=f[h>>2];f[n+4>>2]=f[t>>2];v=v+-1|0;if((v|0)<=-1){A=5;break}n=f[m>>2]|0;w=f[n>>2]|0;if((f[n+4>>2]|0)-w>>2>>>0<=v>>>0){x=n;A=6;break}}if((A|0)==5){u=d;return 1}else if((A|0)==6)aq(x);return 0}function qf(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0;d=a+8|0;e=f[d>>2]|0;g=f[a>>2]|0;h=g;do if(e-g>>3>>>0>=b>>>0){i=a+4|0;j=f[i>>2]|0;k=j-g>>3;l=k>>>0>>0;m=l?k:b;n=j;if(m|0){j=m;m=h;while(1){o=c;p=f[o+4>>2]|0;q=m;f[q>>2]=f[o>>2];f[q+4>>2]=p;j=j+-1|0;if(!j)break;else m=m+8|0}}if(!l){m=h+(b<<3)|0;if((m|0)==(n|0))return;else{r=i;s=n+(~((n+-8-m|0)>>>3)<<3)|0;break}}else{m=b-k|0;j=m;p=n;while(1){q=c;o=f[q+4>>2]|0;t=p;f[t>>2]=f[q>>2];f[t+4>>2]=o;j=j+-1|0;if(!j)break;else p=p+8|0}r=i;s=n+(m<<3)|0;break}}else{p=g;if(!g)u=e;else{j=a+4|0;k=f[j>>2]|0;if((k|0)!=(h|0))f[j>>2]=k+(~((k+-8-g|0)>>>3)<<3);Oq(p);f[d>>2]=0;f[j>>2]=0;f[a>>2]=0;u=0}if(b>>>0>536870911)aq(a);j=u>>2;p=u>>3>>>0<268435455?(j>>>0>>0?b:j):536870911;if(p>>>0>536870911)aq(a);j=ln(p<<3)|0;k=a+4|0;f[k>>2]=j;f[a>>2]=j;f[d>>2]=j+(p<<3);p=b;l=j;while(1){o=c;t=f[o+4>>2]|0;q=l;f[q>>2]=f[o>>2];f[q+4>>2]=t;p=p+-1|0;if(!p)break;else l=l+8|0}r=k;s=j+(b<<3)|0}while(0);f[r>>2]=s;return}function rf(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0.0,g=0.0,h=0.0,i=0.0,j=0.0,k=0,l=0,m=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0;e=+$(n[b>>2]);g=+K(+e);h=+$(n[b+4>>2]);i=g+ +K(+h);g=+$(n[b+8>>2]);j=i+ +K(+g);b=j>1.0e-06;i=1.0/j;k=f[a+12>>2]|0;j=+(k|0);l=~~+J(+((b?i*e:1.0)*j+.5));m=~~+J(+((b?i*h:0.0)*j+.5));o=(l|0)>-1;p=k-(o?l:0-l|0)-((m|0)>-1?m:0-m|0)|0;l=(p|0)<0;q=(l?((m|0)>0?p:0-p|0):0)+m|0;m=l?0:p;p=(b?i*g:0.0)<0.0?0-m|0:m;do if(!o){if((q|0)<0)r=(p|0)>-1?p:0-p|0;else r=(f[a+8>>2]|0)-((p|0)>-1?p:0-p|0)|0;if((p|0)<0){s=(q|0)>-1?q:0-q|0;t=r;break}else{s=(f[a+8>>2]|0)-((q|0)>-1?q:0-q|0)|0;t=r;break}}else{s=k+p|0;t=k+q|0}while(0);q=(t|0)==0;p=(s|0)==0;r=f[a+8>>2]|0;if(!(s|t)){u=r;v=r;f[c>>2]=u;f[d>>2]=v;return}a=(r|0)==(s|0);if(q&a){u=s;v=s;f[c>>2]=u;f[d>>2]=v;return}o=(r|0)==(t|0);if(p&o){u=t;v=t;f[c>>2]=u;f[d>>2]=v;return}if(q&(k|0)<(s|0)){u=0;v=(k<<1)-s|0;f[c>>2]=u;f[d>>2]=v;return}if(o&(k|0)>(s|0)){u=t;v=(k<<1)-s|0;f[c>>2]=u;f[d>>2]=v;return}if(a&(k|0)>(t|0)){u=(k<<1)-t|0;v=s;f[c>>2]=u;f[d>>2]=v;return}if(!p){u=t;v=s;f[c>>2]=u;f[d>>2]=v;return}u=(k|0)<(t|0)?(k<<1)-t|0:t;v=0;f[c>>2]=u;f[d>>2]=v;return}function sf(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0;g=u;u=u+32|0;h=g+12|0;i=g;f[a>>2]=f[d>>2];d=a+4|0;f[d>>2]=(f[c>>2]|0)-(f[b>>2]|0);j=e+16|0;k=j;l=f[k+4>>2]|0;if(!((l|0)>0|(l|0)==0&(f[k>>2]|0)>>>0>0)?(k=e+4|0,f[i>>2]=f[k>>2],f[h>>2]=f[i>>2],Me(e,h,a,a+4|0)|0,l=j,j=f[l+4>>2]|0,!((j|0)>0|(j|0)==0&(f[l>>2]|0)>>>0>0)):0){f[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=0;c=u;u=u+32|0;d=c;e=a+8|0;g=f[e>>2]|0;h=a+4|0;i=f[h>>2]|0;j=i;if(g-i>>2>>>0>=b>>>0){sj(i|0,0,b<<2|0)|0;f[h>>2]=i+(b<<2);u=c;return}k=f[a>>2]|0;l=i-k>>2;m=l+b|0;n=k;if(m>>>0>1073741823)aq(a);o=g-k|0;p=o>>1;q=o>>2>>>0<536870911?(p>>>0>>0?m:p):1073741823;f[d+12>>2]=0;f[d+16>>2]=a+8;do if(q)if(q>>>0>1073741823){p=ra(8)|0;Oo(p,16035);f[p>>2]=7256;va(p|0,1112,110)}else{r=ln(q<<2)|0;break}else r=0;while(0);f[d>>2]=r;p=r+(l<<2)|0;l=d+8|0;m=d+4|0;f[m>>2]=p;o=r+(q<<2)|0;q=d+12|0;f[q>>2]=o;r=p+(b<<2)|0;sj(p|0,0,b<<2|0)|0;f[l>>2]=r;if((j|0)==(n|0)){s=p;t=q;v=l;w=k;x=r;y=i;z=o;A=g}else{g=j;j=p;do{g=g+-4|0;p=f[g>>2]|0;f[g>>2]=0;f[j+-4>>2]=p;j=(f[m>>2]|0)+-4|0;f[m>>2]=j}while((g|0)!=(n|0));s=j;t=q;v=l;w=f[a>>2]|0;x=f[l>>2]|0;y=f[h>>2]|0;z=f[q>>2]|0;A=f[e>>2]|0}f[a>>2]=s;f[m>>2]=w;f[h>>2]=x;f[v>>2]=y;f[e>>2]=z;f[t>>2]=A;f[d>>2]=w;ki(d);u=c;return}function vf(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0;d=f[a+8>>2]|0;e=a+76|0;g=f[e>>2]|0;h=f[g+80>>2]|0;b[c+84>>0]=0;i=c+68|0;j=c+72|0;k=f[j>>2]|0;l=f[i>>2]|0;m=k-l>>2;n=l;l=k;if(h>>>0<=m>>>0)if(h>>>0>>0?(k=n+(h<<2)|0,(k|0)!=(l|0)):0){f[j>>2]=l+(~((l+-4-k|0)>>>2)<<2);o=g;p=h}else{o=g;p=h}else{Ch(i,h-m|0,3600);m=f[e>>2]|0;o=m;p=f[m+80>>2]|0}m=(f[o+100>>2]|0)-(f[o+96>>2]|0)|0;e=(m|0)/12|0;if(!m){q=1;return q|0}m=a+80|0;a=c+68|0;c=f[o+96>>2]|0;o=0;while(1){h=o*3|0;if((h|0)==-1)r=-1;else r=f[(f[d>>2]|0)+(h<<2)>>2]|0;i=f[(f[m>>2]|0)+12>>2]|0;g=f[i+(r<<2)>>2]|0;if(g>>>0>=p>>>0){q=0;s=12;break}k=f[a>>2]|0;f[k+(f[c+(o*12|0)>>2]<<2)>>2]=g;g=h+1|0;if((g|0)==-1)t=-1;else t=f[(f[d>>2]|0)+(g<<2)>>2]|0;g=f[i+(t<<2)>>2]|0;if(g>>>0>=p>>>0){q=0;s=12;break}f[k+(f[c+(o*12|0)+4>>2]<<2)>>2]=g;g=h+2|0;if((g|0)==-1)u=-1;else u=f[(f[d>>2]|0)+(g<<2)>>2]|0;g=f[i+(u<<2)>>2]|0;if(g>>>0>=p>>>0){q=0;s=12;break}f[k+(f[c+(o*12|0)+8>>2]<<2)>>2]=g;o=o+1|0;if(o>>>0>=e>>>0){q=1;s=12;break}}if((s|0)==12)return q|0;return 0}function wf(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0;d=f[a+8>>2]|0;e=a+112|0;g=f[e>>2]|0;h=f[g+80>>2]|0;b[c+84>>0]=0;i=c+68|0;j=c+72|0;k=f[j>>2]|0;l=f[i>>2]|0;m=k-l>>2;n=l;l=k;if(h>>>0<=m>>>0)if(h>>>0>>0?(k=n+(h<<2)|0,(k|0)!=(l|0)):0){f[j>>2]=l+(~((l+-4-k|0)>>>2)<<2);o=g;p=h}else{o=g;p=h}else{Ch(i,h-m|0,3600);m=f[e>>2]|0;o=m;p=f[m+80>>2]|0}m=(f[o+100>>2]|0)-(f[o+96>>2]|0)|0;e=(m|0)/12|0;if(!m){q=1;return q|0}m=a+116|0;a=c+68|0;c=f[o+96>>2]|0;o=0;while(1){h=o*3|0;if((h|0)==-1)r=-1;else r=f[(f[d>>2]|0)+(h<<2)>>2]|0;i=f[(f[m>>2]|0)+12>>2]|0;g=f[i+(r<<2)>>2]|0;if(g>>>0>=p>>>0){q=0;s=12;break}k=f[a>>2]|0;f[k+(f[c+(o*12|0)>>2]<<2)>>2]=g;g=h+1|0;if((g|0)==-1)t=-1;else t=f[(f[d>>2]|0)+(g<<2)>>2]|0;g=f[i+(t<<2)>>2]|0;if(g>>>0>=p>>>0){q=0;s=12;break}f[k+(f[c+(o*12|0)+4>>2]<<2)>>2]=g;g=h+2|0;if((g|0)==-1)u=-1;else u=f[(f[d>>2]|0)+(g<<2)>>2]|0;g=f[i+(u<<2)>>2]|0;if(g>>>0>=p>>>0){q=0;s=12;break}f[k+(f[c+(o*12|0)+8>>2]<<2)>>2]=g;o=o+1|0;if(o>>>0>=e>>>0){q=1;s=12;break}}if((s|0)==12)return q|0;return 0}function xf(a,c,d,e,g){a=a|0;c=c|0;d=d|0;e=e|0;g=g|0;var h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0;d=u;u=u+16|0;h=d;i=f[a+124>>2]|0;if(!i){u=d;return}j=i+-1|0;k=(j&i|0)==0;if(!k)if(i>>>0>g>>>0)l=g;else l=(g>>>0)%(i>>>0)|0;else l=j&g;m=f[(f[a+120>>2]|0)+(l<<2)>>2]|0;if(!m){u=d;return}n=f[m>>2]|0;if(!n){u=d;return}a:do if(k){m=n;while(1){o=f[m+4>>2]|0;p=(o|0)==(g|0);if(!(p|(o&j|0)==(l|0))){q=24;break}if(p?(f[m+8>>2]|0)==(g|0):0){r=m;break a}m=f[m>>2]|0;if(!m){q=24;break}}if((q|0)==24){u=d;return}}else{m=n;while(1){p=f[m+4>>2]|0;if((p|0)==(g|0)){if((f[m+8>>2]|0)==(g|0)){r=m;break a}}else{if(p>>>0>>0)s=p;else s=(p>>>0)%(i>>>0)|0;if((s|0)!=(l|0)){q=24;break}}m=f[m>>2]|0;if(!m){q=24;break}}if((q|0)==24){u=d;return}}while(0);q=f[r+12>>2]|0;if((q|0)==-1){u=d;return}f[h>>2]=q;f[h+4>>2]=c;b[h+8>>0]=e&1;e=a+112|0;c=f[e>>2]|0;if((c|0)==(f[a+116>>2]|0))yi(a+108|0,h);else{f[c>>2]=f[h>>2];f[c+4>>2]=f[h+4>>2];f[c+8>>2]=f[h+8>>2];f[e>>2]=(f[e>>2]|0)+12}u=d;return}function yf(a,b){a=a|0;b=b|0;var c=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0;c=d[b>>1]|0;e=d[b+2>>1]|0;g=d[b+4>>1]|0;h=d[b+6>>1]|0;b=((((c^318)&65535)+239^e&65535)+239^g&65535)+239^h&65535;i=f[a+4>>2]|0;if(!i){j=0;return j|0}k=i+-1|0;l=(k&i|0)==0;if(!l)if(b>>>0>>0)m=b;else m=(b>>>0)%(i>>>0)|0;else m=b&k;n=f[(f[a>>2]|0)+(m<<2)>>2]|0;if(!n){j=0;return j|0}a=f[n>>2]|0;if(!a){j=0;return j|0}if(l){l=a;while(1){n=f[l+4>>2]|0;o=(n|0)==(b|0);if(!(o|(n&k|0)==(m|0))){j=0;p=25;break}if((((o?(o=l+8|0,(d[o>>1]|0)==c<<16>>16):0)?(d[o+2>>1]|0)==e<<16>>16:0)?(d[l+12>>1]|0)==g<<16>>16:0)?(d[o+6>>1]|0)==h<<16>>16:0){j=l;p=25;break}l=f[l>>2]|0;if(!l){j=0;p=25;break}}if((p|0)==25)return j|0}else q=a;while(1){a=f[q+4>>2]|0;if((a|0)==(b|0)){l=q+8|0;if((((d[l>>1]|0)==c<<16>>16?(d[l+2>>1]|0)==e<<16>>16:0)?(d[q+12>>1]|0)==g<<16>>16:0)?(d[l+6>>1]|0)==h<<16>>16:0){j=q;p=25;break}}else{if(a>>>0>>0)r=a;else r=(a>>>0)%(i>>>0)|0;if((r|0)!=(m|0)){j=0;p=25;break}}q=f[q>>2]|0;if(!q){j=0;p=25;break}}if((p|0)==25)return j|0;return 0}function zf(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0;g=u;u=u+32|0;h=g+12|0;i=g;f[a>>2]=f[d>>2];d=a+4|0;f[d>>2]=(f[c>>2]|0)-(f[b>>2]|0);j=e+16|0;k=j;l=f[k+4>>2]|0;if(!((l|0)>0|(l|0)==0&(f[k>>2]|0)>>>0>0)?(k=e+4|0,f[i>>2]=f[k>>2],f[h>>2]=f[i>>2],Me(e,h,a,a+4|0)|0,l=j,j=f[l+4>>2]|0,!((j|0)>0|(j|0)==0&(f[l>>2]|0)>>>0>0)):0){f[i>>2]=f[k>>2];f[h>>2]=f[i>>2];Me(e,h,d,d+4|0)|0;m=i}else m=i;if(!(f[d>>2]|0)){u=g;return 1}d=a+12|0;Mm(d);m=a+32|0;Mm(m);k=a+52|0;Mm(k);l=a+72|0;Mm(l);f[i>>2]=f[b>>2];f[i+4>>2]=f[b+4>>2];f[i+8>>2]=f[b+8>>2];f[h>>2]=f[c>>2];f[h+4>>2]=f[c+4>>2];f[h+8>>2]=f[c+8>>2];hb(a,i,h);Bg(d,e);Bg(m,e);Bg(k,e);Bg(l,e);u=g;return 1}function Af(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0;g=u;u=u+32|0;h=g+12|0;i=g;f[a>>2]=f[d>>2];d=a+4|0;f[d>>2]=(f[c>>2]|0)-(f[b>>2]|0);j=e+16|0;k=j;l=f[k+4>>2]|0;if(!((l|0)>0|(l|0)==0&(f[k>>2]|0)>>>0>0)?(k=e+4|0,f[i>>2]=f[k>>2],f[h>>2]=f[i>>2],Me(e,h,a,a+4|0)|0,l=j,j=f[l+4>>2]|0,!((j|0)>0|(j|0)==0&(f[l>>2]|0)>>>0>0)):0){f[i>>2]=f[k>>2];f[h>>2]=f[i>>2];Me(e,h,d,d+4|0)|0;m=i}else m=i;if(!(f[d>>2]|0)){u=g;return 1}d=a+12|0;tk(d);m=a+44|0;Mm(m);k=a+64|0;Mm(k);l=a+84|0;Mm(l);f[i>>2]=f[b>>2];f[i+4>>2]=f[b+4>>2];f[i+8>>2]=f[b+8>>2];f[h>>2]=f[c>>2];f[h+4>>2]=f[c+4>>2];f[h+8>>2]=f[c+8>>2];lb(a,i,h);ld(d,e);Bg(m,e);Bg(k,e);Bg(l,e);u=g;return 1}function Bf(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0;a=u;u=u+16|0;e=a+4|0;g=a;h=a+8|0;i=d+11|0;j=b[i>>0]|0;k=j<<24>>24<0;if(k){l=f[d+4>>2]|0;if(l>>>0>255){m=0;u=a;return m|0}else n=l}else n=j&255;if(!n){b[h>>0]=0;n=c+16|0;l=f[n+4>>2]|0;if(!((l|0)>0|(l|0)==0&(f[n>>2]|0)>>>0>0)){f[g>>2]=f[c+4>>2];f[e>>2]=f[g>>2];Me(c,e,h,h+1|0)|0}m=1;u=a;return m|0}n=d+4|0;l=f[n>>2]|0;b[h>>0]=k?l:j&255;k=c+16|0;o=k;p=f[o>>2]|0;q=f[o+4>>2]|0;if((q|0)>0|(q|0)==0&p>>>0>0){r=j;s=q;t=p;v=l}else{f[g>>2]=f[c+4>>2];f[e>>2]=f[g>>2];Me(c,e,h,h+1|0)|0;h=k;r=b[i>>0]|0;s=f[h+4>>2]|0;t=f[h>>2]|0;v=f[n>>2]|0}n=r<<24>>24<0;h=n?f[d>>2]|0:d;if(!((s|0)>0|(s|0)==0&t>>>0>0)){f[g>>2]=f[c+4>>2];f[e>>2]=f[g>>2];Me(c,e,h,h+(n?v:r&255)|0)|0}m=1;u=a;return m|0}function Cf(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;c=a+4|0;d=f[a>>2]|0;e=((f[c>>2]|0)-d|0)/24|0;g=e+1|0;if(g>>>0>178956970)aq(a);h=a+8|0;i=((f[h>>2]|0)-d|0)/24|0;d=i<<1;j=i>>>0<89478485?(d>>>0>>0?g:d):178956970;do if(j)if(j>>>0>178956970){d=ra(8)|0;Oo(d,16035);f[d>>2]=7256;va(d|0,1112,110)}else{k=ln(j*24|0)|0;break}else k=0;while(0);d=k+(e*24|0)|0;g=d;i=k+(j*24|0)|0;f[d>>2]=1196;f[k+(e*24|0)+4>>2]=f[b+4>>2];fk(k+(e*24|0)+8|0,b+8|0);f[k+(e*24|0)+20>>2]=f[b+20>>2];b=d+24|0;e=f[a>>2]|0;k=f[c>>2]|0;if((k|0)==(e|0)){l=g;m=e;n=e}else{j=k;k=g;g=d;do{f[g+-24>>2]=1196;f[g+-20>>2]=f[j+-20>>2];d=g+-16|0;o=j+-16|0;f[d>>2]=0;p=g+-12|0;f[p>>2]=0;f[g+-8>>2]=0;f[d>>2]=f[o>>2];d=j+-12|0;f[p>>2]=f[d>>2];p=j+-8|0;f[g+-8>>2]=f[p>>2];f[p>>2]=0;f[d>>2]=0;f[o>>2]=0;f[g+-4>>2]=f[j+-4>>2];j=j+-24|0;g=k+-24|0;k=g}while((j|0)!=(e|0));l=k;m=f[a>>2]|0;n=f[c>>2]|0}f[a>>2]=l;f[c>>2]=b;f[h>>2]=i;i=m;if((n|0)!=(i|0)){h=n;do{h=h+-24|0;Va[f[f[h>>2]>>2]&127](h)}while((h|0)!=(i|0))}if(!m)return;Oq(m);return}function Df(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;c=u;u=u+32|0;d=c+24|0;e=c+16|0;g=c+8|0;h=c;f[a>>2]=3588;f[a+4>>2]=f[b+4>>2];i=a+8|0;j=b+8|0;f[i>>2]=0;k=a+12|0;f[k>>2]=0;l=a+16|0;f[l>>2]=0;m=b+12|0;n=f[m>>2]|0;do if(n|0)if((n|0)<0)aq(i);else{o=((n+-1|0)>>>5)+1|0;p=ln(o<<2)|0;f[i>>2]=p;f[k>>2]=0;f[l>>2]=o;o=f[j>>2]|0;f[g>>2]=o;f[g+4>>2]=0;p=f[m>>2]|0;f[h>>2]=o+(p>>>5<<2);f[h+4>>2]=p&31;f[e>>2]=f[g>>2];f[e+4>>2]=f[g+4>>2];f[d>>2]=f[h>>2];f[d+4>>2]=f[h+4>>2];Tf(i,e,d);break}while(0);i=a+20|0;f[i>>2]=0;m=a+24|0;f[m>>2]=0;j=a+28|0;f[j>>2]=0;a=b+24|0;l=f[a>>2]|0;if(!l){u=c;return}if((l|0)<0)aq(i);k=((l+-1|0)>>>5)+1|0;l=ln(k<<2)|0;f[i>>2]=l;f[m>>2]=0;f[j>>2]=k;k=f[b+20>>2]|0;f[g>>2]=k;f[g+4>>2]=0;b=f[a>>2]|0;f[h>>2]=k+(b>>>5<<2);f[h+4>>2]=b&31;f[e>>2]=f[g>>2];f[e+4>>2]=f[g+4>>2];f[d>>2]=f[h>>2];f[d+4>>2]=f[h+4>>2];Tf(i,e,d);u=c;return}function Ef(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0;d=b[c>>0]|0;e=b[c+1>>0]|0;g=b[c+2>>0]|0;h=b[c+3>>0]|0;c=(((d&255^318)+239^e&255)+239^g&255)+239^h&255;i=f[a+4>>2]|0;if(!i){j=0;return j|0}k=i+-1|0;l=(k&i|0)==0;if(!l)if(c>>>0>>0)m=c;else m=(c>>>0)%(i>>>0)|0;else m=c&k;n=f[(f[a>>2]|0)+(m<<2)>>2]|0;if(!n){j=0;return j|0}a=f[n>>2]|0;if(!a){j=0;return j|0}if(l){l=a;while(1){n=f[l+4>>2]|0;o=(n|0)==(c|0);if(!(o|(n&k|0)==(m|0))){j=0;p=25;break}if((((o?(o=l+8|0,(b[o>>0]|0)==d<<24>>24):0)?(b[o+1>>0]|0)==e<<24>>24:0)?(b[o+2>>0]|0)==g<<24>>24:0)?(b[o+3>>0]|0)==h<<24>>24:0){j=l;p=25;break}l=f[l>>2]|0;if(!l){j=0;p=25;break}}if((p|0)==25)return j|0}else q=a;while(1){a=f[q+4>>2]|0;if((a|0)==(c|0)){l=q+8|0;if((((b[l>>0]|0)==d<<24>>24?(b[l+1>>0]|0)==e<<24>>24:0)?(b[l+2>>0]|0)==g<<24>>24:0)?(b[l+3>>0]|0)==h<<24>>24:0){j=q;p=25;break}}else{if(a>>>0>>0)r=a;else r=(a>>>0)%(i>>>0)|0;if((r|0)!=(m|0)){j=0;p=25;break}}q=f[q>>2]|0;if(!q){j=0;p=25;break}}if((p|0)==25)return j|0;return 0}function Ff(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;c=u;u=u+32|0;d=c+24|0;e=c+16|0;g=c+8|0;h=c;f[a>>2]=3636;f[a+4>>2]=f[b+4>>2];i=a+8|0;j=b+8|0;f[i>>2]=0;k=a+12|0;f[k>>2]=0;l=a+16|0;f[l>>2]=0;m=b+12|0;n=f[m>>2]|0;do if(n|0)if((n|0)<0)aq(i);else{o=((n+-1|0)>>>5)+1|0;p=ln(o<<2)|0;f[i>>2]=p;f[k>>2]=0;f[l>>2]=o;o=f[j>>2]|0;f[g>>2]=o;f[g+4>>2]=0;p=f[m>>2]|0;f[h>>2]=o+(p>>>5<<2);f[h+4>>2]=p&31;f[e>>2]=f[g>>2];f[e+4>>2]=f[g+4>>2];f[d>>2]=f[h>>2];f[d+4>>2]=f[h+4>>2];Tf(i,e,d);break}while(0);i=a+20|0;f[i>>2]=0;m=a+24|0;f[m>>2]=0;j=a+28|0;f[j>>2]=0;a=b+24|0;l=f[a>>2]|0;if(!l){u=c;return}if((l|0)<0)aq(i);k=((l+-1|0)>>>5)+1|0;l=ln(k<<2)|0;f[i>>2]=l;f[m>>2]=0;f[j>>2]=k;k=f[b+20>>2]|0;f[g>>2]=k;f[g+4>>2]=0;b=f[a>>2]|0;f[h>>2]=k+(b>>>5<<2);f[h+4>>2]=b&31;f[e>>2]=f[g>>2];f[e+4>>2]=f[g+4>>2];f[d>>2]=f[h>>2];f[d+4>>2]=f[h+4>>2];Tf(i,e,d);u=c;return}function Gf(a,b,c,d,e,g){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;g=g|0;var h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0;d=u;u=u+32|0;h=d+24|0;i=d+16|0;j=d;k=d+8|0;l=a+40|0;f[a+44>>2]=g;g=a+36|0;m=f[g>>2]|0;n=f[m+4>>2]|0;o=f[m>>2]|0;p=n-o|0;if((p|0)<=0){u=d;return 1}q=(p>>>2)+-1|0;p=a+8|0;r=a+48|0;s=a+52|0;a=i+4|0;t=j+4|0;v=h+4|0;if(n-o>>2>>>0>q>>>0){w=q;x=o}else{y=m;aq(y)}while(1){f[k>>2]=f[x+(w<<2)>>2];f[h>>2]=f[k>>2];ub(l,h,b,w);m=X(w,e)|0;o=b+(m<<2)|0;q=c+(m<<2)|0;m=f[o+4>>2]|0;n=f[r>>2]|0;z=f[s>>2]|0;f[i>>2]=f[o>>2];f[a>>2]=m;f[j>>2]=n;f[t>>2]=z;Od(h,p,i,j);f[q>>2]=f[h>>2];f[q+4>>2]=f[v>>2];w=w+-1|0;if((w|0)<=-1){A=3;break}q=f[g>>2]|0;x=f[q>>2]|0;if((f[q+4>>2]|0)-x>>2>>>0<=w>>>0){y=q;A=4;break}}if((A|0)==3){u=d;return 1}else if((A|0)==4)aq(y);return 0}function Hf(a,b,c,d,e,g){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;g=g|0;var h=0,i=0,j=0,k=0,l=0,m=0,n=0;h=u;u=u+32|0;i=h;j=h+16|0;k=f[(f[(f[b+4>>2]|0)+8>>2]|0)+(d<<2)>>2]|0;do if((c+-1|0)>>>0<6&(Qa[f[(f[b>>2]|0)+8>>2]&127](b)|0)==1){l=Qa[f[(f[b>>2]|0)+48>>2]&127](b)|0;m=Ra[f[(f[b>>2]|0)+56>>2]&127](b,d)|0;if((l|0)==0|(m|0)==0){f[a>>2]=0;u=h;return}n=Ra[f[(f[b>>2]|0)+52>>2]&127](b,d)|0;if(!n){f[i>>2]=f[b+52>>2];f[i+4>>2]=l;f[i+12>>2]=m;f[i+8>>2]=m+12;Cd(a,j,c,k,e,i,g);if(!(f[a>>2]|0)){f[a>>2]=0;break}u=h;return}else{f[i>>2]=f[b+52>>2];f[i+4>>2]=n;f[i+12>>2]=m;f[i+8>>2]=m+12;Ad(a,j,c,k,e,i,g);if(!(f[a>>2]|0)){f[a>>2]=0;break}u=h;return}}while(0);f[a>>2]=0;u=h;return}function If(a,b,c,d,e,g){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;g=g|0;var h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0;d=u;u=u+32|0;h=d+24|0;i=d+16|0;j=d;k=d+8|0;l=a+40|0;f[a+44>>2]=g;g=a+36|0;m=f[g>>2]|0;n=f[m+4>>2]|0;o=f[m>>2]|0;p=n-o|0;if((p|0)<=0){u=d;return 1}q=(p>>>2)+-1|0;p=a+8|0;r=a+48|0;s=a+52|0;a=i+4|0;t=j+4|0;v=h+4|0;if(n-o>>2>>>0>q>>>0){w=q;x=o}else{y=m;aq(y)}while(1){f[k>>2]=f[x+(w<<2)>>2];f[h>>2]=f[k>>2];tb(l,h,b,w);m=X(w,e)|0;o=b+(m<<2)|0;q=c+(m<<2)|0;m=f[o+4>>2]|0;n=f[r>>2]|0;z=f[s>>2]|0;f[i>>2]=f[o>>2];f[a>>2]=m;f[j>>2]=n;f[t>>2]=z;Od(h,p,i,j);f[q>>2]=f[h>>2];f[q+4>>2]=f[v>>2];w=w+-1|0;if((w|0)<=-1){A=3;break}q=f[g>>2]|0;x=f[q>>2]|0;if((f[q+4>>2]|0)-x>>2>>>0<=w>>>0){y=q;A=4;break}}if((A|0)==3){u=d;return 1}else if((A|0)==4)aq(y);return 0}function Jf(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;d=f[b>>2]|0;b=f[c>>2]|0;e=b-d>>2;g=a+8|0;h=f[g>>2]|0;i=f[a>>2]|0;j=i;k=b;if(e>>>0<=h-i>>2>>>0){l=a+4|0;m=(f[l>>2]|0)-i>>2;n=e>>>0>m>>>0;o=n?d+(m<<2)|0:b;b=o-d|0;m=b>>2;if(m|0)im(i|0,d|0,b|0)|0;b=j+(m<<2)|0;if(!n){n=f[l>>2]|0;if((n|0)==(b|0))return;f[l>>2]=n+(~((n+-4-b|0)>>>2)<<2);return}b=f[c>>2]|0;c=o;if((b|0)==(c|0))return;n=f[l>>2]|0;m=b+-4-o|0;o=c;c=n;while(1){f[c>>2]=f[o>>2];o=o+4|0;if((o|0)==(b|0))break;else c=c+4|0}f[l>>2]=n+((m>>>2)+1<<2);return}m=i;if(!i)p=h;else{h=a+4|0;n=f[h>>2]|0;if((n|0)!=(j|0))f[h>>2]=n+(~((n+-4-i|0)>>>2)<<2);Oq(m);f[g>>2]=0;f[h>>2]=0;f[a>>2]=0;p=0}if(e>>>0>1073741823)aq(a);h=p>>1;m=p>>2>>>0<536870911?(h>>>0>>0?e:h):1073741823;if(m>>>0>1073741823)aq(a);h=ln(m<<2)|0;e=a+4|0;f[e>>2]=h;f[a>>2]=h;f[g>>2]=h+(m<<2);m=d;if((k|0)==(m|0))return;g=k+-4-d|0;d=m;m=h;while(1){f[m>>2]=f[d>>2];d=d+4|0;if((d|0)==(k|0))break;else m=m+4|0}f[e>>2]=h+((g>>>2)+1<<2);return}function Kf(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0;c=a+8|0;d=f[c>>2]|0;e=a+4|0;g=f[e>>2]|0;h=g;if(((d-g|0)/12|0)>>>0>=b>>>0){sj(g|0,0,b*12|0)|0;f[e>>2]=h+(b*12|0);return}i=f[a>>2]|0;j=(g-i|0)/12|0;g=j+b|0;k=i;if(g>>>0>357913941)aq(a);l=(d-i|0)/12|0;d=l<<1;m=l>>>0<178956970?(d>>>0>>0?g:d):357913941;do if(m)if(m>>>0>357913941){d=ra(8)|0;Oo(d,16035);f[d>>2]=7256;va(d|0,1112,110)}else{n=ln(m*12|0)|0;break}else n=0;while(0);d=n+(j*12|0)|0;j=d;g=n+(m*12|0)|0;sj(d|0,0,b*12|0)|0;m=d+(b*12|0)|0;if((h|0)==(k|0)){o=j;p=i;q=h}else{i=h;h=j;j=d;do{d=j+-12|0;b=i;i=i+-12|0;f[d>>2]=0;n=j+-8|0;f[n>>2]=0;f[j+-4>>2]=0;f[d>>2]=f[i>>2];d=b+-8|0;f[n>>2]=f[d>>2];n=b+-4|0;f[j+-4>>2]=f[n>>2];f[n>>2]=0;f[d>>2]=0;f[i>>2]=0;j=h+-12|0;h=j}while((i|0)!=(k|0));o=h;p=f[a>>2]|0;q=f[e>>2]|0}f[a>>2]=o;f[e>>2]=m;f[c>>2]=g;g=p;if((q|0)!=(g|0)){c=q;do{q=c;c=c+-12|0;m=f[c>>2]|0;if(m|0){e=q+-8|0;q=f[e>>2]|0;if((q|0)!=(m|0))f[e>>2]=q+(~((q+-4-m|0)>>>2)<<2);Oq(m)}}while((c|0)!=(g|0))}if(!p)return;Oq(p);return}function Lf(a){a=a|0;var b=0,c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0;b=u;u=u+16|0;c=b+4|0;d=b;e=a+8|0;g=f[e>>2]|0;gk(f[a+4>>2]|0,(f[g+28>>2]|0)-(f[g+24>>2]|0)>>2);g=a+100|0;h=f[e>>2]|0;i=(f[h+28>>2]|0)-(f[h+24>>2]|0)>>2;f[c>>2]=0;h=a+104|0;j=f[h>>2]|0;k=f[g>>2]|0;l=j-k>>2;m=k;k=j;if(i>>>0<=l>>>0){if(i>>>0>>0?(j=m+(i<<2)|0,(j|0)!=(k|0)):0)f[h>>2]=k+(~((k+-4-j|0)>>>2)<<2)}else Ch(g,i-l|0,c);l=a+120|0;a=f[l>>2]|0;if(!a){i=f[e>>2]|0;g=(f[i+4>>2]|0)-(f[i>>2]|0)>>2;i=(g>>>0)/3|0;if(g>>>0<=2){u=b;return 1}g=0;do{f[d>>2]=g*3;f[c>>2]=f[d>>2];wb(e,c);g=g+1|0}while((g|0)<(i|0));u=b;return 1}else{i=f[a>>2]|0;if((f[a+4>>2]|0)==(i|0)){u=b;return 1}a=0;g=i;do{f[d>>2]=f[g+(a<<2)>>2];f[c>>2]=f[d>>2];wb(e,c);a=a+1|0;i=f[l>>2]|0;g=f[i>>2]|0}while(a>>>0<(f[i+4>>2]|0)-g>>2>>>0);u=b;return 1}return 0}function Mf(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0;d=u;u=u+32|0;e=d;g=a+40|0;h=(f[c>>2]|0)+(f[g>>2]|0)|0;i=a+24|0;j=f[a+32>>2]|0;k=j+-4194304|0;do if(k>>>0>=64){if(k>>>0<16384){l=a+28|0;m=(f[i>>2]|0)+(f[l>>2]|0)|0;n=j+-4177920|0;b[m>>0]=n;b[m+1>>0]=n>>>8;o=(f[l>>2]|0)+2|0;break}if(k>>>0<4194304){l=a+28|0;n=(f[i>>2]|0)+(f[l>>2]|0)|0;m=j+4194304|0;b[n>>0]=m;b[n+1>>0]=m>>>8;b[n+2>>0]=m>>>16;o=(f[l>>2]|0)+3|0;break}if(k>>>0<1073741824){l=a+28|0;m=(f[i>>2]|0)+(f[l>>2]|0)|0;n=j+-1077936128|0;b[m>>0]=n;b[m+1>>0]=n>>>8;b[m+2>>0]=n>>>16;b[m+3>>0]=n>>>24;o=(f[l>>2]|0)+4|0;break}else{o=f[a+28>>2]|0;break}}else{l=a+28|0;b[(f[i>>2]|0)+(f[l>>2]|0)>>0]=k;o=(f[l>>2]|0)+1|0}while(0);k=((o|0)<0)<<31>>31;Gn(e);yh(o,k,e)|0;i=e+4|0;a=(f[i>>2]|0)-(f[e>>2]|0)|0;im(h+a|0,h|0,o|0)|0;kh(h|0,f[e>>2]|0,a|0)|0;h=g;g=f[h>>2]|0;j=f[h+4>>2]|0;h=Vn(a|0,0,o|0,k|0)|0;k=Vn(h|0,I|0,g|0,j|0)|0;Cl(c,k,I);k=e+12|0;c=f[k>>2]|0;f[k>>2]=0;if(c|0)Oq(c);c=f[e>>2]|0;if(!c){u=d;return}if((f[i>>2]|0)!=(c|0))f[i>>2]=c;Oq(c);u=d;return}function Nf(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0;d=u;u=u+32|0;e=d;g=a+40|0;h=(f[c>>2]|0)+(f[g>>2]|0)|0;i=a+24|0;j=f[a+32>>2]|0;k=j+-2097152|0;do if(k>>>0>=64){if(k>>>0<16384){l=a+28|0;m=(f[i>>2]|0)+(f[l>>2]|0)|0;n=j+-2080768|0;b[m>>0]=n;b[m+1>>0]=n>>>8;o=(f[l>>2]|0)+2|0;break}if(k>>>0<4194304){l=a+28|0;n=(f[i>>2]|0)+(f[l>>2]|0)|0;m=j+6291456|0;b[n>>0]=m;b[n+1>>0]=m>>>8;b[n+2>>0]=m>>>16;o=(f[l>>2]|0)+3|0;break}if(k>>>0<1073741824){l=a+28|0;m=(f[i>>2]|0)+(f[l>>2]|0)|0;n=j+-1075838976|0;b[m>>0]=n;b[m+1>>0]=n>>>8;b[m+2>>0]=n>>>16;b[m+3>>0]=n>>>24;o=(f[l>>2]|0)+4|0;break}else{o=f[a+28>>2]|0;break}}else{l=a+28|0;b[(f[i>>2]|0)+(f[l>>2]|0)>>0]=k;o=(f[l>>2]|0)+1|0}while(0);k=((o|0)<0)<<31>>31;Gn(e);yh(o,k,e)|0;i=e+4|0;a=(f[i>>2]|0)-(f[e>>2]|0)|0;im(h+a|0,h|0,o|0)|0;kh(h|0,f[e>>2]|0,a|0)|0;h=g;g=f[h>>2]|0;j=f[h+4>>2]|0;h=Vn(a|0,0,o|0,k|0)|0;k=Vn(h|0,I|0,g|0,j|0)|0;Cl(c,k,I);k=e+12|0;c=f[k>>2]|0;f[k>>2]=0;if(c|0)Oq(c);c=f[e>>2]|0;if(!c){u=d;return}if((f[i>>2]|0)!=(c|0))f[i>>2]=c;Oq(c);u=d;return}function Of(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0;d=u;u=u+32|0;e=d;g=a+40|0;h=(f[c>>2]|0)+(f[g>>2]|0)|0;i=a+24|0;j=f[a+32>>2]|0;k=j+-1048576|0;do if(k>>>0>=64){if(k>>>0<16384){l=a+28|0;m=(f[i>>2]|0)+(f[l>>2]|0)|0;n=j+-1032192|0;b[m>>0]=n;b[m+1>>0]=n>>>8;o=(f[l>>2]|0)+2|0;break}if(k>>>0<4194304){l=a+28|0;n=(f[i>>2]|0)+(f[l>>2]|0)|0;m=j+7340032|0;b[n>>0]=m;b[n+1>>0]=m>>>8;b[n+2>>0]=m>>>16;o=(f[l>>2]|0)+3|0;break}if(k>>>0<1073741824){l=a+28|0;m=(f[i>>2]|0)+(f[l>>2]|0)|0;n=j+-1074790400|0;b[m>>0]=n;b[m+1>>0]=n>>>8;b[m+2>>0]=n>>>16;b[m+3>>0]=n>>>24;o=(f[l>>2]|0)+4|0;break}else{o=f[a+28>>2]|0;break}}else{l=a+28|0;b[(f[i>>2]|0)+(f[l>>2]|0)>>0]=k;o=(f[l>>2]|0)+1|0}while(0);k=((o|0)<0)<<31>>31;Gn(e);yh(o,k,e)|0;i=e+4|0;a=(f[i>>2]|0)-(f[e>>2]|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((f[e>>2]|0)!=(v|0))f[e>>2]=v;Oq(v)}Oq(j)}k=w;u=a;return k|0}function Qf(a,c,d,e,g,h,i){a=a|0;c=c|0;d=d|0;e=e|0;g=g|0;h=h|0;i=i|0;var j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0;a=u;u=u+96|0;j=a;if(!c){k=-1;u=a;return k|0}Tm(j);Jj(j,d,0,g&255,i,0,g<<2,0,0,0);i=jf(c,j,1,e)|0;d=f[(f[c+8>>2]|0)+(i<<2)>>2]|0;if(e|0){l=d+84|0;m=d+68|0;n=d+40|0;o=d+64|0;d=0;do{if(!(b[l>>0]|0))p=f[(f[m>>2]|0)+(d<<2)>>2]|0;else p=d;q=h+((X(d,g)|0)<<2)|0;r=n;s=f[r>>2]|0;t=un(s|0,f[r+4>>2]|0,p|0,0)|0;kh((f[f[o>>2]>>2]|0)+t|0,q|0,s|0)|0;d=d+1|0}while((d|0)!=(e|0))}d=c+80|0;c=f[d>>2]|0;if(c)if((c|0)==(e|0))v=10;else w=-1;else{f[d>>2]=e;v=10}if((v|0)==10)w=i;i=j+88|0;v=f[i>>2]|0;f[i>>2]=0;if(v|0){i=f[v+8>>2]|0;if(i|0){e=v+12|0;if((f[e>>2]|0)!=(i|0))f[e>>2]=i;Oq(i)}Oq(v)}v=f[j+68>>2]|0;if(v|0){i=j+72|0;e=f[i>>2]|0;if((e|0)!=(v|0))f[i>>2]=e+(~((e+-4-v|0)>>>2)<<2);Oq(v)}v=j+64|0;j=f[v>>2]|0;f[v>>2]=0;if(j|0){v=f[j>>2]|0;if(v|0){e=j+4|0;if((f[e>>2]|0)!=(v|0))f[e>>2]=v;Oq(v)}Oq(j)}k=w;u=a;return k|0}function Rf(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0;d=u;u=u+32|0;e=d;g=a+40|0;h=(f[c>>2]|0)+(f[g>>2]|0)|0;i=a+24|0;j=f[a+32>>2]|0;k=j+-262144|0;do if(k>>>0>=64){if(k>>>0<16384){l=a+28|0;m=(f[i>>2]|0)+(f[l>>2]|0)|0;n=j+-245760|0;b[m>>0]=n;b[m+1>>0]=n>>>8;o=(f[l>>2]|0)+2|0;break}if(k>>>0<4194304){l=a+28|0;n=(f[i>>2]|0)+(f[l>>2]|0)|0;m=j+8126464|0;b[n>>0]=m;b[n+1>>0]=m>>>8;b[n+2>>0]=m>>>16;o=(f[l>>2]|0)+3|0;break}if(k>>>0<1073741824){l=a+28|0;m=(f[i>>2]|0)+(f[l>>2]|0)|0;n=j+-1074003968|0;b[m>>0]=n;b[m+1>>0]=n>>>8;b[m+2>>0]=n>>>16;b[m+3>>0]=n>>>24;o=(f[l>>2]|0)+4|0;break}else{o=f[a+28>>2]|0;break}}else{l=a+28|0;b[(f[i>>2]|0)+(f[l>>2]|0)>>0]=k;o=(f[l>>2]|0)+1|0}while(0);k=((o|0)<0)<<31>>31;Gn(e);yh(o,k,e)|0;i=e+4|0;a=(f[i>>2]|0)-(f[e>>2]|0)|0;im(h+a|0,h|0,o|0)|0;kh(h|0,f[e>>2]|0,a|0)|0;h=g;g=f[h>>2]|0;j=f[h+4>>2]|0;h=Vn(a|0,0,o|0,k|0)|0;k=Vn(h|0,I|0,g|0,j|0)|0;Cl(c,k,I);k=e+12|0;c=f[k>>2]|0;f[k>>2]=0;if(c|0)Oq(c);c=f[e>>2]|0;if(!c){u=d;return}if((f[i>>2]|0)!=(c|0))f[i>>2]=c;Oq(c);u=d;return}function Sf(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0;d=u;u=u+32|0;e=d;g=a+40|0;h=(f[c>>2]|0)+(f[g>>2]|0)|0;i=a+24|0;j=f[a+32>>2]|0;k=j+-131072|0;do if(k>>>0>=64){if(k>>>0<16384){l=a+28|0;m=(f[i>>2]|0)+(f[l>>2]|0)|0;n=j+-114688|0;b[m>>0]=n;b[m+1>>0]=n>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i;f[q>>2]=c;f[q+4>>2]=p;f[j>>2]=m;f[j+4>>2]=a;f[g>>2]=f[h>>2];f[g+4>>2]=f[h+4>>2];f[e>>2]=f[i>>2];f[e+4>>2]=f[i+4>>2];we(k,g,e,j);u=d;return}j=p-o+n|0;n=b;if((j|0)>0){if(!o){r=j;s=0;t=l;v=b;w=n}else{b=32-o|0;p=(j|0)<(b|0)?j:b;e=-1>>>(b-p|0)&-1<>2]=f[l>>2]&~e|f[n>>2]&e;e=p+o|0;b=n+4|0;r=j-p|0;s=e&31;t=l+(e>>>5<<2)|0;v=b;w=b}b=(r|0)/32|0;im(t|0,v|0,b<<2|0)|0;v=r-(b<<5)|0;r=t+(b<<2)|0;t=r;if((v|0)>0){e=-1>>>(32-v|0);f[r>>2]=f[r>>2]&~e|f[w+(b<<2)>>2]&e;x=v;y=t}else{x=s;y=t}}else{x=o;y=m}f[k>>2]=y;f[k+4>>2]=x;u=d;return}function Uf(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0;d=u;u=u+32|0;e=d;g=a+40|0;h=(f[c>>2]|0)+(f[g>>2]|0)|0;i=a+24|0;j=f[a+32>>2]|0;k=j+-32768|0;do if(k>>>0>=64){if(k>>>0<16384){l=a+28|0;m=(f[i>>2]|0)+(f[l>>2]|0)|0;n=j+-16384|0;b[m>>0]=n;b[m+1>>0]=n>>>8;o=(f[l>>2]|0)+2|0;break}if(k>>>0<4194304){l=a+28|0;n=(f[i>>2]|0)+(f[l>>2]|0)|0;m=j+8355840|0;b[n>>0]=m;b[n+1>>0]=m>>>8;b[n+2>>0]=m>>>16;o=(f[l>>2]|0)+3|0;break}if(k>>>0<1073741824){l=a+28|0;m=(f[i>>2]|0)+(f[l>>2]|0)|0;n=j+-1073774592|0;b[m>>0]=n;b[m+1>>0]=n>>>8;b[m+2>>0]=n>>>16;b[m+3>>0]=n>>>24;o=(f[l>>2]|0)+4|0;break}else{o=f[a+28>>2]|0;break}}else{l=a+28|0;b[(f[i>>2]|0)+(f[l>>2]|0)>>0]=k;o=(f[l>>2]|0)+1|0}while(0);k=((o|0)<0)<<31>>31;Gn(e);yh(o,k,e)|0;i=e+4|0;a=(f[i>>2]|0)-(f[e>>2]|0)|0;im(h+a|0,h|0,o|0)|0;kh(h|0,f[e>>2]|0,a|0)|0;h=g;g=f[h>>2]|0;j=f[h+4>>2]|0;h=Vn(a|0,0,o|0,k|0)|0;k=Vn(h|0,I|0,g|0,j|0)|0;Cl(c,k,I);k=e+12|0;c=f[k>>2]|0;f[k>>2]=0;if(c|0)Oq(c);c=f[e>>2]|0;if(!c){u=d;return}if((f[i>>2]|0)!=(c|0))f[i>>2]=c;Oq(c);u=d;return}function Vf(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0;c=f[b>>2]|0;d=f[b+4>>2]|0;e=f[b+8>>2]|0;g=f[b+12>>2]|0;b=(((c^318)+239^d)+239^e)+239^g;h=f[a+4>>2]|0;if(!h){i=0;return i|0}j=h+-1|0;k=(j&h|0)==0;if(!k)if(b>>>0>>0)l=b;else l=(b>>>0)%(h>>>0)|0;else l=b&j;m=f[(f[a>>2]|0)+(l<<2)>>2]|0;if(!m){i=0;return i|0}a=f[m>>2]|0;if(!a){i=0;return i|0}if(k){k=a;while(1){m=f[k+4>>2]|0;n=(m|0)==(b|0);if(!(n|(m&j|0)==(l|0))){i=0;o=25;break}if((((n?(f[k+8>>2]|0)==(c|0):0)?(f[k+12>>2]|0)==(d|0):0)?(f[k+16>>2]|0)==(e|0):0)?(f[k+20>>2]|0)==(g|0):0){i=k;o=25;break}k=f[k>>2]|0;if(!k){i=0;o=25;break}}if((o|0)==25)return i|0}else p=a;while(1){a=f[p+4>>2]|0;if((a|0)==(b|0)){if((((f[p+8>>2]|0)==(c|0)?(f[p+12>>2]|0)==(d|0):0)?(f[p+16>>2]|0)==(e|0):0)?(f[p+20>>2]|0)==(g|0):0){i=p;o=25;break}}else{if(a>>>0>>0)q=a;else q=(a>>>0)%(h>>>0)|0;if((q|0)!=(l|0)){i=0;o=25;break}}p=f[p>>2]|0;if(!p){i=0;o=25;break}}if((o|0)==25)return i|0;return 0}function Wf(a,c,d,e,g,h,i){a=a|0;c=c|0;d=d|0;e=e|0;g=g|0;h=h|0;i=i|0;var j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0;a=u;u=u+96|0;j=a;if(!c){k=-1;u=a;return k|0}Tm(j);Jj(j,d,0,g&255,i,0,g,0,0,0);i=jf(c,j,1,e)|0;d=f[(f[c+8>>2]|0)+(i<<2)>>2]|0;if(e|0){l=d+84|0;m=d+68|0;n=d+40|0;o=d+64|0;d=0;do{if(!(b[l>>0]|0))p=f[(f[m>>2]|0)+(d<<2)>>2]|0;else p=d;q=h+(X(d,g)|0)|0;r=n;s=f[r>>2]|0;t=un(s|0,f[r+4>>2]|0,p|0,0)|0;kh((f[f[o>>2]>>2]|0)+t|0,q|0,s|0)|0;d=d+1|0}while((d|0)!=(e|0))}d=c+80|0;c=f[d>>2]|0;if(c)if((c|0)==(e|0))v=10;else w=-1;else{f[d>>2]=e;v=10}if((v|0)==10)w=i;i=j+88|0;v=f[i>>2]|0;f[i>>2]=0;if(v|0){i=f[v+8>>2]|0;if(i|0){e=v+12|0;if((f[e>>2]|0)!=(i|0))f[e>>2]=i;Oq(i)}Oq(v)}v=f[j+68>>2]|0;if(v|0){i=j+72|0;e=f[i>>2]|0;if((e|0)!=(v|0))f[i>>2]=e+(~((e+-4-v|0)>>>2)<<2);Oq(v)}v=j+64|0;j=f[v>>2]|0;f[v>>2]=0;if(j|0){v=f[j>>2]|0;if(v|0){e=j+4|0;if((f[e>>2]|0)!=(v|0))f[e>>2]=v;Oq(v)}Oq(j)}k=w;u=a;return k|0}function Xf(a,b,c,d,e,g){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;g=g|0;var h=0,i=0,j=0,k=0,l=0,m=0,n=0;h=u;u=u+32|0;i=h;j=h+16|0;k=f[(f[(f[b+4>>2]|0)+8>>2]|0)+(d<<2)>>2]|0;do if((c+-1|0)>>>0<6&(Qa[f[(f[b>>2]|0)+8>>2]&127](b)|0)==1){l=Qa[f[(f[b>>2]|0)+48>>2]&127](b)|0;m=Ra[f[(f[b>>2]|0)+56>>2]&127](b,d)|0;if((l|0)==0|(m|0)==0){f[a>>2]=0;u=h;return}n=Ra[f[(f[b>>2]|0)+52>>2]&127](b,d)|0;if(!n){f[i>>2]=f[b+52>>2];f[i+4>>2]=l;f[i+12>>2]=m;f[i+8>>2]=m+12;qd(a,j,c,k,e,i,g);if(!(f[a>>2]|0)){f[a>>2]=0;break}u=h;return}else{f[i>>2]=f[b+52>>2];f[i+4>>2]=n;f[i+12>>2]=m;f[i+8>>2]=m+12;pd(a,j,c,k,e,i,g);if(!(f[a>>2]|0)){f[a>>2]=0;break}u=h;return}}while(0);f[a>>2]=0;u=h;return}function Yf(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0;e=f[d>>2]|0;g=f[d+4>>2]|0;if((e|0)==(g|0)){h=0;i=a+12|0;j=a+8|0}else{d=f[c>>2]|0;c=a+8|0;k=a+12|0;a=0;l=e;while(1){e=f[l>>2]|0;m=f[d+(e<<2)>>2]|0;if(m>>>0>>0)n=a;else{o=f[c>>2]|0;p=(f[k>>2]|0)-o|0;q=o;if((p|0)>0){o=p>>>2;p=0;do{r=f[q+(p<<2)>>2]|0;s=f[r+68>>2]|0;if(!(b[r+84>>0]|0))t=f[s+(e<<2)>>2]|0;else t=e;f[s+(m<<2)>>2]=t;p=p+1|0}while((p|0)<(o|0))}n=m+1|0}l=l+4|0;if((l|0)==(g|0)){h=n;i=k;j=c;break}else a=n}}n=f[i>>2]|0;a=f[j>>2]|0;if((n-a|0)>0){u=0;v=a;w=n}else return;while(1){n=f[v+(u<<2)>>2]|0;b[n+84>>0]=0;a=n+68|0;c=n+72|0;n=f[c>>2]|0;k=f[a>>2]|0;g=n-k>>2;l=k;k=n;if(h>>>0<=g>>>0)if(h>>>0>>0?(n=l+(h<<2)|0,(n|0)!=(k|0)):0){f[c>>2]=k+(~((k+-4-n|0)>>>2)<<2);x=v;y=w}else{x=v;y=w}else{Ch(a,h-g|0,6220);x=f[j>>2]|0;y=f[i>>2]|0}u=u+1|0;if((u|0)>=(y-x>>2|0))break;else{v=x;w=y}}return}function Zf(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0;d=b;e=c-d>>2;g=a+8|0;h=f[g>>2]|0;i=f[a>>2]|0;j=i;if(e>>>0<=h-i>>2>>>0){k=a+4|0;l=(f[k>>2]|0)-i>>2;m=e>>>0>l>>>0;n=b+(l<<2)|0;l=m?n:c;o=l;p=o-d|0;q=p>>2;if(q|0)im(i|0,b|0,p|0)|0;p=j+(q<<2)|0;if(!m){m=f[k>>2]|0;if((m|0)==(p|0))return;f[k>>2]=m+(~((m+-4-p|0)>>>2)<<2);return}if((l|0)==(c|0))return;l=f[k>>2]|0;p=((c+-4-o|0)>>>2)+1|0;o=n;n=l;while(1){f[n>>2]=f[o>>2];o=o+4|0;if((o|0)==(c|0))break;else n=n+4|0}f[k>>2]=l+(p<<2);return}p=i;if(!i)r=h;else{h=a+4|0;l=f[h>>2]|0;if((l|0)!=(j|0))f[h>>2]=l+(~((l+-4-i|0)>>>2)<<2);Oq(p);f[g>>2]=0;f[h>>2]=0;f[a>>2]=0;r=0}if(e>>>0>1073741823)aq(a);h=r>>1;p=r>>2>>>0<536870911?(h>>>0>>0?e:h):1073741823;if(p>>>0>1073741823)aq(a);h=ln(p<<2)|0;e=a+4|0;f[e>>2]=h;f[a>>2]=h;f[g>>2]=h+(p<<2);if((b|0)==(c|0))return;p=((c+-4-d|0)>>>2)+1|0;d=b;b=h;while(1){f[b>>2]=f[d>>2];d=d+4|0;if((d|0)==(c|0))break;else b=b+4|0}f[e>>2]=h+(p<<2);return}function _f(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0;d=u;u=u+32|0;e=d;g=a+40|0;h=(f[c>>2]|0)+(f[g>>2]|0)|0;i=a+24|0;j=f[a+32>>2]|0;k=j+-16384|0;do if(k>>>0>=64){if(k>>>0<16384){l=a+28|0;m=(f[i>>2]|0)+(f[l>>2]|0)|0;b[m>>0]=j;b[m+1>>0]=j>>>8;n=(f[l>>2]|0)+2|0;break}if(k>>>0<4194304){l=a+28|0;m=(f[i>>2]|0)+(f[l>>2]|0)|0;o=j+8372224|0;b[m>>0]=o;b[m+1>>0]=o>>>8;b[m+2>>0]=o>>>16;n=(f[l>>2]|0)+3|0;break}if(k>>>0<1073741824){l=a+28|0;o=(f[i>>2]|0)+(f[l>>2]|0)|0;m=j+-1073758208|0;b[o>>0]=m;b[o+1>>0]=m>>>8;b[o+2>>0]=m>>>16;b[o+3>>0]=m>>>24;n=(f[l>>2]|0)+4|0;break}else{n=f[a+28>>2]|0;break}}else{l=a+28|0;b[(f[i>>2]|0)+(f[l>>2]|0)>>0]=k;n=(f[l>>2]|0)+1|0}while(0);k=((n|0)<0)<<31>>31;Gn(e);yh(n,k,e)|0;i=e+4|0;a=(f[i>>2]|0)-(f[e>>2]|0)|0;im(h+a|0,h|0,n|0)|0;kh(h|0,f[e>>2]|0,a|0)|0;h=g;g=f[h>>2]|0;j=f[h+4>>2]|0;h=Vn(a|0,0,n|0,k|0)|0;k=Vn(h|0,I|0,g|0,j|0)|0;Cl(c,k,I);k=e+12|0;c=f[k>>2]|0;f[k>>2]=0;if(c|0)Oq(c);c=f[e>>2]|0;if(!c){u=d;return}if((f[i>>2]|0)!=(c|0))f[i>>2]=c;Oq(c);u=d;return}function $f(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0;d=b;e=c-d>>2;g=a+8|0;h=f[g>>2]|0;i=f[a>>2]|0;j=i;if(e>>>0<=h-i>>2>>>0){k=a+4|0;l=(f[k>>2]|0)-i>>2;m=e>>>0>l>>>0;n=b+(l<<2)|0;l=m?n:c;o=l;p=o-d|0;q=p>>2;if(q|0)im(i|0,b|0,p|0)|0;p=j+(q<<2)|0;if(!m){m=f[k>>2]|0;if((m|0)==(p|0))return;f[k>>2]=m+(~((m+-4-p|0)>>>2)<<2);return}if((l|0)==(c|0))return;l=f[k>>2]|0;p=c+-4-o|0;o=n;n=l;while(1){f[n>>2]=f[o>>2];o=o+4|0;if((o|0)==(c|0))break;else n=n+4|0}f[k>>2]=l+((p>>>2)+1<<2);return}p=i;if(!i)r=h;else{h=a+4|0;l=f[h>>2]|0;if((l|0)!=(j|0))f[h>>2]=l+(~((l+-4-i|0)>>>2)<<2);Oq(p);f[g>>2]=0;f[h>>2]=0;f[a>>2]=0;r=0}if(e>>>0>1073741823)aq(a);h=r>>1;p=r>>2>>>0<536870911?(h>>>0>>0?e:h):1073741823;if(p>>>0>1073741823)aq(a);h=ln(p<<2)|0;e=a+4|0;f[e>>2]=h;f[a>>2]=h;f[g>>2]=h+(p<<2);if((b|0)==(c|0))return;p=c+-4-d|0;d=b;b=h;while(1){f[b>>2]=f[d>>2];d=d+4|0;if((d|0)==(c|0))break;else b=b+4|0}f[e>>2]=h+((p>>>2)+1<<2);return}function ag(a,c,d,e){a=a|0;c=c|0;d=d|0;e=e|0;var g=0,h=0,i=0,j=0,k=0;g=u;u=u+80|0;h=g;i=g+64|0;Il(h);j=f[(f[a+8>>2]|0)+56>>2]|0;k=X(Vl(5)|0,d)|0;Jj(h,j,0,d&255,5,0,k,((k|0)<0)<<31>>31,0,0);k=ln(96)|0;tl(k,h);Bj(k,c)|0;f[i>>2]=k;gj(a,i);k=f[i>>2]|0;f[i>>2]=0;if(k|0){i=k+88|0;c=f[i>>2]|0;f[i>>2]=0;if(c|0){i=f[c+8>>2]|0;if(i|0){h=c+12|0;if((f[h>>2]|0)!=(i|0))f[h>>2]=i;Oq(i)}Oq(c)}c=f[k+68>>2]|0;if(c|0){i=k+72|0;h=f[i>>2]|0;if((h|0)!=(c|0))f[i>>2]=h+(~((h+-4-c|0)>>>2)<<2);Oq(c)}c=k+64|0;h=f[c>>2]|0;f[c>>2]=0;if(h|0){c=f[h>>2]|0;if(c|0){i=h+4|0;if((f[i>>2]|0)!=(c|0))f[i>>2]=c;Oq(c)}Oq(h)}Oq(k)}if(!e){u=g;return}k=f[a+32>>2]|0;b[k+84>>0]=0;a=k+68|0;h=k+72|0;k=f[h>>2]|0;c=f[a>>2]|0;i=k-c>>2;d=k;if(i>>>0>>0){Ch(a,e-i|0,1532);u=g;return}if(i>>>0<=e>>>0){u=g;return}i=c+(e<<2)|0;if((i|0)==(d|0)){u=g;return}f[h>>2]=d+(~((d+-4-i|0)>>>2)<<2);u=g;return}function bg(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0;c=u;u=u+16|0;d=c+4|0;e=c;g=a+4|0;h=f[g>>2]|0;i=a+8|0;j=f[i>>2]|0;if((j|0)==(h|0))k=h;else{l=j+(~((j+-4-h|0)>>>2)<<2)|0;f[i>>2]=l;k=l}l=a+16|0;h=f[l>>2]|0;j=a+20|0;m=f[j>>2]|0;n=h;if((m|0)!=(h|0))f[j>>2]=m+(~((m+-4-n|0)>>>2)<<2);m=f[b>>2]|0;h=f[b+4>>2]|0;if((m|0)==(h|0)){u=c;return}b=a+12|0;a=m;m=k;k=n;while(1){n=f[a>>2]|0;f[d>>2]=n;if((m|0)==(f[b>>2]|0)){Ri(g,d);o=f[l>>2]|0}else{f[m>>2]=n;f[i>>2]=m+4;o=k}n=f[d>>2]|0;p=f[j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12|0)+4>>2];f[q+(h+2<<2)>>2]=f[r+(p*12|0)+8>>2];p=p+1|0}while(p>>>0>>0)}f[d>>2]=-1;if(!(rc(a,d)|0)){s=0;u=c;return s|0}eb(a,f[d>>2]|0)|0;s=1;u=c;return s|0}function dg(a,b){a=a|0;b=b|0;var c=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0;c=d[b>>1]|0;e=d[b+2>>1]|0;g=d[b+4>>1]|0;b=(((c^318)&65535)+239^e&65535)+239^g&65535;h=f[a+4>>2]|0;if(!h){i=0;return i|0}j=h+-1|0;k=(j&h|0)==0;if(!k)if(b>>>0>>0)l=b;else l=(b>>>0)%(h>>>0)|0;else l=b&j;m=f[(f[a>>2]|0)+(l<<2)>>2]|0;if(!m){i=0;return i|0}a=f[m>>2]|0;if(!a){i=0;return i|0}if(k){k=a;while(1){m=f[k+4>>2]|0;n=(m|0)==(b|0);if(!(n|(m&j|0)==(l|0))){i=0;o=23;break}if(((n?(n=k+8|0,(d[n>>1]|0)==c<<16>>16):0)?(d[n+2>>1]|0)==e<<16>>16:0)?(d[k+12>>1]|0)==g<<16>>16:0){i=k;o=23;break}k=f[k>>2]|0;if(!k){i=0;o=23;break}}if((o|0)==23)return i|0}else p=a;while(1){a=f[p+4>>2]|0;if((a|0)==(b|0)){k=p+8|0;if(((d[k>>1]|0)==c<<16>>16?(d[k+2>>1]|0)==e<<16>>16:0)?(d[p+12>>1]|0)==g<<16>>16:0){i=p;o=23;break}}else{if(a>>>0>>0)q=a;else q=(a>>>0)%(h>>>0)|0;if((q|0)!=(l|0)){i=0;o=23;break}}p=f[p>>2]|0;if(!p){i=0;o=23;break}}if((o|0)==23)return i|0;return 0}function eg(a){a=a|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0;c=u;u=u+32|0;d=c;e=a+16|0;g=e;h=f[g>>2]|0;i=f[g+4>>2]|0;if(!((i|0)>0|(i|0)==0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0;k=f[e>>2]|0}if((k|0)<0)aq(c);else{j=((k+-1|0)>>>5)+1|0;l=ln(j<<2)|0;f[c>>2]=l;f[a+12>>2]=0;f[i>>2]=j;m=f[e>>2]|0;n=l;break}}else{m=g;n=f[c>>2]|0}while(0);im(n|0,f[d>>2]|0,((m+-1|0)>>>5<<2)+4|0)|0;h=f[e>>2]|0}f[a+12>>2]=h;h=a+20|0;e=b+20|0;m=b+24|0;b=f[m>>2]|0;if(!b)o=0;else{d=a+28|0;do if(b>>>0>f[d>>2]<<5>>>0){n=f[h>>2]|0;if(!n)p=b;else{Oq(n);f[h>>2]=0;f[d>>2]=0;f[a+24>>2]=0;p=f[m>>2]|0}if((p|0)<0)aq(h);else{n=((p+-1|0)>>>5)+1|0;c=ln(n<<2)|0;f[h>>2]=c;f[a+24>>2]=0;f[d>>2]=n;q=f[m>>2]|0;r=c;break}}else{q=b;r=f[h>>2]|0}while(0);im(r|0,f[e>>2]|0,((q+-1|0)>>>5<<2)+4|0)|0;o=f[m>>2]|0}f[a+24>>2]=o;return a|0}function gg(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0;f[c>>2]=1;d=a+4|0;e=c+8|0;g=c+12|0;c=f[e>>2]|0;i=(f[g>>2]|0)-c|0;if(i>>>0<4294967292){Lk(e,i+4|0,0);j=f[e>>2]|0}else j=c;c=j+i|0;i=h[d>>0]|h[d+1>>0]<<8|h[d+2>>0]<<16|h[d+3>>0]<<24;b[c>>0]=i;b[c+1>>0]=i>>8;b[c+2>>0]=i>>16;b[c+3>>0]=i>>24;i=a+8|0;c=a+12|0;d=f[i>>2]|0;if((f[c>>2]|0)!=(d|0)){j=0;k=d;do{d=k+(j<<2)|0;l=f[e>>2]|0;m=(f[g>>2]|0)-l|0;if(m>>>0<4294967292){Lk(e,m+4|0,0);n=f[e>>2]|0}else n=l;l=n+m|0;m=h[d>>0]|h[d+1>>0]<<8|h[d+2>>0]<<16|h[d+3>>0]<<24;b[l>>0]=m;b[l+1>>0]=m>>8;b[l+2>>0]=m>>16;b[l+3>>0]=m>>24;j=j+1|0;k=f[i>>2]|0}while(j>>>0<(f[c>>2]|0)-k>>2>>>0)}k=a+20|0;a=f[e>>2]|0;c=(f[g>>2]|0)-a|0;if(c>>>0<4294967292){Lk(e,c+4|0,0);o=f[e>>2]|0;p=o+c|0;q=h[k>>0]|h[k+1>>0]<<8|h[k+2>>0]<<16|h[k+3>>0]<<24;b[p>>0]=q;b[p+1>>0]=q>>8;b[p+2>>0]=q>>16;b[p+3>>0]=q>>24;return}else{o=a;p=o+c|0;q=h[k>>0]|h[k+1>>0]<<8|h[k+2>>0]<<16|h[k+3>>0]<<24;b[p>>0]=q;b[p+1>>0]=q>>8;b[p+2>>0]=q>>16;b[p+3>>0]=q>>24;return}}function hg(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0;d=a+8|0;e=f[d>>2]|0;g=f[a>>2]|0;h=g;do if(e-g>>2>>>0>=b>>>0){i=a+4|0;j=f[i>>2]|0;k=j-g>>2;l=k>>>0>>0;m=l?k:b;n=j;if(m|0){j=m;m=h;while(1){f[m>>2]=f[c>>2];j=j+-1|0;if(!j)break;else m=m+4|0}}if(!l){m=h+(b<<2)|0;if((m|0)==(n|0))return;else{o=i;p=n+(~((n+-4-m|0)>>>2)<<2)|0;break}}else{m=b-k|0;j=m;q=n;while(1){f[q>>2]=f[c>>2];j=j+-1|0;if(!j)break;else q=q+4|0}o=i;p=n+(m<<2)|0;break}}else{q=g;if(!g)r=e;else{j=a+4|0;k=f[j>>2]|0;if((k|0)!=(h|0))f[j>>2]=k+(~((k+-4-g|0)>>>2)<<2);Oq(q);f[d>>2]=0;f[j>>2]=0;f[a>>2]=0;r=0}if(b>>>0>1073741823)aq(a);j=r>>1;q=r>>2>>>0<536870911?(j>>>0>>0?b:j):1073741823;if(q>>>0>1073741823)aq(a);j=ln(q<<2)|0;k=a+4|0;f[k>>2]=j;f[a>>2]=j;f[d>>2]=j+(q<<2);q=b;l=j;while(1){f[l>>2]=f[c>>2];q=q+-1|0;if(!q)break;else l=l+4|0}o=k;p=j+(b<<2)|0}while(0);f[o>>2]=p;return}function ig(a,b,c,d,e,g){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;g=g|0;var h=0,i=0,j=0,k=0,l=0,m=0,n=0;h=jh(a,b,c,d,g)|0;i=f[e>>2]|0;j=f[d>>2]|0;k=f[g>>2]|0;g=f[k>>2]|0;l=(f[k+4>>2]|0)-g>>3;if(l>>>0<=i>>>0)aq(k);m=g;if(l>>>0<=j>>>0)aq(k);if((f[m+(i<<3)>>2]|0)>>>0>=(f[m+(j<<3)>>2]|0)>>>0){n=h;return n|0}f[d>>2]=i;f[e>>2]=j;j=f[d>>2]|0;e=f[c>>2]|0;if(l>>>0<=j>>>0)aq(k);if(l>>>0<=e>>>0)aq(k);if((f[m+(j<<3)>>2]|0)>>>0>=(f[m+(e<<3)>>2]|0)>>>0){n=h+1|0;return n|0}f[c>>2]=j;f[d>>2]=e;e=f[c>>2]|0;d=f[b>>2]|0;if(l>>>0<=e>>>0)aq(k);if(l>>>0<=d>>>0)aq(k);if((f[m+(e<<3)>>2]|0)>>>0>=(f[m+(d<<3)>>2]|0)>>>0){n=h+2|0;return n|0}f[b>>2]=e;f[c>>2]=d;d=f[b>>2]|0;c=f[a>>2]|0;if(l>>>0<=d>>>0)aq(k);if(l>>>0<=c>>>0)aq(k);if((f[m+(d<<3)>>2]|0)>>>0>=(f[m+(c<<3)>>2]|0)>>>0){n=h+3|0;return n|0}f[a>>2]=d;f[b>>2]=c;n=h+4|0;return n|0}function jg(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0;d=b[c>>0]|0;e=b[c+1>>0]|0;g=b[c+2>>0]|0;c=((d&255^318)+239^e&255)+239^g&255;h=f[a+4>>2]|0;if(!h){i=0;return i|0}j=h+-1|0;k=(j&h|0)==0;if(!k)if(c>>>0>>0)l=c;else l=(c>>>0)%(h>>>0)|0;else l=c&j;m=f[(f[a>>2]|0)+(l<<2)>>2]|0;if(!m){i=0;return i|0}a=f[m>>2]|0;if(!a){i=0;return i|0}if(k){k=a;while(1){m=f[k+4>>2]|0;n=(m|0)==(c|0);if(!(n|(m&j|0)==(l|0))){i=0;o=23;break}if(((n?(n=k+8|0,(b[n>>0]|0)==d<<24>>24):0)?(b[n+1>>0]|0)==e<<24>>24:0)?(b[n+2>>0]|0)==g<<24>>24:0){i=k;o=23;break}k=f[k>>2]|0;if(!k){i=0;o=23;break}}if((o|0)==23)return i|0}else p=a;while(1){a=f[p+4>>2]|0;if((a|0)==(c|0)){k=p+8|0;if(((b[k>>0]|0)==d<<24>>24?(b[k+1>>0]|0)==e<<24>>24:0)?(b[k+2>>0]|0)==g<<24>>24:0){i=p;o=23;break}}else{if(a>>>0>>0)q=a;else q=(a>>>0)%(h>>>0)|0;if((q|0)!=(l|0)){i=0;o=23;break}}p=f[p>>2]|0;if(!p){i=0;o=23;break}}if((o|0)==23)return i|0;return 0}function kg(a){a=a|0;var b=0,c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;b=u;u=u+16|0;c=b;d=a+36|0;e=a+4|0;g=a+8|0;h=(f[g>>2]|0)-(f[e>>2]|0)>>2;i=a+40|0;j=f[i>>2]|0;k=f[d>>2]|0;l=j-k>>2;m=k;k=j;if(h>>>0<=l>>>0){if(h>>>0>>0?(j=m+(h<<2)|0,(j|0)!=(k|0)):0){m=k;do{k=m+-4|0;f[i>>2]=k;n=f[k>>2]|0;f[k>>2]=0;if(n|0)Va[f[(f[n>>2]|0)+4>>2]&127](n);m=f[i>>2]|0}while((m|0)!=(j|0))}}else Eg(d,h-l|0);if((f[g>>2]|0)==(f[e>>2]|0)){o=1;u=b;return o|0}l=a+52|0;h=a+48|0;j=0;while(1){Xa[f[(f[a>>2]|0)+56>>2]&15](c,a,j);m=(f[d>>2]|0)+(j<<2)|0;i=f[c>>2]|0;f[c>>2]=0;n=f[m>>2]|0;f[m>>2]=i;if(n|0)Va[f[(f[n>>2]|0)+4>>2]&127](n);n=f[c>>2]|0;f[c>>2]=0;if(n|0)Va[f[(f[n>>2]|0)+4>>2]&127](n);n=f[(f[d>>2]|0)+(j<<2)>>2]|0;if(!n){o=0;p=19;break}if(j>>>0<(f[l>>2]|0)>>>0?f[(f[h>>2]|0)+(j>>>5<<2)>>2]&1<<(j&31)|0:0)Bp(n);j=j+1|0;if(j>>>0>=(f[g>>2]|0)-(f[e>>2]|0)>>2>>>0){o=1;p=19;break}}if((p|0)==19){u=b;return o|0}return 0}function lg(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0;d=u;u=u+16|0;e=d+4|0;g=d;ci(f[c+12>>2]|0,b)|0;h=f[c+8>>2]|0;a:do if(h|0){i=b+16|0;j=b+4|0;k=h;while(1){l=k;if(!(Bf(0,b,l+8|0)|0)){m=0;break}n=l+20|0;o=(f[l+24>>2]|0)-(f[n>>2]|0)|0;ci(o,b)|0;l=f[n>>2]|0;n=i;p=f[n+4>>2]|0;if(!((p|0)>0|(p|0)==0&(f[n>>2]|0)>>>0>0)){f[g>>2]=f[j>>2];f[e>>2]=f[g>>2];Me(b,e,l,l+o|0)|0}k=f[k>>2]|0;if(!k)break a}u=d;return m|0}while(0);ci(f[c+32>>2]|0,b)|0;e=f[c+28>>2]|0;if(!e){m=1;u=d;return m|0}else q=e;while(1){e=q;if(!(Bf(0,b,e+8|0)|0)){m=0;r=10;break}lg(a,b,f[e+20>>2]|0)|0;q=f[q>>2]|0;if(!q){m=1;r=10;break}}if((r|0)==10){u=d;return m|0}return 0}function mg(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n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>0>>0?h:j):1073741823;if(m>>>0>1073741823)aq(a);j=ln(m<<2)|0;n=a+4|0;f[n>>2]=j;f[a>>2]=j;f[i>>2]=j+(m<<2);if((g|0)<=0)return;kh(j|0,b|0,g|0)|0;f[n>>2]=j+(g>>>2<<2);return}g=a+4|0;a=f[g>>2]|0;j=a-k>>2;k=h>>>0>j>>>0;h=k?b+(j<<2)|0:c;c=a;j=a;if((h|0)==(b|0))p=l;else{a=h+-4-e|0;e=b;b=l;while(1){f[b>>2]=f[e>>2];e=e+4|0;if((e|0)==(h|0))break;else b=b+4|0}p=l+((a>>>2)+1<<2)|0}if(k){k=d-h|0;if((k|0)<=0)return;kh(j|0,h|0,k|0)|0;f[g>>2]=(f[g>>2]|0)+(k>>>2<<2);return}else{if((p|0)==(c|0))return;f[g>>2]=c+(~((c+-4-p|0)>>>2)<<2);return}}function og(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0;d=f[a+8>>2]|0;e=a+76|0;g=f[e>>2]|0;h=f[g+80>>2]|0;b[c+84>>0]=0;i=c+68|0;j=c+72|0;k=f[j>>2]|0;l=f[i>>2]|0;m=k-l>>2;n=l;l=k;if(h>>>0<=m>>>0)if(h>>>0>>0?(k=n+(h<<2)|0,(k|0)!=(l|0)):0){f[j>>2]=l+(~((l+-4-k|0)>>>2)<<2);o=g;p=h}else{o=g;p=h}else{Ch(i,h-m|0,3600);m=f[e>>2]|0;o=m;p=f[m+80>>2]|0}m=(f[o+100>>2]|0)-(f[o+96>>2]|0)|0;e=(m|0)/12|0;if(!m){q=1;return q|0}m=c+68|0;c=f[o+96>>2]|0;o=f[d+28>>2]|0;d=f[(f[a+80>>2]|0)+12>>2]|0;a=0;while(1){h=a*3|0;i=f[d+(f[o+(h<<2)>>2]<<2)>>2]|0;if(i>>>0>=p>>>0){q=0;r=10;break}g=f[m>>2]|0;f[g+(f[c+(a*12|0)>>2]<<2)>>2]=i;i=f[d+(f[o+(h+1<<2)>>2]<<2)>>2]|0;if(i>>>0>=p>>>0){q=0;r=10;break}f[g+(f[c+(a*12|0)+4>>2]<<2)>>2]=i;i=f[d+(f[o+(h+2<<2)>>2]<<2)>>2]|0;if(i>>>0>=p>>>0){q=0;r=10;break}f[g+(f[c+(a*12|0)+8>>2]<<2)>>2]=i;a=a+1|0;if(a>>>0>=e>>>0){q=1;r=10;break}}if((r|0)==10)return q|0;return 0}function pg(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;e=u;u=u+16|0;g=e;if(!(xh(a,c,d)|0)){h=0;u=e;return h|0}if((b[(f[a+8>>2]|0)+24>>0]|0)!=3){h=0;u=e;return h|0}i=f[c+48>>2]|0;c=ln(32)|0;f[g>>2]=c;f[g+8>>2]=-2147483616;f[g+4>>2]=17;j=c;k=14495;l=j+17|0;do{b[j>>0]=b[k>>0]|0;j=j+1|0;k=k+1|0}while((j|0)<(l|0));b[c+17>>0]=0;c=i+16|0;k=f[c>>2]|0;if(k){j=c;l=k;a:while(1){k=l;while(1){if((f[k+16>>2]|0)>=(d|0))break;m=f[k+4>>2]|0;if(!m){n=j;break a}else k=m}l=f[k>>2]|0;if(!l){n=k;break}else j=k}if(((n|0)!=(c|0)?(f[n+16>>2]|0)<=(d|0):0)?(d=n+20|0,(Jh(d,g)|0)!=0):0)o=Hk(d,g,-1)|0;else p=12}else p=12;if((p|0)==12)o=Hk(i,g,-1)|0;if((b[g+11>>0]|0)<0)Oq(f[g>>2]|0);if((o|0)<1){h=0;u=e;return h|0}ip(a+40|0,o);h=1;u=e;return h|0}function qg(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;c=f[b>>2]|0;d=f[b+4>>2]|0;e=f[b+8>>2]|0;b=((c^318)+239^d)+239^e;g=f[a+4>>2]|0;if(!g){h=0;return h|0}i=g+-1|0;j=(i&g|0)==0;if(!j)if(b>>>0>>0)k=b;else k=(b>>>0)%(g>>>0)|0;else k=b&i;l=f[(f[a>>2]|0)+(k<<2)>>2]|0;if(!l){h=0;return h|0}a=f[l>>2]|0;if(!a){h=0;return h|0}if(j){j=a;while(1){l=f[j+4>>2]|0;m=(l|0)==(b|0);if(!(m|(l&i|0)==(k|0))){h=0;n=23;break}if(((m?(f[j+8>>2]|0)==(c|0):0)?(f[j+12>>2]|0)==(d|0):0)?(f[j+16>>2]|0)==(e|0):0){h=j;n=23;break}j=f[j>>2]|0;if(!j){h=0;n=23;break}}if((n|0)==23)return h|0}else o=a;while(1){a=f[o+4>>2]|0;if((a|0)==(b|0)){if(((f[o+8>>2]|0)==(c|0)?(f[o+12>>2]|0)==(d|0):0)?(f[o+16>>2]|0)==(e|0):0){h=o;n=23;break}}else{if(a>>>0>>0)p=a;else p=(a>>>0)%(g>>>0)|0;if((p|0)!=(k|0)){h=0;n=23;break}}o=f[o>>2]|0;if(!o){h=0;n=23;break}}if((n|0)==23)return h|0;return 0}function rg(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;e=c;g=d-e|0;h=a+8|0;i=f[h>>2]|0;j=f[a>>2]|0;k=j;if(g>>>0>(i-j|0)>>>0){if(!j)l=i;else{i=a+4|0;if((f[i>>2]|0)!=(k|0))f[i>>2]=k;Oq(k);f[h>>2]=0;f[i>>2]=0;f[a>>2]=0;l=0}if((g|0)<0)aq(a);i=l<<1;m=l>>>0<1073741823?(i>>>0>>0?g:i):2147483647;if((m|0)<0)aq(a);i=ln(m)|0;l=a+4|0;f[l>>2]=i;f[a>>2]=i;f[h>>2]=i+m;if((c|0)==(d|0))return;else{n=c;o=i}do{b[o>>0]=b[n>>0]|0;n=n+1|0;o=(f[l>>2]|0)+1|0;f[l>>2]=o}while((n|0)!=(d|0));return}n=a+4|0;a=(f[n>>2]|0)-j|0;j=g>>>0>a>>>0;g=c+a|0;a=j?g:d;if((a|0)==(c|0))p=k;else{o=c;c=k;while(1){b[c>>0]=b[o>>0]|0;o=o+1|0;if((o|0)==(a|0))break;else c=c+1|0}p=k+(a-e)|0}if(!j){if((f[n>>2]|0)==(p|0))return;f[n>>2]=p;return}if((a|0)==(d|0))return;a=g;g=f[n>>2]|0;do{b[g>>0]=b[a>>0]|0;a=a+1|0;g=(f[n>>2]|0)+1|0;f[n>>2]=g}while((a|0)!=(d|0));return}function sg(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;d=c>>>1&1431655765|c<<1&-1431655766;c=d>>>2&858993459|d<<2&-858993460;d=c>>>4&252645135|c<<4&-252645136;c=d>>>8&16711935|d<<8&-16711936;d=32-b|0;e=(c>>>16|c<<16)>>>d;c=e-(e>>>1&1431655765)|0;g=(c>>>2&858993459)+(c&858993459)|0;c=(X((g>>>4)+g&252645135,16843009)|0)>>>24;g=b-c|0;h=f[a>>2]|0;i=h;j=Vn(f[i>>2]|0,f[i+4>>2]|0,g|0,((g|0)<0)<<31>>31|0)|0;g=h;f[g>>2]=j;f[g+4>>2]=I;g=h+8|0;h=g;j=Vn(f[h>>2]|0,f[h+4>>2]|0,c|0,0)|0;c=g;f[c>>2]=j;f[c+4>>2]=I;c=a+28|0;j=f[c>>2]|0;g=32-j|0;h=a+24|0;do if((g|0)>=(b|0)){i=-1>>>d<>2]&~i|i&e<>2]=k;i=j+b|0;f[c>>2]=i;if((i|0)!=32)return;i=a+16|0;l=f[i>>2]|0;if((l|0)==(f[a+20>>2]|0)){Ri(a+12|0,h);m=0;n=0;break}else{f[l>>2]=k;f[i>>2]=l+4;m=0;n=0;break}}else{l=-1>>>j<>2]&~l|l&e<>2]=i;l=a+16|0;k=f[l>>2]|0;if((k|0)==(f[a+20>>2]|0))Ri(a+12|0,h);else{f[k>>2]=i;f[l>>2]=k+4}k=b-g|0;m=k;n=-1>>>(32-k|0)&e>>>g}while(0);f[h>>2]=n;f[c>>2]=m;return}function tg(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0;e=c&255;g=(d|0)!=0;a:do if(g&(a&3|0)!=0){h=c&255;i=a;j=d;while(1){if((b[i>>0]|0)==h<<24>>24){k=i;l=j;m=6;break a}n=i+1|0;o=j+-1|0;p=(o|0)!=0;if(p&(n&3|0)!=0){i=n;j=o}else{q=n;r=o;s=p;m=5;break}}}else{q=a;r=d;s=g;m=5}while(0);if((m|0)==5)if(s){k=q;l=r;m=6}else{t=q;u=0}b:do if((m|0)==6){q=c&255;if((b[k>>0]|0)==q<<24>>24){t=k;u=l}else{r=X(e,16843009)|0;c:do if(l>>>0>3){s=k;g=l;while(1){d=f[s>>2]^r;if((d&-2139062144^-2139062144)&d+-16843009|0)break;d=s+4|0;a=g+-4|0;if(a>>>0>3){s=d;g=a}else{v=d;w=a;m=11;break c}}x=s;y=g}else{v=k;w=l;m=11}while(0);if((m|0)==11)if(!w){t=v;u=0;break}else{x=v;y=w}while(1){if((b[x>>0]|0)==q<<24>>24){t=x;u=y;break b}r=x+1|0;y=y+-1|0;if(!y){t=r;u=0;break}else x=r}}}while(0);return (u|0?t:0)|0}function ug(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0;c=a+4|0;d=f[c>>2]|0;e=f[a>>2]|0;g=e;do if((d|0)==(e|0)){h=a+8|0;i=f[h>>2]|0;j=a+12|0;k=f[j>>2]|0;l=k;if(i>>>0>>0){k=i;m=((l-k>>2)+1|0)/2|0;n=i+(m<<2)|0;o=k-d|0;k=o>>2;p=n+(0-k<<2)|0;if(!k){q=n;r=i}else{im(p|0,d|0,o|0)|0;q=p;r=f[h>>2]|0}f[c>>2]=q;f[h>>2]=r+(m<<2);s=q;break}m=l-g>>1;l=(m|0)==0?1:m;if(l>>>0>1073741823){m=ra(8)|0;Oo(m,16035);f[m>>2]=7256;va(m|0,1112,110)}m=ln(l<<2)|0;p=m;o=m+((l+3|0)>>>2<<2)|0;n=o;k=m+(l<<2)|0;if((d|0)==(i|0)){t=n;u=d}else{l=o;m=n;v=d;do{f[l>>2]=f[v>>2];l=m+4|0;m=l;v=v+4|0}while((v|0)!=(i|0));t=m;u=f[a>>2]|0}f[a>>2]=p;f[c>>2]=n;f[h>>2]=t;f[j>>2]=k;if(!u)s=o;else{Oq(u);s=f[c>>2]|0}}else s=d;while(0);f[s+-4>>2]=f[b>>2];f[c>>2]=(f[c>>2]|0)+-4;return}function vg(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0;d=u;u=u+16|0;e=d+4|0;g=d;h=d+8|0;i=a+4|0;if((f[i>>2]|0)==-1){j=0;u=d;return j|0}k=f[a+8>>2]|0;l=c+16|0;m=l;n=f[m>>2]|0;o=f[m+4>>2]|0;if(!((o|0)>0|(o|0)==0&n>>>0>0)){m=(f[a+12>>2]|0)-k|0;p=c+4|0;f[g>>2]=f[p>>2];f[e>>2]=f[g>>2];Me(c,e,k,k+m|0)|0;m=l;k=f[m>>2]|0;q=f[m+4>>2]|0;m=a+20|0;if((q|0)>0|(q|0)==0&k>>>0>0){r=q;s=k;t=g}else{f[g>>2]=f[p>>2];f[e>>2]=f[g>>2];Me(c,e,m,m+4|0)|0;m=l;r=f[m+4>>2]|0;s=f[m>>2]|0;t=g}}else{r=o;s=n;t=g}b[h>>0]=f[i>>2];if(!((r|0)>0|(r|0)==0&s>>>0>0)){f[g>>2]=f[c+4>>2];f[e>>2]=f[g>>2];Me(c,e,h,h+1|0)|0}j=1;u=d;return j|0}function wg(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0;e=u;u=u+16|0;g=e+4|0;h=e;i=a+8|0;a=f[i>>2]|0;j=f[a+40>>2]|0;k=Lq((j|0)>-1?j:-1)|0;l=c+4|0;m=f[l>>2]|0;n=f[c>>2]|0;if((m|0)==(n|0)){Mq(k);u=e;return 1}o=d+16|0;p=d+4|0;q=k+j|0;j=0;r=n;n=a;s=a;a=m;while(1){m=f[r+(j<<2)>>2]|0;if(!(b[n+84>>0]|0))t=f[(f[n+68>>2]|0)+(m<<2)>>2]|0;else t=m;m=s+48|0;v=f[m>>2]|0;w=f[m+4>>2]|0;m=s+40|0;x=f[m>>2]|0;y=un(x|0,f[m+4>>2]|0,t|0,0)|0;m=Vn(y|0,I|0,v|0,w|0)|0;kh(k|0,(f[f[s>>2]>>2]|0)+m|0,x|0)|0;x=o;m=f[x+4>>2]|0;if((m|0)>0|(m|0)==0&(f[x>>2]|0)>>>0>0){z=r;A=a}else{f[h>>2]=f[p>>2];f[g>>2]=f[h>>2];Me(d,g,k,q)|0;z=f[c>>2]|0;A=f[l>>2]|0}x=j+1|0;if(x>>>0>=A-z>>2>>>0)break;m=f[i>>2]|0;j=x;r=z;n=m;s=m;a=A}Mq(k);u=e;return 1}function xg(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0;d=(f[b>>2]|0)*3|0;if((d|0)==-1){e=0;g=-1;f[c>>2]=g;return e|0}b=f[a+12>>2]|0;h=f[b+12>>2]|0;if((f[h+(d<<2)>>2]|0)==-1){e=0;g=d;f[c>>2]=g;return e|0}i=f[b>>2]|0;b=f[a+152>>2]|0;if((f[b+(f[i+(d<<2)>>2]<<2)>>2]|0)==-1){a=d+1|0;j=((a>>>0)%3|0|0)==0?d+-2|0:a;if((j|0)==-1){e=0;g=-1;f[c>>2]=g;return e|0}if((f[h+(j<<2)>>2]|0)==-1){e=0;g=j;f[c>>2]=g;return e|0}if((f[b+(f[i+(j<<2)>>2]<<2)>>2]|0)==-1){a=j+1|0;k=((a>>>0)%3|0|0)==0?j+-2|0:a;if((k|0)==-1){e=0;g=-1;f[c>>2]=g;return e|0}if((f[h+(k<<2)>>2]|0)==-1){e=0;g=k;f[c>>2]=g;return e|0}if((f[b+(f[i+(k<<2)>>2]<<2)>>2]|0)==-1){i=k+1|0;e=1;g=((i>>>0)%3|0|0)==0?k+-2|0:i;f[c>>2]=g;return e|0}else l=k}else l=j}else l=d;while(1){d=(((l>>>0)%3|0|0)==0?2:-1)+l|0;if((d|0)==-1)break;j=f[h+(d<<2)>>2]|0;if((j|0)==-1)break;d=j+(((j>>>0)%3|0|0)==0?2:-1)|0;if((d|0)==-1)break;else l=d}e=0;g=(((l>>>0)%3|0|0)==0?2:-1)+l|0;f[c>>2]=g;return e|0}function yg(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0;e=a+4|0;g=f[e>>2]|0;if(!g){f[c>>2]=e;h=e;return h|0}e=b[d+11>>0]|0;i=e<<24>>24<0;j=i?f[d+4>>2]|0:e&255;e=i?f[d>>2]|0:d;d=a+4|0;a=g;while(1){g=a+16|0;i=b[g+11>>0]|0;k=i<<24>>24<0;l=k?f[a+20>>2]|0:i&255;i=l>>>0>>0;m=i?l:j;if((m|0)!=0?(n=Vk(e,k?f[g>>2]|0:g,m)|0,(n|0)!=0):0)if((n|0)<0)o=8;else o=10;else if(j>>>0>>0)o=8;else o=10;if((o|0)==8){o=0;n=f[a>>2]|0;if(!n){o=9;break}else{p=a;q=n}}else if((o|0)==10){o=0;n=j>>>0>>0?j:l;if((n|0)!=0?(l=Vk(k?f[g>>2]|0:g,e,n)|0,(l|0)!=0):0){if((l|0)>=0){o=16;break}}else o=12;if((o|0)==12?(o=0,!i):0){o=16;break}r=a+4|0;i=f[r>>2]|0;if(!i){o=15;break}else{p=r;q=i}}d=p;a=q}if((o|0)==9){f[c>>2]=a;h=a;return h|0}else if((o|0)==15){f[c>>2]=a;h=r;return h|0}else if((o|0)==16){f[c>>2]=a;h=d;return h|0}return 0}function zg(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0;d=u;u=u+32|0;e=d+24|0;g=d+16|0;h=d+8|0;i=d;j=a+4|0;k=f[j>>2]|0;l=f[b>>2]|0;m=f[b+4>>2]|0;b=f[c>>2]|0;n=f[c+4>>2]|0;c=b-l<<3;f[j>>2]=k-m+n+c;j=(f[a>>2]|0)+(k>>>5<<2)|0;a=k&31;k=j;if((m|0)!=(a|0)){f[e>>2]=l;f[e+4>>2]=m;f[g>>2]=b;f[g+4>>2]=n;f[h>>2]=k;f[h+4>>2]=a;xe(i,e,g,h);u=d;return}h=n-m+c|0;c=l;if((h|0)>0){if(!m){o=h;p=j;q=0;r=l;s=c}else{l=32-m|0;n=(h|0)<(l|0)?h:l;g=-1>>>(l-n|0)&-1<>2]=f[j>>2]&~g|f[c>>2]&g;g=n+m|0;l=c+4|0;o=h-n|0;p=j+(g>>>5<<2)|0;q=g&31;r=l;s=l}l=(o|0)/32|0;im(p|0,r|0,l<<2|0)|0;r=o-(l<<5)|0;o=p+(l<<2)|0;p=o;if((r|0)>0){g=-1>>>(32-r|0);f[o>>2]=f[o>>2]&~g|f[s+(l<<2)>>2]&g;t=r;v=p}else{t=q;v=p}}else{t=m;v=k}f[i>>2]=v;f[i+4>>2]=t;u=d;return}function Ag(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0;c=a+8|0;d=f[c>>2]|0;e=a+12|0;g=f[e>>2]|0;h=g;do if((d|0)==(g|0)){i=a+4|0;j=f[i>>2]|0;k=f[a>>2]|0;l=k;if(j>>>0>k>>>0){m=j;n=((m-l>>2)+1|0)/-2|0;o=j+(n<<2)|0;p=d-m|0;m=p>>2;if(!m)q=j;else{im(o|0,j|0,p|0)|0;q=f[i>>2]|0}p=o+(m<<2)|0;f[c>>2]=p;f[i>>2]=q+(n<<2);r=p;break}p=h-l>>1;l=(p|0)==0?1:p;if(l>>>0>1073741823){p=ra(8)|0;Oo(p,16035);f[p>>2]=7256;va(p|0,1112,110)}p=ln(l<<2)|0;n=p;m=p+(l>>>2<<2)|0;o=m;s=p+(l<<2)|0;if((j|0)==(d|0)){t=o;u=k}else{k=m;m=o;l=j;do{f[k>>2]=f[l>>2];k=m+4|0;m=k;l=l+4|0}while((l|0)!=(d|0));t=m;u=f[a>>2]|0}f[a>>2]=n;f[i>>2]=o;f[c>>2]=t;f[e>>2]=s;if(!u)r=t;else{Oq(u);r=f[c>>2]|0}}else r=d;while(0);f[r>>2]=f[b>>2];f[c>>2]=(f[c>>2]|0)+4;return}function Bg(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;c=u;u=u+16|0;d=c+8|0;e=c+4|0;g=c;h=a+12|0;i=a+4|0;j=f[i>>2]|0;if((j|0)==(f[a+8>>2]|0)){Ri(a,h);k=f[i>>2]|0}else{f[j>>2]=f[h>>2];l=j+4|0;f[i>>2]=l;k=l}l=f[a>>2]|0;f[g>>2]=k-l;k=b+16|0;j=k;m=f[j+4>>2]|0;if(!((m|0)>0|(m|0)==0&(f[j>>2]|0)>>>0>0)){f[e>>2]=f[b+4>>2];f[d>>2]=f[e>>2];Me(b,d,g,g+4|0)|0;j=f[a>>2]|0;m=f[g>>2]|0;g=k;k=f[g+4>>2]|0;if((k|0)>0|(k|0)==0&(f[g>>2]|0)>>>0>0){n=j;o=e}else{f[e>>2]=f[b+4>>2];f[d>>2]=f[e>>2];Me(b,d,j,j+m|0)|0;n=f[a>>2]|0;o=e}}else{n=l;o=e}e=f[i>>2]|0;if((e|0)==(n|0)){f[h>>2]=0;p=a+16|0;f[p>>2]=0;u=c;return}f[i>>2]=e+(~((e+-4-n|0)>>>2)<<2);f[h>>2]=0;p=a+16|0;f[p>>2]=0;u=c;return}function Cg(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0;e=c;g=d-e|0;h=a+8|0;i=f[h>>2]|0;j=f[a>>2]|0;k=j;if(g>>>0>(i-j|0)>>>0){if(!j)l=i;else{i=a+4|0;if((f[i>>2]|0)!=(k|0))f[i>>2]=k;Oq(k);f[h>>2]=0;f[i>>2]=0;f[a>>2]=0;l=0}if((g|0)<0)aq(a);i=l<<1;m=l>>>0<1073741823?(i>>>0>>0?g:i):2147483647;if((m|0)<0)aq(a);i=ln(m)|0;l=a+4|0;f[l>>2]=i;f[a>>2]=i;f[h>>2]=i+m;if((c|0)==(d|0))return;else{n=c;o=i}do{b[o>>0]=b[n>>0]|0;n=n+1|0;o=(f[l>>2]|0)+1|0;f[l>>2]=o}while((n|0)!=(d|0));return}else{n=a+4|0;a=(f[n>>2]|0)-j|0;j=g>>>0>a>>>0;g=c+a|0;a=j?g:d;o=a-e|0;if(o|0)im(k|0,c|0,o|0)|0;c=k+o|0;if(!j){if((f[n>>2]|0)==(c|0))return;f[n>>2]=c;return}if((a|0)==(d|0))return;a=g;g=f[n>>2]|0;do{b[g>>0]=b[a>>0]|0;a=a+1|0;g=(f[n>>2]|0)+1|0;f[n>>2]=g}while((a|0)!=(d|0));return}}function Dg(a){a=a|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;c=u;u=u+16|0;d=c;if(b[a+352>>0]|0){u=c;return 1}e=a+8|0;g=f[e>>2]|0;h=(f[g+12>>2]|0)-(f[g+8>>2]|0)|0;g=h>>2;i=a+172|0;Gi(i,g+-1|0);if(!((g|0)!=1&(h|0)>0)){u=c;return 1}h=a+12|0;a=0;j=0;while(1){k=f[(f[(f[e>>2]|0)+8>>2]|0)+(a<<2)>>2]|0;if(!(f[k+56>>2]|0))l=j;else{m=f[i>>2]|0;f[m+(j*136|0)>>2]=a;n=f[m+(j*136|0)+104>>2]|0;o=m+(j*136|0)+108|0;p=f[o>>2]|0;if((p|0)!=(n|0))f[o>>2]=p+(~((p+-4-n|0)>>>2)<<2);n=f[h>>2]|0;gk(m+(j*136|0)+104|0,(f[n+4>>2]|0)-(f[n>>2]|0)>>2);n=(f[i>>2]|0)+(j*136|0)+116|0;m=f[h>>2]|0;p=(f[m+4>>2]|0)-(f[m>>2]|0)>>2;f[d>>2]=-1;hg(n,p,d);p=f[i>>2]|0;f[p+(j*136|0)+128>>2]=0;Gc(p+(j*136|0)+4|0,f[e>>2]|0,f[h>>2]|0,k)|0;l=j+1|0}a=a+1|0;if((a|0)>=(g|0))break;else j=l}u=c;return 1}function Eg(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0;c=a+8|0;d=f[c>>2]|0;e=a+4|0;g=f[e>>2]|0;h=g;if(d-g>>2>>>0>=b>>>0){sj(g|0,0,b<<2|0)|0;f[e>>2]=g+(b<<2);return}i=f[a>>2]|0;j=g-i>>2;g=j+b|0;k=i;if(g>>>0>1073741823)aq(a);l=d-i|0;d=l>>1;m=l>>2>>>0<536870911?(d>>>0>>0?g:d):1073741823;do if(m)if(m>>>0>1073741823){d=ra(8)|0;Oo(d,16035);f[d>>2]=7256;va(d|0,1112,110)}else{n=ln(m<<2)|0;break}else n=0;while(0);d=n+(j<<2)|0;sj(d|0,0,b<<2|0)|0;b=d;j=n+(m<<2)|0;m=n+(g<<2)|0;if((h|0)==(k|0)){o=b;p=i;q=h}else{i=h;h=b;b=d;do{i=i+-4|0;d=f[i>>2]|0;f[i>>2]=0;f[b+-4>>2]=d;b=h+-4|0;h=b}while((i|0)!=(k|0));o=h;p=f[a>>2]|0;q=f[e>>2]|0}f[a>>2]=o;f[e>>2]=m;f[c>>2]=j;j=p;if((q|0)!=(j|0)){c=q;do{c=c+-4|0;q=f[c>>2]|0;f[c>>2]=0;if(q|0)Va[f[(f[q>>2]|0)+4>>2]&127](q)}while((c|0)!=(j|0))}if(!p)return;Oq(p);return}function Fg(a,c,d,e,g,h){a=a|0;c=c|0;d=d|0;e=e|0;g=g|0;h=$(h);var i=0,j=0,k=0,l=0,m=0,n=0;i=u;u=u+16|0;j=i;k=i+4|0;f[j>>2]=c;c=ln(32)|0;f[k>>2]=c;f[k+8>>2]=-2147483616;f[k+4>>2]=17;l=c;m=14495;n=l+17|0;do{b[l>>0]=b[m>>0]|0;l=l+1|0;m=m+1|0}while((l|0)<(n|0));b[c+17>>0]=0;Xj(Hd(a,j)|0,k,d);if((b[k+11>>0]|0)<0)Oq(f[k>>2]|0);d=ln(32)|0;f[k>>2]=d;f[k+8>>2]=-2147483616;f[k+4>>2]=19;l=d;m=14438;n=l+19|0;do{b[l>>0]=b[m>>0]|0;l=l+1|0;m=m+1|0}while((l|0)<(n|0));b[d+19>>0]=0;si(Hd(a,j)|0,k,g,e);if((b[k+11>>0]|0)<0)Oq(f[k>>2]|0);e=ln(32)|0;f[k>>2]=e;f[k+8>>2]=-2147483616;f[k+4>>2]=18;l=e;m=14458;n=l+18|0;do{b[l>>0]=b[m>>0]|0;l=l+1|0;m=m+1|0}while((l|0)<(n|0));b[e+18>>0]=0;Tj(Hd(a,j)|0,k,h);if((b[k+11>>0]|0)>=0){u=i;return}Oq(f[k>>2]|0);u=i;return}function Gg(a){a=a|0;tk(a);tk(a+32|0);tk(a+64|0);tk(a+96|0);tk(a+128|0);tk(a+160|0);tk(a+192|0);tk(a+224|0);tk(a+256|0);tk(a+288|0);tk(a+320|0);tk(a+352|0);tk(a+384|0);tk(a+416|0);tk(a+448|0);tk(a+480|0);tk(a+512|0);tk(a+544|0);tk(a+576|0);tk(a+608|0);tk(a+640|0);tk(a+672|0);tk(a+704|0);tk(a+736|0);tk(a+768|0);tk(a+800|0);tk(a+832|0);tk(a+864|0);tk(a+896|0);tk(a+928|0);tk(a+960|0);tk(a+992|0);tk(a+1024|0);return}function Hg(a){a=a|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;c=u;u=u+16|0;d=c;if(b[a+288>>0]|0){u=c;return 1}e=a+8|0;g=f[e>>2]|0;h=(f[g+12>>2]|0)-(f[g+8>>2]|0)|0;g=h>>2;i=a+172|0;Gi(i,g+-1|0);if(!((g|0)!=1&(h|0)>0)){u=c;return 1}h=a+12|0;a=0;j=0;while(1){k=f[(f[(f[e>>2]|0)+8>>2]|0)+(a<<2)>>2]|0;if(!(f[k+56>>2]|0))l=j;else{m=f[i>>2]|0;f[m+(j*136|0)>>2]=a;n=f[m+(j*136|0)+104>>2]|0;o=m+(j*136|0)+108|0;p=f[o>>2]|0;if((p|0)!=(n|0))f[o>>2]=p+(~((p+-4-n|0)>>>2)<<2);n=f[h>>2]|0;gk(m+(j*136|0)+104|0,(f[n+4>>2]|0)-(f[n>>2]|0)>>2);n=(f[i>>2]|0)+(j*136|0)+116|0;m=f[h>>2]|0;p=(f[m+4>>2]|0)-(f[m>>2]|0)>>2;f[d>>2]=-1;hg(n,p,d);p=f[i>>2]|0;f[p+(j*136|0)+128>>2]=0;Gc(p+(j*136|0)+4|0,f[e>>2]|0,f[h>>2]|0,k)|0;l=j+1|0}a=a+1|0;if((a|0)>=(g|0))break;else j=l}u=c;return 1}function Ig(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0;d=c;e=b;g=d-e|0;h=g>>2;i=a+8|0;j=f[i>>2]|0;k=f[a>>2]|0;l=k;if(h>>>0<=j-k>>2>>>0){m=a+4|0;n=(f[m>>2]|0)-k>>2;o=h>>>0>n>>>0;p=o?b+(n<<2)|0:c;c=p;n=c-e|0;e=n>>2;if(e|0)im(k|0,b|0,n|0)|0;n=l+(e<<2)|0;if(o){o=d-c|0;if((o|0)<=0)return;kh(f[m>>2]|0,p|0,o|0)|0;f[m>>2]=(f[m>>2]|0)+(o>>>2<<2);return}else{o=f[m>>2]|0;if((o|0)==(n|0))return;f[m>>2]=o+(~((o+-4-n|0)>>>2)<<2);return}}n=k;if(!k)q=j;else{j=a+4|0;o=f[j>>2]|0;if((o|0)!=(l|0))f[j>>2]=o+(~((o+-4-k|0)>>>2)<<2);Oq(n);f[i>>2]=0;f[j>>2]=0;f[a>>2]=0;q=0}if(h>>>0>1073741823)aq(a);j=q>>1;n=q>>2>>>0<536870911?(j>>>0>>0?h:j):1073741823;if(n>>>0>1073741823)aq(a);j=ln(n<<2)|0;h=a+4|0;f[h>>2]=j;f[a>>2]=j;f[i>>2]=j+(n<<2);if((g|0)<=0)return;kh(j|0,b|0,g|0)|0;f[h>>2]=j+(g>>>2<<2);return}function Jg(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0.0,p=0,q=0.0,r=0.0,s=0.0,t=0,v=0.0;e=u;u=u+16|0;g=e;h=c+1|0;f[g>>2]=0;i=g+4|0;f[i>>2]=0;f[g+8>>2]=0;do if(h)if(h>>>0>1073741823)aq(g);else{j=ln(h<<2)|0;f[g>>2]=j;k=j+(h<<2)|0;f[g+8>>2]=k;sj(j|0,0,(c<<2)+4|0)|0;f[i>>2]=k;l=j;m=k;n=j;break}else{l=0;m=0;n=0}while(0);if((b|0)>0){g=0;do{j=l+(f[a+(g<<2)>>2]<<2)|0;f[j>>2]=(f[j>>2]|0)+1;g=g+1|0}while((g|0)!=(b|0))}o=+(b|0);if((c|0)<0){p=0;q=0.0}else{c=0;r=0.0;b=0;while(1){g=f[l+(b<<2)>>2]|0;s=+(g|0);if((g|0)>0){t=c+1|0;v=r+ +Zg(s/o)*s}else{t=c;v=r}b=b+1|0;if((b|0)==(h|0)){p=t;q=v;break}else{c=t;r=v}}}if(d|0)f[d>>2]=p;v=-q;p=~~v>>>0;d=+K(v)>=1.0?(v>0.0?~~+Y(+J(v/4294967296.0),4294967295.0)>>>0:~~+W((v-+(~~v>>>0))/4294967296.0)>>>0):0;if(!l){I=d;u=e;return p|0}if((m|0)!=(l|0))f[i>>2]=m+(~((m+-4-l|0)>>>2)<<2);Oq(n);I=d;u=e;return p|0}function Kg(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0;e=u;u=u+16|0;g=e+4|0;h=e;i=ln(32)|0;f[a>>2]=i;f[a+4>>2]=c+4;c=a+8|0;b[c>>0]=0;f[i+16>>2]=f[d>>2];a=i+20|0;f[i+24>>2]=0;f[i+28>>2]=0;j=i+24|0;f[a>>2]=j;i=f[d+4>>2]|0;k=d+8|0;if((i|0)==(k|0)){b[c>>0]=1;u=e;return}d=j;j=i;while(1){i=j+16|0;f[h>>2]=d;f[g>>2]=f[h>>2];ph(a,g,i,i)|0;i=f[j+4>>2]|0;if(!i){l=j+8|0;m=f[l>>2]|0;if((f[m>>2]|0)==(j|0))n=m;else{m=l;do{l=f[m>>2]|0;m=l+8|0;o=f[m>>2]|0}while((f[o>>2]|0)!=(l|0));n=o}}else{m=i;while(1){o=f[m>>2]|0;if(!o)break;else m=o}n=m}if((n|0)==(k|0))break;else j=n}b[c>>0]=1;u=e;return}function Lg(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0;d=u;u=u+16|0;e=d;f[e>>2]=b;g=a+8|0;if(((f[a+12>>2]|0)-(f[g>>2]|0)>>2|0)<=(b|0))Bh(g,b+1|0);h=f[(f[c>>2]|0)+56>>2]|0;do if((h|0)<5){i=a+20+(h*12|0)+4|0;j=f[i>>2]|0;if((j|0)==(f[a+20+(h*12|0)+8>>2]|0)){Ri(a+20+(h*12|0)|0,e);break}else{f[j>>2]=b;f[i>>2]=j+4;break}}while(0);b=f[c>>2]|0;h=f[e>>2]|0;f[b+60>>2]=h;e=(f[g>>2]|0)+(h<<2)|0;f[c>>2]=0;c=f[e>>2]|0;f[e>>2]=b;if(!c){u=d;return}b=c+88|0;e=f[b>>2]|0;f[b>>2]=0;if(e|0){b=f[e+8>>2]|0;if(b|0){h=e+12|0;if((f[h>>2]|0)!=(b|0))f[h>>2]=b;Oq(b)}Oq(e)}e=f[c+68>>2]|0;if(e|0){b=c+72|0;h=f[b>>2]|0;if((h|0)!=(e|0))f[b>>2]=h+(~((h+-4-e|0)>>>2)<<2);Oq(e)}e=c+64|0;h=f[e>>2]|0;f[e>>2]=0;if(h|0){e=f[h>>2]|0;if(e|0){b=h+4|0;if((f[b>>2]|0)!=(e|0))f[b>>2]=e;Oq(e)}Oq(h)}Oq(c);u=d;return}function Mg(a){a=a|0;var b=0,c=0,d=0,e=0,g=0,h=0,i=0;b=u;u=u+16|0;c=b+4|0;d=b;e=a+8|0;g=f[e>>2]|0;gk(f[a+4>>2]|0,(f[g+56>>2]|0)-(f[g+52>>2]|0)>>2);g=a+84|0;a=f[g>>2]|0;if(!a){h=f[(f[e>>2]|0)+64>>2]|0;i=(f[h+4>>2]|0)-(f[h>>2]|0)>>2;h=(i>>>0)/3|0;if(i>>>0<=2){u=b;return 1}i=0;do{f[d>>2]=i*3;f[c>>2]=f[d>>2];Zb(e,c);i=i+1|0}while((i|0)<(h|0));u=b;return 1}else{h=f[a>>2]|0;if((f[a+4>>2]|0)==(h|0)){u=b;return 1}a=0;i=h;do{f[d>>2]=f[i+(a<<2)>>2];f[c>>2]=f[d>>2];Zb(e,c);a=a+1|0;h=f[g>>2]|0;i=f[h>>2]|0}while(a>>>0<(f[h+4>>2]|0)-i>>2>>>0);u=b;return 1}return 0}function Ng(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0;d=u;u=u+48|0;e=d+16|0;g=d;h=d+32|0;i=a+28|0;j=f[i>>2]|0;f[h>>2]=j;k=a+20|0;l=(f[k>>2]|0)-j|0;f[h+4>>2]=l;f[h+8>>2]=b;f[h+12>>2]=c;b=l+c|0;l=a+60|0;f[g>>2]=f[l>>2];f[g+4>>2]=h;f[g+8>>2]=2;j=to(Aa(146,g|0)|0)|0;a:do if((b|0)!=(j|0)){g=2;m=b;n=h;o=j;while(1){if((o|0)<0)break;m=m-o|0;p=f[n+4>>2]|0;q=o>>>0>p>>>0;r=q?n+8|0:n;s=g+(q<<31>>31)|0;t=o-(q?p:0)|0;f[r>>2]=(f[r>>2]|0)+t;p=r+4|0;f[p>>2]=(f[p>>2]|0)-t;f[e>>2]=f[l>>2];f[e+4>>2]=r;f[e+8>>2]=s;o=to(Aa(146,e|0)|0)|0;if((m|0)==(o|0)){v=3;break a}else{g=s;n=r}}f[a+16>>2]=0;f[i>>2]=0;f[k>>2]=0;f[a>>2]=f[a>>2]|32;if((g|0)==2)w=0;else w=c-(f[n+4>>2]|0)|0}else v=3;while(0);if((v|0)==3){v=f[a+44>>2]|0;f[a+16>>2]=v+(f[a+48>>2]|0);a=v;f[i>>2]=a;f[k>>2]=a;w=c}u=d;return w|0}function Og(a){a=a|0;var b=0,c=0,d=0,e=0,g=0,h=0,i=0;f[a>>2]=6192;b=f[a+68>>2]|0;if(b|0){c=a+72|0;d=f[c>>2]|0;if((d|0)!=(b|0))f[c>>2]=d+(~((d+-4-b|0)>>>2)<<2);Oq(b)}b=f[a+56>>2]|0;if(b|0){d=a+60|0;c=f[d>>2]|0;if((c|0)!=(b|0))f[d>>2]=c+(~((c+-4-b|0)>>>2)<<2);Oq(b)}b=f[a+44>>2]|0;if(b|0){c=a+48|0;d=f[c>>2]|0;if((d|0)!=(b|0))f[c>>2]=d+(~((d+-4-b|0)>>>2)<<2);Oq(b)}b=f[a+32>>2]|0;if(b|0){d=a+36|0;c=f[d>>2]|0;if((c|0)!=(b|0))f[d>>2]=c+(~((c+-4-b|0)>>>2)<<2);Oq(b)}b=f[a+20>>2]|0;if(b|0){c=a+24|0;d=f[c>>2]|0;if((d|0)!=(b|0))f[c>>2]=d+(~((d+-4-b|0)>>>2)<<2);Oq(b)}hi(a+8|0);b=a+4|0;a=f[b>>2]|0;f[b>>2]=0;if(!a)return;b=a+40|0;d=f[b>>2]|0;if(d|0){c=a+44|0;e=f[c>>2]|0;if((e|0)==(d|0))g=d;else{h=e;do{e=h+-4|0;f[c>>2]=e;i=f[e>>2]|0;f[e>>2]=0;if(i|0){bj(i);Oq(i)}h=f[c>>2]|0}while((h|0)!=(d|0));g=f[b>>2]|0}Oq(g)}bj(a);Oq(a);return}function Pg(a){a=a|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0;c=a+12|0;d=f[a>>2]|0;e=a+8|0;g=f[e>>2]|0;h=(g|0)==-1;if(!(b[c>>0]|0)){do if(((!h?(i=(((g>>>0)%3|0|0)==0?2:-1)+g|0,(i|0)!=-1):0)?(f[(f[d>>2]|0)+(i>>>5<<2)>>2]&1<<(i&31)|0)==0:0)?(j=f[(f[(f[d+64>>2]|0)+12>>2]|0)+(i<<2)>>2]|0,(j|0)!=-1):0)if(!((j>>>0)%3|0)){k=j+2|0;break}else{k=j+-1|0;break}else k=-1;while(0);f[e>>2]=k;return}k=g+1|0;if(((!h?(h=((k>>>0)%3|0|0)==0?g+-2|0:k,(h|0)!=-1):0)?(f[(f[d>>2]|0)+(h>>>5<<2)>>2]&1<<(h&31)|0)==0:0)?(k=f[(f[(f[d+64>>2]|0)+12>>2]|0)+(h<<2)>>2]|0,h=k+1|0,(k|0)!=-1):0){g=((h>>>0)%3|0|0)==0?k+-2|0:h;f[e>>2]=g;if((g|0)!=-1){if((g|0)!=(f[a+4>>2]|0))return;f[e>>2]=-1;return}}else f[e>>2]=-1;g=f[a+4>>2]|0;do if((((g|0)!=-1?(a=(((g>>>0)%3|0|0)==0?2:-1)+g|0,(a|0)!=-1):0)?(f[(f[d>>2]|0)+(a>>>5<<2)>>2]&1<<(a&31)|0)==0:0)?(h=f[(f[(f[d+64>>2]|0)+12>>2]|0)+(a<<2)>>2]|0,(h|0)!=-1):0)if(!((h>>>0)%3|0)){l=h+2|0;break}else{l=h+-1|0;break}else l=-1;while(0);f[e>>2]=l;b[c>>0]=0;return}function Qg(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;c=a+4|0;d=f[a>>2]|0;e=(f[c>>2]|0)-d>>2;g=e+1|0;if(g>>>0>1073741823)aq(a);h=a+8|0;i=(f[h>>2]|0)-d|0;d=i>>1;j=i>>2>>>0<536870911?(d>>>0>>0?g:d):1073741823;do if(j)if(j>>>0>1073741823){d=ra(8)|0;Oo(d,16035);f[d>>2]=7256;va(d|0,1112,110)}else{k=ln(j<<2)|0;break}else k=0;while(0);d=k+(e<<2)|0;e=d;g=k+(j<<2)|0;j=f[b>>2]|0;f[b>>2]=0;f[d>>2]=j;j=d+4|0;b=f[a>>2]|0;k=f[c>>2]|0;if((k|0)==(b|0)){l=e;m=b;n=b}else{i=k;k=e;e=d;do{i=i+-4|0;d=f[i>>2]|0;f[i>>2]=0;f[e+-4>>2]=d;e=k+-4|0;k=e}while((i|0)!=(b|0));l=k;m=f[a>>2]|0;n=f[c>>2]|0}f[a>>2]=l;f[c>>2]=j;f[h>>2]=g;g=m;if((n|0)!=(g|0)){h=n;do{h=h+-4|0;n=f[h>>2]|0;f[h>>2]=0;if(n|0)Va[f[(f[n>>2]|0)+4>>2]&127](n)}while((h|0)!=(g|0))}if(!m)return;Oq(m);return}function Rg(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0;d=a+4|0;a=f[d>>2]|0;do if(a|0){e=b[c+11>>0]|0;g=e<<24>>24<0;h=g?f[c+4>>2]|0:e&255;e=g?f[c>>2]|0:c;g=d;i=a;a:while(1){j=i;while(1){k=j+16|0;l=b[k+11>>0]|0;m=l<<24>>24<0;n=m?f[j+20>>2]|0:l&255;l=h>>>0>>0?h:n;if((l|0)!=0?(o=Vk(m?f[k>>2]|0:k,e,l)|0,(o|0)!=0):0){if((o|0)>=0)break}else p=6;if((p|0)==6?(p=0,n>>>0>=h>>>0):0)break;n=f[j+4>>2]|0;if(!n){q=g;break a}else j=n}i=f[j>>2]|0;if(!i){q=j;break}else g=j}if((q|0)!=(d|0)){g=q+16|0;i=b[g+11>>0]|0;n=i<<24>>24<0;o=n?f[q+20>>2]|0:i&255;i=o>>>0>>0?o:h;if(i|0?(l=Vk(e,n?f[g>>2]|0:g,i)|0,l|0):0){if((l|0)<0)break;else r=q;return r|0}if(h>>>0>=o>>>0){r=q;return r|0}}}while(0);r=d;return r|0}function Sg(a,b){a=a|0;b=b|0;var c=0,d=0,e=0;c=a+8|0;f[c>>2]=f[b>>2];fg(a+12|0,b+4|0)|0;d=a+44|0;e=b+36|0;f[d>>2]=f[e>>2];f[d+4>>2]=f[e+4>>2];f[d+8>>2]=f[e+8>>2];f[d+12>>2]=f[e+12>>2];if((c|0)==(b|0)){f[a+96>>2]=f[b+88>>2];return}else{ng(a+60|0,f[b+52>>2]|0,f[b+56>>2]|0);ng(a+72|0,f[b+64>>2]|0,f[b+68>>2]|0);ng(a+84|0,f[b+76>>2]|0,f[b+80>>2]|0);f[a+96>>2]=f[b+88>>2];Ig(a+100|0,f[b+92>>2]|0,f[b+96>>2]|0);return}}function Tg(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0;d=a+8|0;e=f[d>>2]|0;g=a+4|0;h=f[g>>2]|0;if(((e-h|0)/12|0)>>>0>=b>>>0){i=b;j=h;do{f[j>>2]=f[c>>2];f[j+4>>2]=f[c+4>>2];f[j+8>>2]=f[c+8>>2];j=(f[g>>2]|0)+12|0;f[g>>2]=j;i=i+-1|0}while((i|0)!=0);return}i=f[a>>2]|0;j=(h-i|0)/12|0;h=j+b|0;if(h>>>0>357913941)aq(a);k=(e-i|0)/12|0;i=k<<1;e=k>>>0<178956970?(i>>>0>>0?h:i):357913941;do if(e)if(e>>>0>357913941){i=ra(8)|0;Oo(i,16035);f[i>>2]=7256;va(i|0,1112,110)}else{l=ln(e*12|0)|0;break}else l=0;while(0);i=l+(j*12|0)|0;j=l+(e*12|0)|0;e=b;b=i;l=i;do{f[b>>2]=f[c>>2];f[b+4>>2]=f[c+4>>2];f[b+8>>2]=f[c+8>>2];b=l+12|0;l=b;e=e+-1|0}while((e|0)!=0);e=f[a>>2]|0;b=(f[g>>2]|0)-e|0;c=i+(((b|0)/-12|0)*12|0)|0;if((b|0)>0)kh(c|0,e|0,b|0)|0;f[a>>2]=c;f[g>>2]=l;f[d>>2]=j;if(!e)return;Oq(e);return}function Ug(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;c=a+4|0;d=f[a>>2]|0;e=(f[c>>2]|0)-d>>2;g=e+1|0;if(g>>>0>1073741823)aq(a);h=a+8|0;i=(f[h>>2]|0)-d|0;d=i>>1;j=i>>2>>>0<536870911?(d>>>0>>0?g:d):1073741823;do if(j)if(j>>>0>1073741823){d=ra(8)|0;Oo(d,16035);f[d>>2]=7256;va(d|0,1112,110)}else{k=ln(j<<2)|0;break}else k=0;while(0);d=k+(e<<2)|0;e=d;g=k+(j<<2)|0;j=f[b>>2]|0;f[b>>2]=0;f[d>>2]=j;j=d+4|0;b=f[a>>2]|0;k=f[c>>2]|0;if((k|0)==(b|0)){l=e;m=b;n=b}else{i=k;k=e;e=d;do{i=i+-4|0;d=f[i>>2]|0;f[i>>2]=0;f[e+-4>>2]=d;e=k+-4|0;k=e}while((i|0)!=(b|0));l=k;m=f[a>>2]|0;n=f[c>>2]|0}f[a>>2]=l;f[c>>2]=j;f[h>>2]=g;g=m;if((n|0)!=(g|0)){h=n;do{h=h+-4|0;n=f[h>>2]|0;f[h>>2]=0;if(n|0){bj(n);Oq(n)}}while((h|0)!=(g|0))}if(!m)return;Oq(m);return}function Vg(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;e=f[b>>2]|0;g=f[a>>2]|0;h=f[d>>2]|0;d=f[h>>2]|0;i=(f[h+4>>2]|0)-d>>3;if(i>>>0<=e>>>0)aq(h);j=d;if(i>>>0<=g>>>0)aq(h);d=f[j+(e<<3)>>2]|0;k=f[c>>2]|0;if(i>>>0<=k>>>0)aq(h);l=j+(g<<3)|0;m=(f[j+(k<<3)>>2]|0)>>>0>>0;if(d>>>0<(f[l>>2]|0)>>>0){if(m){f[a>>2]=k;f[c>>2]=g;n=1;return n|0}f[a>>2]=e;f[b>>2]=g;d=f[c>>2]|0;if(i>>>0<=d>>>0)aq(h);if((f[j+(d<<3)>>2]|0)>>>0>=(f[l>>2]|0)>>>0){n=1;return n|0}f[b>>2]=d;f[c>>2]=g;n=2;return n|0}if(!m){n=0;return n|0}f[b>>2]=k;f[c>>2]=e;e=f[b>>2]|0;c=f[a>>2]|0;if(i>>>0<=e>>>0)aq(h);if(i>>>0<=c>>>0)aq(h);if((f[j+(e<<3)>>2]|0)>>>0>=(f[j+(c<<3)>>2]|0)>>>0){n=1;return n|0}f[a>>2]=e;f[b>>2]=c;n=2;return n|0}function Wg(a){a=a|0;var b=0,c=0,d=0,e=0,g=0,h=0,i=0;b=u;u=u+16|0;c=b+4|0;d=b;e=a+8|0;g=f[e>>2]|0;gk(f[a+4>>2]|0,(f[g+28>>2]|0)-(f[g+24>>2]|0)>>2);g=a+84|0;a=f[g>>2]|0;if(!a){h=f[e>>2]|0;i=(f[h+4>>2]|0)-(f[h>>2]|0)>>2;h=(i>>>0)/3|0;if(i>>>0<=2){u=b;return 1}i=0;do{f[d>>2]=i*3;f[c>>2]=f[d>>2];dc(e,c);i=i+1|0}while((i|0)<(h|0));u=b;return 1}else{h=f[a>>2]|0;if((f[a+4>>2]|0)==(h|0)){u=b;return 1}a=0;i=h;do{f[d>>2]=f[i+(a<<2)>>2];f[c>>2]=f[d>>2];dc(e,c);a=a+1|0;h=f[g>>2]|0;i=f[h>>2]|0}while(a>>>0<(f[h+4>>2]|0)-i>>2>>>0);u=b;return 1}return 0}function Xg(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0;a=u;u=u+16|0;e=a;if(!b){g=0;u=a;return g|0}h=b+96|0;i=b+100|0;f[e>>2]=0;f[e+4>>2]=0;f[e+8>>2]=0;b=f[i>>2]|0;j=f[h>>2]|0;k=(b-j|0)/12|0;l=j;j=b;if(k>>>0>=c>>>0){if(k>>>0>c>>>0?(b=l+(c*12|0)|0,(b|0)!=(j|0)):0)f[i>>2]=j+(~(((j+-12-b|0)>>>0)/12|0)*12|0);if(!c){g=1;u=a;return g|0}}else Tg(h,c-k|0,e);k=0;b=f[h>>2]|0;while(1){j=k*3|0;l=f[d+(j<<2)>>2]|0;m=f[d+(j+1<<2)>>2]|0;n=f[d+(j+2<<2)>>2]|0;j=((f[i>>2]|0)-b|0)/12|0;o=k;k=k+1|0;if(o>>>0>>0){p=b;q=b}else{f[e>>2]=0;f[e+4>>2]=0;f[e+8>>2]=0;Tg(h,k-j|0,e);j=f[h>>2]|0;p=j;q=j}f[p+(o*12|0)>>2]=l;f[p+(o*12|0)+4>>2]=m;f[p+(o*12|0)+8>>2]=n;if((k|0)==(c|0)){g=1;break}else b=q}u=a;return g|0}function Yg(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,g=0,h=0;e=u;u=u+80|0;g=e+36|0;h=e;ao(g,c);Ke(h,b,c);Ph(g,h);Ej(h+24|0,f[h+28>>2]|0);Oj(h+12|0,f[h+16>>2]|0);Ej(h,f[h+4>>2]|0);cj(a,g,d);Ej(g+24|0,f[g+28>>2]|0);Oj(g+12|0,f[g+16>>2]|0);Ej(g,f[g+4>>2]|0);u=e;return}function Zg(a){a=+a;var b=0,c=0,d=0,e=0.0,g=0,h=0,i=0,j=0,k=0,l=0,m=0.0,n=0.0,o=0.0,q=0.0,r=0.0,t=0.0;p[s>>3]=a;b=f[s>>2]|0;c=f[s+4>>2]|0;d=(c|0)<0;do if(d|c>>>0<1048576){if((b|0)==0&(c&2147483647|0)==0){e=-1.0/(a*a);break}if(d){e=(a-a)/0.0;break}else{p[s>>3]=a*18014398509481984.0;g=f[s+4>>2]|0;h=-1077;i=g;j=f[s>>2]|0;k=g;l=9;break}}else if(c>>>0<=2146435071)if((b|0)==0&0==0&(c|0)==1072693248)e=0.0;else{h=-1023;i=c;j=b;k=c;l=9}else e=a;while(0);if((l|0)==9){l=i+614242|0;f[s>>2]=j;f[s+4>>2]=(l&1048575)+1072079006;a=+p[s>>3]+-1.0;m=a*a*.5;n=a/(a+2.0);o=n*n;q=o*o;p[s>>3]=a-m;j=f[s+4>>2]|0;f[s>>2]=0;f[s+4>>2]=j;r=+p[s>>3];t=a-r-m+n*(m+(q*(q*(q*.15313837699209373+.22222198432149784)+.3999999999940942)+o*(q*(q*(q*.14798198605116586+.1818357216161805)+.2857142874366239)+.6666666666666735)));q=r*1.4426950407214463;o=+(h+(l>>>20)|0);m=q+o;e=m+(q+(o-m)+(t*1.4426950407214463+(t+r)*1.6751713164886512e-10))}return +e}function _g(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0;d=u;u=u+16|0;e=d;g=ln(32)|0;f[e>>2]=g;f[e+8>>2]=-2147483616;f[e+4>>2]=17;h=g;i=14390;j=h+17|0;do{b[h>>0]=b[i>>0]|0;h=h+1|0;i=i+1|0}while((h|0)<(j|0));b[g+17>>0]=0;g=c+16|0;i=f[g>>2]|0;if(i){h=g;j=i;a:while(1){i=j;while(1){if((f[i+16>>2]|0)>=(a|0))break;k=f[i+4>>2]|0;if(!k){l=h;break a}else i=k}j=f[i>>2]|0;if(!j){l=i;break}else h=i}if(((l|0)!=(g|0)?(f[l+16>>2]|0)<=(a|0):0)?(a=l+20|0,(Jh(a,e)|0)!=0):0)m=a;else n=10}else n=10;if((n|0)==10)m=c;c=Hk(m,e,-1)|0;if((b[e+11>>0]|0)>=0){o=(c|0)==-1;p=c>>>0>6;q=p?-2:c;r=o?-1:q;u=d;return r|0}Oq(f[e>>2]|0);o=(c|0)==-1;p=c>>>0>6;q=p?-2:c;r=o?-1:q;u=d;return r|0}function $g(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0;d=u;u=u+16|0;e=d;g=f[c>>2]|0;f[c>>2]=0;f[e>>2]=g;Lg(a,b,e);g=f[e>>2]|0;f[e>>2]=0;if(g|0){e=g+88|0;c=f[e>>2]|0;f[e>>2]=0;if(c|0){e=f[c+8>>2]|0;if(e|0){h=c+12|0;if((f[h>>2]|0)!=(e|0))f[h>>2]=e;Oq(e)}Oq(c)}c=f[g+68>>2]|0;if(c|0){e=g+72|0;h=f[e>>2]|0;if((h|0)!=(c|0))f[e>>2]=h+(~((h+-4-c|0)>>>2)<<2);Oq(c)}c=g+64|0;h=f[c>>2]|0;f[c>>2]=0;if(h|0){c=f[h>>2]|0;if(c|0){e=h+4|0;if((f[e>>2]|0)!=(c|0))f[e>>2]=c;Oq(c)}Oq(h)}Oq(g)}g=a+84|0;h=a+88|0;a=f[h>>2]|0;c=f[g>>2]|0;e=a-c>>2;if((e|0)>(b|0)){u=d;return}i=b+1|0;b=a;if(i>>>0>e>>>0){Fh(g,i-e|0);u=d;return}if(i>>>0>=e>>>0){u=d;return}e=c+(i<<2)|0;if((e|0)==(b|0)){u=d;return}f[h>>2]=b+(~((b+-4-e|0)>>>2)<<2);u=d;return}function ah(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0;d=u;u=u+16|0;e=d;g=a+4|0;f[g>>2]=c;f[a+8>>2]=f[c+52>>2];h=f[a+184>>2]|0;i=a+188|0;j=f[i>>2]|0;if((j|0)!=(h|0))f[i>>2]=j+(~((j+-4-h|0)>>>2)<<2);h=f[c+48>>2]|0;c=ln(32)|0;f[e>>2]=c;f[e+8>>2]=-2147483616;f[e+4>>2]=19;j=c;i=15351;k=j+19|0;do{b[j>>0]=b[i>>0]|0;j=j+1|0;i=i+1|0}while((j|0)<(k|0));b[c+19>>0]=0;c=(Jh(h,e)|0)==0;if((b[e+11>>0]|0)<0)Oq(f[e>>2]|0);h=f[(f[g>>2]|0)+48>>2]|0;if(c){c=(mi(h)|0)>5&1;b[a+352>>0]=c;u=d;return 1}c=ln(32)|0;f[e>>2]=c;f[e+8>>2]=-2147483616;f[e+4>>2]=19;j=c;i=15351;k=j+19|0;do{b[j>>0]=b[i>>0]|0;j=j+1|0;i=i+1|0}while((j|0)<(k|0));b[c+19>>0]=0;c=(Yj(h,e,0)|0)&1;b[a+352>>0]=c;if((b[e+11>>0]|0)<0)Oq(f[e>>2]|0);u=d;return 1}function bh(a){a=a|0;var c=0,d=0,e=0,g=0,i=0,j=0,k=0,l=0,m=0;c=a+108|0;d=(f[a+112>>2]|0)-(f[c>>2]|0)|0;e=(d|0)/12|0;g=a+4|0;ci(e,f[(f[g>>2]|0)+44>>2]|0)|0;if(!d)return 1;d=0;a=0;while(1){i=f[c>>2]|0;j=i+(d*12|0)+4|0;ci((f[j>>2]|0)-a|0,f[(f[g>>2]|0)+44>>2]|0)|0;ci((f[j>>2]|0)-(f[i+(d*12|0)>>2]|0)|0,f[(f[g>>2]|0)+44>>2]|0)|0;d=d+1|0;if(d>>>0>=e>>>0)break;else a=f[j>>2]|0}zi(f[(f[g>>2]|0)+44>>2]|0,e,0,0)|0;a=0;do{d=f[(f[g>>2]|0)+44>>2]|0;j=d+16|0;i=f[j+4>>2]|0;if((i|0)>0|(i|0)==0&(f[j>>2]|0)>>>0>0){j=f[d+12>>2]|0;d=j+4|0;i=f[d>>2]|0;k=b[(f[c>>2]|0)+(a*12|0)+8>>0]&1;l=i>>>3;m=i&7;i=(f[j>>2]|0)+l|0;b[i>>0]=(1<>0]|0);i=(f[j>>2]|0)+l|0;b[i>>0]=k<>0]|0);f[d>>2]=(f[d>>2]|0)+1}a=a+1|0}while(a>>>0>>0);eg(f[(f[g>>2]|0)+44>>2]|0);return 1}function ch(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,g=0,h=0;e=u;u=u+80|0;g=e+36|0;h=e;io(g,c);Ke(h,b,c);Ph(g,h);Ej(h+24|0,f[h+28>>2]|0);Oj(h+12|0,f[h+16>>2]|0);Ej(h,f[h+4>>2]|0);cj(a,g,d);Ej(g+24|0,f[g+28>>2]|0);Oj(g+12|0,f[g+16>>2]|0);Ej(g,f[g+4>>2]|0);u=e;return}function dh(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0;d=u;u=u+16|0;e=d;g=a+4|0;f[g>>2]=c;f[a+8>>2]=f[c+52>>2];h=f[a+184>>2]|0;i=a+188|0;j=f[i>>2]|0;if((j|0)!=(h|0))f[i>>2]=j+(~((j+-4-h|0)>>>2)<<2);h=f[c+48>>2]|0;c=ln(32)|0;f[e>>2]=c;f[e+8>>2]=-2147483616;f[e+4>>2]=19;j=c;i=15351;k=j+19|0;do{b[j>>0]=b[i>>0]|0;j=j+1|0;i=i+1|0}while((j|0)<(k|0));b[c+19>>0]=0;c=(Jh(h,e)|0)==0;if((b[e+11>>0]|0)<0)Oq(f[e>>2]|0);h=f[(f[g>>2]|0)+48>>2]|0;if(c){c=(mi(h)|0)>5&1;b[a+288>>0]=c;u=d;return 1}c=ln(32)|0;f[e>>2]=c;f[e+8>>2]=-2147483616;f[e+4>>2]=19;j=c;i=15351;k=j+19|0;do{b[j>>0]=b[i>>0]|0;j=j+1|0;i=i+1|0}while((j|0)<(k|0));b[c+19>>0]=0;c=(Yj(h,e,0)|0)&1;b[a+288>>0]=c;if((b[e+11>>0]|0)<0)Oq(f[e>>2]|0);u=d;return 1}function eh(a,b,c,d,e,g){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;g=g|0;var h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,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a){u=c;return}d=f[j>>2]|0;if((d|0)!=(a|0))f[j>>2]=d+(~(((d+-12-a|0)>>>0)/12|0)*12|0);Oq(a);u=c;return}function gh(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0;if(c>>>0>4294967279)aq(a);d=a+11|0;e=b[d>>0]|0;g=e<<24>>24<0;if(g){h=f[a+4>>2]|0;i=(f[a+8>>2]&2147483647)+-1|0}else{h=e&255;i=10}j=h>>>0>c>>>0?h:c;c=j>>>0<11;k=c?10:(j+16&-16)+-1|0;do if((k|0)!=(i|0)){do if(c){j=f[a>>2]|0;if(g){l=0;m=j;n=a;o=13}else{Fo(a,j,(e&255)+1|0)|0;Oq(j);o=16}}else{j=k+1|0;p=ln(j)|0;if(g){l=1;m=f[a>>2]|0;n=p;o=13;break}else{Fo(p,a,(e&255)+1|0)|0;q=p;r=j;s=a+4|0;o=15;break}}while(0);if((o|0)==13){j=a+4|0;Fo(n,m,(f[j>>2]|0)+1|0)|0;Oq(m);if(l){q=n;r=k+1|0;s=j;o=15}else o=16}if((o|0)==15){f[a+8>>2]=r|-2147483648;f[s>>2]=h;f[a>>2]=q;break}else if((o|0)==16){b[d>>0]=h;break}}while(0);return}function hh(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0;c=f[b>>2]|0;if((c|0)==-1){d=-1;return d|0}b=f[(f[a+24>>2]|0)+(c<<2)>>2]|0;if((b|0)==-1){d=0;return d|0}c=a+12|0;a=0;e=0;g=b;a:while(1){b:do if(e){h=a+1|0;i=(((g>>>0)%3|0|0)==0?2:-1)+g|0;if((i|0)==-1){d=h;j=15;break a}k=f[(f[c>>2]|0)+(i<<2)>>2]|0;if((k|0)==-1){d=h;j=15;break a}if(!((k>>>0)%3|0)){l=k+2|0;m=h;break}else{l=k+-1|0;m=h;break}}else{h=a;k=g;while(1){i=h+1|0;n=k+1|0;o=((n>>>0)%3|0|0)==0?k+-2|0:n;if((o|0)==-1){l=b;m=i;break b}n=f[(f[c>>2]|0)+(o<<2)>>2]|0;o=n+1|0;if((n|0)==-1){l=b;m=i;break b}k=((o>>>0)%3|0|0)==0?n+-2|0:o;if((k|0)==-1){l=b;m=i;break b}if((k|0)==(b|0)){d=i;j=15;break a}else h=i}}while(0);if((l|0)==-1){d=m;j=15;break}else{a=m;e=1;g=l}}if((j|0)==15)return d|0;return 0}function ih(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0;d=a+8|0;Vg(a,a+4|0,d,c)|0;e=a+12|0;if((e|0)==(b|0))return;g=f[c>>2]|0;c=f[g>>2]|0;h=(f[g+4>>2]|0)-c>>3;i=c;c=e;e=d;a:while(1){d=f[c>>2]|0;j=f[e>>2]|0;if(h>>>0<=d>>>0){k=5;break}if(h>>>0<=j>>>0){k=7;break}l=i+(d<<3)|0;if((f[l>>2]|0)>>>0<(f[i+(j<<3)>>2]|0)>>>0){m=e;n=c;o=j;while(1){f[n>>2]=o;if((m|0)==(a|0)){p=a;break}j=m+-4|0;o=f[j>>2]|0;if(h>>>0<=o>>>0){k=11;break a}if((f[l>>2]|0)>>>0>=(f[i+(o<<3)>>2]|0)>>>0){p=m;break}else{q=m;m=j;n=q}}f[p>>2]=d}n=c+4|0;if((n|0)==(b|0)){k=3;break}else{m=c;c=n;e=m}}if((k|0)==3)return;else if((k|0)==5)aq(g);else if((k|0)==7)aq(g);else if((k|0)==11)aq(g)}function jh(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0;g=Vg(a,b,c,e)|0;h=f[d>>2]|0;i=f[c>>2]|0;j=f[e>>2]|0;e=f[j>>2]|0;k=(f[j+4>>2]|0)-e>>3;if(k>>>0<=h>>>0)aq(j);l=e;if(k>>>0<=i>>>0)aq(j);if((f[l+(h<<3)>>2]|0)>>>0>=(f[l+(i<<3)>>2]|0)>>>0){m=g;return m|0}f[c>>2]=h;f[d>>2]=i;i=f[c>>2]|0;d=f[b>>2]|0;if(k>>>0<=i>>>0)aq(j);if(k>>>0<=d>>>0)aq(j);if((f[l+(i<<3)>>2]|0)>>>0>=(f[l+(d<<3)>>2]|0)>>>0){m=g+1|0;return m|0}f[b>>2]=i;f[c>>2]=d;d=f[b>>2]|0;c=f[a>>2]|0;if(k>>>0<=d>>>0)aq(j);if(k>>>0<=c>>>0)aq(j);if((f[l+(d<<3)>>2]|0)>>>0>=(f[l+(c<<3)>>2]|0)>>>0){m=g+2|0;return m|0}f[a>>2]=d;f[b>>2]=c;m=g+3|0;return m|0}function kh(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,h=0;if((d|0)>=8192)return Da(a|0,c|0,d|0)|0;e=a|0;g=a+d|0;if((a&3)==(c&3)){while(a&3){if(!d)return e|0;b[a>>0]=b[c>>0]|0;a=a+1|0;c=c+1|0;d=d-1|0}h=g&-4|0;d=h-64|0;while((a|0)<=(d|0)){f[a>>2]=f[c>>2];f[a+4>>2]=f[c+4>>2];f[a+8>>2]=f[c+8>>2];f[a+12>>2]=f[c+12>>2];f[a+16>>2]=f[c+16>>2];f[a+20>>2]=f[c+20>>2];f[a+24>>2]=f[c+24>>2];f[a+28>>2]=f[c+28>>2];f[a+32>>2]=f[c+32>>2];f[a+36>>2]=f[c+36>>2];f[a+40>>2]=f[c+40>>2];f[a+44>>2]=f[c+44>>2];f[a+48>>2]=f[c+48>>2];f[a+52>>2]=f[c+52>>2];f[a+56>>2]=f[c+56>>2];f[a+60>>2]=f[c+60>>2];a=a+64|0;c=c+64|0}while((a|0)<(h|0)){f[a>>2]=f[c>>2];a=a+4|0;c=c+4|0}}else{h=g-4|0;while((a|0)<(h|0)){b[a>>0]=b[c>>0]|0;b[a+1>>0]=b[c+1>>0]|0;b[a+2>>0]=b[c+2>>0]|0;b[a+3>>0]=b[c+3>>0]|0;a=a+4|0;c=c+4|0}}while((a|0)<(g|0)){b[a>>0]=b[c>>0]|0;a=a+1|0;c=c+1|0}return e|0}function lh(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0;c=u;u=u+16|0;d=c+4|0;e=c;f[a>>2]=1232;g=a+4|0;f[g>>2]=0;f[g+4>>2]=0;f[g+8>>2]=0;f[g+12>>2]=0;f[g+16>>2]=0;f[g+20>>2]=0;f[g+24>>2]=0;f[g+28>>2]=0;f[d>>2]=b;b=a+4|0;g=a+8|0;Ri(b,d);h=f[d>>2]|0;i=a+20|0;j=f[i>>2]|0;k=a+16|0;a=f[k>>2]|0;l=j-a>>2;m=a;if((h|0)<(l|0)){n=m;o=h;p=f[g>>2]|0;q=f[b>>2]|0;r=p-q|0;s=r>>2;t=s+-1|0;v=n+(o<<2)|0;f[v>>2]=t;u=c;return}a=h+1|0;f[e>>2]=-1;w=j;if(a>>>0<=l>>>0)if(a>>>0>>0?(j=m+(a<<2)|0,(j|0)!=(w|0)):0){f[i>>2]=w+(~((w+-4-j|0)>>>2)<<2);x=h;y=m}else{x=h;y=m}else{Ch(k,a-l|0,e);x=f[d>>2]|0;y=f[k>>2]|0}n=y;o=x;p=f[g>>2]|0;q=f[b>>2]|0;r=p-q|0;s=r>>2;t=s+-1|0;v=n+(o<<2)|0;f[v>>2]=t;u=c;return}function mh(a){a=a|0;var b=0,c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0;b=a+4|0;c=f[b>>2]|0;d=(f[c+12>>2]|0)-(f[c+8>>2]|0)|0;c=d>>2;a:do if((d|0)>0){e=0;while(1){if(!(Ra[f[(f[a>>2]|0)+36>>2]&127](a,e)|0)){g=0;break}e=e+1|0;h=f[b>>2]|0;i=(f[h+12>>2]|0)-(f[h+8>>2]|0)>>2;if((e|0)>=(i|0)){j=i;break a}}return g|0}else j=c;while(0);c=a+20|0;b=a+24|0;d=f[b>>2]|0;e=f[c>>2]|0;i=d-e>>2;h=e;e=d;if(j>>>0<=i>>>0){if(j>>>0>>0?(d=h+(j<<2)|0,(d|0)!=(e|0)):0)f[b>>2]=e+(~((e+-4-d|0)>>>2)<<2)}else Ci(c,j-i|0);i=f[a+12>>2]|0;j=f[a+8>>2]|0;a=j;if((i|0)==(j|0)){g=1;return g|0}d=i-j>>2;j=0;do{i=f[a+(j<<2)>>2]|0;e=f[i+8>>2]|0;b=f[i+4>>2]|0;i=b;if((e|0)!=(b|0)?(h=f[c>>2]|0,k=e-b>>2,f[h+(f[i>>2]<<2)>>2]=j,k>>>0>1):0){b=1;do{f[h+(f[i+(b<<2)>>2]<<2)>>2]=j;b=b+1|0}while(b>>>0>>0)}j=j+1|0}while(j>>>0>>0);g=1;return g|0}function nh(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0;d=f[c+88>>2]|0;if(!d){e=0;return e|0}if((f[d>>2]|0)!=1){e=0;return e|0}g=d+8|0;d=f[g>>2]|0;f[a+4>>2]=h[d>>0]|h[d+1>>0]<<8|h[d+2>>0]<<16|h[d+3>>0]<<24;i=a+8|0;j=c+24|0;c=b[j>>0]|0;k=c<<24>>24;l=a+12|0;m=f[l>>2]|0;n=f[i>>2]|0;o=m-n>>2;p=n;n=m;if(o>>>0>=k>>>0)if(o>>>0>k>>>0?(m=p+(k<<2)|0,(m|0)!=(n|0)):0){f[l>>2]=n+(~((n+-4-m|0)>>>2)<<2);q=c;r=d}else{q=c;r=d}else{Ci(i,k-o|0);q=b[j>>0]|0;r=f[g>>2]|0}g=r+4|0;j=h[g>>0]|h[g+1>>0]<<8|h[g+2>>0]<<16|h[g+3>>0]<<24;if(q<<24>>24>0){g=f[i>>2]|0;i=q<<24>>24;q=j;o=4;k=0;while(1){f[g+(k<<2)>>2]=q;o=o+4|0;k=k+1|0;d=r+o|0;c=h[d>>0]|h[d+1>>0]<<8|h[d+2>>0]<<16|h[d+3>>0]<<24;if((k|0)>=(i|0)){s=c;break}else q=c}}else s=j;f[a+20>>2]=s;e=1;return e|0}function oh(a,c,d,e,g){a=a|0;c=c|0;d=d|0;e=e|0;g=g|0;var h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0;do if(!(fp(a,f[c+8>>2]|0,g)|0)){if(!(fp(a,f[c>>2]|0,g)|0)){h=f[a+8>>2]|0;Za[f[(f[h>>2]|0)+24>>2]&3](h,c,d,e,g);break}if((f[c+16>>2]|0)!=(d|0)?(h=c+20|0,(f[h>>2]|0)!=(d|0)):0){f[c+32>>2]=e;i=c+44|0;if((f[i>>2]|0)==4)break;j=c+52|0;b[j>>0]=0;k=c+53|0;b[k>>0]=0;l=f[a+8>>2]|0;_a[f[(f[l>>2]|0)+20>>2]&3](l,c,d,d,1,g);if(b[k>>0]|0)if(!(b[j>>0]|0)){m=3;n=11}else o=3;else{m=4;n=11}if((n|0)==11){f[h>>2]=d;h=c+40|0;f[h>>2]=(f[h>>2]|0)+1;if((f[c+36>>2]|0)==1?(f[c+24>>2]|0)==2:0){b[c+54>>0]=1;o=m}else o=m}f[i>>2]=o;break}if((e|0)==1)f[c+32>>2]=1}else Vm(0,c,d,e);while(0);return}function ph(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0;e=u;u=u+16|0;g=e+12|0;h=e+8|0;i=e;f[i>>2]=f[b>>2];f[g>>2]=f[i>>2];i=Kd(a,g,h,e+4|0,c)|0;c=f[i>>2]|0;if(c|0){j=c;u=e;return j|0}c=ln(40)|0;pj(c+16|0,d);pj(c+28|0,d+12|0);d=f[h>>2]|0;f[c>>2]=0;f[c+4>>2]=0;f[c+8>>2]=d;f[i>>2]=c;d=f[f[a>>2]>>2]|0;if(!d)k=c;else{f[a>>2]=d;k=f[i>>2]|0}Oe(f[a+4>>2]|0,k);k=a+8|0;f[k>>2]=(f[k>>2]|0)+1;j=c;u=e;return j|0}function qh(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0;e=u;u=u+16|0;g=e;h=a+4|0;f[h>>2]=0;if(!c){u=e;return}i=a+8|0;j=f[i>>2]|0;k=j<<5;if(k>>>0>>0){f[g>>2]=0;l=g+4|0;f[l>>2]=0;m=g+8|0;f[m>>2]=0;if((c|0)<0)aq(a);n=j<<6;j=c+31&-32;vi(g,k>>>0<1073741823?(n>>>0>>0?j:n):2147483647);n=f[a>>2]|0;f[a>>2]=f[g>>2];f[g>>2]=n;g=f[h>>2]|0;f[h>>2]=c;f[l>>2]=g;g=f[i>>2]|0;f[i>>2]=f[m>>2];f[m>>2]=g;if(n|0)Oq(n);o=a}else{f[h>>2]=c;o=a}a=f[o>>2]|0;o=a;h=a;a=c>>>5;n=a<<2;if(!(b[d>>0]|0)){sj(h|0,0,n|0)|0;d=c&31;g=o+(a<<2)|0;if(!d){u=e;return}f[g>>2]=f[g>>2]&~(-1>>>(32-d|0));u=e;return}else{sj(h|0,-1,n|0)|0;n=c&31;c=o+(a<<2)|0;if(!n){u=e;return}f[c>>2]=f[c>>2]|-1>>>(32-n|0);u=e;return}}function rh(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;c=u;u=u+16|0;d=c+8|0;e=c+4|0;g=c;f[g>>2]=f[a+12>>2];h=b+16|0;i=h;j=f[i>>2]|0;k=f[i+4>>2]|0;if((k|0)>0|(k|0)==0&j>>>0>0){l=k;m=j}else{f[e>>2]=f[b+4>>2];f[d>>2]=f[e>>2];Me(b,d,g,g+4|0)|0;j=h;l=f[j+4>>2]|0;m=f[j>>2]|0}f[g>>2]=f[a+20>>2];if((l|0)>0|(l|0)==0&m>>>0>0){n=a+88|0;ld(n,b);u=c;return 1}f[e>>2]=f[b+4>>2];f[d>>2]=f[e>>2];Me(b,d,g,g+4|0)|0;n=a+88|0;ld(n,b);u=c;return 1}function sh(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;c=u;u=u+16|0;d=c+8|0;e=c+4|0;g=c;f[g>>2]=f[a+12>>2];h=b+16|0;i=h;j=f[i>>2]|0;k=f[i+4>>2]|0;if((k|0)>0|(k|0)==0&j>>>0>0){l=k;m=j}else{f[e>>2]=f[b+4>>2];f[d>>2]=f[e>>2];Me(b,d,g,g+4|0)|0;j=h;l=f[j+4>>2]|0;m=f[j>>2]|0}f[g>>2]=f[a+16>>2];if((l|0)>0|(l|0)==0&m>>>0>0){n=a+108|0;ld(n,b);u=c;return 1}f[e>>2]=f[b+4>>2];f[d>>2]=f[e>>2];Me(b,d,g,g+4|0)|0;n=a+108|0;ld(n,b);u=c;return 1}function th(a){a=a|0;var c=0,d=0,e=0,g=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0;c=a+32|0;d=f[a+64>>2]|0;e=(Qa[f[(f[d>>2]|0)+40>>2]&127](d)|0)+52|0;d=f[e>>2]|0;zi(c,(((f[d+100>>2]|0)-(f[d+96>>2]|0)|0)/12|0)*3|0,0,1)|0;d=a+68|0;e=f[d>>2]|0;g=(f[a+72>>2]|0)-e|0;if((g|0)<=0){eg(c);return}i=a+48|0;j=a+44|0;a=(g>>>2)+-1|0;g=e;while(1){e=f[g+(a<<2)>>2]|0;k=f[3524+(e<<2)>>2]|0;l=i;m=f[l+4>>2]|0;if((m|0)>0|(m|0)==0&(f[l>>2]|0)>>>0>0?(l=f[j>>2]|0,171>>>e&1|0):0){m=l+4|0;n=0;o=f[m>>2]|0;do{p=o>>>3;q=o&7;r=(f[l>>2]|0)+p|0;b[r>>0]=(1<>0]|0);r=(f[l>>2]|0)+p|0;b[r>>0]=(e>>>n&1)<>0]|0);o=(f[m>>2]|0)+1|0;f[m>>2]=o;n=n+1|0}while((n|0)!=(k|0))}k=a+-1|0;if((k|0)<=-1)break;a=k;g=f[d>>2]|0}eg(c);return}function uh(a,c,d,e){a=a|0;c=c|0;d=d|0;e=e|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0;g=u;u=u+48|0;h=g;i=g+32|0;if(!c){j=0;u=g;return j|0}Gn(h);do if((dm(c,0)|0)!=-1){if(d){if(!(Qa[f[(f[c>>2]|0)+16>>2]&127](c)|0)){k=0;break}Va[f[(f[c>>2]|0)+20>>2]&127](c)}Yg(i,a,c,h);l=(f[i>>2]|0)==0;m=i+4|0;if((b[m+11>>0]|0)<0)Oq(f[m>>2]|0);if(l){l=f[h>>2]|0;m=h+4|0;rg(e,l,l+((f[m>>2]|0)-l)|0);k=(f[m>>2]|0)-(f[h>>2]|0)|0}else k=0}else k=0;while(0);e=h+12|0;i=f[e>>2]|0;f[e>>2]=0;if(i|0)Oq(i);i=f[h>>2]|0;if(i|0){e=h+4|0;if((f[e>>2]|0)!=(i|0))f[e>>2]=i;Oq(i)}j=k;u=g;return j|0}function vh(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0;c=u;u=u+16|0;d=c;e=f[(f[a>>2]|0)+8>>2]|0;g=a+8|0;h=a+12|0;i=(f[h>>2]|0)-(f[g>>2]|0)>>2;j=f[b>>2]|0;f[b>>2]=0;f[d>>2]=j;Xa[e&15](a,i,d);i=f[d>>2]|0;f[d>>2]=0;if(!i){k=f[h>>2]|0;l=f[g>>2]|0;m=k-l|0;n=m>>2;o=n+-1|0;u=c;return o|0}d=i+88|0;a=f[d>>2]|0;f[d>>2]=0;if(a|0){d=f[a+8>>2]|0;if(d|0){e=a+12|0;if((f[e>>2]|0)!=(d|0))f[e>>2]=d;Oq(d)}Oq(a)}a=f[i+68>>2]|0;if(a|0){d=i+72|0;e=f[d>>2]|0;if((e|0)!=(a|0))f[d>>2]=e+(~((e+-4-a|0)>>>2)<<2);Oq(a)}a=i+64|0;e=f[a>>2]|0;f[a>>2]=0;if(e|0){a=f[e>>2]|0;if(a|0){d=e+4|0;if((f[d>>2]|0)!=(a|0))f[d>>2]=a;Oq(a)}Oq(e)}Oq(i);k=f[h>>2]|0;l=f[g>>2]|0;m=k-l|0;n=m>>2;o=n+-1|0;u=c;return o|0}function wh(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0;c=a+8|0;d=f[c>>2]|0;e=a+4|0;g=f[e>>2]|0;if(d-g>>3>>>0>=b>>>0){h=b;i=g;do{j=i;f[j>>2]=0;f[j+4>>2]=0;i=(f[e>>2]|0)+8|0;f[e>>2]=i;h=h+-1|0}while((h|0)!=0);return}h=f[a>>2]|0;i=g-h>>3;g=i+b|0;if(g>>>0>536870911)aq(a);j=d-h|0;h=j>>2;d=j>>3>>>0<268435455?(h>>>0>>0?g:h):536870911;do if(d)if(d>>>0>536870911){h=ra(8)|0;Oo(h,16035);f[h>>2]=7256;va(h|0,1112,110)}else{k=ln(d<<3)|0;break}else k=0;while(0);h=k+(i<<3)|0;i=k+(d<<3)|0;d=b;b=h;k=h;do{g=b;f[g>>2]=0;f[g+4>>2]=0;b=k+8|0;k=b;d=d+-1|0}while((d|0)!=0);d=f[a>>2]|0;b=(f[e>>2]|0)-d|0;g=h+(0-(b>>3)<<3)|0;if((b|0)>0)kh(g|0,d|0,b|0)|0;f[a>>2]=g;f[e>>2]=k;f[c>>2]=i;if(!d)return;Oq(d);return}function xh(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0;d=u;u=u+16|0;e=d;if(!(bn(a,b,c)|0)){g=0;u=d;return g|0}if((Qa[f[(f[a>>2]|0)+32>>2]&127](a)|0)<<24>>24==1?((f[(f[a+8>>2]|0)+28>>2]|0)+-1|0)>>>0>=6:0){g=0;u=d;return g|0}h=_g(c,f[b+48>>2]|0)|0;Xa[f[(f[a>>2]|0)+48>>2]&15](e,a,h);h=a+36|0;b=f[e>>2]|0;f[e>>2]=0;c=f[h>>2]|0;f[h>>2]=b;if(!c){f[e>>2]=0;i=b}else{Va[f[(f[c>>2]|0)+4>>2]&127](c);c=f[e>>2]|0;f[e>>2]=0;if(c|0)Va[f[(f[c>>2]|0)+4>>2]&127](c);i=f[h>>2]|0}if(!i){g=1;u=d;return g|0}if(Ra[f[(f[a>>2]|0)+36>>2]&127](a,i)|0){g=1;u=d;return g|0}i=f[h>>2]|0;f[h>>2]=0;if(!i){g=1;u=d;return g|0}Va[f[(f[i>>2]|0)+4>>2]&127](i);g=1;u=d;return g|0}function yh(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;e=u;u=u+16|0;g=e+4|0;h=e;i=e+8|0;j=a&255;b[i>>0]=j&127;do if(c>>>0>0|(c|0)==0&a>>>0>127){b[i>>0]=j|-128;k=d+16|0;l=f[k+4>>2]|0;if((l|0)>0|(l|0)==0&(f[k>>2]|0)>>>0>0){m=0;break}else{f[h>>2]=f[d+4>>2];f[g>>2]=f[h>>2];Me(d,g,i,i+1|0)|0;k=Yn(a|0,c|0,7)|0;m=yh(k,I,d)|0;break}}else{k=d+16|0;l=f[k+4>>2]|0;if((l|0)>0|(l|0)==0&(f[k>>2]|0)>>>0>0){m=0;break}f[h>>2]=f[d+4>>2];f[g>>2]=f[h>>2];Me(d,g,i,i+1|0)|0;n=1;u=e;return n|0}while(0);n=m;u=e;return n|0}function zh(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;var g=0,h=0,i=0;g=f[(f[(f[d+4>>2]|0)+8>>2]|0)+(c<<2)>>2]|0;if((b|0)==-1)h=Xi(c,d)|0;else h=b;if((h|0)==-2)i=0;else{do if((Qa[f[(f[d>>2]|0)+8>>2]&127](d)|0)==1){Xf(a,d,h,c,e,514);if(!(f[a>>2]|0)){f[a>>2]=0;break}else return}while(0);c=ln(44)|0;f[c>>2]=1544;f[c+4>>2]=g;g=c+8|0;f[g>>2]=f[e>>2];f[g+4>>2]=f[e+4>>2];f[g+8>>2]=f[e+8>>2];f[g+12>>2]=f[e+12>>2];f[g+16>>2]=f[e+16>>2];f[g+20>>2]=f[e+20>>2];fk(c+32|0,e+24|0);f[c>>2]=1600;i=c}f[a>>2]=i;return}function Ah(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0;e=u;u=u+224|0;g=e+120|0;h=e+80|0;i=e;j=e+136|0;k=h;l=k+40|0;do{f[k>>2]=0;k=k+4|0}while((k|0)<(l|0));f[g>>2]=f[d>>2];if((qb(0,c,g,i,h)|0)<0)m=-1;else{if((f[a+76>>2]|0)>-1)n=Tq(a)|0;else n=0;d=f[a>>2]|0;k=d&32;if((b[a+74>>0]|0)<1)f[a>>2]=d&-33;d=a+48|0;if(!(f[d>>2]|0)){l=a+44|0;o=f[l>>2]|0;f[l>>2]=j;p=a+28|0;f[p>>2]=j;q=a+20|0;f[q>>2]=j;f[d>>2]=80;r=a+16|0;f[r>>2]=j+80;j=qb(a,c,g,i,h)|0;if(!o)s=j;else{Sa[f[a+36>>2]&31](a,0,0)|0;t=(f[q>>2]|0)==0?-1:j;f[l>>2]=o;f[d>>2]=0;f[r>>2]=0;f[p>>2]=0;f[q>>2]=0;s=t}}else s=qb(a,c,g,i,h)|0;h=f[a>>2]|0;f[a>>2]=h|k;if(n|0)Sq(a);m=(h&32|0)==0?s:-1}u=e;return m|0}function Bh(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0;c=a+4|0;d=f[c>>2]|0;e=f[a>>2]|0;g=d-e>>2;h=d;if(g>>>0>>0){uf(a,b-g|0);return}if(g>>>0<=b>>>0)return;g=e+(b<<2)|0;if((g|0)==(h|0))return;else i=h;do{h=i+-4|0;f[c>>2]=h;b=f[h>>2]|0;f[h>>2]=0;if(b|0){h=b+88|0;e=f[h>>2]|0;f[h>>2]=0;if(e|0){h=f[e+8>>2]|0;if(h|0){a=e+12|0;if((f[a>>2]|0)!=(h|0))f[a>>2]=h;Oq(h)}Oq(e)}e=f[b+68>>2]|0;if(e|0){h=b+72|0;a=f[h>>2]|0;if((a|0)!=(e|0))f[h>>2]=a+(~((a+-4-e|0)>>>2)<<2);Oq(e)}e=b+64|0;a=f[e>>2]|0;f[e>>2]=0;if(a|0){e=f[a>>2]|0;if(e|0){h=a+4|0;if((f[h>>2]|0)!=(e|0))f[h>>2]=e;Oq(e)}Oq(a)}Oq(b)}i=f[c>>2]|0}while((i|0)!=(g|0));return}function Ch(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0;d=a+8|0;e=f[d>>2]|0;g=a+4|0;h=f[g>>2]|0;i=h;if(e-h>>2>>>0>=b>>>0){j=b;k=i;while(1){f[k>>2]=f[c>>2];j=j+-1|0;if(!j)break;else k=k+4|0}f[g>>2]=i+(b<<2);return}i=f[a>>2]|0;k=h-i|0;h=k>>2;j=h+b|0;if(j>>>0>1073741823)aq(a);l=e-i|0;e=l>>1;m=l>>2>>>0<536870911?(e>>>0>>0?j:e):1073741823;do if(m)if(m>>>0>1073741823){e=ra(8)|0;Oo(e,16035);f[e>>2]=7256;va(e|0,1112,110)}else{e=ln(m<<2)|0;n=e;o=e;break}else{n=0;o=0}while(0);e=n+(h<<2)|0;h=n+(m<<2)|0;m=b;j=e;while(1){f[j>>2]=f[c>>2];m=m+-1|0;if(!m)break;else j=j+4|0}if((k|0)>0)kh(o|0,i|0,k|0)|0;f[a>>2]=n;f[g>>2]=e+(b<<2);f[d>>2]=h;if(!i)return;Oq(i);return}function Dh(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0;e=(f[a>>2]|0)+1794895138|0;g=gp(f[a+8>>2]|0,e)|0;h=gp(f[a+12>>2]|0,e)|0;i=gp(f[a+16>>2]|0,e)|0;a:do if((g>>>0>>2>>>0?(j=c-(g<<2)|0,h>>>0>>0&i>>>0>>0):0)?((i|h)&3|0)==0:0){j=h>>>2;k=i>>>2;l=0;m=g;while(1){n=m>>>1;o=l+n|0;p=o<<1;q=p+j|0;r=gp(f[a+(q<<2)>>2]|0,e)|0;s=gp(f[a+(q+1<<2)>>2]|0,e)|0;if(!(s>>>0>>0&r>>>0<(c-s|0)>>>0)){t=0;break a}if(b[a+(s+r)>>0]|0){t=0;break a}r=hl(d,a+s|0)|0;if(!r)break;s=(r|0)<0;if((m|0)==1){t=0;break a}else{l=s?l:o;m=s?n:m-n|0}}m=p+k|0;l=gp(f[a+(m<<2)>>2]|0,e)|0;j=gp(f[a+(m+1<<2)>>2]|0,e)|0;if(j>>>0>>0&l>>>0<(c-j|0)>>>0)t=(b[a+(j+l)>>0]|0)==0?a+j|0:0;else t=0}else t=0;while(0);return t|0}function Eh(a,c,e,g){a=a|0;c=c|0;e=e|0;g=g|0;var h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0;h=u;u=u+64|0;i=h;j=f[a>>2]|0;k=a+(f[j+-8>>2]|0)|0;l=f[j+-4>>2]|0;f[i>>2]=e;f[i+4>>2]=a;f[i+8>>2]=c;f[i+12>>2]=g;g=i+16|0;c=i+20|0;a=i+24|0;j=i+28|0;m=i+32|0;n=i+40|0;o=g;p=o+36|0;do{f[o>>2]=0;o=o+4|0}while((o|0)<(p|0));d[g+36>>1]=0;b[g+38>>0]=0;a:do if(fp(l,e,0)|0){f[i+48>>2]=1;_a[f[(f[l>>2]|0)+20>>2]&3](l,i,k,k,1,0);q=(f[a>>2]|0)==1?k:0}else{Za[f[(f[l>>2]|0)+24>>2]&3](l,i,k,1,0);switch(f[i+36>>2]|0){case 0:{q=(f[n>>2]|0)==1&(f[j>>2]|0)==1&(f[m>>2]|0)==1?f[c>>2]|0:0;break a;break}case 1:break;default:{q=0;break a}}if((f[a>>2]|0)!=1?!((f[n>>2]|0)==0&(f[j>>2]|0)==1&(f[m>>2]|0)==1):0){q=0;break}q=f[g>>2]|0}while(0);u=h;return q|0}function Fh(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;c=a+8|0;d=f[c>>2]|0;e=a+4|0;g=f[e>>2]|0;h=g;if(d-g>>2>>>0>=b>>>0){i=b;j=h;while(1){f[j>>2]=1;i=i+-1|0;if(!i)break;else j=j+4|0}f[e>>2]=h+(b<<2);return}h=f[a>>2]|0;j=g-h|0;g=j>>2;i=g+b|0;if(i>>>0>1073741823)aq(a);k=d-h|0;d=k>>1;l=k>>2>>>0<536870911?(d>>>0>>0?i:d):1073741823;do if(l)if(l>>>0>1073741823){d=ra(8)|0;Oo(d,16035);f[d>>2]=7256;va(d|0,1112,110)}else{d=ln(l<<2)|0;m=d;n=d;break}else{m=0;n=0}while(0);d=m+(g<<2)|0;g=m+(l<<2)|0;l=b;i=d;while(1){f[i>>2]=1;l=l+-1|0;if(!l)break;else i=i+4|0}if((j|0)>0)kh(n|0,h|0,j|0)|0;f[a>>2]=m;f[e>>2]=d+(b<<2);f[c>>2]=g;if(!h)return;Oq(h);return}function Gh(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0;d=u;u=u+16|0;e=d;if(!c){g=0;u=d;return g|0}h=a+84|0;i=f[h>>2]|0;j=a+88|0;k=f[j>>2]|0;if((k|0)!=(i|0))f[j>>2]=k+(~((k+-4-i|0)>>>2)<<2);f[h>>2]=0;f[j>>2]=0;f[a+92>>2]=0;if(i|0)Oq(i);i=a+72|0;j=f[i>>2]|0;h=a+76|0;if((f[h>>2]|0)!=(j|0))f[h>>2]=j;f[i>>2]=0;f[h>>2]=0;f[a+80>>2]=0;if(j|0)Oq(j);j=c+4|0;h=(f[j>>2]|0)-(f[c>>2]|0)>>2;b[e>>0]=0;qh(a,h,e);h=c+24|0;i=c+28|0;k=(f[i>>2]|0)-(f[h>>2]|0)>>2;b[e>>0]=0;qh(a+12|0,k,e);hg(a+28|0,(f[j>>2]|0)-(f[c>>2]|0)>>2,6180);gk(a+52|0,(f[i>>2]|0)-(f[h>>2]|0)>>2);gk(a+40|0,(f[i>>2]|0)-(f[h>>2]|0)>>2);f[a+64>>2]=c;b[a+24>>0]=1;g=1;u=d;return g|0}function Hh(a){a=a|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0;c=a+12|0;d=f[a>>2]|0;e=a+8|0;g=f[e>>2]|0;h=(g|0)==-1;if(!(b[c>>0]|0)){do if((!h?(i=(((g>>>0)%3|0|0)==0?2:-1)+g|0,(i|0)!=-1):0)?(j=f[(f[d+12>>2]|0)+(i<<2)>>2]|0,(j|0)!=-1):0)if(!((j>>>0)%3|0)){k=j+2|0;break}else{k=j+-1|0;break}else k=-1;while(0);f[e>>2]=k;return}k=g+1|0;if((!h?(h=((k>>>0)%3|0|0)==0?g+-2|0:k,(h|0)!=-1):0)?(k=f[(f[d+12>>2]|0)+(h<<2)>>2]|0,h=k+1|0,(k|0)!=-1):0){g=((h>>>0)%3|0|0)==0?k+-2|0:h;f[e>>2]=g;if((g|0)!=-1){if((g|0)!=(f[a+4>>2]|0))return;f[e>>2]=-1;return}}else f[e>>2]=-1;g=f[a+4>>2]|0;do if(((g|0)!=-1?(a=(((g>>>0)%3|0|0)==0?2:-1)+g|0,(a|0)!=-1):0)?(h=f[(f[d+12>>2]|0)+(a<<2)>>2]|0,(h|0)!=-1):0)if(!((h>>>0)%3|0)){l=h+2|0;break}else{l=h+-1|0;break}else l=-1;while(0);f[e>>2]=l;b[c>>0]=0;return}function Ih(a,b){a=a|0;b=b|0;var c=0,d=Oa,e=0,g=0;if((b|0)!=1)if(!(b+-1&b))c=b;else c=cb(b)|0;else c=2;b=f[a+4>>2]|0;if(c>>>0>b>>>0){Td(a,c);return}if(c>>>0>=b>>>0)return;d=$((f[a+12>>2]|0)>>>0);e=~~$(W($(d/$(n[a+20>>2]))))>>>0;if(b>>>0>2&(b+-1&b|0)==0)g=1<<32-(_(e+-1|0)|0);else g=cb(e)|0;e=c>>>0>>0?g:c;if(e>>>0>=b>>>0)return;Td(a,e);return}function Jh(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;d=f[a+4>>2]|0;if(!d){e=0;return e|0}a=b[c+11>>0]|0;g=a<<24>>24<0;h=g?f[c+4>>2]|0:a&255;a=g?f[c>>2]|0:c;c=d;while(1){d=c+16|0;g=b[d+11>>0]|0;i=g<<24>>24<0;j=i?f[c+20>>2]|0:g&255;g=j>>>0>>0;k=g?j:h;if((k|0)!=0?(l=Vk(a,i?f[d>>2]|0:d,k)|0,(l|0)!=0):0)if((l|0)<0)m=7;else m=8;else if(h>>>0>>0)m=7;else m=8;if((m|0)==7){m=0;n=c}else if((m|0)==8){m=0;l=h>>>0>>0?h:j;if((l|0)!=0?(j=Vk(i?f[d>>2]|0:d,a,l)|0,(j|0)!=0):0){if((j|0)>=0){e=1;m=14;break}}else m=10;if((m|0)==10?(m=0,!g):0){e=1;m=14;break}n=c+4|0}c=f[n>>2]|0;if(!c){e=0;m=14;break}}if((m|0)==14)return e|0;return 0}function Kh(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0;e=u;u=u+16|0;g=e+4|0;h=e;i=f[a+8>>2]|0;j=i+24|0;k=b[j>>0]|0;l=c+4|0;ag(a,(f[l>>2]|0)-(f[c>>2]|0)>>2,k,d);d=f[a+32>>2]|0;a=(f[f[d>>2]>>2]|0)+(f[d+48>>2]|0)|0;d=f[c>>2]|0;c=f[l>>2]|0;if((d|0)==(c|0)){m=1;u=e;return m|0}l=i+84|0;n=i+68|0;o=0;p=d;while(1){d=f[p>>2]|0;if(!(b[l>>0]|0))q=f[(f[n>>2]|0)+(d<<2)>>2]|0;else q=d;f[h>>2]=q;d=b[j>>0]|0;f[g>>2]=f[h>>2];if(!(Qb(i,g,d,a+(o<<2)|0)|0)){m=0;r=7;break}p=p+4|0;if((p|0)==(c|0)){m=1;r=7;break}else o=o+k|0}if((r|0)==7){u=e;return m|0}return 0}function Lh(a){a=a|0;var b=0,c=0,d=0,e=0,g=0,h=0,i=0;f[a>>2]=1408;b=a+72|0;c=f[b>>2]|0;f[b>>2]=0;if(c|0)Va[f[(f[c>>2]|0)+4>>2]&127](c);c=f[a+60>>2]|0;if(c|0){b=a+64|0;d=f[b>>2]|0;if((d|0)!=(c|0))f[b>>2]=d+(~((d+-4-c|0)>>>2)<<2);Oq(c)}c=f[a+48>>2]|0;if(c|0)Oq(c);c=a+36|0;d=f[c>>2]|0;if(d|0){b=a+40|0;e=f[b>>2]|0;if((e|0)==(d|0))g=d;else{h=e;do{e=h+-4|0;f[b>>2]=e;i=f[e>>2]|0;f[e>>2]=0;if(i|0)Va[f[(f[i>>2]|0)+4>>2]&127](i);h=f[b>>2]|0}while((h|0)!=(d|0));g=f[c>>2]|0}Oq(g)}f[a>>2]=1232;g=f[a+16>>2]|0;if(g|0){c=a+20|0;d=f[c>>2]|0;if((d|0)!=(g|0))f[c>>2]=d+(~((d+-4-g|0)>>>2)<<2);Oq(g)}g=f[a+4>>2]|0;if(!g)return;d=a+8|0;a=f[d>>2]|0;if((a|0)!=(g|0))f[d>>2]=a+(~((a+-4-g|0)>>>2)<<2);Oq(g);return}function Mh(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;f[a>>2]=d;e=a+24|0;g=a+28|0;h=f[g>>2]|0;i=f[e>>2]|0;j=h-i>>2;k=i;i=h;if(j>>>0>=d>>>0){if(j>>>0>d>>>0?(h=k+(d<<2)|0,(h|0)!=(i|0)):0)f[g>>2]=i+(~((i+-4-h|0)>>>2)<<2)}else Ci(e,d-j|0);if(!c)return;j=f[b>>2]|0;if((c|0)>1){d=j;e=j;h=1;while(1){i=f[b+(h<<2)>>2]|0;g=(i|0)<(e|0);k=g?i:e;l=g?d:(i|0)>(d|0)?i:d;h=h+1|0;if((h|0)==(c|0)){m=l;n=k;break}else{d=l;e=k}}}else{m=j;n=j}f[a+4>>2]=n;f[a+8>>2]=m;j=Xn(m|0,((m|0)<0)<<31>>31|0,n|0,((n|0)<0)<<31>>31|0)|0;n=I;if(!(n>>>0<0|(n|0)==0&j>>>0<2147483647))return;n=j+1|0;f[a+12>>2]=n;j=(n|0)/2|0;m=a+16|0;f[m>>2]=j;f[a+20>>2]=0-j;if(n&1|0)return;f[m>>2]=j+-1;return}function Nh(a){a=a|0;Fj(a+992|0);Fj(a+960|0);Fj(a+928|0);Fj(a+896|0);Fj(a+864|0);Fj(a+832|0);Fj(a+800|0);Fj(a+768|0);Fj(a+736|0);Fj(a+704|0);Fj(a+672|0);Fj(a+640|0);Fj(a+608|0);Fj(a+576|0);Fj(a+544|0);Fj(a+512|0);Fj(a+480|0);Fj(a+448|0);Fj(a+416|0);Fj(a+384|0);Fj(a+352|0);Fj(a+320|0);Fj(a+288|0);Fj(a+256|0);Fj(a+224|0);Fj(a+192|0);Fj(a+160|0);Fj(a+128|0);Fj(a+96|0);Fj(a+64|0);Fj(a+32|0);Fj(a);return}function Oh(a){a=a|0;wn(a);wn(a+32|0);wn(a+64|0);wn(a+96|0);wn(a+128|0);wn(a+160|0);wn(a+192|0);wn(a+224|0);wn(a+256|0);wn(a+288|0);wn(a+320|0);wn(a+352|0);wn(a+384|0);wn(a+416|0);wn(a+448|0);wn(a+480|0);wn(a+512|0);wn(a+544|0);wn(a+576|0);wn(a+608|0);wn(a+640|0);wn(a+672|0);wn(a+704|0);wn(a+736|0);wn(a+768|0);wn(a+800|0);wn(a+832|0);wn(a+864|0);wn(a+896|0);wn(a+928|0);wn(a+960|0);wn(a+992|0);return}function Ph(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0;c=u;u=u+16|0;d=c+12|0;e=c+8|0;g=c+4|0;h=c;i=(a|0)==(b|0);if(!i){f[g>>2]=f[b>>2];f[h>>2]=b+4;f[e>>2]=f[g>>2];f[d>>2]=f[h>>2];Oc(a,e,d)}if(!i){f[g>>2]=f[b+12>>2];f[h>>2]=b+16;f[e>>2]=f[g>>2];f[d>>2]=f[h>>2];Hc(a+12|0,e,d)}if(i){u=c;return}f[g>>2]=f[b+24>>2];f[h>>2]=b+28;f[e>>2]=f[g>>2];f[d>>2]=f[h>>2];Oc(a+24|0,e,d);u=c;return}function Qh(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0;a=u;u=u+16|0;e=a;if((c|0)<0|((b|0)==0|(d|0)==0)){g=0;u=a;return g|0}h=f[b+8>>2]|0;if(((f[b+12>>2]|0)-h>>2|0)<=(c|0)){g=0;u=a;return g|0}i=b+4|0;if(!(f[i>>2]|0)){j=ln(52)|0;f[j>>2]=0;f[j+4>>2]=0;f[j+8>>2]=0;f[j+12>>2]=0;n[j+16>>2]=$(1.0);k=j+20|0;f[k>>2]=0;f[k+4>>2]=0;f[k+8>>2]=0;f[k+12>>2]=0;n[j+36>>2]=$(1.0);f[j+40>>2]=0;f[j+44>>2]=0;f[j+48>>2]=0;f[b+4>>2]=j}j=f[(f[h+(c<<2)>>2]|0)+60>>2]|0;c=ln(44)|0;Ub(c,d);f[c+40>>2]=j;j=f[i>>2]|0;f[e>>2]=c;mk(j,e)|0;j=f[e>>2]|0;f[e>>2]=0;if(!j){g=1;u=a;return g|0}bj(j);Oq(j);g=1;u=a;return g|0}function Rh(a,c,d,e,g,h,i){a=a|0;c=c|0;d=d|0;e=e|0;g=g|0;h=h|0;i=i|0;var j=0,k=0;c=u;u=u+64|0;j=c;k=i?6:5;Il(j);i=f[h+56>>2]|0;h=X(Vl(k)|0,e)|0;Jj(j,i,0,e&255,k,0,h,((h|0)<0)<<31>>31,0,0);h=ln(96)|0;tl(h,j);f[a>>2]=h;Bj(h,d)|0;d=h+84|0;if(!g){b[d>>0]=1;a=f[h+68>>2]|0;j=h+72|0;k=f[j>>2]|0;if((k|0)==(a|0)){u=c;return}f[j>>2]=k+(~((k+-4-a|0)>>>2)<<2);u=c;return}b[d>>0]=0;d=h+68|0;a=h+72|0;h=f[a>>2]|0;k=f[d>>2]|0;j=h-k>>2;e=h;if(j>>>0>>0){Ch(d,g-j|0,1216);u=c;return}if(j>>>0<=g>>>0){u=c;return}j=k+(g<<2)|0;if((j|0)==(e|0)){u=c;return}f[a>>2]=e+(~((e+-4-j|0)>>>2)<<2);u=c;return}function Sh(a,b){a=a|0;b=b|0;var c=0,d=Oa,e=0,g=0;if((b|0)!=1)if(!(b+-1&b))c=b;else c=cb(b)|0;else c=2;b=f[a+4>>2]|0;if(c>>>0>b>>>0){rd(a,c);return}if(c>>>0>=b>>>0)return;d=$((f[a+12>>2]|0)>>>0);e=~~$(W($(d/$(n[a+16>>2]))))>>>0;if(b>>>0>2&(b+-1&b|0)==0)g=1<<32-(_(e+-1|0)|0);else g=cb(e)|0;e=c>>>0>>0?g:c;if(e>>>0>=b>>>0)return;rd(a,e);return}function Th(a,b){a=a|0;b=b|0;var c=0,d=Oa,e=0,g=0;if((b|0)!=1)if(!(b+-1&b))c=b;else c=cb(b)|0;else c=2;b=f[a+4>>2]|0;if(c>>>0>b>>>0){vd(a,c);return}if(c>>>0>=b>>>0)return;d=$((f[a+12>>2]|0)>>>0);e=~~$(W($(d/$(n[a+16>>2]))))>>>0;if(b>>>0>2&(b+-1&b|0)==0)g=1<<32-(_(e+-1|0)|0);else g=cb(e)|0;e=c>>>0>>0?g:c;if(e>>>0>=b>>>0)return;vd(a,e);return}function Uh(a,b){a=a|0;b=b|0;var c=0,d=Oa,e=0,g=0;if((b|0)!=1)if(!(b+-1&b))c=b;else c=cb(b)|0;else c=2;b=f[a+4>>2]|0;if(c>>>0>b>>>0){Fd(a,c);return}if(c>>>0>=b>>>0)return;d=$((f[a+12>>2]|0)>>>0);e=~~$(W($(d/$(n[a+16>>2]))))>>>0;if(b>>>0>2&(b+-1&b|0)==0)g=1<<32-(_(e+-1|0)|0);else g=cb(e)|0;e=c>>>0>>0?g:c;if(e>>>0>=b>>>0)return;Fd(a,e);return}function Vh(a,b){a=a|0;b=b|0;var c=0,d=Oa,e=0,g=0;if((b|0)!=1)if(!(b+-1&b))c=b;else c=cb(b)|0;else c=2;b=f[a+4>>2]|0;if(c>>>0>b>>>0){Pd(a,c);return}if(c>>>0>=b>>>0)return;d=$((f[a+12>>2]|0)>>>0);e=~~$(W($(d/$(n[a+16>>2]))))>>>0;if(b>>>0>2&(b+-1&b|0)==0)g=1<<32-(_(e+-1|0)|0);else g=cb(e)|0;e=c>>>0>>0?g:c;if(e>>>0>=b>>>0)return;Pd(a,e);return}function Wh(a,b){a=a|0;b=b|0;var c=0,d=Oa,e=0,g=0;if((b|0)!=1)if(!(b+-1&b))c=b;else c=cb(b)|0;else c=2;b=f[a+4>>2]|0;if(c>>>0>b>>>0){ud(a,c);return}if(c>>>0>=b>>>0)return;d=$((f[a+12>>2]|0)>>>0);e=~~$(W($(d/$(n[a+16>>2]))))>>>0;if(b>>>0>2&(b+-1&b|0)==0)g=1<<32-(_(e+-1|0)|0);else g=cb(e)|0;e=c>>>0>>0?g:c;if(e>>>0>=b>>>0)return;ud(a,e);return}function Xh(a,b){a=a|0;b=b|0;var c=0,d=Oa,e=0,g=0;if((b|0)!=1)if(!(b+-1&b))c=b;else c=cb(b)|0;else c=2;b=f[a+4>>2]|0;if(c>>>0>b>>>0){zd(a,c);return}if(c>>>0>=b>>>0)return;d=$((f[a+12>>2]|0)>>>0);e=~~$(W($(d/$(n[a+16>>2]))))>>>0;if(b>>>0>2&(b+-1&b|0)==0)g=1<<32-(_(e+-1|0)|0);else g=cb(e)|0;e=c>>>0>>0?g:c;if(e>>>0>=b>>>0)return;zd(a,e);return}function Yh(a,b){a=a|0;b=b|0;var c=0,d=Oa,e=0,g=0;if((b|0)!=1)if(!(b+-1&b))c=b;else c=cb(b)|0;else c=2;b=f[a+4>>2]|0;if(c>>>0>b>>>0){Jd(a,c);return}if(c>>>0>=b>>>0)return;d=$((f[a+12>>2]|0)>>>0);e=~~$(W($(d/$(n[a+16>>2]))))>>>0;if(b>>>0>2&(b+-1&b|0)==0)g=1<<32-(_(e+-1|0)|0);else g=cb(e)|0;e=c>>>0>>0?g:c;if(e>>>0>=b>>>0)return;Jd(a,e);return}function Zh(a,b){a=a|0;b=b|0;var c=0,d=Oa,e=0,g=0;if((b|0)!=1)if(!(b+-1&b))c=b;else c=cb(b)|0;else c=2;b=f[a+4>>2]|0;if(c>>>0>b>>>0){sd(a,c);return}if(c>>>0>=b>>>0)return;d=$((f[a+12>>2]|0)>>>0);e=~~$(W($(d/$(n[a+16>>2]))))>>>0;if(b>>>0>2&(b+-1&b|0)==0)g=1<<32-(_(e+-1|0)|0);else g=cb(e)|0;e=c>>>0>>0?g:c;if(e>>>0>=b>>>0)return;sd(a,e);return}function _h(a,b){a=a|0;b=b|0;var c=0,d=Oa,e=0,g=0;if((b|0)!=1)if(!(b+-1&b))c=b;else c=cb(b)|0;else c=2;b=f[a+4>>2]|0;if(c>>>0>b>>>0){wd(a,c);return}if(c>>>0>=b>>>0)return;d=$((f[a+12>>2]|0)>>>0);e=~~$(W($(d/$(n[a+16>>2]))))>>>0;if(b>>>0>2&(b+-1&b|0)==0)g=1<<32-(_(e+-1|0)|0);else g=cb(e)|0;e=c>>>0>>0?g:c;if(e>>>0>=b>>>0)return;wd(a,e);return}function $h(a,b){a=a|0;b=b|0;var c=0,d=Oa,e=0,g=0;if((b|0)!=1)if(!(b+-1&b))c=b;else c=cb(b)|0;else c=2;b=f[a+4>>2]|0;if(c>>>0>b>>>0){Gd(a,c);return}if(c>>>0>=b>>>0)return;d=$((f[a+12>>2]|0)>>>0);e=~~$(W($(d/$(n[a+16>>2]))))>>>0;if(b>>>0>2&(b+-1&b|0)==0)g=1<<32-(_(e+-1|0)|0);else g=cb(e)|0;e=c>>>0>>0?g:c;if(e>>>0>=b>>>0)return;Gd(a,e);return}function ai(a,b){a=a|0;b=b|0;var c=0,d=Oa,e=0,g=0;if((b|0)!=1)if(!(b+-1&b))c=b;else c=cb(b)|0;else c=2;b=f[a+4>>2]|0;if(c>>>0>b>>>0){Qd(a,c);return}if(c>>>0>=b>>>0)return;d=$((f[a+12>>2]|0)>>>0);e=~~$(W($(d/$(n[a+16>>2]))))>>>0;if(b>>>0>2&(b+-1&b|0)==0)g=1<<32-(_(e+-1|0)|0);else g=cb(e)|0;e=c>>>0>>0?g:c;if(e>>>0>=b>>>0)return;Qd(a,e);return}function bi(a,c,d,e){a=a|0;c=c|0;d=d|0;e=e|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;g=u;u=u+16|0;h=g;f[h>>2]=0;f[h+4>>2]=0;f[h+8>>2]=0;i=ln(16)|0;f[h>>2]=i;f[h+8>>2]=-2147483632;f[h+4>>2]=15;j=i;k=14479;l=j+15|0;do{b[j>>0]=b[k>>0]|0;j=j+1|0;k=k+1|0}while((j|0)<(l|0));b[i+15>>0]=0;i=Hk(c,h,-1)|0;if((b[h+11>>0]|0)<0)Oq(f[h>>2]|0);switch(i|0){case -1:{if((mi(c)|0)==10)m=6;else m=5;break}case 1:{m=5;break}default:m=6}if((m|0)==5){i=ln(60)|0;Lo(i);n=i}else if((m|0)==6){m=ln(56)|0;tp(m);n=m}xo(n,d);Md(a,n,c,e);Va[f[(f[n>>2]|0)+4>>2]&127](n);u=g;return}function ci(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0;d=u;u=u+16|0;e=d+4|0;g=d;h=d+8|0;b[h>>0]=a&127;do if(a>>>0>127){b[h>>0]=a|128;i=c+16|0;j=f[i+4>>2]|0;if((j|0)>0|(j|0)==0&(f[i>>2]|0)>>>0>0){k=0;break}else{f[g>>2]=f[c+4>>2];f[e>>2]=f[g>>2];Me(c,e,h,h+1|0)|0;k=ci(a>>>7,c)|0;break}}else{i=c+16|0;j=f[i+4>>2]|0;if((j|0)>0|(j|0)==0&(f[i>>2]|0)>>>0>0){k=0;break}f[g>>2]=f[c+4>>2];f[e>>2]=f[g>>2];Me(c,e,h,h+1|0)|0;l=1;u=d;return l|0}while(0);l=k;u=d;return l|0} -function vc(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0;e=u;u=u+32|0;g=e+16|0;h=e+12|0;i=e+8|0;j=e+4|0;k=e;switch(f[c+28>>2]|0){case 9:{l=f[d>>2]|0;switch(b[c+24>>0]|0){case 1:{f[h>>2]=l;f[g>>2]=f[h>>2];m=hc(a,c,g)|0;break}case 2:{f[i>>2]=l;f[g>>2]=f[i>>2];m=Wb(a,c,g)|0;break}case 3:{f[j>>2]=l;f[g>>2]=f[j>>2];m=uc(a,c,g)|0;break}case 4:{f[k>>2]=l;f[g>>2]=f[k>>2];m=mc(a,c,g)|0;break}default:m=0}n=m;break}case 1:{m=f[d>>2]|0;switch(b[c+24>>0]|0){case 1:{f[h>>2]=m;f[g>>2]=f[h>>2];o=gc(a,c,g)|0;break}case 2:{f[i>>2]=m;f[g>>2]=f[i>>2];o=Xb(a,c,g)|0;break}case 3:{f[j>>2]=m;f[g>>2]=f[j>>2];o=sc(a,c,g)|0;break}case 4:{f[k>>2]=m;f[g>>2]=f[k>>2];o=lc(a,c,g)|0;break}default:o=0}n=o;break}case 11:case 2:{o=f[d>>2]|0;switch(b[c+24>>0]|0){case 1:{f[h>>2]=o;f[g>>2]=f[h>>2];p=gc(a,c,g)|0;break}case 2:{f[i>>2]=o;f[g>>2]=f[i>>2];p=Xb(a,c,g)|0;break}case 3:{f[j>>2]=o;f[g>>2]=f[j>>2];p=sc(a,c,g)|0;break}case 4:{f[k>>2]=o;f[g>>2]=f[k>>2];p=lc(a,c,g)|0;break}default:p=0}n=p;break}case 4:{p=f[d>>2]|0;switch(b[c+24>>0]|0){case 1:{f[h>>2]=p;f[g>>2]=f[h>>2];q=ec(a,c,g)|0;break}case 2:{f[i>>2]=p;f[g>>2]=f[i>>2];q=Vb(a,c,g)|0;break}case 3:{f[j>>2]=p;f[g>>2]=f[j>>2];q=nc(a,c,g)|0;break}case 4:{f[k>>2]=p;f[g>>2]=f[k>>2];q=jc(a,c,g)|0;break}default:q=0}n=q;break}case 3:{q=f[d>>2]|0;switch(b[c+24>>0]|0){case 1:{f[h>>2]=q;f[g>>2]=f[h>>2];r=ec(a,c,g)|0;break}case 2:{f[i>>2]=q;f[g>>2]=f[i>>2];r=Vb(a,c,g)|0;break}case 3:{f[j>>2]=q;f[g>>2]=f[j>>2];r=nc(a,c,g)|0;break}case 4:{f[k>>2]=q;f[g>>2]=f[k>>2];r=jc(a,c,g)|0;break}default:r=0}n=r;break}case 6:{r=f[d>>2]|0;switch(b[c+24>>0]|0){case 1:{f[h>>2]=r;f[g>>2]=f[h>>2];s=hc(a,c,g)|0;break}case 2:{f[i>>2]=r;f[g>>2]=f[i>>2];s=Wb(a,c,g)|0;break}case 3:{f[j>>2]=r;f[g>>2]=f[j>>2];s=uc(a,c,g)|0;break}case 4:{f[k>>2]=r;f[g>>2]=f[k>>2];s=mc(a,c,g)|0;break}default:s=0}n=s;break}case 5:{s=f[d>>2]|0;switch(b[c+24>>0]|0){case 1:{f[h>>2]=s;f[g>>2]=f[h>>2];t=hc(a,c,g)|0;break}case 2:{f[i>>2]=s;f[g>>2]=f[i>>2];t=Wb(a,c,g)|0;break}case 3:{f[j>>2]=s;f[g>>2]=f[j>>2];t=uc(a,c,g)|0;break}case 4:{f[k>>2]=s;f[g>>2]=f[k>>2];t=mc(a,c,g)|0;break}default:t=0}n=t;break}default:{v=-1;u=e;return v|0}}v=(n|0)==0?-1:n;u=e;return v|0}function wc(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0;e=u;u=u+32|0;g=e+16|0;h=e+12|0;i=e+29|0;j=e;k=e+28|0;if(!(f[(f[a+8>>2]|0)+80>>2]|0)){l=1;u=e;return l|0}b[i>>0]=-2;m=a+36|0;n=f[m>>2]|0;if(n)if(Ra[f[(f[a>>2]|0)+40>>2]&127](a,n)|0){n=f[m>>2]|0;o=(Qa[f[(f[n>>2]|0)+8>>2]&127](n)|0)&255;b[i>>0]=o;p=5}else q=0;else p=5;if((p|0)==5){o=d+16|0;n=o;r=f[n+4>>2]|0;if(!((r|0)>0|(r|0)==0&(f[n>>2]|0)>>>0>0)){f[h>>2]=f[d+4>>2];f[g>>2]=f[h>>2];Me(d,g,i,i+1|0)|0}i=f[m>>2]|0;if(i|0?(n=(Qa[f[(f[i>>2]|0)+36>>2]&127](i)|0)&255,b[j>>0]=n,n=o,i=f[n+4>>2]|0,!((i|0)>0|(i|0)==0&(f[n>>2]|0)>>>0>0)):0){f[h>>2]=f[d+4>>2];f[g>>2]=f[h>>2];Me(d,g,j,j+1|0)|0}n=f[a+32>>2]|0;i=b[n+24>>0]|0;r=X(f[n+80>>2]|0,i)|0;s=(f[f[n>>2]>>2]|0)+(f[n+48>>2]|0)|0;f[j>>2]=0;n=j+4|0;f[n>>2]=0;f[j+8>>2]=0;t=(r|0)==0;do if(!t)if(r>>>0>1073741823)aq(j);else{v=r<<2;w=ln(v)|0;f[j>>2]=w;x=w+(r<<2)|0;f[j+8>>2]=x;sj(w|0,0,v|0)|0;f[n>>2]=x;y=w;break}else y=0;while(0);w=f[m>>2]|0;do if(w){Ta[f[(f[w>>2]|0)+44>>2]&31](w,s,y,r,i,f[c>>2]|0)|0;x=f[m>>2]|0;if(!x){z=s;A=f[j>>2]|0;p=20;break}if(!(Qa[f[(f[x>>2]|0)+32>>2]&127](x)|0)){x=f[j>>2]|0;z=f[m>>2]|0?x:s;A=x;p=20}}else{z=s;A=y;p=20}while(0);if((p|0)==20)xm(z,r,A);A=a+4|0;a=f[A>>2]|0;do if(a){z=f[a+48>>2]|0;f[g>>2]=0;f[g+4>>2]=0;f[g+8>>2]=0;y=ln(48)|0;f[g>>2]=y;f[g+8>>2]=-2147483600;f[g+4>>2]=34;s=y;w=10697;x=s+34|0;do{b[s>>0]=b[w>>0]|0;s=s+1|0;w=w+1|0}while((s|0)<(x|0));b[y+34>>0]=0;w=Yj(z,g,1)|0;if((b[g+11>>0]|0)<0)Oq(f[g>>2]|0);if(!w){if(!t){w=f[j>>2]|0;s=0;x=0;do{x=f[w+(s<<2)>>2]|x;s=s+1|0}while((s|0)!=(r|0));if(x)B=((_(x|0)|0)>>>3^3)+1|0;else B=1}else B=1;b[k>>0]=0;s=o;w=f[s>>2]|0;z=f[s+4>>2]|0;if((z|0)>0|(z|0)==0&w>>>0>0){C=z;D=w}else{f[h>>2]=f[d+4>>2];f[g>>2]=f[h>>2];Me(d,g,k,k+1|0)|0;w=o;C=f[w+4>>2]|0;D=f[w>>2]|0}b[k>>0]=B;if(!((C|0)>0|(C|0)==0&D>>>0>0)){f[h>>2]=f[d+4>>2];f[g>>2]=f[h>>2];Me(d,g,k,k+1|0)|0}if((B|0)==(Vl(5)|0)){w=f[j>>2]|0;z=o;s=f[z+4>>2]|0;if(!((s|0)>0|(s|0)==0&(f[z>>2]|0)>>>0>0)){f[h>>2]=f[d+4>>2];f[g>>2]=f[h>>2];Me(d,g,w,w+(r<<2)|0)|0}p=48;break}if(t)p=48;else{w=d+4|0;z=0;do{s=(f[j>>2]|0)+(z<<2)|0;y=o;v=f[y+4>>2]|0;if(!((v|0)>0|(v|0)==0&(f[y>>2]|0)>>>0>0)){f[h>>2]=f[w>>2];f[g>>2]=f[h>>2];Me(d,g,s,s+B|0)|0}z=z+1|0}while(z>>>0>>0);p=48}}else p=27}else p=27;while(0);if((p|0)==27){b[k>>0]=1;r=o;o=f[r+4>>2]|0;if(!((o|0)>0|(o|0)==0&(f[r>>2]|0)>>>0>0)){f[h>>2]=f[d+4>>2];f[g>>2]=f[h>>2];Me(d,g,k,k+1|0)|0}lp(g);k=f[A>>2]|0;if(k|0)Zj(g,10-(mi(f[k+48>>2]|0)|0)|0)|0;k=Mc(f[j>>2]|0,X((f[c+4>>2]|0)-(f[c>>2]|0)>>2,i)|0,i,g,d)|0;Ej(g,f[g+4>>2]|0);if(k)p=48;else E=0}if((p|0)==48){p=f[m>>2]|0;if(!p)E=1;else{Ra[f[(f[p>>2]|0)+40>>2]&127](p,d)|0;E=1}}d=f[j>>2]|0;if(d|0){j=f[n>>2]|0;if((j|0)!=(d|0))f[n>>2]=j+(~((j+-4-d|0)>>>2)<<2);Oq(d)}q=E}l=q;u=e;return l|0}function xc(a){a=a|0;var b=0,c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0;b=u;u=u+48|0;c=b+24|0;d=b+12|0;e=b;g=a+32|0;h=a+8|0;i=a+12|0;j=f[i>>2]|0;k=f[h>>2]|0;l=j-k>>2;m=a+36|0;n=f[m>>2]|0;o=f[g>>2]|0;p=n-o>>2;q=o;o=n;n=k;if(l>>>0<=p>>>0)if(l>>>0

      >>0:0)break;s=yg(a,d,g)|0;return s|0}while(0);if(m){f[d>>2]=c;s=i+4|0;return s|0}else{f[d>>2]=t;s=t;return s|0}}while(0);t=f[i>>2]|0;do if((f[a>>2]|0)==(i|0))v=c;else{if(!t){h=i;while(1){e=f[h+8>>2]|0;if((f[e>>2]|0)==(h|0))h=e;else{w=e;break}}}else{h=t;while(1){m=f[h+4>>2]|0;if(!m){w=h;break}else h=m}}h=w;m=w+16|0;e=b[g+11>>0]|0;o=e<<24>>24<0;n=o?f[g+4>>2]|0:e&255;e=b[m+11>>0]|0;j=e<<24>>24<0;p=j?f[w+20>>2]|0:e&255;e=n>>>0

      >>0?n:p;if((e|0)!=0?(u=Vk(j?f[m>>2]|0:m,o?f[g>>2]|0:g,e)|0,(u|0)!=0):0){if((u|0)<0){v=h;break}}else r=13;if((r|0)==13?p>>>0>>0:0){v=h;break}s=yg(a,d,g)|0;return s|0}while(0);if(!t){f[d>>2]=i;s=i;return s|0}else{f[d>>2]=v;s=v+4|0;return s|0}return 0}function Ld(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0;g=a;h=b;i=h;j=c;k=d;l=k;if(!i){m=(e|0)!=0;if(!l){if(m){f[e>>2]=(g>>>0)%(j>>>0);f[e+4>>2]=0}n=0;o=(g>>>0)/(j>>>0)>>>0;return (I=n,o)|0}else{if(!m){n=0;o=0;return (I=n,o)|0}f[e>>2]=a|0;f[e+4>>2]=b&0;n=0;o=0;return (I=n,o)|0}}m=(l|0)==0;do if(j){if(!m){p=(_(l|0)|0)-(_(i|0)|0)|0;if(p>>>0<=31){q=p+1|0;r=31-p|0;s=p-31>>31;t=q;u=g>>>(q>>>0)&s|i<>>(q>>>0)&s;w=0;x=g<>2]=a|0;f[e+4>>2]=h|b&0;n=0;o=0;return (I=n,o)|0}r=j-1|0;if(r&j|0){s=(_(j|0)|0)+33-(_(i|0)|0)|0;q=64-s|0;p=32-s|0;y=p>>31;z=s-32|0;A=z>>31;t=s;u=p-1>>31&i>>>(z>>>0)|(i<>>(s>>>0))&A;v=A&i>>>(s>>>0);w=g<>>(z>>>0))&y|g<>31;break}if(e|0){f[e>>2]=r&g;f[e+4>>2]=0}if((j|0)==1){n=h|b&0;o=a|0|0;return (I=n,o)|0}else{r=vm(j|0)|0;n=i>>>(r>>>0)|0;o=i<<32-r|g>>>(r>>>0)|0;return (I=n,o)|0}}else{if(m){if(e|0){f[e>>2]=(i>>>0)%(j>>>0);f[e+4>>2]=0}n=0;o=(i>>>0)/(j>>>0)>>>0;return (I=n,o)|0}if(!g){if(e|0){f[e>>2]=0;f[e+4>>2]=(i>>>0)%(l>>>0)}n=0;o=(i>>>0)/(l>>>0)>>>0;return (I=n,o)|0}r=l-1|0;if(!(r&l)){if(e|0){f[e>>2]=a|0;f[e+4>>2]=r&i|b&0}n=0;o=i>>>((vm(l|0)|0)>>>0);return (I=n,o)|0}r=(_(l|0)|0)-(_(i|0)|0)|0;if(r>>>0<=30){s=r+1|0;p=31-r|0;t=s;u=i<>>(s>>>0);v=i>>>(s>>>0);w=0;x=g<>2]=a|0;f[e+4>>2]=h|b&0;n=0;o=0;return (I=n,o)|0}while(0);if(!t){B=x;C=w;D=v;E=u;F=0;G=0}else{b=c|0|0;c=k|d&0;d=Vn(b|0,c|0,-1,-1)|0;k=I;h=x;x=w;w=v;v=u;u=t;t=0;do{a=h;h=x>>>31|h<<1;x=t|x<<1;g=v<<1|a>>>31|0;a=v>>>31|w<<1|0;Xn(d|0,k|0,g|0,a|0)|0;i=I;l=i>>31|((i|0)<0?-1:0)<<1;t=l&1;v=Xn(g|0,a|0,l&b|0,(((i|0)<0?-1:0)>>31|((i|0)<0?-1:0)<<1)&c|0)|0;w=I;u=u-1|0}while((u|0)!=0);B=h;C=x;D=w;E=v;F=0;G=t}t=C;C=0;if(e|0){f[e>>2]=E;f[e+4>>2]=D}n=(t|0)>>>31|(B|C)<<1|(C<<1|t>>>31)&0|F;o=(t<<1|0>>>31)&-2|G;return (I=n,o)|0}function Md(a,c,d,e){a=a|0;c=c|0;d=d|0;e=e|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;g=u;u=u+16|0;h=g;f[c+48>>2]=d;f[c+44>>2]=e;e=f[c+8>>2]|0;d=c+12|0;i=f[d>>2]|0;if((i|0)!=(e|0)){j=i;do{i=j+-4|0;f[d>>2]=i;k=f[i>>2]|0;f[i>>2]=0;if(k|0)Va[f[(f[k>>2]|0)+4>>2]&127](k);j=f[d>>2]|0}while((j|0)!=(e|0))}e=f[c+20>>2]|0;j=c+24|0;d=f[j>>2]|0;if((d|0)!=(e|0))f[j>>2]=d+(~((d+-4-e|0)>>>2)<<2);e=f[c+32>>2]|0;d=c+36|0;j=f[d>>2]|0;if((j|0)!=(e|0))f[d>>2]=j+(~((j+-4-e|0)>>>2)<<2);if(!(f[c+4>>2]|0)){e=ln(32)|0;f[h>>2]=e;f[h+8>>2]=-2147483616;f[h+4>>2]=23;l=e;m=15706;n=l+23|0;do{b[l>>0]=b[m>>0]|0;l=l+1|0;m=m+1|0}while((l|0)<(n|0));b[e+23>>0]=0;f[a>>2]=-1;pj(a+4|0,h);if((b[h+11>>0]|0)<0)Oq(f[h>>2]|0);u=g;return}Ud(a,c);if(f[a>>2]|0){u=g;return}e=a+4|0;j=e+11|0;if((b[j>>0]|0)<0)Oq(f[e>>2]|0);Wi(a,c);if(f[a>>2]|0){u=g;return}if((b[j>>0]|0)<0)Oq(f[e>>2]|0);if(!(Qa[f[(f[c>>2]|0)+16>>2]&127](c)|0)){j=ln(32)|0;f[h>>2]=j;f[h+8>>2]=-2147483616;f[h+4>>2]=29;l=j;m=15730;n=l+29|0;do{b[l>>0]=b[m>>0]|0;l=l+1|0;m=m+1|0}while((l|0)<(n|0));b[j+29>>0]=0;f[a>>2]=-1;pj(e,h);if((b[h+11>>0]|0)<0)Oq(f[h>>2]|0);u=g;return}if(!(Qa[f[(f[c>>2]|0)+20>>2]&127](c)|0)){j=ln(32)|0;f[h>>2]=j;f[h+8>>2]=-2147483616;f[h+4>>2]=31;l=j;m=15760;n=l+31|0;do{b[l>>0]=b[m>>0]|0;l=l+1|0;m=m+1|0}while((l|0)<(n|0));b[j+31>>0]=0;f[a>>2]=-1;pj(e,h);if((b[h+11>>0]|0)<0)Oq(f[h>>2]|0);u=g;return}if(!(Qa[f[(f[c>>2]|0)+24>>2]&127](c)|0)){j=ln(32)|0;f[h>>2]=j;f[h+8>>2]=-2147483616;f[h+4>>2]=31;l=j;m=15792;n=l+31|0;do{b[l>>0]=b[m>>0]|0;l=l+1|0;m=m+1|0}while((l|0)<(n|0));b[j+31>>0]=0;f[a>>2]=-1;pj(e,h);if((b[h+11>>0]|0)<0)Oq(f[h>>2]|0);u=g;return}if(Qa[f[(f[c>>2]|0)+28>>2]&127](c)|0){f[a>>2]=0;f[a+4>>2]=0;f[a+8>>2]=0;f[a+12>>2]=0;u=g;return}c=ln(48)|0;f[h>>2]=c;f[h+8>>2]=-2147483600;f[h+4>>2]=34;l=c;m=15824;n=l+34|0;do{b[l>>0]=b[m>>0]|0;l=l+1|0;m=m+1|0}while((l|0)<(n|0));b[c+34>>0]=0;f[a>>2]=-1;pj(e,h);if((b[h+11>>0]|0)<0)Oq(f[h>>2]|0);u=g;return}function Nd(a){a=a|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0;c=u;u=u+32|0;d=c+4|0;e=c;g=c+16|0;h=a+48|0;i=f[h>>2]|0;j=ln(32)|0;f[d>>2]=j;f[d+8>>2]=-2147483616;f[d+4>>2]=20;k=j;l=14538;m=k+20|0;do{b[k>>0]=b[l>>0]|0;k=k+1|0;l=l+1|0}while((k|0)<(m|0));b[j+20>>0]=0;j=Fk(i+24|0,d)|0;if((b[d+11>>0]|0)<0)Oq(f[d>>2]|0);i=f[h>>2]|0;n=ln(32)|0;f[d>>2]=n;f[d+8>>2]=-2147483616;f[d+4>>2]=22;k=n;l=14559;m=k+22|0;do{b[k>>0]=b[l>>0]|0;k=k+1|0;l=l+1|0}while((k|0)<(m|0));b[n+22>>0]=0;n=Fk(i+24|0,d)|0;if((b[d+11>>0]|0)<0)Oq(f[d>>2]|0);i=a+56|0;o=f[i>>2]|0;f[i>>2]=0;if(o|0)Va[f[(f[o>>2]|0)+4>>2]&127](o);o=f[a+52>>2]|0;p=(((f[o+100>>2]|0)-(f[o+96>>2]|0)|0)/12|0)>>>0<1e3;o=f[h>>2]|0;q=ln(32)|0;f[d>>2]=q;f[d+8>>2]=-2147483616;f[d+4>>2]=18;k=q;l=14582;m=k+18|0;do{b[k>>0]=b[l>>0]|0;k=k+1|0;l=l+1|0}while((k|0)<(m|0));b[q+18>>0]=0;q=Hk(o,d,-1)|0;if((b[d+11>>0]|0)<0)Oq(f[d>>2]|0);switch(q|0){case -1:{if(j?p|((mi(f[h>>2]|0)|0)>4|n^1):0)r=13;else r=17;break}case 0:{if(j)r=13;else r=21;break}case 2:{r=17;break}default:r=21}if((r|0)==13){j=f[a+44>>2]|0;b[g>>0]=0;n=j+16|0;h=f[n+4>>2]|0;if(!((h|0)>0|(h|0)==0&(f[n>>2]|0)>>>0>0)){f[e>>2]=f[j+4>>2];f[d>>2]=f[e>>2];Me(j,d,g,g+1|0)|0}j=ln(296)|0;_i(j);n=f[i>>2]|0;f[i>>2]=j;if(!n)s=j;else{Va[f[(f[n>>2]|0)+4>>2]&127](n);r=21}}else if((r|0)==17){n=f[a+44>>2]|0;b[g>>0]=2;j=n+16|0;h=f[j+4>>2]|0;if(!((h|0)>0|(h|0)==0&(f[j>>2]|0)>>>0>0)){f[e>>2]=f[n+4>>2];f[d>>2]=f[e>>2];Me(n,d,g,g+1|0)|0}g=ln(360)|0;xi(g);d=f[i>>2]|0;f[i>>2]=g;if(!d)s=g;else{Va[f[(f[d>>2]|0)+4>>2]&127](d);r=21}}if((r|0)==21){r=f[i>>2]|0;if(!r){t=0;u=c;return t|0}else s=r}t=Ra[f[(f[s>>2]|0)+8>>2]&127](s,a)|0;u=c;return t|0}function Od(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0;e=b+12|0;g=f[e>>2]|0;h=c+4|0;i=(f[h>>2]|0)-g|0;j=c;f[j>>2]=(f[c>>2]|0)-g;f[j+4>>2]=i;i=(f[d>>2]|0)-g|0;j=d+4|0;k=(f[j>>2]|0)-g|0;g=d;f[g>>2]=i;f[g+4>>2]=k;g=f[e>>2]|0;if((((k|0)>-1?k:0-k|0)+((i|0)>-1?i:0-i|0)|0)>(g|0)){l=f[c>>2]|0;m=f[h>>2]|0;if((l|0)>-1)if((m|0)<=-1)if((l|0)<1){n=-1;o=-1}else p=6;else{n=1;o=1}else if((m|0)<1){n=-1;o=-1}else p=6;if((p|0)==6){n=(l|0)>0?1:-1;o=(m|0)>0?1:-1}q=X(g,n)|0;r=X(g,o)|0;g=(l<<1)-q|0;f[c>>2]=g;l=(m<<1)-r|0;f[h>>2]=l;if((X(n,o)|0)>-1){o=0-l|0;f[c>>2]=o;s=0-g|0;t=o}else{f[c>>2]=l;s=g;t=l}f[c>>2]=(t+q|0)/2|0;f[h>>2]=(s+r|0)/2|0;r=f[d>>2]|0;s=f[j>>2]|0;if((r|0)>-1)if((s|0)<=-1)if((r|0)<1){u=-1;v=-1}else p=14;else{u=1;v=1}else if((s|0)<1){u=-1;v=-1}else p=14;if((p|0)==14){u=(r|0)>0?1:-1;v=(s|0)>0?1:-1}q=f[e>>2]|0;e=X(q,u)|0;t=X(q,v)|0;q=(r<<1)-e|0;f[d>>2]=q;r=(s<<1)-t|0;f[j>>2]=r;if((X(u,v)|0)>-1){v=0-r|0;f[d>>2]=v;w=0-q|0;x=v}else{f[d>>2]=r;w=q;x=r}r=(x+e|0)/2|0;f[d>>2]=r;e=(w+t|0)/2|0;f[j>>2]=e;y=r;z=e}else{y=i;z=k}if(!y)if(!z){A=y;B=z}else p=22;else if((y|0)<0&(z|0)<1){A=y;B=z}else p=22;if((p|0)==22){if(!y)C=(z|0)==0?0:(z|0)>0?3:1;else C=(y|0)>0?(z>>31)+2|0:(z|0)<1?0:3;z=f[c>>2]|0;y=f[h>>2]|0;switch(C|0){case 1:{C=c;f[C>>2]=y;f[C+4>>2]=0-z;D=f[j>>2]|0;E=0-(f[d>>2]|0)|0;break}case 2:{C=c;f[C>>2]=0-z;f[C+4>>2]=0-y;D=0-(f[d>>2]|0)|0;E=0-(f[j>>2]|0)|0;break}case 3:{C=c;f[C>>2]=0-y;f[C+4>>2]=z;D=0-(f[j>>2]|0)|0;E=f[d>>2]|0;break}default:{C=c;f[C>>2]=z;f[C+4>>2]=y;D=f[d>>2]|0;E=f[j>>2]|0}}j=d;f[j>>2]=D;f[j+4>>2]=E;A=D;B=E}E=(f[c>>2]|0)-A|0;f[a>>2]=E;A=(f[h>>2]|0)-B|0;B=a+4|0;f[B>>2]=A;if((E|0)<0)F=(f[b+4>>2]|0)+E|0;else F=E;f[a>>2]=F;if((A|0)>=0){G=A;f[B>>2]=G;return}G=(f[b+4>>2]|0)+A|0;f[B>>2]=G;return}function Pd(a,b){a=a|0;b=b|0;var c=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0;c=a+4|0;if(!b){e=f[a>>2]|0;f[a>>2]=0;if(e|0)Oq(e);f[c>>2]=0;return}if(b>>>0>1073741823){e=ra(8)|0;Oo(e,16035);f[e>>2]=7256;va(e|0,1112,110)}e=ln(b<<2)|0;g=f[a>>2]|0;f[a>>2]=e;if(g|0)Oq(g);f[c>>2]=b;c=0;do{f[(f[a>>2]|0)+(c<<2)>>2]=0;c=c+1|0}while((c|0)!=(b|0));c=a+8|0;g=f[c>>2]|0;if(!g)return;e=f[g+4>>2]|0;h=b+-1|0;i=(h&b|0)==0;if(!i)if(e>>>0>>0)j=e;else j=(e>>>0)%(b>>>0)|0;else j=e&h;f[(f[a>>2]|0)+(j<<2)>>2]=c;c=f[g>>2]|0;if(!c)return;else{k=j;l=g;m=c;n=g}a:while(1){b:do if(i){g=l;c=m;j=n;while(1){e=c;while(1){o=f[e+4>>2]&h;if((o|0)==(k|0))break;p=(f[a>>2]|0)+(o<<2)|0;if(!(f[p>>2]|0)){q=e;r=j;s=o;t=p;break b}p=e+8|0;u=e;while(1){v=f[u>>2]|0;if(!v)break;if((d[p>>1]|0)==(d[v+8>>1]|0))u=v;else break}f[j>>2]=v;f[u>>2]=f[f[(f[a>>2]|0)+(o<<2)>>2]>>2];f[f[(f[a>>2]|0)+(o<<2)>>2]>>2]=e;p=f[g>>2]|0;if(!p){w=37;break a}else e=p}c=f[e>>2]|0;if(!c){w=37;break a}else{g=e;j=e}}}else{j=l;g=m;c=n;while(1){p=g;while(1){x=f[p+4>>2]|0;if(x>>>0>>0)y=x;else y=(x>>>0)%(b>>>0)|0;if((y|0)==(k|0))break;x=(f[a>>2]|0)+(y<<2)|0;if(!(f[x>>2]|0)){q=p;r=c;s=y;t=x;break b}x=p+8|0;z=p;while(1){A=f[z>>2]|0;if(!A)break;if((d[x>>1]|0)==(d[A+8>>1]|0))z=A;else break}f[c>>2]=A;f[z>>2]=f[f[(f[a>>2]|0)+(y<<2)>>2]>>2];f[f[(f[a>>2]|0)+(y<<2)>>2]>>2]=p;x=f[j>>2]|0;if(!x){w=37;break a}else p=x}g=f[p>>2]|0;if(!g){w=37;break a}else{j=p;c=p}}}while(0);f[t>>2]=r;m=f[q>>2]|0;if(!m){w=37;break}else{k=s;l=q;n=q}}if((w|0)==37)return}function Qd(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0;d=a+4|0;if(!c){e=f[a>>2]|0;f[a>>2]=0;if(e|0)Oq(e);f[d>>2]=0;return}if(c>>>0>1073741823){e=ra(8)|0;Oo(e,16035);f[e>>2]=7256;va(e|0,1112,110)}e=ln(c<<2)|0;g=f[a>>2]|0;f[a>>2]=e;if(g|0)Oq(g);f[d>>2]=c;d=0;do{f[(f[a>>2]|0)+(d<<2)>>2]=0;d=d+1|0}while((d|0)!=(c|0));d=a+8|0;g=f[d>>2]|0;if(!g)return;e=f[g+4>>2]|0;h=c+-1|0;i=(h&c|0)==0;if(!i)if(e>>>0>>0)j=e;else j=(e>>>0)%(c>>>0)|0;else j=e&h;f[(f[a>>2]|0)+(j<<2)>>2]=d;d=f[g>>2]|0;if(!d)return;else{k=j;l=g;m=d;n=g}a:while(1){b:do if(i){g=l;d=m;j=n;while(1){e=d;while(1){o=f[e+4>>2]&h;if((o|0)==(k|0))break;p=(f[a>>2]|0)+(o<<2)|0;if(!(f[p>>2]|0)){q=e;r=j;s=o;t=p;break b}p=e+8|0;u=e;while(1){v=f[u>>2]|0;if(!v)break;if((b[p>>0]|0)==(b[v+8>>0]|0))u=v;else break}f[j>>2]=v;f[u>>2]=f[f[(f[a>>2]|0)+(o<<2)>>2]>>2];f[f[(f[a>>2]|0)+(o<<2)>>2]>>2]=e;p=f[g>>2]|0;if(!p){w=37;break a}else e=p}d=f[e>>2]|0;if(!d){w=37;break a}else{g=e;j=e}}}else{j=l;g=m;d=n;while(1){p=g;while(1){x=f[p+4>>2]|0;if(x>>>0>>0)y=x;else y=(x>>>0)%(c>>>0)|0;if((y|0)==(k|0))break;x=(f[a>>2]|0)+(y<<2)|0;if(!(f[x>>2]|0)){q=p;r=d;s=y;t=x;break b}x=p+8|0;z=p;while(1){A=f[z>>2]|0;if(!A)break;if((b[x>>0]|0)==(b[A+8>>0]|0))z=A;else break}f[d>>2]=A;f[z>>2]=f[f[(f[a>>2]|0)+(y<<2)>>2]>>2];f[f[(f[a>>2]|0)+(y<<2)>>2]>>2]=p;x=f[j>>2]|0;if(!x){w=37;break a}else p=x}g=f[p>>2]|0;if(!g){w=37;break a}else{j=p;d=p}}}while(0);f[t>>2]=r;m=f[q>>2]|0;if(!m){w=37;break}else{k=s;l=q;n=q}}if((w|0)==37)return}function Rd(a,b,c,d,e,g){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;g=g|0;var h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0;g=f[c>>2]|0;c=f[b>>2]|0;h=g-c|0;i=a+8|0;j=f[i>>2]|0;if(h>>>0<64){if(j>>>0<=1){k=0;return k|0}l=f[e>>2]|0;m=0;n=1;while(1){o=(f[l+(m<<2)>>2]|0)>>>0>(f[l+(n<<2)>>2]|0)>>>0?n:m;n=n+1|0;if(n>>>0>=j>>>0){k=o;break}else m=o}return k|0}if(j){j=f[a+1128>>2]|0;m=f[e>>2]|0;e=f[a+1140>>2]|0;n=f[d>>2]|0;d=b+4|0;l=b+8|0;if((g|0)==(c|0)){b=0;do{o=j+(b<<2)|0;f[o>>2]=0;p=(f[a>>2]|0)-(f[m+(b<<2)>>2]|0)|0;f[e+(b<<2)>>2]=p;if(p|0){p=f[o>>2]|0;q=h-p|0;f[o>>2]=q>>>0

      >>0?p:q}b=b+1|0;q=f[i>>2]|0}while(b>>>0>>0);r=q}else{b=0;do{q=j+(b<<2)|0;f[q>>2]=0;p=(f[a>>2]|0)-(f[m+(b<<2)>>2]|0)|0;f[e+(b<<2)>>2]=p;if(p|0){o=(f[n+(b<<2)>>2]|0)+(1<>2]|0;s=f[(f[d>>2]|0)+24>>2]|0;t=c;u=f[q>>2]|0;do{v=s+((X(t,p)|0)<<2)+(b<<2)|0;u=u+((f[v>>2]|0)>>>0>>0&1)|0;f[q>>2]=u;t=t+1|0}while((t|0)!=(g|0));t=h-u|0;f[q>>2]=t>>>0>>0?u:t}b=b+1|0;t=f[i>>2]|0}while(b>>>0>>0);r=t}if(r){b=f[a+1140>>2]|0;i=a+1128|0;h=0;g=0;c=0;while(1){if(!(f[b+(g<<2)>>2]|0)){w=h;x=c}else{d=f[(f[i>>2]|0)+(g<<2)>>2]|0;l=h>>>0>>0;w=l?d:h;x=l?g:c}g=g+1|0;if(g>>>0>=r>>>0){y=x;break}else{h=w;c=x}}}else y=0}else y=0;x=a+1088|0;c=a+1104|0;w=f[c>>2]|0;h=32-w|0;if((h|0)<4){r=y&15;g=4-h|0;f[c>>2]=g;h=a+1100|0;i=f[h>>2]|r>>>g;f[h>>2]=i;g=a+1092|0;b=f[g>>2]|0;if((b|0)==(f[a+1096>>2]|0))Ri(x,h);else{f[b>>2]=i;f[g>>2]=b+4}f[h>>2]=r<<32-(f[c>>2]|0);k=y;return k|0}r=a+1100|0;h=f[r>>2]|y<<28>>>w;f[r>>2]=h;b=w+4|0;f[c>>2]=b;if((b|0)!=32){k=y;return k|0}b=a+1092|0;w=f[b>>2]|0;if((w|0)==(f[a+1096>>2]|0))Ri(x,r);else{f[w>>2]=h;f[b>>2]=w+4}f[r>>2]=0;f[c>>2]=0;k=y;return k|0}function Sd(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0;c=a+4|0;if(!b){d=f[a>>2]|0;f[a>>2]=0;if(d|0)Oq(d);f[c>>2]=0;return}if(b>>>0>1073741823){d=ra(8)|0;Oo(d,16035);f[d>>2]=7256;va(d|0,1112,110)}d=ln(b<<2)|0;e=f[a>>2]|0;f[a>>2]=d;if(e|0)Oq(e);f[c>>2]=b;c=0;do{f[(f[a>>2]|0)+(c<<2)>>2]=0;c=c+1|0}while((c|0)!=(b|0));c=a+8|0;e=f[c>>2]|0;if(!e)return;d=f[e+4>>2]|0;g=b+-1|0;h=(g&b|0)==0;if(!h)if(d>>>0>>0)i=d;else i=(d>>>0)%(b>>>0)|0;else i=d&g;f[(f[a>>2]|0)+(i<<2)>>2]=c;c=f[e>>2]|0;if(!c)return;else{j=i;k=e;l=c;m=e}a:while(1){b:do if(h){e=k;c=l;i=m;while(1){d=c;while(1){n=f[d+4>>2]&g;if((n|0)==(j|0))break;o=(f[a>>2]|0)+(n<<2)|0;if(!(f[o>>2]|0)){p=d;q=i;r=n;s=o;break b}o=d+8|0;t=d;while(1){u=f[t>>2]|0;if(!u)break;if((f[o>>2]|0)==(f[u+8>>2]|0))t=u;else break}f[i>>2]=u;f[t>>2]=f[f[(f[a>>2]|0)+(n<<2)>>2]>>2];f[f[(f[a>>2]|0)+(n<<2)>>2]>>2]=d;o=f[e>>2]|0;if(!o){v=37;break a}else d=o}c=f[d>>2]|0;if(!c){v=37;break a}else{e=d;i=d}}}else{i=k;e=l;c=m;while(1){o=e;while(1){w=f[o+4>>2]|0;if(w>>>0>>0)x=w;else x=(w>>>0)%(b>>>0)|0;if((x|0)==(j|0))break;w=(f[a>>2]|0)+(x<<2)|0;if(!(f[w>>2]|0)){p=o;q=c;r=x;s=w;break b}w=o+8|0;y=o;while(1){z=f[y>>2]|0;if(!z)break;if((f[w>>2]|0)==(f[z+8>>2]|0))y=z;else break}f[c>>2]=z;f[y>>2]=f[f[(f[a>>2]|0)+(x<<2)>>2]>>2];f[f[(f[a>>2]|0)+(x<<2)>>2]>>2]=o;w=f[i>>2]|0;if(!w){v=37;break a}else o=w}e=f[o>>2]|0;if(!e){v=37;break a}else{i=o;c=o}}}while(0);f[s>>2]=q;l=f[p>>2]|0;if(!l){v=37;break}else{j=r;k=p;m=p}}if((v|0)==37)return}function Td(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0;d=a+4|0;if(!c){e=f[a>>2]|0;f[a>>2]=0;if(e|0)Oq(e);f[d>>2]=0;return}if(c>>>0>1073741823){e=ra(8)|0;Oo(e,16035);f[e>>2]=7256;va(e|0,1112,110)}e=ln(c<<2)|0;g=f[a>>2]|0;f[a>>2]=e;if(g|0)Oq(g);f[d>>2]=c;d=0;do{f[(f[a>>2]|0)+(d<<2)>>2]=0;d=d+1|0}while((d|0)!=(c|0));d=a+8|0;g=f[d>>2]|0;if(!g)return;e=f[g+4>>2]|0;h=c+-1|0;i=(h&c|0)==0;if(!i)if(e>>>0>>0)j=e;else j=(e>>>0)%(c>>>0)|0;else j=e&h;f[(f[a>>2]|0)+(j<<2)>>2]=d;d=f[g>>2]|0;if(!d)return;e=a+24|0;k=j;j=g;l=d;d=g;a:while(1){g=j;m=l;n=d;b:while(1){o=m;while(1){p=f[o+4>>2]|0;if(!i)if(p>>>0>>0)q=p;else q=(p>>>0)%(c>>>0)|0;else q=p&h;if((q|0)==(k|0))break;r=(f[a>>2]|0)+(q<<2)|0;if(!(f[r>>2]|0))break b;p=f[o>>2]|0;c:do if(!p)s=o;else{t=f[o+8>>2]|0;u=f[e>>2]|0;v=f[u+8>>2]|0;w=(f[u+12>>2]|0)-v|0;u=v;v=w>>>2;if((w|0)>0){x=o;y=p}else{w=p;while(1){z=f[w>>2]|0;if(!z){s=w;break c}else w=z}}while(1){w=f[y+8>>2]|0;z=0;do{A=f[u+(z<<2)>>2]|0;if(!(b[A+84>>0]|0)){B=f[A+68>>2]|0;C=f[B+(w<<2)>>2]|0;D=f[B+(t<<2)>>2]|0}else{C=w;D=t}z=z+1|0;if((D|0)!=(C|0)){s=x;break c}}while((z|0)<(v|0));z=f[y>>2]|0;if(!z){s=y;break}else{w=y;y=z;x=w}}}while(0);f[n>>2]=f[s>>2];f[s>>2]=f[f[(f[a>>2]|0)+(q<<2)>>2]>>2];f[f[(f[a>>2]|0)+(q<<2)>>2]>>2]=o;p=f[g>>2]|0;if(!p){E=38;break a}else o=p}m=f[o>>2]|0;if(!m){E=38;break a}else{g=o;n=o}}f[r>>2]=n;l=f[o>>2]|0;if(!l){E=38;break}else{k=q;j=o;d=o}}if((E|0)==38)return}function Ud(a,c){a=a|0;c=c|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0;e=u;u=u+16|0;g=e+4|0;h=e;i=e+12|0;j=e+11|0;k=e+10|0;l=e+8|0;m=c+44|0;n=f[m>>2]|0;o=n+16|0;p=f[o+4>>2]|0;if(!((p|0)>0|(p|0)==0&(f[o>>2]|0)>>>0>0)){f[h>>2]=f[n+4>>2];f[g>>2]=f[h>>2];Me(n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0,(f[a>>2]|0)+r|0,g|0)|0;p=f[c+80>>2]|0;a:do if(p>>>0>1){if(d<<24>>24<=0){c=1;while(1){m=un(g|0,l|0,c|0,0)|0;t=Vn(m|0,I|0,r|0,o|0)|0;kh(q|0,(f[a>>2]|0)+t|0,g|0)|0;c=c+1|0;if(c>>>0>=p>>>0)break a}}c=f[k>>2]|0;t=1;do{m=un(g|0,l|0,t|0,0)|0;v=Vn(m|0,I|0,r|0,o|0)|0;kh(q|0,(f[a>>2]|0)+v|0,g|0)|0;v=0;do{m=c+(v<<2)|0;w=$(n[m>>2]);x=q+(v<<2)|0;y=$(n[x>>2]);if(w>y){n[m>>2]=y;z=$(n[x>>2])}else z=y;x=s+(v<<2)|0;if($(n[x>>2])>2]=z;v=v+1|0}while((v|0)!=(h|0));t=t+1|0}while(t>>>0

      >>0)}while(0);if(d<<24>>24>0){d=f[k>>2]|0;k=0;z=$(n[j>>2]);while(1){y=$(n[s+(k<<2)>>2]);w=$(y-$(n[d+(k<<2)>>2]));if(w>z){n[j>>2]=w;A=w}else A=z;k=k+1|0;if((k|0)==(h|0))break;else z=A}}Mq(q);Mq(s);i=1;u=e;return i|0}function Xd(a,b,c,d,e,g){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;g=g|0;var h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0;g=a+8|0;Mh(g,b,d,e);h=d-e|0;if((h|0)>0){d=0-e|0;i=a+16|0;j=a+32|0;k=a+12|0;l=a+28|0;m=a+20|0;n=a+24|0;o=h;h=f[g>>2]|0;while(1){p=b+(o<<2)|0;q=c+(o<<2)|0;if((h|0)>0){r=0;s=p+(d<<2)|0;t=h;while(1){if((t|0)>0){u=0;do{v=f[s+(u<<2)>>2]|0;w=f[i>>2]|0;if((v|0)>(w|0)){x=f[j>>2]|0;f[x+(u<<2)>>2]=w;y=x}else{x=f[k>>2]|0;w=f[j>>2]|0;f[w+(u<<2)>>2]=(v|0)<(x|0)?x:v;y=w}u=u+1|0}while((u|0)<(f[g>>2]|0));z=y}else z=f[j>>2]|0;u=(f[p+(r<<2)>>2]|0)-(f[z+(r<<2)>>2]|0)|0;w=q+(r<<2)|0;f[w>>2]=u;if((u|0)>=(f[l>>2]|0)){if((u|0)>(f[n>>2]|0)){A=u-(f[m>>2]|0)|0;B=31}}else{A=(f[m>>2]|0)+u|0;B=31}if((B|0)==31){B=0;f[w>>2]=A}r=r+1|0;w=f[g>>2]|0;if((r|0)>=(w|0)){C=w;break}else{s=z;t=w}}}else C=h;o=o-e|0;if((o|0)<=0){D=C;break}else h=C}}else D=f[g>>2]|0;C=e>>>0>1073741823?-1:e<<2;e=Lq(C)|0;sj(e|0,0,C|0)|0;if((D|0)<=0){Mq(e);return 1}C=a+16|0;h=a+32|0;o=a+12|0;z=a+28|0;A=a+20|0;m=a+24|0;a=0;n=e;l=D;while(1){if((l|0)>0){D=0;do{j=f[n+(D<<2)>>2]|0;y=f[C>>2]|0;if((j|0)>(y|0)){k=f[h>>2]|0;f[k+(D<<2)>>2]=y;E=k}else{k=f[o>>2]|0;y=f[h>>2]|0;f[y+(D<<2)>>2]=(j|0)<(k|0)?k:j;E=y}D=D+1|0}while((D|0)<(f[g>>2]|0));F=E}else F=f[h>>2]|0;D=(f[b+(a<<2)>>2]|0)-(f[F+(a<<2)>>2]|0)|0;y=c+(a<<2)|0;f[y>>2]=D;if((D|0)>=(f[z>>2]|0)){if((D|0)>(f[m>>2]|0)){G=D-(f[A>>2]|0)|0;B=16}}else{G=(f[A>>2]|0)+D|0;B=16}if((B|0)==16){B=0;f[y>>2]=G}a=a+1|0;l=f[g>>2]|0;if((a|0)>=(l|0))break;else n=F}Mq(e);return 1}function Yd(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0;e=f[a>>2]|0;g=e;h=(f[b>>2]|0)-g|0;b=e+(h>>2<<2)|0;i=f[c>>2]|0;c=f[d>>2]|0;d=c-i|0;j=d>>2;k=i;l=c;if((d|0)<=0){m=b;return m|0}d=a+8|0;n=f[d>>2]|0;o=a+4|0;p=f[o>>2]|0;q=p;if((j|0)<=(n-q>>2|0)){r=b;s=q-r|0;t=s>>2;if((j|0)>(t|0)){u=k+(t<<2)|0;t=u;if((u|0)==(l|0))v=p;else{w=l+-4-t|0;x=u;u=p;while(1){f[u>>2]=f[x>>2];x=x+4|0;if((x|0)==(l|0))break;else u=u+4|0}u=p+((w>>>2)+1<<2)|0;f[o>>2]=u;v=u}if((s|0)>0){y=t;z=v}else{m=b;return m|0}}else{y=c;z=p}c=z-(b+(j<<2))>>2;v=b+(c<<2)|0;if(v>>>0

      >>0){t=(p+(0-c<<2)+~r|0)>>>2;r=v;s=z;while(1){f[s>>2]=f[r>>2];r=r+4|0;if(r>>>0>=p>>>0)break;else s=s+4|0}f[o>>2]=z+(t+1<<2)}if(c|0){c=v;v=z;do{c=c+-4|0;v=v+-4|0;f[v>>2]=f[c>>2]}while((c|0)!=(b|0))}c=y;if((k|0)==(c|0)){m=b;return m|0}else{A=b;B=k}while(1){f[A>>2]=f[B>>2];B=B+4|0;if((B|0)==(c|0)){m=b;break}else A=A+4|0}return m|0}A=(q-g>>2)+j|0;if(A>>>0>1073741823)aq(a);j=n-g|0;g=j>>1;n=j>>2>>>0<536870911?(g>>>0>>0?A:g):1073741823;g=b;A=h>>2;do if(n)if(n>>>0>1073741823){j=ra(8)|0;Oo(j,16035);f[j>>2]=7256;va(j|0,1112,110)}else{j=ln(n<<2)|0;C=j;D=j;break}else{C=0;D=0}while(0);j=D+(A<<2)|0;A=D+(n<<2)|0;if((l|0)==(k|0))E=j;else{n=((l+-4-i|0)>>>2)+1|0;i=k;k=j;while(1){f[k>>2]=f[i>>2];i=i+4|0;if((i|0)==(l|0))break;else k=k+4|0}E=j+(n<<2)|0}if((h|0)>0)kh(C|0,e|0,h|0)|0;h=q-g|0;if((h|0)>0){kh(E|0,b|0,h|0)|0;F=E+(h>>>2<<2)|0}else F=E;f[a>>2]=D;f[o>>2]=F;f[d>>2]=A;if(!e){m=j;return m|0}Oq(e);m=j;return m|0}function Zd(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0;c=u;u=u+48|0;d=c+40|0;e=c+36|0;g=c+32|0;h=c;i=a+60|0;ci(f[i>>2]|0,b)|0;wn(h);tk(h);j=f[a+56>>2]|0;k=f[i>>2]|0;i=k>>>5;l=j+(i<<2)|0;m=k&31;k=(i|0)!=0;a:do if(i|m|0){if(!m){n=1;o=j;p=k;while(1){if(p){q=n;r=0;while(1){s=(f[o>>2]&1<>2]&1<>2]&1<>2]&1<>2]=f[a+12>>2];m=b+16|0;w=m;v=f[w>>2]|0;j=f[w+4>>2]|0;if((j|0)>0|(j|0)==0&v>>>0>0){x=j;y=v}else{f[e>>2]=f[b+4>>2];f[d>>2]=f[e>>2];Me(b,d,g,g+4|0)|0;v=m;x=f[v+4>>2]|0;y=f[v>>2]|0}f[g>>2]=f[a+20>>2];if((x|0)>0|(x|0)==0&y>>>0>0){Fj(h);u=c;return 1}f[e>>2]=f[b+4>>2];f[d>>2]=f[e>>2];Me(b,d,g,g+4|0)|0;Fj(h);u=c;return 1}function _d(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0;switch(b-a>>2|0){case 2:{d=b+-4|0;e=f[d>>2]|0;g=f[a>>2]|0;h=f[c>>2]|0;i=f[h>>2]|0;j=(f[h+4>>2]|0)-i>>3;if(j>>>0<=e>>>0)aq(h);k=i;if(j>>>0<=g>>>0)aq(h);if((f[k+(e<<3)>>2]|0)>>>0>=(f[k+(g<<3)>>2]|0)>>>0){l=1;return l|0}f[a>>2]=e;f[d>>2]=g;l=1;return l|0}case 3:{Vg(a,a+4|0,b+-4|0,c)|0;l=1;return l|0}case 4:{jh(a,a+4|0,a+8|0,b+-4|0,c)|0;l=1;return l|0}case 5:{ig(a,a+4|0,a+8|0,a+12|0,b+-4|0,c)|0;l=1;return l|0}case 1:case 0:{l=1;return l|0}default:{g=a+8|0;Vg(a,a+4|0,g,c)|0;d=a+12|0;a:do if((d|0)!=(b|0)){e=f[c>>2]|0;k=f[e>>2]|0;h=(f[e+4>>2]|0)-k>>3;j=k;k=d;i=0;m=g;b:while(1){n=f[k>>2]|0;o=f[m>>2]|0;if(h>>>0<=n>>>0){p=14;break}if(h>>>0<=o>>>0){p=16;break}q=j+(n<<3)|0;if((f[q>>2]|0)>>>0<(f[j+(o<<3)>>2]|0)>>>0){r=m;s=k;t=o;while(1){f[s>>2]=t;if((r|0)==(a|0)){u=a;break}o=r+-4|0;t=f[o>>2]|0;if(h>>>0<=t>>>0){p=20;break b}if((f[q>>2]|0)>>>0>=(f[j+(t<<3)>>2]|0)>>>0){u=r;break}else{v=r;r=o;s=v}}f[u>>2]=n;s=i+1|0;if((s|0)==8){w=0;x=(k+4|0)==(b|0);break a}else y=s}else y=i;s=k+4|0;if((s|0)==(b|0)){w=1;x=0;break a}else{r=k;k=s;i=y;m=r}}if((p|0)==14)aq(e);else if((p|0)==16)aq(e);else if((p|0)==20)aq(e)}else{w=1;x=0}while(0);l=x|w;return l|0}}return 0}function $d(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0;c=u;u=u+48|0;d=c+40|0;e=c+36|0;g=c+32|0;h=c;i=a+80|0;ci(f[i>>2]|0,b)|0;wn(h);tk(h);j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A=g;while(1){if((A|0)>0){g=0;do{B=f[z+(g<<2)>>2]|0;C=f[o>>2]|0;if((B|0)>(C|0)){D=f[q>>2]|0;f[D+(g<<2)>>2]=C;E=D}else{D=f[r>>2]|0;C=f[q>>2]|0;f[C+(g<<2)>>2]=(B|0)<(D|0)?D:B;E=C}g=g+1|0}while((g|0)<(f[l>>2]|0));F=E}else F=f[q>>2]|0;g=(f[n+(m<<2)>>2]|0)-(f[F+(m<<2)>>2]|0)|0;C=p+(m<<2)|0;f[C>>2]=g;if((g|0)>=(f[s>>2]|0)){if((g|0)>(f[v>>2]|0)){G=g-(f[t>>2]|0)|0;H=21}}else{G=(f[t>>2]|0)+g|0;H=21}if((H|0)==21){H=0;f[C>>2]=G}m=m+1|0;A=f[l>>2]|0;if((m|0)>=(A|0))break;else z=F}}w=w+-1|0;if((w|0)<=-1){H=5;break}z=f[d>>2]|0;x=f[z>>2]|0;if((f[z+4>>2]|0)-x>>2>>>0<=w>>>0){y=z;H=6;break}}if((H|0)==5){u=h;return 1}else if((H|0)==6)aq(y);return 0} -function $a(a){a=a|0;var b=0,c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,$=0,aa=0,ba=0,ca=0,da=0,ea=0,fa=0,ga=0,ha=0,ia=0,ja=0,ka=0,la=0,ma=0,na=0,oa=0,pa=0,qa=0,ra=0,sa=0,ta=0,ua=0,va=0,wa=0,xa=0,ya=0,za=0;b=u;u=u+16|0;c=b;do if(a>>>0<245){d=a>>>0<11?16:a+11&-8;e=d>>>3;g=f[4784]|0;h=g>>>e;if(h&3|0){i=(h&1^1)+e|0;j=19176+(i<<1<<2)|0;k=j+8|0;l=f[k>>2]|0;m=l+8|0;n=f[m>>2]|0;if((n|0)==(j|0))f[4784]=g&~(1<>2]=j;f[k>>2]=n}n=i<<3;f[l+4>>2]=n|3;i=l+n+4|0;f[i>>2]=f[i>>2]|1;o=m;u=b;return o|0}m=f[4786]|0;if(d>>>0>m>>>0){if(h|0){i=2<>>12&16;e=i>>>n;i=e>>>5&8;h=e>>>i;e=h>>>2&4;l=h>>>e;h=l>>>1&2;k=l>>>h;l=k>>>1&1;j=(i|n|e|h|l)+(k>>>l)|0;l=19176+(j<<1<<2)|0;k=l+8|0;h=f[k>>2]|0;e=h+8|0;n=f[e>>2]|0;if((n|0)==(l|0)){i=g&~(1<>2]=l;f[k>>2]=n;p=g}n=j<<3;j=n-d|0;f[h+4>>2]=d|3;k=h+d|0;f[k+4>>2]=j|1;f[h+n>>2]=j;if(m|0){n=f[4789]|0;h=m>>>3;l=19176+(h<<1<<2)|0;i=1<>2]|0;r=i}f[r>>2]=n;f[q+12>>2]=n;f[n+8>>2]=q;f[n+12>>2]=l}f[4786]=j;f[4789]=k;o=e;u=b;return o|0}e=f[4785]|0;if(e){k=(e&0-e)+-1|0;j=k>>>12&16;l=k>>>j;k=l>>>5&8;n=l>>>k;l=n>>>2&4;i=n>>>l;n=i>>>1&2;h=i>>>n;i=h>>>1&1;s=f[19440+((k|j|l|n|i)+(h>>>i)<<2)>>2]|0;i=(f[s+4>>2]&-8)-d|0;h=f[s+16+(((f[s+16>>2]|0)==0&1)<<2)>>2]|0;if(!h){t=s;v=i}else{n=s;s=i;i=h;while(1){h=(f[i+4>>2]&-8)-d|0;l=h>>>0>>0;j=l?h:s;h=l?i:n;i=f[i+16+(((f[i+16>>2]|0)==0&1)<<2)>>2]|0;if(!i){t=h;v=j;break}else{n=h;s=j}}}s=t+d|0;if(s>>>0>t>>>0){n=f[t+24>>2]|0;i=f[t+12>>2]|0;do if((i|0)==(t|0)){j=t+20|0;h=f[j>>2]|0;if(!h){l=t+16|0;k=f[l>>2]|0;if(!k){w=0;break}else{x=k;y=l}}else{x=h;y=j}while(1){j=x+20|0;h=f[j>>2]|0;if(h|0){x=h;y=j;continue}j=x+16|0;h=f[j>>2]|0;if(!h)break;else{x=h;y=j}}f[y>>2]=0;w=x}else{j=f[t+8>>2]|0;f[j+12>>2]=i;f[i+8>>2]=j;w=i}while(0);do if(n|0){i=f[t+28>>2]|0;j=19440+(i<<2)|0;if((t|0)==(f[j>>2]|0)){f[j>>2]=w;if(!w){f[4785]=e&~(1<>2]|0)!=(t|0)&1)<<2)>>2]=w;if(!w)break}f[w+24>>2]=n;i=f[t+16>>2]|0;if(i|0){f[w+16>>2]=i;f[i+24>>2]=w}i=f[t+20>>2]|0;if(i|0){f[w+20>>2]=i;f[i+24>>2]=w}}while(0);if(v>>>0<16){n=v+d|0;f[t+4>>2]=n|3;e=t+n+4|0;f[e>>2]=f[e>>2]|1}else{f[t+4>>2]=d|3;f[s+4>>2]=v|1;f[s+v>>2]=v;if(m|0){e=f[4789]|0;n=m>>>3;i=19176+(n<<1<<2)|0;j=1<>2]|0;A=j}f[A>>2]=e;f[z+12>>2]=e;f[e+8>>2]=z;f[e+12>>2]=i}f[4786]=v;f[4789]=s}o=t+8|0;u=b;return o|0}else B=d}else B=d}else B=d}else if(a>>>0<=4294967231){i=a+11|0;e=i&-8;j=f[4785]|0;if(j){n=0-e|0;h=i>>>8;if(h)if(e>>>0>16777215)C=31;else{i=(h+1048320|0)>>>16&8;l=h<>>16&4;k=l<>>16&2;D=14-(h|i|l)+(k<>>15)|0;C=e>>>(D+7|0)&1|D<<1}else C=0;D=f[19440+(C<<2)>>2]|0;a:do if(!D){E=0;F=0;G=n;H=57}else{l=0;k=n;i=D;h=e<<((C|0)==31?0:25-(C>>>1)|0);I=0;while(1){J=(f[i+4>>2]&-8)-e|0;if(J>>>0>>0)if(!J){K=0;L=i;M=i;H=61;break a}else{N=i;O=J}else{N=l;O=k}J=f[i+20>>2]|0;i=f[i+16+(h>>>31<<2)>>2]|0;P=(J|0)==0|(J|0)==(i|0)?I:J;J=(i|0)==0;if(J){E=P;F=N;G=O;H=57;break}else{l=N;k=O;h=h<<((J^1)&1);I=P}}}while(0);if((H|0)==57){if((E|0)==0&(F|0)==0){D=2<>>12&16;d=D>>>n;D=d>>>5&8;s=d>>>D;d=s>>>2&4;g=s>>>d;s=g>>>1&2;m=g>>>s;g=m>>>1&1;Q=0;R=f[19440+((D|n|d|s|g)+(m>>>g)<<2)>>2]|0}else{Q=F;R=E}if(!R){S=Q;T=G}else{K=G;L=R;M=Q;H=61}}if((H|0)==61)while(1){H=0;g=(f[L+4>>2]&-8)-e|0;m=g>>>0>>0;s=m?g:K;g=m?L:M;L=f[L+16+(((f[L+16>>2]|0)==0&1)<<2)>>2]|0;if(!L){S=g;T=s;break}else{K=s;M=g;H=61}}if((S|0)!=0?T>>>0<((f[4786]|0)-e|0)>>>0:0){g=S+e|0;if(g>>>0<=S>>>0){o=0;u=b;return o|0}s=f[S+24>>2]|0;m=f[S+12>>2]|0;do if((m|0)==(S|0)){d=S+20|0;n=f[d>>2]|0;if(!n){D=S+16|0;I=f[D>>2]|0;if(!I){U=0;break}else{V=I;W=D}}else{V=n;W=d}while(1){d=V+20|0;n=f[d>>2]|0;if(n|0){V=n;W=d;continue}d=V+16|0;n=f[d>>2]|0;if(!n)break;else{V=n;W=d}}f[W>>2]=0;U=V}else{d=f[S+8>>2]|0;f[d+12>>2]=m;f[m+8>>2]=d;U=m}while(0);do if(s){m=f[S+28>>2]|0;d=19440+(m<<2)|0;if((S|0)==(f[d>>2]|0)){f[d>>2]=U;if(!U){d=j&~(1<>2]|0)!=(S|0)&1)<<2)>>2]=U;if(!U){X=j;break}}f[U+24>>2]=s;d=f[S+16>>2]|0;if(d|0){f[U+16>>2]=d;f[d+24>>2]=U}d=f[S+20>>2]|0;if(d){f[U+20>>2]=d;f[d+24>>2]=U;X=j}else X=j}else X=j;while(0);do if(T>>>0>=16){f[S+4>>2]=e|3;f[g+4>>2]=T|1;f[g+T>>2]=T;j=T>>>3;if(T>>>0<256){s=19176+(j<<1<<2)|0;d=f[4784]|0;m=1<>2]|0;Z=m}f[Z>>2]=g;f[Y+12>>2]=g;f[g+8>>2]=Y;f[g+12>>2]=s;break}s=T>>>8;if(s)if(T>>>0>16777215)_=31;else{m=(s+1048320|0)>>>16&8;d=s<>>16&4;j=d<>>16&2;n=14-(s|m|d)+(j<>>15)|0;_=T>>>(n+7|0)&1|n<<1}else _=0;n=19440+(_<<2)|0;f[g+28>>2]=_;d=g+16|0;f[d+4>>2]=0;f[d>>2]=0;d=1<<_;if(!(X&d)){f[4785]=X|d;f[n>>2]=g;f[g+24>>2]=n;f[g+12>>2]=g;f[g+8>>2]=g;break}d=T<<((_|0)==31?0:25-(_>>>1)|0);j=f[n>>2]|0;while(1){if((f[j+4>>2]&-8|0)==(T|0)){H=97;break}$=j+16+(d>>>31<<2)|0;n=f[$>>2]|0;if(!n){H=96;break}else{d=d<<1;j=n}}if((H|0)==96){f[$>>2]=g;f[g+24>>2]=j;f[g+12>>2]=g;f[g+8>>2]=g;break}else if((H|0)==97){d=j+8|0;n=f[d>>2]|0;f[n+12>>2]=g;f[d>>2]=g;f[g+8>>2]=n;f[g+12>>2]=j;f[g+24>>2]=0;break}}else{n=T+e|0;f[S+4>>2]=n|3;d=S+n+4|0;f[d>>2]=f[d>>2]|1}while(0);o=S+8|0;u=b;return o|0}else B=e}else B=e}else B=-1;while(0);S=f[4786]|0;if(S>>>0>=B>>>0){T=S-B|0;$=f[4789]|0;if(T>>>0>15){_=$+B|0;f[4789]=_;f[4786]=T;f[_+4>>2]=T|1;f[$+S>>2]=T;f[$+4>>2]=B|3}else{f[4786]=0;f[4789]=0;f[$+4>>2]=S|3;T=$+S+4|0;f[T>>2]=f[T>>2]|1}o=$+8|0;u=b;return o|0}$=f[4787]|0;if($>>>0>B>>>0){T=$-B|0;f[4787]=T;S=f[4790]|0;_=S+B|0;f[4790]=_;f[_+4>>2]=T|1;f[S+4>>2]=B|3;o=S+8|0;u=b;return o|0}if(!(f[4902]|0)){f[4904]=4096;f[4903]=4096;f[4905]=-1;f[4906]=-1;f[4907]=0;f[4895]=0;f[4902]=c&-16^1431655768;aa=4096}else aa=f[4904]|0;c=B+48|0;S=B+47|0;T=aa+S|0;_=0-aa|0;aa=T&_;if(aa>>>0<=B>>>0){o=0;u=b;return o|0}X=f[4894]|0;if(X|0?(Y=f[4892]|0,Z=Y+aa|0,Z>>>0<=Y>>>0|Z>>>0>X>>>0):0){o=0;u=b;return o|0}b:do if(!(f[4895]&4)){X=f[4790]|0;c:do if(X){Z=19584;while(1){Y=f[Z>>2]|0;if(Y>>>0<=X>>>0?(ba=Z+4|0,(Y+(f[ba>>2]|0)|0)>>>0>X>>>0):0)break;Y=f[Z+8>>2]|0;if(!Y){H=118;break c}else Z=Y}j=T-$&_;if(j>>>0<2147483647){Y=Nl(j|0)|0;if((Y|0)==((f[Z>>2]|0)+(f[ba>>2]|0)|0))if((Y|0)==(-1|0))ca=j;else{da=j;ea=Y;H=135;break b}else{fa=Y;ga=j;H=126}}else ca=0}else H=118;while(0);do if((H|0)==118){X=Nl(0)|0;if((X|0)!=(-1|0)?(e=X,j=f[4903]|0,Y=j+-1|0,U=((Y&e|0)==0?0:(Y+e&0-j)-e|0)+aa|0,e=f[4892]|0,j=U+e|0,U>>>0>B>>>0&U>>>0<2147483647):0){Y=f[4894]|0;if(Y|0?j>>>0<=e>>>0|j>>>0>Y>>>0:0){ca=0;break}Y=Nl(U|0)|0;if((Y|0)==(X|0)){da=U;ea=X;H=135;break b}else{fa=Y;ga=U;H=126}}else ca=0}while(0);do if((H|0)==126){U=0-ga|0;if(!(c>>>0>ga>>>0&(ga>>>0<2147483647&(fa|0)!=(-1|0))))if((fa|0)==(-1|0)){ca=0;break}else{da=ga;ea=fa;H=135;break b}Y=f[4904]|0;X=S-ga+Y&0-Y;if(X>>>0>=2147483647){da=ga;ea=fa;H=135;break b}if((Nl(X|0)|0)==(-1|0)){Nl(U|0)|0;ca=0;break}else{da=X+ga|0;ea=fa;H=135;break b}}while(0);f[4895]=f[4895]|4;ha=ca;H=133}else{ha=0;H=133}while(0);if(((H|0)==133?aa>>>0<2147483647:0)?(ca=Nl(aa|0)|0,aa=Nl(0)|0,fa=aa-ca|0,ga=fa>>>0>(B+40|0)>>>0,!((ca|0)==(-1|0)|ga^1|ca>>>0>>0&((ca|0)!=(-1|0)&(aa|0)!=(-1|0))^1)):0){da=ga?fa:ha;ea=ca;H=135}if((H|0)==135){ca=(f[4892]|0)+da|0;f[4892]=ca;if(ca>>>0>(f[4893]|0)>>>0)f[4893]=ca;ca=f[4790]|0;do if(ca){ha=19584;while(1){ia=f[ha>>2]|0;ja=ha+4|0;ka=f[ja>>2]|0;if((ea|0)==(ia+ka|0)){H=143;break}fa=f[ha+8>>2]|0;if(!fa)break;else ha=fa}if(((H|0)==143?(f[ha+12>>2]&8|0)==0:0)?ea>>>0>ca>>>0&ia>>>0<=ca>>>0:0){f[ja>>2]=ka+da;fa=(f[4787]|0)+da|0;ga=ca+8|0;aa=(ga&7|0)==0?0:0-ga&7;ga=ca+aa|0;S=fa-aa|0;f[4790]=ga;f[4787]=S;f[ga+4>>2]=S|1;f[ca+fa+4>>2]=40;f[4791]=f[4906];break}if(ea>>>0<(f[4788]|0)>>>0)f[4788]=ea;fa=ea+da|0;S=19584;while(1){if((f[S>>2]|0)==(fa|0)){H=151;break}ga=f[S+8>>2]|0;if(!ga){la=19584;break}else S=ga}if((H|0)==151)if(!(f[S+12>>2]&8)){f[S>>2]=ea;ha=S+4|0;f[ha>>2]=(f[ha>>2]|0)+da;ha=ea+8|0;ga=ea+((ha&7|0)==0?0:0-ha&7)|0;ha=fa+8|0;aa=fa+((ha&7|0)==0?0:0-ha&7)|0;ha=ga+B|0;c=aa-ga-B|0;f[ga+4>>2]=B|3;do if((ca|0)!=(aa|0)){if((f[4789]|0)==(aa|0)){ba=(f[4786]|0)+c|0;f[4786]=ba;f[4789]=ha;f[ha+4>>2]=ba|1;f[ha+ba>>2]=ba;break}ba=f[aa+4>>2]|0;if((ba&3|0)==1){_=ba&-8;$=ba>>>3;d:do if(ba>>>0<256){T=f[aa+8>>2]|0;X=f[aa+12>>2]|0;if((X|0)==(T|0)){f[4784]=f[4784]&~(1<<$);break}else{f[T+12>>2]=X;f[X+8>>2]=T;break}}else{T=f[aa+24>>2]|0;X=f[aa+12>>2]|0;do if((X|0)==(aa|0)){U=aa+16|0;Y=U+4|0;j=f[Y>>2]|0;if(!j){e=f[U>>2]|0;if(!e){ma=0;break}else{na=e;oa=U}}else{na=j;oa=Y}while(1){Y=na+20|0;j=f[Y>>2]|0;if(j|0){na=j;oa=Y;continue}Y=na+16|0;j=f[Y>>2]|0;if(!j)break;else{na=j;oa=Y}}f[oa>>2]=0;ma=na}else{Y=f[aa+8>>2]|0;f[Y+12>>2]=X;f[X+8>>2]=Y;ma=X}while(0);if(!T)break;X=f[aa+28>>2]|0;Y=19440+(X<<2)|0;do if((f[Y>>2]|0)!=(aa|0)){f[T+16+(((f[T+16>>2]|0)!=(aa|0)&1)<<2)>>2]=ma;if(!ma)break d}else{f[Y>>2]=ma;if(ma|0)break;f[4785]=f[4785]&~(1<>2]=T;X=aa+16|0;Y=f[X>>2]|0;if(Y|0){f[ma+16>>2]=Y;f[Y+24>>2]=ma}Y=f[X+4>>2]|0;if(!Y)break;f[ma+20>>2]=Y;f[Y+24>>2]=ma}while(0);pa=aa+_|0;qa=_+c|0}else{pa=aa;qa=c}$=pa+4|0;f[$>>2]=f[$>>2]&-2;f[ha+4>>2]=qa|1;f[ha+qa>>2]=qa;$=qa>>>3;if(qa>>>0<256){ba=19176+($<<1<<2)|0;Z=f[4784]|0;Y=1<<$;if(!(Z&Y)){f[4784]=Z|Y;ra=ba;sa=ba+8|0}else{Y=ba+8|0;ra=f[Y>>2]|0;sa=Y}f[sa>>2]=ha;f[ra+12>>2]=ha;f[ha+8>>2]=ra;f[ha+12>>2]=ba;break}ba=qa>>>8;do if(!ba)ta=0;else{if(qa>>>0>16777215){ta=31;break}Y=(ba+1048320|0)>>>16&8;Z=ba<>>16&4;X=Z<<$;Z=(X+245760|0)>>>16&2;j=14-($|Y|Z)+(X<>>15)|0;ta=qa>>>(j+7|0)&1|j<<1}while(0);ba=19440+(ta<<2)|0;f[ha+28>>2]=ta;_=ha+16|0;f[_+4>>2]=0;f[_>>2]=0;_=f[4785]|0;j=1<>2]=ha;f[ha+24>>2]=ba;f[ha+12>>2]=ha;f[ha+8>>2]=ha;break}j=qa<<((ta|0)==31?0:25-(ta>>>1)|0);_=f[ba>>2]|0;while(1){if((f[_+4>>2]&-8|0)==(qa|0)){H=192;break}ua=_+16+(j>>>31<<2)|0;ba=f[ua>>2]|0;if(!ba){H=191;break}else{j=j<<1;_=ba}}if((H|0)==191){f[ua>>2]=ha;f[ha+24>>2]=_;f[ha+12>>2]=ha;f[ha+8>>2]=ha;break}else if((H|0)==192){j=_+8|0;ba=f[j>>2]|0;f[ba+12>>2]=ha;f[j>>2]=ha;f[ha+8>>2]=ba;f[ha+12>>2]=_;f[ha+24>>2]=0;break}}else{ba=(f[4787]|0)+c|0;f[4787]=ba;f[4790]=ha;f[ha+4>>2]=ba|1}while(0);o=ga+8|0;u=b;return o|0}else la=19584;while(1){ha=f[la>>2]|0;if(ha>>>0<=ca>>>0?(va=ha+(f[la+4>>2]|0)|0,va>>>0>ca>>>0):0)break;la=f[la+8>>2]|0}ga=va+-47|0;ha=ga+8|0;c=ga+((ha&7|0)==0?0:0-ha&7)|0;ha=ca+16|0;ga=c>>>0>>0?ca:c;c=ga+8|0;aa=da+-40|0;fa=ea+8|0;S=(fa&7|0)==0?0:0-fa&7;fa=ea+S|0;ba=aa-S|0;f[4790]=fa;f[4787]=ba;f[fa+4>>2]=ba|1;f[ea+aa+4>>2]=40;f[4791]=f[4906];aa=ga+4|0;f[aa>>2]=27;f[c>>2]=f[4896];f[c+4>>2]=f[4897];f[c+8>>2]=f[4898];f[c+12>>2]=f[4899];f[4896]=ea;f[4897]=da;f[4899]=0;f[4898]=c;c=ga+24|0;do{ba=c;c=c+4|0;f[c>>2]=7}while((ba+8|0)>>>0>>0);if((ga|0)!=(ca|0)){c=ga-ca|0;f[aa>>2]=f[aa>>2]&-2;f[ca+4>>2]=c|1;f[ga>>2]=c;ba=c>>>3;if(c>>>0<256){fa=19176+(ba<<1<<2)|0;S=f[4784]|0;j=1<>2]|0;xa=j}f[xa>>2]=ca;f[wa+12>>2]=ca;f[ca+8>>2]=wa;f[ca+12>>2]=fa;break}fa=c>>>8;if(fa)if(c>>>0>16777215)ya=31;else{j=(fa+1048320|0)>>>16&8;S=fa<>>16&4;ba=S<>>16&2;Z=14-(fa|j|S)+(ba<>>15)|0;ya=c>>>(Z+7|0)&1|Z<<1}else ya=0;Z=19440+(ya<<2)|0;f[ca+28>>2]=ya;f[ca+20>>2]=0;f[ha>>2]=0;S=f[4785]|0;ba=1<>2]=ca;f[ca+24>>2]=Z;f[ca+12>>2]=ca;f[ca+8>>2]=ca;break}ba=c<<((ya|0)==31?0:25-(ya>>>1)|0);S=f[Z>>2]|0;while(1){if((f[S+4>>2]&-8|0)==(c|0)){H=213;break}za=S+16+(ba>>>31<<2)|0;Z=f[za>>2]|0;if(!Z){H=212;break}else{ba=ba<<1;S=Z}}if((H|0)==212){f[za>>2]=ca;f[ca+24>>2]=S;f[ca+12>>2]=ca;f[ca+8>>2]=ca;break}else if((H|0)==213){ba=S+8|0;c=f[ba>>2]|0;f[c+12>>2]=ca;f[ba>>2]=ca;f[ca+8>>2]=c;f[ca+12>>2]=S;f[ca+24>>2]=0;break}}}else{c=f[4788]|0;if((c|0)==0|ea>>>0>>0)f[4788]=ea;f[4896]=ea;f[4897]=da;f[4899]=0;f[4793]=f[4902];f[4792]=-1;f[4797]=19176;f[4796]=19176;f[4799]=19184;f[4798]=19184;f[4801]=19192;f[4800]=19192;f[4803]=19200;f[4802]=19200;f[4805]=19208;f[4804]=19208;f[4807]=19216;f[4806]=19216;f[4809]=19224;f[4808]=19224;f[4811]=19232;f[4810]=19232;f[4813]=19240;f[4812]=19240;f[4815]=19248;f[4814]=19248;f[4817]=19256;f[4816]=19256;f[4819]=19264;f[4818]=19264;f[4821]=19272;f[4820]=19272;f[4823]=19280;f[4822]=19280;f[4825]=19288;f[4824]=19288;f[4827]=19296;f[4826]=19296;f[4829]=19304;f[4828]=19304;f[4831]=19312;f[4830]=19312;f[4833]=19320;f[4832]=19320;f[4835]=19328;f[4834]=19328;f[4837]=19336;f[4836]=19336;f[4839]=19344;f[4838]=19344;f[4841]=19352;f[4840]=19352;f[4843]=19360;f[4842]=19360;f[4845]=19368;f[4844]=19368;f[4847]=19376;f[4846]=19376;f[4849]=19384;f[4848]=19384;f[4851]=19392;f[4850]=19392;f[4853]=19400;f[4852]=19400;f[4855]=19408;f[4854]=19408;f[4857]=19416;f[4856]=19416;f[4859]=19424;f[4858]=19424;c=da+-40|0;ba=ea+8|0;ha=(ba&7|0)==0?0:0-ba&7;ba=ea+ha|0;ga=c-ha|0;f[4790]=ba;f[4787]=ga;f[ba+4>>2]=ga|1;f[ea+c+4>>2]=40;f[4791]=f[4906]}while(0);ea=f[4787]|0;if(ea>>>0>B>>>0){da=ea-B|0;f[4787]=da;ea=f[4790]|0;ca=ea+B|0;f[4790]=ca;f[ca+4>>2]=da|1;f[ea+4>>2]=B|3;o=ea+8|0;u=b;return o|0}}ea=Vq()|0;f[ea>>2]=12;o=0;u=b;return o|0}function ab(a,c,d,e,g,i){a=a|0;c=c|0;d=d|0;e=e|0;g=g|0;i=i|0;var j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,Z=0,_=0,$=0,aa=0,ba=0,ca=0,da=0,ea=0,fa=0,ga=0,ha=0,ia=0,ja=0,ka=0,la=0,ma=0,na=0,oa=0,pa=0,qa=0,ra=0,sa=0,ta=0,ua=0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b;break}}else ub=f[Z>>2]|0;nb=0;lb=0;while(1){pb=(f[mb+(nb<<2)>>2]|0)-(f[Ba+(nb<<2)>>2]|0)|0;ob=((pb|0)>-1?pb:0-pb|0)+lb|0;f[Fa+(nb<<2)>>2]=pb;f[ub+(nb<<2)>>2]=pb<<1^pb>>31;nb=nb+1|0;if((nb|0)==(g|0)){vb=ob;wb=ub;break}else lb=ob}}else{vb=0;wb=f[Z>>2]|0}while(0);mo(j,_,wb,g);mb=Zk(j)|0;lb=I;nb=Bm(j)|0;ob=I;Xa=+wm(Aa,kb);pb=Vn(nb|0,ob|0,mb|0,lb|0)|0;Va=+W(+(Xa*Wa));lb=Vn(pb|0,I|0,~~Va>>>0|0,(+K(Va)>=1.0?(Va>0.0?~~+Y(+J(Va/4294967296.0),4294967295.0)>>>0:~~+W((Va-+(~~Va>>>0))/4294967296.0)>>>0):0)|0)|0;pb=f[r>>2]|0;if(!((pb|0)<=(lb|0)?!((pb|0)>=(lb|0)?(vb|0)<(f[T>>2]|0):0):0)){pb=r;f[pb>>2]=lb;f[pb+4>>2]=vb;b[U>>0]=sb;f[V>>2]=jb;f[v>>2]=f[m>>2];f[w>>2]=f[E>>2];f[k>>2]=f[v>>2];f[j>>2]=f[w>>2];Jf($,k,j);f[x>>2]=Ea;f[y>>2]=Oa;f[k>>2]=f[x>>2];f[j>>2]=f[y>>2];Jf(aa,k,j)}if(Ka)break;xb=b[Ma>>0]|0;pb=-1;lb=xb;while(1){mb=pb+-1|0;yb=Pa+mb|0;ob=lb;lb=b[yb>>0]|0;if((lb&255)<(ob&255))break;if((yb|0)==(n|0)){zb=84;break d}else pb=mb}mb=Pa+pb|0;if((lb&255)<(xb&255)){Ab=Ma;Bb=xb}else{ob=Pa;nb=Ma;while(1){qb=nb+-1|0;if((lb&255)<(h[ob+-2>>0]|0)){Ab=qb;Bb=1;break}else{Cb=nb;nb=qb;ob=Cb}}}b[yb>>0]=Bb;b[Ab>>0]=lb;if((pb|0)<-1){Db=mb;E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-Mb|0)>>>2)<<2);Oq(Mb)}Mb=f[l+24>>2]|0;if(Mb|0){E=l+28|0;m=f[E>>2]|0;if((m|0)!=(Mb|0))f[E>>2]=m+(~((m+-4-Mb|0)>>>2)<<2);Oq(Mb)}Mb=f[l+12>>2]|0;if(Mb|0){m=l+16|0;E=f[m>>2]|0;if((E|0)!=(Mb|0))f[m>>2]=E+(~((E+-4-Mb|0)>>>2)<<2);Oq(Mb)}Mb=f[l>>2]|0;if(!Mb){u=i;return 1}E=l+4|0;l=f[E>>2]|0;if((l|0)!=(Mb|0))f[E>>2]=l+(~((l+-4-Mb|0)>>>2)<<2);Oq(Mb);u=i;return 1}function cb(a){a=a|0;var b=0,c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0;b=u;u=u+16|0;c=b;d=b+8|0;e=b+4|0;f[d>>2]=a;do if(a>>>0>=212){g=(a>>>0)/210|0;h=g*210|0;f[e>>2]=a-h;i=0;j=g;g=(Hl(6952,7144,e,c)|0)-6952>>2;k=h;a:while(1){l=(f[6952+(g<<2)>>2]|0)+k|0;h=5;while(1){if(h>>>0>=47){m=211;n=i;o=8;break}p=f[6760+(h<<2)>>2]|0;q=(l>>>0)/(p>>>0)|0;if(q>>>0

      >>0){o=106;break a}if((l|0)==(X(q,p)|0)){r=i;break}else h=h+1|0}b:do if((o|0)==8){c:while(1){o=0;h=(l>>>0)/(m>>>0)|0;do if(h>>>0>=m>>>0)if((l|0)!=(X(h,m)|0)){p=m+10|0;q=(l>>>0)/(p>>>0)|0;if(q>>>0>=p>>>0)if((l|0)!=(X(q,p)|0)){q=m+12|0;s=(l>>>0)/(q>>>0)|0;if(s>>>0>=q>>>0)if((l|0)!=(X(s,q)|0)){s=m+16|0;t=(l>>>0)/(s>>>0)|0;if(t>>>0>=s>>>0)if((l|0)!=(X(t,s)|0)){t=m+18|0;v=(l>>>0)/(t>>>0)|0;if(v>>>0>=t>>>0)if((l|0)!=(X(v,t)|0)){v=m+22|0;w=(l>>>0)/(v>>>0)|0;if(w>>>0>=v>>>0)if((l|0)!=(X(w,v)|0)){w=m+28|0;x=(l>>>0)/(w>>>0)|0;if(x>>>0>=w>>>0)if((l|0)==(X(x,w)|0)){y=w;z=9;A=n}else{x=m+30|0;B=(l>>>0)/(x>>>0)|0;if(B>>>0>>0){y=x;z=1;A=l;break}if((l|0)==(X(B,x)|0)){y=x;z=9;A=n;break}x=m+36|0;B=(l>>>0)/(x>>>0)|0;if(B>>>0>>0){y=x;z=1;A=l;break}if((l|0)==(X(B,x)|0)){y=x;z=9;A=n;break}x=m+40|0;B=(l>>>0)/(x>>>0)|0;if(B>>>0>>0){y=x;z=1;A=l;break}if((l|0)==(X(B,x)|0)){y=x;z=9;A=n;break}x=m+42|0;B=(l>>>0)/(x>>>0)|0;if(B>>>0>>0){y=x;z=1;A=l;break}if((l|0)==(X(B,x)|0)){y=x;z=9;A=n;break}x=m+46|0;B=(l>>>0)/(x>>>0)|0;if(B>>>0>>0){y=x;z=1;A=l;break}if((l|0)==(X(B,x)|0)){y=x;z=9;A=n;break}x=m+52|0;B=(l>>>0)/(x>>>0)|0;if(B>>>0>>0){y=x;z=1;A=l;break}if((l|0)==(X(B,x)|0)){y=x;z=9;A=n;break}x=m+58|0;B=(l>>>0)/(x>>>0)|0;if(B>>>0>>0){y=x;z=1;A=l;break}if((l|0)==(X(B,x)|0)){y=x;z=9;A=n;break}x=m+60|0;B=(l>>>0)/(x>>>0)|0;if(B>>>0>>0){y=x;z=1;A=l;break}if((l|0)==(X(B,x)|0)){y=x;z=9;A=n;break}x=m+66|0;B=(l>>>0)/(x>>>0)|0;if(B>>>0>>0){y=x;z=1;A=l;break}if((l|0)==(X(B,x)|0)){y=x;z=9;A=n;break}x=m+70|0;B=(l>>>0)/(x>>>0)|0;if(B>>>0>>0){y=x;z=1;A=l;break}if((l|0)==(X(B,x)|0)){y=x;z=9;A=n;break}x=m+72|0;B=(l>>>0)/(x>>>0)|0;if(B>>>0>>0){y=x;z=1;A=l;break}if((l|0)==(X(B,x)|0)){y=x;z=9;A=n;break}x=m+78|0;B=(l>>>0)/(x>>>0)|0;if(B>>>0>>0){y=x;z=1;A=l;break}if((l|0)==(X(B,x)|0)){y=x;z=9;A=n;break}x=m+82|0;B=(l>>>0)/(x>>>0)|0;if(B>>>0>>0){y=x;z=1;A=l;break}if((l|0)==(X(B,x)|0)){y=x;z=9;A=n;break}x=m+88|0;B=(l>>>0)/(x>>>0)|0;if(B>>>0>>0){y=x;z=1;A=l;break}if((l|0)==(X(B,x)|0)){y=x;z=9;A=n;break}x=m+96|0;B=(l>>>0)/(x>>>0)|0;if(B>>>0>>0){y=x;z=1;A=l;break}if((l|0)==(X(B,x)|0)){y=x;z=9;A=n;break}x=m+100|0;B=(l>>>0)/(x>>>0)|0;if(B>>>0>>0){y=x;z=1;A=l;break}if((l|0)==(X(B,x)|0)){y=x;z=9;A=n;break}x=m+102|0;B=(l>>>0)/(x>>>0)|0;if(B>>>0>>0){y=x;z=1;A=l;break}if((l|0)==(X(B,x)|0)){y=x;z=9;A=n;break}x=m+106|0;B=(l>>>0)/(x>>>0)|0;if(B>>>0>>0){y=x;z=1;A=l;break}if((l|0)==(X(B,x)|0)){y=x;z=9;A=n;break}x=m+108|0;B=(l>>>0)/(x>>>0)|0;if(B>>>0>>0){y=x;z=1;A=l;break}if((l|0)==(X(B,x)|0)){y=x;z=9;A=n;break}x=m+112|0;B=(l>>>0)/(x>>>0)|0;if(B>>>0>>0){y=x;z=1;A=l;break}if((l|0)==(X(B,x)|0)){y=x;z=9;A=n;break}x=m+120|0;B=(l>>>0)/(x>>>0)|0;if(B>>>0>>0){y=x;z=1;A=l;break}if((l|0)==(X(B,x)|0)){y=x;z=9;A=n;break}x=m+126|0;B=(l>>>0)/(x>>>0)|0;if(B>>>0>>0){y=x;z=1;A=l;break}if((l|0)==(X(B,x)|0)){y=x;z=9;A=n;break}x=m+130|0;B=(l>>>0)/(x>>>0)|0;if(B>>>0>>0){y=x;z=1;A=l;break}if((l|0)==(X(B,x)|0)){y=x;z=9;A=n;break}x=m+136|0;B=(l>>>0)/(x>>>0)|0;if(B>>>0>>0){y=x;z=1;A=l;break}if((l|0)==(X(B,x)|0)){y=x;z=9;A=n;break}x=m+138|0;B=(l>>>0)/(x>>>0)|0;if(B>>>0>>0){y=x;z=1;A=l;break}if((l|0)==(X(B,x)|0)){y=x;z=9;A=n;break}x=m+142|0;B=(l>>>0)/(x>>>0)|0;if(B>>>0>>0){y=x;z=1;A=l;break}if((l|0)==(X(B,x)|0)){y=x;z=9;A=n;break}x=m+148|0;B=(l>>>0)/(x>>>0)|0;if(B>>>0>>0){y=x;z=1;A=l;break}if((l|0)==(X(B,x)|0)){y=x;z=9;A=n;break}x=m+150|0;B=(l>>>0)/(x>>>0)|0;if(B>>>0>>0){y=x;z=1;A=l;break}if((l|0)==(X(B,x)|0)){y=x;z=9;A=n;break}x=m+156|0;B=(l>>>0)/(x>>>0)|0;if(B>>>0>>0){y=x;z=1;A=l;break}if((l|0)==(X(B,x)|0)){y=x;z=9;A=n;break}x=m+162|0;B=(l>>>0)/(x>>>0)|0;if(B>>>0>>0){y=x;z=1;A=l;break}if((l|0)==(X(B,x)|0)){y=x;z=9;A=n;break}x=m+166|0;B=(l>>>0)/(x>>>0)|0;if(B>>>0>>0){y=x;z=1;A=l;break}if((l|0)==(X(B,x)|0)){y=x;z=9;A=n;break}x=m+168|0;B=(l>>>0)/(x>>>0)|0;if(B>>>0>>0){y=x;z=1;A=l;break}if((l|0)==(X(B,x)|0)){y=x;z=9;A=n;break}x=m+172|0;B=(l>>>0)/(x>>>0)|0;if(B>>>0>>0){y=x;z=1;A=l;break}if((l|0)==(X(B,x)|0)){y=x;z=9;A=n;break}x=m+178|0;B=(l>>>0)/(x>>>0)|0;if(B>>>0>>0){y=x;z=1;A=l;break}if((l|0)==(X(B,x)|0)){y=x;z=9;A=n;break}x=m+180|0;B=(l>>>0)/(x>>>0)|0;if(B>>>0>>0){y=x;z=1;A=l;break}if((l|0)==(X(B,x)|0)){y=x;z=9;A=n;break}x=m+186|0;B=(l>>>0)/(x>>>0)|0;if(B>>>0>>0){y=x;z=1;A=l;break}if((l|0)==(X(B,x)|0)){y=x;z=9;A=n;break}x=m+190|0;B=(l>>>0)/(x>>>0)|0;if(B>>>0>>0){y=x;z=1;A=l;break}if((l|0)==(X(B,x)|0)){y=x;z=9;A=n;break}x=m+192|0;B=(l>>>0)/(x>>>0)|0;if(B>>>0>>0){y=x;z=1;A=l;break}if((l|0)==(X(B,x)|0)){y=x;z=9;A=n;break}x=m+196|0;B=(l>>>0)/(x>>>0)|0;if(B>>>0>>0){y=x;z=1;A=l;break}if((l|0)==(X(B,x)|0)){y=x;z=9;A=n;break}x=m+198|0;B=(l>>>0)/(x>>>0)|0;if(B>>>0>>0){y=x;z=1;A=l;break}if((l|0)==(X(B,x)|0)){y=x;z=9;A=n;break}x=m+208|0;B=(l>>>0)/(x>>>0)|0;C=B>>>0>>0;D=(l|0)==(X(B,x)|0);y=C|D?x:m+210|0;z=C?1:D?9:0;A=C?l:n}else{y=w;z=1;A=l}}else{y=v;z=9;A=n}else{y=v;z=1;A=l}}else{y=t;z=9;A=n}else{y=t;z=1;A=l}}else{y=s;z=9;A=n}else{y=s;z=1;A=l}}else{y=q;z=9;A=n}else{y=q;z=1;A=l}}else{y=p;z=9;A=n}else{y=p;z=1;A=l}}else{y=m;z=9;A=n}else{y=m;z=1;A=l}while(0);switch(z&15){case 9:{r=A;break b;break}case 0:{m=y;n=A;o=8;break}default:break c}}if(!z)r=A;else{o=107;break a}}while(0);h=g+1|0;p=(h|0)==48;q=j+(p&1)|0;i=r;j=q;g=p?0:h;k=q*210|0}if((o|0)==106){f[d>>2]=l;E=l;break}else if((o|0)==107){f[d>>2]=l;E=A;break}}else{k=Hl(6760,6952,d,c)|0;E=f[k>>2]|0}while(0);u=b;return E|0}function db(a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[V>>0]=ob;f[Z>>2]=fb;f[v>>2]=f[m>>2];f[w>>2]=f[E>>2];f[j>>2]=f[v>>2];f[e>>2]=f[w>>2];Jf(aa,j,e);f[x>>2]=Ha;f[y>>2]=Ga;f[j>>2]=f[x>>2];f[e>>2]=f[y>>2];Jf(ba,j,e)}if(Ja)break;tb=b[Fa>>0]|0;lb=-1;hb=tb;while(1){ib=lb+-1|0;ub=Ka+ib|0;kb=hb;hb=b[ub>>0]|0;if((hb&255)<(kb&255))break;if((ub|0)==(n|0)){vb=84;break d}else lb=ib}ib=Ka+lb|0;if((hb&255)<(tb&255)){wb=Fa;xb=tb}else{kb=Ka;jb=Fa;while(1){mb=jb+-1|0;if((hb&255)<(h[kb+-2>>0]|0)){wb=mb;xb=1;break}else{yb=jb;jb=mb;kb=yb}}}b[ub>>0]=xb;b[wb>>0]=hb;if((lb|0)<-1){zb=ib;Ab=Fa}else continue;while(1){kb=b[zb>>0]|0;b[zb>>0]=b[Ab>>0]|0;b[Ab>>0]=kb;kb=zb+1|0;jb=Ab+-1|0;if(kb>>>0>>0){zb=kb;Ab=jb}else continue d}}if(((vb|0)==84?(vb=0,db):0)?(gb=b[n>>0]|0,b[n>>0]=tb,b[Fa>>0]=gb,Ma):0){gb=La;ib=ka;do{lb=b[ib>>0]|0;b[ib>>0]=b[gb>>0]|0;b[gb>>0]=lb;ib=ib+1|0;gb=gb+-1|0}while(ib>>>0>>0)}if((fb|0)>=(Ia|0)){Wa=bb;Xa=na;Ya=bb;Za=na;_a=Ga;$a=Ha;ab=na;break}else fb=fb+1|0}}fb=f[Z>>2]|0;na=Vn(Na|0,Pa|0,fb|0,((fb|0)<0)<<31>>31|0)|0;fb=Oa;f[fb>>2]=na;f[fb+4>>2]=I;if(T){fb=f[ba>>2]|0;na=f[C>>2]|0;Ha=0;do{Ga=f[fb+(Ha<<2)>>2]|0;f[na+(Ha<<2)>>2]=Ga<<1^Ga>>31;Ha=Ha+1|0}while((Ha|0)!=(g|0));Bb=na}else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[l>>2]=b;k=b>>>5;sj(m|0,0,k<<2|0)|0;n=b&31;o=m+(k<<2)|0;k=m;if(!n){p=b;q=k;r=m}else{f[o>>2]=f[o>>2]&~(-1>>>(32-n|0));p=b;q=k;r=m}}else{p=0;q=0;r=0}m=a+4|0;k=f[a>>2]|0;n=(f[m>>2]|0)-k|0;o=n>>2;f[e>>2]=0;s=e+4|0;f[s>>2]=0;t=e+8|0;f[t>>2]=0;do if(o){if((n|0)<0)aq(e);v=((o+-1|0)>>>5)+1|0;w=ln(v<<2)|0;f[e>>2]=w;f[t>>2]=v;f[s>>2]=o;v=o>>>5;sj(w|0,0,v<<2|0)|0;x=o&31;y=w+(v<<2)|0;if(x|0)f[y>>2]=f[y>>2]&~(-1>>>(32-x|0));if(o>>>0>2){x=a+12|0;y=a+32|0;v=a+52|0;w=a+56|0;z=a+48|0;A=b;B=k;C=0;D=q;E=r;a:while(1){F=B;G=C*3|0;if((G|0)!=-1){H=f[F+(G<<2)>>2]|0;I=G+1|0;J=((I>>>0)%3|0|0)==0?G+-2|0:I;if((J|0)==-1)K=-1;else K=f[F+(J<<2)>>2]|0;J=(((G>>>0)%3|0|0)==0?2:-1)+G|0;if((J|0)==-1)L=-1;else L=f[F+(J<<2)>>2]|0;if((H|0)!=(K|0)?!((H|0)==(L|0)|(K|0)==(L|0)):0){H=0;J=A;F=E;I=D;while(1){M=H+G|0;if(!(f[(f[e>>2]|0)+(M>>>5<<2)>>2]&1<<(M&31))){N=f[(f[a>>2]|0)+(M<<2)>>2]|0;f[g>>2]=N;if(!(f[F+(N>>>5<<2)>>2]&1<<(N&31))){O=0;P=J;Q=N}else{N=f[i>>2]|0;if((N|0)==(f[y>>2]|0))Ri(h,6140);else{f[N>>2]=-1;f[i>>2]=N+4}N=f[v>>2]|0;if((N|0)==(f[w>>2]|0))Ri(z,g);else{f[N>>2]=f[g>>2];f[v>>2]=N+4}N=f[l>>2]|0;R=f[j>>2]|0;if((N|0)==(R<<5|0)){if((N+1|0)<0){S=50;break a}T=R<<6;R=N+32&-32;vi(d,N>>>0<1073741823?(T>>>0>>0?R:T):2147483647);U=f[l>>2]|0}else U=N;f[l>>2]=U+1;N=(f[d>>2]|0)+(U>>>5<<2)|0;f[N>>2]=f[N>>2]&~(1<<(U&31));f[g>>2]=J;O=1;P=J+1|0;Q=J}N=f[d>>2]|0;T=N+(Q>>>5<<2)|0;f[T>>2]=f[T>>2]|1<<(Q&31);T=N;b:do if(O){R=M;while(1){if((R|0)==-1){S=64;break b}V=(f[e>>2]|0)+(R>>>5<<2)|0;f[V>>2]=f[V>>2]|1<<(R&31);V=f[g>>2]|0;f[(f[h>>2]|0)+(V<<2)>>2]=R;f[(f[a>>2]|0)+(R<<2)>>2]=V;V=R+1|0;W=((V>>>0)%3|0|0)==0?R+-2|0:V;do if((W|0)==-1)X=-1;else{V=f[(f[x>>2]|0)+(W<<2)>>2]|0;Y=V+1|0;if((V|0)==-1){X=-1;break}X=((Y>>>0)%3|0|0)==0?V+-2|0:Y}while(0);if((X|0)==(M|0))break;else R=X}}else{R=M;while(1){if((R|0)==-1){S=64;break b}W=(f[e>>2]|0)+(R>>>5<<2)|0;f[W>>2]=f[W>>2]|1<<(R&31);f[(f[h>>2]|0)+(f[g>>2]<<2)>>2]=R;W=R+1|0;Y=((W>>>0)%3|0|0)==0?R+-2|0:W;do if((Y|0)==-1)Z=-1;else{W=f[(f[x>>2]|0)+(Y<<2)>>2]|0;V=W+1|0;if((W|0)==-1){Z=-1;break}Z=((V>>>0)%3|0|0)==0?W+-2|0:V}while(0);if((Z|0)==(M|0))break;else R=Z}}while(0);c:do if((S|0)==64){S=0;if((M|0)==-1)break;R=(((M>>>0)%3|0|0)==0?2:-1)+M|0;if((R|0)==-1)break;Y=f[(f[x>>2]|0)+(R<<2)>>2]|0;if((Y|0)==-1)break;R=Y+(((Y>>>0)%3|0|0)==0?2:-1)|0;if((R|0)==-1)break;if(!O){Y=R;while(1){V=(f[e>>2]|0)+(Y>>>5<<2)|0;f[V>>2]=f[V>>2]|1<<(Y&31);V=(((Y>>>0)%3|0|0)==0?2:-1)+Y|0;if((V|0)==-1)break c;W=f[(f[x>>2]|0)+(V<<2)>>2]|0;if((W|0)==-1)break c;Y=W+(((W>>>0)%3|0|0)==0?2:-1)|0;if((Y|0)==-1)break c}}Y=f[a>>2]|0;W=R;do{V=(f[e>>2]|0)+(W>>>5<<2)|0;f[V>>2]=f[V>>2]|1<<(W&31);f[Y+(W<<2)>>2]=f[g>>2];V=(((W>>>0)%3|0|0)==0?2:-1)+W|0;if((V|0)==-1)break c;_=f[(f[x>>2]|0)+(V<<2)>>2]|0;if((_|0)==-1)break c;W=_+(((_>>>0)%3|0|0)==0?2:-1)|0}while((W|0)!=-1)}while(0);$=P;aa=T;ba=N}else{$=J;aa=I;ba=F}if((H|0)<2){H=H+1|0;J=$;F=ba;I=aa}else{ca=$;da=aa;ea=ba;break}}}else{ca=A;da=D;ea=E}}else{ca=A;da=D;ea=E}C=C+1|0;B=f[a>>2]|0;if(C>>>0>=(((f[m>>2]|0)-B>>2>>>0)/3|0)>>>0){S=18;break}else{A=ca;D=da;E=ea}}if((S|0)==18){fa=da;ga=f[l>>2]|0;break}else if((S|0)==50)aq(d)}else{fa=q;ga=p}}else{fa=q;ga=p}while(0);p=a+44|0;f[p>>2]=0;a=fa;fa=ga>>>5;q=a+(fa<<2)|0;S=ga&31;ga=(fa|0)!=0;d:do if(fa|S|0)if(!S){l=a;da=0;ea=ga;while(1){e:do if(ea){if(!(f[l>>2]&1)){ca=da+1|0;f[p>>2]=ca;ha=ca}else ha=da;if(!(f[l>>2]&2)){ca=ha+1|0;f[p>>2]=ca;ia=ca}else ia=ha;if(!(f[l>>2]&4)){ca=ia+1|0;f[p>>2]=ca;ja=ca}else ja=ia;if(!(f[l>>2]&8)){ca=ja+1|0;f[p>>2]=ca;ka=ca}else ka=ja;if(!(f[l>>2]&16)){ca=ka+1|0;f[p>>2]=ca;la=ca}else la=ka;if(!(f[l>>2]&32)){ca=la+1|0;f[p>>2]=ca;ma=ca}else ma=la;if(!(f[l>>2]&64)){ca=ma+1|0;f[p>>2]=ca;na=ca}else na=ma;if(!(f[l>>2]&128)){ca=na+1|0;f[p>>2]=ca;oa=ca}else oa=na;if(!(f[l>>2]&256)){ca=oa+1|0;f[p>>2]=ca;pa=ca}else pa=oa;if(!(f[l>>2]&512)){ca=pa+1|0;f[p>>2]=ca;qa=ca}else qa=pa;if(!(f[l>>2]&1024)){ca=qa+1|0;f[p>>2]=ca;ra=ca}else ra=qa;if(!(f[l>>2]&2048)){ca=ra+1|0;f[p>>2]=ca;sa=ca}else sa=ra;if(!(f[l>>2]&4096)){ca=sa+1|0;f[p>>2]=ca;ta=ca}else ta=sa;if(!(f[l>>2]&8192)){ca=ta+1|0;f[p>>2]=ca;ua=ca}else ua=ta;if(!(f[l>>2]&16384)){ca=ua+1|0;f[p>>2]=ca;va=ca}else va=ua;if(!(f[l>>2]&32768)){ca=va+1|0;f[p>>2]=ca;wa=ca}else wa=va;if(!(f[l>>2]&65536)){ca=wa+1|0;f[p>>2]=ca;xa=ca}else xa=wa;if(!(f[l>>2]&131072)){ca=xa+1|0;f[p>>2]=ca;ya=ca}else ya=xa;if(!(f[l>>2]&262144)){ca=ya+1|0;f[p>>2]=ca;za=ca}else za=ya;if(!(f[l>>2]&524288)){ca=za+1|0;f[p>>2]=ca;Aa=ca}else Aa=za;if(!(f[l>>2]&1048576)){ca=Aa+1|0;f[p>>2]=ca;Ba=ca}else Ba=Aa;if(!(f[l>>2]&2097152)){ca=Ba+1|0;f[p>>2]=ca;Ca=ca}else Ca=Ba;if(!(f[l>>2]&4194304)){ca=Ca+1|0;f[p>>2]=ca;Da=ca}else Da=Ca;if(!(f[l>>2]&8388608)){ca=Da+1|0;f[p>>2]=ca;Ea=ca}else Ea=Da;if(!(f[l>>2]&16777216)){ca=Ea+1|0;f[p>>2]=ca;Fa=ca}else Fa=Ea;if(!(f[l>>2]&33554432)){ca=Fa+1|0;f[p>>2]=ca;Ga=ca}else Ga=Fa;if(!(f[l>>2]&67108864)){ca=Ga+1|0;f[p>>2]=ca;Ha=ca}else Ha=Ga;if(!(f[l>>2]&134217728)){ca=Ha+1|0;f[p>>2]=ca;Ia=ca}else Ia=Ha;if(!(f[l>>2]&268435456)){ca=Ia+1|0;f[p>>2]=ca;Ja=ca}else Ja=Ia;if(!(f[l>>2]&536870912)){ca=Ja+1|0;f[p>>2]=ca;Ka=ca}else Ka=Ja;if(!(f[l>>2]&1073741824)){ca=Ka+1|0;f[p>>2]=ca;La=ca}else La=Ka;if((f[l>>2]|0)<=-1){Ma=La;break}ca=La+1|0;f[p>>2]=ca;Ma=ca}else{ca=0;m=da;while(1){if(!(f[l>>2]&1<>2]=ba;Na=ba}else Na=m;if((ca|0)==31){Ma=Na;break e}ca=ca+1|0;if(!ca)break d;else m=Na}}while(0);l=l+4|0;if((q|0)==(l|0))break;else{da=Ma;ea=1}}}else{if(ga){ea=0;da=a;l=0;while(1){if(!(f[da>>2]&1)){m=l+1|0;f[p>>2]=m;Oa=m;Pa=m}else{Oa=l;Pa=ea}if(!(f[da>>2]&2)){m=Oa+1|0;f[p>>2]=m;Qa=m;Ra=m}else{Qa=Oa;Ra=Pa}if(!(f[da>>2]&4)){m=Qa+1|0;f[p>>2]=m;Sa=m;Ta=m}else{Sa=Qa;Ta=Ra}if(!(f[da>>2]&8)){m=Sa+1|0;f[p>>2]=m;Ua=m;Va=m}else{Ua=Sa;Va=Ta}if(!(f[da>>2]&16)){m=Ua+1|0;f[p>>2]=m;Wa=m;Xa=m}else{Wa=Ua;Xa=Va}if(!(f[da>>2]&32)){m=Wa+1|0;f[p>>2]=m;Ya=m;Za=m}else{Ya=Wa;Za=Xa}if(!(f[da>>2]&64)){m=Ya+1|0;f[p>>2]=m;_a=m;$a=m}else{_a=Ya;$a=Za}if(!(f[da>>2]&128)){m=_a+1|0;f[p>>2]=m;ab=m;bb=m}else{ab=_a;bb=$a}if(!(f[da>>2]&256)){m=ab+1|0;f[p>>2]=m;cb=m;db=m}else{cb=ab;db=bb}if(!(f[da>>2]&512)){m=cb+1|0;f[p>>2]=m;eb=m;fb=m}else{eb=cb;fb=db}if(!(f[da>>2]&1024)){m=eb+1|0;f[p>>2]=m;gb=m;hb=m}else{gb=eb;hb=fb}if(!(f[da>>2]&2048)){m=gb+1|0;f[p>>2]=m;ib=m;jb=m}else{ib=gb;jb=hb}if(!(f[da>>2]&4096)){m=ib+1|0;f[p>>2]=m;kb=m;lb=m}else{kb=ib;lb=jb}if(!(f[da>>2]&8192)){m=kb+1|0;f[p>>2]=m;mb=m;nb=m}else{mb=kb;nb=lb}if(!(f[da>>2]&16384)){m=mb+1|0;f[p>>2]=m;ob=m;pb=m}else{ob=mb;pb=nb}if(!(f[da>>2]&32768)){m=ob+1|0;f[p>>2]=m;qb=m;rb=m}else{qb=ob;rb=pb}if(!(f[da>>2]&65536)){m=qb+1|0;f[p>>2]=m;sb=m;tb=m}else{sb=qb;tb=rb}if(!(f[da>>2]&131072)){m=sb+1|0;f[p>>2]=m;ub=m;vb=m}else{ub=sb;vb=tb}if(!(f[da>>2]&262144)){m=ub+1|0;f[p>>2]=m;wb=m;xb=m}else{wb=ub;xb=vb}if(!(f[da>>2]&524288)){m=wb+1|0;f[p>>2]=m;yb=m;zb=m}else{yb=wb;zb=xb}if(!(f[da>>2]&1048576)){m=yb+1|0;f[p>>2]=m;Ab=m;Bb=m}else{Ab=yb;Bb=zb}if(!(f[da>>2]&2097152)){m=Ab+1|0;f[p>>2]=m;Cb=m;Db=m}else{Cb=Ab;Db=Bb}if(!(f[da>>2]&4194304)){m=Cb+1|0;f[p>>2]=m;Eb=m;Fb=m}else{Eb=Cb;Fb=Db}if(!(f[da>>2]&8388608)){m=Eb+1|0;f[p>>2]=m;Gb=m;Hb=m}else{Gb=Eb;Hb=Fb}if(!(f[da>>2]&16777216)){m=Gb+1|0;f[p>>2]=m;Ib=m;Jb=m}else{Ib=Gb;Jb=Hb}if(!(f[da>>2]&33554432)){m=Ib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b;f[sb+(lb<<2)>>2]=nb<<1^nb>>31;lb=lb+1|0;if((lb|0)==(g|0)){tb=mb;ub=sb;break}else jb=mb}}else{tb=0;ub=f[Z>>2]|0}while(0);mo(e,_,ub,g);kb=Zk(e)|0;jb=I;lb=Bm(e)|0;mb=I;Va=+wm(ya,ib);nb=Vn(lb|0,mb|0,kb|0,jb|0)|0;Ta=+W(+(Va*Ua));jb=Vn(nb|0,I|0,~~Ta>>>0|0,(+K(Ta)>=1.0?(Ta>0.0?~~+Y(+J(Ta/4294967296.0),4294967295.0)>>>0:~~+W((Ta-+(~~Ta>>>0))/4294967296.0)>>>0):0)|0)|0;nb=f[r>>2]|0;if(!((nb|0)<=(jb|0)?!((nb|0)>=(jb|0)?(tb|0)<(f[T>>2]|0):0):0)){nb=r;f[nb>>2]=jb;f[nb+4>>2]=tb;b[U>>0]=qb;f[V>>2]=hb;f[v>>2]=f[m>>2];f[w>>2]=f[E>>2];f[j>>2]=f[v>>2];f[e>>2]=f[w>>2];Jf($,j,e);f[x>>2]=Ca;f[y>>2]=Ma;f[j>>2]=f[x>>2];f[e>>2]=f[y>>2];Jf(aa,j,e)}if(Ia)break;vb=b[Ka>>0]|0;nb=-1;jb=vb;while(1){kb=nb+-1|0;wb=Na+kb|0;mb=jb;jb=b[wb>>0]|0;if((jb&255)<(mb&255))break;if((wb|0)==(n|0)){xb=84;break d}else nb=kb}kb=Na+nb|0;if((jb&255)<(vb&255)){yb=Ka;zb=vb}else{mb=Na;lb=Ka;while(1){ob=lb+-1|0;if((jb&255)<(h[mb+-2>>0]|0)){yb=ob;zb=1;break}else{Ab=lb;lb=ob;mb=Ab}}}b[wb>>0]=zb;b[yb>>0]=jb;if((nb|0)<-1){Bb=kb;Cb=Ka}else continue;while(1){mb=b[Bb>>0]|0;b[Bb>>0]=b[Cb>>0]|0;b[Cb>>0]=mb;mb=Bb+1|0;lb=Cb+-1|0;if(mb>>>0>>0){Bb=mb;Cb=lb}else continue d}}if(((xb|0)==84?(xb=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2]|0)+24>>0]|0)|0;q=q+1|0}while(q>>>0>>0);f[a+72>>2]=r;if(s){v=1;u=c;return v|0}s=g+4|0;r=g+8|0;x=d+8|0;q=d+4|0;w=d+11|0;y=g+12|0;z=d+8|0;A=d+4|0;B=d+11|0;C=h+4|0;D=h+8|0;E=i+8|0;F=i+4|0;G=d+11|0;H=d+4|0;I=i+11|0;J=d+8|0;K=d+4|0;L=d+11|0;M=d+11|0;N=d+4|0;O=h+8|0;P=a+40|0;Q=a+44|0;R=a+36|0;S=a+64|0;T=a+68|0;U=a+60|0;V=g+8|0;W=g+20|0;X=e+8|0;Y=e+4|0;Z=e+11|0;_=g+4|0;aa=g+8|0;ba=h+4|0;ca=h+8|0;da=h+8|0;ea=a+52|0;fa=a+56|0;ga=a+48|0;a=g+8|0;ha=0;ia=t;t=l;l=k;a:while(1){k=f[ia+(ha<<2)>>2]|0;ja=f[(f[t+8>>2]|0)+(k<<2)>>2]|0;switch(f[ja+28>>2]|0){case 9:{f[g>>2]=1196;f[s>>2]=-1;f[r>>2]=0;f[r+4>>2]=0;f[r+8>>2]=0;f[r+12>>2]=0;ka=f[l+48>>2]|0;f[d>>2]=0;f[d+4>>2]=0;f[d+8>>2]=0;la=ln(32)|0;f[d>>2]=la;f[x>>2]=-2147483616;f[q>>2]=17;ma=la;na=14495;oa=ma+17|0;do{b[ma>>0]=b[na>>0]|0;ma=ma+1|0;na=na+1|0}while((ma|0)<(oa|0));b[la+17>>0]=0;pa=ka+16|0;qa=f[pa>>2]|0;if(qa){ra=pa;sa=qa;b:while(1){qa=sa;while(1){if((f[qa+16>>2]|0)>=(k|0))break;ta=f[qa+4>>2]|0;if(!ta){ua=ra;break b}else qa=ta}sa=f[qa>>2]|0;if(!sa){ua=qa;break}else ra=qa}if(((ua|0)!=(pa|0)?(k|0)>=(f[ua+16>>2]|0):0)?(ra=ua+20|0,(Jh(ra,d)|0)!=0):0)va=Hk(ra,d,-1)|0;else wa=17}else wa=17;if((wa|0)==17){wa=0;va=Hk(ka,d,-1)|0}if((b[w>>0]|0)<0)Oq(f[d>>2]|0);if((va|0)<1)xa=1;else{ra=f[(f[j>>2]|0)+48>>2]|0;f[d>>2]=0;f[d+4>>2]=0;f[d+8>>2]=0;sa=ln(32)|0;f[d>>2]=sa;f[z>>2]=-2147483616;f[A>>2]=19;ma=sa;na=14438;oa=ma+19|0;do{b[ma>>0]=b[na>>0]|0;ma=ma+1|0;na=na+1|0}while((ma|0)<(oa|0));b[sa+19>>0]=0;ka=ra+16|0;pa=f[ka>>2]|0;if(pa){la=ka;ta=pa;c:while(1){pa=ta;while(1){if((f[pa+16>>2]|0)>=(k|0))break;ya=f[pa+4>>2]|0;if(!ya){za=la;break c}else pa=ya}ta=f[pa>>2]|0;if(!ta){za=pa;break}else la=pa}if((za|0)!=(ka|0)?(k|0)>=(f[za+16>>2]|0):0)Aa=za+20|0;else wa=29}else wa=29;if((wa|0)==29){wa=0;Aa=ra}if(!(Jh(Aa,d)|0))Ba=0;else{la=f[(f[j>>2]|0)+48>>2]|0;f[e>>2]=0;f[e+4>>2]=0;f[e+8>>2]=0;ta=ln(32)|0;f[e>>2]=ta;f[X>>2]=-2147483616;f[Y>>2]=18;ma=ta;na=14458;oa=ma+18|0;do{b[ma>>0]=b[na>>0]|0;ma=ma+1|0;na=na+1|0}while((ma|0)<(oa|0));b[ta+18>>0]=0;ra=la+16|0;ka=f[ra>>2]|0;if(ka){sa=ra;qa=ka;d:while(1){ka=qa;while(1){if((f[ka+16>>2]|0)>=(k|0))break;ya=f[ka+4>>2]|0;if(!ya){Ca=sa;break d}else ka=ya}qa=f[ka>>2]|0;if(!qa){Ca=ka;break}else sa=ka}if((Ca|0)!=(ra|0)?(k|0)>=(f[Ca+16>>2]|0):0)Da=Ca+20|0;else wa=39}else wa=39;if((wa|0)==39){wa=0;Da=la}sa=(Jh(Da,e)|0)!=0;if((b[Z>>0]|0)<0)Oq(f[e>>2]|0);Ba=sa}if((b[B>>0]|0)<0)Oq(f[d>>2]|0);if(Ba){sa=ja+24|0;qa=b[sa>>0]|0;ta=qa<<24>>24;f[h>>2]=0;f[C>>2]=0;f[D>>2]=0;if(!(qa<<24>>24))Ea=0;else{if(qa<<24>>24<0){wa=48;break a}qa=ta<<2;pa=ln(qa)|0;f[h>>2]=pa;ya=pa+(ta<<2)|0;f[O>>2]=ya;sj(pa|0,0,qa|0)|0;f[C>>2]=ya;Ea=pa}pa=f[(f[j>>2]|0)+48>>2]|0;f[i>>2]=0;f[i+4>>2]=0;f[i+8>>2]=0;ya=ln(32)|0;f[i>>2]=ya;f[E>>2]=-2147483616;f[F>>2]=19;ma=ya;na=14438;oa=ma+19|0;do{b[ma>>0]=b[na>>0]|0;ma=ma+1|0;na=na+1|0}while((ma|0)<(oa|0));b[ya+19>>0]=0;la=b[sa>>0]|0;ra=la<<24>>24;qa=pa+16|0;ta=f[qa>>2]|0;if(ta){Fa=qa;Ga=ta;e:while(1){ta=Ga;while(1){if((f[ta+16>>2]|0)>=(k|0))break;Ha=f[ta+4>>2]|0;if(!Ha){Ia=Fa;break e}else ta=Ha}Ga=f[ta>>2]|0;if(!Ga){Ia=ta;break}else Fa=ta}if(((Ia|0)!=(qa|0)?(k|0)>=(f[Ia+16>>2]|0):0)?(Fa=Ia+20|0,(Jh(Fa,i)|0)!=0):0){Ga=Rg(Fa,i)|0;if((Ga|0)!=(Ia+24|0)){pj(d,Ga+28|0);Ga=b[M>>0]|0;Fa=Ga<<24>>24<0;if(!((Fa?f[N>>2]|0:Ga&255)|0))Ja=Ga;else{if(la<<24>>24>0){ya=Fa?f[d>>2]|0:d;Fa=0;do{Ka=$(bq(ya,e));ka=ya;ya=f[e>>2]|0;if((ka|0)==(ya|0))break;n[Ea+(Fa<<2)>>2]=Ka;Fa=Fa+1|0}while((Fa|0)<(ra|0));La=b[M>>0]|0}else La=Ga;Ja=La}if(Ja<<24>>24<0)Oq(f[d>>2]|0)}}else wa=69}else wa=69;if((wa|0)==69?(wa=0,Fa=Rg(pa,i)|0,(Fa|0)!=(pa+4|0)):0){pj(d,Fa+28|0);Fa=b[G>>0]|0;ya=Fa<<24>>24<0;if(!((ya?f[H>>2]|0:Fa&255)|0))Ma=Fa;else{if(la<<24>>24>0){qa=ya?f[d>>2]|0:d;ya=0;do{Ka=$(bq(qa,e));ka=qa;qa=f[e>>2]|0;if((ka|0)==(qa|0))break;n[Ea+(ya<<2)>>2]=Ka;ya=ya+1|0}while((ya|0)<(ra|0));Na=b[G>>0]|0}else Na=Fa;Ma=Na}if(Ma<<24>>24<0)Oq(f[d>>2]|0)}if((b[I>>0]|0)<0)Oq(f[i>>2]|0);ra=f[(f[j>>2]|0)+48>>2]|0;f[d>>2]=0;f[d+4>>2]=0;f[d+8>>2]=0;ya=ln(32)|0;f[d>>2]=ya;f[J>>2]=-2147483616;f[K>>2]=18;ma=ya;na=14458;oa=ma+18|0;do{b[ma>>0]=b[na>>0]|0;ma=ma+1|0;na=na+1|0}while((ma|0)<(oa|0));b[ya+18>>0]=0;na=ra+16|0;ma=f[na>>2]|0;do if(ma){oa=na;Fa=ma;f:while(1){qa=Fa;while(1){if((f[qa+16>>2]|0)>=(k|0))break;la=f[qa+4>>2]|0;if(!la){Pa=oa;break f}else qa=la}Fa=f[qa>>2]|0;if(!Fa){Pa=qa;break}else oa=qa}if((Pa|0)!=(na|0)?(k|0)>=(f[Pa+16>>2]|0):0){oa=Pa+20|0;if(!(Jh(oa,d)|0)){wa=91;break}Qa=$(sk(oa,d,$(1.0)))}else wa=91}else wa=91;while(0);if((wa|0)==91){wa=0;Qa=$(sk(ra,d,$(1.0)))}if((b[L>>0]|0)<0)Oq(f[d>>2]|0);Dl(g,va,f[h>>2]|0,b[sa>>0]|0,Qa);k=f[h>>2]|0;if(k|0){na=f[C>>2]|0;if((na|0)!=(k|0))f[C>>2]=na+(~((na+-4-k|0)>>>2)<<2);Oq(k)}}else Wd(g,ja,va)|0;k=f[P>>2]|0;if((k|0)==(f[Q>>2]|0))Cf(R,g);else{f[k>>2]=1196;f[k+4>>2]=f[s>>2];Ra=k+8|0;f[Ra>>2]=0;na=k+12|0;f[na>>2]=0;f[k+16>>2]=0;ma=(f[y>>2]|0)-(f[V>>2]|0)|0;ya=ma>>2;if(ya|0){if(ya>>>0>1073741823){wa=103;break a}oa=ln(ma)|0;f[na>>2]=oa;f[Ra>>2]=oa;f[k+16>>2]=oa+(ya<<2);ya=f[V>>2]|0;ma=(f[y>>2]|0)-ya|0;if((ma|0)>0){kh(oa|0,ya|0,ma|0)|0;f[na>>2]=oa+(ma>>>2<<2)}}f[k+20>>2]=f[W>>2];f[P>>2]=(f[P>>2]|0)+24}Qe(d,g,ja,m);k=f[S>>2]|0;if(k>>>0<(f[T>>2]|0)>>>0){ma=f[d>>2]|0;f[d>>2]=0;f[k>>2]=ma;f[S>>2]=k+4}else Ze(U,d);k=f[d>>2]|0;f[d>>2]=0;if(k|0){ma=k+88|0;oa=f[ma>>2]|0;f[ma>>2]=0;if(oa|0){ma=f[oa+8>>2]|0;if(ma|0){na=oa+12|0;if((f[na>>2]|0)!=(ma|0))f[na>>2]=ma;Oq(ma)}Oq(oa)}oa=f[k+68>>2]|0;if(oa|0){ma=k+72|0;na=f[ma>>2]|0;if((na|0)!=(oa|0))f[ma>>2]=na+(~((na+-4-oa|0)>>>2)<<2);Oq(oa)}oa=k+64|0;na=f[oa>>2]|0;f[oa>>2]=0;if(na|0){oa=f[na>>2]|0;if(oa|0){ma=na+4|0;if((f[ma>>2]|0)!=(oa|0))f[ma>>2]=oa;Oq(oa)}Oq(na)}Oq(k)}xa=0}f[g>>2]=1196;k=f[r>>2]|0;if(k|0){na=f[y>>2]|0;if((na|0)!=(k|0))f[y>>2]=na+(~((na+-4-k|0)>>>2)<<2);Oq(k)}if(xa|0){v=0;wa=169;break a}break}case 1:case 3:case 5:{k=ja+24|0;na=b[k>>0]|0;oa=na<<24>>24;f[g>>2]=0;f[_>>2]=0;f[aa>>2]=0;if(!(na<<24>>24))Sa=0;else{if(na<<24>>24<0){wa=137;break a}na=ln(oa<<2)|0;f[_>>2]=na;f[g>>2]=na;ma=na+(oa<<2)|0;f[a>>2]=ma;ya=oa;oa=na;while(1){f[oa>>2]=2147483647;ya=ya+-1|0;if(!ya)break;else oa=oa+4|0}f[_>>2]=ma;Sa=b[k>>0]|0}oa=Sa<<24>>24;f[h>>2]=0;f[ba>>2]=0;f[ca>>2]=0;if(!(Sa<<24>>24))Ta=0;else{if(Sa<<24>>24<0){wa=144;break a}ya=oa<<2;sa=ln(ya)|0;f[h>>2]=sa;ra=sa+(oa<<2)|0;f[da>>2]=ra;sj(sa|0,0,ya|0)|0;f[ba>>2]=ra;Ta=sa}sa=ja+80|0;ra=b[k>>0]|0;g:do if(!(f[sa>>2]|0))Ua=ra;else{ya=0;oa=ra;na=Ta;while(1){f[e>>2]=ya;f[d>>2]=f[e>>2];Qb(ja,d,oa,na)|0;Fa=b[k>>0]|0;if(Fa<<24>>24>0){ta=f[g>>2]|0;la=f[h>>2]|0;pa=Fa<<24>>24;Ga=0;do{ka=ta+(Ga<<2)|0;Ha=f[la+(Ga<<2)>>2]|0;if((f[ka>>2]|0)>(Ha|0))f[ka>>2]=Ha;Ga=Ga+1|0}while((Ga|0)<(pa|0))}pa=ya+1|0;if(pa>>>0>=(f[sa>>2]|0)>>>0){Ua=Fa;break g}ya=pa;oa=Fa;na=f[h>>2]|0}}while(0);if(Ua<<24>>24>0){sa=0;ja=Ua;while(1){ra=(f[g>>2]|0)+(sa<<2)|0;ma=f[ea>>2]|0;if((ma|0)==(f[fa>>2]|0)){Ri(ga,ra);Va=b[k>>0]|0}else{f[ma>>2]=f[ra>>2];f[ea>>2]=ma+4;Va=ja}sa=sa+1|0;if((sa|0)>=(Va<<24>>24|0))break;else ja=Va}}ja=f[h>>2]|0;if(ja|0){sa=f[ba>>2]|0;if((sa|0)!=(ja|0))f[ba>>2]=sa+(~((sa+-4-ja|0)>>>2)<<2);Oq(ja)}ja=f[g>>2]|0;if(ja|0){sa=f[_>>2]|0;if((sa|0)!=(ja|0))f[_>>2]=sa+(~((sa+-4-ja|0)>>>2)<<2);Oq(ja)}break}default:{}}ja=ha+1|0;sa=f[o>>2]|0;if(ja>>>0>=(f[p>>2]|0)-sa>>2>>>0){v=1;wa=169;break}k=f[j>>2]|0;ha=ja;ia=sa;t=f[k+4>>2]|0;l=k}if((wa|0)==48)aq(h);else if((wa|0)==103)aq(Ra);else if((wa|0)==137)aq(g);else if((wa|0)==144)aq(h);else if((wa|0)==169){u=c;return v|0}return 0}function hb(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,Y=0,Z=0,$=0,aa=0,ba=0,ca=0,da=0,ea=0,fa=0,ga=0,ha=0,ia=0,ja=0,ka=0,la=0,ma=0,na=0,oa=0,pa=0,qa=0,ra=0,sa=0,ta=0,ua=0,va=0,wa=0,xa=0,ya=0,za=0,Aa=0,Ba=0,Ca=0,Da=0,Ea=0,Fa=0,Ga=0,Ha=0,Ia=0,Ja=0,Ka=0,La=0,Ma=0,Na=0,Oa=0,Pa=0,Qa=0,Ra=0;d=u;u=u+32|0;e=d;g=a+8|0;h=f[g>>2]|0;f[e>>2]=0;i=e+4|0;f[i>>2]=0;f[e+8>>2]=0;do if(h)if(h>>>0>1073741823)aq(e);else{j=h<<2;k=ln(j)|0;f[e>>2]=k;l=k+(h<<2)|0;f[e+8>>2]=l;sj(k|0,0,j|0)|0;f[i>>2]=l;m=l;n=k;break}else{m=0;n=0}while(0);k=a+128|0;l=f[k>>2]|0;j=f[l>>2]|0;o=l+4|0;if(!j){p=l+8|0;q=n;r=m;s=h}else{h=f[o>>2]|0;if((h|0)!=(j|0))f[o>>2]=h+(~((h+-4-j|0)>>>2)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-ja|0;f[y>>2]=ka;ja=f[h>>2]|ma>>>ka;f[h>>2]=ja;ka=f[j>>2]|0;if((ka|0)==(f[m>>2]|0))Ri(n,h);else{f[ka>>2]=ja;f[j>>2]=ka+4}f[h>>2]=ma<<32-(f[y>>2]|0);break}ma=f[h>>2]|la>>>da;f[h>>2]=ma;la=da+U|0;f[y>>2]=la;if((la|0)!=32)break;la=f[j>>2]|0;if((la|0)==(f[m>>2]|0))Ri(n,h);else{f[la>>2]=ma;f[j>>2]=la+4}f[h>>2]=0;f[y>>2]=0}while(0);aa=aa+1|0;U=f[g>>2]|0}while(aa>>>0>>0);ia=U}ga=ga+1|0;if(ga>>>0>=z>>>0){fa=99;break a}else ha=ia}}$=Z+1|0;Ig(R+($*12|0)|0,f[R+(Z*12|0)>>2]|0,f[R+(Z*12|0)+4>>2]|0);aa=(f[(f[k>>2]|0)+($*12|0)>>2]|0)+(V<<2)|0;ba=(f[aa>>2]|0)+(1<>2]=ba;aa=f[A>>2]|0;U=f[B>>2]|0;b:do if((W|0)==(S|0))na=S;else{ca=f[O>>2]|0;if(!aa){if((f[ca+(V<<2)>>2]|0)>>>0>>0){na=W;break}else{oa=W;pa=S}while(1){la=oa;do{la=la+-1|0;if((pa|0)==(la|0)){na=pa;break b}ma=(f[P>>2]|0)+((X(la,U)|0)<<2)+(V<<2)|0}while((f[ma>>2]|0)>>>0>=ba>>>0);pa=pa+1|0;if((pa|0)==(la|0)){na=la;break b}else oa=la}}else{qa=W;ra=S}while(1){ma=ra;while(1){sa=ca+((X(ma,aa)|0)<<2)|0;if((f[sa+(V<<2)>>2]|0)>>>0>=ba>>>0){ta=qa;break}da=ma+1|0;if((da|0)==(qa|0)){na=qa;break b}else ma=da}while(1){ta=ta+-1|0;if((ma|0)==(ta|0)){na=ma;break b}ua=(f[P>>2]|0)+((X(ta,U)|0)<<2)|0;if((f[ua+(V<<2)>>2]|0)>>>0>>0){va=0;break}}do{la=sa+(va<<2)|0;da=ua+(va<<2)|0;ka=f[la>>2]|0;f[la>>2]=f[da>>2];f[da>>2]=ka;va=va+1|0}while((va|0)!=(aa|0));ra=ma+1|0;if((ra|0)==(ta|0)){na=ta;break}else qa=ta}}while(0);ba=(_(z|0)|0)^31;U=na-S|0;ca=W-na|0;ka=U>>>0>>0;if((U|0)!=(ca|0)){da=f[H>>2]|0;if(ka)f[I>>2]=f[I>>2]|1<<31-da;la=da+1|0;f[H>>2]=la;if((la|0)==32){la=f[J>>2]|0;if((la|0)==(f[K>>2]|0))Ri(L,I);else{f[la>>2]=f[I>>2];f[J>>2]=la+4}f[H>>2]=0;f[I>>2]=0}}la=z>>>1;do if(ka){da=f[C>>2]|0;ja=32-da|0;wa=32-ba|0;xa=la-U<(ja|0)){ya=xa>>>wa;wa=ba-ja|0;f[C>>2]=wa;ja=f[D>>2]|ya>>>wa;f[D>>2]=ja;wa=f[E>>2]|0;if((wa|0)==(f[F>>2]|0))Ri(G,D);else{f[wa>>2]=ja;f[E>>2]=wa+4}f[D>>2]=ya<<32-(f[C>>2]|0);break}ya=f[D>>2]|xa>>>da;f[D>>2]=ya;xa=da+ba|0;f[C>>2]=xa;if((xa|0)==32){xa=f[E>>2]|0;if((xa|0)==(f[F>>2]|0))Ri(G,D);else{f[xa>>2]=ya;f[E>>2]=xa+4}f[D>>2]=0;f[C>>2]=0}}else{xa=f[C>>2]|0;ya=32-xa|0;da=32-ba|0;wa=la-ca<(ya|0)){ja=wa>>>da;da=ba-ya|0;f[C>>2]=da;ya=f[D>>2]|ja>>>da;f[D>>2]=ya;da=f[E>>2]|0;if((da|0)==(f[F>>2]|0))Ri(G,D);else{f[da>>2]=ya;f[E>>2]=da+4}f[D>>2]=ja<<32-(f[C>>2]|0);break}ja=f[D>>2]|wa>>>xa;f[D>>2]=ja;wa=xa+ba|0;f[C>>2]=wa;if((wa|0)==32){wa=f[E>>2]|0;if((wa|0)==(f[F>>2]|0))Ri(G,D);else{f[wa>>2]=ja;f[E>>2]=wa+4}f[D>>2]=0;f[C>>2]=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ja=ba}else fa=99}else fa=99;while(0);if((fa|0)==99){fa=0;Ja=f[l>>2]|0}if(!Ja)break;else Q=Ja}}Ja=f[t>>2]|0;Q=f[v>>2]|0;Ia=Ja+(((Q>>>0)/113|0)<<2)|0;q=f[o>>2]|0;p=q;i=Ja;if((q|0)==(Ja|0)){Ka=0;La=0}else{na=(f[Ia>>2]|0)+(((Q>>>0)%113|0)*36|0)|0;Ka=na;La=na}na=Ia;Ia=La;c:while(1){La=Ia;do{Q=La;if((Ka|0)==(Q|0))break c;La=Q+36|0}while((La-(f[na>>2]|0)|0)!=4068);La=na+4|0;na=La;Ia=f[La>>2]|0}f[l>>2]=0;l=p-i>>2;if(l>>>0>2){i=Ja;do{Oq(f[i>>2]|0);i=(f[t>>2]|0)+4|0;f[t>>2]=i;Ma=f[o>>2]|0;Na=Ma-i>>2}while(Na>>>0>2);Oa=Na;Pa=i;Qa=Ma}else{Oa=l;Pa=Ja;Qa=q}switch(Oa|0){case 1:{Ra=56;fa=113;break}case 2:{Ra=113;fa=113;break}default:{}}if((fa|0)==113)f[v>>2]=Ra;if((Pa|0)!=(Qa|0)){Ra=Pa;do{Oq(f[Ra>>2]|0);Ra=Ra+4|0}while((Ra|0)!=(Qa|0));Qa=f[t>>2]|0;t=f[o>>2]|0;if((t|0)!=(Qa|0))f[o>>2]=t+(~((t+-4-Qa|0)>>>2)<<2)}Qa=f[e>>2]|0;if(!Qa){u=d;return}Oq(Qa);u=d;return}function ib(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,Y=0,Z=0,$=0,aa=0,ba=0,ca=0,da=0,ea=0,fa=0,ga=0,ha=0,ia=0,ja=0,ka=0,la=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12|0)+4>>2]|0);la=f[m>>2]|0}$=(f[la+(Y*12|0)>>2]|0)+(Q<<2)|0;Z=(f[$>>2]|0)+(1<>2]=Z;$=f[C>>2]|0;W=f[D>>2]|0;b:do if((T|0)==(P|0))ma=P;else{aa=f[L>>2]|0;if(!$){if((f[aa+(Q<<2)>>2]|0)>>>0>>0){ma=T;break}else{na=T;oa=P}while(1){ja=na;do{ja=ja+-1|0;if((oa|0)==(ja|0)){ma=oa;break b}ka=(f[M>>2]|0)+((X(ja,W)|0)<<2)+(Q<<2)|0}while((f[ka>>2]|0)>>>0>=Z>>>0);oa=oa+1|0;if((oa|0)==(ja|0)){ma=ja;break b}else na=ja}}else{pa=T;qa=P}while(1){ka=qa;while(1){ra=aa+((X(ka,$)|0)<<2)|0;if((f[ra+(Q<<2)>>2]|0)>>>0>=Z>>>0){sa=pa;break}ba=ka+1|0;if((ba|0)==(pa|0)){ma=pa;break b}else ka=ba}while(1){sa=sa+-1|0;if((ka|0)==(sa|0)){ma=ka;break b}ta=(f[M>>2]|0)+((X(sa,W)|0)<<2)|0;if((f[ta+(Q<<2)>>2]|0)>>>0>>0){ua=0;break}}do{ja=ra+(ua<<2)|0;ba=ta+(ua<<2)|0;ia=f[ja>>2]|0;f[ja>>2]=f[ba>>2];f[ba>>2]=ia;ua=ua+1|0}while((ua|0)!=($|0));qa=ka+1|0;if((qa|0)==(sa|0)){ma=sa;break}else pa=sa}}while(0);Z=(_(U|0)|0)^31;W=ma-P|0;aa=T-ma|0;ia=W>>>0>>0;if((W|0)!=(aa|0)){ba=f[E>>2]|0;if(ia)f[F>>2]=f[F>>2]|1<<31-ba;ja=ba+1|0;f[E>>2]=ja;if((ja|0)==32){ja=f[G>>2]|0;if((ja|0)==(f[H>>2]|0))Ri(I,F);else{f[ja>>2]=f[F>>2];f[G>>2]=ja+4}f[E>>2]=0;f[F>>2]=0}}ja=U>>>1;if(ia){ia=ja-W|0;if(Z|0){ba=0;ha=1<>>1}}}else{ha=ja-aa|0;if(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>>2]=ia;Fa=ia}else da=87}else da=87;while(0);if((da|0)==87){da=0;Fa=f[n>>2]|0}if(!Fa)break;else N=Fa}}Fa=f[w>>2]|0;N=f[x>>2]|0;Ea=Fa+(((N>>>0)/113|0)<<2)|0;s=f[q>>2]|0;r=s;k=Fa;if((s|0)==(Fa|0)){Ga=0;Ha=0}else{ma=(f[Ea>>2]|0)+(((N>>>0)%113|0)*36|0)|0;Ga=ma;Ha=ma}ma=Ea;Ea=Ha;c:while(1){Ha=Ea;do{N=Ha;if((Ga|0)==(N|0))break c;Ha=N+36|0}while((Ha-(f[ma>>2]|0)|0)!=4068);Ha=ma+4|0;ma=Ha;Ea=f[Ha>>2]|0}f[n>>2]=0;n=r-k>>2;if(n>>>0>2){k=Fa;do{Oq(f[k>>2]|0);k=(f[w>>2]|0)+4|0;f[w>>2]=k;Ia=f[q>>2]|0;Ja=Ia-k>>2}while(Ja>>>0>2);Ka=Ja;La=k;Ma=Ia}else{Ka=n;La=Fa;Ma=s}switch(Ka|0){case 1:{Na=56;da=101;break}case 2:{Na=113;da=101;break}default:{}}if((da|0)==101)f[x>>2]=Na;if((La|0)!=(Ma|0)){Na=La;do{Oq(f[Na>>2]|0);Na=Na+4|0}while((Na|0)!=(Ma|0));Ma=f[w>>2]|0;w=f[q>>2]|0;if((w|0)!=(Ma|0))f[q>>2]=w+(~((w+-4-Ma|0)>>>2)<<2)}Ma=f[h>>2]|0;if(!Ma){u=d;return}Oq(Ma);u=d;return}function jb(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,Y=0,Z=0,$=0,aa=0,ba=0,ca=0,da=0,ea=0,fa=0,ga=0,ha=0,ia=0,ja=0,ka=0,la=0,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=f[(f[(f[ea+4>>2]|0)+8>>2]|0)+(f[da+(ca<<2)>>2]<<2)>>2]|0;switch(f[fa+28>>2]|0){case 1:case 3:case 5:case 2:case 4:case 6:{ga=fa;ha=aa;break}case 9:{ga=f[(f[Z>>2]|0)+(aa<<2)>>2]|0;ha=aa+1|0;break}default:{ia=0;break a}}if(!ga){ia=0;break a}c:do switch(f[ga+28>>2]|0){case 6:{if(Q){ja=ba;ka=ga+24|0;break c}fa=ga+84|0;la=ga+68|0;ma=ga+48|0;na=ga+40|0;oa=ga+24|0;pa=0;do{if(!(b[fa>>0]|0))qa=f[(f[la>>2]|0)+(pa<<2)>>2]|0;else qa=pa;ra=ma;sa=f[ra>>2]|0;ta=f[ra+4>>2]|0;ra=na;ua=un(f[ra>>2]|0,f[ra+4>>2]|0,qa|0,0)|0;ra=Vn(ua|0,I|0,sa|0,ta|0)|0;kh((f[H>>2]|0)+((X(f[F>>2]|0,pa)|0)<<2)+($<<2)|0,(f[f[ga>>2]>>2]|0)+ra|0,b[oa>>0]<<2|0)|0;pa=pa+1|0}while((pa|0)!=(B|0));ja=ba;ka=oa;break}case 1:case 3:case 5:{oa=ga+24|0;pa=b[oa>>0]|0;na=pa<<24>>24;f[j>>2]=0;f[R>>2]=0;f[S>>2]=0;if(!(pa<<24>>24))va=0;else{if(pa<<24>>24<0){wa=24;break b}pa=na<<2;ma=ln(pa)|0;f[j>>2]=ma;la=ma+(na<<2)|0;f[Y>>2]=la;sj(ma|0,0,pa|0)|0;f[R>>2]=la;va=b[oa>>0]|0}la=va<<24>>24;f[k>>2]=0;f[T>>2]=0;f[U>>2]=0;if(!(va<<24>>24)){xa=0;ya=0}else{if(va<<24>>24<0){wa=30;break b}pa=la<<2;ma=ln(pa)|0;f[k>>2]=ma;na=ma+(la<<2)|0;f[V>>2]=na;sj(ma|0,0,pa|0)|0;f[T>>2]=na;xa=ma;ya=ma}if(Q){za=ya;Aa=xa}else{ma=ga+84|0;na=ga+68|0;pa=0;do{if(!(b[ma>>0]|0))Ba=f[(f[na>>2]|0)+(pa<<2)>>2]|0;else Ba=pa;la=f[j>>2]|0;f[g>>2]=Ba;fa=b[oa>>0]|0;f[e>>2]=f[g>>2];Qb(ga,e,fa,la)|0;la=b[oa>>0]|0;fa=la<<24>>24;if(la<<24>>24>0){la=f[j>>2]|0;ra=f[W>>2]|0;ta=f[k>>2]|0;sa=0;do{f[ta+(sa<<2)>>2]=(f[la+(sa<<2)>>2]|0)-(f[ra+(sa+ba<<2)>>2]|0);sa=sa+1|0}while((sa|0)<(fa|0));Ca=ta}else Ca=f[k>>2]|0;kh((f[H>>2]|0)+((X(f[F>>2]|0,pa)|0)<<2)+($<<2)|0,Ca|0,fa<<2|0)|0;pa=pa+1|0}while(pa>>>0>>0);pa=f[k>>2]|0;za=pa;Aa=pa}pa=ba+(b[oa>>0]|0)|0;if(za|0){na=f[T>>2]|0;if((na|0)!=(za|0))f[T>>2]=na+(~((na+-4-za|0)>>>2)<<2);Oq(Aa)}na=f[j>>2]|0;if(na|0){ma=f[R>>2]|0;if((ma|0)!=(na|0))f[R>>2]=ma+(~((ma+-4-na|0)>>>2)<<2);Oq(na)}ja=pa;ka=oa;break}default:{pa=ga+24|0;na=b[pa>>0]|0;ma=na<<24>>24;f[j>>2]=0;f[K>>2]=0;f[O>>2]=0;if(!(na<<24>>24)){Da=0;Ea=0}else{if(na<<24>>24<0){wa=53;break b}na=ma<<2;ta=ln(na)|0;f[j>>2]=ta;sa=ta+(ma<<2)|0;f[P>>2]=sa;sj(ta|0,0,na|0)|0;f[K>>2]=sa;Da=ta;Ea=ta}if(Q){Fa=Ea;Ga=Da}else{ta=ga+84|0;sa=ga+68|0;na=0;do{if(!(b[ta>>0]|0))Ha=f[(f[sa>>2]|0)+(na<<2)>>2]|0;else Ha=na;ma=f[j>>2]|0;f[g>>2]=Ha;ra=b[pa>>0]|0;f[e>>2]=f[g>>2];Pb(ga,e,ra,ma)|0;kh((f[H>>2]|0)+((X(f[F>>2]|0,na)|0)<<2)+($<<2)|0,f[j>>2]|0,b[pa>>0]<<2|0)|0;na=na+1|0}while(na>>>0>>0);na=f[j>>2]|0;Fa=na;Ga=na}if(Fa|0){na=f[K>>2]|0;if((na|0)!=(Fa|0))f[K>>2]=na+(~((na+-4-Fa|0)>>>2)<<2);Oq(Ga)}ja=ba;ka=pa}}while(0);na=ca+1|0;sa=f[G>>2]|0;if(na>>>0>=(f[L>>2]|0)-sa>>2>>>0){wa=66;break}$=$+(b[ka>>0]|0)|0;aa=ha;ba=ja;ca=na;da=sa;ea=f[A>>2]|0}if((wa|0)==24)aq(j);else if((wa|0)==30)aq(k);else if((wa|0)==53)aq(j);else if((wa|0)==66){Ia=f[D>>2]|0;Ja=f[H>>2]|0;wa=67;break}}else{Ia=E;Ja=N;wa=67}while(0);d:do if((wa|0)==67){N=X(Ia,B)|0;if((N|0)>0){E=0;H=0;while(1){D=f[Ja+(E<<2)>>2]|0;if(!D)Ka=H;else{A=(_(D|0)|0)^31;Ka=(A|0)<(H|0)?H:A+1|0}E=E+1|0;if((E|0)>=(N|0)){La=Ka;break}else H=Ka}}else La=0;switch(b[h>>0]|0){case 6:{Ue(j,Ia);f[l>>2]=0;f[l+4>>2]=i;H=f[F>>2]|0;f[l+8>>2]=H;f[m>>2]=f[i>>2];f[m+4>>2]=i;f[m+8>>2]=H;f[k>>2]=La;f[g>>2]=f[l>>2];f[g+4>>2]=f[l+4>>2];f[g+8>>2]=f[l+8>>2];f[e>>2]=f[m>>2];f[e+4>>2]=f[m+4>>2];f[e+8>>2]=f[m+8>>2];H=sf(j,g,e,k,c)|0;Se(j);if(!H){ia=0;break d}break}case 5:{Ue(j,Ia);f[n>>2]=0;f[n+4>>2]=i;H=f[F>>2]|0;f[n+8>>2]=H;f[o>>2]=f[i>>2];f[o+4>>2]=i;f[o+8>>2]=H;f[k>>2]=La;f[g>>2]=f[n>>2];f[g+4>>2]=f[n+4>>2];f[g+8>>2]=f[n+8>>2];f[e>>2]=f[o>>2];f[e+4>>2]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Y<<2)>>2]|0)|0;do if(P|0){Z=f[y>>2]|0;ea=32-Z|0;fa=32-P|0;ga=f[W+(Y<<2)>>2]<(ea|0)){ha=ga>>>fa;fa=P-ea|0;f[y>>2]=fa;ea=f[h>>2]|ha>>>fa;f[h>>2]=ea;fa=f[j>>2]|0;if((fa|0)==(f[m>>2]|0))Ri(n,h);else{f[fa>>2]=ea;f[j>>2]=fa+4}f[h>>2]=ha<<32-(f[y>>2]|0);break}ha=f[h>>2]|ga>>>Z;f[h>>2]=ha;ga=Z+P|0;f[y>>2]=ga;if((ga|0)!=32)break;ga=f[j>>2]|0;if((ga|0)==(f[m>>2]|0))Ri(n,h);else{f[ga>>2]=ha;f[j>>2]=ga+4}f[h>>2]=0;f[y>>2]=0}while(0);V=V+1|0;P=f[g>>2]|0}while(V>>>0

      >>0);da=P}ba=ba+1|0;if(ba>>>0>=z>>>0){aa=85;break a}else ca=da}}U=T+1|0;Ig(M+(U*12|0)|0,f[M+(T*12|0)>>2]|0,f[M+(T*12|0)+4>>2]|0);V=(f[(f[k>>2]|0)+(U*12|0)>>2]|0)+(Q<<2)|0;W=(f[V>>2]|0)+(1<>2]=W;V=f[A>>2]|0;P=f[B>>2]|0;b:do if((R|0)==(N|0))ia=N;else{Y=f[J>>2]|0;if(!V){if((f[Y+(Q<<2)>>2]|0)>>>0>>0){ia=R;break}else{ja=R;ka=N}while(1){ga=ja;do{ga=ga+-1|0;if((ka|0)==(ga|0)){ia=ka;break b}ha=(f[K>>2]|0)+((X(ga,P)|0)<<2)+(Q<<2)|0}while((f[ha>>2]|0)>>>0>=W>>>0);ka=ka+1|0;if((ka|0)==(ga|0)){ia=ga;break b}else ja=ga}}else{la=R;ma=N}while(1){ha=ma;while(1){na=Y+((X(ha,V)|0)<<2)|0;if((f[na+(Q<<2)>>2]|0)>>>0>=W>>>0){oa=la;break}Z=ha+1|0;if((Z|0)==(la|0)){ia=la;break b}else ha=Z}while(1){oa=oa+-1|0;if((ha|0)==(oa|0)){ia=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>>2]=ga+4}f[h>>2]=ia<<32-(f[y>>2]|0);break}ia=f[h>>2]|ha>>>$;f[h>>2]=ia;ha=$+Q|0;f[y>>2]=ha;if((ha|0)!=32)break;ha=f[j>>2]|0;if((ha|0)==(f[m>>2]|0))Ri(n,h);else{f[ha>>2]=ia;f[j>>2]=ha+4}f[h>>2]=0;f[y>>2]=0}while(0);W=W+1|0;Q=f[g>>2]|0}while(W>>>0>>0);ea=Q}ca=ca+1|0;if(ca>>>0>=z>>>0){ba=81;break a}else da=ea}}V=U+1|0;Ig(N+(V*12|0)|0,f[N+(U*12|0)>>2]|0,f[N+(U*12|0)+4>>2]|0);W=(f[(f[k>>2]|0)+(V*12|0)>>2]|0)+(R<<2)|0;Y=(f[W>>2]|0)+(1<>2]=Y;W=f[A>>2]|0;Q=f[B>>2]|0;b:do if((S|0)==(O|0))ja=O;else{Z=f[K>>2]|0;if(!W){if((f[Z+(R<<2)>>2]|0)>>>0>>0){ja=S;break}else{ka=S;la=O}while(1){ha=ka;do{ha=ha+-1|0;if((la|0)==(ha|0)){ja=la;break b}ia=(f[L>>2]|0)+((X(ha,Q)|0)<<2)+(R<<2)|0}while((f[ia>>2]|0)>>>0>=Y>>>0);la=la+1|0;if((la|0)==(ha|0)){ja=ha;break b}else ka=ha}}else{ma=S;na=O}while(1){ia=na;while(1){oa=Z+((X(ia,W)|0)<<2)|0;if((f[oa+(R<<2)>>2]|0)>>>0>=Y>>>0){pa=ma;break}$=ia+1|0;if(($|0)==(ma|0)){ja=ma;break b}else ia=$}while(1){pa=pa+-1|0;if((ia|0)==(pa|0)){ja=ia;break b}qa=(f[L>>2]|0)+((X(pa,Q)|0)<<2)|0;if((f[qa+(R<<2)>>2]|0)>>>0>>0){ra=0;break}}do{ha=oa+(ra<<2)|0;$=qa+(ra<<2)|0;ga=f[ha>>2]|0;f[ha>>2]=f[$>>2];f[$>>2]=ga;ra=ra+1|0}while((ra|0)!=(W|0));na=ia+1|0;if((na|0)==(pa|0)){ja=pa;break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Ja);u=d;return}function mb(a,c,e,g){a=a|0;c=c|0;e=e|0;g=g|0;var i=0,k=0,l=0,m=0,o=0,q=0,r=0,s=Oa,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0;if(!g){i=0;return i|0}do switch(f[a+28>>2]|0){case 1:{k=a+24|0;l=b[k>>0]|0;if((l<<24>>24>e<<24>>24?e:l)<<24>>24>0){m=f[f[a>>2]>>2]|0;o=a+40|0;q=un(f[o>>2]|0,f[o+4>>2]|0,f[c>>2]|0,0)|0;o=a+48|0;r=Vn(q|0,I|0,f[o>>2]|0,f[o+4>>2]|0)|0;o=m+r|0;if(!(b[a+32>>0]|0)){r=o;m=0;while(1){s=$(b[r>>0]|0);n[g+(m<<2)>>2]=s;m=m+1|0;q=b[k>>0]|0;if((m|0)>=((q<<24>>24>e<<24>>24?e:q)<<24>>24|0)){t=q;break}else r=r+1|0}}else{r=o;m=0;while(1){s=$($(b[r>>0]|0)/$(127.0));n[g+(m<<2)>>2]=s;m=m+1|0;q=b[k>>0]|0;if((m|0)>=((q<<24>>24>e<<24>>24?e:q)<<24>>24|0)){t=q;break}else r=r+1|0}}}else t=l;r=t<<24>>24;if(t<<24>>24>=e<<24>>24){i=1;return i|0}sj(g+(r<<2)|0,0,(e<<24>>24)-r<<2|0)|0;i=1;return i|0}case 2:{r=a+24|0;m=b[r>>0]|0;if((m<<24>>24>e<<24>>24?e:m)<<24>>24>0){k=f[f[a>>2]>>2]|0;o=a+40|0;q=un(f[o>>2]|0,f[o+4>>2]|0,f[c>>2]|0,0)|0;o=a+48|0;u=Vn(q|0,I|0,f[o>>2]|0,f[o+4>>2]|0)|0;o=k+u|0;if(!(b[a+32>>0]|0)){u=o;k=0;while(1){s=$(h[u>>0]|0);n[g+(k<<2)>>2]=s;k=k+1|0;q=b[r>>0]|0;if((k|0)>=((q<<24>>24>e<<24>>24?e:q)<<24>>24|0)){v=q;break}else u=u+1|0}}else{u=o;k=0;while(1){s=$($(h[u>>0]|0)/$(255.0));n[g+(k<<2)>>2]=s;k=k+1|0;l=b[r>>0]|0;if((k|0)>=((l<<24>>24>e<<24>>24?e:l)<<24>>24|0)){v=l;break}else u=u+1|0}}}else v=m;u=v<<24>>24;if(v<<24>>24>=e<<24>>24){i=1;return i|0}sj(g+(u<<2)|0,0,(e<<24>>24)-u<<2|0)|0;i=1;return i|0}case 3:{u=a+48|0;k=f[u>>2]|0;r=f[u+4>>2]|0;u=a+40|0;o=(Vn(un(f[u>>2]|0,f[u+4>>2]|0,f[c>>2]|0,0)|0,I|0,k|0,r|0)|0)+(f[f[a>>2]>>2]|0)|0;r=a+24|0;k=b[r>>0]|0;if((k<<24>>24>e<<24>>24?e:k)<<24>>24>0)if(!(b[a+32>>0]|0)){u=o;l=0;while(1){s=$(d[u>>1]|0);n[g+(l<<2)>>2]=s;l=l+1|0;q=b[r>>0]|0;if((l|0)>=((q<<24>>24>e<<24>>24?e:q)<<24>>24|0)){w=q;break}else u=u+2|0}}else{u=o;l=0;while(1){s=$($(d[u>>1]|0)/$(32767.0));n[g+(l<<2)>>2]=s;l=l+1|0;m=b[r>>0]|0;if((l|0)>=((m<<24>>24>e<<24>>24?e:m)<<24>>24|0)){w=m;break}else u=u+2|0}}else w=k;u=w<<24>>24;if(w<<24>>24>=e<<24>>24){i=1;return i|0}sj(g+(u<<2)|0,0,(e<<24>>24)-u<<2|0)|0;i=1;return i|0}case 4:{u=a+48|0;l=f[u>>2]|0;r=f[u+4>>2]|0;u=a+40|0;o=(Vn(un(f[u>>2]|0,f[u+4>>2]|0,f[c>>2]|0,0)|0,I|0,l|0,r|0)|0)+(f[f[a>>2]>>2]|0)|0;r=a+24|0;l=b[r>>0]|0;if((l<<24>>24>e<<24>>24?e:l)<<24>>24>0)if(!(b[a+32>>0]|0)){u=o;m=0;while(1){s=$(j[u>>1]|0);n[g+(m<<2)>>2]=s;m=m+1|0;q=b[r>>0]|0;if((m|0)>=((q<<24>>24>e<<24>>24?e:q)<<24>>24|0)){x=q;break}else u=u+2|0}}else{u=o;m=0;while(1){s=$($(j[u>>1]|0)/$(65535.0));n[g+(m<<2)>>2]=s;m=m+1|0;k=b[r>>0]|0;if((m|0)>=((k<<24>>24>e<<24>>24?e:k)<<24>>24|0)){x=k;break}else u=u+2|0}}else x=l;u=x<<24>>24;if(x<<24>>24>=e<<24>>24){i=1;return i|0}sj(g+(u<<2)|0,0,(e<<24>>24)-u<<2|0)|0;i=1;return i|0}case 5:{u=a+48|0;m=f[u>>2]|0;r=f[u+4>>2]|0;u=a+40|0;o=(Vn(un(f[u>>2]|0,f[u+4>>2]|0,f[c>>2]|0,0)|0,I|0,m|0,r|0)|0)+(f[f[a>>2]>>2]|0)|0;r=a+24|0;m=b[r>>0]|0;if((m<<24>>24>e<<24>>24?e:m)<<24>>24>0)if(!(b[a+32>>0]|0)){u=o;k=0;while(1){s=$(f[u>>2]|0);n[g+(k<<2)>>2]=s;k=k+1|0;q=b[r>>0]|0;if((k|0)>=((q<<24>>24>e<<24>>24?e:q)<<24>>24|0)){y=q;break}else u=u+4|0}}else{u=o;k=0;while(1){s=$($(f[u>>2]|0)*$(4.65661287e-10));n[g+(k<<2)>>2]=s;k=k+1|0;l=b[r>>0]|0;if((k|0)>=((l<<24>>24>e<<24>>24?e:l)<<24>>24|0)){y=l;break}else u=u+4|0}}else y=m;u=y<<24>>24;if(y<<24>>24>=e<<24>>24){i=1;return i|0}sj(g+(u<<2)|0,0,(e<<24>>24)-u<<2|0)|0;i=1;return i|0}case 6:{u=a+48|0;k=f[u>>2]|0;r=f[u+4>>2]|0;u=a+40|0;o=(Vn(un(f[u>>2]|0,f[u+4>>2]|0,f[c>>2]|0,0)|0,I|0,k|0,r|0)|0)+(f[f[a>>2]>>2]|0)|0;r=a+24|0;k=b[r>>0]|0;if((k<<24>>24>e<<24>>24?e:k)<<24>>24>0)if(!(b[a+32>>0]|0)){u=o;l=0;while(1){s=$((f[u>>2]|0)>>>0);n[g+(l<<2)>>2]=s;l=l+1|0;q=b[r>>0]|0;if((l|0)>=((q<<24>>24>e<<24>>24?e:q)<<24>>24|0)){z=q;break}else u=u+4|0}}else{u=o;l=0;while(1){s=$($((f[u>>2]|0)>>>0)*$(2.32830644e-10));n[g+(l<<2)>>2]=s;l=l+1|0;m=b[r>>0]|0;if((l|0)>=((m<<24>>24>e<<24>>24?e:m)<<24>>24|0)){z=m;break}else u=u+4|0}}else z=k;u=z<<24>>24;if(z<<24>>24>=e<<24>>24){i=1;return i|0}sj(g+(u<<2)|0,0,(e<<24>>24)-u<<2|0)|0;i=1;return i|0}case 7:{u=a+48|0;l=f[u>>2]|0;r=f[u+4>>2]|0;u=a+40|0;o=(Vn(un(f[u>>2]|0,f[u+4>>2]|0,f[c>>2]|0,0)|0,I|0,l|0,r|0)|0)+(f[f[a>>2]>>2]|0)|0;r=a+24|0;l=b[r>>0]|0;if((l<<24>>24>e<<24>>24?e:l)<<24>>24>0)if(!(b[a+32>>0]|0)){u=o;m=0;while(1){q=u;s=$(+((f[q>>2]|0)>>>0)+4294967296.0*+(f[q+4>>2]|0));n[g+(m<<2)>>2]=s;m=m+1|0;q=b[r>>0]|0;if((m|0)>=((q<<24>>24>e<<24>>24?e:q)<<24>>24|0)){A=q;break}else u=u+8|0}}else{u=o;m=0;while(1){k=u;s=$($(+((f[k>>2]|0)>>>0)+4294967296.0*+(f[k+4>>2]|0))*$(1.08420217e-19));n[g+(m<<2)>>2]=s;m=m+1|0;k=b[r>>0]|0;if((m|0)>=((k<<24>>24>e<<24>>24?e:k)<<24>>24|0)){A=k;break}else u=u+8|0}}else A=l;u=A<<24>>24;if(A<<24>>24>=e<<24>>24){i=1;return i|0}sj(g+(u<<2)|0,0,(e<<24>>24)-u<<2|0)|0;i=1;return i|0}case 8:{u=a+48|0;m=f[u>>2]|0;r=f[u+4>>2]|0;u=a+40|0;o=(Vn(un(f[u>>2]|0,f[u+4>>2]|0,f[c>>2]|0,0)|0,I|0,m|0,r|0)|0)+(f[f[a>>2]>>2]|0)|0;r=a+24|0;m=b[r>>0]|0;if((m<<24>>24>e<<24>>24?e:m)<<24>>24>0)if(!(b[a+32>>0]|0)){u=o;k=0;while(1){q=u;s=$(+((f[q>>2]|0)>>>0)+4294967296.0*+((f[q+4>>2]|0)>>>0));n[g+(k<<2)>>2]=s;k=k+1|0;q=b[r>>0]|0;if((k|0)>=((q<<24>>24>e<<24>>24?e:q)<<24>>24|0)){B=q;break}else u=u+8|0}}else{u=o;k=0;while(1){l=u;s=$($(+((f[l>>2]|0)>>>0)+4294967296.0*+((f[l+4>>2]|0)>>>0))*$(5.42101086e-20));n[g+(k<<2)>>2]=s;k=k+1|0;l=b[r>>0]|0;if((k|0)>=((l<<24>>24>e<<24>>24?e:l)<<24>>24|0)){B=l;break}else u=u+8|0}}else B=m;u=B<<24>>24;if(B<<24>>24>=e<<24>>24){i=1;return i|0}sj(g+(u<<2)|0,0,(e<<24>>24)-u<<2|0)|0;i=1;return i|0}case 9:{u=a+24|0;k=b[u>>0]|0;if((k<<24>>24>e<<24>>24?e:k)<<24>>24>0){r=f[f[a>>2]>>2]|0;o=a+40|0;l=un(f[o>>2]|0,f[o+4>>2]|0,f[c>>2]|0,0)|0;o=a+48|0;q=Vn(l|0,I|0,f[o>>2]|0,f[o+4>>2]|0)|0;o=r+q|0;q=0;while(1){f[g+(q<<2)>>2]=f[o>>2];q=q+1|0;r=b[u>>0]|0;if((q|0)>=((r<<24>>24>e<<24>>24?e:r)<<24>>24|0)){C=r;break}else o=o+4|0}}else C=k;o=C<<24>>24;if(C<<24>>24>=e<<24>>24){i=1;return i|0}sj(g+(o<<2)|0,0,(e<<24>>24)-o<<2|0)|0;i=1;return i|0}case 10:{o=a+24|0;q=b[o>>0]|0;if((q<<24>>24>e<<24>>24?e:q)<<24>>24>0){u=f[f[a>>2]>>2]|0;m=a+40|0;r=un(f[m>>2]|0,f[m+4>>2]|0,f[c>>2]|0,0)|0;m=a+48|0;l=Vn(r|0,I|0,f[m>>2]|0,f[m+4>>2]|0)|0;m=u+l|0;l=0;while(1){s=$(+p[m>>3]);n[g+(l<<2)>>2]=s;l=l+1|0;u=b[o>>0]|0;if((l|0)>=((u<<24>>24>e<<24>>24?e:u)<<24>>24|0)){D=u;break}else m=m+8|0}}else D=q;m=D<<24>>24;if(D<<24>>24>=e<<24>>24){i=1;return i|0}sj(g+(m<<2)|0,0,(e<<24>>24)-m<<2|0)|0;i=1;return i|0}case 11:{m=a+24|0;l=b[m>>0]|0;if((l<<24>>24>e<<24>>24?e:l)<<24>>24>0){o=f[f[a>>2]>>2]|0;k=a+40|0;u=un(f[k>>2]|0,f[k+4>>2]|0,f[c>>2]|0,0)|0;k=a+48|0;r=Vn(u|0,I|0,f[k>>2]|0,f[k+4>>2]|0)|0;k=o+r|0;r=0;while(1){s=$((b[k>>0]|0)!=0&1);n[g+(r<<2)>>2]=s;r=r+1|0;o=b[m>>0]|0;if((r|0)>=((o<<24>>24>e<<24>>24?e:o)<<24>>24|0)){E=o;break}else k=k+1|0}}else E=l;k=E<<24>>24;if(E<<24>>24>=e<<24>>24){i=1;return i|0}sj(g+(k<<2)|0,0,(e<<24>>24)-k<<2|0)|0;i=1;return i|0}default:{i=0;return i|0}}while(0);return 0}function nb(a,b,c,d,e,g){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;g=g|0;var i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,J=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,Y=0,Z=0,_=0,$=0,aa=0,ba=0,ca=0,da=0,ea=0,fa=0,ga=0,ha=0,ia=0,ja=0,ka=0,la=0,ma=0,na=0,oa=0,pa=0,qa=0,ra=0,sa=0,ta=0,ua=0,va=0,wa=0,xa=0,ya=0,za=0,Aa=0.0,Ba=0,Ca=0,Da=0,Ea=0,Fa=0,Ga=0,Ha=0,Ia=0,Ja=0,Ka=0,La=0,Ma=0,Na=0,Oa=0,Pa=0,Qa=0,Ra=0,Sa=0,Ta=0,Ua=0,Va=0,Wa=0,Xa=0,Ya=0,Za=0,_a=0,$a=0,ab=0,bb=0.0,cb=0,db=0,eb=0,fb=0,gb=0,hb=0,ib=0,jb=0.0,kb=0.0,lb=0.0,mb=0.0,nb=0.0,ob=0.0,pb=0.0,qb=0.0,rb=0.0,sb=0.0,tb=0;i=u;u=u+512|0;j=i;k=d+c|0;l=0-k|0;m=a+4|0;n=a+100|0;o=b;b=0;a:while(1){switch(o|0){case 46:{p=6;break a;break}case 48:break;default:{q=0;r=o;s=b;t=0;v=0;break a}}w=f[m>>2]|0;if(w>>>0<(f[n>>2]|0)>>>0){f[m>>2]=w+1;o=h[w>>0]|0;b=1;continue}else{o=Si(a)|0;b=1;continue}}if((p|0)==6){o=f[m>>2]|0;if(o>>>0<(f[n>>2]|0)>>>0){f[m>>2]=o+1;x=h[o>>0]|0}else x=Si(a)|0;if((x|0)==48){o=0;w=0;while(1){y=Vn(o|0,w|0,-1,-1)|0;z=I;A=f[m>>2]|0;if(A>>>0<(f[n>>2]|0)>>>0){f[m>>2]=A+1;B=h[A>>0]|0}else B=Si(a)|0;if((B|0)==48){o=y;w=z}else{q=1;r=B;s=1;t=y;v=z;break}}}else{q=1;r=x;s=b;t=0;v=0}}f[j>>2]=0;b=r+-48|0;x=(r|0)==46;b:do if(x|b>>>0<10){B=j+496|0;w=0;o=0;z=0;y=q;A=s;C=r;D=x;E=b;F=t;G=v;H=0;J=0;c:while(1){do if(D)if(!y){L=w;M=o;N=1;O=z;P=A;Q=H;R=J;S=H;T=J}else break c;else{U=Vn(H|0,J|0,1,0)|0;V=I;W=(C|0)!=48;if((o|0)>=125){if(!W){L=w;M=o;N=y;O=z;P=A;Q=F;R=G;S=U;T=V;break}f[B>>2]=f[B>>2]|1;L=w;M=o;N=y;O=z;P=A;Q=F;R=G;S=U;T=V;break}Y=j+(o<<2)|0;if(!w)Z=E;else Z=C+-48+((f[Y>>2]|0)*10|0)|0;f[Y>>2]=Z;Y=w+1|0;_=(Y|0)==9;L=_?0:Y;M=o+(_&1)|0;N=y;O=W?U:z;P=1;Q=F;R=G;S=U;T=V}while(0);V=f[m>>2]|0;if(V>>>0<(f[n>>2]|0)>>>0){f[m>>2]=V+1;$=h[V>>0]|0}else $=Si(a)|0;E=$+-48|0;D=($|0)==46;if(!(D|E>>>0<10)){aa=L;ba=M;ca=O;da=N;ea=$;fa=P;ga=S;ha=Q;ia=T;ja=R;p=29;break b}else{w=L;o=M;z=O;y=N;A=P;C=$;F=Q;G=R;H=S;J=T}}ka=w;la=o;ma=z;na=H;oa=J;pa=F;qa=G;ra=(A|0)!=0;p=37}else{aa=0;ba=0;ca=0;da=q;ea=r;fa=s;ga=0;ha=t;ia=0;ja=v;p=29}while(0);do if((p|0)==29){v=(da|0)==0;t=v?ga:ha;s=v?ia:ja;v=(fa|0)!=0;if(!(v&(ea|32|0)==101))if((ea|0)>-1){ka=aa;la=ba;ma=ca;na=ga;oa=ia;pa=t;qa=s;ra=v;p=37;break}else{sa=aa;ta=ba;ua=ca;va=ga;wa=ia;xa=v;ya=t;za=s;p=39;break}v=Re(a,g)|0;r=I;if((v|0)==0&(r|0)==-2147483648){if(!g){Ym(a,0);Aa=0.0;break}if(!(f[n>>2]|0)){Ba=0;Ca=0}else{f[m>>2]=(f[m>>2]|0)+-1;Ba=0;Ca=0}}else{Ba=v;Ca=r}r=Vn(Ba|0,Ca|0,t|0,s|0)|0;Da=aa;Ea=ba;Fa=ca;Ga=r;Ha=ga;Ia=I;Ja=ia;p=41}while(0);if((p|0)==37)if(f[n>>2]|0){f[m>>2]=(f[m>>2]|0)+-1;if(ra){Da=ka;Ea=la;Fa=ma;Ga=pa;Ha=na;Ia=qa;Ja=oa;p=41}else p=40}else{sa=ka;ta=la;ua=ma;va=na;wa=oa;xa=ra;ya=pa;za=qa;p=39}if((p|0)==39)if(xa){Da=sa;Ea=ta;Fa=ua;Ga=ya;Ha=va;Ia=za;Ja=wa;p=41}else p=40;do if((p|0)==40){wa=Vq()|0;f[wa>>2]=22;Ym(a,0);Aa=0.0}else if((p|0)==41){wa=f[j>>2]|0;if(!wa){Aa=+(e|0)*0.0;break}if(((Ja|0)<0|(Ja|0)==0&Ha>>>0<10)&((Ga|0)==(Ha|0)&(Ia|0)==(Ja|0))?(c|0)>30|(wa>>>c|0)==0:0){Aa=+(e|0)*+(wa>>>0);break}wa=(d|0)/-2|0;za=((wa|0)<0)<<31>>31;if((Ia|0)>(za|0)|(Ia|0)==(za|0)&Ga>>>0>wa>>>0){wa=Vq()|0;f[wa>>2]=34;Aa=+(e|0)*1797693134862315708145274.0e284*1797693134862315708145274.0e284;break}wa=d+-106|0;za=((wa|0)<0)<<31>>31;if((Ia|0)<(za|0)|(Ia|0)==(za|0)&Ga>>>0>>0){wa=Vq()|0;f[wa>>2]=34;Aa=+(e|0)*2.2250738585072014e-308*2.2250738585072014e-308;break}if(!Da)Ka=Ea;else{if((Da|0)<9){wa=j+(Ea<<2)|0;za=Da;va=f[wa>>2]|0;while(1){va=va*10|0;if((za|0)>=8)break;else za=za+1|0}f[wa>>2]=va}Ka=Ea+1|0}if((Fa|0)<9?(Fa|0)<=(Ga|0)&(Ga|0)<18:0){if((Ga|0)==9){Aa=+(e|0)*+((f[j>>2]|0)>>>0);break}if((Ga|0)<9){Aa=+(e|0)*+((f[j>>2]|0)>>>0)/+(f[6720+(8-Ga<<2)>>2]|0);break}za=c+27+(X(Ga,-3)|0)|0;A=f[j>>2]|0;if((za|0)>30|(A>>>za|0)==0){Aa=+(e|0)*+(A>>>0)*+(f[6720+(Ga+-10<<2)>>2]|0);break}}A=(Ga|0)%9|0;if(!A){La=0;Ma=Ka;Na=0;Oa=Ga}else{za=(Ga|0)>-1?A:A+9|0;A=f[6720+(8-za<<2)>>2]|0;if(Ka){G=1e9/(A|0)|0;F=0;J=0;H=Ga;z=0;do{o=j+(z<<2)|0;w=f[o>>2]|0;ya=((w>>>0)/(A>>>0)|0)+F|0;f[o>>2]=ya;F=X(G,(w>>>0)%(A>>>0)|0)|0;w=(z|0)==(J|0)&(ya|0)==0;H=w?H+-9|0:H;J=w?J+1&127:J;z=z+1|0}while((z|0)!=(Ka|0));if(!F){Pa=J;Qa=Ka;Ra=H}else{f[j+(Ka<<2)>>2]=F;Pa=J;Qa=Ka+1|0;Ra=H}}else{Pa=0;Qa=0;Ra=Ga}La=0;Ma=Qa;Na=Pa;Oa=9-za+Ra|0}d:while(1){z=(Oa|0)<18;A=(Oa|0)==18;G=j+(Na<<2)|0;va=La;wa=Ma;while(1){if(!z){if(!A){Sa=va;Ta=Na;Ua=Oa;Va=wa;break d}if((f[G>>2]|0)>>>0>=9007199){Sa=va;Ta=Na;Ua=18;Va=wa;break d}}w=0;Wa=wa;ya=wa+127|0;while(1){o=ya&127;ua=j+(o<<2)|0;ta=Tn(f[ua>>2]|0,0,29)|0;sa=Vn(ta|0,I|0,w|0,0)|0;ta=I;if(ta>>>0>0|(ta|0)==0&sa>>>0>1e9){xa=jp(sa|0,ta|0,1e9,0)|0;qa=hn(sa|0,ta|0,1e9,0)|0;Xa=xa;Ya=qa}else{Xa=0;Ya=sa}f[ua>>2]=Ya;ua=(o|0)==(Na|0);Wa=(Ya|0)==0&(((o|0)!=(Wa+127&127|0)|ua)^1)?o:Wa;if(ua)break;else{w=Xa;ya=o+-1|0}}va=va+-29|0;if(Xa|0)break;else wa=Wa}wa=Na+127&127;G=Wa+127&127;A=j+((Wa+126&127)<<2)|0;if((wa|0)==(Wa|0)){f[A>>2]=f[A>>2]|f[j+(G<<2)>>2];Za=G}else Za=Wa;f[j+(wa<<2)>>2]=Xa;La=va;Ma=Za;Na=wa;Oa=Oa+9|0}e:while(1){za=Va+1&127;H=j+((Va+127&127)<<2)|0;J=Sa;F=Ta;wa=Ua;while(1){G=(wa|0)==18;A=(wa|0)>27?9:1;_a=J;$a=F;while(1){z=0;while(1){ya=z+$a&127;if((ya|0)==(Va|0)){ab=2;p=88;break}w=f[j+(ya<<2)>>2]|0;ya=f[6752+(z<<2)>>2]|0;if(w>>>0>>0){ab=2;p=88;break}if(w>>>0>ya>>>0)break;ya=z+1|0;if((z|0)<1)z=ya;else{ab=ya;p=88;break}}if((p|0)==88?(p=0,G&(ab|0)==2):0){bb=0.0;cb=0;db=Va;break e}eb=A+_a|0;if(($a|0)==(Va|0)){_a=eb;$a=Va}else break}G=(1<>>A;fb=0;gb=$a;hb=wa;ya=$a;do{w=j+(ya<<2)|0;o=f[w>>2]|0;ua=(o>>>A)+fb|0;f[w>>2]=ua;fb=X(o&G,z)|0;o=(ya|0)==(gb|0)&(ua|0)==0;hb=o?hb+-9|0:hb;gb=o?gb+1&127:gb;ya=ya+1&127}while((ya|0)!=(Va|0));if(!fb){J=eb;F=gb;wa=hb;continue}if((za|0)!=(gb|0))break;f[H>>2]=f[H>>2]|1;J=eb;F=gb;wa=hb}f[j+(Va<<2)>>2]=fb;Sa=eb;Ta=gb;Ua=hb;Va=za}while(1){wa=cb+$a&127;F=db+1&127;if((wa|0)==(db|0)){f[j+(F+-1<<2)>>2]=0;ib=F}else ib=db;bb=bb*1.0e9+ +((f[j+(wa<<2)>>2]|0)>>>0);cb=cb+1|0;if((cb|0)==2)break;else db=ib}jb=+(e|0);kb=bb*jb;wa=_a+53|0;F=wa-d|0;J=(F|0)<(c|0);H=J?((F|0)>0?F:0):c;if((H|0)<53){lb=+rq(+bk(1.0,105-H|0),kb);mb=+Dq(kb,+bk(1.0,53-H|0));nb=lb;ob=mb;pb=lb+(kb-mb)}else{nb=0.0;ob=0.0;pb=kb}va=$a+2&127;if((va|0)!=(ib|0)){ya=f[j+(va<<2)>>2]|0;do if(ya>>>0>=5e8){if((ya|0)!=5e8){qb=jb*.75+ob;break}if(($a+3&127|0)==(ib|0)){qb=jb*.5+ob;break}else{qb=jb*.75+ob;break}}else{if((ya|0)==0?($a+3&127|0)==(ib|0):0){qb=ob;break}qb=jb*.25+ob}while(0);if((53-H|0)>1?!(+Dq(qb,1.0)!=0.0):0)rb=qb+1.0;else rb=qb}else rb=ob;jb=pb+rb-nb;do if((wa&2147483647|0)>(-2-k|0)){ya=!(+K(+jb)>=9007199254740992.0);va=_a+((ya^1)&1)|0;kb=ya?jb:jb*.5;if((va+50|0)<=(l|0)?!(rb!=0.0&(J&((H|0)!=(F|0)|ya))):0){sb=kb;tb=va;break}ya=Vq()|0;f[ya>>2]=34;sb=kb;tb=va}else{sb=jb;tb=_a}while(0);Aa=+sq(sb,tb)}while(0);u=i;return +Aa}function ob(a,c,d,e,g,i){a=a|0;c=+c;d=d|0;e=e|0;g=g|0;i=i|0;var j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0.0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0.0,C=0,D=0.0,E=0,F=0,G=0,H=0.0,J=0,K=0,L=0,M=0,N=0,O=0.0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,Y=0,Z=0,_=0,$=0,aa=0,ba=0,ca=0,da=0,ea=0,fa=0.0,ga=0.0,ha=0,ia=0,ja=0,ka=0,la=0,ma=0,na=0,oa=0,pa=0,qa=0,ra=0,sa=0,ta=0,ua=0,va=0,wa=0,xa=0,ya=0,za=0,Aa=0,Ba=0,Ca=0,Da=0,Ea=0,Fa=0;j=u;u=u+560|0;k=j+8|0;l=j;m=j+524|0;n=m;o=j+512|0;f[l>>2]=0;p=o+12|0;yo(c)|0;if((I|0)<0){q=-c;r=1;s=16605}else{q=c;r=(g&2049|0)!=0&1;s=(g&2048|0)==0?((g&1|0)==0?16606:16611):16608}yo(q)|0;do if(0==0&(I&2146435072|0)==2146435072){t=(i&32|0)!=0;v=r+3|0;Qk(a,32,d,v,g&-65537);Xo(a,s,r);Xo(a,q!=q|0.0!=0.0?(t?18555:16632):t?16624:16628,3);Qk(a,32,d,v,g^8192);w=v}else{c=+tq(q,l)*2.0;v=c!=0.0;if(v)f[l>>2]=(f[l>>2]|0)+-1;t=i|32;if((t|0)==97){x=i&32;y=(x|0)==0?s:s+9|0;z=r|2;A=12-e|0;do if(!(e>>>0>11|(A|0)==0)){B=8.0;C=A;do{C=C+-1|0;B=B*16.0}while((C|0)!=0);if((b[y>>0]|0)==45){D=-(B+(-c-B));break}else{D=c+B-B;break}}else D=c;while(0);A=f[l>>2]|0;C=(A|0)<0?0-A|0:A;E=Rj(C,((C|0)<0)<<31>>31,p)|0;if((E|0)==(p|0)){C=o+11|0;b[C>>0]=48;F=C}else F=E;b[F+-1>>0]=(A>>31&2)+43;A=F+-2|0;b[A>>0]=i+15;E=(e|0)<1;C=(g&8|0)==0;G=m;H=D;while(1){J=~~H;K=G+1|0;b[G>>0]=x|h[16636+J>>0];H=(H-+(J|0))*16.0;if((K-n|0)==1?!(C&(E&H==0.0)):0){b[K>>0]=46;L=G+2|0}else L=K;if(!(H!=0.0))break;else G=L}G=L;if((e|0)!=0?(-2-n+G|0)<(e|0):0){M=G-n|0;N=e+2|0}else{E=G-n|0;M=E;N=E}E=p-A|0;G=E+z+N|0;Qk(a,32,d,G,g);Xo(a,y,z);Qk(a,48,d,G,g^65536);Xo(a,m,M);Qk(a,48,N-M|0,0,0);Xo(a,A,E);Qk(a,32,d,G,g^8192);w=G;break}G=(e|0)<0?6:e;if(v){E=(f[l>>2]|0)+-28|0;f[l>>2]=E;O=c*268435456.0;P=E}else{O=c;P=f[l>>2]|0}E=(P|0)<0?k:k+288|0;C=E;H=O;do{x=~~H>>>0;f[C>>2]=x;C=C+4|0;H=(H-+(x>>>0))*1.0e9}while(H!=0.0);if((P|0)>0){v=E;A=C;z=P;while(1){y=(z|0)<29?z:29;x=A+-4|0;if(x>>>0>=v>>>0){K=x;x=0;do{J=Tn(f[K>>2]|0,0,y|0)|0;Q=Vn(J|0,I|0,x|0,0)|0;J=I;R=hn(Q|0,J|0,1e9,0)|0;f[K>>2]=R;x=jp(Q|0,J|0,1e9,0)|0;K=K+-4|0}while(K>>>0>=v>>>0);if(x){K=v+-4|0;f[K>>2]=x;S=K}else S=v}else S=v;K=A;while(1){if(K>>>0<=S>>>0)break;J=K+-4|0;if(!(f[J>>2]|0))K=J;else break}x=(f[l>>2]|0)-y|0;f[l>>2]=x;if((x|0)>0){v=S;A=K;z=x}else{T=S;U=K;V=x;break}}}else{T=E;U=C;V=P}if((V|0)<0){z=((G+25|0)/9|0)+1|0;A=(t|0)==102;v=T;x=U;J=V;while(1){Q=0-J|0;R=(Q|0)<9?Q:9;if(v>>>0>>0){Q=(1<>>R;Y=0;Z=v;do{_=f[Z>>2]|0;f[Z>>2]=(_>>>R)+Y;Y=X(_&Q,W)|0;Z=Z+4|0}while(Z>>>0>>0);Z=(f[v>>2]|0)==0?v+4|0:v;if(!Y){$=Z;aa=x}else{f[x>>2]=Y;$=Z;aa=x+4|0}}else{$=(f[v>>2]|0)==0?v+4|0:v;aa=x}Z=A?E:$;W=(aa-Z>>2|0)>(z|0)?Z+(z<<2)|0:aa;J=(f[l>>2]|0)+R|0;f[l>>2]=J;if((J|0)>=0){ba=$;ca=W;break}else{v=$;x=W}}}else{ba=T;ca=U}x=E;if(ba>>>0>>0){v=(x-ba>>2)*9|0;J=f[ba>>2]|0;if(J>>>0<10)da=v;else{z=v;v=10;while(1){v=v*10|0;A=z+1|0;if(J>>>0>>0){da=A;break}else z=A}}}else da=0;z=(t|0)==103;v=(G|0)!=0;J=G-((t|0)!=102?da:0)+((v&z)<<31>>31)|0;if((J|0)<(((ca-x>>2)*9|0)+-9|0)){A=J+9216|0;J=E+4+(((A|0)/9|0)+-1024<<2)|0;C=(A|0)%9|0;if((C|0)<8){A=C;C=10;while(1){W=C*10|0;if((A|0)<7){A=A+1|0;C=W}else{ea=W;break}}}else ea=10;C=f[J>>2]|0;A=(C>>>0)%(ea>>>0)|0;t=(J+4|0)==(ca|0);if(!(t&(A|0)==0)){B=(((C>>>0)/(ea>>>0)|0)&1|0)==0?9007199254740992.0:9007199254740994.0;W=(ea|0)/2|0;H=A>>>0>>0?.5:t&(A|0)==(W|0)?1.0:1.5;if(!r){fa=H;ga=B}else{W=(b[s>>0]|0)==45;fa=W?-H:H;ga=W?-B:B}W=C-A|0;f[J>>2]=W;if(ga+fa!=ga){A=W+ea|0;f[J>>2]=A;if(A>>>0>999999999){A=ba;W=J;while(1){C=W+-4|0;f[W>>2]=0;if(C>>>0>>0){t=A+-4|0;f[t>>2]=0;ha=t}else ha=A;t=(f[C>>2]|0)+1|0;f[C>>2]=t;if(t>>>0>999999999){A=ha;W=C}else{ia=ha;ja=C;break}}}else{ia=ba;ja=J}W=(x-ia>>2)*9|0;A=f[ia>>2]|0;if(A>>>0<10){ka=ja;la=W;ma=ia}else{C=W;W=10;while(1){W=W*10|0;t=C+1|0;if(A>>>0>>0){ka=ja;la=t;ma=ia;break}else C=t}}}else{ka=J;la=da;ma=ba}}else{ka=J;la=da;ma=ba}C=ka+4|0;na=la;oa=ca>>>0>C>>>0?C:ca;pa=ma}else{na=da;oa=ca;pa=ba}C=oa;while(1){if(C>>>0<=pa>>>0){qa=0;break}W=C+-4|0;if(!(f[W>>2]|0))C=W;else{qa=1;break}}J=0-na|0;do if(z){W=G+((v^1)&1)|0;if((W|0)>(na|0)&(na|0)>-5){ra=i+-1|0;sa=W+-1-na|0}else{ra=i+-2|0;sa=W+-1|0}W=g&8;if(!W){if(qa?(A=f[C+-4>>2]|0,(A|0)!=0):0)if(!((A>>>0)%10|0)){t=0;Z=10;while(1){Z=Z*10|0;Q=t+1|0;if((A>>>0)%(Z>>>0)|0|0){ta=Q;break}else t=Q}}else ta=0;else ta=9;t=((C-x>>2)*9|0)+-9|0;if((ra|32|0)==102){Z=t-ta|0;A=(Z|0)>0?Z:0;ua=ra;va=(sa|0)<(A|0)?sa:A;wa=0;break}else{A=t+na-ta|0;t=(A|0)>0?A:0;ua=ra;va=(sa|0)<(t|0)?sa:t;wa=0;break}}else{ua=ra;va=sa;wa=W}}else{ua=i;va=G;wa=g&8}while(0);G=va|wa;x=(G|0)!=0&1;v=(ua|32|0)==102;if(v){xa=0;ya=(na|0)>0?na:0}else{z=(na|0)<0?J:na;t=Rj(z,((z|0)<0)<<31>>31,p)|0;z=p;if((z-t|0)<2){A=t;while(1){Z=A+-1|0;b[Z>>0]=48;if((z-Z|0)<2)A=Z;else{za=Z;break}}}else za=t;b[za+-1>>0]=(na>>31&2)+43;A=za+-2|0;b[A>>0]=ua;xa=A;ya=z-A|0}A=r+1+va+x+ya|0;Qk(a,32,d,A,g);Xo(a,s,r);Qk(a,48,d,A,g^65536);if(v){J=pa>>>0>E>>>0?E:pa;Z=m+9|0;R=Z;Y=m+8|0;Q=J;do{K=Rj(f[Q>>2]|0,0,Z)|0;if((Q|0)==(J|0))if((K|0)==(Z|0)){b[Y>>0]=48;Aa=Y}else Aa=K;else if(K>>>0>m>>>0){sj(m|0,48,K-n|0)|0;y=K;while(1){_=y+-1|0;if(_>>>0>m>>>0)y=_;else{Aa=_;break}}}else Aa=K;Xo(a,Aa,R-Aa|0);Q=Q+4|0}while(Q>>>0<=E>>>0);if(G|0)Xo(a,16652,1);if(Q>>>0>>0&(va|0)>0){E=va;R=Q;while(1){Y=Rj(f[R>>2]|0,0,Z)|0;if(Y>>>0>m>>>0){sj(m|0,48,Y-n|0)|0;J=Y;while(1){v=J+-1|0;if(v>>>0>m>>>0)J=v;else{Ba=v;break}}}else Ba=Y;Xo(a,Ba,(E|0)<9?E:9);R=R+4|0;J=E+-9|0;if(!(R>>>0>>0&(E|0)>9)){Ca=J;break}else E=J}}else Ca=va;Qk(a,48,Ca+9|0,9,0)}else{E=qa?C:pa+4|0;if((va|0)>-1){R=m+9|0;Z=(wa|0)==0;Q=R;G=0-n|0;J=m+8|0;K=va;v=pa;while(1){x=Rj(f[v>>2]|0,0,R)|0;if((x|0)==(R|0)){b[J>>0]=48;Da=J}else Da=x;do if((v|0)==(pa|0)){x=Da+1|0;Xo(a,Da,1);if(Z&(K|0)<1){Ea=x;break}Xo(a,16652,1);Ea=x}else{if(Da>>>0<=m>>>0){Ea=Da;break}sj(m|0,48,Da+G|0)|0;x=Da;while(1){z=x+-1|0;if(z>>>0>m>>>0)x=z;else{Ea=z;break}}}while(0);Y=Q-Ea|0;Xo(a,Ea,(K|0)>(Y|0)?Y:K);x=K-Y|0;v=v+4|0;if(!(v>>>0>>0&(x|0)>-1)){Fa=x;break}else K=x}}else Fa=va;Qk(a,48,Fa+18|0,18,0);Xo(a,xa,p-xa|0)}Qk(a,32,d,A,g^8192);w=A}while(0);u=j;return ((w|0)<(d|0)?d:w)|0}function pb(a){a=a|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,$=0,aa=0,ba=0;c=u;u=u+64|0;d=c+56|0;e=c+52|0;g=c+48|0;h=c+60|0;i=c;j=c+44|0;k=c+40|0;l=c+36|0;m=c+32|0;n=c+28|0;o=c+24|0;p=c+20|0;q=c+16|0;r=c+12|0;if(!(b[a+288>>0]|0)){_e(d,f[a+8>>2]|0);s=a+12|0;t=f[d>>2]|0;f[d>>2]=0;v=f[s>>2]|0;f[s>>2]=t;if(v){Ii(v);Oq(v);v=f[d>>2]|0;f[d>>2]=0;if(v|0){Ii(v);Oq(v)}}else f[d>>2]=0}else{fh(d,f[a+8>>2]|0);v=a+12|0;t=f[d>>2]|0;f[d>>2]=0;s=f[v>>2]|0;f[v>>2]=t;if(s){Ii(s);Oq(s);s=f[d>>2]|0;f[d>>2]=0;if(s|0){Ii(s);Oq(s)}}else f[d>>2]=0}s=a+12|0;t=f[s>>2]|0;if(!t){w=0;u=c;return w|0}if((((f[t+4>>2]|0)-(f[t>>2]|0)>>2>>>0)/3|0|0)==(f[t+40>>2]|0)){w=0;u=c;return w|0}v=a+200|0;f[a+264>>2]=a;x=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>>5<<2)|0;f[V>>2]=f[V>>2]|1<<(S&31);V=Y+(U>>>5<<2)|0;f[V>>2]=f[V>>2]|1<<(U&31);V=Y+(T>>>5<<2)|0;f[V>>2]=f[V>>2]|1<<(T&31);f[d>>2]=1;V=f[B>>2]|0;if(V>>>0<(f[J>>2]|0)>>>0){f[V>>2]=1;f[B>>2]=V+4}else Ri(A,d);V=(f[t>>2]|0)+(O<<2)|0;f[V>>2]=f[V>>2]|P;V=Q+1|0;if(R)_=-1;else _=((V>>>0)%3|0|0)==0?Q+-2|0:V;f[d>>2]=_;Y=f[H>>2]|0;if(Y>>>0<(f[K>>2]|0)>>>0){f[Y>>2]=_;f[H>>2]=Y+4}else Ri(i,d);if(R)break;Y=((V>>>0)%3|0|0)==0?Q+-2|0:V;if((Y|0)==-1)break;V=f[(f[(f[s>>2]|0)+12>>2]|0)+(Y<<2)>>2]|0;Y=(V|0)==-1;W=Y?-1:(V>>>0)/3|0;if(Y)break;if(f[(f[t>>2]|0)+(W>>>5<<2)>>2]&1<<(W&31)|0)break;f[l>>2]=V;f[d>>2]=f[l>>2];if(!(kc(a,d)|0))break b}else{V=Q+1|0;if(R)$=-1;else $=((V>>>0)%3|0|0)==0?Q+-2|0:V;f[m>>2]=$;f[d>>2]=f[m>>2];Pe(a,d,1)|0;f[n>>2]=f[e>>2];f[d>>2]=f[n>>2];if(!(kc(a,d)|0))break b}while(0)}M=M+1|0;if((M|0)>=(L|0)){aa=62;break a}}ba=0}else aa=62;while(0);if((aa|0)==62){aa=f[F>>2]|0;L=f[E>>2]|0;n=L;if((aa|0)!=(L|0)?(m=L+-4|0,aa>>>0>>0):0){L=aa;aa=m;do{m=f[L>>2]|0;f[L>>2]=f[aa>>2];f[aa>>2]=m;L=L+4|0;aa=aa+-4|0}while(L>>>0>>0)}f[o>>2]=n;f[p>>2]=f[i>>2];f[q>>2]=f[H>>2];f[g>>2]=f[o>>2];f[e>>2]=f[p>>2];f[d>>2]=f[q>>2];Yd(F,g,e,d)|0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0,ra=0,sa=0,ta=0,ua=0,va=0,wa=0,xa=0,ya=0,za=0,Aa=0,Ba=0,Ca=0,Da=0,Ea=0,Fa=0,Ga=0,Ha=0,Ia=0;i=u;u=u+64|0;j=i+16|0;k=i;l=i+24|0;m=i+8|0;n=i+20|0;f[j>>2]=c;c=(a|0)!=0;o=l+40|0;q=o;r=l+39|0;l=m+4|0;s=0;t=0;v=0;a:while(1){do if((t|0)>-1)if((s|0)>(2147483647-t|0)){w=Vq()|0;f[w>>2]=75;x=-1;break}else{x=s+t|0;break}else x=t;while(0);w=f[j>>2]|0;y=b[w>>0]|0;if(!(y<<24>>24)){z=88;break}else{A=y;B=w}b:while(1){switch(A<<24>>24){case 37:{C=B;D=B;z=9;break b;break}case 0:{E=B;break b;break}default:{}}y=B+1|0;f[j>>2]=y;A=b[y>>0]|0;B=y}c:do if((z|0)==9)while(1){z=0;if((b[D+1>>0]|0)!=37){E=C;break c}y=C+1|0;D=D+2|0;f[j>>2]=D;if((b[D>>0]|0)!=37){E=y;break}else{C=y;z=9}}while(0);y=E-w|0;if(c)Xo(a,w,y);if(y|0){s=y;t=x;continue}y=(Aq(b[(f[j>>2]|0)+1>>0]|0)|0)==0;F=f[j>>2]|0;if(!y?(b[F+2>>0]|0)==36:0){G=(b[F+1>>0]|0)+-48|0;H=1;J=3}else{G=-1;H=v;J=1}y=F+J|0;f[j>>2]=y;F=b[y>>0]|0;K=(F<<24>>24)+-32|0;if(K>>>0>31|(1<>24)+-32|K;P=F+1|0;f[j>>2]=P;Q=b[P>>0]|0;R=(Q<<24>>24)+-32|0;if(R>>>0>31|(1<>24==42){if((Aq(b[N+1>>0]|0)|0)!=0?(F=f[j>>2]|0,(b[F+2>>0]|0)==36):0){O=F+1|0;f[h+((b[O>>0]|0)+-48<<2)>>2]=10;S=f[g+((b[O>>0]|0)+-48<<3)>>2]|0;T=1;U=F+3|0}else{if(H|0){V=-1;break}if(c){F=(f[e>>2]|0)+(4-1)&~(4-1);O=f[F>>2]|0;f[e>>2]=F+4;W=O}else W=0;S=W;T=0;U=(f[j>>2]|0)+1|0}f[j>>2]=U;O=(S|0)<0;X=O?0-S|0:S;Y=O?L|8192:L;Z=T;_=U}else{O=Ll(j)|0;if((O|0)<0){V=-1;break}X=O;Y=L;Z=H;_=f[j>>2]|0}do if((b[_>>0]|0)==46){if((b[_+1>>0]|0)!=42){f[j>>2]=_+1;O=Ll(j)|0;$=O;aa=f[j>>2]|0;break}if(Aq(b[_+2>>0]|0)|0?(O=f[j>>2]|0,(b[O+3>>0]|0)==36):0){F=O+2|0;f[h+((b[F>>0]|0)+-48<<2)>>2]=10;K=f[g+((b[F>>0]|0)+-48<<3)>>2]|0;F=O+4|0;f[j>>2]=F;$=K;aa=F;break}if(Z|0){V=-1;break a}if(c){F=(f[e>>2]|0)+(4-1)&~(4-1);K=f[F>>2]|0;f[e>>2]=F+4;ba=K}else ba=0;K=(f[j>>2]|0)+2|0;f[j>>2]=K;$=ba;aa=K}else{$=-1;aa=_}while(0);K=0;F=aa;while(1){if(((b[F>>0]|0)+-65|0)>>>0>57){V=-1;break a}O=F;F=F+1|0;f[j>>2]=F;ca=b[(b[O>>0]|0)+-65+(16124+(K*58|0))>>0]|0;da=ca&255;if((da+-1|0)>>>0>=8)break;else K=da}if(!(ca<<24>>24)){V=-1;break}O=(G|0)>-1;do if(ca<<24>>24==19)if(O){V=-1;break a}else z=50;else{if(O){f[h+(G<<2)>>2]=da;P=g+(G<<3)|0;Q=f[P+4>>2]|0;y=k;f[y>>2]=f[P>>2];f[y+4>>2]=Q;z=50;break}if(!c){V=0;break a}We(k,da,e);ea=f[j>>2]|0}while(0);if((z|0)==50){z=0;if(c)ea=F;else{s=0;t=x;v=Z;continue}}O=b[ea+-1>>0]|0;Q=(K|0)!=0&(O&15|0)==3?O&-33:O;O=Y&-65537;y=(Y&8192|0)==0?Y:O;d:do switch(Q|0){case 110:{switch((K&255)<<24>>24){case 0:{f[f[k>>2]>>2]=x;s=0;t=x;v=Z;continue a;break}case 1:{f[f[k>>2]>>2]=x;s=0;t=x;v=Z;continue a;break}case 2:{P=f[k>>2]|0;f[P>>2]=x;f[P+4>>2]=((x|0)<0)<<31>>31;s=0;t=x;v=Z;continue a;break}case 3:{d[f[k>>2]>>1]=x;s=0;t=x;v=Z;continue a;break}case 4:{b[f[k>>2]>>0]=x;s=0;t=x;v=Z;continue a;break}case 6:{f[f[k>>2]>>2]=x;s=0;t=x;v=Z;continue a;break}case 7:{P=f[k>>2]|0;f[P>>2]=x;f[P+4>>2]=((x|0)<0)<<31>>31;s=0;t=x;v=Z;continue a;break}default:{s=0;t=x;v=Z;continue a}}break}case 112:{fa=120;ga=$>>>0>8?$:8;ha=y|8;z=62;break}case 88:case 120:{fa=Q;ga=$;ha=y;z=62;break}case 111:{P=k;R=f[P>>2]|0;ia=f[P+4>>2]|0;P=Ol(R,ia,o)|0;ja=q-P|0;ka=P;la=0;ma=16588;na=(y&8|0)==0|($|0)>(ja|0)?$:ja+1|0;oa=y;pa=R;qa=ia;z=68;break}case 105:case 100:{ia=k;R=f[ia>>2]|0;ja=f[ia+4>>2]|0;if((ja|0)<0){ia=Xn(0,0,R|0,ja|0)|0;P=I;ra=k;f[ra>>2]=ia;f[ra+4>>2]=P;sa=1;ta=16588;ua=ia;va=P;z=67;break d}else{sa=(y&2049|0)!=0&1;ta=(y&2048|0)==0?((y&1|0)==0?16588:16590):16589;ua=R;va=ja;z=67;break d}break}case 117:{ja=k;sa=0;ta=16588;ua=f[ja>>2]|0;va=f[ja+4>>2]|0;z=67;break}case 99:{b[r>>0]=f[k>>2];wa=r;xa=0;ya=16588;za=o;Aa=1;Ba=O;break}case 109:{ja=Vq()|0;Ca=$o(f[ja>>2]|0)|0;z=72;break}case 115:{ja=f[k>>2]|0;Ca=ja|0?ja:16598;z=72;break}case 67:{f[m>>2]=f[k>>2];f[l>>2]=0;f[k>>2]=m;Da=-1;Ea=m;z=76;break}case 83:{ja=f[k>>2]|0;if(!$){Qk(a,32,X,0,y);Fa=0;z=85}else{Da=$;Ea=ja;z=76}break}case 65:case 71:case 70:case 69:case 97:case 103:case 102:case 101:{s=ob(a,+p[k>>3],X,$,y,Q)|0;t=x;v=Z;continue a;break}default:{wa=w;xa=0;ya=16588;za=o;Aa=$;Ba=y}}while(0);e:do if((z|0)==62){z=0;w=k;Q=f[w>>2]|0;K=f[w+4>>2]|0;w=ul(Q,K,o,fa&32)|0;F=(ha&8|0)==0|(Q|0)==0&(K|0)==0;ka=w;la=F?0:2;ma=F?16588:16588+(fa>>4)|0;na=ga;oa=ha;pa=Q;qa=K;z=68}else if((z|0)==67){z=0;ka=Rj(ua,va,o)|0;la=sa;ma=ta;na=$;oa=y;pa=ua;qa=va;z=68}else if((z|0)==72){z=0;K=tg(Ca,0,$)|0;Q=(K|0)==0;wa=Ca;xa=0;ya=16588;za=Q?Ca+$|0:K;Aa=Q?$:K-Ca|0;Ba=O}else if((z|0)==76){z=0;K=Ea;Q=0;F=0;while(1){w=f[K>>2]|0;if(!w){Ga=Q;Ha=F;break}ja=Po(n,w)|0;if((ja|0)<0|ja>>>0>(Da-Q|0)>>>0){Ga=Q;Ha=ja;break}w=ja+Q|0;if(Da>>>0>w>>>0){K=K+4|0;Q=w;F=ja}else{Ga=w;Ha=ja;break}}if((Ha|0)<0){V=-1;break a}Qk(a,32,X,Ga,y);if(!Ga){Fa=0;z=85}else{F=Ea;Q=0;while(1){K=f[F>>2]|0;if(!K){Fa=Ga;z=85;break e}ja=Po(n,K)|0;Q=ja+Q|0;if((Q|0)>(Ga|0)){Fa=Ga;z=85;break e}Xo(a,n,ja);if(Q>>>0>=Ga>>>0){Fa=Ga;z=85;break}else F=F+4|0}}}while(0);if((z|0)==68){z=0;O=(pa|0)!=0|(qa|0)!=0;F=(na|0)!=0|O;Q=q-ka+((O^1)&1)|0;wa=F?ka:o;xa=la;ya=ma;za=o;Aa=F?((na|0)>(Q|0)?na:Q):na;Ba=(na|0)>-1?oa&-65537:oa}else if((z|0)==85){z=0;Qk(a,32,X,Fa,y^8192);s=(X|0)>(Fa|0)?X:Fa;t=x;v=Z;continue}Q=za-wa|0;F=(Aa|0)<(Q|0)?Q:Aa;O=F+xa|0;ja=(X|0)<(O|0)?O:X;Qk(a,32,ja,O,Ba);Xo(a,ya,xa);Qk(a,48,ja,O,Ba^65536);Qk(a,48,F,Q,0);Xo(a,wa,Q);Qk(a,32,ja,O,Ba^8192);s=ja;t=x;v=Z}f:do if((z|0)==88)if(!a)if(v){Z=1;while(1){t=f[h+(Z<<2)>>2]|0;if(!t){Ia=Z;break}We(g+(Z<<3)|0,t,e);t=Z+1|0;if((Z|0)<9)Z=t;else{Ia=t;break}}if((Ia|0)<10){Z=Ia;while(1){if(f[h+(Z<<2)>>2]|0){V=-1;break f}if((Z|0)<9)Z=Z+1|0;else{V=1;break}}}else V=1}else V=0;else V=x;while(0);u=i;return V|0}function rb(a){a=a|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,$=0,aa=0;c=u;u=u+64|0;d=c+56|0;e=c+52|0;g=c+48|0;h=c+60|0;i=c;j=c+44|0;k=c+40|0;l=c+36|0;m=c+32|0;n=c+28|0;o=c+24|0;p=c+20|0;q=c+16|0;r=c+12|0;if(!(b[a+352>>0]|0)){_e(d,f[a+8>>2]|0);s=a+12|0;t=f[d>>2]|0;f[d>>2]=0;v=f[s>>2]|0;f[s>>2]=t;if(v){Ii(v);Oq(v);v=f[d>>2]|0;f[d>>2]=0;if(v|0){Ii(v);Oq(v)}}else f[d>>2]=0}else{fh(d,f[a+8>>2]|0);v=a+12|0;t=f[d>>2]|0;f[d>>2]=0;s=f[v>>2]|0;f[v>>2]=t;if(s){Ii(s);Oq(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0;X=((W>>>0)%3|0|0)==0?P+-2|0:W;if((X|0)==-1)Y=-1;else Y=f[U+(X<<2)>>2]|0;X=(((P>>>0)%3|0|0)==0?2:-1)+P|0;if((X|0)==-1){R=-1;S=Y;T=V;break}R=f[U+(X<<2)>>2]|0;S=Y;T=V}while(0);V=f[C>>2]|0;X=V+(T>>>5<<2)|0;f[X>>2]=f[X>>2]|1<<(T&31);X=V+(S>>>5<<2)|0;f[X>>2]=f[X>>2]|1<<(S&31);X=V+(R>>>5<<2)|0;f[X>>2]=f[X>>2]|1<<(R&31);f[d>>2]=1;X=f[B>>2]|0;if(X>>>0<(f[H>>2]|0)>>>0){f[X>>2]=1;f[B>>2]=X+4}else Ri(A,d);X=(f[v>>2]|0)+(N<<2)|0;f[X>>2]=f[X>>2]|O;X=P+1|0;if(Q)Z=-1;else Z=((X>>>0)%3|0|0)==0?P+-2|0:X;f[d>>2]=Z;V=f[I>>2]|0;if(V>>>0<(f[J>>2]|0)>>>0){f[V>>2]=Z;f[I>>2]=V+4}else Ri(i,d);if(Q)break;V=((X>>>0)%3|0|0)==0?P+-2|0:X;if((V|0)==-1)break;X=f[(f[(f[s>>2]|0)+12>>2]|0)+(V<<2)>>2]|0;V=(X|0)==-1;U=V?-1:(X>>>0)/3|0;if(V)break;if(f[(f[v>>2]|0)+(U>>>5<<2)>>2]&1<<(U&31)|0)break;f[l>>2]=X;f[d>>2]=f[l>>2];if(!(Yb(a,d)|0))break b}else{X=P+1|0;if(Q)_=-1;else _=((X>>>0)%3|0|0)==0?P+-2|0:X;f[m>>2]=_;f[d>>2]=f[m>>2];Pe(a,d,1)|0;f[n>>2]=f[e>>2];f[d>>2]=f[n>>2];if(!(Yb(a,d)|0))break b}while(0)}K=K+1|0;if((K|0)>=(L|0)){$=62;break a}}aa=0}else $=62;while(0);if(($|0)==62){$=f[F>>2]|0;L=f[E>>2]|0;n=L;if(($|0)!=(L|0)?(m=L+-4|0,$>>>0>>0):0){L=$;$=m;do{m=f[L>>2]|0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a=0;c=u;u=u+64|0;d=c+28|0;e=c+16|0;g=c+4|0;h=c;i=a;j=a+80|0;k=f[j>>2]|0;f[d>>2]=0;f[d+4>>2]=0;f[d+8>>2]=0;f[d+12>>2]=0;f[d+16>>2]=i;l=d+20|0;n[l>>2]=$(1.0);f[d+24>>2]=i;Ih(d,k);k=f[j>>2]|0;f[e>>2]=0;i=e+4|0;f[i>>2]=0;f[e+8>>2]=0;m=(k|0)==0;do if(!m)if(k>>>0>1073741823)aq(e);else{o=k<<2;p=ln(o)|0;f[e>>2]=p;q=p+(k<<2)|0;f[e+8>>2]=q;sj(p|0,0,o|0)|0;f[i>>2]=q;break}while(0);f[g>>2]=0;k=g+4|0;f[k>>2]=0;f[g+8>>2]=0;f[h>>2]=0;if(!m){m=d+16|0;q=d+4|0;o=d+12|0;p=d+8|0;r=g+8|0;s=d+24|0;t=0;v=0;while(1){w=f[m>>2]|0;x=f[w+8>>2]|0;y=(f[w+12>>2]|0)-x|0;w=(y|0)>0;z=x;if(w){x=y>>>2;A=0;B=0;while(1){C=f[z+(A<<2)>>2]|0;if(!(b[C+84>>0]|0))D=f[(f[C+68>>2]|0)+(v<<2)>>2]|0;else D=v;C=D+239^B;A=A+1|0;if((A|0)>=(x|0)){E=C;break}else B=C}}else E=0;B=f[q>>2]|0;x=(B|0)==0;a:do if(!x){A=B+-1|0;C=(A&B|0)==0;if(!C)if(E>>>0>>0)F=E;else F=(E>>>0)%(B>>>0)|0;else F=A&E;G=f[(f[d>>2]|0)+(F<<2)>>2]|0;if((G|0)!=0?(H=f[G>>2]|0,(H|0)!=0):0){G=f[s>>2]|0;I=G+8|0;J=G+12|0;b:do if(C){G=H;while(1){K=f[G+4>>2]|0;L=(K|0)==(E|0);if(!(L|(K&A|0)==(F|0))){M=44;break a}c:do if(L){K=f[G+8>>2]|0;N=f[I>>2]|0;O=(f[J>>2]|0)-N|0;P=N;if((O|0)<=0){Q=G;break b}N=O>>>2;O=0;while(1){R=f[P+(O<<2)>>2]|0;if(!(b[R+84>>0]|0)){S=f[R+68>>2]|0;T=f[S+(v<<2)>>2]|0;U=f[S+(K<<2)>>2]|0}else{T=v;U=K}O=O+1|0;if((U|0)!=(T|0))break c;if((O|0)>=(N|0)){V=G;M=42;break b}}}while(0);G=f[G>>2]|0;if(!G){M=44;break a}}}else{G=H;while(1){L=f[G+4>>2]|0;d:do if((L|0)!=(E|0)){if(L>>>0>>0)X=L;else X=(L>>>0)%(B>>>0)|0;if((X|0)!=(F|0)){M=44;break a}}else{N=f[G+8>>2]|0;O=f[I>>2]|0;K=(f[J>>2]|0)-O|0;P=O;if((K|0)<=0){Q=G;break b}O=K>>>2;K=0;while(1){S=f[P+(K<<2)>>2]|0;if(!(b[S+84>>0]|0)){R=f[S+68>>2]|0;Y=f[R+(v<<2)>>2]|0;Z=f[R+(N<<2)>>2]|0}else{Y=v;Z=N}K=K+1|0;if((Z|0)!=(Y|0))break d;if((K|0)>=(O|0)){V=G;M=42;break b}}}while(0);G=f[G>>2]|0;if(!G){M=44;break a}}}while(0);if((M|0)==42){M=0;if(!V){M=44;break}else Q=V}f[(f[e>>2]|0)+(v<<2)>>2]=f[Q+12>>2];_=t}else M=44}else M=44;while(0);do if((M|0)==44){M=0;if(w){J=y>>>2;I=0;H=0;while(1){A=f[z+(I<<2)>>2]|0;if(!(b[A+84>>0]|0))aa=f[(f[A+68>>2]|0)+(v<<2)>>2]|0;else aa=v;A=aa+239^H;I=I+1|0;if((I|0)>=(J|0)){ba=A;break}else H=A}}else ba=0;e:do if(!x){H=B+-1|0;J=(H&B|0)==0;if(!J)if(ba>>>0>>0)ca=ba;else ca=(ba>>>0)%(B>>>0)|0;else ca=H&ba;I=f[(f[d>>2]|0)+(ca<<2)>>2]|0;if((I|0)!=0?(A=f[I>>2]|0,(A|0)!=0):0){I=f[s>>2]|0;C=I+8|0;G=I+12|0;if(J){J=A;while(1){I=f[J+4>>2]|0;if(!((I|0)==(ba|0)|(I&H|0)==(ca|0))){da=ca;M=76;break e}I=f[J+8>>2]|0;L=f[C>>2]|0;O=(f[G>>2]|0)-L|0;K=L;if((O|0)<=0){ea=v;break e}L=O>>>2;O=0;while(1){N=f[K+(O<<2)>>2]|0;if(!(b[N+84>>0]|0)){P=f[N+68>>2]|0;fa=f[P+(v<<2)>>2]|0;ga=f[P+(I<<2)>>2]|0}else{fa=v;ga=I}O=O+1|0;if((ga|0)!=(fa|0))break;if((O|0)>=(L|0)){ea=v;break e}}J=f[J>>2]|0;if(!J){da=ca;M=76;break e}}}else ha=A;while(1){J=f[ha+4>>2]|0;if((J|0)!=(ba|0)){if(J>>>0>>0)ia=J;else ia=(J>>>0)%(B>>>0)|0;if((ia|0)!=(ca|0)){da=ca;M=76;break e}}J=f[ha+8>>2]|0;H=f[C>>2]|0;L=(f[G>>2]|0)-H|0;O=H;if((L|0)<=0){ea=v;break e}H=L>>>2;L=0;while(1){I=f[O+(L<<2)>>2]|0;if(!(b[I+84>>0]|0)){K=f[I+68>>2]|0;ja=f[K+(v<<2)>>2]|0;ka=f[K+(J<<2)>>2]|0}else{ja=v;ka=J}L=L+1|0;if((ka|0)!=(ja|0))break;if((L|0)>=(H|0)){ea=v;break e}}ha=f[ha>>2]|0;if(!ha){da=ca;M=76;break}}}else{da=ca;M=76}}else{da=0;M=76}while(0);if((M|0)==76){M=0;G=ln(16)|0;f[G+8>>2]=v;f[G+12>>2]=t;f[G+4>>2]=ba;f[G>>2]=0;la=$(((f[o>>2]|0)+1|0)>>>0);ma=$(B>>>0);na=$(n[l>>2]);do if(x|$(na*ma)>>0<3|(B+-1&B|0)!=0)&1;A=~~$(W($(la/na)))>>>0;Ih(d,C>>>0>>0?A:C);C=f[q>>2]|0;A=C+-1|0;if(!(A&C)){oa=C;pa=A&ba;break}if(ba>>>0>>0){oa=C;pa=ba}else{oa=C;pa=(ba>>>0)%(C>>>0)|0}}else{oa=B;pa=da}while(0);C=(f[d>>2]|0)+(pa<<2)|0;A=f[C>>2]|0;if(!A){f[G>>2]=f[p>>2];f[p>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T>>2]=ia+1;F=(f[B>>2]|0)+(ia>>>5<<2)|0;f[F>>2]=f[F>>2]&~(1<<(ia&31));ea=G;fa=H;ga=C;ha=s}f[a+8>>2]=ea;f[a+12>>2]=fa;u=g;return}while(0);do if(r)ja=m<<1;else{if((e|0)>0){ja=(e<<1)+-2|0;break}fa=a+8|0;f[fa>>2]=0;f[fa+4>>2]=0;u=g;return}while(0);f[a+8>>2]=f[d+(ja<<2)>>2];f[a+12>>2]=f[d+(ja+1<<2)>>2];u=g;return}function ub(a,c,d,e){a=a|0;c=c|0;d=d|0;e=e|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,$=0,aa=0,ba=0,ca=0,da=0,ea=0,fa=0,ga=0,ha=0,ia=0,ja=0;g=u;u=u+80|0;h=g+76|0;i=g+72|0;j=g+48|0;k=g+24|0;l=g;m=a+32|0;n=f[c>>2]|0;c=n+1|0;do if((n|0)!=-1){o=((c>>>0)%3|0|0)==0?n+-2|0:c;if(!((n>>>0)%3|0)){p=n+2|0;q=o;break}else{p=n+-1|0;q=o;break}}else{p=-1;q=-1}while(0);n=f[(f[m>>2]|0)+28>>2]|0;m=f[n+(q<<2)>>2]|0;q=f[n+(p<<2)>>2]|0;p=f[a+36>>2]|0;n=f[p>>2]|0;c=(f[p+4>>2]|0)-n>>2;if(c>>>0<=m>>>0)aq(p);o=n;n=f[o+(m<<2)>>2]|0;if(c>>>0<=q>>>0)aq(p);p=f[o+(q<<2)>>2]|0;q=(n|0)<(e|0);do if(q&(p|0)<(e|0)){o=n<<1;c=f[d+(o<<2)>>2]|0;m=((c|0)<0)<<31>>31;r=f[d+((o|1)<<2)>>2]|0;o=((r|0)<0)<<31>>31;s=p<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|0,J|0)|0;J=I;T=Xn(F|0,M|0,G|0,s|0)|0;M=I;F=Xn(B|0,E|0,H|0,C|0)|0;E=I;B=un(T|0,M|0,T|0,M|0)|0;M=I;T=un(F|0,E|0,F|0,E|0)|0;E=Vn(T|0,I|0,B|0,M|0)|0;M=I;B=a+16|0;T=a+20|0;F=f[T>>2]|0;O=f[a+24>>2]|0;P=(F|0)==(O<<5|0);if(J>>>0>>0|(J|0)==(M|0)&U>>>0>>0){do if(P)if((F+1|0)<0)aq(B);else{E=O<<6;U=F+32&-32;vi(B,F>>>0<1073741823?(E>>>0>>0?U:E):2147483647);da=f[T>>2]|0;break}else da=F;while(0);f[T>>2]=da+1;L=(f[B>>2]|0)+(da>>>5<<2)|0;f[L>>2]=f[L>>2]|1<<(da&31);ea=x;fa=c;ga=K;ha=D}else{do if(P)if((F+1|0)<0)aq(B);else{L=O<<6;N=F+32&-32;vi(B,F>>>0<1073741823?(L>>>0>>0?N:L):2147483647);ia=f[T>>2]|0;break}else ia=F;while(0);f[T>>2]=ia+1;F=(f[B>>2]|0)+(ia>>>5<<2)|0;f[F>>2]=f[F>>2]&~(1<<(ia&31));ea=G;fa=H;ga=C;ha=s}f[a+8>>2]=ea;f[a+12>>2]=fa;u=g;return}while(0);do if(q)ja=n<<1;else{if((e|0)>0){ja=(e<<1)+-2|0;break}fa=a+8|0;f[fa>>2]=0;f[fa+4>>2]=0;u=g;return}while(0);f[a+8>>2]=f[d+(ja<<2)>>2];f[a+12>>2]=f[d+(ja+1<<2)>>2];u=g;return}function vb(a,c,e,g){a=a|0;c=c|0;e=e|0;g=g|0;var i=0,k=0,l=0,m=0,o=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=Oa,D=0,E=0.0,F=0,G=0;if(!g){i=0;return i|0}do switch(f[a+28>>2]|0){case 1:{k=a+24|0;l=b[k>>0]|0;if((l<<24>>24>e<<24>>24?e:l)<<24>>24>0){m=f[f[a>>2]>>2]|0;o=a+40|0;q=un(f[o>>2]|0,f[o+4>>2]|0,f[c>>2]|0,0)|0;o=a+48|0;r=Vn(q|0,I|0,f[o>>2]|0,f[o+4>>2]|0)|0;o=m+r|0;r=0;while(1){m=b[o>>0]|0;q=g+(r<<3)|0;f[q>>2]=m;f[q+4>>2]=((m|0)<0)<<31>>31;r=r+1|0;m=b[k>>0]|0;if((r|0)>=((m<<24>>24>e<<24>>24?e:m)<<24>>24|0)){s=m;break}else o=o+1|0}}else s=l;o=s<<24>>24;if(s<<24>>24>=e<<24>>24){i=1;return i|0}sj(g+(o<<3)|0,0,(e<<24>>24)-o<<3|0)|0;i=1;return i|0}case 2:{o=a+24|0;r=b[o>>0]|0;if((r<<24>>24>e<<24>>24?e:r)<<24>>24>0){k=f[f[a>>2]>>2]|0;m=a+40|0;q=un(f[m>>2]|0,f[m+4>>2]|0,f[c>>2]|0,0)|0;m=a+48|0;t=Vn(q|0,I|0,f[m>>2]|0,f[m+4>>2]|0)|0;m=k+t|0;t=0;while(1){k=g+(t<<3)|0;f[k>>2]=h[m>>0];f[k+4>>2]=0;t=t+1|0;k=b[o>>0]|0;if((t|0)>=((k<<24>>24>e<<24>>24?e:k)<<24>>24|0)){u=k;break}else m=m+1|0}}else u=r;m=u<<24>>24;if(u<<24>>24>=e<<24>>24){i=1;return i|0}sj(g+(m<<3)|0,0,(e<<24>>24)-m<<3|0)|0;i=1;return i|0}case 3:{m=a+24|0;t=b[m>>0]|0;if((t<<24>>24>e<<24>>24?e:t)<<24>>24>0){o=f[f[a>>2]>>2]|0;l=a+40|0;k=un(f[l>>2]|0,f[l+4>>2]|0,f[c>>2]|0,0)|0;l=a+48|0;q=Vn(k|0,I|0,f[l>>2]|0,f[l+4>>2]|0)|0;l=o+q|0;q=0;while(1){o=d[l>>1]|0;k=g+(q<<3)|0;f[k>>2]=o;f[k+4>>2]=((o|0)<0)<<31>>31;q=q+1|0;o=b[m>>0]|0;if((q|0)>=((o<<24>>24>e<<24>>24?e:o)<<24>>24|0)){v=o;break}else l=l+2|0}}else v=t;l=v<<24>>24;if(v<<24>>24>=e<<24>>24){i=1;return i|0}sj(g+(l<<3)|0,0,(e<<24>>24)-l<<3|0)|0;i=1;return i|0}case 4:{l=a+24|0;q=b[l>>0]|0;if((q<<24>>24>e<<24>>24?e:q)<<24>>24>0){m=f[f[a>>2]>>2]|0;r=a+40|0;o=un(f[r>>2]|0,f[r+4>>2]|0,f[c>>2]|0,0)|0;r=a+48|0;k=Vn(o|0,I|0,f[r>>2]|0,f[r+4>>2]|0)|0;r=m+k|0;k=0;while(1){m=g+(k<<3)|0;f[m>>2]=j[r>>1];f[m+4>>2]=0;k=k+1|0;m=b[l>>0]|0;if((k|0)>=((m<<24>>24>e<<24>>24?e:m)<<24>>24|0)){w=m;break}else r=r+2|0}}else w=q;r=w<<24>>24;if(w<<24>>24>=e<<24>>24){i=1;return i|0}sj(g+(r<<3)|0,0,(e<<24>>24)-r<<3|0)|0;i=1;return i|0}case 5:{r=a+24|0;k=b[r>>0]|0;if((k<<24>>24>e<<24>>24?e:k)<<24>>24>0){l=f[f[a>>2]>>2]|0;t=a+40|0;m=un(f[t>>2]|0,f[t+4>>2]|0,f[c>>2]|0,0)|0;t=a+48|0;o=Vn(m|0,I|0,f[t>>2]|0,f[t+4>>2]|0)|0;t=l+o|0;o=0;while(1){l=f[t>>2]|0;m=g+(o<<3)|0;f[m>>2]=l;f[m+4>>2]=((l|0)<0)<<31>>31;o=o+1|0;l=b[r>>0]|0;if((o|0)>=((l<<24>>24>e<<24>>24?e:l)<<24>>24|0)){x=l;break}else t=t+4|0}}else x=k;t=x<<24>>24;if(x<<24>>24>=e<<24>>24){i=1;return i|0}sj(g+(t<<3)|0,0,(e<<24>>24)-t<<3|0)|0;i=1;return i|0}case 6:{t=a+24|0;o=b[t>>0]|0;if((o<<24>>24>e<<24>>24?e:o)<<24>>24>0){r=f[f[a>>2]>>2]|0;q=a+40|0;l=un(f[q>>2]|0,f[q+4>>2]|0,f[c>>2]|0,0)|0;q=a+48|0;m=Vn(l|0,I|0,f[q>>2]|0,f[q+4>>2]|0)|0;q=r+m|0;m=0;while(1){r=g+(m<<3)|0;f[r>>2]=f[q>>2];f[r+4>>2]=0;m=m+1|0;r=b[t>>0]|0;if((m|0)>=((r<<24>>24>e<<24>>24?e:r)<<24>>24|0)){y=r;break}else q=q+4|0}}else y=o;q=y<<24>>24;if(y<<24>>24>=e<<24>>24){i=1;return i|0}sj(g+(q<<3)|0,0,(e<<24>>24)-q<<3|0)|0;i=1;return i|0}case 7:{q=a+24|0;m=b[q>>0]|0;if((m<<24>>24>e<<24>>24?e:m)<<24>>24>0){t=f[f[a>>2]>>2]|0;k=a+40|0;r=un(f[k>>2]|0,f[k+4>>2]|0,f[c>>2]|0,0)|0;k=a+48|0;l=Vn(r|0,I|0,f[k>>2]|0,f[k+4>>2]|0)|0;k=t+l|0;l=0;while(1){t=k;r=f[t+4>>2]|0;z=g+(l<<3)|0;f[z>>2]=f[t>>2];f[z+4>>2]=r;l=l+1|0;r=b[q>>0]|0;if((l|0)>=((r<<24>>24>e<<24>>24?e:r)<<24>>24|0)){A=r;break}else k=k+8|0}}else A=m;k=A<<24>>24;if(A<<24>>24>=e<<24>>24){i=1;return i|0}sj(g+(k<<3)|0,0,(e<<24>>24)-k<<3|0)|0;i=1;return i|0}case 8:{k=a+24|0;l=b[k>>0]|0;if((l<<24>>24>e<<24>>24?e:l)<<24>>24>0){q=f[f[a>>2]>>2]|0;o=a+40|0;r=un(f[o>>2]|0,f[o+4>>2]|0,f[c>>2]|0,0)|0;o=a+48|0;z=Vn(r|0,I|0,f[o>>2]|0,f[o+4>>2]|0)|0;o=q+z|0;z=0;while(1){q=o;r=f[q+4>>2]|0;t=g+(z<<3)|0;f[t>>2]=f[q>>2];f[t+4>>2]=r;z=z+1|0;r=b[k>>0]|0;if((z|0)>=((r<<24>>24>e<<24>>24?e:r)<<24>>24|0)){B=r;break}else o=o+8|0}}else B=l;o=B<<24>>24;if(B<<24>>24>=e<<24>>24){i=1;return i|0}sj(g+(o<<3)|0,0,(e<<24>>24)-o<<3|0)|0;i=1;return i|0}case 9:{o=a+24|0;z=b[o>>0]|0;if((z<<24>>24>e<<24>>24?e:z)<<24>>24>0){k=f[f[a>>2]>>2]|0;m=a+40|0;r=un(f[m>>2]|0,f[m+4>>2]|0,f[c>>2]|0,0)|0;m=a+48|0;t=Vn(r|0,I|0,f[m>>2]|0,f[m+4>>2]|0)|0;m=k+t|0;t=0;while(1){C=$(n[m>>2]);k=+K(+C)>=1.0?(+C>0.0?~~+Y(+J(+C/4294967296.0),4294967295.0)>>>0:~~+W((+C-+(~~+C>>>0))/4294967296.0)>>>0):0;r=g+(t<<3)|0;f[r>>2]=~~+C>>>0;f[r+4>>2]=k;t=t+1|0;k=b[o>>0]|0;if((t|0)>=((k<<24>>24>e<<24>>24?e:k)<<24>>24|0)){D=k;break}else m=m+4|0}}else D=z;m=D<<24>>24;if(D<<24>>24>=e<<24>>24){i=1;return i|0}sj(g+(m<<3)|0,0,(e<<24>>24)-m<<3|0)|0;i=1;return i|0}case 10:{m=a+24|0;t=b[m>>0]|0;if((t<<24>>24>e<<24>>24?e:t)<<24>>24>0){o=f[f[a>>2]>>2]|0;l=a+40|0;k=un(f[l>>2]|0,f[l+4>>2]|0,f[c>>2]|0,0)|0;l=a+48|0;r=Vn(k|0,I|0,f[l>>2]|0,f[l+4>>2]|0)|0;l=o+r|0;r=0;while(1){E=+p[l>>3];o=+K(E)>=1.0?(E>0.0?~~+Y(+J(E/4294967296.0),4294967295.0)>>>0:~~+W((E-+(~~E>>>0))/4294967296.0)>>>0):0;k=g+(r<<3)|0;f[k>>2]=~~E>>>0;f[k+4>>2]=o;r=r+1|0;o=b[m>>0]|0;if((r|0)>=((o<<24>>24>e<<24>>24?e:o)<<24>>24|0)){F=o;break}else l=l+8|0}}else F=t;l=F<<24>>24;if(F<<24>>24>=e<<24>>24){i=1;return i|0}sj(g+(l<<3)|0,0,(e<<24>>24)-l<<3|0)|0;i=1;return i|0}case 11:{l=a+24|0;r=b[l>>0]|0;if((r<<24>>24>e<<24>>24?e:r)<<24>>24>0){m=f[f[a>>2]>>2]|0;z=a+40|0;o=un(f[z>>2]|0,f[z+4>>2]|0,f[c>>2]|0,0)|0;z=a+48|0;k=Vn(o|0,I|0,f[z>>2]|0,f[z+4>>2]|0)|0;z=m+k|0;k=0;while(1){m=g+(k<<3)|0;f[m>>2]=h[z>>0];f[m+4>>2]=0;k=k+1|0;m=b[l>>0]|0;if((k|0)>=((m<<24>>24>e<<24>>24?e:m)<<24>>24|0)){G=m;break}else z=z+1|0}}else G=r;z=G<<24>>24;if(G<<24>>24>=e<<24>>24){i=1;return i|0}sj(g+(z<<3)|0,0,(e<<24>>24)-z<<3|0)|0;i=1;return i|0}default:{i=0;return i|0}}while(0);return 0}function wb(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0;c=u;u=u+16|0;d=c+8|0;e=c;if((f[a+96>>2]|0)==(f[a+92>>2]|0)){u=c;return}g=a+56|0;h=f[g>>2]|0;if((h|0)==(f[a+60>>2]|0)){Ri(a+52|0,b);i=b}else{f[h>>2]=f[b>>2];f[g>>2]=h+4;i=b}b=a+88|0;f[b>>2]=0;h=f[a>>2]|0;g=f[i>>2]|0;j=g+1|0;if((g|0)!=-1){k=((j>>>0)%3|0|0)==0?g+-2|0:j;if((k|0)==-1)l=-1;else l=f[(f[h>>2]|0)+(k<<2)>>2]|0;k=(((g>>>0)%3|0|0)==0?2:-1)+g|0;if((k|0)==-1){m=l;n=-1}else{m=l;n=f[(f[h>>2]|0)+(k<<2)>>2]|0}}else{m=-1;n=-1}k=a+24|0;h=f[k>>2]|0;l=h+(m>>>5<<2)|0;g=1<<(m&31);j=f[l>>2]|0;if(!(j&g)){f[l>>2]=j|g;g=f[i>>2]|0;j=g+1|0;if((g|0)==-1)o=-1;else o=((j>>>0)%3|0|0)==0?g+-2|0:j;f[e>>2]=o;j=f[(f[(f[a+44>>2]|0)+96>>2]|0)+(((o>>>0)/3|0)*12|0)+(((o>>>0)%3|0)<<2)>>2]|0;o=f[a+48>>2]|0;f[d>>2]=j;g=f[o+4>>2]|0;o=g+4|0;l=f[o>>2]|0;if((l|0)==(f[g+8>>2]|0))Ri(g,d);else{f[l>>2]=j;f[o>>2]=l+4}l=a+40|0;o=f[l>>2]|0;j=o+4|0;g=f[j>>2]|0;if((g|0)==(f[o+8>>2]|0)){Ri(o,e);p=f[l>>2]|0}else{f[g>>2]=f[e>>2];f[j>>2]=g+4;p=o}o=p+24|0;f[(f[p+12>>2]|0)+(m<<2)>>2]=f[o>>2];f[o>>2]=(f[o>>2]|0)+1;q=f[k>>2]|0}else q=h;h=q+(n>>>5<<2)|0;q=1<<(n&31);o=f[h>>2]|0;if(!(o&q)){f[h>>2]=o|q;q=f[i>>2]|0;do if((q|0)!=-1)if(!((q>>>0)%3|0)){r=q+2|0;break}else{r=q+-1|0;break}else r=-1;while(0);f[e>>2]=r;q=f[(f[(f[a+44>>2]|0)+96>>2]|0)+(((r>>>0)/3|0)*12|0)+(((r>>>0)%3|0)<<2)>>2]|0;r=f[a+48>>2]|0;f[d>>2]=q;o=f[r+4>>2]|0;r=o+4|0;h=f[r>>2]|0;if((h|0)==(f[o+8>>2]|0))Ri(o,d);else{f[h>>2]=q;f[r>>2]=h+4}h=a+40|0;r=f[h>>2]|0;q=r+4|0;o=f[q>>2]|0;if((o|0)==(f[r+8>>2]|0)){Ri(r,e);s=f[h>>2]|0}else{f[o>>2]=f[e>>2];f[q>>2]=o+4;s=r}r=s+24|0;f[(f[s+12>>2]|0)+(n<<2)>>2]=f[r>>2];f[r>>2]=(f[r>>2]|0)+1}r=f[i>>2]|0;if((r|0)==-1)t=-1;else t=f[(f[f[a>>2]>>2]|0)+(r<<2)>>2]|0;r=(f[k>>2]|0)+(t>>>5<<2)|0;n=1<<(t&31);s=f[r>>2]|0;if(!(n&s)){f[r>>2]=s|n;n=f[i>>2]|0;f[e>>2]=n;s=f[(f[(f[a+44>>2]|0)+96>>2]|0)+(((n>>>0)/3|0)*12|0)+(((n>>>0)%3|0)<<2)>>2]|0;n=f[a+48>>2]|0;f[d>>2]=s;r=f[n+4>>2]|0;n=r+4|0;o=f[n>>2]|0;if((o|0)==(f[r+8>>2]|0))Ri(r,d);else{f[o>>2]=s;f[n>>2]=o+4}o=a+40|0;n=f[o>>2]|0;s=n+4|0;r=f[s>>2]|0;if((r|0)==(f[n+8>>2]|0)){Ri(n,e);v=f[o>>2]|0}else{f[r>>2]=f[e>>2];f[s>>2]=r+4;v=n}n=v+24|0;f[(f[v+12>>2]|0)+(t<<2)>>2]=f[n>>2];f[n>>2]=(f[n>>2]|0)+1}n=f[b>>2]|0;a:do if((n|0)<3){t=a+12|0;v=a+44|0;r=a+48|0;s=a+40|0;o=a+92|0;q=n;while(1){h=q;while(1){w=a+52+(h*12|0)+4|0;x=f[w>>2]|0;if((f[a+52+(h*12|0)>>2]|0)!=(x|0))break;if((h|0)<2)h=h+1|0;else break a}m=x+-4|0;p=f[m>>2]|0;f[w>>2]=m;f[b>>2]=h;f[i>>2]=p;if((p|0)==-1)break;m=(p>>>0)/3|0;g=f[t>>2]|0;do if(!(f[g+(m>>>5<<2)>>2]&1<<(m&31))){j=p;l=g;b:while(1){y=(j>>>0)/3|0;z=l+(y>>>5<<2)|0;f[z>>2]=1<<(y&31)|f[z>>2];z=f[i>>2]|0;if((z|0)==-1)A=-1;else A=f[(f[f[a>>2]>>2]|0)+(z<<2)>>2]|0;y=(f[k>>2]|0)+(A>>>5<<2)|0;B=1<<(A&31);C=f[y>>2]|0;if(!(B&C)){f[y>>2]=C|B;B=f[i>>2]|0;f[e>>2]=B;C=f[(f[(f[v>>2]|0)+96>>2]|0)+(((B>>>0)/3|0)*12|0)+(((B>>>0)%3|0)<<2)>>2]|0;B=f[r>>2]|0;f[d>>2]=C;y=f[B+4>>2]|0;B=y+4|0;D=f[B>>2]|0;if((D|0)==(f[y+8>>2]|0))Ri(y,d);else{f[D>>2]=C;f[B>>2]=D+4}D=f[s>>2]|0;B=D+4|0;C=f[B>>2]|0;if((C|0)==(f[D+8>>2]|0)){Ri(D,e);E=f[s>>2]|0}else{f[C>>2]=f[e>>2];f[B>>2]=C+4;E=D}D=E+24|0;f[(f[E+12>>2]|0)+(A<<2)>>2]=f[D>>2];f[D>>2]=(f[D>>2]|0)+1;F=f[i>>2]|0}else F=z;z=f[a>>2]|0;if((F|0)==-1){G=93;break}D=F+1|0;C=((D>>>0)%3|0|0)==0?F+-2|0:D;if((C|0)==-1)H=-1;else H=f[(f[z+12>>2]|0)+(C<<2)>>2]|0;C=(((F>>>0)%3|0|0)==0?2:-1)+F|0;if((C|0)==-1)I=-1;else I=f[(f[z+12>>2]|0)+(C<<2)>>2]|0;C=(H|0)==-1;D=C?-1:(H>>>0)/3|0;B=(I|0)==-1;y=B?-1:(I>>>0)/3|0;if(C)J=1;else J=(f[(f[t>>2]|0)+(D>>>5<<2)>>2]&1<<(D&31)|0)!=0;do if(B)if(J){G=93;break b}else G=82;else{if(f[(f[t>>2]|0)+(y>>>5<<2)>>2]&1<<(y&31)|0)if(J){G=93;break b}else{G=82;break}D=f[(f[z>>2]|0)+(I<<2)>>2]|0;if(!(1<<(D&31)&f[(f[k>>2]|0)+(D>>>5<<2)>>2])){K=(f[o>>2]|0)+(D<<2)|0;D=f[K>>2]|0;f[K>>2]=D+1;L=(D|0)>0?1:2}else L=0;if(J?(L|0)<=(f[b>>2]|0):0){M=I;break}f[d>>2]=I;D=a+52+(L*12|0)+4|0;K=f[D>>2]|0;if((K|0)==(f[a+52+(L*12|0)+8>>2]|0))Ri(a+52+(L*12|0)|0,d);else{f[K>>2]=I;f[D>>2]=K+4}if((f[b>>2]|0)>(L|0))f[b>>2]=L;if(J){G=93;break b}else G=82}while(0);if((G|0)==82){G=0;if(C)N=-1;else N=f[(f[f[a>>2]>>2]|0)+(H<<2)>>2]|0;if(!(1<<(N&31)&f[(f[k>>2]|0)+(N>>>5<<2)>>2])){z=(f[o>>2]|0)+(N<<2)|0;y=f[z>>2]|0;f[z>>2]=y+1;O=(y|0)>0?1:2}else O=0;if((O|0)>(f[b>>2]|0))break;else M=H}f[i>>2]=M;j=M;l=f[t>>2]|0}if((G|0)==93){G=0;P=f[b>>2]|0;break}f[d>>2]=H;l=a+52+(O*12|0)+4|0;j=f[l>>2]|0;if((j|0)==(f[a+52+(O*12|0)+8>>2]|0))Ri(a+52+(O*12|0)|0,d);else{f[j>>2]=H;f[l>>2]=j+4}j=f[b>>2]|0;if((j|0)>(O|0)){f[b>>2]=O;Q=O}else Q=j;P=Q}else P=h;while(0);if((P|0)<3)q=P;else break a}u=c;return}while(0);f[i>>2]=-1;u=c;return}function xb(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,$=0;d=a;a=b;a:while(1){b=a;e=a+-4|0;g=d;while(1){h=g;b:while(1){i=h;j=b-i|0;k=j>>2;switch(k|0){case 2:{l=5;break a;break}case 3:{l=11;break a;break}case 4:{l=12;break a;break}case 5:{l=13;break a;break}case 1:case 0:{l=84;break a;break}default:{}}if((j|0)<124){l=15;break a}m=h+(((k|0)/2|0)<<2)|0;if((j|0)>3996){j=(k|0)/4|0;n=ig(h,h+(j<<2)|0,m,m+(j<<2)|0,e,c)|0}else n=Vg(h,m,e,c)|0;o=f[h>>2]|0;j=f[m>>2]|0;p=f[c>>2]|0;k=f[p>>2]|0;q=(f[p+4>>2]|0)-k>>3;if(q>>>0<=o>>>0){l=20;break a}r=k;if(q>>>0<=j>>>0){l=22;break a}k=f[r+(o<<3)>>2]|0;s=f[r+(j<<3)>>2]|0;if(k>>>0>>0){t=e;u=n;break}else v=e;while(1){v=v+-4|0;if((h|0)==(v|0))break;w=f[v>>2]|0;if(q>>>0<=w>>>0){l=51;break a}if((f[r+(w<<3)>>2]|0)>>>0>>0){l=53;break b}}s=h+4|0;j=f[e>>2]|0;if(q>>>0<=j>>>0){l=26;break a}if(k>>>0<(f[r+(j<<3)>>2]|0)>>>0)x=s;else{if((s|0)==(e|0)){l=84;break a}else y=s;while(1){z=f[y>>2]|0;if(q>>>0<=z>>>0){l=32;break a}if(k>>>0<(f[r+(z<<3)>>2]|0)>>>0)break;s=y+4|0;if((s|0)==(e|0)){l=84;break a}else y=s}f[y>>2]=j;f[e>>2]=z;x=y+4|0}if((x|0)==(e|0)){l=84;break a}r=f[h>>2]|0;A=f[c>>2]|0;k=f[A>>2]|0;q=(f[A+4>>2]|0)-k>>3;if(q>>>0<=r>>>0){l=38;break a}s=k;k=e;B=x;C=r;while(1){r=s+(C<<3)|0;D=q>>>0>C>>>0;E=B;while(1){F=f[E>>2]|0;if(q>>>0<=F>>>0){l=40;break a}G=f[r>>2]|0;if(G>>>0<(f[s+(F<<3)>>2]|0)>>>0)break;if(D)E=E+4|0;else{l=38;break a}}if(q>>>0>C>>>0)H=k;else{l=46;break a}do{H=H+-4|0;I=f[H>>2]|0;if(q>>>0<=I>>>0){l=47;break a}}while(G>>>0<(f[s+(I<<3)>>2]|0)>>>0);if(E>>>0>=H>>>0){h=E;continue b}D=f[E>>2]|0;f[E>>2]=I;f[H>>2]=D;C=f[h>>2]|0;if(q>>>0<=C>>>0){l=38;break a}else{k=H;B=E+4|0}}}if((l|0)==53){l=0;f[h>>2]=w;f[v>>2]=o;t=v;u=n+1|0}B=h+4|0;c:do if(B>>>0>>0){k=f[B>>2]|0;C=f[c>>2]|0;q=f[C>>2]|0;s=(f[C+4>>2]|0)-q>>3;if(s>>>0>k>>>0){J=t;K=B;L=u;M=m;N=s;O=q;P=C;Q=k}else{R=C;l=57;break a}while(1){C=f[c>>2]|0;k=C+4|0;q=f[M>>2]|0;s=K;j=O;D=N;S=P;r=Q;while(1){F=j;if(D>>>0<=q>>>0){l=59;break a}if((f[F+(r<<3)>>2]|0)>>>0>=(f[F+(q<<3)>>2]|0)>>>0)break;F=s+4|0;T=f[F>>2]|0;j=f[C>>2]|0;D=(f[k>>2]|0)-j>>3;if(D>>>0<=T>>>0){R=C;l=57;break a}else{s=F;S=C;r=T}}C=f[M>>2]|0;O=f[S>>2]|0;N=(f[S+4>>2]|0)-O>>3;D=O;j=D+(C<<3)|0;if(N>>>0>C>>>0)U=J;else{l=65;break a}do{U=U+-4|0;V=f[U>>2]|0;if(N>>>0<=V>>>0){l=66;break a}}while((f[D+(V<<3)>>2]|0)>>>0>=(f[j>>2]|0)>>>0);if(s>>>0>U>>>0){W=M;X=L;Y=s;break c}f[s>>2]=V;f[U>>2]=r;K=s+4|0;Q=f[K>>2]|0;if(N>>>0<=Q>>>0){R=S;l=57;break a}else{J=U;L=L+1|0;M=(M|0)==(s|0)?U:M;P=S}}}else{W=m;X=u;Y=B}while(0);if((Y|0)!=(W|0)){B=f[W>>2]|0;j=f[Y>>2]|0;Z=f[c>>2]|0;D=f[Z>>2]|0;C=(f[Z+4>>2]|0)-D>>3;if(C>>>0<=B>>>0){l=72;break a}k=D;if(C>>>0<=j>>>0){l=74;break a}if((f[k+(B<<3)>>2]|0)>>>0<(f[k+(j<<3)>>2]|0)>>>0){f[Y>>2]=B;f[W>>2]=j;_=X+1|0}else _=X}else _=X;if(!_){$=_d(h,Y,c)|0;j=Y+4|0;if(_d(j,a,c)|0){l=83;break}if($){g=j;continue}}j=Y;if((j-i|0)>=(b-j|0)){l=82;break}xb(h,Y,c);g=Y+4|0}if((l|0)==82){l=0;xb(Y+4|0,a,c);d=h;a=Y;continue}else if((l|0)==83){l=0;if($){l=84;break}else{d=h;a=Y;continue}}}switch(l|0){case 5:{l=f[e>>2]|0;Y=f[h>>2]|0;d=f[c>>2]|0;$=f[d>>2]|0;i=(f[d+4>>2]|0)-$>>3;if(i>>>0<=l>>>0)aq(d);_=$;if(i>>>0<=Y>>>0)aq(d);if((f[_+(l<<3)>>2]|0)>>>0>=(f[_+(Y<<3)>>2]|0)>>>0)return;f[h>>2]=l;f[e>>2]=Y;return}case 11:{Vg(h,h+4|0,e,c)|0;return}case 12:{jh(h,h+4|0,h+8|0,e,c)|0;return}case 13:{ig(h,h+4|0,h+8|0,h+12|0,e,c)|0;return}case 15:{ih(h,a,c);return}case 20:{aq(p);break}case 22:{aq(p);break}case 26:{aq(p);break}case 32:{aq(p);break}case 38:{aq(A);break}case 40:{aq(A);break}case 46:{aq(A);break}case 47:{aq(A);break}case 51:{aq(p);break}case 57:{aq(R);break}case 59:{aq(S);break}case 65:{if(N>>>0>(f[J+-4>>2]|0)>>>0)aq(S);else aq(S);break}case 66:{aq(S);break}case 72:{aq(Z);break}case 74:{aq(Z);break}case 84:return}}function yb(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,$=0;d=a;a=b;a:while(1){b=a;e=a+-4|0;g=d;while(1){h=g;b:while(1){i=h;j=b-i|0;k=j>>2;switch(k|0){case 2:{l=5;break a;break}case 3:{l=11;break a;break}case 4:{l=12;break a;break}case 5:{l=13;break a;break}case 1:case 0:{l=84;break a;break}default:{}}if((j|0)<124){l=15;break a}m=h+(((k|0)/2|0)<<2)|0;if((j|0)>3996){j=(k|0)/4|0;n=ig(h,h+(j<<2)|0,m,m+(j<<2)|0,e,c)|0}else n=Vg(h,m,e,c)|0;o=f[h>>2]|0;j=f[m>>2]|0;p=f[c>>2]|0;k=f[p>>2]|0;q=(f[p+4>>2]|0)-k>>3;if(q>>>0<=o>>>0){l=20;break a}r=k;if(q>>>0<=j>>>0){l=22;break a}k=f[r+(o<<3)>>2]|0;s=f[r+(j<<3)>>2]|0;if(k>>>0>>0){t=e;u=n;break}else v=e;while(1){v=v+-4|0;if((h|0)==(v|0))break;w=f[v>>2]|0;if(q>>>0<=w>>>0){l=51;break a}if((f[r+(w<<3)>>2]|0)>>>0>>0){l=53;break b}}s=h+4|0;j=f[e>>2]|0;if(q>>>0<=j>>>0){l=26;break a}if(k>>>0<(f[r+(j<<3)>>2]|0)>>>0)x=s;else{if((s|0)==(e|0)){l=84;break a}else y=s;while(1){z=f[y>>2]|0;if(q>>>0<=z>>>0){l=32;break a}if(k>>>0<(f[r+(z<<3)>>2]|0)>>>0)break;s=y+4|0;if((s|0)==(e|0)){l=84;break a}else y=s}f[y>>2]=j;f[e>>2]=z;x=y+4|0}if((x|0)==(e|0)){l=84;break a}r=f[h>>2]|0;A=f[c>>2]|0;k=f[A>>2]|0;q=(f[A+4>>2]|0)-k>>3;if(q>>>0<=r>>>0){l=38;break a}s=k;k=e;B=x;C=r;while(1){r=s+(C<<3)|0;D=q>>>0>C>>>0;E=B;while(1){F=f[E>>2]|0;if(q>>>0<=F>>>0){l=40;break a}G=f[r>>2]|0;if(G>>>0<(f[s+(F<<3)>>2]|0)>>>0)break;if(D)E=E+4|0;else{l=38;break a}}if(q>>>0>C>>>0)H=k;else{l=46;break a}do{H=H+-4|0;I=f[H>>2]|0;if(q>>>0<=I>>>0){l=47;break a}}while(G>>>0<(f[s+(I<<3)>>2]|0)>>>0);if(E>>>0>=H>>>0){h=E;continue b}D=f[E>>2]|0;f[E>>2]=I;f[H>>2]=D;C=f[h>>2]|0;if(q>>>0<=C>>>0){l=38;break a}else{k=H;B=E+4|0}}}if((l|0)==53){l=0;f[h>>2]=w;f[v>>2]=o;t=v;u=n+1|0}B=h+4|0;c:do if(B>>>0>>0){k=f[B>>2]|0;C=f[c>>2]|0;q=f[C>>2]|0;s=(f[C+4>>2]|0)-q>>3;if(s>>>0>k>>>0){J=t;K=B;L=u;M=m;N=s;O=q;P=C;Q=k}else{R=C;l=57;break a}while(1){C=f[c>>2]|0;k=C+4|0;q=f[M>>2]|0;s=K;j=O;D=N;S=P;r=Q;while(1){F=j;if(D>>>0<=q>>>0){l=59;break a}if((f[F+(r<<3)>>2]|0)>>>0>=(f[F+(q<<3)>>2]|0)>>>0)break;F=s+4|0;T=f[F>>2]|0;j=f[C>>2]|0;D=(f[k>>2]|0)-j>>3;if(D>>>0<=T>>>0){R=C;l=57;break a}else{s=F;S=C;r=T}}C=f[M>>2]|0;O=f[S>>2]|0;N=(f[S+4>>2]|0)-O>>3;D=O;j=D+(C<<3)|0;if(N>>>0>C>>>0)U=J;else{l=65;break a}do{U=U+-4|0;V=f[U>>2]|0;if(N>>>0<=V>>>0){l=66;break a}}while((f[D+(V<<3)>>2]|0)>>>0>=(f[j>>2]|0)>>>0);if(s>>>0>U>>>0){W=M;X=L;Y=s;break c}f[s>>2]=V;f[U>>2]=r;K=s+4|0;Q=f[K>>2]|0;if(N>>>0<=Q>>>0){R=S;l=57;break a}else{J=U;L=L+1|0;M=(M|0)==(s|0)?U:M;P=S}}}else{W=m;X=u;Y=B}while(0);if((Y|0)!=(W|0)){B=f[W>>2]|0;j=f[Y>>2]|0;Z=f[c>>2]|0;D=f[Z>>2]|0;C=(f[Z+4>>2]|0)-D>>3;if(C>>>0<=B>>>0){l=72;break a}k=D;if(C>>>0<=j>>>0){l=74;break a}if((f[k+(B<<3)>>2]|0)>>>0<(f[k+(j<<3)>>2]|0)>>>0){f[Y>>2]=B;f[W>>2]=j;_=X+1|0}else _=X}else _=X;if(!_){$=_d(h,Y,c)|0;j=Y+4|0;if(_d(j,a,c)|0){l=83;break}if($){g=j;continue}}j=Y;if((j-i|0)>=(b-j|0)){l=82;break}yb(h,Y,c);g=Y+4|0}if((l|0)==82){l=0;yb(Y+4|0,a,c);d=h;a=Y;continue}else if((l|0)==83){l=0;if($){l=84;break}else{d=h;a=Y;continue}}}switch(l|0){case 5:{l=f[e>>2]|0;Y=f[h>>2]|0;d=f[c>>2]|0;$=f[d>>2]|0;i=(f[d+4>>2]|0)-$>>3;if(i>>>0<=l>>>0)aq(d);_=$;if(i>>>0<=Y>>>0)aq(d);if((f[_+(l<<3)>>2]|0)>>>0>=(f[_+(Y<<3)>>2]|0)>>>0)return;f[h>>2]=l;f[e>>2]=Y;return}case 11:{Vg(h,h+4|0,e,c)|0;return}case 12:{jh(h,h+4|0,h+8|0,e,c)|0;return}case 13:{ig(h,h+4|0,h+8|0,h+12|0,e,c)|0;return}case 15:{ih(h,a,c);return}case 20:{aq(p);break}case 22:{aq(p);break}case 26:{aq(p);break}case 32:{aq(p);break}case 38:{aq(A);break}case 40:{aq(A);break}case 46:{aq(A);break}case 47:{aq(A);break}case 51:{aq(p);break}case 57:{aq(R);break}case 59:{aq(S);break}case 65:{if(N>>>0>(f[J+-4>>2]|0)>>>0)aq(S);else aq(S);break}case 66:{aq(S);break}case 72:{aq(Z);break}case 74:{aq(Z);break}case 84:return}}function zb(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,$=0;d=a;a=b;a:while(1){b=a;e=a+-4|0;g=d;while(1){h=g;b:while(1){i=h;j=b-i|0;k=j>>2;switch(k|0){case 2:{l=5;break a;break}case 3:{l=11;break a;break}case 4:{l=12;break a;break}case 5:{l=13;break a;break}case 1:case 0:{l=84;break a;break}default:{}}if((j|0)<124){l=15;break a}m=h+(((k|0)/2|0)<<2)|0;if((j|0)>3996){j=(k|0)/4|0;n=ig(h,h+(j<<2)|0,m,m+(j<<2)|0,e,c)|0}else n=Vg(h,m,e,c)|0;o=f[h>>2]|0;j=f[m>>2]|0;p=f[c>>2]|0;k=f[p>>2]|0;q=(f[p+4>>2]|0)-k>>3;if(q>>>0<=o>>>0){l=20;break a}r=k;if(q>>>0<=j>>>0){l=22;break a}k=f[r+(o<<3)>>2]|0;s=f[r+(j<<3)>>2]|0;if(k>>>0>>0){t=e;u=n;break}else v=e;while(1){v=v+-4|0;if((h|0)==(v|0))break;w=f[v>>2]|0;if(q>>>0<=w>>>0){l=51;break a}if((f[r+(w<<3)>>2]|0)>>>0>>0){l=53;break b}}s=h+4|0;j=f[e>>2]|0;if(q>>>0<=j>>>0){l=26;break a}if(k>>>0<(f[r+(j<<3)>>2]|0)>>>0)x=s;else{if((s|0)==(e|0)){l=84;break a}else y=s;while(1){z=f[y>>2]|0;if(q>>>0<=z>>>0){l=32;break a}if(k>>>0<(f[r+(z<<3)>>2]|0)>>>0)break;s=y+4|0;if((s|0)==(e|0)){l=84;break a}else y=s}f[y>>2]=j;f[e>>2]=z;x=y+4|0}if((x|0)==(e|0)){l=84;break a}r=f[h>>2]|0;A=f[c>>2]|0;k=f[A>>2]|0;q=(f[A+4>>2]|0)-k>>3;if(q>>>0<=r>>>0){l=38;break a}s=k;k=e;B=x;C=r;while(1){r=s+(C<<3)|0;D=q>>>0>C>>>0;E=B;while(1){F=f[E>>2]|0;if(q>>>0<=F>>>0){l=40;break a}G=f[r>>2]|0;if(G>>>0<(f[s+(F<<3)>>2]|0)>>>0)break;if(D)E=E+4|0;else{l=38;break a}}if(q>>>0>C>>>0)H=k;else{l=46;break a}do{H=H+-4|0;I=f[H>>2]|0;if(q>>>0<=I>>>0){l=47;break a}}while(G>>>0<(f[s+(I<<3)>>2]|0)>>>0);if(E>>>0>=H>>>0){h=E;continue b}D=f[E>>2]|0;f[E>>2]=I;f[H>>2]=D;C=f[h>>2]|0;if(q>>>0<=C>>>0){l=38;break a}else{k=H;B=E+4|0}}}if((l|0)==53){l=0;f[h>>2]=w;f[v>>2]=o;t=v;u=n+1|0}B=h+4|0;c:do if(B>>>0>>0){k=f[B>>2]|0;C=f[c>>2]|0;q=f[C>>2]|0;s=(f[C+4>>2]|0)-q>>3;if(s>>>0>k>>>0){J=t;K=B;L=u;M=m;N=s;O=q;P=C;Q=k}else{R=C;l=57;break a}while(1){C=f[c>>2]|0;k=C+4|0;q=f[M>>2]|0;s=K;j=O;D=N;S=P;r=Q;while(1){F=j;if(D>>>0<=q>>>0){l=59;break a}if((f[F+(r<<3)>>2]|0)>>>0>=(f[F+(q<<3)>>2]|0)>>>0)break;F=s+4|0;T=f[F>>2]|0;j=f[C>>2]|0;D=(f[k>>2]|0)-j>>3;if(D>>>0<=T>>>0){R=C;l=57;break a}else{s=F;S=C;r=T}}C=f[M>>2]|0;O=f[S>>2]|0;N=(f[S+4>>2]|0)-O>>3;D=O;j=D+(C<<3)|0;if(N>>>0>C>>>0)U=J;else{l=65;break a}do{U=U+-4|0;V=f[U>>2]|0;if(N>>>0<=V>>>0){l=66;break a}}while((f[D+(V<<3)>>2]|0)>>>0>=(f[j>>2]|0)>>>0);if(s>>>0>U>>>0){W=M;X=L;Y=s;break c}f[s>>2]=V;f[U>>2]=r;K=s+4|0;Q=f[K>>2]|0;if(N>>>0<=Q>>>0){R=S;l=57;break a}else{J=U;L=L+1|0;M=(M|0)==(s|0)?U:M;P=S}}}else{W=m;X=u;Y=B}while(0);if((Y|0)!=(W|0)){B=f[W>>2]|0;j=f[Y>>2]|0;Z=f[c>>2]|0;D=f[Z>>2]|0;C=(f[Z+4>>2]|0)-D>>3;if(C>>>0<=B>>>0){l=72;break a}k=D;if(C>>>0<=j>>>0){l=74;break a}if((f[k+(B<<3)>>2]|0)>>>0<(f[k+(j<<3)>>2]|0)>>>0){f[Y>>2]=B;f[W>>2]=j;_=X+1|0}else _=X}else _=X;if(!_){$=_d(h,Y,c)|0;j=Y+4|0;if(_d(j,a,c)|0){l=83;break}if($){g=j;continue}}j=Y;if((j-i|0)>=(b-j|0)){l=82;break}zb(h,Y,c);g=Y+4|0}if((l|0)==82){l=0;zb(Y+4|0,a,c);d=h;a=Y;continue}else if((l|0)==83){l=0;if($){l=84;break}else{d=h;a=Y;continue}}}switch(l|0){case 5:{l=f[e>>2]|0;Y=f[h>>2]|0;d=f[c>>2]|0;$=f[d>>2]|0;i=(f[d+4>>2]|0)-$>>3;if(i>>>0<=l>>>0)aq(d);_=$;if(i>>>0<=Y>>>0)aq(d);if((f[_+(l<<3)>>2]|0)>>>0>=(f[_+(Y<<3)>>2]|0)>>>0)return;f[h>>2]=l;f[e>>2]=Y;return}case 11:{Vg(h,h+4|0,e,c)|0;return}case 12:{jh(h,h+4|0,h+8|0,e,c)|0;return}case 13:{ig(h,h+4|0,h+8|0,h+12|0,e,c)|0;return}case 15:{ih(h,a,c);return}case 20:{aq(p);break}case 22:{aq(p);break}case 26:{aq(p);break}case 32:{aq(p);break}case 38:{aq(A);break}case 40:{aq(A);break}case 46:{aq(A);break}case 47:{aq(A);break}case 51:{aq(p);break}case 57:{aq(R);break}case 59:{aq(S);break}case 65:{if(N>>>0>(f[J+-4>>2]|0)>>>0)aq(S);else aq(S);break}case 66:{aq(S);break}case 72:{aq(Z);break}case 74:{aq(Z);break}case 84:return}}function Ab(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,$=0;d=a;a=b;a:while(1){b=a;e=a+-4|0;g=d;while(1){h=g;b:while(1){i=h;j=b-i|0;k=j>>2;switch(k|0){case 2:{l=5;break a;break}case 3:{l=11;break a;break}case 4:{l=12;break a;break}case 5:{l=13;break a;break}case 1:case 0:{l=84;break a;break}default:{}}if((j|0)<124){l=15;break a}m=h+(((k|0)/2|0)<<2)|0;if((j|0)>3996){j=(k|0)/4|0;n=ig(h,h+(j<<2)|0,m,m+(j<<2)|0,e,c)|0}else n=Vg(h,m,e,c)|0;o=f[h>>2]|0;j=f[m>>2]|0;p=f[c>>2]|0;k=f[p>>2]|0;q=(f[p+4>>2]|0)-k>>3;if(q>>>0<=o>>>0){l=20;break a}r=k;if(q>>>0<=j>>>0){l=22;break a}k=f[r+(o<<3)>>2]|0;s=f[r+(j<<3)>>2]|0;if(k>>>0>>0){t=e;u=n;break}else v=e;while(1){v=v+-4|0;if((h|0)==(v|0))break;w=f[v>>2]|0;if(q>>>0<=w>>>0){l=51;break a}if((f[r+(w<<3)>>2]|0)>>>0>>0){l=53;break b}}s=h+4|0;j=f[e>>2]|0;if(q>>>0<=j>>>0){l=26;break a}if(k>>>0<(f[r+(j<<3)>>2]|0)>>>0)x=s;else{if((s|0)==(e|0)){l=84;break a}else y=s;while(1){z=f[y>>2]|0;if(q>>>0<=z>>>0){l=32;break a}if(k>>>0<(f[r+(z<<3)>>2]|0)>>>0)break;s=y+4|0;if((s|0)==(e|0)){l=84;break a}else y=s}f[y>>2]=j;f[e>>2]=z;x=y+4|0}if((x|0)==(e|0)){l=84;break a}r=f[h>>2]|0;A=f[c>>2]|0;k=f[A>>2]|0;q=(f[A+4>>2]|0)-k>>3;if(q>>>0<=r>>>0){l=38;break a}s=k;k=e;B=x;C=r;while(1){r=s+(C<<3)|0;D=q>>>0>C>>>0;E=B;while(1){F=f[E>>2]|0;if(q>>>0<=F>>>0){l=40;break a}G=f[r>>2]|0;if(G>>>0<(f[s+(F<<3)>>2]|0)>>>0)break;if(D)E=E+4|0;else{l=38;break a}}if(q>>>0>C>>>0)H=k;else{l=46;break a}do{H=H+-4|0;I=f[H>>2]|0;if(q>>>0<=I>>>0){l=47;break a}}while(G>>>0<(f[s+(I<<3)>>2]|0)>>>0);if(E>>>0>=H>>>0){h=E;continue b}D=f[E>>2]|0;f[E>>2]=I;f[H>>2]=D;C=f[h>>2]|0;if(q>>>0<=C>>>0){l=38;break a}else{k=H;B=E+4|0}}}if((l|0)==53){l=0;f[h>>2]=w;f[v>>2]=o;t=v;u=n+1|0}B=h+4|0;c:do if(B>>>0>>0){k=f[B>>2]|0;C=f[c>>2]|0;q=f[C>>2]|0;s=(f[C+4>>2]|0)-q>>3;if(s>>>0>k>>>0){J=t;K=B;L=u;M=m;N=s;O=q;P=C;Q=k}else{R=C;l=57;break a}while(1){C=f[c>>2]|0;k=C+4|0;q=f[M>>2]|0;s=K;j=O;D=N;S=P;r=Q;while(1){F=j;if(D>>>0<=q>>>0){l=59;break a}if((f[F+(r<<3)>>2]|0)>>>0>=(f[F+(q<<3)>>2]|0)>>>0)break;F=s+4|0;T=f[F>>2]|0;j=f[C>>2]|0;D=(f[k>>2]|0)-j>>3;if(D>>>0<=T>>>0){R=C;l=57;break a}else{s=F;S=C;r=T}}C=f[M>>2]|0;O=f[S>>2]|0;N=(f[S+4>>2]|0)-O>>3;D=O;j=D+(C<<3)|0;if(N>>>0>C>>>0)U=J;else{l=65;break a}do{U=U+-4|0;V=f[U>>2]|0;if(N>>>0<=V>>>0){l=66;break a}}while((f[D+(V<<3)>>2]|0)>>>0>=(f[j>>2]|0)>>>0);if(s>>>0>U>>>0){W=M;X=L;Y=s;break c}f[s>>2]=V;f[U>>2]=r;K=s+4|0;Q=f[K>>2]|0;if(N>>>0<=Q>>>0){R=S;l=57;break a}else{J=U;L=L+1|0;M=(M|0)==(s|0)?U:M;P=S}}}else{W=m;X=u;Y=B}while(0);if((Y|0)!=(W|0)){B=f[W>>2]|0;j=f[Y>>2]|0;Z=f[c>>2]|0;D=f[Z>>2]|0;C=(f[Z+4>>2]|0)-D>>3;if(C>>>0<=B>>>0){l=72;break a}k=D;if(C>>>0<=j>>>0){l=74;break a}if((f[k+(B<<3)>>2]|0)>>>0<(f[k+(j<<3)>>2]|0)>>>0){f[Y>>2]=B;f[W>>2]=j;_=X+1|0}else _=X}else _=X;if(!_){$=_d(h,Y,c)|0;j=Y+4|0;if(_d(j,a,c)|0){l=83;break}if($){g=j;continue}}j=Y;if((j-i|0)>=(b-j|0)){l=82;break}Ab(h,Y,c);g=Y+4|0}if((l|0)==82){l=0;Ab(Y+4|0,a,c);d=h;a=Y;continue}else if((l|0)==83){l=0;if($){l=84;break}else{d=h;a=Y;continue}}}switch(l|0){case 5:{l=f[e>>2]|0;Y=f[h>>2]|0;d=f[c>>2]|0;$=f[d>>2]|0;i=(f[d+4>>2]|0)-$>>3;if(i>>>0<=l>>>0)aq(d);_=$;if(i>>>0<=Y>>>0)aq(d);if((f[_+(l<<3)>>2]|0)>>>0>=(f[_+(Y<<3)>>2]|0)>>>0)return;f[h>>2]=l;f[e>>2]=Y;return}case 11:{Vg(h,h+4|0,e,c)|0;return}case 12:{jh(h,h+4|0,h+8|0,e,c)|0;return}case 13:{ig(h,h+4|0,h+8|0,h+12|0,e,c)|0;return}case 15:{ih(h,a,c);return}case 20:{aq(p);break}case 22:{aq(p);break}case 26:{aq(p);break}case 32:{aq(p);break}case 38:{aq(A);break}case 40:{aq(A);break}case 46:{aq(A);break}case 47:{aq(A);break}case 51:{aq(p);break}case 57:{aq(R);break}case 59:{aq(S);break}case 65:{if(N>>>0>(f[J+-4>>2]|0)>>>0)aq(S);else aq(S);break}case 66:{aq(S);break}case 72:{aq(Z);break}case 74:{aq(Z);break}case 84:return}} -function Bb(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,$=0;d=a;a=b;a:while(1){b=a;e=a+-4|0;g=d;while(1){h=g;b:while(1){i=h;j=b-i|0;k=j>>2;switch(k|0){case 2:{l=5;break a;break}case 3:{l=11;break a;break}case 4:{l=12;break a;break}case 5:{l=13;break a;break}case 1:case 0:{l=84;break a;break}default:{}}if((j|0)<124){l=15;break a}m=h+(((k|0)/2|0)<<2)|0;if((j|0)>3996){j=(k|0)/4|0;n=ig(h,h+(j<<2)|0,m,m+(j<<2)|0,e,c)|0}else n=Vg(h,m,e,c)|0;o=f[h>>2]|0;j=f[m>>2]|0;p=f[c>>2]|0;k=f[p>>2]|0;q=(f[p+4>>2]|0)-k>>3;if(q>>>0<=o>>>0){l=20;break a}r=k;if(q>>>0<=j>>>0){l=22;break a}k=f[r+(o<<3)>>2]|0;s=f[r+(j<<3)>>2]|0;if(k>>>0>>0){t=e;u=n;break}else v=e;while(1){v=v+-4|0;if((h|0)==(v|0))break;w=f[v>>2]|0;if(q>>>0<=w>>>0){l=51;break a}if((f[r+(w<<3)>>2]|0)>>>0>>0){l=53;break b}}s=h+4|0;j=f[e>>2]|0;if(q>>>0<=j>>>0){l=26;break a}if(k>>>0<(f[r+(j<<3)>>2]|0)>>>0)x=s;else{if((s|0)==(e|0)){l=84;break a}else y=s;while(1){z=f[y>>2]|0;if(q>>>0<=z>>>0){l=32;break a}if(k>>>0<(f[r+(z<<3)>>2]|0)>>>0)break;s=y+4|0;if((s|0)==(e|0)){l=84;break a}else y=s}f[y>>2]=j;f[e>>2]=z;x=y+4|0}if((x|0)==(e|0)){l=84;break a}r=f[h>>2]|0;A=f[c>>2]|0;k=f[A>>2]|0;q=(f[A+4>>2]|0)-k>>3;if(q>>>0<=r>>>0){l=38;break a}s=k;k=e;B=x;C=r;while(1){r=s+(C<<3)|0;D=q>>>0>C>>>0;E=B;while(1){F=f[E>>2]|0;if(q>>>0<=F>>>0){l=40;break a}G=f[r>>2]|0;if(G>>>0<(f[s+(F<<3)>>2]|0)>>>0)break;if(D)E=E+4|0;else{l=38;break a}}if(q>>>0>C>>>0)H=k;else{l=46;break a}do{H=H+-4|0;I=f[H>>2]|0;if(q>>>0<=I>>>0){l=47;break a}}while(G>>>0<(f[s+(I<<3)>>2]|0)>>>0);if(E>>>0>=H>>>0){h=E;continue b}D=f[E>>2]|0;f[E>>2]=I;f[H>>2]=D;C=f[h>>2]|0;if(q>>>0<=C>>>0){l=38;break a}else{k=H;B=E+4|0}}}if((l|0)==53){l=0;f[h>>2]=w;f[v>>2]=o;t=v;u=n+1|0}B=h+4|0;c:do if(B>>>0>>0){k=f[B>>2]|0;C=f[c>>2]|0;q=f[C>>2]|0;s=(f[C+4>>2]|0)-q>>3;if(s>>>0>k>>>0){J=t;K=B;L=u;M=m;N=s;O=q;P=C;Q=k}else{R=C;l=57;break a}while(1){C=f[c>>2]|0;k=C+4|0;q=f[M>>2]|0;s=K;j=O;D=N;S=P;r=Q;while(1){F=j;if(D>>>0<=q>>>0){l=59;break a}if((f[F+(r<<3)>>2]|0)>>>0>=(f[F+(q<<3)>>2]|0)>>>0)break;F=s+4|0;T=f[F>>2]|0;j=f[C>>2]|0;D=(f[k>>2]|0)-j>>3;if(D>>>0<=T>>>0){R=C;l=57;break a}else{s=F;S=C;r=T}}C=f[M>>2]|0;O=f[S>>2]|0;N=(f[S+4>>2]|0)-O>>3;D=O;j=D+(C<<3)|0;if(N>>>0>C>>>0)U=J;else{l=65;break a}do{U=U+-4|0;V=f[U>>2]|0;if(N>>>0<=V>>>0){l=66;break a}}while((f[D+(V<<3)>>2]|0)>>>0>=(f[j>>2]|0)>>>0);if(s>>>0>U>>>0){W=M;X=L;Y=s;break c}f[s>>2]=V;f[U>>2]=r;K=s+4|0;Q=f[K>>2]|0;if(N>>>0<=Q>>>0){R=S;l=57;break a}else{J=U;L=L+1|0;M=(M|0)==(s|0)?U:M;P=S}}}else{W=m;X=u;Y=B}while(0);if((Y|0)!=(W|0)){B=f[W>>2]|0;j=f[Y>>2]|0;Z=f[c>>2]|0;D=f[Z>>2]|0;C=(f[Z+4>>2]|0)-D>>3;if(C>>>0<=B>>>0){l=72;break a}k=D;if(C>>>0<=j>>>0){l=74;break a}if((f[k+(B<<3)>>2]|0)>>>0<(f[k+(j<<3)>>2]|0)>>>0){f[Y>>2]=B;f[W>>2]=j;_=X+1|0}else _=X}else _=X;if(!_){$=_d(h,Y,c)|0;j=Y+4|0;if(_d(j,a,c)|0){l=83;break}if($){g=j;continue}}j=Y;if((j-i|0)>=(b-j|0)){l=82;break}Bb(h,Y,c);g=Y+4|0}if((l|0)==82){l=0;Bb(Y+4|0,a,c);d=h;a=Y;continue}else if((l|0)==83){l=0;if($){l=84;break}else{d=h;a=Y;continue}}}switch(l|0){case 5:{l=f[e>>2]|0;Y=f[h>>2]|0;d=f[c>>2]|0;$=f[d>>2]|0;i=(f[d+4>>2]|0)-$>>3;if(i>>>0<=l>>>0)aq(d);_=$;if(i>>>0<=Y>>>0)aq(d);if((f[_+(l<<3)>>2]|0)>>>0>=(f[_+(Y<<3)>>2]|0)>>>0)return;f[h>>2]=l;f[e>>2]=Y;return}case 11:{Vg(h,h+4|0,e,c)|0;return}case 12:{jh(h,h+4|0,h+8|0,e,c)|0;return}case 13:{ig(h,h+4|0,h+8|0,h+12|0,e,c)|0;return}case 15:{ih(h,a,c);return}case 20:{aq(p);break}case 22:{aq(p);break}case 26:{aq(p);break}case 32:{aq(p);break}case 38:{aq(A);break}case 40:{aq(A);break}case 46:{aq(A);break}case 47:{aq(A);break}case 51:{aq(p);break}case 57:{aq(R);break}case 59:{aq(S);break}case 65:{if(N>>>0>(f[J+-4>>2]|0)>>>0)aq(S);else aq(S);break}case 66:{aq(S);break}case 72:{aq(Z);break}case 74:{aq(Z);break}case 84:return}}function Cb(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,$=0;d=a;a=b;a:while(1){b=a;e=a+-4|0;g=d;while(1){h=g;b:while(1){i=h;j=b-i|0;k=j>>2;switch(k|0){case 2:{l=5;break a;break}case 3:{l=11;break a;break}case 4:{l=12;break a;break}case 5:{l=13;break a;break}case 1:case 0:{l=84;break a;break}default:{}}if((j|0)<124){l=15;break a}m=h+(((k|0)/2|0)<<2)|0;if((j|0)>3996){j=(k|0)/4|0;n=ig(h,h+(j<<2)|0,m,m+(j<<2)|0,e,c)|0}else n=Vg(h,m,e,c)|0;o=f[h>>2]|0;j=f[m>>2]|0;p=f[c>>2]|0;k=f[p>>2]|0;q=(f[p+4>>2]|0)-k>>3;if(q>>>0<=o>>>0){l=20;break a}r=k;if(q>>>0<=j>>>0){l=22;break a}k=f[r+(o<<3)>>2]|0;s=f[r+(j<<3)>>2]|0;if(k>>>0>>0){t=e;u=n;break}else v=e;while(1){v=v+-4|0;if((h|0)==(v|0))break;w=f[v>>2]|0;if(q>>>0<=w>>>0){l=51;break a}if((f[r+(w<<3)>>2]|0)>>>0>>0){l=53;break b}}s=h+4|0;j=f[e>>2]|0;if(q>>>0<=j>>>0){l=26;break a}if(k>>>0<(f[r+(j<<3)>>2]|0)>>>0)x=s;else{if((s|0)==(e|0)){l=84;break a}else y=s;while(1){z=f[y>>2]|0;if(q>>>0<=z>>>0){l=32;break a}if(k>>>0<(f[r+(z<<3)>>2]|0)>>>0)break;s=y+4|0;if((s|0)==(e|0)){l=84;break a}else y=s}f[y>>2]=j;f[e>>2]=z;x=y+4|0}if((x|0)==(e|0)){l=84;break a}r=f[h>>2]|0;A=f[c>>2]|0;k=f[A>>2]|0;q=(f[A+4>>2]|0)-k>>3;if(q>>>0<=r>>>0){l=38;break a}s=k;k=e;B=x;C=r;while(1){r=s+(C<<3)|0;D=q>>>0>C>>>0;E=B;while(1){F=f[E>>2]|0;if(q>>>0<=F>>>0){l=40;break a}G=f[r>>2]|0;if(G>>>0<(f[s+(F<<3)>>2]|0)>>>0)break;if(D)E=E+4|0;else{l=38;break a}}if(q>>>0>C>>>0)H=k;else{l=46;break a}do{H=H+-4|0;I=f[H>>2]|0;if(q>>>0<=I>>>0){l=47;break a}}while(G>>>0<(f[s+(I<<3)>>2]|0)>>>0);if(E>>>0>=H>>>0){h=E;continue b}D=f[E>>2]|0;f[E>>2]=I;f[H>>2]=D;C=f[h>>2]|0;if(q>>>0<=C>>>0){l=38;break a}else{k=H;B=E+4|0}}}if((l|0)==53){l=0;f[h>>2]=w;f[v>>2]=o;t=v;u=n+1|0}B=h+4|0;c:do if(B>>>0>>0){k=f[B>>2]|0;C=f[c>>2]|0;q=f[C>>2]|0;s=(f[C+4>>2]|0)-q>>3;if(s>>>0>k>>>0){J=t;K=B;L=u;M=m;N=s;O=q;P=C;Q=k}else{R=C;l=57;break a}while(1){C=f[c>>2]|0;k=C+4|0;q=f[M>>2]|0;s=K;j=O;D=N;S=P;r=Q;while(1){F=j;if(D>>>0<=q>>>0){l=59;break a}if((f[F+(r<<3)>>2]|0)>>>0>=(f[F+(q<<3)>>2]|0)>>>0)break;F=s+4|0;T=f[F>>2]|0;j=f[C>>2]|0;D=(f[k>>2]|0)-j>>3;if(D>>>0<=T>>>0){R=C;l=57;break a}else{s=F;S=C;r=T}}C=f[M>>2]|0;O=f[S>>2]|0;N=(f[S+4>>2]|0)-O>>3;D=O;j=D+(C<<3)|0;if(N>>>0>C>>>0)U=J;else{l=65;break a}do{U=U+-4|0;V=f[U>>2]|0;if(N>>>0<=V>>>0){l=66;break a}}while((f[D+(V<<3)>>2]|0)>>>0>=(f[j>>2]|0)>>>0);if(s>>>0>U>>>0){W=M;X=L;Y=s;break c}f[s>>2]=V;f[U>>2]=r;K=s+4|0;Q=f[K>>2]|0;if(N>>>0<=Q>>>0){R=S;l=57;break a}else{J=U;L=L+1|0;M=(M|0)==(s|0)?U:M;P=S}}}else{W=m;X=u;Y=B}while(0);if((Y|0)!=(W|0)){B=f[W>>2]|0;j=f[Y>>2]|0;Z=f[c>>2]|0;D=f[Z>>2]|0;C=(f[Z+4>>2]|0)-D>>3;if(C>>>0<=B>>>0){l=72;break a}k=D;if(C>>>0<=j>>>0){l=74;break a}if((f[k+(B<<3)>>2]|0)>>>0<(f[k+(j<<3)>>2]|0)>>>0){f[Y>>2]=B;f[W>>2]=j;_=X+1|0}else _=X}else _=X;if(!_){$=_d(h,Y,c)|0;j=Y+4|0;if(_d(j,a,c)|0){l=83;break}if($){g=j;continue}}j=Y;if((j-i|0)>=(b-j|0)){l=82;break}Cb(h,Y,c);g=Y+4|0}if((l|0)==82){l=0;Cb(Y+4|0,a,c);d=h;a=Y;continue}else if((l|0)==83){l=0;if($){l=84;break}else{d=h;a=Y;continue}}}switch(l|0){case 5:{l=f[e>>2]|0;Y=f[h>>2]|0;d=f[c>>2]|0;$=f[d>>2]|0;i=(f[d+4>>2]|0)-$>>3;if(i>>>0<=l>>>0)aq(d);_=$;if(i>>>0<=Y>>>0)aq(d);if((f[_+(l<<3)>>2]|0)>>>0>=(f[_+(Y<<3)>>2]|0)>>>0)return;f[h>>2]=l;f[e>>2]=Y;return}case 11:{Vg(h,h+4|0,e,c)|0;return}case 12:{jh(h,h+4|0,h+8|0,e,c)|0;return}case 13:{ig(h,h+4|0,h+8|0,h+12|0,e,c)|0;return}case 15:{ih(h,a,c);return}case 20:{aq(p);break}case 22:{aq(p);break}case 26:{aq(p);break}case 32:{aq(p);break}case 38:{aq(A);break}case 40:{aq(A);break}case 46:{aq(A);break}case 47:{aq(A);break}case 51:{aq(p);break}case 57:{aq(R);break}case 59:{aq(S);break}case 65:{if(N>>>0>(f[J+-4>>2]|0)>>>0)aq(S);else aq(S);break}case 66:{aq(S);break}case 72:{aq(Z);break}case 74:{aq(Z);break}case 84:return}}function Db(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,$=0;d=a;a=b;a:while(1){b=a;e=a+-4|0;g=d;while(1){h=g;b:while(1){i=h;j=b-i|0;k=j>>2;switch(k|0){case 2:{l=5;break a;break}case 3:{l=11;break a;break}case 4:{l=12;break a;break}case 5:{l=13;break a;break}case 1:case 0:{l=84;break a;break}default:{}}if((j|0)<124){l=15;break a}m=h+(((k|0)/2|0)<<2)|0;if((j|0)>3996){j=(k|0)/4|0;n=ig(h,h+(j<<2)|0,m,m+(j<<2)|0,e,c)|0}else n=Vg(h,m,e,c)|0;o=f[h>>2]|0;j=f[m>>2]|0;p=f[c>>2]|0;k=f[p>>2]|0;q=(f[p+4>>2]|0)-k>>3;if(q>>>0<=o>>>0){l=20;break a}r=k;if(q>>>0<=j>>>0){l=22;break a}k=f[r+(o<<3)>>2]|0;s=f[r+(j<<3)>>2]|0;if(k>>>0>>0){t=e;u=n;break}else v=e;while(1){v=v+-4|0;if((h|0)==(v|0))break;w=f[v>>2]|0;if(q>>>0<=w>>>0){l=51;break a}if((f[r+(w<<3)>>2]|0)>>>0>>0){l=53;break b}}s=h+4|0;j=f[e>>2]|0;if(q>>>0<=j>>>0){l=26;break a}if(k>>>0<(f[r+(j<<3)>>2]|0)>>>0)x=s;else{if((s|0)==(e|0)){l=84;break a}else y=s;while(1){z=f[y>>2]|0;if(q>>>0<=z>>>0){l=32;break a}if(k>>>0<(f[r+(z<<3)>>2]|0)>>>0)break;s=y+4|0;if((s|0)==(e|0)){l=84;break a}else y=s}f[y>>2]=j;f[e>>2]=z;x=y+4|0}if((x|0)==(e|0)){l=84;break a}r=f[h>>2]|0;A=f[c>>2]|0;k=f[A>>2]|0;q=(f[A+4>>2]|0)-k>>3;if(q>>>0<=r>>>0){l=38;break a}s=k;k=e;B=x;C=r;while(1){r=s+(C<<3)|0;D=q>>>0>C>>>0;E=B;while(1){F=f[E>>2]|0;if(q>>>0<=F>>>0){l=40;break a}G=f[r>>2]|0;if(G>>>0<(f[s+(F<<3)>>2]|0)>>>0)break;if(D)E=E+4|0;else{l=38;break a}}if(q>>>0>C>>>0)H=k;else{l=46;break a}do{H=H+-4|0;I=f[H>>2]|0;if(q>>>0<=I>>>0){l=47;break a}}while(G>>>0<(f[s+(I<<3)>>2]|0)>>>0);if(E>>>0>=H>>>0){h=E;continue b}D=f[E>>2]|0;f[E>>2]=I;f[H>>2]=D;C=f[h>>2]|0;if(q>>>0<=C>>>0){l=38;break a}else{k=H;B=E+4|0}}}if((l|0)==53){l=0;f[h>>2]=w;f[v>>2]=o;t=v;u=n+1|0}B=h+4|0;c:do if(B>>>0>>0){k=f[B>>2]|0;C=f[c>>2]|0;q=f[C>>2]|0;s=(f[C+4>>2]|0)-q>>3;if(s>>>0>k>>>0){J=t;K=B;L=u;M=m;N=s;O=q;P=C;Q=k}else{R=C;l=57;break a}while(1){C=f[c>>2]|0;k=C+4|0;q=f[M>>2]|0;s=K;j=O;D=N;S=P;r=Q;while(1){F=j;if(D>>>0<=q>>>0){l=59;break a}if((f[F+(r<<3)>>2]|0)>>>0>=(f[F+(q<<3)>>2]|0)>>>0)break;F=s+4|0;T=f[F>>2]|0;j=f[C>>2]|0;D=(f[k>>2]|0)-j>>3;if(D>>>0<=T>>>0){R=C;l=57;break a}else{s=F;S=C;r=T}}C=f[M>>2]|0;O=f[S>>2]|0;N=(f[S+4>>2]|0)-O>>3;D=O;j=D+(C<<3)|0;if(N>>>0>C>>>0)U=J;else{l=65;break a}do{U=U+-4|0;V=f[U>>2]|0;if(N>>>0<=V>>>0){l=66;break a}}while((f[D+(V<<3)>>2]|0)>>>0>=(f[j>>2]|0)>>>0);if(s>>>0>U>>>0){W=M;X=L;Y=s;break c}f[s>>2]=V;f[U>>2]=r;K=s+4|0;Q=f[K>>2]|0;if(N>>>0<=Q>>>0){R=S;l=57;break a}else{J=U;L=L+1|0;M=(M|0)==(s|0)?U:M;P=S}}}else{W=m;X=u;Y=B}while(0);if((Y|0)!=(W|0)){B=f[W>>2]|0;j=f[Y>>2]|0;Z=f[c>>2]|0;D=f[Z>>2]|0;C=(f[Z+4>>2]|0)-D>>3;if(C>>>0<=B>>>0){l=72;break a}k=D;if(C>>>0<=j>>>0){l=74;break a}if((f[k+(B<<3)>>2]|0)>>>0<(f[k+(j<<3)>>2]|0)>>>0){f[Y>>2]=B;f[W>>2]=j;_=X+1|0}else _=X}else _=X;if(!_){$=_d(h,Y,c)|0;j=Y+4|0;if(_d(j,a,c)|0){l=83;break}if($){g=j;continue}}j=Y;if((j-i|0)>=(b-j|0)){l=82;break}Db(h,Y,c);g=Y+4|0}if((l|0)==82){l=0;Db(Y+4|0,a,c);d=h;a=Y;continue}else if((l|0)==83){l=0;if($){l=84;break}else{d=h;a=Y;continue}}}switch(l|0){case 5:{l=f[e>>2]|0;Y=f[h>>2]|0;d=f[c>>2]|0;$=f[d>>2]|0;i=(f[d+4>>2]|0)-$>>3;if(i>>>0<=l>>>0)aq(d);_=$;if(i>>>0<=Y>>>0)aq(d);if((f[_+(l<<3)>>2]|0)>>>0>=(f[_+(Y<<3)>>2]|0)>>>0)return;f[h>>2]=l;f[e>>2]=Y;return}case 11:{Vg(h,h+4|0,e,c)|0;return}case 12:{jh(h,h+4|0,h+8|0,e,c)|0;return}case 13:{ig(h,h+4|0,h+8|0,h+12|0,e,c)|0;return}case 15:{ih(h,a,c);return}case 20:{aq(p);break}case 22:{aq(p);break}case 26:{aq(p);break}case 32:{aq(p);break}case 38:{aq(A);break}case 40:{aq(A);break}case 46:{aq(A);break}case 47:{aq(A);break}case 51:{aq(p);break}case 57:{aq(R);break}case 59:{aq(S);break}case 65:{if(N>>>0>(f[J+-4>>2]|0)>>>0)aq(S);else aq(S);break}case 66:{aq(S);break}case 72:{aq(Z);break}case 74:{aq(Z);break}case 84:return}}function Eb(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,$=0;d=a;a=b;a:while(1){b=a;e=a+-4|0;g=d;while(1){h=g;b:while(1){i=h;j=b-i|0;k=j>>2;switch(k|0){case 2:{l=5;break a;break}case 3:{l=11;break a;break}case 4:{l=12;break a;break}case 5:{l=13;break a;break}case 1:case 0:{l=84;break a;break}default:{}}if((j|0)<124){l=15;break a}m=h+(((k|0)/2|0)<<2)|0;if((j|0)>3996){j=(k|0)/4|0;n=ig(h,h+(j<<2)|0,m,m+(j<<2)|0,e,c)|0}else n=Vg(h,m,e,c)|0;o=f[h>>2]|0;j=f[m>>2]|0;p=f[c>>2]|0;k=f[p>>2]|0;q=(f[p+4>>2]|0)-k>>3;if(q>>>0<=o>>>0){l=20;break a}r=k;if(q>>>0<=j>>>0){l=22;break a}k=f[r+(o<<3)>>2]|0;s=f[r+(j<<3)>>2]|0;if(k>>>0>>0){t=e;u=n;break}else v=e;while(1){v=v+-4|0;if((h|0)==(v|0))break;w=f[v>>2]|0;if(q>>>0<=w>>>0){l=51;break a}if((f[r+(w<<3)>>2]|0)>>>0>>0){l=53;break b}}s=h+4|0;j=f[e>>2]|0;if(q>>>0<=j>>>0){l=26;break a}if(k>>>0<(f[r+(j<<3)>>2]|0)>>>0)x=s;else{if((s|0)==(e|0)){l=84;break a}else y=s;while(1){z=f[y>>2]|0;if(q>>>0<=z>>>0){l=32;break a}if(k>>>0<(f[r+(z<<3)>>2]|0)>>>0)break;s=y+4|0;if((s|0)==(e|0)){l=84;break a}else y=s}f[y>>2]=j;f[e>>2]=z;x=y+4|0}if((x|0)==(e|0)){l=84;break a}r=f[h>>2]|0;A=f[c>>2]|0;k=f[A>>2]|0;q=(f[A+4>>2]|0)-k>>3;if(q>>>0<=r>>>0){l=38;break a}s=k;k=e;B=x;C=r;while(1){r=s+(C<<3)|0;D=q>>>0>C>>>0;E=B;while(1){F=f[E>>2]|0;if(q>>>0<=F>>>0){l=40;break a}G=f[r>>2]|0;if(G>>>0<(f[s+(F<<3)>>2]|0)>>>0)break;if(D)E=E+4|0;else{l=38;break a}}if(q>>>0>C>>>0)H=k;else{l=46;break a}do{H=H+-4|0;I=f[H>>2]|0;if(q>>>0<=I>>>0){l=47;break a}}while(G>>>0<(f[s+(I<<3)>>2]|0)>>>0);if(E>>>0>=H>>>0){h=E;continue b}D=f[E>>2]|0;f[E>>2]=I;f[H>>2]=D;C=f[h>>2]|0;if(q>>>0<=C>>>0){l=38;break a}else{k=H;B=E+4|0}}}if((l|0)==53){l=0;f[h>>2]=w;f[v>>2]=o;t=v;u=n+1|0}B=h+4|0;c:do if(B>>>0>>0){k=f[B>>2]|0;C=f[c>>2]|0;q=f[C>>2]|0;s=(f[C+4>>2]|0)-q>>3;if(s>>>0>k>>>0){J=t;K=B;L=u;M=m;N=s;O=q;P=C;Q=k}else{R=C;l=57;break a}while(1){C=f[c>>2]|0;k=C+4|0;q=f[M>>2]|0;s=K;j=O;D=N;S=P;r=Q;while(1){F=j;if(D>>>0<=q>>>0){l=59;break a}if((f[F+(r<<3)>>2]|0)>>>0>=(f[F+(q<<3)>>2]|0)>>>0)break;F=s+4|0;T=f[F>>2]|0;j=f[C>>2]|0;D=(f[k>>2]|0)-j>>3;if(D>>>0<=T>>>0){R=C;l=57;break a}else{s=F;S=C;r=T}}C=f[M>>2]|0;O=f[S>>2]|0;N=(f[S+4>>2]|0)-O>>3;D=O;j=D+(C<<3)|0;if(N>>>0>C>>>0)U=J;else{l=65;break a}do{U=U+-4|0;V=f[U>>2]|0;if(N>>>0<=V>>>0){l=66;break a}}while((f[D+(V<<3)>>2]|0)>>>0>=(f[j>>2]|0)>>>0);if(s>>>0>U>>>0){W=M;X=L;Y=s;break c}f[s>>2]=V;f[U>>2]=r;K=s+4|0;Q=f[K>>2]|0;if(N>>>0<=Q>>>0){R=S;l=57;break a}else{J=U;L=L+1|0;M=(M|0)==(s|0)?U:M;P=S}}}else{W=m;X=u;Y=B}while(0);if((Y|0)!=(W|0)){B=f[W>>2]|0;j=f[Y>>2]|0;Z=f[c>>2]|0;D=f[Z>>2]|0;C=(f[Z+4>>2]|0)-D>>3;if(C>>>0<=B>>>0){l=72;break a}k=D;if(C>>>0<=j>>>0){l=74;break a}if((f[k+(B<<3)>>2]|0)>>>0<(f[k+(j<<3)>>2]|0)>>>0){f[Y>>2]=B;f[W>>2]=j;_=X+1|0}else _=X}else _=X;if(!_){$=_d(h,Y,c)|0;j=Y+4|0;if(_d(j,a,c)|0){l=83;break}if($){g=j;continue}}j=Y;if((j-i|0)>=(b-j|0)){l=82;break}Eb(h,Y,c);g=Y+4|0}if((l|0)==82){l=0;Eb(Y+4|0,a,c);d=h;a=Y;continue}else if((l|0)==83){l=0;if($){l=84;break}else{d=h;a=Y;continue}}}switch(l|0){case 5:{l=f[e>>2]|0;Y=f[h>>2]|0;d=f[c>>2]|0;$=f[d>>2]|0;i=(f[d+4>>2]|0)-$>>3;if(i>>>0<=l>>>0)aq(d);_=$;if(i>>>0<=Y>>>0)aq(d);if((f[_+(l<<3)>>2]|0)>>>0>=(f[_+(Y<<3)>>2]|0)>>>0)return;f[h>>2]=l;f[e>>2]=Y;return}case 11:{Vg(h,h+4|0,e,c)|0;return}case 12:{jh(h,h+4|0,h+8|0,e,c)|0;return}case 13:{ig(h,h+4|0,h+8|0,h+12|0,e,c)|0;return}case 15:{ih(h,a,c);return}case 20:{aq(p);break}case 22:{aq(p);break}case 26:{aq(p);break}case 32:{aq(p);break}case 38:{aq(A);break}case 40:{aq(A);break}case 46:{aq(A);break}case 47:{aq(A);break}case 51:{aq(p);break}case 57:{aq(R);break}case 59:{aq(S);break}case 65:{if(N>>>0>(f[J+-4>>2]|0)>>>0)aq(S);else aq(S);break}case 66:{aq(S);break}case 72:{aq(Z);break}case 74:{aq(Z);break}case 84:return}}function Fb(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,$=0;d=a;a=b;a:while(1){b=a;e=a+-4|0;g=d;while(1){h=g;b:while(1){i=h;j=b-i|0;k=j>>2;switch(k|0){case 2:{l=5;break a;break}case 3:{l=11;break a;break}case 4:{l=12;break a;break}case 5:{l=13;break a;break}case 1:case 0:{l=84;break a;break}default:{}}if((j|0)<124){l=15;break a}m=h+(((k|0)/2|0)<<2)|0;if((j|0)>3996){j=(k|0)/4|0;n=ig(h,h+(j<<2)|0,m,m+(j<<2)|0,e,c)|0}else n=Vg(h,m,e,c)|0;o=f[h>>2]|0;j=f[m>>2]|0;p=f[c>>2]|0;k=f[p>>2]|0;q=(f[p+4>>2]|0)-k>>3;if(q>>>0<=o>>>0){l=20;break a}r=k;if(q>>>0<=j>>>0){l=22;break a}k=f[r+(o<<3)>>2]|0;s=f[r+(j<<3)>>2]|0;if(k>>>0>>0){t=e;u=n;break}else v=e;while(1){v=v+-4|0;if((h|0)==(v|0))break;w=f[v>>2]|0;if(q>>>0<=w>>>0){l=51;break a}if((f[r+(w<<3)>>2]|0)>>>0>>0){l=53;break b}}s=h+4|0;j=f[e>>2]|0;if(q>>>0<=j>>>0){l=26;break a}if(k>>>0<(f[r+(j<<3)>>2]|0)>>>0)x=s;else{if((s|0)==(e|0)){l=84;break a}else y=s;while(1){z=f[y>>2]|0;if(q>>>0<=z>>>0){l=32;break a}if(k>>>0<(f[r+(z<<3)>>2]|0)>>>0)break;s=y+4|0;if((s|0)==(e|0)){l=84;break a}else y=s}f[y>>2]=j;f[e>>2]=z;x=y+4|0}if((x|0)==(e|0)){l=84;break a}r=f[h>>2]|0;A=f[c>>2]|0;k=f[A>>2]|0;q=(f[A+4>>2]|0)-k>>3;if(q>>>0<=r>>>0){l=38;break a}s=k;k=e;B=x;C=r;while(1){r=s+(C<<3)|0;D=q>>>0>C>>>0;E=B;while(1){F=f[E>>2]|0;if(q>>>0<=F>>>0){l=40;break a}G=f[r>>2]|0;if(G>>>0<(f[s+(F<<3)>>2]|0)>>>0)break;if(D)E=E+4|0;else{l=38;break a}}if(q>>>0>C>>>0)H=k;else{l=46;break a}do{H=H+-4|0;I=f[H>>2]|0;if(q>>>0<=I>>>0){l=47;break a}}while(G>>>0<(f[s+(I<<3)>>2]|0)>>>0);if(E>>>0>=H>>>0){h=E;continue b}D=f[E>>2]|0;f[E>>2]=I;f[H>>2]=D;C=f[h>>2]|0;if(q>>>0<=C>>>0){l=38;break a}else{k=H;B=E+4|0}}}if((l|0)==53){l=0;f[h>>2]=w;f[v>>2]=o;t=v;u=n+1|0}B=h+4|0;c:do if(B>>>0>>0){k=f[B>>2]|0;C=f[c>>2]|0;q=f[C>>2]|0;s=(f[C+4>>2]|0)-q>>3;if(s>>>0>k>>>0){J=t;K=B;L=u;M=m;N=s;O=q;P=C;Q=k}else{R=C;l=57;break a}while(1){C=f[c>>2]|0;k=C+4|0;q=f[M>>2]|0;s=K;j=O;D=N;S=P;r=Q;while(1){F=j;if(D>>>0<=q>>>0){l=59;break a}if((f[F+(r<<3)>>2]|0)>>>0>=(f[F+(q<<3)>>2]|0)>>>0)break;F=s+4|0;T=f[F>>2]|0;j=f[C>>2]|0;D=(f[k>>2]|0)-j>>3;if(D>>>0<=T>>>0){R=C;l=57;break a}else{s=F;S=C;r=T}}C=f[M>>2]|0;O=f[S>>2]|0;N=(f[S+4>>2]|0)-O>>3;D=O;j=D+(C<<3)|0;if(N>>>0>C>>>0)U=J;else{l=65;break a}do{U=U+-4|0;V=f[U>>2]|0;if(N>>>0<=V>>>0){l=66;break a}}while((f[D+(V<<3)>>2]|0)>>>0>=(f[j>>2]|0)>>>0);if(s>>>0>U>>>0){W=M;X=L;Y=s;break c}f[s>>2]=V;f[U>>2]=r;K=s+4|0;Q=f[K>>2]|0;if(N>>>0<=Q>>>0){R=S;l=57;break a}else{J=U;L=L+1|0;M=(M|0)==(s|0)?U:M;P=S}}}else{W=m;X=u;Y=B}while(0);if((Y|0)!=(W|0)){B=f[W>>2]|0;j=f[Y>>2]|0;Z=f[c>>2]|0;D=f[Z>>2]|0;C=(f[Z+4>>2]|0)-D>>3;if(C>>>0<=B>>>0){l=72;break a}k=D;if(C>>>0<=j>>>0){l=74;break a}if((f[k+(B<<3)>>2]|0)>>>0<(f[k+(j<<3)>>2]|0)>>>0){f[Y>>2]=B;f[W>>2]=j;_=X+1|0}else _=X}else _=X;if(!_){$=_d(h,Y,c)|0;j=Y+4|0;if(_d(j,a,c)|0){l=83;break}if($){g=j;continue}}j=Y;if((j-i|0)>=(b-j|0)){l=82;break}Fb(h,Y,c);g=Y+4|0}if((l|0)==82){l=0;Fb(Y+4|0,a,c);d=h;a=Y;continue}else if((l|0)==83){l=0;if($){l=84;break}else{d=h;a=Y;continue}}}switch(l|0){case 5:{l=f[e>>2]|0;Y=f[h>>2]|0;d=f[c>>2]|0;$=f[d>>2]|0;i=(f[d+4>>2]|0)-$>>3;if(i>>>0<=l>>>0)aq(d);_=$;if(i>>>0<=Y>>>0)aq(d);if((f[_+(l<<3)>>2]|0)>>>0>=(f[_+(Y<<3)>>2]|0)>>>0)return;f[h>>2]=l;f[e>>2]=Y;return}case 11:{Vg(h,h+4|0,e,c)|0;return}case 12:{jh(h,h+4|0,h+8|0,e,c)|0;return}case 13:{ig(h,h+4|0,h+8|0,h+12|0,e,c)|0;return}case 15:{ih(h,a,c);return}case 20:{aq(p);break}case 22:{aq(p);break}case 26:{aq(p);break}case 32:{aq(p);break}case 38:{aq(A);break}case 40:{aq(A);break}case 46:{aq(A);break}case 47:{aq(A);break}case 51:{aq(p);break}case 57:{aq(R);break}case 59:{aq(S);break}case 65:{if(N>>>0>(f[J+-4>>2]|0)>>>0)aq(S);else aq(S);break}case 66:{aq(S);break}case 72:{aq(Z);break}case 74:{aq(Z);break}case 84:return}}function Gb(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,$=0;d=a;a=b;a:while(1){b=a;e=a+-4|0;g=d;while(1){h=g;b:while(1){i=h;j=b-i|0;k=j>>2;switch(k|0){case 2:{l=5;break a;break}case 3:{l=11;break a;break}case 4:{l=12;break a;break}case 5:{l=13;break a;break}case 1:case 0:{l=84;break a;break}default:{}}if((j|0)<124){l=15;break a}m=h+(((k|0)/2|0)<<2)|0;if((j|0)>3996){j=(k|0)/4|0;n=ig(h,h+(j<<2)|0,m,m+(j<<2)|0,e,c)|0}else n=Vg(h,m,e,c)|0;o=f[h>>2]|0;j=f[m>>2]|0;p=f[c>>2]|0;k=f[p>>2]|0;q=(f[p+4>>2]|0)-k>>3;if(q>>>0<=o>>>0){l=20;break a}r=k;if(q>>>0<=j>>>0){l=22;break a}k=f[r+(o<<3)>>2]|0;s=f[r+(j<<3)>>2]|0;if(k>>>0>>0){t=e;u=n;break}else v=e;while(1){v=v+-4|0;if((h|0)==(v|0))break;w=f[v>>2]|0;if(q>>>0<=w>>>0){l=51;break a}if((f[r+(w<<3)>>2]|0)>>>0>>0){l=53;break b}}s=h+4|0;j=f[e>>2]|0;if(q>>>0<=j>>>0){l=26;break a}if(k>>>0<(f[r+(j<<3)>>2]|0)>>>0)x=s;else{if((s|0)==(e|0)){l=84;break a}else y=s;while(1){z=f[y>>2]|0;if(q>>>0<=z>>>0){l=32;break a}if(k>>>0<(f[r+(z<<3)>>2]|0)>>>0)break;s=y+4|0;if((s|0)==(e|0)){l=84;break a}else y=s}f[y>>2]=j;f[e>>2]=z;x=y+4|0}if((x|0)==(e|0)){l=84;break a}r=f[h>>2]|0;A=f[c>>2]|0;k=f[A>>2]|0;q=(f[A+4>>2]|0)-k>>3;if(q>>>0<=r>>>0){l=38;break a}s=k;k=e;B=x;C=r;while(1){r=s+(C<<3)|0;D=q>>>0>C>>>0;E=B;while(1){F=f[E>>2]|0;if(q>>>0<=F>>>0){l=40;break a}G=f[r>>2]|0;if(G>>>0<(f[s+(F<<3)>>2]|0)>>>0)break;if(D)E=E+4|0;else{l=38;break a}}if(q>>>0>C>>>0)H=k;else{l=46;break a}do{H=H+-4|0;I=f[H>>2]|0;if(q>>>0<=I>>>0){l=47;break a}}while(G>>>0<(f[s+(I<<3)>>2]|0)>>>0);if(E>>>0>=H>>>0){h=E;continue b}D=f[E>>2]|0;f[E>>2]=I;f[H>>2]=D;C=f[h>>2]|0;if(q>>>0<=C>>>0){l=38;break a}else{k=H;B=E+4|0}}}if((l|0)==53){l=0;f[h>>2]=w;f[v>>2]=o;t=v;u=n+1|0}B=h+4|0;c:do if(B>>>0>>0){k=f[B>>2]|0;C=f[c>>2]|0;q=f[C>>2]|0;s=(f[C+4>>2]|0)-q>>3;if(s>>>0>k>>>0){J=t;K=B;L=u;M=m;N=s;O=q;P=C;Q=k}else{R=C;l=57;break a}while(1){C=f[c>>2]|0;k=C+4|0;q=f[M>>2]|0;s=K;j=O;D=N;S=P;r=Q;while(1){F=j;if(D>>>0<=q>>>0){l=59;break a}if((f[F+(r<<3)>>2]|0)>>>0>=(f[F+(q<<3)>>2]|0)>>>0)break;F=s+4|0;T=f[F>>2]|0;j=f[C>>2]|0;D=(f[k>>2]|0)-j>>3;if(D>>>0<=T>>>0){R=C;l=57;break a}else{s=F;S=C;r=T}}C=f[M>>2]|0;O=f[S>>2]|0;N=(f[S+4>>2]|0)-O>>3;D=O;j=D+(C<<3)|0;if(N>>>0>C>>>0)U=J;else{l=65;break a}do{U=U+-4|0;V=f[U>>2]|0;if(N>>>0<=V>>>0){l=66;break a}}while((f[D+(V<<3)>>2]|0)>>>0>=(f[j>>2]|0)>>>0);if(s>>>0>U>>>0){W=M;X=L;Y=s;break c}f[s>>2]=V;f[U>>2]=r;K=s+4|0;Q=f[K>>2]|0;if(N>>>0<=Q>>>0){R=S;l=57;break a}else{J=U;L=L+1|0;M=(M|0)==(s|0)?U:M;P=S}}}else{W=m;X=u;Y=B}while(0);if((Y|0)!=(W|0)){B=f[W>>2]|0;j=f[Y>>2]|0;Z=f[c>>2]|0;D=f[Z>>2]|0;C=(f[Z+4>>2]|0)-D>>3;if(C>>>0<=B>>>0){l=72;break a}k=D;if(C>>>0<=j>>>0){l=74;break a}if((f[k+(B<<3)>>2]|0)>>>0<(f[k+(j<<3)>>2]|0)>>>0){f[Y>>2]=B;f[W>>2]=j;_=X+1|0}else _=X}else _=X;if(!_){$=_d(h,Y,c)|0;j=Y+4|0;if(_d(j,a,c)|0){l=83;break}if($){g=j;continue}}j=Y;if((j-i|0)>=(b-j|0)){l=82;break}Gb(h,Y,c);g=Y+4|0}if((l|0)==82){l=0;Gb(Y+4|0,a,c);d=h;a=Y;continue}else if((l|0)==83){l=0;if($){l=84;break}else{d=h;a=Y;continue}}}switch(l|0){case 5:{l=f[e>>2]|0;Y=f[h>>2]|0;d=f[c>>2]|0;$=f[d>>2]|0;i=(f[d+4>>2]|0)-$>>3;if(i>>>0<=l>>>0)aq(d);_=$;if(i>>>0<=Y>>>0)aq(d);if((f[_+(l<<3)>>2]|0)>>>0>=(f[_+(Y<<3)>>2]|0)>>>0)return;f[h>>2]=l;f[e>>2]=Y;return}case 11:{Vg(h,h+4|0,e,c)|0;return}case 12:{jh(h,h+4|0,h+8|0,e,c)|0;return}case 13:{ig(h,h+4|0,h+8|0,h+12|0,e,c)|0;return}case 15:{ih(h,a,c);return}case 20:{aq(p);break}case 22:{aq(p);break}case 26:{aq(p);break}case 32:{aq(p);break}case 38:{aq(A);break}case 40:{aq(A);break}case 46:{aq(A);break}case 47:{aq(A);break}case 51:{aq(p);break}case 57:{aq(R);break}case 59:{aq(S);break}case 65:{if(N>>>0>(f[J+-4>>2]|0)>>>0)aq(S);else aq(S);break}case 66:{aq(S);break}case 72:{aq(Z);break}case 74:{aq(Z);break}case 84:return}}function Hb(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,$=0;d=a;a=b;a:while(1){b=a;e=a+-4|0;g=d;while(1){h=g;b:while(1){i=h;j=b-i|0;k=j>>2;switch(k|0){case 2:{l=5;break a;break}case 3:{l=11;break a;break}case 4:{l=12;break a;break}case 5:{l=13;break a;break}case 1:case 0:{l=84;break a;break}default:{}}if((j|0)<124){l=15;break a}m=h+(((k|0)/2|0)<<2)|0;if((j|0)>3996){j=(k|0)/4|0;n=ig(h,h+(j<<2)|0,m,m+(j<<2)|0,e,c)|0}else n=Vg(h,m,e,c)|0;o=f[h>>2]|0;j=f[m>>2]|0;p=f[c>>2]|0;k=f[p>>2]|0;q=(f[p+4>>2]|0)-k>>3;if(q>>>0<=o>>>0){l=20;break a}r=k;if(q>>>0<=j>>>0){l=22;break a}k=f[r+(o<<3)>>2]|0;s=f[r+(j<<3)>>2]|0;if(k>>>0>>0){t=e;u=n;break}else v=e;while(1){v=v+-4|0;if((h|0)==(v|0))break;w=f[v>>2]|0;if(q>>>0<=w>>>0){l=51;break a}if((f[r+(w<<3)>>2]|0)>>>0>>0){l=53;break b}}s=h+4|0;j=f[e>>2]|0;if(q>>>0<=j>>>0){l=26;break a}if(k>>>0<(f[r+(j<<3)>>2]|0)>>>0)x=s;else{if((s|0)==(e|0)){l=84;break a}else y=s;while(1){z=f[y>>2]|0;if(q>>>0<=z>>>0){l=32;break a}if(k>>>0<(f[r+(z<<3)>>2]|0)>>>0)break;s=y+4|0;if((s|0)==(e|0)){l=84;break a}else y=s}f[y>>2]=j;f[e>>2]=z;x=y+4|0}if((x|0)==(e|0)){l=84;break a}r=f[h>>2]|0;A=f[c>>2]|0;k=f[A>>2]|0;q=(f[A+4>>2]|0)-k>>3;if(q>>>0<=r>>>0){l=38;break a}s=k;k=e;B=x;C=r;while(1){r=s+(C<<3)|0;D=q>>>0>C>>>0;E=B;while(1){F=f[E>>2]|0;if(q>>>0<=F>>>0){l=40;break a}G=f[r>>2]|0;if(G>>>0<(f[s+(F<<3)>>2]|0)>>>0)break;if(D)E=E+4|0;else{l=38;break a}}if(q>>>0>C>>>0)H=k;else{l=46;break a}do{H=H+-4|0;I=f[H>>2]|0;if(q>>>0<=I>>>0){l=47;break a}}while(G>>>0<(f[s+(I<<3)>>2]|0)>>>0);if(E>>>0>=H>>>0){h=E;continue b}D=f[E>>2]|0;f[E>>2]=I;f[H>>2]=D;C=f[h>>2]|0;if(q>>>0<=C>>>0){l=38;break a}else{k=H;B=E+4|0}}}if((l|0)==53){l=0;f[h>>2]=w;f[v>>2]=o;t=v;u=n+1|0}B=h+4|0;c:do if(B>>>0>>0){k=f[B>>2]|0;C=f[c>>2]|0;q=f[C>>2]|0;s=(f[C+4>>2]|0)-q>>3;if(s>>>0>k>>>0){J=t;K=B;L=u;M=m;N=s;O=q;P=C;Q=k}else{R=C;l=57;break a}while(1){C=f[c>>2]|0;k=C+4|0;q=f[M>>2]|0;s=K;j=O;D=N;S=P;r=Q;while(1){F=j;if(D>>>0<=q>>>0){l=59;break a}if((f[F+(r<<3)>>2]|0)>>>0>=(f[F+(q<<3)>>2]|0)>>>0)break;F=s+4|0;T=f[F>>2]|0;j=f[C>>2]|0;D=(f[k>>2]|0)-j>>3;if(D>>>0<=T>>>0){R=C;l=57;break a}else{s=F;S=C;r=T}}C=f[M>>2]|0;O=f[S>>2]|0;N=(f[S+4>>2]|0)-O>>3;D=O;j=D+(C<<3)|0;if(N>>>0>C>>>0)U=J;else{l=65;break a}do{U=U+-4|0;V=f[U>>2]|0;if(N>>>0<=V>>>0){l=66;break a}}while((f[D+(V<<3)>>2]|0)>>>0>=(f[j>>2]|0)>>>0);if(s>>>0>U>>>0){W=M;X=L;Y=s;break c}f[s>>2]=V;f[U>>2]=r;K=s+4|0;Q=f[K>>2]|0;if(N>>>0<=Q>>>0){R=S;l=57;break a}else{J=U;L=L+1|0;M=(M|0)==(s|0)?U:M;P=S}}}else{W=m;X=u;Y=B}while(0);if((Y|0)!=(W|0)){B=f[W>>2]|0;j=f[Y>>2]|0;Z=f[c>>2]|0;D=f[Z>>2]|0;C=(f[Z+4>>2]|0)-D>>3;if(C>>>0<=B>>>0){l=72;break a}k=D;if(C>>>0<=j>>>0){l=74;break a}if((f[k+(B<<3)>>2]|0)>>>0<(f[k+(j<<3)>>2]|0)>>>0){f[Y>>2]=B;f[W>>2]=j;_=X+1|0}else _=X}else _=X;if(!_){$=_d(h,Y,c)|0;j=Y+4|0;if(_d(j,a,c)|0){l=83;break}if($){g=j;continue}}j=Y;if((j-i|0)>=(b-j|0)){l=82;break}Hb(h,Y,c);g=Y+4|0}if((l|0)==82){l=0;Hb(Y+4|0,a,c);d=h;a=Y;continue}else if((l|0)==83){l=0;if($){l=84;break}else{d=h;a=Y;continue}}}switch(l|0){case 5:{l=f[e>>2]|0;Y=f[h>>2]|0;d=f[c>>2]|0;$=f[d>>2]|0;i=(f[d+4>>2]|0)-$>>3;if(i>>>0<=l>>>0)aq(d);_=$;if(i>>>0<=Y>>>0)aq(d);if((f[_+(l<<3)>>2]|0)>>>0>=(f[_+(Y<<3)>>2]|0)>>>0)return;f[h>>2]=l;f[e>>2]=Y;return}case 11:{Vg(h,h+4|0,e,c)|0;return}case 12:{jh(h,h+4|0,h+8|0,e,c)|0;return}case 13:{ig(h,h+4|0,h+8|0,h+12|0,e,c)|0;return}case 15:{ih(h,a,c);return}case 20:{aq(p);break}case 22:{aq(p);break}case 26:{aq(p);break}case 32:{aq(p);break}case 38:{aq(A);break}case 40:{aq(A);break}case 46:{aq(A);break}case 47:{aq(A);break}case 51:{aq(p);break}case 57:{aq(R);break}case 59:{aq(S);break}case 65:{if(N>>>0>(f[J+-4>>2]|0)>>>0)aq(S);else aq(S);break}case 66:{aq(S);break}case 72:{aq(Z);break}case 74:{aq(Z);break}case 84:return}}function Ib(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,$=0;d=a;a=b;a:while(1){b=a;e=a+-4|0;g=d;while(1){h=g;b:while(1){i=h;j=b-i|0;k=j>>2;switch(k|0){case 2:{l=5;break a;break}case 3:{l=11;break a;break}case 4:{l=12;break a;break}case 5:{l=13;break a;break}case 1:case 0:{l=84;break a;break}default:{}}if((j|0)<124){l=15;break a}m=h+(((k|0)/2|0)<<2)|0;if((j|0)>3996){j=(k|0)/4|0;n=ig(h,h+(j<<2)|0,m,m+(j<<2)|0,e,c)|0}else n=Vg(h,m,e,c)|0;o=f[h>>2]|0;j=f[m>>2]|0;p=f[c>>2]|0;k=f[p>>2]|0;q=(f[p+4>>2]|0)-k>>3;if(q>>>0<=o>>>0){l=20;break a}r=k;if(q>>>0<=j>>>0){l=22;break a}k=f[r+(o<<3)>>2]|0;s=f[r+(j<<3)>>2]|0;if(k>>>0>>0){t=e;u=n;break}else v=e;while(1){v=v+-4|0;if((h|0)==(v|0))break;w=f[v>>2]|0;if(q>>>0<=w>>>0){l=51;break a}if((f[r+(w<<3)>>2]|0)>>>0>>0){l=53;break b}}s=h+4|0;j=f[e>>2]|0;if(q>>>0<=j>>>0){l=26;break a}if(k>>>0<(f[r+(j<<3)>>2]|0)>>>0)x=s;else{if((s|0)==(e|0)){l=84;break a}else y=s;while(1){z=f[y>>2]|0;if(q>>>0<=z>>>0){l=32;break a}if(k>>>0<(f[r+(z<<3)>>2]|0)>>>0)break;s=y+4|0;if((s|0)==(e|0)){l=84;break a}else y=s}f[y>>2]=j;f[e>>2]=z;x=y+4|0}if((x|0)==(e|0)){l=84;break a}r=f[h>>2]|0;A=f[c>>2]|0;k=f[A>>2]|0;q=(f[A+4>>2]|0)-k>>3;if(q>>>0<=r>>>0){l=38;break a}s=k;k=e;B=x;C=r;while(1){r=s+(C<<3)|0;D=q>>>0>C>>>0;E=B;while(1){F=f[E>>2]|0;if(q>>>0<=F>>>0){l=40;break a}G=f[r>>2]|0;if(G>>>0<(f[s+(F<<3)>>2]|0)>>>0)break;if(D)E=E+4|0;else{l=38;break a}}if(q>>>0>C>>>0)H=k;else{l=46;break a}do{H=H+-4|0;I=f[H>>2]|0;if(q>>>0<=I>>>0){l=47;break a}}while(G>>>0<(f[s+(I<<3)>>2]|0)>>>0);if(E>>>0>=H>>>0){h=E;continue b}D=f[E>>2]|0;f[E>>2]=I;f[H>>2]=D;C=f[h>>2]|0;if(q>>>0<=C>>>0){l=38;break a}else{k=H;B=E+4|0}}}if((l|0)==53){l=0;f[h>>2]=w;f[v>>2]=o;t=v;u=n+1|0}B=h+4|0;c:do if(B>>>0>>0){k=f[B>>2]|0;C=f[c>>2]|0;q=f[C>>2]|0;s=(f[C+4>>2]|0)-q>>3;if(s>>>0>k>>>0){J=t;K=B;L=u;M=m;N=s;O=q;P=C;Q=k}else{R=C;l=57;break a}while(1){C=f[c>>2]|0;k=C+4|0;q=f[M>>2]|0;s=K;j=O;D=N;S=P;r=Q;while(1){F=j;if(D>>>0<=q>>>0){l=59;break a}if((f[F+(r<<3)>>2]|0)>>>0>=(f[F+(q<<3)>>2]|0)>>>0)break;F=s+4|0;T=f[F>>2]|0;j=f[C>>2]|0;D=(f[k>>2]|0)-j>>3;if(D>>>0<=T>>>0){R=C;l=57;break a}else{s=F;S=C;r=T}}C=f[M>>2]|0;O=f[S>>2]|0;N=(f[S+4>>2]|0)-O>>3;D=O;j=D+(C<<3)|0;if(N>>>0>C>>>0)U=J;else{l=65;break a}do{U=U+-4|0;V=f[U>>2]|0;if(N>>>0<=V>>>0){l=66;break a}}while((f[D+(V<<3)>>2]|0)>>>0>=(f[j>>2]|0)>>>0);if(s>>>0>U>>>0){W=M;X=L;Y=s;break c}f[s>>2]=V;f[U>>2]=r;K=s+4|0;Q=f[K>>2]|0;if(N>>>0<=Q>>>0){R=S;l=57;break a}else{J=U;L=L+1|0;M=(M|0)==(s|0)?U:M;P=S}}}else{W=m;X=u;Y=B}while(0);if((Y|0)!=(W|0)){B=f[W>>2]|0;j=f[Y>>2]|0;Z=f[c>>2]|0;D=f[Z>>2]|0;C=(f[Z+4>>2]|0)-D>>3;if(C>>>0<=B>>>0){l=72;break a}k=D;if(C>>>0<=j>>>0){l=74;break a}if((f[k+(B<<3)>>2]|0)>>>0<(f[k+(j<<3)>>2]|0)>>>0){f[Y>>2]=B;f[W>>2]=j;_=X+1|0}else _=X}else _=X;if(!_){$=_d(h,Y,c)|0;j=Y+4|0;if(_d(j,a,c)|0){l=83;break}if($){g=j;continue}}j=Y;if((j-i|0)>=(b-j|0)){l=82;break}Ib(h,Y,c);g=Y+4|0}if((l|0)==82){l=0;Ib(Y+4|0,a,c);d=h;a=Y;continue}else if((l|0)==83){l=0;if($){l=84;break}else{d=h;a=Y;continue}}}switch(l|0){case 5:{l=f[e>>2]|0;Y=f[h>>2]|0;d=f[c>>2]|0;$=f[d>>2]|0;i=(f[d+4>>2]|0)-$>>3;if(i>>>0<=l>>>0)aq(d);_=$;if(i>>>0<=Y>>>0)aq(d);if((f[_+(l<<3)>>2]|0)>>>0>=(f[_+(Y<<3)>>2]|0)>>>0)return;f[h>>2]=l;f[e>>2]=Y;return}case 11:{Vg(h,h+4|0,e,c)|0;return}case 12:{jh(h,h+4|0,h+8|0,e,c)|0;return}case 13:{ig(h,h+4|0,h+8|0,h+12|0,e,c)|0;return}case 15:{ih(h,a,c);return}case 20:{aq(p);break}case 22:{aq(p);break}case 26:{aq(p);break}case 32:{aq(p);break}case 38:{aq(A);break}case 40:{aq(A);break}case 46:{aq(A);break}case 47:{aq(A);break}case 51:{aq(p);break}case 57:{aq(R);break}case 59:{aq(S);break}case 65:{if(N>>>0>(f[J+-4>>2]|0)>>>0)aq(S);else aq(S);break}case 66:{aq(S);break}case 72:{aq(Z);break}case 74:{aq(Z);break}case 84:return}}function Jb(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,$=0;d=a;a=b;a:while(1){b=a;e=a+-4|0;g=d;while(1){h=g;b:while(1){i=h;j=b-i|0;k=j>>2;switch(k|0){case 2:{l=5;break a;break}case 3:{l=11;break a;break}case 4:{l=12;break a;break}case 5:{l=13;break a;break}case 1:case 0:{l=84;break a;break}default:{}}if((j|0)<124){l=15;break a}m=h+(((k|0)/2|0)<<2)|0;if((j|0)>3996){j=(k|0)/4|0;n=ig(h,h+(j<<2)|0,m,m+(j<<2)|0,e,c)|0}else n=Vg(h,m,e,c)|0;o=f[h>>2]|0;j=f[m>>2]|0;p=f[c>>2]|0;k=f[p>>2]|0;q=(f[p+4>>2]|0)-k>>3;if(q>>>0<=o>>>0){l=20;break a}r=k;if(q>>>0<=j>>>0){l=22;break a}k=f[r+(o<<3)>>2]|0;s=f[r+(j<<3)>>2]|0;if(k>>>0>>0){t=e;u=n;break}else v=e;while(1){v=v+-4|0;if((h|0)==(v|0))break;w=f[v>>2]|0;if(q>>>0<=w>>>0){l=51;break a}if((f[r+(w<<3)>>2]|0)>>>0>>0){l=53;break b}}s=h+4|0;j=f[e>>2]|0;if(q>>>0<=j>>>0){l=26;break a}if(k>>>0<(f[r+(j<<3)>>2]|0)>>>0)x=s;else{if((s|0)==(e|0)){l=84;break a}else y=s;while(1){z=f[y>>2]|0;if(q>>>0<=z>>>0){l=32;break a}if(k>>>0<(f[r+(z<<3)>>2]|0)>>>0)break;s=y+4|0;if((s|0)==(e|0)){l=84;break a}else y=s}f[y>>2]=j;f[e>>2]=z;x=y+4|0}if((x|0)==(e|0)){l=84;break a}r=f[h>>2]|0;A=f[c>>2]|0;k=f[A>>2]|0;q=(f[A+4>>2]|0)-k>>3;if(q>>>0<=r>>>0){l=38;break a}s=k;k=e;B=x;C=r;while(1){r=s+(C<<3)|0;D=q>>>0>C>>>0;E=B;while(1){F=f[E>>2]|0;if(q>>>0<=F>>>0){l=40;break a}G=f[r>>2]|0;if(G>>>0<(f[s+(F<<3)>>2]|0)>>>0)break;if(D)E=E+4|0;else{l=38;break a}}if(q>>>0>C>>>0)H=k;else{l=46;break a}do{H=H+-4|0;I=f[H>>2]|0;if(q>>>0<=I>>>0){l=47;break a}}while(G>>>0<(f[s+(I<<3)>>2]|0)>>>0);if(E>>>0>=H>>>0){h=E;continue b}D=f[E>>2]|0;f[E>>2]=I;f[H>>2]=D;C=f[h>>2]|0;if(q>>>0<=C>>>0){l=38;break a}else{k=H;B=E+4|0}}}if((l|0)==53){l=0;f[h>>2]=w;f[v>>2]=o;t=v;u=n+1|0}B=h+4|0;c:do if(B>>>0>>0){k=f[B>>2]|0;C=f[c>>2]|0;q=f[C>>2]|0;s=(f[C+4>>2]|0)-q>>3;if(s>>>0>k>>>0){J=t;K=B;L=u;M=m;N=s;O=q;P=C;Q=k}else{R=C;l=57;break a}while(1){C=f[c>>2]|0;k=C+4|0;q=f[M>>2]|0;s=K;j=O;D=N;S=P;r=Q;while(1){F=j;if(D>>>0<=q>>>0){l=59;break a}if((f[F+(r<<3)>>2]|0)>>>0>=(f[F+(q<<3)>>2]|0)>>>0)break;F=s+4|0;T=f[F>>2]|0;j=f[C>>2]|0;D=(f[k>>2]|0)-j>>3;if(D>>>0<=T>>>0){R=C;l=57;break a}else{s=F;S=C;r=T}}C=f[M>>2]|0;O=f[S>>2]|0;N=(f[S+4>>2]|0)-O>>3;D=O;j=D+(C<<3)|0;if(N>>>0>C>>>0)U=J;else{l=65;break a}do{U=U+-4|0;V=f[U>>2]|0;if(N>>>0<=V>>>0){l=66;break a}}while((f[D+(V<<3)>>2]|0)>>>0>=(f[j>>2]|0)>>>0);if(s>>>0>U>>>0){W=M;X=L;Y=s;break c}f[s>>2]=V;f[U>>2]=r;K=s+4|0;Q=f[K>>2]|0;if(N>>>0<=Q>>>0){R=S;l=57;break a}else{J=U;L=L+1|0;M=(M|0)==(s|0)?U:M;P=S}}}else{W=m;X=u;Y=B}while(0);if((Y|0)!=(W|0)){B=f[W>>2]|0;j=f[Y>>2]|0;Z=f[c>>2]|0;D=f[Z>>2]|0;C=(f[Z+4>>2]|0)-D>>3;if(C>>>0<=B>>>0){l=72;break a}k=D;if(C>>>0<=j>>>0){l=74;break a}if((f[k+(B<<3)>>2]|0)>>>0<(f[k+(j<<3)>>2]|0)>>>0){f[Y>>2]=B;f[W>>2]=j;_=X+1|0}else _=X}else _=X;if(!_){$=_d(h,Y,c)|0;j=Y+4|0;if(_d(j,a,c)|0){l=83;break}if($){g=j;continue}}j=Y;if((j-i|0)>=(b-j|0)){l=82;break}Jb(h,Y,c);g=Y+4|0}if((l|0)==82){l=0;Jb(Y+4|0,a,c);d=h;a=Y;continue}else if((l|0)==83){l=0;if($){l=84;break}else{d=h;a=Y;continue}}}switch(l|0){case 5:{l=f[e>>2]|0;Y=f[h>>2]|0;d=f[c>>2]|0;$=f[d>>2]|0;i=(f[d+4>>2]|0)-$>>3;if(i>>>0<=l>>>0)aq(d);_=$;if(i>>>0<=Y>>>0)aq(d);if((f[_+(l<<3)>>2]|0)>>>0>=(f[_+(Y<<3)>>2]|0)>>>0)return;f[h>>2]=l;f[e>>2]=Y;return}case 11:{Vg(h,h+4|0,e,c)|0;return}case 12:{jh(h,h+4|0,h+8|0,e,c)|0;return}case 13:{ig(h,h+4|0,h+8|0,h+12|0,e,c)|0;return}case 15:{ih(h,a,c);return}case 20:{aq(p);break}case 22:{aq(p);break}case 26:{aq(p);break}case 32:{aq(p);break}case 38:{aq(A);break}case 40:{aq(A);break}case 46:{aq(A);break}case 47:{aq(A);break}case 51:{aq(p);break}case 57:{aq(R);break}case 59:{aq(S);break}case 65:{if(N>>>0>(f[J+-4>>2]|0)>>>0)aq(S);else aq(S);break}case 66:{aq(S);break}case 72:{aq(Z);break}case 74:{aq(Z);break}case 84:return}}function Kb(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,$=0;d=a;a=b;a:while(1){b=a;e=a+-4|0;g=d;while(1){h=g;b:while(1){i=h;j=b-i|0;k=j>>2;switch(k|0){case 2:{l=5;break a;break}case 3:{l=11;break a;break}case 4:{l=12;break a;break}case 5:{l=13;break a;break}case 1:case 0:{l=84;break a;break}default:{}}if((j|0)<124){l=15;break a}m=h+(((k|0)/2|0)<<2)|0;if((j|0)>3996){j=(k|0)/4|0;n=ig(h,h+(j<<2)|0,m,m+(j<<2)|0,e,c)|0}else n=Vg(h,m,e,c)|0;o=f[h>>2]|0;j=f[m>>2]|0;p=f[c>>2]|0;k=f[p>>2]|0;q=(f[p+4>>2]|0)-k>>3;if(q>>>0<=o>>>0){l=20;break a}r=k;if(q>>>0<=j>>>0){l=22;break a}k=f[r+(o<<3)>>2]|0;s=f[r+(j<<3)>>2]|0;if(k>>>0>>0){t=e;u=n;break}else v=e;while(1){v=v+-4|0;if((h|0)==(v|0))break;w=f[v>>2]|0;if(q>>>0<=w>>>0){l=51;break a}if((f[r+(w<<3)>>2]|0)>>>0>>0){l=53;break b}}s=h+4|0;j=f[e>>2]|0;if(q>>>0<=j>>>0){l=26;break a}if(k>>>0<(f[r+(j<<3)>>2]|0)>>>0)x=s;else{if((s|0)==(e|0)){l=84;break a}else y=s;while(1){z=f[y>>2]|0;if(q>>>0<=z>>>0){l=32;break a}if(k>>>0<(f[r+(z<<3)>>2]|0)>>>0)break;s=y+4|0;if((s|0)==(e|0)){l=84;break a}else y=s}f[y>>2]=j;f[e>>2]=z;x=y+4|0}if((x|0)==(e|0)){l=84;break a}r=f[h>>2]|0;A=f[c>>2]|0;k=f[A>>2]|0;q=(f[A+4>>2]|0)-k>>3;if(q>>>0<=r>>>0){l=38;break a}s=k;k=e;B=x;C=r;while(1){r=s+(C<<3)|0;D=q>>>0>C>>>0;E=B;while(1){F=f[E>>2]|0;if(q>>>0<=F>>>0){l=40;break a}G=f[r>>2]|0;if(G>>>0<(f[s+(F<<3)>>2]|0)>>>0)break;if(D)E=E+4|0;else{l=38;break a}}if(q>>>0>C>>>0)H=k;else{l=46;break a}do{H=H+-4|0;I=f[H>>2]|0;if(q>>>0<=I>>>0){l=47;break a}}while(G>>>0<(f[s+(I<<3)>>2]|0)>>>0);if(E>>>0>=H>>>0){h=E;continue b}D=f[E>>2]|0;f[E>>2]=I;f[H>>2]=D;C=f[h>>2]|0;if(q>>>0<=C>>>0){l=38;break a}else{k=H;B=E+4|0}}}if((l|0)==53){l=0;f[h>>2]=w;f[v>>2]=o;t=v;u=n+1|0}B=h+4|0;c:do if(B>>>0>>0){k=f[B>>2]|0;C=f[c>>2]|0;q=f[C>>2]|0;s=(f[C+4>>2]|0)-q>>3;if(s>>>0>k>>>0){J=t;K=B;L=u;M=m;N=s;O=q;P=C;Q=k}else{R=C;l=57;break a}while(1){C=f[c>>2]|0;k=C+4|0;q=f[M>>2]|0;s=K;j=O;D=N;S=P;r=Q;while(1){F=j;if(D>>>0<=q>>>0){l=59;break a}if((f[F+(r<<3)>>2]|0)>>>0>=(f[F+(q<<3)>>2]|0)>>>0)break;F=s+4|0;T=f[F>>2]|0;j=f[C>>2]|0;D=(f[k>>2]|0)-j>>3;if(D>>>0<=T>>>0){R=C;l=57;break a}else{s=F;S=C;r=T}}C=f[M>>2]|0;O=f[S>>2]|0;N=(f[S+4>>2]|0)-O>>3;D=O;j=D+(C<<3)|0;if(N>>>0>C>>>0)U=J;else{l=65;break a}do{U=U+-4|0;V=f[U>>2]|0;if(N>>>0<=V>>>0){l=66;break a}}while((f[D+(V<<3)>>2]|0)>>>0>=(f[j>>2]|0)>>>0);if(s>>>0>U>>>0){W=M;X=L;Y=s;break c}f[s>>2]=V;f[U>>2]=r;K=s+4|0;Q=f[K>>2]|0;if(N>>>0<=Q>>>0){R=S;l=57;break a}else{J=U;L=L+1|0;M=(M|0)==(s|0)?U:M;P=S}}}else{W=m;X=u;Y=B}while(0);if((Y|0)!=(W|0)){B=f[W>>2]|0;j=f[Y>>2]|0;Z=f[c>>2]|0;D=f[Z>>2]|0;C=(f[Z+4>>2]|0)-D>>3;if(C>>>0<=B>>>0){l=72;break a}k=D;if(C>>>0<=j>>>0){l=74;break a}if((f[k+(B<<3)>>2]|0)>>>0<(f[k+(j<<3)>>2]|0)>>>0){f[Y>>2]=B;f[W>>2]=j;_=X+1|0}else _=X}else _=X;if(!_){$=_d(h,Y,c)|0;j=Y+4|0;if(_d(j,a,c)|0){l=83;break}if($){g=j;continue}}j=Y;if((j-i|0)>=(b-j|0)){l=82;break}Kb(h,Y,c);g=Y+4|0}if((l|0)==82){l=0;Kb(Y+4|0,a,c);d=h;a=Y;continue}else if((l|0)==83){l=0;if($){l=84;break}else{d=h;a=Y;continue}}}switch(l|0){case 5:{l=f[e>>2]|0;Y=f[h>>2]|0;d=f[c>>2]|0;$=f[d>>2]|0;i=(f[d+4>>2]|0)-$>>3;if(i>>>0<=l>>>0)aq(d);_=$;if(i>>>0<=Y>>>0)aq(d);if((f[_+(l<<3)>>2]|0)>>>0>=(f[_+(Y<<3)>>2]|0)>>>0)return;f[h>>2]=l;f[e>>2]=Y;return}case 11:{Vg(h,h+4|0,e,c)|0;return}case 12:{jh(h,h+4|0,h+8|0,e,c)|0;return}case 13:{ig(h,h+4|0,h+8|0,h+12|0,e,c)|0;return}case 15:{ih(h,a,c);return}case 20:{aq(p);break}case 22:{aq(p);break}case 26:{aq(p);break}case 32:{aq(p);break}case 38:{aq(A);break}case 40:{aq(A);break}case 46:{aq(A);break}case 47:{aq(A);break}case 51:{aq(p);break}case 57:{aq(R);break}case 59:{aq(S);break}case 65:{if(N>>>0>(f[J+-4>>2]|0)>>>0)aq(S);else aq(S);break}case 66:{aq(S);break}case 72:{aq(Z);break}case 74:{aq(Z);break}case 84:return}}function Lb(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,$=0;d=a;a=b;a:while(1){b=a;e=a+-4|0;g=d;while(1){h=g;b:while(1){i=h;j=b-i|0;k=j>>2;switch(k|0){case 2:{l=5;break a;break}case 3:{l=11;break a;break}case 4:{l=12;break a;break}case 5:{l=13;break a;break}case 1:case 0:{l=84;break a;break}default:{}}if((j|0)<124){l=15;break a}m=h+(((k|0)/2|0)<<2)|0;if((j|0)>3996){j=(k|0)/4|0;n=ig(h,h+(j<<2)|0,m,m+(j<<2)|0,e,c)|0}else n=Vg(h,m,e,c)|0;o=f[h>>2]|0;j=f[m>>2]|0;p=f[c>>2]|0;k=f[p>>2]|0;q=(f[p+4>>2]|0)-k>>3;if(q>>>0<=o>>>0){l=20;break a}r=k;if(q>>>0<=j>>>0){l=22;break a}k=f[r+(o<<3)>>2]|0;s=f[r+(j<<3)>>2]|0;if(k>>>0>>0){t=e;u=n;break}else v=e;while(1){v=v+-4|0;if((h|0)==(v|0))break;w=f[v>>2]|0;if(q>>>0<=w>>>0){l=51;break a}if((f[r+(w<<3)>>2]|0)>>>0>>0){l=53;break b}}s=h+4|0;j=f[e>>2]|0;if(q>>>0<=j>>>0){l=26;break a}if(k>>>0<(f[r+(j<<3)>>2]|0)>>>0)x=s;else{if((s|0)==(e|0)){l=84;break a}else y=s;while(1){z=f[y>>2]|0;if(q>>>0<=z>>>0){l=32;break a}if(k>>>0<(f[r+(z<<3)>>2]|0)>>>0)break;s=y+4|0;if((s|0)==(e|0)){l=84;break a}else y=s}f[y>>2]=j;f[e>>2]=z;x=y+4|0}if((x|0)==(e|0)){l=84;break a}r=f[h>>2]|0;A=f[c>>2]|0;k=f[A>>2]|0;q=(f[A+4>>2]|0)-k>>3;if(q>>>0<=r>>>0){l=38;break a}s=k;k=e;B=x;C=r;while(1){r=s+(C<<3)|0;D=q>>>0>C>>>0;E=B;while(1){F=f[E>>2]|0;if(q>>>0<=F>>>0){l=40;break a}G=f[r>>2]|0;if(G>>>0<(f[s+(F<<3)>>2]|0)>>>0)break;if(D)E=E+4|0;else{l=38;break a}}if(q>>>0>C>>>0)H=k;else{l=46;break a}do{H=H+-4|0;I=f[H>>2]|0;if(q>>>0<=I>>>0){l=47;break a}}while(G>>>0<(f[s+(I<<3)>>2]|0)>>>0);if(E>>>0>=H>>>0){h=E;continue b}D=f[E>>2]|0;f[E>>2]=I;f[H>>2]=D;C=f[h>>2]|0;if(q>>>0<=C>>>0){l=38;break a}else{k=H;B=E+4|0}}}if((l|0)==53){l=0;f[h>>2]=w;f[v>>2]=o;t=v;u=n+1|0}B=h+4|0;c:do if(B>>>0>>0){k=f[B>>2]|0;C=f[c>>2]|0;q=f[C>>2]|0;s=(f[C+4>>2]|0)-q>>3;if(s>>>0>k>>>0){J=t;K=B;L=u;M=m;N=s;O=q;P=C;Q=k}else{R=C;l=57;break a}while(1){C=f[c>>2]|0;k=C+4|0;q=f[M>>2]|0;s=K;j=O;D=N;S=P;r=Q;while(1){F=j;if(D>>>0<=q>>>0){l=59;break a}if((f[F+(r<<3)>>2]|0)>>>0>=(f[F+(q<<3)>>2]|0)>>>0)break;F=s+4|0;T=f[F>>2]|0;j=f[C>>2]|0;D=(f[k>>2]|0)-j>>3;if(D>>>0<=T>>>0){R=C;l=57;break a}else{s=F;S=C;r=T}}C=f[M>>2]|0;O=f[S>>2]|0;N=(f[S+4>>2]|0)-O>>3;D=O;j=D+(C<<3)|0;if(N>>>0>C>>>0)U=J;else{l=65;break a}do{U=U+-4|0;V=f[U>>2]|0;if(N>>>0<=V>>>0){l=66;break a}}while((f[D+(V<<3)>>2]|0)>>>0>=(f[j>>2]|0)>>>0);if(s>>>0>U>>>0){W=M;X=L;Y=s;break c}f[s>>2]=V;f[U>>2]=r;K=s+4|0;Q=f[K>>2]|0;if(N>>>0<=Q>>>0){R=S;l=57;break a}else{J=U;L=L+1|0;M=(M|0)==(s|0)?U:M;P=S}}}else{W=m;X=u;Y=B}while(0);if((Y|0)!=(W|0)){B=f[W>>2]|0;j=f[Y>>2]|0;Z=f[c>>2]|0;D=f[Z>>2]|0;C=(f[Z+4>>2]|0)-D>>3;if(C>>>0<=B>>>0){l=72;break a}k=D;if(C>>>0<=j>>>0){l=74;break a}if((f[k+(B<<3)>>2]|0)>>>0<(f[k+(j<<3)>>2]|0)>>>0){f[Y>>2]=B;f[W>>2]=j;_=X+1|0}else _=X}else _=X;if(!_){$=_d(h,Y,c)|0;j=Y+4|0;if(_d(j,a,c)|0){l=83;break}if($){g=j;continue}}j=Y;if((j-i|0)>=(b-j|0)){l=82;break}Lb(h,Y,c);g=Y+4|0}if((l|0)==82){l=0;Lb(Y+4|0,a,c);d=h;a=Y;continue}else if((l|0)==83){l=0;if($){l=84;break}else{d=h;a=Y;continue}}}switch(l|0){case 5:{l=f[e>>2]|0;Y=f[h>>2]|0;d=f[c>>2]|0;$=f[d>>2]|0;i=(f[d+4>>2]|0)-$>>3;if(i>>>0<=l>>>0)aq(d);_=$;if(i>>>0<=Y>>>0)aq(d);if((f[_+(l<<3)>>2]|0)>>>0>=(f[_+(Y<<3)>>2]|0)>>>0)return;f[h>>2]=l;f[e>>2]=Y;return}case 11:{Vg(h,h+4|0,e,c)|0;return}case 12:{jh(h,h+4|0,h+8|0,e,c)|0;return}case 13:{ig(h,h+4|0,h+8|0,h+12|0,e,c)|0;return}case 15:{ih(h,a,c);return}case 20:{aq(p);break}case 22:{aq(p);break}case 26:{aq(p);break}case 32:{aq(p);break}case 38:{aq(A);break}case 40:{aq(A);break}case 46:{aq(A);break}case 47:{aq(A);break}case 51:{aq(p);break}case 57:{aq(R);break}case 59:{aq(S);break}case 65:{if(N>>>0>(f[J+-4>>2]|0)>>>0)aq(S);else aq(S);break}case 66:{aq(S);break}case 72:{aq(Z);break}case 74:{aq(Z);break}case 84:return}}function Mb(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,$=0;d=a;a=b;a:while(1){b=a;e=a+-4|0;g=d;while(1){h=g;b:while(1){i=h;j=b-i|0;k=j>>2;switch(k|0){case 2:{l=5;break a;break}case 3:{l=11;break a;break}case 4:{l=12;break a;break}case 5:{l=13;break a;break}case 1:case 0:{l=84;break a;break}default:{}}if((j|0)<124){l=15;break a}m=h+(((k|0)/2|0)<<2)|0;if((j|0)>3996){j=(k|0)/4|0;n=ig(h,h+(j<<2)|0,m,m+(j<<2)|0,e,c)|0}else n=Vg(h,m,e,c)|0;o=f[h>>2]|0;j=f[m>>2]|0;p=f[c>>2]|0;k=f[p>>2]|0;q=(f[p+4>>2]|0)-k>>3;if(q>>>0<=o>>>0){l=20;break a}r=k;if(q>>>0<=j>>>0){l=22;break a}k=f[r+(o<<3)>>2]|0;s=f[r+(j<<3)>>2]|0;if(k>>>0>>0){t=e;u=n;break}else v=e;while(1){v=v+-4|0;if((h|0)==(v|0))break;w=f[v>>2]|0;if(q>>>0<=w>>>0){l=51;break a}if((f[r+(w<<3)>>2]|0)>>>0>>0){l=53;break b}}s=h+4|0;j=f[e>>2]|0;if(q>>>0<=j>>>0){l=26;break a}if(k>>>0<(f[r+(j<<3)>>2]|0)>>>0)x=s;else{if((s|0)==(e|0)){l=84;break a}else y=s;while(1){z=f[y>>2]|0;if(q>>>0<=z>>>0){l=32;break a}if(k>>>0<(f[r+(z<<3)>>2]|0)>>>0)break;s=y+4|0;if((s|0)==(e|0)){l=84;break a}else y=s}f[y>>2]=j;f[e>>2]=z;x=y+4|0}if((x|0)==(e|0)){l=84;break a}r=f[h>>2]|0;A=f[c>>2]|0;k=f[A>>2]|0;q=(f[A+4>>2]|0)-k>>3;if(q>>>0<=r>>>0){l=38;break a}s=k;k=e;B=x;C=r;while(1){r=s+(C<<3)|0;D=q>>>0>C>>>0;E=B;while(1){F=f[E>>2]|0;if(q>>>0<=F>>>0){l=40;break a}G=f[r>>2]|0;if(G>>>0<(f[s+(F<<3)>>2]|0)>>>0)break;if(D)E=E+4|0;else{l=38;break a}}if(q>>>0>C>>>0)H=k;else{l=46;break a}do{H=H+-4|0;I=f[H>>2]|0;if(q>>>0<=I>>>0){l=47;break a}}while(G>>>0<(f[s+(I<<3)>>2]|0)>>>0);if(E>>>0>=H>>>0){h=E;continue b}D=f[E>>2]|0;f[E>>2]=I;f[H>>2]=D;C=f[h>>2]|0;if(q>>>0<=C>>>0){l=38;break a}else{k=H;B=E+4|0}}}if((l|0)==53){l=0;f[h>>2]=w;f[v>>2]=o;t=v;u=n+1|0}B=h+4|0;c:do if(B>>>0>>0){k=f[B>>2]|0;C=f[c>>2]|0;q=f[C>>2]|0;s=(f[C+4>>2]|0)-q>>3;if(s>>>0>k>>>0){J=t;K=B;L=u;M=m;N=s;O=q;P=C;Q=k}else{R=C;l=57;break a}while(1){C=f[c>>2]|0;k=C+4|0;q=f[M>>2]|0;s=K;j=O;D=N;S=P;r=Q;while(1){F=j;if(D>>>0<=q>>>0){l=59;break a}if((f[F+(r<<3)>>2]|0)>>>0>=(f[F+(q<<3)>>2]|0)>>>0)break;F=s+4|0;T=f[F>>2]|0;j=f[C>>2]|0;D=(f[k>>2]|0)-j>>3;if(D>>>0<=T>>>0){R=C;l=57;break a}else{s=F;S=C;r=T}}C=f[M>>2]|0;O=f[S>>2]|0;N=(f[S+4>>2]|0)-O>>3;D=O;j=D+(C<<3)|0;if(N>>>0>C>>>0)U=J;else{l=65;break a}do{U=U+-4|0;V=f[U>>2]|0;if(N>>>0<=V>>>0){l=66;break a}}while((f[D+(V<<3)>>2]|0)>>>0>=(f[j>>2]|0)>>>0);if(s>>>0>U>>>0){W=M;X=L;Y=s;break c}f[s>>2]=V;f[U>>2]=r;K=s+4|0;Q=f[K>>2]|0;if(N>>>0<=Q>>>0){R=S;l=57;break a}else{J=U;L=L+1|0;M=(M|0)==(s|0)?U:M;P=S}}}else{W=m;X=u;Y=B}while(0);if((Y|0)!=(W|0)){B=f[W>>2]|0;j=f[Y>>2]|0;Z=f[c>>2]|0;D=f[Z>>2]|0;C=(f[Z+4>>2]|0)-D>>3;if(C>>>0<=B>>>0){l=72;break a}k=D;if(C>>>0<=j>>>0){l=74;break a}if((f[k+(B<<3)>>2]|0)>>>0<(f[k+(j<<3)>>2]|0)>>>0){f[Y>>2]=B;f[W>>2]=j;_=X+1|0}else _=X}else _=X;if(!_){$=_d(h,Y,c)|0;j=Y+4|0;if(_d(j,a,c)|0){l=83;break}if($){g=j;continue}}j=Y;if((j-i|0)>=(b-j|0)){l=82;break}Mb(h,Y,c);g=Y+4|0}if((l|0)==82){l=0;Mb(Y+4|0,a,c);d=h;a=Y;continue}else if((l|0)==83){l=0;if($){l=84;break}else{d=h;a=Y;continue}}}switch(l|0){case 5:{l=f[e>>2]|0;Y=f[h>>2]|0;d=f[c>>2]|0;$=f[d>>2]|0;i=(f[d+4>>2]|0)-$>>3;if(i>>>0<=l>>>0)aq(d);_=$;if(i>>>0<=Y>>>0)aq(d);if((f[_+(l<<3)>>2]|0)>>>0>=(f[_+(Y<<3)>>2]|0)>>>0)return;f[h>>2]=l;f[e>>2]=Y;return}case 11:{Vg(h,h+4|0,e,c)|0;return}case 12:{jh(h,h+4|0,h+8|0,e,c)|0;return}case 13:{ig(h,h+4|0,h+8|0,h+12|0,e,c)|0;return}case 15:{ih(h,a,c);return}case 20:{aq(p);break}case 22:{aq(p);break}case 26:{aq(p);break}case 32:{aq(p);break}case 38:{aq(A);break}case 40:{aq(A);break}case 46:{aq(A);break}case 47:{aq(A);break}case 51:{aq(p);break}case 57:{aq(R);break}case 59:{aq(S);break}case 65:{if(N>>>0>(f[J+-4>>2]|0)>>>0)aq(S);else aq(S);break}case 66:{aq(S);break}case 72:{aq(Z);break}case 74:{aq(Z);break}case 84:return}}function Nb(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,$=0;d=a;a=b;a:while(1){b=a;e=a+-4|0;g=d;while(1){h=g;b:while(1){i=h;j=b-i|0;k=j>>2;switch(k|0){case 2:{l=5;break a;break}case 3:{l=11;break a;break}case 4:{l=12;break a;break}case 5:{l=13;break a;break}case 1:case 0:{l=84;break a;break}default:{}}if((j|0)<124){l=15;break a}m=h+(((k|0)/2|0)<<2)|0;if((j|0)>3996){j=(k|0)/4|0;n=ig(h,h+(j<<2)|0,m,m+(j<<2)|0,e,c)|0}else n=Vg(h,m,e,c)|0;o=f[h>>2]|0;j=f[m>>2]|0;p=f[c>>2]|0;k=f[p>>2]|0;q=(f[p+4>>2]|0)-k>>3;if(q>>>0<=o>>>0){l=20;break a}r=k;if(q>>>0<=j>>>0){l=22;break a}k=f[r+(o<<3)>>2]|0;s=f[r+(j<<3)>>2]|0;if(k>>>0>>0){t=e;u=n;break}else v=e;while(1){v=v+-4|0;if((h|0)==(v|0))break;w=f[v>>2]|0;if(q>>>0<=w>>>0){l=51;break a}if((f[r+(w<<3)>>2]|0)>>>0>>0){l=53;break b}}s=h+4|0;j=f[e>>2]|0;if(q>>>0<=j>>>0){l=26;break a}if(k>>>0<(f[r+(j<<3)>>2]|0)>>>0)x=s;else{if((s|0)==(e|0)){l=84;break a}else y=s;while(1){z=f[y>>2]|0;if(q>>>0<=z>>>0){l=32;break a}if(k>>>0<(f[r+(z<<3)>>2]|0)>>>0)break;s=y+4|0;if((s|0)==(e|0)){l=84;break a}else y=s}f[y>>2]=j;f[e>>2]=z;x=y+4|0}if((x|0)==(e|0)){l=84;break a}r=f[h>>2]|0;A=f[c>>2]|0;k=f[A>>2]|0;q=(f[A+4>>2]|0)-k>>3;if(q>>>0<=r>>>0){l=38;break a}s=k;k=e;B=x;C=r;while(1){r=s+(C<<3)|0;D=q>>>0>C>>>0;E=B;while(1){F=f[E>>2]|0;if(q>>>0<=F>>>0){l=40;break a}G=f[r>>2]|0;if(G>>>0<(f[s+(F<<3)>>2]|0)>>>0)break;if(D)E=E+4|0;else{l=38;break a}}if(q>>>0>C>>>0)H=k;else{l=46;break a}do{H=H+-4|0;I=f[H>>2]|0;if(q>>>0<=I>>>0){l=47;break a}}while(G>>>0<(f[s+(I<<3)>>2]|0)>>>0);if(E>>>0>=H>>>0){h=E;continue b}D=f[E>>2]|0;f[E>>2]=I;f[H>>2]=D;C=f[h>>2]|0;if(q>>>0<=C>>>0){l=38;break a}else{k=H;B=E+4|0}}}if((l|0)==53){l=0;f[h>>2]=w;f[v>>2]=o;t=v;u=n+1|0}B=h+4|0;c:do if(B>>>0>>0){k=f[B>>2]|0;C=f[c>>2]|0;q=f[C>>2]|0;s=(f[C+4>>2]|0)-q>>3;if(s>>>0>k>>>0){J=t;K=B;L=u;M=m;N=s;O=q;P=C;Q=k}else{R=C;l=57;break a}while(1){C=f[c>>2]|0;k=C+4|0;q=f[M>>2]|0;s=K;j=O;D=N;S=P;r=Q;while(1){F=j;if(D>>>0<=q>>>0){l=59;break a}if((f[F+(r<<3)>>2]|0)>>>0>=(f[F+(q<<3)>>2]|0)>>>0)break;F=s+4|0;T=f[F>>2]|0;j=f[C>>2]|0;D=(f[k>>2]|0)-j>>3;if(D>>>0<=T>>>0){R=C;l=57;break a}else{s=F;S=C;r=T}}C=f[M>>2]|0;O=f[S>>2]|0;N=(f[S+4>>2]|0)-O>>3;D=O;j=D+(C<<3)|0;if(N>>>0>C>>>0)U=J;else{l=65;break a}do{U=U+-4|0;V=f[U>>2]|0;if(N>>>0<=V>>>0){l=66;break a}}while((f[D+(V<<3)>>2]|0)>>>0>=(f[j>>2]|0)>>>0);if(s>>>0>U>>>0){W=M;X=L;Y=s;break c}f[s>>2]=V;f[U>>2]=r;K=s+4|0;Q=f[K>>2]|0;if(N>>>0<=Q>>>0){R=S;l=57;break a}else{J=U;L=L+1|0;M=(M|0)==(s|0)?U:M;P=S}}}else{W=m;X=u;Y=B}while(0);if((Y|0)!=(W|0)){B=f[W>>2]|0;j=f[Y>>2]|0;Z=f[c>>2]|0;D=f[Z>>2]|0;C=(f[Z+4>>2]|0)-D>>3;if(C>>>0<=B>>>0){l=72;break a}k=D;if(C>>>0<=j>>>0){l=74;break a}if((f[k+(B<<3)>>2]|0)>>>0<(f[k+(j<<3)>>2]|0)>>>0){f[Y>>2]=B;f[W>>2]=j;_=X+1|0}else _=X}else _=X;if(!_){$=_d(h,Y,c)|0;j=Y+4|0;if(_d(j,a,c)|0){l=83;break}if($){g=j;continue}}j=Y;if((j-i|0)>=(b-j|0)){l=82;break}Nb(h,Y,c);g=Y+4|0}if((l|0)==82){l=0;Nb(Y+4|0,a,c);d=h;a=Y;continue}else if((l|0)==83){l=0;if($){l=84;break}else{d=h;a=Y;continue}}}switch(l|0){case 5:{l=f[e>>2]|0;Y=f[h>>2]|0;d=f[c>>2]|0;$=f[d>>2]|0;i=(f[d+4>>2]|0)-$>>3;if(i>>>0<=l>>>0)aq(d);_=$;if(i>>>0<=Y>>>0)aq(d);if((f[_+(l<<3)>>2]|0)>>>0>=(f[_+(Y<<3)>>2]|0)>>>0)return;f[h>>2]=l;f[e>>2]=Y;return}case 11:{Vg(h,h+4|0,e,c)|0;return}case 12:{jh(h,h+4|0,h+8|0,e,c)|0;return}case 13:{ig(h,h+4|0,h+8|0,h+12|0,e,c)|0;return}case 15:{ih(h,a,c);return}case 20:{aq(p);break}case 22:{aq(p);break}case 26:{aq(p);break}case 32:{aq(p);break}case 38:{aq(A);break}case 40:{aq(A);break}case 46:{aq(A);break}case 47:{aq(A);break}case 51:{aq(p);break}case 57:{aq(R);break}case 59:{aq(S);break}case 65:{if(N>>>0>(f[J+-4>>2]|0)>>>0)aq(S);else aq(S);break}case 66:{aq(S);break}case 72:{aq(Z);break}case 74:{aq(Z);break}case 84:return}}function Ob(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,$=0;d=a;a=b;a:while(1){b=a;e=a+-4|0;g=d;while(1){h=g;b:while(1){i=h;j=b-i|0;k=j>>2;switch(k|0){case 2:{l=5;break a;break}case 3:{l=11;break a;break}case 4:{l=12;break a;break}case 5:{l=13;break a;break}case 1:case 0:{l=84;break a;break}default:{}}if((j|0)<124){l=15;break a}m=h+(((k|0)/2|0)<<2)|0;if((j|0)>3996){j=(k|0)/4|0;n=ig(h,h+(j<<2)|0,m,m+(j<<2)|0,e,c)|0}else n=Vg(h,m,e,c)|0;o=f[h>>2]|0;j=f[m>>2]|0;p=f[c>>2]|0;k=f[p>>2]|0;q=(f[p+4>>2]|0)-k>>3;if(q>>>0<=o>>>0){l=20;break a}r=k;if(q>>>0<=j>>>0){l=22;break a}k=f[r+(o<<3)>>2]|0;s=f[r+(j<<3)>>2]|0;if(k>>>0>>0){t=e;u=n;break}else v=e;while(1){v=v+-4|0;if((h|0)==(v|0))break;w=f[v>>2]|0;if(q>>>0<=w>>>0){l=51;break a}if((f[r+(w<<3)>>2]|0)>>>0>>0){l=53;break b}}s=h+4|0;j=f[e>>2]|0;if(q>>>0<=j>>>0){l=26;break a}if(k>>>0<(f[r+(j<<3)>>2]|0)>>>0)x=s;else{if((s|0)==(e|0)){l=84;break a}else y=s;while(1){z=f[y>>2]|0;if(q>>>0<=z>>>0){l=32;break a}if(k>>>0<(f[r+(z<<3)>>2]|0)>>>0)break;s=y+4|0;if((s|0)==(e|0)){l=84;break a}else y=s}f[y>>2]=j;f[e>>2]=z;x=y+4|0}if((x|0)==(e|0)){l=84;break a}r=f[h>>2]|0;A=f[c>>2]|0;k=f[A>>2]|0;q=(f[A+4>>2]|0)-k>>3;if(q>>>0<=r>>>0){l=38;break a}s=k;k=e;B=x;C=r;while(1){r=s+(C<<3)|0;D=q>>>0>C>>>0;E=B;while(1){F=f[E>>2]|0;if(q>>>0<=F>>>0){l=40;break a}G=f[r>>2]|0;if(G>>>0<(f[s+(F<<3)>>2]|0)>>>0)break;if(D)E=E+4|0;else{l=38;break a}}if(q>>>0>C>>>0)H=k;else{l=46;break a}do{H=H+-4|0;I=f[H>>2]|0;if(q>>>0<=I>>>0){l=47;break a}}while(G>>>0<(f[s+(I<<3)>>2]|0)>>>0);if(E>>>0>=H>>>0){h=E;continue b}D=f[E>>2]|0;f[E>>2]=I;f[H>>2]=D;C=f[h>>2]|0;if(q>>>0<=C>>>0){l=38;break a}else{k=H;B=E+4|0}}}if((l|0)==53){l=0;f[h>>2]=w;f[v>>2]=o;t=v;u=n+1|0}B=h+4|0;c:do if(B>>>0>>0){k=f[B>>2]|0;C=f[c>>2]|0;q=f[C>>2]|0;s=(f[C+4>>2]|0)-q>>3;if(s>>>0>k>>>0){J=t;K=B;L=u;M=m;N=s;O=q;P=C;Q=k}else{R=C;l=57;break a}while(1){C=f[c>>2]|0;k=C+4|0;q=f[M>>2]|0;s=K;j=O;D=N;S=P;r=Q;while(1){F=j;if(D>>>0<=q>>>0){l=59;break a}if((f[F+(r<<3)>>2]|0)>>>0>=(f[F+(q<<3)>>2]|0)>>>0)break;F=s+4|0;T=f[F>>2]|0;j=f[C>>2]|0;D=(f[k>>2]|0)-j>>3;if(D>>>0<=T>>>0){R=C;l=57;break a}else{s=F;S=C;r=T}}C=f[M>>2]|0;O=f[S>>2]|0;N=(f[S+4>>2]|0)-O>>3;D=O;j=D+(C<<3)|0;if(N>>>0>C>>>0)U=J;else{l=65;break a}do{U=U+-4|0;V=f[U>>2]|0;if(N>>>0<=V>>>0){l=66;break a}}while((f[D+(V<<3)>>2]|0)>>>0>=(f[j>>2]|0)>>>0);if(s>>>0>U>>>0){W=M;X=L;Y=s;break c}f[s>>2]=V;f[U>>2]=r;K=s+4|0;Q=f[K>>2]|0;if(N>>>0<=Q>>>0){R=S;l=57;break a}else{J=U;L=L+1|0;M=(M|0)==(s|0)?U:M;P=S}}}else{W=m;X=u;Y=B}while(0);if((Y|0)!=(W|0)){B=f[W>>2]|0;j=f[Y>>2]|0;Z=f[c>>2]|0;D=f[Z>>2]|0;C=(f[Z+4>>2]|0)-D>>3;if(C>>>0<=B>>>0){l=72;break a}k=D;if(C>>>0<=j>>>0){l=74;break a}if((f[k+(B<<3)>>2]|0)>>>0<(f[k+(j<<3)>>2]|0)>>>0){f[Y>>2]=B;f[W>>2]=j;_=X+1|0}else _=X}else _=X;if(!_){$=_d(h,Y,c)|0;j=Y+4|0;if(_d(j,a,c)|0){l=83;break}if($){g=j;continue}}j=Y;if((j-i|0)>=(b-j|0)){l=82;break}Ob(h,Y,c);g=Y+4|0}if((l|0)==82){l=0;Ob(Y+4|0,a,c);d=h;a=Y;continue}else if((l|0)==83){l=0;if($){l=84;break}else{d=h;a=Y;continue}}}switch(l|0){case 5:{l=f[e>>2]|0;Y=f[h>>2]|0;d=f[c>>2]|0;$=f[d>>2]|0;i=(f[d+4>>2]|0)-$>>3;if(i>>>0<=l>>>0)aq(d);_=$;if(i>>>0<=Y>>>0)aq(d);if((f[_+(l<<3)>>2]|0)>>>0>=(f[_+(Y<<3)>>2]|0)>>>0)return;f[h>>2]=l;f[e>>2]=Y;return}case 11:{Vg(h,h+4|0,e,c)|0;return}case 12:{jh(h,h+4|0,h+8|0,e,c)|0;return}case 13:{ig(h,h+4|0,h+8|0,h+12|0,e,c)|0;return}case 15:{ih(h,a,c);return}case 20:{aq(p);break}case 22:{aq(p);break}case 26:{aq(p);break}case 32:{aq(p);break}case 38:{aq(A);break}case 40:{aq(A);break}case 46:{aq(A);break}case 47:{aq(A);break}case 51:{aq(p);break}case 57:{aq(R);break}case 59:{aq(S);break}case 65:{if(N>>>0>(f[J+-4>>2]|0)>>>0)aq(S);else aq(S);break}case 66:{aq(S);break}case 72:{aq(Z);break}case 74:{aq(Z);break}case 84:return}}function Pb(a,c,e,g){a=a|0;c=c|0;e=e|0;g=g|0;var i=0,k=0,l=0,m=0,o=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0;if(!g){i=0;return i|0}do switch(f[a+28>>2]|0){case 1:{k=a+24|0;l=b[k>>0]|0;if((l<<24>>24>e<<24>>24?e:l)<<24>>24>0){m=f[f[a>>2]>>2]|0;o=a+40|0;q=un(f[o>>2]|0,f[o+4>>2]|0,f[c>>2]|0,0)|0;o=a+48|0;r=Vn(q|0,I|0,f[o>>2]|0,f[o+4>>2]|0)|0;o=m+r|0;r=0;while(1){f[g+(r<<2)>>2]=b[o>>0];r=r+1|0;m=b[k>>0]|0;if((r|0)>=((m<<24>>24>e<<24>>24?e:m)<<24>>24|0)){s=m;break}else o=o+1|0}}else s=l;o=s<<24>>24;if(s<<24>>24>=e<<24>>24){i=1;return i|0}sj(g+(o<<2)|0,0,(e<<24>>24)-o<<2|0)|0;i=1;return i|0}case 2:{o=a+24|0;r=b[o>>0]|0;if((r<<24>>24>e<<24>>24?e:r)<<24>>24>0){k=f[f[a>>2]>>2]|0;m=a+40|0;q=un(f[m>>2]|0,f[m+4>>2]|0,f[c>>2]|0,0)|0;m=a+48|0;t=Vn(q|0,I|0,f[m>>2]|0,f[m+4>>2]|0)|0;m=k+t|0;t=0;while(1){f[g+(t<<2)>>2]=h[m>>0];t=t+1|0;k=b[o>>0]|0;if((t|0)>=((k<<24>>24>e<<24>>24?e:k)<<24>>24|0)){u=k;break}else m=m+1|0}}else u=r;m=u<<24>>24;if(u<<24>>24>=e<<24>>24){i=1;return i|0}sj(g+(m<<2)|0,0,(e<<24>>24)-m<<2|0)|0;i=1;return i|0}case 3:{m=a+24|0;t=b[m>>0]|0;if((t<<24>>24>e<<24>>24?e:t)<<24>>24>0){o=f[f[a>>2]>>2]|0;l=a+40|0;k=un(f[l>>2]|0,f[l+4>>2]|0,f[c>>2]|0,0)|0;l=a+48|0;q=Vn(k|0,I|0,f[l>>2]|0,f[l+4>>2]|0)|0;l=o+q|0;q=0;while(1){f[g+(q<<2)>>2]=d[l>>1];q=q+1|0;o=b[m>>0]|0;if((q|0)>=((o<<24>>24>e<<24>>24?e:o)<<24>>24|0)){v=o;break}else l=l+2|0}}else v=t;l=v<<24>>24;if(v<<24>>24>=e<<24>>24){i=1;return i|0}sj(g+(l<<2)|0,0,(e<<24>>24)-l<<2|0)|0;i=1;return i|0}case 4:{l=a+24|0;q=b[l>>0]|0;if((q<<24>>24>e<<24>>24?e:q)<<24>>24>0){m=f[f[a>>2]>>2]|0;r=a+40|0;o=un(f[r>>2]|0,f[r+4>>2]|0,f[c>>2]|0,0)|0;r=a+48|0;k=Vn(o|0,I|0,f[r>>2]|0,f[r+4>>2]|0)|0;r=m+k|0;k=0;while(1){f[g+(k<<2)>>2]=j[r>>1];k=k+1|0;m=b[l>>0]|0;if((k|0)>=((m<<24>>24>e<<24>>24?e:m)<<24>>24|0)){w=m;break}else r=r+2|0}}else w=q;r=w<<24>>24;if(w<<24>>24>=e<<24>>24){i=1;return i|0}sj(g+(r<<2)|0,0,(e<<24>>24)-r<<2|0)|0;i=1;return i|0}case 5:{r=a+24|0;k=b[r>>0]|0;if((k<<24>>24>e<<24>>24?e:k)<<24>>24>0){l=f[f[a>>2]>>2]|0;t=a+40|0;m=un(f[t>>2]|0,f[t+4>>2]|0,f[c>>2]|0,0)|0;t=a+48|0;o=Vn(m|0,I|0,f[t>>2]|0,f[t+4>>2]|0)|0;t=l+o|0;o=0;while(1){f[g+(o<<2)>>2]=f[t>>2];o=o+1|0;l=b[r>>0]|0;if((o|0)>=((l<<24>>24>e<<24>>24?e:l)<<24>>24|0)){x=l;break}else t=t+4|0}}else x=k;t=x<<24>>24;if(x<<24>>24>=e<<24>>24){i=1;return i|0}sj(g+(t<<2)|0,0,(e<<24>>24)-t<<2|0)|0;i=1;return i|0}case 6:{t=a+24|0;o=b[t>>0]|0;if((o<<24>>24>e<<24>>24?e:o)<<24>>24>0){r=f[f[a>>2]>>2]|0;q=a+40|0;l=un(f[q>>2]|0,f[q+4>>2]|0,f[c>>2]|0,0)|0;q=a+48|0;m=Vn(l|0,I|0,f[q>>2]|0,f[q+4>>2]|0)|0;q=r+m|0;m=0;while(1){f[g+(m<<2)>>2]=f[q>>2];m=m+1|0;r=b[t>>0]|0;if((m|0)>=((r<<24>>24>e<<24>>24?e:r)<<24>>24|0)){y=r;break}else q=q+4|0}}else y=o;q=y<<24>>24;if(y<<24>>24>=e<<24>>24){i=1;return i|0}sj(g+(q<<2)|0,0,(e<<24>>24)-q<<2|0)|0;i=1;return i|0}case 7:{q=a+24|0;m=b[q>>0]|0;if((m<<24>>24>e<<24>>24?e:m)<<24>>24>0){t=f[f[a>>2]>>2]|0;k=a+40|0;r=un(f[k>>2]|0,f[k+4>>2]|0,f[c>>2]|0,0)|0;k=a+48|0;l=Vn(r|0,I|0,f[k>>2]|0,f[k+4>>2]|0)|0;k=t+l|0;l=0;while(1){f[g+(l<<2)>>2]=f[k>>2];l=l+1|0;t=b[q>>0]|0;if((l|0)>=((t<<24>>24>e<<24>>24?e:t)<<24>>24|0)){z=t;break}else k=k+8|0}}else z=m;k=z<<24>>24;if(z<<24>>24>=e<<24>>24){i=1;return i|0}sj(g+(k<<2)|0,0,(e<<24>>24)-k<<2|0)|0;i=1;return i|0}case 8:{k=a+24|0;l=b[k>>0]|0;if((l<<24>>24>e<<24>>24?e:l)<<24>>24>0){q=f[f[a>>2]>>2]|0;o=a+40|0;t=un(f[o>>2]|0,f[o+4>>2]|0,f[c>>2]|0,0)|0;o=a+48|0;r=Vn(t|0,I|0,f[o>>2]|0,f[o+4>>2]|0)|0;o=q+r|0;r=0;while(1){f[g+(r<<2)>>2]=f[o>>2];r=r+1|0;q=b[k>>0]|0;if((r|0)>=((q<<24>>24>e<<24>>24?e:q)<<24>>24|0)){A=q;break}else o=o+8|0}}else A=l;o=A<<24>>24;if(A<<24>>24>=e<<24>>24){i=1;return i|0}sj(g+(o<<2)|0,0,(e<<24>>24)-o<<2|0)|0;i=1;return i|0}case 9:{o=a+24|0;r=b[o>>0]|0;if((r<<24>>24>e<<24>>24?e:r)<<24>>24>0){k=f[f[a>>2]>>2]|0;m=a+40|0;q=un(f[m>>2]|0,f[m+4>>2]|0,f[c>>2]|0,0)|0;m=a+48|0;t=Vn(q|0,I|0,f[m>>2]|0,f[m+4>>2]|0)|0;m=k+t|0;t=0;while(1){k=~~$(n[m>>2])>>>0;f[g+(t<<2)>>2]=k;t=t+1|0;k=b[o>>0]|0;if((t|0)>=((k<<24>>24>e<<24>>24?e:k)<<24>>24|0)){B=k;break}else m=m+4|0}}else B=r;m=B<<24>>24;if(B<<24>>24>=e<<24>>24){i=1;return i|0}sj(g+(m<<2)|0,0,(e<<24>>24)-m<<2|0)|0;i=1;return i|0}case 10:{m=a+24|0;t=b[m>>0]|0;if((t<<24>>24>e<<24>>24?e:t)<<24>>24>0){o=f[f[a>>2]>>2]|0;l=a+40|0;k=un(f[l>>2]|0,f[l+4>>2]|0,f[c>>2]|0,0)|0;l=a+48|0;q=Vn(k|0,I|0,f[l>>2]|0,f[l+4>>2]|0)|0;l=o+q|0;q=0;while(1){f[g+(q<<2)>>2]=~~+p[l>>3]>>>0;q=q+1|0;o=b[m>>0]|0;if((q|0)>=((o<<24>>24>e<<24>>24?e:o)<<24>>24|0)){C=o;break}else l=l+8|0}}else C=t;l=C<<24>>24;if(C<<24>>24>=e<<24>>24){i=1;return i|0}sj(g+(l<<2)|0,0,(e<<24>>24)-l<<2|0)|0;i=1;return i|0}case 11:{l=a+24|0;q=b[l>>0]|0;if((q<<24>>24>e<<24>>24?e:q)<<24>>24>0){m=f[f[a>>2]>>2]|0;r=a+40|0;o=un(f[r>>2]|0,f[r+4>>2]|0,f[c>>2]|0,0)|0;r=a+48|0;k=Vn(o|0,I|0,f[r>>2]|0,f[r+4>>2]|0)|0;r=m+k|0;k=0;while(1){f[g+(k<<2)>>2]=h[r>>0];k=k+1|0;m=b[l>>0]|0;if((k|0)>=((m<<24>>24>e<<24>>24?e:m)<<24>>24|0)){D=m;break}else r=r+1|0}}else D=q;r=D<<24>>24;if(D<<24>>24>=e<<24>>24){i=1;return i|0}sj(g+(r<<2)|0,0,(e<<24>>24)-r<<2|0)|0;i=1;return i|0}default:{i=0;return i|0}}while(0);return 0}function Qb(a,c,e,g){a=a|0;c=c|0;e=e|0;g=g|0;var i=0,k=0,l=0,m=0,o=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0;if(!g){i=0;return i|0}do switch(f[a+28>>2]|0){case 1:{k=a+24|0;l=b[k>>0]|0;if((l<<24>>24>e<<24>>24?e:l)<<24>>24>0){m=f[f[a>>2]>>2]|0;o=a+40|0;q=un(f[o>>2]|0,f[o+4>>2]|0,f[c>>2]|0,0)|0;o=a+48|0;r=Vn(q|0,I|0,f[o>>2]|0,f[o+4>>2]|0)|0;o=m+r|0;r=0;while(1){f[g+(r<<2)>>2]=b[o>>0];r=r+1|0;m=b[k>>0]|0;if((r|0)>=((m<<24>>24>e<<24>>24?e:m)<<24>>24|0)){s=m;break}else o=o+1|0}}else s=l;o=s<<24>>24;if(s<<24>>24>=e<<24>>24){i=1;return i|0}sj(g+(o<<2)|0,0,(e<<24>>24)-o<<2|0)|0;i=1;return i|0}case 2:{o=a+24|0;r=b[o>>0]|0;if((r<<24>>24>e<<24>>24?e:r)<<24>>24>0){k=f[f[a>>2]>>2]|0;m=a+40|0;q=un(f[m>>2]|0,f[m+4>>2]|0,f[c>>2]|0,0)|0;m=a+48|0;t=Vn(q|0,I|0,f[m>>2]|0,f[m+4>>2]|0)|0;m=k+t|0;t=0;while(1){f[g+(t<<2)>>2]=h[m>>0];t=t+1|0;k=b[o>>0]|0;if((t|0)>=((k<<24>>24>e<<24>>24?e:k)<<24>>24|0)){u=k;break}else m=m+1|0}}else u=r;m=u<<24>>24;if(u<<24>>24>=e<<24>>24){i=1;return i|0}sj(g+(m<<2)|0,0,(e<<24>>24)-m<<2|0)|0;i=1;return i|0}case 3:{m=a+24|0;t=b[m>>0]|0;if((t<<24>>24>e<<24>>24?e:t)<<24>>24>0){o=f[f[a>>2]>>2]|0;l=a+40|0;k=un(f[l>>2]|0,f[l+4>>2]|0,f[c>>2]|0,0)|0;l=a+48|0;q=Vn(k|0,I|0,f[l>>2]|0,f[l+4>>2]|0)|0;l=o+q|0;q=0;while(1){f[g+(q<<2)>>2]=d[l>>1];q=q+1|0;o=b[m>>0]|0;if((q|0)>=((o<<24>>24>e<<24>>24?e:o)<<24>>24|0)){v=o;break}else l=l+2|0}}else v=t;l=v<<24>>24;if(v<<24>>24>=e<<24>>24){i=1;return i|0}sj(g+(l<<2)|0,0,(e<<24>>24)-l<<2|0)|0;i=1;return i|0}case 4:{l=a+24|0;q=b[l>>0]|0;if((q<<24>>24>e<<24>>24?e:q)<<24>>24>0){m=f[f[a>>2]>>2]|0;r=a+40|0;o=un(f[r>>2]|0,f[r+4>>2]|0,f[c>>2]|0,0)|0;r=a+48|0;k=Vn(o|0,I|0,f[r>>2]|0,f[r+4>>2]|0)|0;r=m+k|0;k=0;while(1){f[g+(k<<2)>>2]=j[r>>1];k=k+1|0;m=b[l>>0]|0;if((k|0)>=((m<<24>>24>e<<24>>24?e:m)<<24>>24|0)){w=m;break}else r=r+2|0}}else w=q;r=w<<24>>24;if(w<<24>>24>=e<<24>>24){i=1;return i|0}sj(g+(r<<2)|0,0,(e<<24>>24)-r<<2|0)|0;i=1;return i|0}case 5:{r=a+24|0;k=b[r>>0]|0;if((k<<24>>24>e<<24>>24?e:k)<<24>>24>0){l=f[f[a>>2]>>2]|0;t=a+40|0;m=un(f[t>>2]|0,f[t+4>>2]|0,f[c>>2]|0,0)|0;t=a+48|0;o=Vn(m|0,I|0,f[t>>2]|0,f[t+4>>2]|0)|0;t=l+o|0;o=0;while(1){f[g+(o<<2)>>2]=f[t>>2];o=o+1|0;l=b[r>>0]|0;if((o|0)>=((l<<24>>24>e<<24>>24?e:l)<<24>>24|0)){x=l;break}else t=t+4|0}}else x=k;t=x<<24>>24;if(x<<24>>24>=e<<24>>24){i=1;return i|0}sj(g+(t<<2)|0,0,(e<<24>>24)-t<<2|0)|0;i=1;return i|0}case 6:{t=a+24|0;o=b[t>>0]|0;if((o<<24>>24>e<<24>>24?e:o)<<24>>24>0){r=f[f[a>>2]>>2]|0;q=a+40|0;l=un(f[q>>2]|0,f[q+4>>2]|0,f[c>>2]|0,0)|0;q=a+48|0;m=Vn(l|0,I|0,f[q>>2]|0,f[q+4>>2]|0)|0;q=r+m|0;m=0;while(1){f[g+(m<<2)>>2]=f[q>>2];m=m+1|0;r=b[t>>0]|0;if((m|0)>=((r<<24>>24>e<<24>>24?e:r)<<24>>24|0)){y=r;break}else q=q+4|0}}else y=o;q=y<<24>>24;if(y<<24>>24>=e<<24>>24){i=1;return i|0}sj(g+(q<<2)|0,0,(e<<24>>24)-q<<2|0)|0;i=1;return i|0}case 7:{q=a+24|0;m=b[q>>0]|0;if((m<<24>>24>e<<24>>24?e:m)<<24>>24>0){t=f[f[a>>2]>>2]|0;k=a+40|0;r=un(f[k>>2]|0,f[k+4>>2]|0,f[c>>2]|0,0)|0;k=a+48|0;l=Vn(r|0,I|0,f[k>>2]|0,f[k+4>>2]|0)|0;k=t+l|0;l=0;while(1){f[g+(l<<2)>>2]=f[k>>2];l=l+1|0;t=b[q>>0]|0;if((l|0)>=((t<<24>>24>e<<24>>24?e:t)<<24>>24|0)){z=t;break}else k=k+8|0}}else z=m;k=z<<24>>24;if(z<<24>>24>=e<<24>>24){i=1;return i|0}sj(g+(k<<2)|0,0,(e<<24>>24)-k<<2|0)|0;i=1;return i|0}case 8:{k=a+24|0;l=b[k>>0]|0;if((l<<24>>24>e<<24>>24?e:l)<<24>>24>0){q=f[f[a>>2]>>2]|0;o=a+40|0;t=un(f[o>>2]|0,f[o+4>>2]|0,f[c>>2]|0,0)|0;o=a+48|0;r=Vn(t|0,I|0,f[o>>2]|0,f[o+4>>2]|0)|0;o=q+r|0;r=0;while(1){f[g+(r<<2)>>2]=f[o>>2];r=r+1|0;q=b[k>>0]|0;if((r|0)>=((q<<24>>24>e<<24>>24?e:q)<<24>>24|0)){A=q;break}else o=o+8|0}}else A=l;o=A<<24>>24;if(A<<24>>24>=e<<24>>24){i=1;return i|0}sj(g+(o<<2)|0,0,(e<<24>>24)-o<<2|0)|0;i=1;return i|0}case 9:{o=a+24|0;r=b[o>>0]|0;if((r<<24>>24>e<<24>>24?e:r)<<24>>24>0){k=f[f[a>>2]>>2]|0;m=a+40|0;q=un(f[m>>2]|0,f[m+4>>2]|0,f[c>>2]|0,0)|0;m=a+48|0;t=Vn(q|0,I|0,f[m>>2]|0,f[m+4>>2]|0)|0;m=k+t|0;t=0;while(1){k=~~$(n[m>>2]);f[g+(t<<2)>>2]=k;t=t+1|0;k=b[o>>0]|0;if((t|0)>=((k<<24>>24>e<<24>>24?e:k)<<24>>24|0)){B=k;break}else m=m+4|0}}else B=r;m=B<<24>>24;if(B<<24>>24>=e<<24>>24){i=1;return i|0}sj(g+(m<<2)|0,0,(e<<24>>24)-m<<2|0)|0;i=1;return i|0}case 10:{m=a+24|0;t=b[m>>0]|0;if((t<<24>>24>e<<24>>24?e:t)<<24>>24>0){o=f[f[a>>2]>>2]|0;l=a+40|0;k=un(f[l>>2]|0,f[l+4>>2]|0,f[c>>2]|0,0)|0;l=a+48|0;q=Vn(k|0,I|0,f[l>>2]|0,f[l+4>>2]|0)|0;l=o+q|0;q=0;while(1){f[g+(q<<2)>>2]=~~+p[l>>3];q=q+1|0;o=b[m>>0]|0;if((q|0)>=((o<<24>>24>e<<24>>24?e:o)<<24>>24|0)){C=o;break}else l=l+8|0}}else C=t;l=C<<24>>24;if(C<<24>>24>=e<<24>>24){i=1;return i|0}sj(g+(l<<2)|0,0,(e<<24>>24)-l<<2|0)|0;i=1;return i|0}case 11:{l=a+24|0;q=b[l>>0]|0;if((q<<24>>24>e<<24>>24?e:q)<<24>>24>0){m=f[f[a>>2]>>2]|0;r=a+40|0;o=un(f[r>>2]|0,f[r+4>>2]|0,f[c>>2]|0,0)|0;r=a+48|0;k=Vn(o|0,I|0,f[r>>2]|0,f[r+4>>2]|0)|0;r=m+k|0;k=0;while(1){f[g+(k<<2)>>2]=h[r>>0];k=k+1|0;m=b[l>>0]|0;if((k|0)>=((m<<24>>24>e<<24>>24?e:m)<<24>>24|0)){D=m;break}else r=r+1|0}}else D=q;r=D<<24>>24;if(D<<24>>24>=e<<24>>24){i=1;return i|0}sj(g+(r<<2)|0,0,(e<<24>>24)-r<<2|0)|0;i=1;return i|0}default:{i=0;return i|0}}while(0);return 0}function Rb(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=Oa,J=0,K=0,L=0,M=0,N=Oa;e=u;u=u+48|0;g=e+36|0;h=e+24|0;i=e+12|0;j=e;if(!(xh(a,c,d)|0)){k=0;u=e;return k|0}l=f[(f[(f[c+4>>2]|0)+8>>2]|0)+(d<<2)>>2]|0;if((f[l+28>>2]|0)!=9){k=0;u=e;return k|0}m=c+48|0;c=f[m>>2]|0;o=ln(32)|0;f[g>>2]=o;f[g+8>>2]=-2147483616;f[g+4>>2]=17;p=o;q=14495;r=p+17|0;do{b[p>>0]=b[q>>0]|0;p=p+1|0;q=q+1|0}while((p|0)<(r|0));b[o+17>>0]=0;o=c+16|0;s=f[o>>2]|0;if(s){t=o;v=s;a:while(1){s=v;while(1){if((f[s+16>>2]|0)>=(d|0))break;w=f[s+4>>2]|0;if(!w){x=t;break a}else s=w}v=f[s>>2]|0;if(!v){x=s;break}else t=s}if(((x|0)!=(o|0)?(f[x+16>>2]|0)<=(d|0):0)?(o=x+20|0,(Jh(o,g)|0)!=0):0)y=Hk(o,g,-1)|0;else z=12}else z=12;if((z|0)==12)y=Hk(c,g,-1)|0;if((b[g+11>>0]|0)<0)Oq(f[g>>2]|0);if((y|0)<1){k=0;u=e;return k|0}c=f[m>>2]|0;o=ln(32)|0;f[g>>2]=o;f[g+8>>2]=-2147483616;f[g+4>>2]=19;p=o;q=14438;r=p+19|0;do{b[p>>0]=b[q>>0]|0;p=p+1|0;q=q+1|0}while((p|0)<(r|0));b[o+19>>0]=0;o=c+16|0;x=f[o>>2]|0;if(x){t=o;v=x;b:while(1){x=v;while(1){if((f[x+16>>2]|0)>=(d|0))break;w=f[x+4>>2]|0;if(!w){A=t;break b}else x=w}v=f[x>>2]|0;if(!v){A=x;break}else t=x}if((A|0)!=(o|0)?(f[A+16>>2]|0)<=(d|0):0)B=A+20|0;else z=24}else z=24;if((z|0)==24)B=c;if(!(Jh(B,g)|0))C=0;else{B=f[m>>2]|0;f[h>>2]=0;f[h+4>>2]=0;f[h+8>>2]=0;c=ln(32)|0;f[h>>2]=c;f[h+8>>2]=-2147483616;f[h+4>>2]=18;p=c;q=14458;r=p+18|0;do{b[p>>0]=b[q>>0]|0;p=p+1|0;q=q+1|0}while((p|0)<(r|0));b[c+18>>0]=0;c=B+16|0;A=f[c>>2]|0;if(A){o=c;t=A;c:while(1){A=t;while(1){if((f[A+16>>2]|0)>=(d|0))break;v=f[A+4>>2]|0;if(!v){D=o;break c}else A=v}t=f[A>>2]|0;if(!t){D=A;break}else o=A}if((D|0)!=(c|0)?(f[D+16>>2]|0)<=(d|0):0)E=D+20|0;else z=34}else z=34;if((z|0)==34)E=B;B=(Jh(E,h)|0)!=0;if((b[h+11>>0]|0)<0)Oq(f[h>>2]|0);C=B}if((b[g+11>>0]|0)<0)Oq(f[g>>2]|0);if(!C){Wd(a+40|0,l,y)|0;k=1;u=e;return k|0}C=l+24|0;l=b[C>>0]|0;B=l<<24>>24;f[i>>2]=0;E=i+4|0;f[E>>2]=0;f[i+8>>2]=0;do if(l<<24>>24)if(l<<24>>24<0)aq(i);else{D=B<<2;c=ln(D)|0;f[i>>2]=c;o=c+(B<<2)|0;f[i+8>>2]=o;sj(c|0,0,D|0)|0;f[E>>2]=o;F=c;break}else F=0;while(0);B=f[m>>2]|0;f[j>>2]=0;f[j+4>>2]=0;f[j+8>>2]=0;l=ln(32)|0;f[j>>2]=l;f[j+8>>2]=-2147483616;f[j+4>>2]=19;p=l;q=14438;r=p+19|0;do{b[p>>0]=b[q>>0]|0;p=p+1|0;q=q+1|0}while((p|0)<(r|0));b[l+19>>0]=0;l=b[C>>0]|0;c=l<<24>>24;o=B+16|0;D=f[o>>2]|0;if(D){t=o;x=D;d:while(1){D=x;while(1){if((f[D+16>>2]|0)>=(d|0))break;v=f[D+4>>2]|0;if(!v){G=t;break d}else D=v}x=f[D>>2]|0;if(!x){G=D;break}else t=D}if(((G|0)!=(o|0)?(f[G+16>>2]|0)<=(d|0):0)?(o=G+20|0,(Jh(o,j)|0)!=0):0){t=Rg(o,j)|0;if((t|0)!=(G+24|0)){pj(g,t+28|0);t=g+11|0;G=b[t>>0]|0;o=G<<24>>24<0;if(!((o?f[g+4>>2]|0:G&255)|0))H=G;else{if(l<<24>>24>0){x=o?f[g>>2]|0:g;o=0;do{I=$(bq(x,h));A=x;x=f[h>>2]|0;if((A|0)==(x|0))break;n[F+(o<<2)>>2]=I;o=o+1|0}while((o|0)<(c|0));J=b[t>>0]|0}else J=G;H=J}if(H<<24>>24<0)Oq(f[g>>2]|0)}}else z=64}else z=64;if((z|0)==64?(H=Rg(B,j)|0,(H|0)!=(B+4|0)):0){pj(g,H+28|0);H=g+11|0;B=b[H>>0]|0;J=B<<24>>24<0;if(!((J?f[g+4>>2]|0:B&255)|0))K=B;else{if(l<<24>>24>0){l=J?f[g>>2]|0:g;J=0;do{I=$(bq(l,h));G=l;l=f[h>>2]|0;if((G|0)==(l|0))break;n[F+(J<<2)>>2]=I;J=J+1|0}while((J|0)<(c|0));L=b[H>>0]|0}else L=B;K=L}if(K<<24>>24<0)Oq(f[g>>2]|0)}if((b[j+11>>0]|0)<0)Oq(f[j>>2]|0);j=f[m>>2]|0;f[g>>2]=0;f[g+4>>2]=0;f[g+8>>2]=0;m=ln(32)|0;f[g>>2]=m;f[g+8>>2]=-2147483616;f[g+4>>2]=18;p=m;q=14458;r=p+18|0;do{b[p>>0]=b[q>>0]|0;p=p+1|0;q=q+1|0}while((p|0)<(r|0));b[m+18>>0]=0;m=j+16|0;q=f[m>>2]|0;if(q){p=m;r=q;e:while(1){q=r;while(1){if((f[q+16>>2]|0)>=(d|0))break;K=f[q+4>>2]|0;if(!K){M=p;break e}else q=K}r=f[q>>2]|0;if(!r){M=q;break}else p=q}if(((M|0)!=(m|0)?(f[M+16>>2]|0)<=(d|0):0)?(d=M+20|0,(Jh(d,g)|0)!=0):0)N=$(sk(d,g,$(1.0)));else z=86}else z=86;if((z|0)==86)N=$(sk(j,g,$(1.0)));if((b[g+11>>0]|0)<0)Oq(f[g>>2]|0);Dl(a+40|0,y,f[i>>2]|0,b[C>>0]|0,N);C=f[i>>2]|0;if(C|0){i=f[E>>2]|0;if((i|0)!=(C|0))f[E>>2]=i+(~((i+-4-C|0)>>>2)<<2);Oq(C)}k=1;u=e;return k|0}function Sb(a,b,c,d,e,g){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;g=g|0;var h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,$=0,aa=0,ba=0,ca=0,da=0,ea=0,fa=0,ga=0,ha=0,ia=0,ja=0,ka=0,la=0,ma=0,na=0,oa=0,pa=0,qa=0,ra=0,sa=0,ta=0,ua=0,va=0,wa=0;e=u;u=u+64|0;d=e+48|0;h=e+36|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1){if((S|0)<0){M=f[s>>2]|0;W=(M|0)>-1?M:0-M|0;X=M}else{M=f[s>>2]|0;W=(f[w>>2]|0)-((M|0)>-1?M:0-M|0)|0;X=M}if((X|0)<0){Y=(S|0)>-1?S:0-S|0;Z=W;_=X;break}else{Y=(f[w>>2]|0)-((S|0)>-1?S:0-S|0)|0;Z=W;_=X;break}}else{M=f[s>>2]|0;Y=M+T|0;Z=T+S|0;_=M}while(0);M=(Z|0)==0;P=(Y|0)==0;N=f[w>>2]|0;do if(Y|Z){H=(N|0)==(Y|0);if(!(M&H)){p=(N|0)==(Z|0);if(!(P&p)){if(M&(T|0)<(Y|0)){$=0;aa=(T<<1)-Y|0;break}if(p&(T|0)>(Y|0)){$=Z;aa=(T<<1)-Y|0;break}if(H&(T|0)>(Z|0)){$=(T<<1)-Z|0;aa=Y;break}if(P){$=(T|0)<(Z|0)?(T<<1)-Z|0:Z;aa=0}else{$=Z;aa=Y}}else{$=Z;aa=Z}}else{$=Y;aa=Y}}else{$=N;aa=N}while(0);f[i>>2]=$;f[v>>2]=aa;P=0-S|0;M=0-_|0;f[h>>2]=0-O;f[q>>2]=P;f[s>>2]=M;if((O|0)<1){ba=T-_|0;ca=T-S|0}else{H=(_|0)<1?M:_;M=(S|0)<1?P:S;ba=(_|0)>0?M:N-M|0;ca=(S|0)>0?H:N-H|0}H=(ca|0)==0;M=(ba|0)==0;do if(((ba|ca|0)!=0?(P=(N|0)==(ba|0),!(H&P)):0)?(p=(N|0)==(ca|0),!(M&p)):0){if(H&(T|0)<(ba|0)){da=0;ea=(T<<1)-ba|0;break}if(p&(T|0)>(ba|0)){da=N;ea=(T<<1)-ba|0;break}if(P&(T|0)>(ca|0)){da=(T<<1)-ca|0;ea=N;break}if(M){da=(T|0)<(ca|0)?(T<<1)-ca|0:ca;ea=0}else{da=ca;ea=ba}}else{da=N;ea=N}while(0);f[j>>2]=da;f[x>>2]=ea;N=K<<1;M=b+(N<<2)|0;H=f[y>>2]|0;if((H|0)>0){O=0;P=i;p=H;while(1){if((p|0)>0){H=0;do{V=f[P+(H<<2)>>2]|0;U=f[z>>2]|0;if((V|0)>(U|0)){fa=f[A>>2]|0;f[fa+(H<<2)>>2]=U;ga=fa}else{fa=f[B>>2]|0;U=f[A>>2]|0;f[U+(H<<2)>>2]=(V|0)<(fa|0)?fa:V;ga=U}H=H+1|0;U=f[y>>2]|0}while((H|0)<(U|0));ha=ga;ia=U}else{ha=f[A>>2]|0;ia=p}H=(f[M+(O<<2)>>2]|0)-(f[ha+(O<<2)>>2]|0)|0;U=k+(O<<2)|0;f[U>>2]=H;ja=f[C>>2]|0;if((H|0)>=(ja|0)){if((H|0)>(f[E>>2]|0)){ka=H-(f[D>>2]|0)|0;la=52}}else{ka=(f[D>>2]|0)+H|0;la=52}if((la|0)==52){la=0;f[U>>2]=ka}O=O+1|0;if((O|0)>=(ia|0))break;else{P=ha;p=ia}}if((ia|0)>0){p=0;P=j;O=ia;U=ja;while(1){if((O|0)>0){H=0;do{V=f[P+(H<<2)>>2]|0;fa=f[z>>2]|0;if((V|0)>(fa|0))f[ha+(H<<2)>>2]=fa;else{fa=f[B>>2]|0;f[ha+(H<<2)>>2]=(V|0)<(fa|0)?fa:V}H=H+1|0;ma=f[y>>2]|0}while((H|0)<(ma|0));na=f[C>>2]|0;oa=ma}else{na=U;oa=O}H=(f[M+(p<<2)>>2]|0)-(f[ha+(p<<2)>>2]|0)|0;V=l+(p<<2)|0;f[V>>2]=H;if((H|0)>=(na|0)){if((H|0)>(f[E>>2]|0)){pa=H-(f[D>>2]|0)|0;la=65}}else{pa=(f[D>>2]|0)+H|0;la=65}if((la|0)==65){la=0;f[V>>2]=pa}p=p+1|0;if((p|0)>=(oa|0))break;else{P=ha;O=oa;U=na}}}}U=f[k>>2]|0;O=f[t>>2]|0;if((O|0)>=(U|0))if((U|0)<(0-O|0))qa=(f[F>>2]|0)+U|0;else qa=U;else qa=U-(f[F>>2]|0)|0;f[k>>2]=qa;U=f[a>>2]|0;if((O|0)>=(U|0))if((U|0)<(0-O|0))ra=(f[F>>2]|0)+U|0;else ra=U;else ra=U-(f[F>>2]|0)|0;f[a>>2]=ra;U=f[l>>2]|0;if((O|0)>=(U|0))if((U|0)<(0-O|0))sa=(f[F>>2]|0)+U|0;else sa=U;else sa=U-(f[F>>2]|0)|0;f[l>>2]=sa;U=f[G>>2]|0;if((O|0)>=(U|0))if((U|0)<(0-O|0))ta=(f[F>>2]|0)+U|0;else ta=U;else ta=U-(f[F>>2]|0)|0;f[G>>2]=ta;if((((ra|0)>-1?ra:0-ra|0)+((qa|0)>-1?qa:0-qa|0)|0)<(((sa|0)>-1?sa:0-sa|0)+((ta|0)>-1?ta:0-ta|0)|0)){fj(g,0);ua=k}else{fj(g,1);ua=l}U=f[ua>>2]|0;if((U|0)<0)va=(f[F>>2]|0)+U|0;else va=U;U=c+(N<<2)|0;f[U>>2]=va;O=f[ua+4>>2]|0;if((O|0)<0)wa=(f[F>>2]|0)+O|0;else wa=O;f[U+4>>2]=wa;K=K+1|0;if((K|0)>=(r|0)){la=3;break}U=f[o>>2]|0;L=f[U>>2]|0;if((f[U+4>>2]|0)-L>>2>>>0<=K>>>0){J=U;la=4;break}}if((la|0)==3){u=e;return 1}else if((la|0)==4)aq(J);return 0}function Tb(a,b,c,d,e,g){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;g=g|0;var h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,$=0,aa=0,ba=0,ca=0,da=0,ea=0,fa=0,ga=0,ha=0,ia=0,ja=0,ka=0,la=0,ma=0,na=0,oa=0,pa=0,qa=0,ra=0,sa=0,ta=0,ua=0,va=0,wa=0;e=u;u=u+64|0;d=e+48|0;h=e+36|0;i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((S|0)<0){M=f[s>>2]|0;W=(M|0)>-1?M:0-M|0;X=M}else{M=f[s>>2]|0;W=(f[w>>2]|0)-((M|0)>-1?M:0-M|0)|0;X=M}if((X|0)<0){Y=(S|0)>-1?S:0-S|0;Z=W;_=X;break}else{Y=(f[w>>2]|0)-((S|0)>-1?S:0-S|0)|0;Z=W;_=X;break}}else{M=f[s>>2]|0;Y=M+T|0;Z=T+S|0;_=M}while(0);M=(Z|0)==0;P=(Y|0)==0;N=f[w>>2]|0;do if(Y|Z){H=(N|0)==(Y|0);if(!(M&H)){p=(N|0)==(Z|0);if(!(P&p)){if(M&(T|0)<(Y|0)){$=0;aa=(T<<1)-Y|0;break}if(p&(T|0)>(Y|0)){$=Z;aa=(T<<1)-Y|0;break}if(H&(T|0)>(Z|0)){$=(T<<1)-Z|0;aa=Y;break}if(P){$=(T|0)<(Z|0)?(T<<1)-Z|0:Z;aa=0}else{$=Z;aa=Y}}else{$=Z;aa=Z}}else{$=Y;aa=Y}}else{$=N;aa=N}while(0);f[i>>2]=$;f[v>>2]=aa;P=0-S|0;M=0-_|0;f[h>>2]=0-O;f[q>>2]=P;f[s>>2]=M;if((O|0)<1){ba=T-_|0;ca=T-S|0}else{H=(_|0)<1?M:_;M=(S|0)<1?P:S;ba=(_|0)>0?M:N-M|0;ca=(S|0)>0?H:N-H|0}H=(ca|0)==0;M=(ba|0)==0;do if(((ba|ca|0)!=0?(P=(N|0)==(ba|0),!(H&P)):0)?(p=(N|0)==(ca|0),!(M&p)):0){if(H&(T|0)<(ba|0)){da=0;ea=(T<<1)-ba|0;break}if(p&(T|0)>(ba|0)){da=N;ea=(T<<1)-ba|0;break}if(P&(T|0)>(ca|0)){da=(T<<1)-ca|0;ea=N;break}if(M){da=(T|0)<(ca|0)?(T<<1)-ca|0:ca;ea=0}else{da=ca;ea=ba}}else{da=N;ea=N}while(0);f[j>>2]=da;f[x>>2]=ea;N=K<<1;M=b+(N<<2)|0;H=f[y>>2]|0;if((H|0)>0){O=0;P=i;p=H;while(1){if((p|0)>0){H=0;do{V=f[P+(H<<2)>>2]|0;U=f[z>>2]|0;if((V|0)>(U|0)){fa=f[A>>2]|0;f[fa+(H<<2)>>2]=U;ga=fa}else{fa=f[B>>2]|0;U=f[A>>2]|0;f[U+(H<<2)>>2]=(V|0)<(fa|0)?fa:V;ga=U}H=H+1|0;U=f[y>>2]|0}while((H|0)<(U|0));ha=ga;ia=U}else{ha=f[A>>2]|0;ia=p}H=(f[M+(O<<2)>>2]|0)-(f[ha+(O<<2)>>2]|0)|0;U=k+(O<<2)|0;f[U>>2]=H;ja=f[C>>2]|0;if((H|0)>=(ja|0)){if((H|0)>(f[E>>2]|0)){ka=H-(f[D>>2]|0)|0;la=52}}else{ka=(f[D>>2]|0)+H|0;la=52}if((la|0)==52){la=0;f[U>>2]=ka}O=O+1|0;if((O|0)>=(ia|0))break;else{P=ha;p=ia}}if((ia|0)>0){p=0;P=j;O=ia;U=ja;while(1){if((O|0)>0){H=0;do{V=f[P+(H<<2)>>2]|0;fa=f[z>>2]|0;if((V|0)>(fa|0))f[ha+(H<<2)>>2]=fa;else{fa=f[B>>2]|0;f[ha+(H<<2)>>2]=(V|0)<(fa|0)?fa:V}H=H+1|0;ma=f[y>>2]|0}while((H|0)<(ma|0));na=f[C>>2]|0;oa=ma}else{na=U;oa=O}H=(f[M+(p<<2)>>2]|0)-(f[ha+(p<<2)>>2]|0)|0;V=l+(p<<2)|0;f[V>>2]=H;if((H|0)>=(na|0)){if((H|0)>(f[E>>2]|0)){pa=H-(f[D>>2]|0)|0;la=65}}else{pa=(f[D>>2]|0)+H|0;la=65}if((la|0)==65){la=0;f[V>>2]=pa}p=p+1|0;if((p|0)>=(oa|0))break;else{P=ha;O=oa;U=na}}}}U=f[k>>2]|0;O=f[t>>2]|0;if((O|0)>=(U|0))if((U|0)<(0-O|0))qa=(f[F>>2]|0)+U|0;else qa=U;else qa=U-(f[F>>2]|0)|0;f[k>>2]=qa;U=f[a>>2]|0;if((O|0)>=(U|0))if((U|0)<(0-O|0))ra=(f[F>>2]|0)+U|0;else ra=U;else ra=U-(f[F>>2]|0)|0;f[a>>2]=ra;U=f[l>>2]|0;if((O|0)>=(U|0))if((U|0)<(0-O|0))sa=(f[F>>2]|0)+U|0;else sa=U;else sa=U-(f[F>>2]|0)|0;f[l>>2]=sa;U=f[G>>2]|0;if((O|0)>=(U|0))if((U|0)<(0-O|0))ta=(f[F>>2]|0)+U|0;else ta=U;else ta=U-(f[F>>2]|0)|0;f[G>>2]=ta;if((((ra|0)>-1?ra:0-ra|0)+((qa|0)>-1?qa:0-qa|0)|0)<(((sa|0)>-1?sa:0-sa|0)+((ta|0)>-1?ta:0-ta|0)|0)){fj(g,0);ua=k}else{fj(g,1);ua=l}U=f[ua>>2]|0;if((U|0)<0)va=(f[F>>2]|0)+U|0;else va=U;U=c+(N<<2)|0;f[U>>2]=va;O=f[ua+4>>2]|0;if((O|0)<0)wa=(f[F>>2]|0)+O|0;else wa=O;f[U+4>>2]=wa;K=K+1|0;if((K|0)>=(r|0)){la=3;break}U=f[o>>2]|0;L=f[U>>2]|0;if((f[U+4>>2]|0)-L>>2>>>0<=K>>>0){J=U;la=4;break}}if((la|0)==3){u=e;return 1}else if((la|0)==4)aq(J);return 0}function Ub(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,i=0,j=0,k=0,l=0,m=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=Oa,V=Oa,Y=Oa,Z=0,_=0,aa=0,ba=0;d=u;u=u+16|0;e=d;g=a+16|0;f[a>>2]=0;f[a+4>>2]=0;f[a+8>>2]=0;f[a+12>>2]=0;n[g>>2]=$(1.0);i=a+20|0;f[i>>2]=0;f[i+4>>2]=0;f[i+8>>2]=0;f[i+12>>2]=0;n[a+36>>2]=$(1.0);j=f[c+8>>2]|0;a:do if(j|0){k=a+4|0;l=a+12|0;m=a+8|0;o=j;p=j;while(1){q=o+8|0;r=b[q+11>>0]|0;s=r<<24>>24<0;t=s?f[q>>2]|0:q;v=s?f[o+12>>2]|0:r&255;if(v>>>0>3){r=t;s=v;w=v;while(1){x=X(h[r>>0]|h[r+1>>0]<<8|h[r+2>>0]<<16|h[r+3>>0]<<24,1540483477)|0;s=(X(x>>>24^x,1540483477)|0)^(X(s,1540483477)|0);w=w+-4|0;if(w>>>0<=3)break;else r=r+4|0}r=v+-4|0;w=r&-4;y=r-w|0;z=t+(w+4)|0;A=s}else{y=v;z=t;A=v}switch(y|0){case 3:{B=h[z+2>>0]<<16^A;C=8;break}case 2:{B=A;C=8;break}case 1:{D=A;C=9;break}default:E=A}if((C|0)==8){C=0;D=h[z+1>>0]<<8^B;C=9}if((C|0)==9){C=0;E=X(D^h[z>>0],1540483477)|0}w=X(E>>>13^E,1540483477)|0;r=w>>>15^w;w=f[k>>2]|0;x=(w|0)==0;b:do if(!x){F=w+-1|0;G=(F&w|0)==0;if(!G)if(r>>>0>>0)H=r;else H=(r>>>0)%(w>>>0)|0;else H=r&F;I=f[(f[a>>2]|0)+(H<<2)>>2]|0;if((I|0)!=0?(J=f[I>>2]|0,(J|0)!=0):0){I=(v|0)==0;if(G){if(I){G=J;while(1){K=f[G+4>>2]|0;if(!((K|0)==(r|0)|(K&F|0)==(H|0))){L=H;C=50;break b}K=b[G+8+11>>0]|0;if(!((K<<24>>24<0?f[G+12>>2]|0:K&255)|0))break b;G=f[G>>2]|0;if(!G){L=H;C=50;break b}}}else M=J;while(1){G=f[M+4>>2]|0;if(!((G|0)==(r|0)|(G&F|0)==(H|0))){L=H;C=50;break b}G=M+8|0;K=b[G+11>>0]|0;N=K<<24>>24<0;O=K&255;do if(((N?f[M+12>>2]|0:O)|0)==(v|0)){K=f[G>>2]|0;if(N)if(!(Vk(K,t,v)|0))break b;else break;if((b[t>>0]|0)==(K&255)<<24>>24){K=G;P=O;Q=t;do{P=P+-1|0;K=K+1|0;if(!P)break b;Q=Q+1|0}while((b[K>>0]|0)==(b[Q>>0]|0))}}while(0);M=f[M>>2]|0;if(!M){L=H;C=50;break b}}}if(I){F=J;while(1){O=f[F+4>>2]|0;if((O|0)!=(r|0)){if(O>>>0>>0)R=O;else R=(O>>>0)%(w>>>0)|0;if((R|0)!=(H|0)){L=H;C=50;break b}}O=b[F+8+11>>0]|0;if(!((O<<24>>24<0?f[F+12>>2]|0:O&255)|0))break b;F=f[F>>2]|0;if(!F){L=H;C=50;break b}}}else S=J;while(1){F=f[S+4>>2]|0;if((F|0)!=(r|0)){if(F>>>0>>0)T=F;else T=(F>>>0)%(w>>>0)|0;if((T|0)!=(H|0)){L=H;C=50;break b}}F=S+8|0;I=b[F+11>>0]|0;O=I<<24>>24<0;G=I&255;do if(((O?f[S+12>>2]|0:G)|0)==(v|0)){I=f[F>>2]|0;if(O)if(!(Vk(I,t,v)|0))break b;else break;if((b[t>>0]|0)==(I&255)<<24>>24){I=F;N=G;Q=t;do{N=N+-1|0;I=I+1|0;if(!N)break b;Q=Q+1|0}while((b[I>>0]|0)==(b[Q>>0]|0))}}while(0);S=f[S>>2]|0;if(!S){L=H;C=50;break}}}else{L=H;C=50}}else{L=0;C=50}while(0);if((C|0)==50){C=0;Di(e,a,r,q);U=$(((f[l>>2]|0)+1|0)>>>0);V=$(w>>>0);Y=$(n[g>>2]);do if(x|$(Y*V)>>0<3|(w+-1&w|0)!=0)&1;v=~~$(W($(U/Y)))>>>0;ei(a,t>>>0>>0?v:t);t=f[k>>2]|0;v=t+-1|0;if(!(v&t)){Z=t;_=v&r;break}if(r>>>0>>0){Z=t;_=r}else{Z=t;_=(r>>>0)%(t>>>0)|0}}else{Z=w;_=L}while(0);w=f[(f[a>>2]|0)+(_<<2)>>2]|0;if(!w){f[f[e>>2]>>2]=f[m>>2];f[m>>2]=f[e>>2];f[(f[a>>2]|0)+(_<<2)>>2]=m;r=f[e>>2]|0;x=f[r>>2]|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=0;f[i+4>>2]=0;f[i+8>>2]=0;f[i+12>>2]=0;n[l>>2]=$(1.0);m=a+80|0;o=f[m>>2]|0;f[k>>2]=0;p=k+4|0;f[p>>2]=0;f[k+8>>2]=0;if(o){if(o>>>0>1073741823)aq(k);q=o<<2;r=ln(q)|0;f[k>>2]=r;s=r+(o<<2)|0;f[k+8>>2]=s;sj(r|0,0,q|0)|0;f[p>>2]=s;s=c+48|0;q=c+40|0;o=i+4|0;t=i+12|0;v=i+8|0;w=a+40|0;x=a+64|0;y=f[e>>2]|0;e=r;z=0;A=0;B=r;C=r;D=0;E=r;while(1){r=s;F=f[r>>2]|0;G=f[r+4>>2]|0;r=q;H=un(f[r>>2]|0,f[r+4>>2]|0,y+z|0,0)|0;r=Vn(H|0,I|0,F|0,G|0)|0;G=(f[f[c>>2]>>2]|0)+r|0;r=h[G>>0]|h[G+1>>0]<<8|h[G+2>>0]<<16|h[G+3>>0]<<24;f[j>>2]=r;G=r&65535;F=r>>>16;H=F&65535;J=(r&65535^318)+239^F;F=(D|0)==0;a:do if(!F){K=D+-1|0;L=(K&D|0)==0;if(!L)if(J>>>0>>0)M=J;else M=(J>>>0)%(D>>>0)|0;else M=J&K;N=f[(f[i>>2]|0)+(M<<2)>>2]|0;do if(N|0?(O=f[N>>2]|0,O|0):0){b:do if(L){P=O;while(1){Q=f[P+4>>2]|0;R=(Q|0)==(J|0);if(!(R|(Q&K|0)==(M|0))){S=27;break b}if((R?(R=P+8|0,(d[R>>1]|0)==G<<16>>16):0)?(d[R+2>>1]|0)==H<<16>>16:0){T=P;S=26;break b}P=f[P>>2]|0;if(!P){S=27;break}}}else{P=O;while(1){R=f[P+4>>2]|0;if((R|0)==(J|0)){Q=P+8|0;if((d[Q>>1]|0)==G<<16>>16?(d[Q+2>>1]|0)==H<<16>>16:0){T=P;S=26;break b}}else{if(R>>>0>>0)U=R;else U=(R>>>0)%(D>>>0)|0;if((U|0)!=(M|0)){S=27;break b}}P=f[P>>2]|0;if(!P){S=27;break}}}while(0);if((S|0)==26){S=0;f[E+(z<<2)>>2]=f[T+12>>2];V=e;X=A;Y=C;Z=B;_=E;break a}else if((S|0)==27){S=0;if(F){aa=0;S=46;break a}else break}}while(0);K=D+-1|0;L=(K&D|0)==0;if(!L)if(J>>>0>>0)ba=J;else ba=(J>>>0)%(D>>>0)|0;else ba=K&J;N=f[(f[i>>2]|0)+(ba<<2)>>2]|0;if((N|0)!=0?(O=f[N>>2]|0,(O|0)!=0):0){if(L){L=O;while(1){N=f[L+4>>2]|0;if(!((N|0)==(J|0)|(N&K|0)==(ba|0))){aa=ba;S=46;break a}N=L+8|0;if((d[N>>1]|0)==G<<16>>16?(d[N+2>>1]|0)==H<<16>>16:0){S=61;break a}L=f[L>>2]|0;if(!L){aa=ba;S=46;break a}}}else ca=O;while(1){L=f[ca+4>>2]|0;if((L|0)!=(J|0)){if(L>>>0>>0)da=L;else da=(L>>>0)%(D>>>0)|0;if((da|0)!=(ba|0)){aa=ba;S=46;break a}}L=ca+8|0;if((d[L>>1]|0)==G<<16>>16?(d[L+2>>1]|0)==H<<16>>16:0){S=61;break a}ca=f[ca>>2]|0;if(!ca){aa=ba;S=46;break}}}else{aa=ba;S=46}}else{aa=0;S=46}while(0);if((S|0)==46){S=0;H=ln(16)|0;G=H+8|0;d[G>>1]=r;d[G+2>>1]=r>>>16;f[H+12>>2]=A;f[H+4>>2]=J;f[H>>2]=0;ea=$(((f[t>>2]|0)+1|0)>>>0);fa=$(D>>>0);ga=$(n[l>>2]);do if(F|$(ga*fa)>>0<3|(D+-1&D|0)!=0)&1;O=~~$(W($(ea/ga)))>>>0;Uh(i,G>>>0>>0?O:G);G=f[o>>2]|0;O=G+-1|0;if(!(O&G)){ha=G;ia=O&J;break}if(J>>>0>>0){ha=G;ia=J}else{ha=G;ia=(J>>>0)%(G>>>0)|0}}else{ha=D;ia=aa}while(0);J=(f[i>>2]|0)+(ia<<2)|0;F=f[J>>2]|0;if(!F){f[H>>2]=f[v>>2];f[v>>2]=H;f[J>>2]=v;J=f[H>>2]|0;if(J|0){r=f[J+4>>2]|0;J=ha+-1|0;if(J&ha)if(r>>>0>>0)ja=r;else ja=(r>>>0)%(ha>>>0)|0;else ja=r&J;ka=(f[i>>2]|0)+(ja<<2)|0;S=59}}else{f[H>>2]=f[F>>2];ka=F;S=59}if((S|0)==59){S=0;f[ka>>2]=H}f[t>>2]=(f[t>>2]|0)+1;S=61}if((S|0)==61){S=0;F=w;J=f[F>>2]|0;r=un(J|0,f[F+4>>2]|0,A|0,0)|0;kh((f[f[x>>2]>>2]|0)+r|0,j|0,J|0)|0;J=f[k>>2]|0;f[J+(z<<2)>>2]=A;V=J;X=A+1|0;Y=J;Z=J;_=J}J=z+1|0;la=f[m>>2]|0;if(J>>>0>=la>>>0)break;e=V;z=J;A=X;B=Z;C=Y;D=f[o>>2]|0;E=_}if((X|0)==(la|0))ma=Z;else{Z=a+84|0;if(!(b[Z>>0]|0)){_=f[a+72>>2]|0;E=f[a+68>>2]|0;o=E;if((_|0)==(E|0))na=V;else{D=_-E>>2;E=0;do{_=o+(E<<2)|0;f[_>>2]=f[Y+(f[_>>2]<<2)>>2];E=E+1|0}while(E>>>0>>0);na=V}}else{b[Z>>0]=0;Z=a+68|0;V=a+72|0;D=f[V>>2]|0;E=f[Z>>2]|0;Y=D-E>>2;o=E;E=D;if(la>>>0<=Y>>>0)if(la>>>0>>0?(D=o+(la<<2)|0,(D|0)!=(E|0)):0){f[V>>2]=E+(~((E+-4-D|0)>>>2)<<2);oa=la}else oa=la;else{Ch(Z,la-Y|0,1220);oa=f[m>>2]|0}Y=f[k>>2]|0;if(!oa)na=Y;else{k=f[a+68>>2]|0;a=0;do{f[k+(a<<2)>>2]=f[Y+(a<<2)>>2];a=a+1|0}while(a>>>0>>0);na=Y}}f[m>>2]=X;ma=na}if(!ma)pa=X;else{na=f[p>>2]|0;if((na|0)!=(ma|0))f[p>>2]=na+(~((na+-4-ma|0)>>>2)<<2);Oq(ma);pa=X}}else pa=0;X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F;G=(q|0)==0;a:do if(!G){H=q+-1|0;J=(H&q|0)==0;if(!J)if(D>>>0>>0)K=D;else K=(D>>>0)%(q>>>0)|0;else K=D&H;L=f[(f[g>>2]|0)+(K<<2)>>2]|0;do if(L|0?(M=f[L>>2]|0,M|0):0){b:do if(J){N=M;while(1){O=f[N+4>>2]|0;P=(O|0)==(D|0);if(!(P|(O&H|0)==(K|0))){Q=27;break b}if((P?(f[N+8>>2]|0)==(E|0):0)?(f[N+12>>2]|0)==(F|0):0){R=N;Q=26;break b}N=f[N>>2]|0;if(!N){Q=27;break}}}else{N=M;while(1){P=f[N+4>>2]|0;if((P|0)==(D|0)){if((f[N+8>>2]|0)==(E|0)?(f[N+12>>2]|0)==(F|0):0){R=N;Q=26;break b}}else{if(P>>>0>>0)S=P;else S=(P>>>0)%(q>>>0)|0;if((S|0)!=(K|0)){Q=27;break b}}N=f[N>>2]|0;if(!N){Q=27;break}}}while(0);if((Q|0)==26){Q=0;f[A+(y<<2)>>2]=f[R+16>>2];T=d;U=z;V=C;X=B;Y=A;break a}else if((Q|0)==27){Q=0;if(G){Z=0;Q=46;break a}else break}}while(0);H=q+-1|0;J=(H&q|0)==0;if(!J)if(D>>>0>>0)_=D;else _=(D>>>0)%(q>>>0)|0;else _=H&D;L=f[(f[g>>2]|0)+(_<<2)>>2]|0;if((L|0)!=0?(M=f[L>>2]|0,(M|0)!=0):0){if(J){J=M;while(1){L=f[J+4>>2]|0;if(!((L|0)==(D|0)|(L&H|0)==(_|0))){Z=_;Q=46;break a}if((f[J+8>>2]|0)==(E|0)?(f[J+12>>2]|0)==(F|0):0){Q=61;break a}J=f[J>>2]|0;if(!J){Z=_;Q=46;break a}}}else aa=M;while(1){J=f[aa+4>>2]|0;if((J|0)!=(D|0)){if(J>>>0>>0)ba=J;else ba=(J>>>0)%(q>>>0)|0;if((ba|0)!=(_|0)){Z=_;Q=46;break a}}if((f[aa+8>>2]|0)==(E|0)?(f[aa+12>>2]|0)==(F|0):0){Q=61;break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]=f[V+(f[m>>2]<<2)>>2];q=q+1|0}while(q>>>0>>0);la=T}}else{b[X>>0]=0;X=a+68|0;T=a+72|0;B=f[T>>2]|0;q=f[X>>2]|0;V=B-q>>2;C=q;q=B;if(ja>>>0<=V>>>0)if(ja>>>0>>0?(B=C+(ja<<2)|0,(B|0)!=(q|0)):0){f[T>>2]=q+(~((q+-4-B|0)>>>2)<<2);ma=ja}else ma=ja;else{Ch(X,ja-V|0,1220);ma=f[l>>2]|0}V=f[j>>2]|0;if(!ma)la=V;else{j=f[a+68>>2]|0;a=0;do{f[j+(a<<2)>>2]=f[V+(a<<2)>>2];a=a+1|0}while(a>>>0>>0);la=V}}f[l>>2]=U;ka=la}if(!ka)na=U;else{la=f[o>>2]|0;if((la|0)!=(ka|0))f[o>>2]=la+(~((la+-4-ka|0)>>>2)<<2);Oq(ka);na=U}}else na=0;U=f[g+8>>2]|0;if(U|0){ka=U;do{U=ka;ka=f[ka>>2]|0;Oq(U)}while((ka|0)!=0)}ka=f[g>>2]|0;f[g>>2]=0;if(!ka){u=e;return na|0}Oq(ka);u=e;return na|0}function Xb(a,c,e){a=a|0;c=c|0;e=e|0;var g=0,i=0,j=0,k=0,l=0,m=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,X=0,Y=0,Z=0,_=0,aa=0,ba=0,ca=0,da=0,ea=Oa,fa=Oa,ga=Oa,ha=0,ia=0,ja=0,ka=0,la=0,ma=0,na=0,oa=0,pa=0;g=u;u=u+48|0;i=g+12|0;j=g+32|0;k=g;l=i+16|0;f[i>>2]=0;f[i+4>>2]=0;f[i+8>>2]=0;f[i+12>>2]=0;n[l>>2]=$(1.0);m=a+80|0;o=f[m>>2]|0;f[k>>2]=0;p=k+4|0;f[p>>2]=0;f[k+8>>2]=0;if(o){if(o>>>0>1073741823)aq(k);q=o<<2;r=ln(q)|0;f[k>>2]=r;s=r+(o<<2)|0;f[k+8>>2]=s;sj(r|0,0,q|0)|0;f[p>>2]=s;s=c+48|0;q=c+40|0;o=i+4|0;t=i+12|0;v=i+8|0;w=a+40|0;x=a+64|0;y=f[e>>2]|0;e=r;z=0;A=0;B=r;C=r;D=0;E=r;while(1){r=s;F=f[r>>2]|0;G=f[r+4>>2]|0;r=q;H=un(f[r>>2]|0,f[r+4>>2]|0,y+z|0,0)|0;r=Vn(H|0,I|0,F|0,G|0)|0;G=(f[f[c>>2]>>2]|0)+r|0;r=h[G>>0]|h[G+1>>0]<<8;d[j>>1]=r;G=r&255;F=(r&65535)>>>8;H=F&255;J=((r&255^318)+239<<16>>16^F)&65535;F=(D|0)==0;a:do if(!F){K=D+-1|0;L=(K&D|0)==0;if(!L)if(D>>>0>J>>>0)M=J;else M=(J>>>0)%(D>>>0)|0;else M=K&J;N=f[(f[i>>2]|0)+(M<<2)>>2]|0;do if(N|0?(O=f[N>>2]|0,O|0):0){b:do if(L){P=O;while(1){Q=f[P+4>>2]|0;R=(Q|0)==(J|0);if(!(R|(Q&K|0)==(M|0))){S=27;break b}if((R?(R=P+8|0,(b[R>>0]|0)==G<<24>>24):0)?(b[R+1>>0]|0)==H<<24>>24:0){T=P;S=26;break b}P=f[P>>2]|0;if(!P){S=27;break}}}else{P=O;while(1){R=f[P+4>>2]|0;if((R|0)==(J|0)){Q=P+8|0;if((b[Q>>0]|0)==G<<24>>24?(b[Q+1>>0]|0)==H<<24>>24:0){T=P;S=26;break b}}else{if(R>>>0>>0)U=R;else U=(R>>>0)%(D>>>0)|0;if((U|0)!=(M|0)){S=27;break b}}P=f[P>>2]|0;if(!P){S=27;break}}}while(0);if((S|0)==26){S=0;f[E+(z<<2)>>2]=f[T+12>>2];V=e;X=A;Y=C;Z=B;_=E;break a}else if((S|0)==27){S=0;if(F){aa=0;S=46;break a}else break}}while(0);K=D+-1|0;L=(K&D|0)==0;if(!L)if(D>>>0>J>>>0)ba=J;else ba=(J>>>0)%(D>>>0)|0;else ba=K&J;N=f[(f[i>>2]|0)+(ba<<2)>>2]|0;if((N|0)!=0?(O=f[N>>2]|0,(O|0)!=0):0){if(L){L=O;while(1){N=f[L+4>>2]|0;if(!((N|0)==(J|0)|(N&K|0)==(ba|0))){aa=ba;S=46;break a}N=L+8|0;if((b[N>>0]|0)==G<<24>>24?(b[N+1>>0]|0)==H<<24>>24:0){S=61;break a}L=f[L>>2]|0;if(!L){aa=ba;S=46;break a}}}else ca=O;while(1){L=f[ca+4>>2]|0;if((L|0)!=(J|0)){if(L>>>0>>0)da=L;else da=(L>>>0)%(D>>>0)|0;if((da|0)!=(ba|0)){aa=ba;S=46;break a}}L=ca+8|0;if((b[L>>0]|0)==G<<24>>24?(b[L+1>>0]|0)==H<<24>>24:0){S=61;break a}ca=f[ca>>2]|0;if(!ca){aa=ba;S=46;break}}}else{aa=ba;S=46}}else{aa=0;S=46}while(0);if((S|0)==46){S=0;H=ln(16)|0;G=H+8|0;b[G>>0]=r;b[G+1>>0]=r>>8;f[H+12>>2]=A;f[H+4>>2]=J;f[H>>2]=0;ea=$(((f[t>>2]|0)+1|0)>>>0);fa=$(D>>>0);ga=$(n[l>>2]);do if(F|$(ga*fa)>>0<3|(D+-1&D|0)!=0)&1;O=~~$(W($(ea/ga)))>>>0;$h(i,G>>>0>>0?O:G);G=f[o>>2]|0;O=G+-1|0;if(!(O&G)){ha=G;ia=O&J;break}if(G>>>0>J>>>0){ha=G;ia=J}else{ha=G;ia=(J>>>0)%(G>>>0)|0}}else{ha=D;ia=aa}while(0);J=(f[i>>2]|0)+(ia<<2)|0;F=f[J>>2]|0;if(!F){f[H>>2]=f[v>>2];f[v>>2]=H;f[J>>2]=v;J=f[H>>2]|0;if(J|0){r=f[J+4>>2]|0;J=ha+-1|0;if(J&ha)if(r>>>0>>0)ja=r;else ja=(r>>>0)%(ha>>>0)|0;else ja=r&J;ka=(f[i>>2]|0)+(ja<<2)|0;S=59}}else{f[H>>2]=f[F>>2];ka=F;S=59}if((S|0)==59){S=0;f[ka>>2]=H}f[t>>2]=(f[t>>2]|0)+1;S=61}if((S|0)==61){S=0;F=w;J=f[F>>2]|0;r=un(J|0,f[F+4>>2]|0,A|0,0)|0;kh((f[f[x>>2]>>2]|0)+r|0,j|0,J|0)|0;J=f[k>>2]|0;f[J+(z<<2)>>2]=A;V=J;X=A+1|0;Y=J;Z=J;_=J}J=z+1|0;la=f[m>>2]|0;if(J>>>0>=la>>>0)break;e=V;z=J;A=X;B=Z;C=Y;D=f[o>>2]|0;E=_}if((X|0)==(la|0))ma=Z;else{Z=a+84|0;if(!(b[Z>>0]|0)){_=f[a+72>>2]|0;E=f[a+68>>2]|0;o=E;if((_|0)==(E|0))na=V;else{D=_-E>>2;E=0;do{_=o+(E<<2)|0;f[_>>2]=f[Y+(f[_>>2]<<2)>>2];E=E+1|0}while(E>>>0>>0);na=V}}else{b[Z>>0]=0;Z=a+68|0;V=a+72|0;D=f[V>>2]|0;E=f[Z>>2]|0;Y=D-E>>2;o=E;E=D;if(la>>>0<=Y>>>0)if(la>>>0>>0?(D=o+(la<<2)|0,(D|0)!=(E|0)):0){f[V>>2]=E+(~((E+-4-D|0)>>>2)<<2);oa=la}else oa=la;else{Ch(Z,la-Y|0,1220);oa=f[m>>2]|0}Y=f[k>>2]|0;if(!oa)na=Y;else{k=f[a+68>>2]|0;a=0;do{f[k+(a<<2)>>2]=f[Y+(a<<2)>>2];a=a+1|0}while(a>>>0>>0);na=Y}}f[m>>2]=X;ma=na}if(!ma)pa=X;else{na=f[p>>2]|0;if((na|0)!=(ma|0))f[p>>2]=na+(~((na+-4-ma|0)>>>2)<<2);Oq(ma);pa=X}}else pa=0;X=f[i+8>>2]|0;if(X|0){ma=X;do{X=ma;ma=f[ma>>2]|0;Oq(X)}while((ma|0)!=0)}ma=f[i>>2]|0;f[i>>2]=0;if(!ma){u=g;return pa|0}Oq(ma);u=g;return pa|0}function Yb(a,b){a=a|0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e>>2]=ca;R=(((T>>>0)%3|0|0)==0?2:-1)+T|0;if((R|0)==-1)da=-1;else da=f[(f[(f[p>>2]|0)+12>>2]|0)+(R<<2)>>2]|0;R=(ca|0)==-1;S=R?-1:(ca>>>0)/3|0;ea=(da|0)==-1;fa=ea?-1:(da>>>0)/3|0;Q=((M>>>0)%3|0|0)==0?T+-2|0:M;if(((Q|0)!=-1?(M=f[(f[p>>2]|0)+12>>2]|0,aa=f[M+(Q<<2)>>2]|0,(aa|0)!=-1):0)?(Q=(aa>>>0)/3|0,aa=f[n>>2]|0,(f[aa+(Q>>>5<<2)>>2]&1<<(Q&31)|0)==0):0){Q=(((T>>>0)%3|0|0)==0?2:-1)+T|0;do if((Q|0)!=-1){V=f[M+(Q<<2)>>2]|0;if((V|0)==-1)break;_=(V>>>0)/3|0;if(!(f[aa+(_>>>5<<2)>>2]&1<<(_&31))){U=62;break b}}while(0);if(!ea)xf(a,f[i>>2]|0,N,0,fa);nd(t,3);ga=f[e>>2]|0}else{if(!R){xf(a,f[i>>2]|0,N,1,S);aa=f[b>>2]|0;if((aa|0)==-1){U=52;break}else ha=aa}else ha=T;aa=(((ha>>>0)%3|0|0)==0?2:-1)+ha|0;if((aa|0)==-1){U=52;break}Q=f[(f[(f[p>>2]|0)+12>>2]|0)+(aa<<2)>>2]|0;if((Q|0)==-1){U=52;break}aa=(Q>>>0)/3|0;if(f[(f[n>>2]|0)+(aa>>>5<<2)>>2]&1<<(aa&31)|0){U=52;break}nd(t,5);ga=da}f[b>>2]=ga}if((K|0)>=(k|0))break a;J=K;L=f[n>>2]|0}do if((U|0)==43){U=0;f[e>>2]=-1;U=54}else if((U|0)==52){U=0;if(ea)U=54;else{xf(a,f[i>>2]|0,N,0,fa);U=54}}else if((U|0)==62){U=0;nd(t,1);f[F>>2]=(f[F>>2]|0)+1;if(P?(L=f[(f[w>>2]|0)+(O<<2)>>2]|0,(1<<(L&31)&f[(f[G>>2]|0)+(L>>>5<<2)>>2]|0)==0):0){f[g>>2]=f[b>>2];f[d>>2]=f[g>>2];Pe(a,d,0)|0}L=f[i>>2]|0;f[d>>2]=N;J=je(H,d)|0;f[J>>2]=L;L=f[j>>2]|0;f[L+-4>>2]=da;if((L|0)==(f[m>>2]|0)){Ri(h,e);break}else{f[L>>2]=f[e>>2];f[j>>2]=L+4;break}}while(0);if((U|0)==54){U=0;nd(t,7);f[j>>2]=(f[j>>2]|0)+-4}}}else U=11;while(0);if((U|0)==11){U=0;f[j>>2]=I+-4}I=f[j>>2]|0}while((f[h>>2]|0)!=(I|0));u=c;return 1}function Zb(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0;c=u;u=u+16|0;d=c+8|0;e=c;g=f[b>>2]|0;if((g|0)==-1){u=c;return}h=(g>>>0)/3|0;i=a+12|0;if(f[(f[i>>2]|0)+(h>>>5<<2)>>2]&1<<(h&31)|0){u=c;return}h=a+56|0;j=f[h>>2]|0;k=a+60|0;l=f[k>>2]|0;if((l|0)==(j|0))m=j;else{n=l+(~((l+-4-j|0)>>>2)<<2)|0;f[k>>2]=n;m=n}n=a+64|0;if((m|0)==(f[n>>2]|0))Ri(h,b);else{f[m>>2]=g;f[k>>2]=m+4}m=f[a>>2]|0;g=f[b>>2]|0;j=g+1|0;do if((g|0)!=-1){l=f[m+28>>2]|0;o=f[l+((((j>>>0)%3|0|0)==0?g+-2|0:j)<<2)>>2]|0;if(!((g>>>0)%3|0)){p=o;q=g+2|0;r=l;break}else{p=o;q=g+-1|0;r=l;break}}else{l=f[m+28>>2]|0;p=f[l+-4>>2]|0;q=-1;r=l}while(0);m=f[r+(q<<2)>>2]|0;q=a+24|0;r=f[q>>2]|0;g=r+(p>>>5<<2)|0;j=1<<(p&31);l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>>2]|0}while(0);f[b>>2]=G;H=(G>>>0)/3|0;I=B}}else{D=j;E=w;F=57}if((F|0)==57){F=0;y=D+1|0;if((D|0)==-1){F=58;break}l=((y>>>0)%3|0|0)==0?D+-2|0:y;if((l|0)!=-1?(f[(f[E>>2]|0)+(l>>>5<<2)>>2]&1<<(l&31)|0)==0:0)J=f[(f[(f[E+64>>2]|0)+12>>2]|0)+(l<<2)>>2]|0;else J=-1;f[d>>2]=J;l=(((D>>>0)%3|0|0)==0?2:-1)+D|0;if((l|0)!=-1?(f[(f[E>>2]|0)+(l>>>5<<2)>>2]&1<<(l&31)|0)==0:0)K=f[(f[(f[E+64>>2]|0)+12>>2]|0)+(l<<2)>>2]|0;else K=-1;l=(J|0)==-1;y=(J>>>0)/3|0;o=l?-1:y;g=(K|0)==-1;z=(K>>>0)/3|0;L=g?-1:z;do if(!l){M=f[i>>2]|0;if(f[M+(o>>>5<<2)>>2]&1<<(o&31)|0){F=67;break}if(g){N=J;O=y;break}if(!(f[M+(L>>>5<<2)>>2]&1<<(L&31))){F=72;break a}else{N=J;O=y}}else F=67;while(0);if((F|0)==67){F=0;if(g){F=69;break}if(!(f[(f[i>>2]|0)+(L>>>5<<2)>>2]&1<<(L&31))){N=K;O=z}else{F=69;break}}f[b>>2]=N;H=O;I=E}t=H;p=f[i>>2]|0;w=I}do if((F|0)==58){F=0;f[d>>2]=-1;F=69}else if((F|0)==72){F=0;w=f[k>>2]|0;f[w+-4>>2]=K;if((w|0)==(f[n>>2]|0)){Ri(h,d);P=f[k>>2]|0;break}else{f[w>>2]=f[d>>2];p=w+4|0;f[k>>2]=p;P=p;break}}while(0);if((F|0)==69){F=0;p=(f[k>>2]|0)+-4|0;f[k>>2]=p;P=p}Q=f[h>>2]|0;R=P}else{p=r+-4|0;f[k>>2]=p;Q=m;R=p}if((Q|0)==(R|0))break;else{r=R;m=Q}}u=c;return}function _b(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,i=0,j=0,k=0,l=0,m=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=Oa,K=Oa,L=Oa,M=0,N=0,O=0,P=0;e=u;u=u+64|0;g=e+40|0;i=e+16|0;j=e;k=Id(a,c)|0;if(k|0){f[i>>2]=k;f[g>>2]=f[i>>2];lf(a,g)|0}f[j>>2]=0;k=j+4|0;f[k>>2]=0;f[j+8>>2]=0;Fi(j,8);l=d;d=l;m=h[d>>0]|h[d+1>>0]<<8|h[d+2>>0]<<16|h[d+3>>0]<<24;d=l+4|0;l=h[d>>0]|h[d+1>>0]<<8|h[d+2>>0]<<16|h[d+3>>0]<<24;d=f[j>>2]|0;o=d;b[o>>0]=m;b[o+1>>0]=m>>8;b[o+2>>0]=m>>16;b[o+3>>0]=m>>24;m=d+4|0;b[m>>0]=l;b[m+1>>0]=l>>8;b[m+2>>0]=l>>16;b[m+3>>0]=l>>24;pj(i,c);c=i+12|0;f[c>>2]=0;l=i+16|0;f[l>>2]=0;f[i+20>>2]=0;m=f[k>>2]|0;d=f[j>>2]|0;o=m-d|0;if(!o){p=d;q=m;r=0}else{Fi(c,o);p=f[j>>2]|0;q=f[k>>2]|0;r=f[c>>2]|0}kh(r|0,p|0,q-p|0)|0;p=i+11|0;q=b[p>>0]|0;r=q<<24>>24<0;c=r?f[i>>2]|0:i;o=r?f[i+4>>2]|0:q&255;if(o>>>0>3){q=c;r=o;m=o;while(1){d=X(h[q>>0]|h[q+1>>0]<<8|h[q+2>>0]<<16|h[q+3>>0]<<24,1540483477)|0;r=(X(d>>>24^d,1540483477)|0)^(X(r,1540483477)|0);m=m+-4|0;if(m>>>0<=3)break;else q=q+4|0}q=o+-4|0;m=q&-4;s=q-m|0;t=c+(m+4)|0;v=r}else{s=o;t=c;v=o}switch(s|0){case 3:{w=h[t+2>>0]<<16^v;x=10;break}case 2:{w=v;x=10;break}case 1:{y=v;x=11;break}default:z=v}if((x|0)==10){y=h[t+1>>0]<<8^w;x=11}if((x|0)==11)z=X(y^h[t>>0],1540483477)|0;t=X(z>>>13^z,1540483477)|0;z=t>>>15^t;t=a+4|0;y=f[t>>2]|0;w=(y|0)==0;a:do if(!w){v=y+-1|0;s=(v&y|0)==0;if(!s)if(z>>>0>>0)A=z;else A=(z>>>0)%(y>>>0)|0;else A=z&v;r=f[(f[a>>2]|0)+(A<<2)>>2]|0;if((r|0)!=0?(m=f[r>>2]|0,(m|0)!=0):0){r=(o|0)==0;if(s){if(r){s=m;while(1){q=f[s+4>>2]|0;if(!((q|0)==(z|0)|(q&v|0)==(A|0))){B=A;x=52;break a}q=b[s+8+11>>0]|0;if(!((q<<24>>24<0?f[s+12>>2]|0:q&255)|0))break a;s=f[s>>2]|0;if(!s){B=A;x=52;break a}}}else C=m;while(1){s=f[C+4>>2]|0;if(!((s|0)==(z|0)|(s&v|0)==(A|0))){B=A;x=52;break a}s=C+8|0;q=b[s+11>>0]|0;d=q<<24>>24<0;D=q&255;do if(((d?f[C+12>>2]|0:D)|0)==(o|0)){q=f[s>>2]|0;if(d)if(!(Vk(q,c,o)|0))break a;else break;if((b[c>>0]|0)==(q&255)<<24>>24){q=s;E=D;F=c;do{E=E+-1|0;q=q+1|0;if(!E)break a;F=F+1|0}while((b[q>>0]|0)==(b[F>>0]|0))}}while(0);C=f[C>>2]|0;if(!C){B=A;x=52;break a}}}if(r){v=m;while(1){D=f[v+4>>2]|0;if((D|0)!=(z|0)){if(D>>>0>>0)G=D;else G=(D>>>0)%(y>>>0)|0;if((G|0)!=(A|0)){B=A;x=52;break a}}D=b[v+8+11>>0]|0;if(!((D<<24>>24<0?f[v+12>>2]|0:D&255)|0))break a;v=f[v>>2]|0;if(!v){B=A;x=52;break a}}}else H=m;while(1){v=f[H+4>>2]|0;if((v|0)!=(z|0)){if(v>>>0>>0)I=v;else I=(v>>>0)%(y>>>0)|0;if((I|0)!=(A|0)){B=A;x=52;break a}}v=H+8|0;r=b[v+11>>0]|0;D=r<<24>>24<0;s=r&255;do if(((D?f[H+12>>2]|0:s)|0)==(o|0)){r=f[v>>2]|0;if(D)if(!(Vk(r,c,o)|0))break a;else break;if((b[c>>0]|0)==(r&255)<<24>>24){r=v;d=s;F=c;do{d=d+-1|0;r=r+1|0;if(!d)break a;F=F+1|0}while((b[r>>0]|0)==(b[F>>0]|0))}}while(0);H=f[H>>2]|0;if(!H){B=A;x=52;break}}}else{B=A;x=52}}else{B=0;x=52}while(0);if((x|0)==52){oi(g,a,z,i);x=a+12|0;J=$(((f[x>>2]|0)+1|0)>>>0);K=$(y>>>0);L=$(n[a+16>>2]);do if(w|$(L*K)>>0<3|(y+-1&y|0)!=0)&1;H=~~$(W($(J/L)))>>>0;ei(a,A>>>0>>0?H:A);A=f[t>>2]|0;H=A+-1|0;if(!(H&A)){M=A;N=H&z;break}if(z>>>0>>0){M=A;N=z}else{M=A;N=(z>>>0)%(A>>>0)|0}}else{M=y;N=B}while(0);B=f[(f[a>>2]|0)+(N<<2)>>2]|0;if(!B){y=a+8|0;f[f[g>>2]>>2]=f[y>>2];f[y>>2]=f[g>>2];f[(f[a>>2]|0)+(N<<2)>>2]=y;y=f[g>>2]|0;N=f[y>>2]|0;if(!N)O=g;else{z=f[N+4>>2]|0;N=M+-1|0;if(N&M)if(z>>>0>>0)P=z;else P=(z>>>0)%(M>>>0)|0;else P=z&N;f[(f[a>>2]|0)+(P<<2)>>2]=y;O=g}}else{f[f[g>>2]>>2]=f[B>>2];f[B>>2]=f[g>>2];O=g}f[x>>2]=(f[x>>2]|0)+1;f[O>>2]=0}O=f[i+12>>2]|0;if(O|0){if((f[l>>2]|0)!=(O|0))f[l>>2]=O;Oq(O)}if((b[p>>0]|0)<0)Oq(f[i>>2]|0);i=f[j>>2]|0;if(!i){u=e;return}if((f[k>>2]|0)!=(i|0))f[k>>2]=i;Oq(i);u=e;return}function $b(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p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<24>>24<0?p:m&255;if(!q){r=m;s=p;t=0}else{Fi(j,q);r=b[l>>0]|0;s=f[o>>2]|0;t=f[j>>2]|0}o=r<<24>>24<0;kh(t|0,(o?f[d>>2]|0:d)|0,(o?s:r&255)|0)|0;pj(i,c);c=i+12|0;f[c>>2]=0;r=i+16|0;f[r>>2]=0;f[i+20>>2]=0;s=f[k>>2]|0;o=f[j>>2]|0;d=s-o|0;if(!d){v=o;w=s;x=0}else{Fi(c,d);v=f[j>>2]|0;w=f[k>>2]|0;x=f[c>>2]|0}kh(x|0,v|0,w-v|0)|0;v=i+11|0;w=b[v>>0]|0;x=w<<24>>24<0;c=x?f[i>>2]|0:i;d=x?f[i+4>>2]|0:w&255;if(d>>>0>3){w=c;x=d;s=d;while(1){o=X(h[w>>0]|h[w+1>>0]<<8|h[w+2>>0]<<16|h[w+3>>0]<<24,1540483477)|0;x=(X(o>>>24^o,1540483477)|0)^(X(x,1540483477)|0);s=s+-4|0;if(s>>>0<=3)break;else w=w+4|0}w=d+-4|0;s=w&-4;y=w-s|0;z=c+(s+4)|0;A=x}else{y=d;z=c;A=d}switch(y|0){case 3:{B=h[z+2>>0]<<16^A;C=12;break}case 2:{B=A;C=12;break}case 1:{D=A;C=13;break}default:E=A}if((C|0)==12){D=h[z+1>>0]<<8^B;C=13}if((C|0)==13)E=X(D^h[z>>0],1540483477)|0;z=X(E>>>13^E,1540483477)|0;E=z>>>15^z;z=a+4|0;D=f[z>>2]|0;B=(D|0)==0;a:do if(!B){A=D+-1|0;y=(A&D|0)==0;if(!y)if(E>>>0>>0)F=E;else F=(E>>>0)%(D>>>0)|0;else F=E&A;x=f[(f[a>>2]|0)+(F<<2)>>2]|0;if((x|0)!=0?(s=f[x>>2]|0,(s|0)!=0):0){x=(d|0)==0;if(y){if(x){y=s;while(1){w=f[y+4>>2]|0;if(!((w|0)==(E|0)|(w&A|0)==(F|0))){G=F;C=54;break a}w=b[y+8+11>>0]|0;if(!((w<<24>>24<0?f[y+12>>2]|0:w&255)|0))break a;y=f[y>>2]|0;if(!y){G=F;C=54;break a}}}else H=s;while(1){y=f[H+4>>2]|0;if(!((y|0)==(E|0)|(y&A|0)==(F|0))){G=F;C=54;break a}y=H+8|0;w=b[y+11>>0]|0;o=w<<24>>24<0;t=w&255;do if(((o?f[H+12>>2]|0:t)|0)==(d|0)){w=f[y>>2]|0;if(o)if(!(Vk(w,c,d)|0))break a;else break;if((b[c>>0]|0)==(w&255)<<24>>24){w=y;l=t;q=c;do{l=l+-1|0;w=w+1|0;if(!l)break a;q=q+1|0}while((b[w>>0]|0)==(b[q>>0]|0))}}while(0);H=f[H>>2]|0;if(!H){G=F;C=54;break a}}}if(x){A=s;while(1){t=f[A+4>>2]|0;if((t|0)!=(E|0)){if(t>>>0>>0)I=t;else I=(t>>>0)%(D>>>0)|0;if((I|0)!=(F|0)){G=F;C=54;break a}}t=b[A+8+11>>0]|0;if(!((t<<24>>24<0?f[A+12>>2]|0:t&255)|0))break a;A=f[A>>2]|0;if(!A){G=F;C=54;break a}}}else J=s;while(1){A=f[J+4>>2]|0;if((A|0)!=(E|0)){if(A>>>0>>0)K=A;else K=(A>>>0)%(D>>>0)|0;if((K|0)!=(F|0)){G=F;C=54;break a}}A=J+8|0;x=b[A+11>>0]|0;t=x<<24>>24<0;y=x&255;do if(((t?f[J+12>>2]|0:y)|0)==(d|0)){x=f[A>>2]|0;if(t)if(!(Vk(x,c,d)|0))break a;else break;if((b[c>>0]|0)==(x&255)<<24>>24){x=A;o=y;q=c;do{o=o+-1|0;x=x+1|0;if(!o)break a;q=q+1|0}while((b[x>>0]|0)==(b[q>>0]|0))}}while(0);J=f[J>>2]|0;if(!J){G=F;C=54;break}}}else{G=F;C=54}}else{G=0;C=54}while(0);if((C|0)==54){oi(g,a,E,i);C=a+12|0;L=$(((f[C>>2]|0)+1|0)>>>0);M=$(D>>>0);N=$(n[a+16>>2]);do if(B|$(N*M)>>0<3|(D+-1&D|0)!=0)&1;J=~~$(W($(L/N)))>>>0;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;if((q|0)==(f[o+12>>2]|0))Ri(n,e);else{f[q>>2]=c;f[p>>2]=q+4}q=f[e>>2]|0;r=o+16|0;s=o+20|0;o=f[s>>2]|0;t=f[r>>2]|0;v=o-t>>2;w=t;if((q|0)<(v|0)){x=w;y=q}else{t=q+1|0;f[g>>2]=-1;z=o;if(t>>>0<=v>>>0)if(t>>>0>>0?(o=w+(t<<2)|0,(o|0)!=(z|0)):0){f[s>>2]=z+(~((z+-4-o|0)>>>2)<<2);A=q;B=w}else{A=q;B=w}else{Ch(r,t-v|0,g);A=f[e>>2]|0;B=f[r>>2]|0}x=B;y=A}f[x+(y<<2)>>2]=((f[p>>2]|0)-(f[n>>2]|0)>>2)+-1;C=1;u=d;return C|0}n=(Qa[f[(f[a>>2]|0)+40>>2]&127](a)|0)+52|0;p=f[(f[(f[n>>2]|0)+84>>2]|0)+(c<<2)>>2]|0;n=(Qa[f[(f[a>>2]|0)+40>>2]&127](a)|0)+4|0;y=f[(f[(f[n>>2]|0)+8>>2]|0)+(c<<2)>>2]|0;f[g>>2]=-1;n=a+172|0;x=f[a+176>>2]|0;A=f[n>>2]|0;B=A;a:do if((x|0)==(A|0))D=-1;else{r=(x-A|0)/136|0;v=0;while(1){if((f[B+(v*136|0)>>2]|0)==(c|0))break;t=v+1|0;if(t>>>0>>0)v=t;else{D=-1;break a}}f[g>>2]=v;D=v}while(0);b:do if(!(b[m>>0]|0)){A=(f[y+56>>2]|0)==0;do if(!((p|0)==0|A)){if((p|0)==1?b[B+(D*136|0)+28>>0]|0:0)break;x=ln(88)|0;r=f[a+8>>2]|0;t=B+(D*136|0)+104|0;f[x+4>>2]=0;f[x>>2]=3564;w=x+12|0;f[w>>2]=3588;q=x+64|0;f[q>>2]=0;f[x+68>>2]=0;f[x+72>>2]=0;o=x+16|0;z=o+44|0;do{f[o>>2]=0;o=o+4|0}while((o|0)<(z|0));f[x+76>>2]=r;f[x+80>>2]=t;s=x+84|0;f[s>>2]=0;f[h>>2]=3588;E=h+4|0;F=E+4|0;f[F>>2]=0;f[F+4>>2]=0;f[F+8>>2]=0;f[F+12>>2]=0;f[F+16>>2]=0;f[F+20>>2]=0;F=B+(D*136|0)+4|0;G=i+4|0;f[G>>2]=3588;H=i+56|0;f[H>>2]=0;I=i+60|0;f[I>>2]=0;f[i+64>>2]=0;o=i+8|0;z=o+44|0;do{f[o>>2]=0;o=o+4|0}while((o|0)<(z|0));f[E>>2]=F;o=f[B+(D*136|0)+68>>2]|0;z=((f[o+4>>2]|0)-(f[o>>2]|0)>>2>>>0)/3|0;b[e>>0]=0;qh(h+8|0,z,e);Va[f[(f[h>>2]|0)+8>>2]&127](h);Df(j,h);Df(e,j);f[i>>2]=f[e+4>>2];z=i+4|0;fg(z,e)|0;f[e>>2]=3588;o=f[e+20>>2]|0;if(o|0)Oq(o);o=f[e+8>>2]|0;if(o|0)Oq(o);f[i+36>>2]=F;f[i+40>>2]=t;f[i+44>>2]=r;f[i+48>>2]=x;f[j>>2]=3588;o=f[j+20>>2]|0;if(o|0)Oq(o);o=f[j+8>>2]|0;if(o|0)Oq(o);f[s>>2]=a+72;f[x+8>>2]=f[i>>2];fg(w,z)|0;z=x+44|0;o=i+36|0;f[z>>2]=f[o>>2];f[z+4>>2]=f[o+4>>2];f[z+8>>2]=f[o+8>>2];f[z+12>>2]=f[o+12>>2];b[z+16>>0]=b[o+16>>0]|0;ng(q,f[H>>2]|0,f[I>>2]|0);o=x;z=f[H>>2]|0;if(z|0){J=f[I>>2]|0;if((J|0)!=(z|0))f[I>>2]=J+(~((J+-4-z|0)>>>2)<<2);Oq(z)}f[G>>2]=3588;z=f[i+24>>2]|0;if(z|0)Oq(z);z=f[i+12>>2]|0;if(z|0)Oq(z);f[h>>2]=3588;z=f[h+20>>2]|0;if(z|0)Oq(z);z=f[h+8>>2]|0;if(z|0)Oq(z);K=0;L=o;M=54;break b}while(0);if(!A){b[B+(D*136|0)+100>>0]=0;N=B+(D*136|0)+104|0;M=26}else M=24}else M=24;while(0);if((M|0)==24){N=a+40|0;M=26}if((M|0)==26){D=(Qa[f[(f[a>>2]|0)+40>>2]&127](a)|0)+48|0;do if((mi(f[D>>2]|0)|0)==0?(f[y+56>>2]|0)==0:0){if(b[m>>0]|0?(B=f[a+8>>2]|0,((f[B+12>>2]|0)-(f[B+8>>2]|0)|0)>4):0){M=31;break}gf(e,a,N);O=1;P=f[e>>2]|0}else M=31;while(0);if((M|0)==31){Vd(e,a,N);O=0;P=f[e>>2]|0}if(!P)Q=0;else{K=O;L=P;M=54}}if((M|0)==54){M=f[g>>2]|0;if((M|0)==-1)R=a+68|0;else R=(f[n>>2]|0)+(M*136|0)+132|0;f[R>>2]=K;K=ln(76)|0;f[k>>2]=L;rl(K,k,c);c=K;K=f[k>>2]|0;f[k>>2]=0;if(K|0)Va[f[(f[K>>2]|0)+4>>2]&127](K);K=a+188|0;k=f[K>>2]|0;if((k|0)==(f[a+192>>2]|0))Ri(a+184|0,g);else{f[k>>2]=f[g>>2];f[K>>2]=k+4}k=Qa[f[(f[a>>2]|0)+40>>2]&127](a)|0;f[l>>2]=c;a=k+12|0;K=f[a>>2]|0;if(K>>>0<(f[k+16>>2]|0)>>>0){f[l>>2]=0;f[K>>2]=c;f[a>>2]=K+4;S=l}else{Qg(k+8|0,l);S=l}l=f[S>>2]|0;f[S>>2]=0;if(!l)Q=1;else{Va[f[(f[l>>2]|0)+4>>2]&127](l);Q=1}}C=Q;u=d;return C|0}function cc(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0;d=u;u=u+192|0;e=d+152|0;g=d+144|0;h=d+72|0;i=d;j=d+112|0;k=d+108|0;l=d+104|0;m=a+288|0;if(b[m>>0]|0?(n=Qa[f[(f[a>>2]|0)+40>>2]&127](a)|0,((f[n+12>>2]|0)-(f[n+8>>2]|0)|0)>0):0){n=(Qa[f[(f[a>>2]|0)+40>>2]&127](a)|0)+8|0;o=f[f[n>>2]>>2]|0;f[e>>2]=c;n=o+4|0;p=o+8|0;q=f[p>>2]|0;if((q|0)==(f[o+12>>2]|0))Ri(n,e);else{f[q>>2]=c;f[p>>2]=q+4}q=f[e>>2]|0;r=o+16|0;s=o+20|0;o=f[s>>2]|0;t=f[r>>2]|0;v=o-t>>2;w=t;if((q|0)<(v|0)){x=w;y=q}else{t=q+1|0;f[g>>2]=-1;z=o;if(t>>>0<=v>>>0)if(t>>>0>>0?(o=w+(t<<2)|0,(o|0)!=(z|0)):0){f[s>>2]=z+(~((z+-4-o|0)>>>2)<<2);A=q;B=w}else{A=q;B=w}else{Ch(r,t-v|0,g);A=f[e>>2]|0;B=f[r>>2]|0}x=B;y=A}f[x+(y<<2)>>2]=((f[p>>2]|0)-(f[n>>2]|0)>>2)+-1;C=1;u=d;return C|0}n=(Qa[f[(f[a>>2]|0)+40>>2]&127](a)|0)+52|0;p=f[(f[(f[n>>2]|0)+84>>2]|0)+(c<<2)>>2]|0;n=(Qa[f[(f[a>>2]|0)+40>>2]&127](a)|0)+4|0;y=f[(f[(f[n>>2]|0)+8>>2]|0)+(c<<2)>>2]|0;f[g>>2]=-1;n=a+172|0;x=f[a+176>>2]|0;A=f[n>>2]|0;B=A;a:do if((x|0)==(A|0))D=-1;else{r=(x-A|0)/136|0;v=0;while(1){if((f[B+(v*136|0)>>2]|0)==(c|0))break;t=v+1|0;if(t>>>0>>0)v=t;else{D=-1;break a}}f[g>>2]=v;D=v}while(0);b:do if(!(b[m>>0]|0)){A=(f[y+56>>2]|0)==0;do if(!((p|0)==0|A)){if((p|0)==1?b[B+(D*136|0)+28>>0]|0:0)break;x=ln(88)|0;r=f[a+8>>2]|0;t=B+(D*136|0)+104|0;f[x+4>>2]=0;f[x>>2]=3564;w=x+12|0;f[w>>2]=3588;q=x+64|0;f[q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3588;z=f[h+20>>2]|0;if(z|0)Oq(z);z=f[h+8>>2]|0;if(z|0)Oq(z);K=0;L=o;M=54;break b}while(0);if(!A){b[B+(D*136|0)+100>>0]=0;N=B+(D*136|0)+104|0;M=26}else M=24}else M=24;while(0);if((M|0)==24){N=a+40|0;M=26}if((M|0)==26){D=(Qa[f[(f[a>>2]|0)+40>>2]&127](a)|0)+48|0;do if((mi(f[D>>2]|0)|0)==0?(f[y+56>>2]|0)==0:0){if(b[m>>0]|0?(B=f[a+8>>2]|0,((f[B+12>>2]|0)-(f[B+8>>2]|0)|0)>4):0){M=31;break}gf(e,a,N);O=1;P=f[e>>2]|0}else M=31;while(0);if((M|0)==31){Vd(e,a,N);O=0;P=f[e>>2]|0}if(!P)Q=0;else{K=O;L=P;M=54}}if((M|0)==54){M=f[g>>2]|0;if((M|0)==-1)R=a+68|0;else R=(f[n>>2]|0)+(M*136|0)+132|0;f[R>>2]=K;K=ln(76)|0;f[k>>2]=L;rl(K,k,c);c=K;K=f[k>>2]|0;f[k>>2]=0;if(K|0)Va[f[(f[K>>2]|0)+4>>2]&127](K);K=a+188|0;k=f[K>>2]|0;if((k|0)==(f[a+192>>2]|0))Ri(a+184|0,g);else{f[k>>2]=f[g>>2];f[K>>2]=k+4}k=Qa[f[(f[a>>2]|0)+40>>2]&127](a)|0;f[l>>2]=c;a=k+12|0;K=f[a>>2]|0;if(K>>>0<(f[k+16>>2]|0)>>>0){f[l>>2]=0;f[K>>2]=c;f[a>>2]=K+4;S=l}else{Qg(k+8|0,l);S=l}l=f[S>>2]|0;f[S>>2]=0;if(!l)Q=1;else{Va[f[(f[l>>2]|0)+4>>2]&127](l);Q=1}}C=Q;u=d;return C|0}function dc(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=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1;t=f[l>>2]|0}else t=m;m=t+(q>>>5<<2)|0;t=1<<(q&31);r=f[m>>2]|0;if(!(r&t)){f[m>>2]=r|t;t=f[b>>2]|0;do if((t|0)!=-1)if(!((t>>>0)%3|0)){v=t+2|0;break}else{v=t+-1|0;break}else v=-1;while(0);f[e>>2]=v;t=f[(f[(f[a+44>>2]|0)+96>>2]|0)+(((v>>>0)/3|0)*12|0)+(((v>>>0)%3|0)<<2)>>2]|0;v=f[a+48>>2]|0;f[d>>2]=t;r=f[v+4>>2]|0;v=r+4|0;m=f[v>>2]|0;if((m|0)==(f[r+8>>2]|0))Ri(r,d);else{f[m>>2]=t;f[v>>2]=m+4}m=a+40|0;v=f[m>>2]|0;t=v+4|0;r=f[t>>2]|0;if((r|0)==(f[v+8>>2]|0)){Ri(v,e);w=f[m>>2]|0}else{f[r>>2]=f[e>>2];f[t>>2]=r+4;w=v}v=w+24|0;f[(f[w+12>>2]|0)+(q<<2)>>2]=f[v>>2];f[v>>2]=(f[v>>2]|0)+1}v=f[h>>2]|0;q=f[k>>2]|0;if((v|0)==(q|0)){u=c;return}w=a+44|0;r=a+48|0;t=a+40|0;m=q;q=v;while(1){v=f[m+-4>>2]|0;f[b>>2]=v;p=(v>>>0)/3|0;if((v|0)!=-1?(v=f[i>>2]|0,(f[v+(p>>>5<<2)>>2]&1<<(p&31)|0)==0):0){s=p;p=v;a:while(1){v=p+(s>>>5<<2)|0;f[v>>2]=f[v>>2]|1<<(s&31);v=f[b>>2]|0;if((v|0)==-1)x=-1;else x=f[(f[f[a>>2]>>2]|0)+(v<<2)>>2]|0;g=(f[l>>2]|0)+(x>>>5<<2)|0;j=1<<(x&31);o=f[g>>2]|0;do if(!(j&o)){y=f[a>>2]|0;z=f[(f[y+24>>2]|0)+(x<<2)>>2]|0;A=z+1|0;if(((z|0)!=-1?(B=((A>>>0)%3|0|0)==0?z+-2|0:A,(B|0)!=-1):0)?(A=f[(f[y+12>>2]|0)+(B<<2)>>2]|0,B=A+1|0,(A|0)!=-1):0)C=((((B>>>0)%3|0|0)==0?A+-2|0:B)|0)==-1;else C=1;f[g>>2]=o|j;B=f[b>>2]|0;f[e>>2]=B;A=f[(f[(f[w>>2]|0)+96>>2]|0)+(((B>>>0)/3|0)*12|0)+(((B>>>0)%3|0)<<2)>>2]|0;B=f[r>>2]|0;f[d>>2]=A;y=f[B+4>>2]|0;B=y+4|0;z=f[B>>2]|0;if((z|0)==(f[y+8>>2]|0))Ri(y,d);else{f[z>>2]=A;f[B>>2]=z+4}z=f[t>>2]|0;B=z+4|0;A=f[B>>2]|0;if((A|0)==(f[z+8>>2]|0)){Ri(z,e);D=f[t>>2]|0}else{f[A>>2]=f[e>>2];f[B>>2]=A+4;D=z}z=D+24|0;f[(f[D+12>>2]|0)+(x<<2)>>2]=f[z>>2];f[z>>2]=(f[z>>2]|0)+1;if(C){E=f[b>>2]|0;F=60;break}z=f[a>>2]|0;A=f[b>>2]|0;do if((A|0)==-1)G=-1;else{B=A+1|0;y=((B>>>0)%3|0|0)==0?A+-2|0:B;if((y|0)==-1){G=-1;break}G=f[(f[z+12>>2]|0)+(y<<2)>>2]|0}while(0);f[b>>2]=G;H=(G>>>0)/3|0}else{E=v;F=60}while(0);if((F|0)==60){F=0;v=f[a>>2]|0;if((E|0)==-1){F=61;break}j=E+1|0;o=((j>>>0)%3|0|0)==0?E+-2|0:j;if((o|0)==-1)I=-1;else I=f[(f[v+12>>2]|0)+(o<<2)>>2]|0;f[d>>2]=I;o=(((E>>>0)%3|0|0)==0?2:-1)+E|0;if((o|0)==-1)J=-1;else J=f[(f[v+12>>2]|0)+(o<<2)>>2]|0;o=(I|0)==-1;v=(I>>>0)/3|0;j=o?-1:v;g=(J|0)==-1;z=(J>>>0)/3|0;A=g?-1:z;do if(!o){y=f[i>>2]|0;if(f[y+(j>>>5<<2)>>2]&1<<(j&31)|0){F=68;break}if(g){K=I;L=v;break}if(!(f[y+(A>>>5<<2)>>2]&1<<(A&31))){F=73;break a}else{K=I;L=v}}else F=68;while(0);if((F|0)==68){F=0;if(g){F=70;break}if(!(f[(f[i>>2]|0)+(A>>>5<<2)>>2]&1<<(A&31))){K=J;L=z}else{F=70;break}}f[b>>2]=K;H=L}s=H;p=f[i>>2]|0}do if((F|0)==61){F=0;f[d>>2]=-1;F=70}else if((F|0)==73){F=0;p=f[k>>2]|0;f[p+-4>>2]=J;if((p|0)==(f[n>>2]|0)){Ri(h,d);M=f[k>>2]|0;break}else{f[p>>2]=f[d>>2];s=p+4|0;f[k>>2]=s;M=s;break}}while(0);if((F|0)==70){F=0;s=(f[k>>2]|0)+-4|0;f[k>>2]=s;M=s}N=f[h>>2]|0;O=M}else{s=m+-4|0;f[k>>2]=s;N=q;O=s}if((N|0)==(O|0))break;else{m=O;q=N}}u=c;return}function ec(a,c,e){a=a|0;c=c|0;e=e|0;var g=0,i=0,j=0,k=0,l=0,m=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,X=0,Y=0,Z=0,_=0,aa=0,ba=0,ca=0,da=0,ea=Oa,fa=Oa,ga=Oa,ha=0,ia=0,ja=0,ka=0,la=0,ma=0,na=0,oa=0,pa=0;g=u;u=u+48|0;i=g+12|0;j=g+32|0;k=g;l=i+16|0;f[i>>2]=0;f[i+4>>2]=0;f[i+8>>2]=0;f[i+12>>2]=0;n[l>>2]=$(1.0);m=a+80|0;o=f[m>>2]|0;f[k>>2]=0;p=k+4|0;f[p>>2]=0;f[k+8>>2]=0;if(o){if(o>>>0>1073741823)aq(k);q=o<<2;r=ln(q)|0;f[k>>2]=r;s=r+(o<<2)|0;f[k+8>>2]=s;sj(r|0,0,q|0)|0;f[p>>2]=s;s=c+48|0;q=c+40|0;o=i+4|0;t=i+12|0;v=i+8|0;w=a+40|0;x=a+64|0;y=f[e>>2]|0;e=0;z=r;A=0;B=0;C=r;D=r;E=r;while(1){r=s;F=f[r>>2]|0;G=f[r+4>>2]|0;r=q;H=un(f[r>>2]|0,f[r+4>>2]|0,y+A|0,0)|0;r=Vn(H|0,I|0,F|0,G|0)|0;G=(f[f[c>>2]>>2]|0)+r|0;r=h[G>>0]|h[G+1>>0]<<8;d[j>>1]=r;G=(r^318)&65535;a:do if(e){F=e+-1|0;H=(F&e|0)==0;if(!H)if(e>>>0>G>>>0)J=G;else J=(G>>>0)%(e>>>0)|0;else J=F&G;K=f[i>>2]|0;L=f[K+(J<<2)>>2]|0;b:do if(L|0?(M=f[L>>2]|0,M|0):0){c:do if(H){N=M;while(1){O=f[N+4>>2]|0;P=(O|0)==(G|0);if(!(P|(O&F|0)==(J|0)))break b;if(P?(d[N+8>>1]|0)==r<<16>>16:0){Q=N;break c}N=f[N>>2]|0;if(!N)break b}}else{N=M;while(1){P=f[N+4>>2]|0;if((P|0)==(G|0)){if((d[N+8>>1]|0)==r<<16>>16){Q=N;break c}}else{if(P>>>0>>0)R=P;else R=(P>>>0)%(e>>>0)|0;if((R|0)!=(J|0))break b}N=f[N>>2]|0;if(!N)break b}}while(0);f[E+(A<<2)>>2]=f[Q+12>>2];S=z;T=B;U=D;V=C;X=E;break a}while(0);if(!H)if(e>>>0>G>>>0)Y=G;else Y=(G>>>0)%(e>>>0)|0;else Y=F&G;L=f[K+(Y<<2)>>2]|0;if(!L){Z=Y;_=e;aa=0;ba=40}else{if(H){M=L;while(1){M=f[M>>2]|0;if(!M){Z=Y;_=e;aa=0;ba=40;break a}N=f[M+4>>2]|0;if(!((N|0)==(G|0)|(N&F|0)==(Y|0))){Z=Y;_=e;aa=0;ba=40;break a}if((d[M+8>>1]|0)==r<<16>>16){ba=55;break a}}}else ca=L;while(1){ca=f[ca>>2]|0;if(!ca){Z=Y;_=e;aa=0;ba=40;break a}M=f[ca+4>>2]|0;if((M|0)!=(G|0)){if(M>>>0>>0)da=M;else da=(M>>>0)%(e>>>0)|0;if((da|0)!=(Y|0)){Z=Y;_=e;aa=0;ba=40;break a}}if((d[ca+8>>1]|0)==r<<16>>16){ba=55;break}}}}else{Z=0;_=0;aa=1;ba=40}while(0);if((ba|0)==40){ba=0;L=ln(16)|0;d[L+8>>1]=r;f[L+12>>2]=B;f[L+4>>2]=G;f[L>>2]=0;ea=$(((f[t>>2]|0)+1|0)>>>0);fa=$(_>>>0);ga=$(n[l>>2]);do if(aa|$(ga*fa)>>0<3|(_+-1&_|0)!=0)&1;F=~~$(W($(ea/ga)))>>>0;Vh(i,M>>>0>>0?F:M);M=f[o>>2]|0;F=M+-1|0;if(!(F&M)){ha=M;ia=F&G;break}if(M>>>0>G>>>0){ha=M;ia=G}else{ha=M;ia=(G>>>0)%(M>>>0)|0}}else{ha=_;ia=Z}while(0);G=(f[i>>2]|0)+(ia<<2)|0;r=f[G>>2]|0;if(!r){f[L>>2]=f[v>>2];f[v>>2]=L;f[G>>2]=v;G=f[L>>2]|0;if(G|0){M=f[G+4>>2]|0;G=ha+-1|0;if(G&ha)if(M>>>0>>0)ja=M;else ja=(M>>>0)%(ha>>>0)|0;else ja=M&G;ka=(f[i>>2]|0)+(ja<<2)|0;ba=53}}else{f[L>>2]=f[r>>2];ka=r;ba=53}if((ba|0)==53){ba=0;f[ka>>2]=L}f[t>>2]=(f[t>>2]|0)+1;ba=55}if((ba|0)==55){ba=0;r=w;G=f[r>>2]|0;M=un(G|0,f[r+4>>2]|0,B|0,0)|0;kh((f[f[x>>2]>>2]|0)+M|0,j|0,G|0)|0;G=f[k>>2]|0;f[G+(A<<2)>>2]=B;S=G;T=B+1|0;U=G;V=G;X=G}G=A+1|0;la=f[m>>2]|0;if(G>>>0>=la>>>0)break;e=f[o>>2]|0;z=S;A=G;B=T;C=V;D=U;E=X}if((T|0)==(la|0))ma=V;else{V=a+84|0;if(!(b[V>>0]|0)){X=f[a+72>>2]|0;E=f[a+68>>2]|0;D=E;if((X|0)==(E|0))na=S;else{C=X-E>>2;E=0;do{X=D+(E<<2)|0;f[X>>2]=f[U+(f[X>>2]<<2)>>2];E=E+1|0}while(E>>>0>>0);na=S}}else{b[V>>0]=0;V=a+68|0;S=a+72|0;C=f[S>>2]|0;E=f[V>>2]|0;U=C-E>>2;D=E;E=C;if(la>>>0<=U>>>0)if(la>>>0>>0?(C=D+(la<<2)|0,(C|0)!=(E|0)):0){f[S>>2]=E+(~((E+-4-C|0)>>>2)<<2);oa=la}else oa=la;else{Ch(V,la-U|0,1220);oa=f[m>>2]|0}U=f[k>>2]|0;if(!oa)na=U;else{k=f[a+68>>2]|0;a=0;do{f[k+(a<<2)>>2]=f[U+(a<<2)>>2];a=a+1|0}while(a>>>0>>0);na=U}}f[m>>2]=T;ma=na}if(!ma)pa=T;else{na=f[p>>2]|0;if((na|0)!=(ma|0))f[p>>2]=na+(~((na+-4-ma|0)>>>2)<<2);Oq(ma);pa=T}}else pa=0;T=f[i+8>>2]|0;if(T|0){ma=T;do{T=ma;ma=f[ma>>2]|0;Oq(T)}while((ma|0)!=0)}ma=f[i>>2]|0;f[i>>2]=0;if(!ma){u=g;return pa|0}Oq(ma);u=g;return pa|0}function fc(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,i=0,j=0,k=0,l=0,m=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=Oa,K=Oa,L=Oa,M=0,N=0,O=0,P=0;e=u;u=u+64|0;g=e+40|0;i=e+16|0;j=e;k=Id(a,c)|0;if(k|0){f[i>>2]=k;f[g>>2]=f[i>>2];lf(a,g)|0}f[j>>2]=0;k=j+4|0;f[k>>2]=0;f[j+8>>2]=0;Fi(j,4);l=f[j>>2]|0;m=h[d>>0]|h[d+1>>0]<<8|h[d+2>>0]<<16|h[d+3>>0]<<24;b[l>>0]=m;b[l+1>>0]=m>>8;b[l+2>>0]=m>>16;b[l+3>>0]=m>>24;pj(i,c);c=i+12|0;f[c>>2]=0;m=i+16|0;f[m>>2]=0;f[i+20>>2]=0;l=f[k>>2]|0;d=f[j>>2]|0;o=l-d|0;if(!o){p=d;q=l;r=0}else{Fi(c,o);p=f[j>>2]|0;q=f[k>>2]|0;r=f[c>>2]|0}kh(r|0,p|0,q-p|0)|0;p=i+11|0;q=b[p>>0]|0;r=q<<24>>24<0;c=r?f[i>>2]|0:i;o=r?f[i+4>>2]|0:q&255;if(o>>>0>3){q=c;r=o;l=o;while(1){d=X(h[q>>0]|h[q+1>>0]<<8|h[q+2>>0]<<16|h[q+3>>0]<<24,1540483477)|0;r=(X(d>>>24^d,1540483477)|0)^(X(r,1540483477)|0);l=l+-4|0;if(l>>>0<=3)break;else q=q+4|0}q=o+-4|0;l=q&-4;s=q-l|0;t=c+(l+4)|0;v=r}else{s=o;t=c;v=o}switch(s|0){case 3:{w=h[t+2>>0]<<16^v;x=10;break}case 2:{w=v;x=10;break}case 1:{y=v;x=11;break}default:z=v}if((x|0)==10){y=h[t+1>>0]<<8^w;x=11}if((x|0)==11)z=X(y^h[t>>0],1540483477)|0;t=X(z>>>13^z,1540483477)|0;z=t>>>15^t;t=a+4|0;y=f[t>>2]|0;w=(y|0)==0;a:do if(!w){v=y+-1|0;s=(v&y|0)==0;if(!s)if(z>>>0>>0)A=z;else A=(z>>>0)%(y>>>0)|0;else A=z&v;r=f[(f[a>>2]|0)+(A<<2)>>2]|0;if((r|0)!=0?(l=f[r>>2]|0,(l|0)!=0):0){r=(o|0)==0;if(s){if(r){s=l;while(1){q=f[s+4>>2]|0;if(!((q|0)==(z|0)|(q&v|0)==(A|0))){B=A;x=52;break a}q=b[s+8+11>>0]|0;if(!((q<<24>>24<0?f[s+12>>2]|0:q&255)|0))break a;s=f[s>>2]|0;if(!s){B=A;x=52;break a}}}else C=l;while(1){s=f[C+4>>2]|0;if(!((s|0)==(z|0)|(s&v|0)==(A|0))){B=A;x=52;break a}s=C+8|0;q=b[s+11>>0]|0;d=q<<24>>24<0;D=q&255;do if(((d?f[C+12>>2]|0:D)|0)==(o|0)){q=f[s>>2]|0;if(d)if(!(Vk(q,c,o)|0))break a;else break;if((b[c>>0]|0)==(q&255)<<24>>24){q=s;E=D;F=c;do{E=E+-1|0;q=q+1|0;if(!E)break a;F=F+1|0}while((b[q>>0]|0)==(b[F>>0]|0))}}while(0);C=f[C>>2]|0;if(!C){B=A;x=52;break a}}}if(r){v=l;while(1){D=f[v+4>>2]|0;if((D|0)!=(z|0)){if(D>>>0>>0)G=D;else G=(D>>>0)%(y>>>0)|0;if((G|0)!=(A|0)){B=A;x=52;break a}}D=b[v+8+11>>0]|0;if(!((D<<24>>24<0?f[v+12>>2]|0:D&255)|0))break a;v=f[v>>2]|0;if(!v){B=A;x=52;break a}}}else H=l;while(1){v=f[H+4>>2]|0;if((v|0)!=(z|0)){if(v>>>0>>0)I=v;else I=(v>>>0)%(y>>>0)|0;if((I|0)!=(A|0)){B=A;x=52;break a}}v=H+8|0;r=b[v+11>>0]|0;D=r<<24>>24<0;s=r&255;do if(((D?f[H+12>>2]|0:s)|0)==(o|0)){r=f[v>>2]|0;if(D)if(!(Vk(r,c,o)|0))break a;else break;if((b[c>>0]|0)==(r&255)<<24>>24){r=v;d=s;F=c;do{d=d+-1|0;r=r+1|0;if(!d)break a;F=F+1|0}while((b[r>>0]|0)==(b[F>>0]|0))}}while(0);H=f[H>>2]|0;if(!H){B=A;x=52;break}}}else{B=A;x=52}}else{B=0;x=52}while(0);if((x|0)==52){oi(g,a,z,i);x=a+12|0;J=$(((f[x>>2]|0)+1|0)>>>0);K=$(y>>>0);L=$(n[a+16>>2]);do if(w|$(L*K)>>0<3|(y+-1&y|0)!=0)&1;H=~~$(W($(J/L)))>>>0;ei(a,A>>>0>>0?H:A);A=f[t>>2]|0;H=A+-1|0;if(!(H&A)){M=A;N=H&z;break}if(z>>>0>>0){M=A;N=z}else{M=A;N=(z>>>0)%(A>>>0)|0}}else{M=y;N=B}while(0);B=f[(f[a>>2]|0)+(N<<2)>>2]|0;if(!B){y=a+8|0;f[f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>>2]|0;d=0;x=p;y=0;z=0;A=p;B=p;C=p;while(1){p=q;D=f[p>>2]|0;E=f[p+4>>2]|0;p=o;F=un(f[p>>2]|0,f[p+4>>2]|0,w+y|0,0)|0;p=Vn(F|0,I|0,D|0,E|0)|0;E=b[(f[f[c>>2]>>2]|0)+p>>0]|0;b[h>>0]=E;p=E&255^318;a:do if(d){D=d+-1|0;F=(D&d|0)==0;if(!F)if(p>>>0>>0)G=p;else G=(p>>>0)%(d>>>0)|0;else G=D&p;H=f[g>>2]|0;J=f[H+(G<<2)>>2]|0;b:do if(J|0?(K=f[J>>2]|0,K|0):0){c:do if(F){L=K;while(1){M=f[L+4>>2]|0;N=(M|0)==(p|0);if(!(N|(M&D|0)==(G|0)))break b;if(N?(b[L+8>>0]|0)==E<<24>>24:0){O=L;break c}L=f[L>>2]|0;if(!L)break b}}else{L=K;while(1){N=f[L+4>>2]|0;if((N|0)==(p|0)){if((b[L+8>>0]|0)==E<<24>>24){O=L;break c}}else{if(N>>>0>>0)P=N;else P=(N>>>0)%(d>>>0)|0;if((P|0)!=(G|0))break b}L=f[L>>2]|0;if(!L)break b}}while(0);f[C+(y<<2)>>2]=f[O+12>>2];Q=x;R=z;S=B;T=A;U=C;break a}while(0);if(!F)if(p>>>0>>0)V=p;else V=(p>>>0)%(d>>>0)|0;else V=D&p;J=f[H+(V<<2)>>2]|0;if(!J){X=V;Y=d;Z=0;_=40}else{if(F){K=J;while(1){K=f[K>>2]|0;if(!K){X=V;Y=d;Z=0;_=40;break a}L=f[K+4>>2]|0;if(!((L|0)==(p|0)|(L&D|0)==(V|0))){X=V;Y=d;Z=0;_=40;break a}if((b[K+8>>0]|0)==E<<24>>24){_=55;break a}}}else aa=J;while(1){aa=f[aa>>2]|0;if(!aa){X=V;Y=d;Z=0;_=40;break a}K=f[aa+4>>2]|0;if((K|0)!=(p|0)){if(K>>>0>>0)ba=K;else ba=(K>>>0)%(d>>>0)|0;if((ba|0)!=(V|0)){X=V;Y=d;Z=0;_=40;break a}}if((b[aa+8>>0]|0)==E<<24>>24){_=55;break}}}}else{X=0;Y=0;Z=1;_=40}while(0);if((_|0)==40){_=0;J=ln(16)|0;b[J+8>>0]=E;f[J+12>>2]=z;f[J+4>>2]=p;f[J>>2]=0;ca=$(((f[r>>2]|0)+1|0)>>>0);da=$(Y>>>0);ea=$(n[j>>2]);do if(Z|$(ea*da)>>0<3|(Y+-1&Y|0)!=0)&1;D=~~$(W($(ca/ea)))>>>0;ai(g,K>>>0>>0?D:K);K=f[l>>2]|0;D=K+-1|0;if(!(D&K)){fa=K;ga=D&p;break}if(p>>>0>>0){fa=K;ga=p}else{fa=K;ga=(p>>>0)%(K>>>0)|0}}else{fa=Y;ga=X}while(0);p=(f[g>>2]|0)+(ga<<2)|0;E=f[p>>2]|0;if(!E){f[J>>2]=f[s>>2];f[s>>2]=J;f[p>>2]=s;p=f[J>>2]|0;if(p|0){K=f[p+4>>2]|0;p=fa+-1|0;if(p&fa)if(K>>>0>>0)ha=K;else ha=(K>>>0)%(fa>>>0)|0;else ha=K&p;ia=(f[g>>2]|0)+(ha<<2)|0;_=53}}else{f[J>>2]=f[E>>2];ia=E;_=53}if((_|0)==53){_=0;f[ia>>2]=J}f[r>>2]=(f[r>>2]|0)+1;_=55}if((_|0)==55){_=0;E=t;p=f[E>>2]|0;K=un(p|0,f[E+4>>2]|0,z|0,0)|0;kh((f[f[v>>2]>>2]|0)+K|0,h|0,p|0)|0;p=f[i>>2]|0;f[p+(y<<2)>>2]=z;Q=p;R=z+1|0;S=p;T=p;U=p}p=y+1|0;ja=f[k>>2]|0;if(p>>>0>=ja>>>0)break;d=f[l>>2]|0;x=Q;y=p;z=R;A=T;B=S;C=U}if((R|0)==(ja|0))ka=T;else{T=a+84|0;if(!(b[T>>0]|0)){U=f[a+72>>2]|0;C=f[a+68>>2]|0;B=C;if((U|0)==(C|0))la=Q;else{A=U-C>>2;C=0;do{U=B+(C<<2)|0;f[U>>2]=f[S+(f[U>>2]<<2)>>2];C=C+1|0}while(C>>>0>>0);la=Q}}else{b[T>>0]=0;T=a+68|0;Q=a+72|0;A=f[Q>>2]|0;C=f[T>>2]|0;S=A-C>>2;B=C;C=A;if(ja>>>0<=S>>>0)if(ja>>>0>>0?(A=B+(ja<<2)|0,(A|0)!=(C|0)):0){f[Q>>2]=C+(~((C+-4-A|0)>>>2)<<2);ma=ja}else ma=ja;else{Ch(T,ja-S|0,1220);ma=f[k>>2]|0}S=f[i>>2]|0;if(!ma)la=S;else{i=f[a+68>>2]|0;a=0;do{f[i+(a<<2)>>2]=f[S+(a<<2)>>2];a=a+1|0}while(a>>>0>>0);la=S}}f[k>>2]=R;ka=la}if(!ka)na=R;else{la=f[m>>2]|0;if((la|0)!=(ka|0))f[m>>2]=la+(~((la+-4-ka|0)>>>2)<<2);Oq(ka);na=R}}else na=0;R=f[g+8>>2]|0;if(R|0){ka=R;do{R=ka;ka=f[ka>>2]|0;Oq(R)}while((ka|0)!=0)}ka=f[g>>2]|0;f[g>>2]=0;if(!ka){u=e;return na|0}Oq(ka);u=e;return na|0}function hc(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,i=0,j=0,k=0,l=0,m=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,X=0,Y=0,Z=0,_=0,aa=0,ba=0,ca=0,da=Oa,ea=Oa,fa=Oa,ga=0,ha=0,ia=0,ja=0,ka=0,la=0,ma=0,na=0,oa=0;e=u;u=u+48|0;g=e+16|0;i=e+12|0;j=e;k=g+16|0;f[g>>2]=0;f[g+4>>2]=0;f[g+8>>2]=0;f[g+12>>2]=0;n[k>>2]=$(1.0);l=a+80|0;m=f[l>>2]|0;f[j>>2]=0;o=j+4|0;f[o>>2]=0;f[j+8>>2]=0;if(m){if(m>>>0>1073741823)aq(j);p=m<<2;q=ln(p)|0;f[j>>2]=q;r=q+(m<<2)|0;f[j+8>>2]=r;sj(q|0,0,p|0)|0;f[o>>2]=r;r=c+48|0;p=c+40|0;m=g+4|0;s=g+12|0;t=g+8|0;v=a+40|0;w=a+64|0;x=f[d>>2]|0;d=0;y=q;z=0;A=0;B=q;C=q;D=q;while(1){q=r;E=f[q>>2]|0;F=f[q+4>>2]|0;q=p;G=un(f[q>>2]|0,f[q+4>>2]|0,x+z|0,0)|0;q=Vn(G|0,I|0,E|0,F|0)|0;F=(f[f[c>>2]>>2]|0)+q|0;q=h[F>>0]|h[F+1>>0]<<8|h[F+2>>0]<<16|h[F+3>>0]<<24;f[i>>2]=q;F=q^318;a:do if(d){E=d+-1|0;G=(E&d|0)==0;if(!G)if(F>>>0>>0)H=F;else H=(F>>>0)%(d>>>0)|0;else H=E&F;J=f[g>>2]|0;K=f[J+(H<<2)>>2]|0;b:do if(K|0?(L=f[K>>2]|0,L|0):0){c:do if(G){M=L;while(1){N=f[M+4>>2]|0;O=(N|0)==(F|0);if(!(O|(N&E|0)==(H|0)))break b;if(O?(f[M+8>>2]|0)==(q|0):0){P=M;break c}M=f[M>>2]|0;if(!M)break b}}else{M=L;while(1){O=f[M+4>>2]|0;if((O|0)==(F|0)){if((f[M+8>>2]|0)==(q|0)){P=M;break c}}else{if(O>>>0>>0)Q=O;else Q=(O>>>0)%(d>>>0)|0;if((Q|0)!=(H|0))break b}M=f[M>>2]|0;if(!M)break b}}while(0);f[D+(z<<2)>>2]=f[P+12>>2];R=y;S=A;T=C;U=B;V=D;break a}while(0);if(!G)if(F>>>0>>0)X=F;else X=(F>>>0)%(d>>>0)|0;else X=E&F;K=f[J+(X<<2)>>2]|0;if(!K){Y=X;Z=d;_=0;aa=40}else{if(G){L=K;while(1){L=f[L>>2]|0;if(!L){Y=X;Z=d;_=0;aa=40;break a}M=f[L+4>>2]|0;if(!((M|0)==(F|0)|(M&E|0)==(X|0))){Y=X;Z=d;_=0;aa=40;break a}if((f[L+8>>2]|0)==(q|0)){aa=55;break a}}}else ba=K;while(1){ba=f[ba>>2]|0;if(!ba){Y=X;Z=d;_=0;aa=40;break a}L=f[ba+4>>2]|0;if((L|0)!=(F|0)){if(L>>>0>>0)ca=L;else ca=(L>>>0)%(d>>>0)|0;if((ca|0)!=(X|0)){Y=X;Z=d;_=0;aa=40;break a}}if((f[ba+8>>2]|0)==(q|0)){aa=55;break}}}}else{Y=0;Z=0;_=1;aa=40}while(0);if((aa|0)==40){aa=0;K=ln(16)|0;f[K+8>>2]=q;f[K+12>>2]=A;f[K+4>>2]=F;f[K>>2]=0;da=$(((f[s>>2]|0)+1|0)>>>0);ea=$(Z>>>0);fa=$(n[k>>2]);do if(_|$(fa*ea)>>0<3|(Z+-1&Z|0)!=0)&1;E=~~$(W($(da/fa)))>>>0;Hi(g,L>>>0>>0?E:L);L=f[m>>2]|0;E=L+-1|0;if(!(E&L)){ga=L;ha=E&F;break}if(F>>>0>>0){ga=L;ha=F}else{ga=L;ha=(F>>>0)%(L>>>0)|0}}else{ga=Z;ha=Y}while(0);F=(f[g>>2]|0)+(ha<<2)|0;q=f[F>>2]|0;if(!q){f[K>>2]=f[t>>2];f[t>>2]=K;f[F>>2]=t;F=f[K>>2]|0;if(F|0){L=f[F+4>>2]|0;F=ga+-1|0;if(F&ga)if(L>>>0>>0)ia=L;else ia=(L>>>0)%(ga>>>0)|0;else ia=L&F;ja=(f[g>>2]|0)+(ia<<2)|0;aa=53}}else{f[K>>2]=f[q>>2];ja=q;aa=53}if((aa|0)==53){aa=0;f[ja>>2]=K}f[s>>2]=(f[s>>2]|0)+1;aa=55}if((aa|0)==55){aa=0;q=v;F=f[q>>2]|0;L=un(F|0,f[q+4>>2]|0,A|0,0)|0;kh((f[f[w>>2]>>2]|0)+L|0,i|0,F|0)|0;F=f[j>>2]|0;f[F+(z<<2)>>2]=A;R=F;S=A+1|0;T=F;U=F;V=F}F=z+1|0;ka=f[l>>2]|0;if(F>>>0>=ka>>>0)break;d=f[m>>2]|0;y=R;z=F;A=S;B=U;C=T;D=V}if((S|0)==(ka|0))la=U;else{U=a+84|0;if(!(b[U>>0]|0)){V=f[a+72>>2]|0;D=f[a+68>>2]|0;C=D;if((V|0)==(D|0))ma=R;else{B=V-D>>2;D=0;do{V=C+(D<<2)|0;f[V>>2]=f[T+(f[V>>2]<<2)>>2];D=D+1|0}while(D>>>0>>0);ma=R}}else{b[U>>0]=0;U=a+68|0;R=a+72|0;B=f[R>>2]|0;D=f[U>>2]|0;T=B-D>>2;C=D;D=B;if(ka>>>0<=T>>>0)if(ka>>>0>>0?(B=C+(ka<<2)|0,(B|0)!=(D|0)):0){f[R>>2]=D+(~((D+-4-B|0)>>>2)<<2);na=ka}else na=ka;else{Ch(U,ka-T|0,1220);na=f[l>>2]|0}T=f[j>>2]|0;if(!na)ma=T;else{j=f[a+68>>2]|0;a=0;do{f[j+(a<<2)>>2]=f[T+(a<<2)>>2];a=a+1|0}while(a>>>0>>0);ma=T}}f[l>>2]=S;la=ma}if(!la)oa=S;else{ma=f[o>>2]|0;if((ma|0)!=(la|0))f[o>>2]=ma+(~((ma+-4-la|0)>>>2)<<2);Oq(la);oa=S}}else oa=0;S=f[g+8>>2]|0;if(S|0){la=S;do{S=la;la=f[la>>2]|0;Oq(S)}while((la|0)!=0)}la=f[g>>2]|0;f[g>>2]=0;if(!la){u=e;return oa|0}Oq(la);u=e;return oa|0}function ic(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,$=0,aa=0,ba=0,ca=0,da=0,ea=0,fa=0,ga=0,ha=0,ia=0,ja=0,ka=0,la=0,ma=0,na=0,oa=0,pa=0,qa=0,ra=0,sa=0,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+4|0;C=h[A>>0]|h[A+1>>0]<<8|h[A+2>>0]<<16|h[A+3>>0]<<24;A=j;f[A>>2]=B;f[A+4>>2]=C;A=k;f[A>>2]=B;f[A+4>>2]=C;C=yf(i,k)|0;if(!C){A=k;B=f[A>>2]|0;D=f[A+4>>2]|0;A=B&65535;E=Yn(B|0,D|0,16)|0;F=E&65535;G=D&65535;H=Yn(B|0,D|0,48)|0;J=H&65535;K=((((A^318)&65535)+239^E&65535)+239^D&65535)+239^H&65535;H=f[s>>2]|0;E=(H|0)==0;a:do if(!E){L=H+-1|0;M=(L&H|0)==0;if(!M)if(K>>>0>>0)N=K;else N=(K>>>0)%(H>>>0)|0;else N=K&L;O=f[(f[i>>2]|0)+(N<<2)>>2]|0;if((O|0)!=0?(P=f[O>>2]|0,(P|0)!=0):0){if(M){M=P;while(1){O=f[M+4>>2]|0;if(!((O|0)==(K|0)|(O&L|0)==(N|0))){Q=N;R=31;break a}O=M+8|0;if((((d[O>>1]|0)==A<<16>>16?(d[O+2>>1]|0)==F<<16>>16:0)?(d[M+12>>1]|0)==G<<16>>16:0)?(d[O+6>>1]|0)==J<<16>>16:0)break a;M=f[M>>2]|0;if(!M){Q=N;R=31;break a}}}else S=P;while(1){M=f[S+4>>2]|0;if((M|0)!=(K|0)){if(M>>>0>>0)T=M;else T=(M>>>0)%(H>>>0)|0;if((T|0)!=(N|0)){Q=N;R=31;break a}}M=S+8|0;if((((d[M>>1]|0)==A<<16>>16?(d[M+2>>1]|0)==F<<16>>16:0)?(d[S+12>>1]|0)==G<<16>>16:0)?(d[M+6>>1]|0)==J<<16>>16:0)break a;S=f[S>>2]|0;if(!S){Q=N;R=31;break}}}else{Q=N;R=31}}else{Q=0;R=31}while(0);if((R|0)==31){R=0;J=ln(20)|0;G=J+8|0;F=G;d[F>>1]=B;d[F+2>>1]=B>>>16;F=G+4|0;d[F>>1]=D;d[F+2>>1]=D>>>16;f[J+16>>2]=z;f[J+4>>2]=K;f[J>>2]=0;U=$(((f[p>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j+-4-w|0)>>>2)<<2);ga=da}else ga=da;else{Ch(z,da-x|0,1220);ga=f[o>>2]|0}x=f[l>>2]|0;if(!ga)fa=x;else{l=f[a+68>>2]|0;a=0;do{f[l+(a<<2)>>2]=f[x+(a<<2)>>2];a=a+1|0}while(a>>>0>>0);fa=x}}f[o>>2]=ba;ea=fa}if(!ea)ha=ba;else{fa=f[q>>2]|0;if((fa|0)!=(ea|0))f[q>>2]=fa+(~((fa+-4-ea|0)>>>2)<<2);Oq(ea);ha=ba}}else ha=0;ba=f[i+8>>2]|0;if(ba|0){ea=ba;do{ba=ea;ea=f[ea>>2]|0;Oq(ba)}while((ea|0)!=0)}ea=f[i>>2]|0;f[i>>2]=0;if(!ea){u=g;return ha|0}Oq(ea);u=g;return ha|0}function kc(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0;c=u;u=u+16|0;d=c+8|0;e=c;g=c+4|0;h=a+16|0;i=f[h>>2]|0;j=a+20|0;k=f[j>>2]|0;if((k|0)==(i|0))l=i;else{m=k+(~((k+-4-i|0)>>>2)<<2)|0;f[j>>2]=m;l=m}m=a+24|0;if((l|0)==(f[m>>2]|0)){Ri(h,b);n=f[h>>2]|0;o=f[j>>2]|0}else{f[l>>2]=f[b>>2];k=l+4|0;f[j>>2]=k;n=i;o=k}k=f[a+8>>2]|0;i=(f[k+100>>2]|0)-(f[k+96>>2]|0)|0;k=(i|0)/12|0;if((n|0)==(o|0)){u=c;return 1}n=a+28|0;l=(i|0)>0;i=a+164|0;p=a+12|0;q=a+76|0;r=a+80|0;s=a+72|0;t=a+152|0;v=a+84|0;w=a+272|0;x=a+276|0;y=a+268|0;z=a+168|0;A=a+140|0;B=a+120|0;C=o;do{o=f[C+-4>>2]|0;f[b>>2]=o;a:do if((o|0)!=-1?(D=(o>>>0)/3|0,E=f[n>>2]|0,(f[E+(D>>>5<<2)>>2]&1<<(D&31)|0)==0):0){if(l){D=0;F=E;b:while(1){E=D+1|0;f[i>>2]=(f[i>>2]|0)+1;G=f[b>>2]|0;H=(G|0)==-1?-1:(G>>>0)/3|0;G=F+(H>>>5<<2)|0;f[G>>2]=1<<(H&31)|f[G>>2];G=f[q>>2]|0;if((G|0)==(f[r>>2]|0))Ri(s,b);else{f[G>>2]=f[b>>2];f[q>>2]=G+4}G=f[b>>2]|0;if((G|0)==-1)I=-1;else I=f[(f[f[p>>2]>>2]|0)+(G<<2)>>2]|0;J=(f[(f[t>>2]|0)+(I<<2)>>2]|0)!=-1;K=(f[v>>2]|0)+(I>>>5<<2)|0;L=1<<(I&31);M=f[K>>2]|0;do if(!(M&L)){f[K>>2]=M|L;if(J){N=f[b>>2]|0;O=30;break}f[d>>2]=0;P=f[w>>2]|0;if((P|0)==(f[x>>2]|0))Ri(y,d);else{f[P>>2]=0;f[w>>2]=P+4}P=f[b>>2]|0;Q=P+1|0;if((P|0)!=-1?(R=((Q>>>0)%3|0|0)==0?P+-2|0:Q,(R|0)!=-1):0)S=f[(f[(f[p>>2]|0)+12>>2]|0)+(R<<2)>>2]|0;else S=-1;f[b>>2]=S}else{N=G;O=30}while(0);if((O|0)==30){O=0;G=N+1|0;if((N|0)==-1){O=35;break}L=((G>>>0)%3|0|0)==0?N+-2|0:G;if((L|0)==-1)T=-1;else T=f[(f[(f[p>>2]|0)+12>>2]|0)+(L<<2)>>2]|0;f[e>>2]=T;L=(((N>>>0)%3|0|0)==0?2:-1)+N|0;if((L|0)==-1)U=-1;else U=f[(f[(f[p>>2]|0)+12>>2]|0)+(L<<2)>>2]|0;L=(T|0)==-1;M=L?-1:(T>>>0)/3|0;V=(U|0)==-1;W=V?-1:(U>>>0)/3|0;K=((G>>>0)%3|0|0)==0?N+-2|0:G;if(((K|0)!=-1?(G=f[(f[p>>2]|0)+12>>2]|0,R=f[G+(K<<2)>>2]|0,(R|0)!=-1):0)?(K=(R>>>0)/3|0,R=f[n>>2]|0,(f[R+(K>>>5<<2)>>2]&1<<(K&31)|0)==0):0){K=(((N>>>0)%3|0|0)==0?2:-1)+N|0;do if((K|0)!=-1){Q=f[G+(K<<2)>>2]|0;if((Q|0)==-1)break;P=(Q>>>0)/3|0;if(!(f[R+(P>>>5<<2)>>2]&1<<(P&31))){O=63;break b}}while(0);if(!V)xf(a,f[i>>2]|0,H,0,W);f[d>>2]=3;R=f[w>>2]|0;if((R|0)==(f[x>>2]|0))Ri(y,d);else{f[R>>2]=3;f[w>>2]=R+4}X=f[e>>2]|0}else{if(!L){xf(a,f[i>>2]|0,H,1,M);R=f[b>>2]|0;if((R|0)==-1){O=44;break}else Y=R}else Y=N;R=(((Y>>>0)%3|0|0)==0?2:-1)+Y|0;if((R|0)==-1){O=44;break}K=f[(f[(f[p>>2]|0)+12>>2]|0)+(R<<2)>>2]|0;if((K|0)==-1){O=44;break}R=(K>>>0)/3|0;if(f[(f[n>>2]|0)+(R>>>5<<2)>>2]&1<<(R&31)|0){O=44;break}f[d>>2]=5;R=f[w>>2]|0;if((R|0)==(f[x>>2]|0))Ri(y,d);else{f[R>>2]=5;f[w>>2]=R+4}X=U}f[b>>2]=X}if((E|0)>=(k|0))break a;D=E;F=f[n>>2]|0}do if((O|0)==35){O=0;f[e>>2]=-1;O=46}else if((O|0)==44){O=0;if(V)O=46;else{xf(a,f[i>>2]|0,H,0,W);O=46}}else if((O|0)==63){O=0;f[d>>2]=1;F=f[w>>2]|0;if((F|0)==(f[x>>2]|0))Ri(y,d);else{f[F>>2]=1;f[w>>2]=F+4}f[z>>2]=(f[z>>2]|0)+1;if(J?(F=f[(f[t>>2]|0)+(I<<2)>>2]|0,(1<<(F&31)&f[(f[A>>2]|0)+(F>>>5<<2)>>2]|0)==0):0){f[g>>2]=f[b>>2];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|0,A|0,B|0)|0;B=(f[f[c>>2]>>2]|0)+z|0;z=h[B>>0]|h[B+1>>0]<<8|h[B+2>>0]<<16|h[B+3>>0]<<24;f[i>>2]=z;f[j>>2]=z;z=Ef(g,j)|0;if(!z){B=f[j>>2]|0;A=B&255;C=B>>>8;D=C&255;E=B>>>16;F=E&255;G=B>>>24;H=G&255;J=C&255;C=E&255;E=(((B&255^318)+239^J)+239^C)+239^G;G=f[r>>2]|0;K=(G|0)==0;a:do if(!K){L=G+-1|0;M=(L&G|0)==0;if(!M)if(E>>>0>>0)N=E;else N=(E>>>0)%(G>>>0)|0;else N=E&L;O=f[(f[g>>2]|0)+(N<<2)>>2]|0;if((O|0)!=0?(P=f[O>>2]|0,(P|0)!=0):0){if(M){M=P;while(1){O=f[M+4>>2]|0;if(!((O|0)==(E|0)|(O&L|0)==(N|0))){Q=N;R=31;break a}O=M+8|0;if((((b[O>>0]|0)==A<<24>>24?(b[O+1>>0]|0)==D<<24>>24:0)?(b[O+2>>0]|0)==F<<24>>24:0)?(b[O+3>>0]|0)==H<<24>>24:0)break a;M=f[M>>2]|0;if(!M){Q=N;R=31;break a}}}else S=P;while(1){M=f[S+4>>2]|0;if((M|0)!=(E|0)){if(M>>>0>>0)T=M;else T=(M>>>0)%(G>>>0)|0;if((T|0)!=(N|0)){Q=N;R=31;break a}}M=S+8|0;if((((b[M>>0]|0)==A<<24>>24?(b[M+1>>0]|0)==D<<24>>24:0)?(b[M+2>>0]|0)==F<<24>>24:0)?(b[M+3>>0]|0)==H<<24>>24:0)break a;S=f[S>>2]|0;if(!S){Q=N;R=31;break}}}else{Q=N;R=31}}else{Q=0;R=31}while(0);if((R|0)==31){R=0;H=ln(16)|0;F=H+8|0;D=B&-16776961|C<<16|J<<8;b[F>>0]=D;b[F+1>>0]=D>>8;b[F+2>>0]=D>>16;b[F+3>>0]=D>>24;f[H+12>>2]=y;f[H+4>>2]=E;f[H>>2]=0;U=$(((f[o>>2]|0)+1|0)>>>0);V=$(G>>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2]|0;B=p;E=un(f[B>>2]|0,f[B+4>>2]|0,r+A|0,0)|0;B=Vn(E|0,I|0,C|0,D|0)|0;D=(f[f[c>>2]>>2]|0)+B|0;B=h;C=D;E=B+16|0;do{b[B>>0]=b[C>>0]|0;B=B+1|0;C=C+1|0}while((B|0)<(E|0));im(i|0,D|0,16)|0;C=Vf(g,i)|0;if(!C){B=f[i>>2]|0;E=f[q>>2]|0;F=f[m>>2]|0;G=f[s>>2]|0;H=(((B^318)+239^E)+239^F)+239^G;J=f[t>>2]|0;K=(J|0)==0;a:do if(!K){L=J+-1|0;M=(L&J|0)==0;if(!M)if(H>>>0>>0)N=H;else N=(H>>>0)%(J>>>0)|0;else N=H&L;O=f[(f[g>>2]|0)+(N<<2)>>2]|0;if((O|0)!=0?(P=f[O>>2]|0,(P|0)!=0):0){if(M){M=P;while(1){O=f[M+4>>2]|0;if(!((O|0)==(H|0)|(O&L|0)==(N|0))){Q=N;R=31;break a}if((((f[M+8>>2]|0)==(B|0)?(f[M+12>>2]|0)==(E|0):0)?(f[M+16>>2]|0)==(F|0):0)?(f[M+20>>2]|0)==(G|0):0)break a;M=f[M>>2]|0;if(!M){Q=N;R=31;break a}}}else S=P;while(1){M=f[S+4>>2]|0;if((M|0)!=(H|0)){if(M>>>0>>0)T=M;else T=(M>>>0)%(J>>>0)|0;if((T|0)!=(N|0)){Q=N;R=31;break a}}if((((f[S+8>>2]|0)==(B|0)?(f[S+12>>2]|0)==(E|0):0)?(f[S+16>>2]|0)==(F|0):0)?(f[S+20>>2]|0)==(G|0):0)break a;S=f[S>>2]|0;if(!S){Q=N;R=31;break}}}else{Q=N;R=31}}else{Q=0;R=31}while(0);if((R|0)==31){R=0;D=ln(28)|0;f[D+8>>2]=B;f[D+12>>2]=E;f[D+16>>2]=F;f[D+20>>2]=G;f[D+24>>2]=z;f[D+4>>2]=H;f[D>>2]=0;U=$(((f[v>>2]|0)+1|0)>>>0);V=$(J>>>0);X=$(n[k>>2]);do if(K|$(X*V)>>0<3|(J+-1&J|0)!=0)&1;M=~~$(W($(U/X)))>>>0;Wh(g,P>>>0>>0?M:P);P=f[t>>2]|0;M=P+-1|0;if(!(M&P)){Y=P;Z=M&H;break}if(H>>>0

      >>0){Y=P;Z=H}else{Y=P;Z=(H>>>0)%(P>>>0)|0}}else{Y=J;Z=Q}while(0);J=(f[g>>2]|0)+(Z<<2)|0;H=f[J>>2]|0;if(!H){f[D>>2]=f[w>>2];f[w>>2]=D;f[J>>2]=w;J=f[D>>2]|0;if(J|0){K=f[J+4>>2]|0;J=Y+-1|0;if(J&Y)if(K>>>0>>0)_=K;else _=(K>>>0)%(Y>>>0)|0;else _=K&J;aa=(f[g>>2]|0)+(_<<2)|0;R=44}}else{f[D>>2]=f[H>>2];aa=H;R=44}if((R|0)==44){R=0;f[aa>>2]=D}f[v>>2]=(f[v>>2]|0)+1}H=x;J=f[H>>2]|0;K=un(J|0,f[H+4>>2]|0,z|0,0)|0;kh((f[f[y>>2]>>2]|0)+K|0,h|0,J|0)|0;J=f[j>>2]|0;f[J+(A<<2)>>2]=z;ba=z+1|0;ca=J}else{J=f[j>>2]|0;f[J+(A<<2)>>2]=f[C+24>>2];ba=z;ca=J}A=A+1|0;da=f[l>>2]|0;if(A>>>0>=da>>>0)break;else z=ba}if((ba|0)==(da|0))ea=ca;else{z=a+84|0;if(!(b[z>>0]|0)){A=f[a+72>>2]|0;h=f[a+68>>2]|0;y=h;if((A|0)==(h|0))fa=ca;else{x=A-h>>2;h=0;do{A=y+(h<<2)|0;f[A>>2]=f[ca+(f[A>>2]<<2)>>2];h=h+1|0}while(h>>>0>>0);fa=ca}}else{b[z>>0]=0;z=a+68|0;ca=a+72|0;x=f[ca>>2]|0;h=f[z>>2]|0;y=x-h>>2;A=h;h=x;if(da>>>0<=y>>>0)if(da>>>0>>0?(x=A+(da<<2)|0,(x|0)!=(h|0)):0){f[ca>>2]=h+(~((h+-4-x|0)>>>2)<<2);ga=da}else ga=da;else{Ch(z,da-y|0,1220);ga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=Vn(E|0,I|0,C|0,D|0)|0;D=(f[f[c>>2]>>2]|0)+B|0;b[i>>0]=b[D>>0]|0;b[i+1>>0]=b[D+1>>0]|0;b[i+2>>0]=b[D+2>>0]|0;b[i+3>>0]=b[D+3>>0]|0;b[i+4>>0]=b[D+4>>0]|0;b[i+5>>0]=b[D+5>>0]|0;im(j|0,D|0,6)|0;D=dg(h,j)|0;if(!D){B=d[j>>1]|0;C=d[r>>1]|0;E=d[o>>1]|0;F=(((B^318)&65535)+239^C&65535)+239^E&65535;G=f[t>>2]|0;H=(G|0)==0;a:do if(!H){J=G+-1|0;K=(J&G|0)==0;if(!K)if(F>>>0>>0)L=F;else L=(F>>>0)%(G>>>0)|0;else L=F&J;M=f[(f[h>>2]|0)+(L<<2)>>2]|0;if((M|0)!=0?(N=f[M>>2]|0,(N|0)!=0):0){if(K){K=N;while(1){M=f[K+4>>2]|0;if(!((M|0)==(F|0)|(M&J|0)==(L|0))){O=L;P=29;break a}M=K+8|0;if(((d[M>>1]|0)==B<<16>>16?(d[M+2>>1]|0)==C<<16>>16:0)?(d[K+12>>1]|0)==E<<16>>16:0)break a;K=f[K>>2]|0;if(!K){O=L;P=29;break a}}}else Q=N;while(1){K=f[Q+4>>2]|0;if((K|0)!=(F|0)){if(K>>>0>>0)R=K;else R=(K>>>0)%(G>>>0)|0;if((R|0)!=(L|0)){O=L;P=29;break a}}K=Q+8|0;if(((d[K>>1]|0)==B<<16>>16?(d[K+2>>1]|0)==C<<16>>16:0)?(d[Q+12>>1]|0)==E<<16>>16:0)break a;Q=f[Q>>2]|0;if(!Q){O=L;P=29;break}}}else{O=L;P=29}}else{O=0;P=29}while(0);if((P|0)==29){P=0;N=ln(20)|0;d[N+8>>1]=B;d[N+10>>1]=C;d[N+12>>1]=E;f[N+16>>2]=z;f[N+4>>2]=F;f[N>>2]=0;S=$(((f[v>>2]|0)+1|0)>>>0);T=$(G>>>0);U=$(n[l>>2]);do if(H|$(U*T)>>0<3|(G+-1&G|0)!=0)&1;J=~~$(W($(S/U)))>>>0;Th(h,K>>>0>>0?J:K);K=f[t>>2]|0;J=K+-1|0;if(!(J&K)){V=K;X=J&F;break}if(F>>>0>>0){V=K;X=F}else{V=K;X=(F>>>0)%(K>>>0)|0}}else{V=G;X=O}while(0);G=(f[h>>2]|0)+(X<<2)|0;F=f[G>>2]|0;if(!F){f[N>>2]=f[w>>2];f[w>>2]=N;f[G>>2]=w;G=f[N>>2]|0;if(G|0){H=f[G+4>>2]|0;G=V+-1|0;if(G&V)if(H>>>0>>0)Y=H;else Y=(H>>>0)%(V>>>0)|0;else Y=H&G;Z=(f[h>>2]|0)+(Y<<2)|0;P=42}}else{f[N>>2]=f[F>>2];Z=F;P=42}if((P|0)==42){P=0;f[Z>>2]=N}f[v>>2]=(f[v>>2]|0)+1}F=x;G=f[F>>2]|0;H=un(G|0,f[F+4>>2]|0,z|0,0)|0;kh((f[f[y>>2]>>2]|0)+H|0,i|0,G|0)|0;G=f[k>>2]|0;f[G+(A<<2)>>2]=z;_=z+1|0;aa=G}else{G=f[k>>2]|0;f[G+(A<<2)>>2]=f[D+16>>2];_=z;aa=G}A=A+1|0;ba=f[m>>2]|0;if(A>>>0>=ba>>>0)break;else z=_}if((_|0)==(ba|0))ca=aa;else{z=a+84|0;if(!(b[z>>0]|0)){A=f[a+72>>2]|0;i=f[a+68>>2]|0;y=i;if((A|0)==(i|0))da=aa;else{x=A-i>>2;i=0;do{A=y+(i<<2)|0;f[A>>2]=f[aa+(f[A>>2]<<2)>>2];i=i+1|0}while(i>>>0>>0);da=aa}}else{b[z>>0]=0;z=a+68|0;aa=a+72|0;x=f[aa>>2]|0;i=f[z>>2]|0;y=x-i>>2;A=i;i=x;if(ba>>>0<=y>>>0)if(ba>>>0>>0?(x=A+(ba<<2)|0,(x|0)!=(i|0)):0){f[aa>>2]=i+(~((i+-4-x|0)>>>2)<<2);ea=ba}else ea=ba;else{Ch(z,ba-y|0,1220);ea=f[m>>2]|0}y=f[k>>2]|0;if(!ea)da=y;else{k=f[a+68>>2]|0;a=0;do{f[k+(a<<2)>>2]=f[y+(a<<2)>>2];a=a+1|0}while(a>>>0>>0);da=y}}f[m>>2]=_;ca=da}if(!ca)fa=_;else{da=f[p>>2]|0;if((da|0)!=(ca|0))f[p>>2]=da+(~((da+-4-ca|0)>>>2)<<2);Oq(ca);fa=_}}else fa=0;_=f[h+8>>2]|0;if(_|0){ca=_;do{_=ca;ca=f[ca>>2]|0;Oq(_)}while((ca|0)!=0)}ca=f[h>>2]|0;f[h>>2]=0;if(!ca){u=g;return fa|0}Oq(ca);u=g;return fa|0}function oc(a,b,c,d,e,g){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;g=g|0;var h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,Y=0,Z=0,_=0;g=a+8|0;Mh(g,b,d,e);d=f[a+48>>2]|0;h=f[a+52>>2]|0;i=e>>>0>1073741823?-1:e<<2;j=Lq(i)|0;sj(j|0,0,i|0)|0;k=Lq(i)|0;sj(k|0,0,i|0)|0;i=f[a+56>>2]|0;l=i+4|0;m=f[l>>2]|0;n=f[i>>2]|0;o=m-n|0;a:do if((o|0)>4){p=o>>2;q=(e|0)>0;r=a+16|0;s=a+32|0;t=a+12|0;u=a+28|0;v=a+20|0;w=a+24|0;x=d+12|0;y=e<<2;z=p+-1|0;if(m-n>>2>>>0>z>>>0){A=p;B=z;C=n}else aq(i);while(1){z=f[C+(B<<2)>>2]|0;if(q)sj(j|0,0,y|0)|0;if((z|0)!=-1){p=f[x>>2]|0;D=0;E=z;while(1){F=f[p+(E<<2)>>2]|0;if((F|0)!=-1){G=f[d>>2]|0;H=f[h>>2]|0;I=f[H+(f[G+(F<<2)>>2]<<2)>>2]|0;J=F+1|0;K=((J>>>0)%3|0|0)==0?F+-2|0:J;if((K|0)==-1)L=-1;else L=f[G+(K<<2)>>2]|0;K=f[H+(L<<2)>>2]|0;J=(((F>>>0)%3|0|0)==0?2:-1)+F|0;if((J|0)==-1)M=-1;else M=f[G+(J<<2)>>2]|0;J=f[H+(M<<2)>>2]|0;if((I|0)<(B|0)&(K|0)<(B|0)&(J|0)<(B|0)){H=X(I,e)|0;I=X(K,e)|0;K=X(J,e)|0;if(q){J=0;do{f[k+(J<<2)>>2]=(f[b+(J+K<<2)>>2]|0)+(f[b+(J+I<<2)>>2]|0)-(f[b+(J+H<<2)>>2]|0);J=J+1|0}while((J|0)!=(e|0));if(q){J=0;do{H=j+(J<<2)|0;f[H>>2]=(f[H>>2]|0)+(f[k+(J<<2)>>2]|0);J=J+1|0}while((J|0)!=(e|0))}}N=D+1|0}else N=D}else N=D;J=(((E>>>0)%3|0|0)==0?2:-1)+E|0;do if((J|0)!=-1?(H=f[p+(J<<2)>>2]|0,(H|0)!=-1):0)if(!((H>>>0)%3|0)){O=H+2|0;break}else{O=H+-1|0;break}else O=-1;while(0);E=(O|0)==(z|0)?-1:O;if((E|0)==-1)break;else D=N}D=X(B,e)|0;if(N){if(q){E=0;do{z=j+(E<<2)|0;f[z>>2]=(f[z>>2]|0)/(N|0)|0;E=E+1|0}while((E|0)!=(e|0))}E=b+(D<<2)|0;z=c+(D<<2)|0;p=f[g>>2]|0;if((p|0)>0){J=0;H=j;I=p;while(1){if((I|0)>0){p=0;do{K=f[H+(p<<2)>>2]|0;G=f[r>>2]|0;if((K|0)>(G|0)){F=f[s>>2]|0;f[F+(p<<2)>>2]=G;P=F}else{F=f[t>>2]|0;G=f[s>>2]|0;f[G+(p<<2)>>2]=(K|0)<(F|0)?F:K;P=G}p=p+1|0}while((p|0)<(f[g>>2]|0));Q=P}else Q=f[s>>2]|0;p=(f[E+(J<<2)>>2]|0)-(f[Q+(J<<2)>>2]|0)|0;G=z+(J<<2)|0;f[G>>2]=p;if((p|0)>=(f[u>>2]|0)){if((p|0)>(f[w>>2]|0)){R=p-(f[v>>2]|0)|0;S=57}}else{R=(f[v>>2]|0)+p|0;S=57}if((S|0)==57){S=0;f[G>>2]=R}J=J+1|0;I=f[g>>2]|0;if((J|0)>=(I|0))break;else H=Q}}}else{T=D;S=30}}else{T=X(B,e)|0;S=30}if((S|0)==30?(S=0,H=b+(T<<2)|0,I=c+(T<<2)|0,J=f[g>>2]|0,(J|0)>0):0){z=0;E=b+((X(A+-2|0,e)|0)<<2)|0;G=J;while(1){if((G|0)>0){J=0;do{p=f[E+(J<<2)>>2]|0;K=f[r>>2]|0;if((p|0)>(K|0)){F=f[s>>2]|0;f[F+(J<<2)>>2]=K;U=F}else{F=f[t>>2]|0;K=f[s>>2]|0;f[K+(J<<2)>>2]=(p|0)<(F|0)?F:p;U=K}J=J+1|0}while((J|0)<(f[g>>2]|0));V=U}else V=f[s>>2]|0;J=(f[H+(z<<2)>>2]|0)-(f[V+(z<<2)>>2]|0)|0;K=I+(z<<2)|0;f[K>>2]=J;if((J|0)>=(f[u>>2]|0)){if((J|0)>(f[w>>2]|0)){W=J-(f[v>>2]|0)|0;S=42}}else{W=(f[v>>2]|0)+J|0;S=42}if((S|0)==42){S=0;f[K>>2]=W}z=z+1|0;G=f[g>>2]|0;if((z|0)>=(G|0))break;else E=V}}if((A|0)<=2)break a;C=f[i>>2]|0;E=B+-1|0;if((f[l>>2]|0)-C>>2>>>0<=E>>>0)break;else{G=B;B=E;A=G}}aq(i)}while(0);if((e|0)>0)sj(j|0,0,e<<2|0)|0;e=f[g>>2]|0;if((e|0)<=0){Mq(k);Mq(j);return 1}i=a+16|0;A=a+32|0;B=a+12|0;C=a+28|0;l=a+20|0;V=a+24|0;a=0;W=j;U=e;while(1){if((U|0)>0){e=0;do{T=f[W+(e<<2)>>2]|0;Q=f[i>>2]|0;if((T|0)>(Q|0)){R=f[A>>2]|0;f[R+(e<<2)>>2]=Q;Y=R}else{R=f[B>>2]|0;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]|0)+(F<<2)>>2]|0,(G|0)!=-1):0)?(H=f[y>>2]|0,I=f[h>>2]|0,J=f[I+(f[H+(G<<2)>>2]<<2)>>2]|0,K=G+1|0,L=f[I+(f[H+((((K>>>0)%3|0|0)==0?G+-2|0:K)<<2)>>2]<<2)>>2]|0,K=f[I+(f[H+((((G>>>0)%3|0|0)==0?2:-1)+G<<2)>>2]<<2)>>2]|0,(J|0)<(C|0)&(L|0)<(C|0)&(K|0)<(C|0)):0){G=X(J,e)|0;J=X(L,e)|0;L=X(K,e)|0;if(q){K=0;do{f[k+(K<<2)>>2]=(f[b+(K+L<<2)>>2]|0)+(f[b+(K+J<<2)>>2]|0)-(f[b+(K+G<<2)>>2]|0);K=K+1|0}while((K|0)!=(e|0));if(q){K=0;do{G=j+(K<<2)|0;f[G>>2]=(f[G>>2]|0)+(f[k+(K<<2)>>2]|0);K=K+1|0}while((K|0)!=(e|0))}}M=E+1|0}else M=E;K=(((F>>>0)%3|0|0)==0?2:-1)+F|0;do if(((K|0)!=-1?(f[p+(K>>>5<<2)>>2]&1<<(K&31)|0)==0:0)?(G=f[(f[(f[x>>2]|0)+12>>2]|0)+(K<<2)>>2]|0,(G|0)!=-1):0)if(!((G>>>0)%3|0)){N=G+2|0;break}else{N=G+-1|0;break}else N=-1;while(0);F=(N|0)==(A|0)?-1:N;if((F|0)==-1)break;else E=M}E=X(C,e)|0;if(M){if(q){F=0;do{A=j+(F<<2)|0;f[A>>2]=(f[A>>2]|0)/(M|0)|0;F=F+1|0}while((F|0)!=(e|0))}F=b+(E<<2)|0;A=c+(E<<2)|0;p=f[g>>2]|0;if((p|0)>0){K=0;G=j;J=p;while(1){if((J|0)>0){p=0;do{L=f[G+(p<<2)>>2]|0;H=f[r>>2]|0;if((L|0)>(H|0)){I=f[s>>2]|0;f[I+(p<<2)>>2]=H;O=I}else{I=f[t>>2]|0;H=f[s>>2]|0;f[H+(p<<2)>>2]=(L|0)<(I|0)?I:L;O=H}p=p+1|0}while((p|0)<(f[g>>2]|0));P=O}else P=f[s>>2]|0;p=(f[F+(K<<2)>>2]|0)-(f[P+(K<<2)>>2]|0)|0;H=A+(K<<2)|0;f[H>>2]=p;if((p|0)>=(f[u>>2]|0)){if((p|0)>(f[w>>2]|0)){Q=p-(f[v>>2]|0)|0;R=55}}else{Q=(f[v>>2]|0)+p|0;R=55}if((R|0)==55){R=0;f[H>>2]=Q}K=K+1|0;J=f[g>>2]|0;if((K|0)>=(J|0))break;else G=P}}}else{S=E;R=28}}else{S=X(C,e)|0;R=28}if((R|0)==28?(R=0,G=b+(S<<2)|0,J=c+(S<<2)|0,K=f[g>>2]|0,(K|0)>0):0){A=0;F=b+((X(B+-2|0,e)|0)<<2)|0;H=K;while(1){if((H|0)>0){K=0;do{p=f[F+(K<<2)>>2]|0;L=f[r>>2]|0;if((p|0)>(L|0)){I=f[s>>2]|0;f[I+(K<<2)>>2]=L;T=I}else{I=f[t>>2]|0;L=f[s>>2]|0;f[L+(K<<2)>>2]=(p|0)<(I|0)?I:p;T=L}K=K+1|0}while((K|0)<(f[g>>2]|0));U=T}else U=f[s>>2]|0;K=(f[G+(A<<2)>>2]|0)-(f[U+(A<<2)>>2]|0)|0;L=J+(A<<2)|0;f[L>>2]=K;if((K|0)>=(f[u>>2]|0)){if((K|0)>(f[w>>2]|0)){V=K-(f[v>>2]|0)|0;R=40}}else{V=(f[v>>2]|0)+K|0;R=40}if((R|0)==40){R=0;f[L>>2]=V}A=A+1|0;H=f[g>>2]|0;if((A|0)>=(H|0))break;else F=U}}if((B|0)<=2)break a;D=f[i>>2]|0;F=C+-1|0;if((f[l>>2]|0)-D>>2>>>0<=F>>>0)break;else{H=C;C=F;B=H}}aq(i)}while(0);if((e|0)>0)sj(j|0,0,e<<2|0)|0;e=f[g>>2]|0;if((e|0)<=0){Mq(k);Mq(j);return 1}i=a+16|0;B=a+32|0;C=a+12|0;D=a+28|0;l=a+20|0;U=a+24|0;a=0;V=j;T=e;while(1){if((T|0)>0){e=0;do{S=f[V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;P=(Y|0)==0;N=f[w>>2]|0;do if(Y|Z){H=(N|0)==(Y|0);if(!(M&H)){q=(N|0)==(Z|0);if(!(P&q)){if(M&(T|0)<(Y|0)){$=0;aa=(T<<1)-Y|0;break}if(q&(T|0)>(Y|0)){$=Z;aa=(T<<1)-Y|0;break}if(H&(T|0)>(Z|0)){$=(T<<1)-Z|0;aa=Y;break}if(P){$=(T|0)<(Z|0)?(T<<1)-Z|0:Z;aa=0}else{$=Z;aa=Y}}else{$=Z;aa=Z}}else{$=Y;aa=Y}}else{$=N;aa=N}while(0);P=0-S|0;M=0-_|0;f[j>>2]=0-O;f[r>>2]=P;f[t>>2]=M;if((O|0)<1){ba=T-_|0;ca=T-S|0}else{H=(_|0)<1?M:_;M=(S|0)<1?P:S;ba=(_|0)>0?M:N-M|0;ca=(S|0)>0?H:N-H|0}H=(ca|0)==0;M=(ba|0)==0;do if(((ba|ca|0)!=0?(P=(N|0)==(ba|0),!(H&P)):0)?(q=(N|0)==(ca|0),!(M&q)):0){if(H&(T|0)<(ba|0)){da=0;ea=(T<<1)-ba|0;break}if(q&(T|0)>(ba|0)){da=N;ea=(T<<1)-ba|0;break}if(P&(T|0)>(ca|0)){da=(T<<1)-ca|0;ea=N;break}if(M){da=(T|0)<(ca|0)?(T<<1)-ca|0:ca;ea=0}else{da=ca;ea=ba}}else{da=N;ea=N}while(0);N=K<<1;M=b+(N<<2)|0;H=M+4|0;O=f[H>>2]|0;f[h>>2]=f[M>>2];f[x>>2]=O;f[i>>2]=$;f[y>>2]=aa;Od(d,n,h,i);O=f[d>>2]|0;f[k>>2]=O;P=f[z>>2]|0;f[A>>2]=P;q=f[H>>2]|0;f[h>>2]=f[M>>2];f[B>>2]=q;f[i>>2]=da;f[C>>2]=ea;Od(d,n,h,i);q=f[d>>2]|0;f[l>>2]=q;M=f[D>>2]|0;f[E>>2]=M;H=f[v>>2]|0;if((H|0)>=(O|0))if((O|0)<(0-H|0))fa=(f[F>>2]|0)+O|0;else fa=O;else fa=O-(f[F>>2]|0)|0;f[k>>2]=fa;if((H|0)>=(P|0))if((P|0)<(0-H|0))ga=(f[F>>2]|0)+P|0;else ga=P;else ga=P-(f[F>>2]|0)|0;f[a>>2]=ga;if((H|0)>=(q|0))if((q|0)<(0-H|0))ha=(f[F>>2]|0)+q|0;else ha=q;else ha=q-(f[F>>2]|0)|0;f[l>>2]=ha;if((H|0)>=(M|0))if((M|0)<(0-H|0))ia=(f[F>>2]|0)+M|0;else ia=M;else ia=M-(f[F>>2]|0)|0;f[G>>2]=ia;if((((ga|0)>-1?ga:0-ga|0)+((fa|0)>-1?fa:0-fa|0)|0)<(((ha|0)>-1?ha:0-ha|0)+((ia|0)>-1?ia:0-ia|0)|0)){fj(g,0);ja=k}else{fj(g,1);ja=l}M=f[ja>>2]|0;if((M|0)<0)ka=(f[F>>2]|0)+M|0;else ka=M;M=c+(N<<2)|0;f[M>>2]=ka;N=f[ja+4>>2]|0;if((N|0)<0)la=(f[F>>2]|0)+N|0;else la=N;f[M+4>>2]=la;K=K+1|0;if((K|0)>=(s|0)){ma=5;break}M=f[p>>2]|0;L=f[M>>2]|0;if((f[M+4>>2]|0)-L>>2>>>0<=K>>>0){J=M;ma=6;break}}if((ma|0)==5){u=e;return 1}else if((ma|0)==6)aq(J);return 0}function rc(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,$=0,aa=0,ba=0,ca=0;c=u;u=u+48|0;d=c+24|0;e=c+12|0;g=c;if(!b){h=0;u=c;return h|0}i=a+12|0;j=a+4|0;k=f[j>>2]|0;l=f[a>>2]|0;m=k-l>>2;n=a+16|0;o=f[n>>2]|0;p=f[i>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>>0>1073741823)aq(g);else{A=ln(k)|0;f[g>>2]=A;p=A+(v<<2)|0;f[g+8>>2]=p;sj(A|0,0,k|0)|0;f[z>>2]=p;J=A;K=p;L=A;break}else{J=0;K=0;L=0}while(0);if((t|0)!=(y|0)){y=0;t=0;while(1){f[J+(t<<2)>>2]=y;k=t+1|0;if(k>>>0>>0){y=(f[s+(t<<2)>>2]|0)+y|0;t=k}else break}}t=f[j>>2]|0;j=f[a>>2]|0;y=j;if((t|0)!=(j|0)){k=a+40|0;a=t-j>>2;j=H;t=H;g=H;A=H;p=H;x=H;l=0;o=J;while(1){F=f[y+(l<<2)>>2]|0;G=l+1|0;E=((G>>>0)%3|0|0)==0?l+-2|0:G;if((E|0)==-1)M=-1;else M=f[y+(E<<2)>>2]|0;E=((l>>>0)%3|0|0)==0;G=(E?2:-1)+l|0;if((G|0)==-1)N=-1;else N=f[y+(G<<2)>>2]|0;if(E?(M|0)==(N|0)|((F|0)==(M|0)|(F|0)==(N|0)):0){f[k>>2]=(f[k>>2]|0)+1;O=j;P=t;Q=g;R=A;S=p;T=x;U=l+2|0;V=o}else W=51;a:do if((W|0)==51){W=0;E=f[s+(N<<2)>>2]|0;b:do if((E|0)>0){G=0;B=f[o+(N<<2)>>2]|0;while(1){m=f[p+(B<<3)>>2]|0;if((m|0)==-1){X=j;Y=t;Z=A;_=p;break b}if((m|0)==(M|0)){m=f[p+(B<<3)+4>>2]|0;if((m|0)==-1)$=-1;else $=f[y+(m<<2)>>2]|0;if((F|0)!=($|0))break}m=G+1|0;if((m|0)<(E|0)){G=m;B=B+1|0}else{X=j;Y=t;Z=A;_=p;break b}}m=f[A+(B<<3)+4>>2]|0;r=G;n=B;D=t;while(1){r=r+1|0;if((r|0)>=(E|0))break;C=n+1|0;f[D+(n<<3)>>2]=f[D+(C<<3)>>2];f[D+(n<<3)+4>>2]=f[D+(C<<3)+4>>2];if((f[j+(n<<3)>>2]|0)==-1)break;else{n=C;D=j}}f[g+(n<<3)>>2]=-1;if((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4>>2]=0;f[g+8>>2]=0;f[g+12>>2]=0;n[k>>2]=$(1.0);l=a+80|0;m=f[l>>2]|0;f[j>>2]=0;o=j+4|0;f[o>>2]=0;f[j+8>>2]=0;if(m){if(m>>>0>1073741823)aq(j);p=m<<2;q=ln(p)|0;f[j>>2]=q;r=q+(m<<2)|0;f[j+8>>2]=r;sj(q|0,0,p|0)|0;f[o>>2]=r;r=f[d>>2]|0;d=c+48|0;p=c+40|0;q=i+1|0;m=i+2|0;s=g+4|0;t=g+12|0;v=g+8|0;w=a+40|0;x=a+64|0;y=0;z=0;while(1){A=d;B=f[A>>2]|0;C=f[A+4>>2]|0;A=p;D=un(f[A>>2]|0,f[A+4>>2]|0,r+y|0,0)|0;A=Vn(D|0,I|0,B|0,C|0)|0;C=(f[f[c>>2]>>2]|0)+A|0;b[h>>0]=b[C>>0]|0;b[h+1>>0]=b[C+1>>0]|0;b[h+2>>0]=b[C+2>>0]|0;im(i|0,C|0,3)|0;C=jg(g,i)|0;if(!C){A=b[i>>0]|0;B=b[q>>0]|0;D=b[m>>0]|0;E=((A&255^318)+239^B&255)+239^D&255;F=f[s>>2]|0;G=(F|0)==0;a:do if(!G){H=F+-1|0;J=(H&F|0)==0;if(!J)if(E>>>0>>0)K=E;else K=(E>>>0)%(F>>>0)|0;else K=E&H;L=f[(f[g>>2]|0)+(K<<2)>>2]|0;if((L|0)!=0?(M=f[L>>2]|0,(M|0)!=0):0){if(J){J=M;while(1){L=f[J+4>>2]|0;if(!((L|0)==(E|0)|(L&H|0)==(K|0))){N=K;O=29;break a}L=J+8|0;if(((b[L>>0]|0)==A<<24>>24?(b[L+1>>0]|0)==B<<24>>24:0)?(b[L+2>>0]|0)==D<<24>>24:0)break a;J=f[J>>2]|0;if(!J){N=K;O=29;break a}}}else P=M;while(1){J=f[P+4>>2]|0;if((J|0)!=(E|0)){if(J>>>0>>0)Q=J;else Q=(J>>>0)%(F>>>0)|0;if((Q|0)!=(K|0)){N=K;O=29;break a}}J=P+8|0;if(((b[J>>0]|0)==A<<24>>24?(b[J+1>>0]|0)==B<<24>>24:0)?(b[J+2>>0]|0)==D<<24>>24:0)break a;P=f[P>>2]|0;if(!P){N=K;O=29;break}}}else{N=K;O=29}}else{N=0;O=29}while(0);if((O|0)==29){O=0;M=ln(16)|0;b[M+8>>0]=A;b[M+9>>0]=B;b[M+10>>0]=D;f[M+12>>2]=z;f[M+4>>2]=E;f[M>>2]=0;R=$(((f[t>>2]|0)+1|0)>>>0);S=$(F>>>0);T=$(n[k>>2]);do if(G|$(T*S)>>0<3|(F+-1&F|0)!=0)&1;H=~~$(W($(R/T)))>>>0;_h(g,J>>>0>>0?H:J);J=f[s>>2]|0;H=J+-1|0;if(!(H&J)){U=J;V=H&E;break}if(E>>>0>>0){U=J;V=E}else{U=J;V=(E>>>0)%(J>>>0)|0}}else{U=F;V=N}while(0);F=(f[g>>2]|0)+(V<<2)|0;E=f[F>>2]|0;if(!E){f[M>>2]=f[v>>2];f[v>>2]=M;f[F>>2]=v;F=f[M>>2]|0;if(F|0){G=f[F+4>>2]|0;F=U+-1|0;if(F&U)if(G>>>0>>0)X=G;else X=(G>>>0)%(U>>>0)|0;else X=G&F;Y=(f[g>>2]|0)+(X<<2)|0;O=42}}else{f[M>>2]=f[E>>2];Y=E;O=42}if((O|0)==42){O=0;f[Y>>2]=M}f[t>>2]=(f[t>>2]|0)+1}E=w;F=f[E>>2]|0;G=un(F|0,f[E+4>>2]|0,z|0,0)|0;kh((f[f[x>>2]>>2]|0)+G|0,h|0,F|0)|0;F=f[j>>2]|0;f[F+(y<<2)>>2]=z;Z=z+1|0;_=F}else{F=f[j>>2]|0;f[F+(y<<2)>>2]=f[C+12>>2];Z=z;_=F}y=y+1|0;aa=f[l>>2]|0;if(y>>>0>=aa>>>0)break;else z=Z}if((Z|0)==(aa|0))ba=_;else{z=a+84|0;if(!(b[z>>0]|0)){y=f[a+72>>2]|0;h=f[a+68>>2]|0;x=h;if((y|0)==(h|0))ca=_;else{w=y-h>>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else{M=f[t>>2]|0;W=(f[w>>2]|0)-((M|0)>-1?M:0-M|0)|0;X=M}if((X|0)<0){Y=(S|0)>-1?S:0-S|0;Z=W;_=X;break}else{Y=(f[w>>2]|0)-((S|0)>-1?S:0-S|0)|0;Z=W;_=X;break}}else{M=f[t>>2]|0;Y=M+T|0;Z=T+S|0;_=M}while(0);M=(Z|0)==0;P=(Y|0)==0;N=f[w>>2]|0;do if(Y|Z){H=(N|0)==(Y|0);if(!(M&H)){q=(N|0)==(Z|0);if(!(P&q)){if(M&(T|0)<(Y|0)){$=0;aa=(T<<1)-Y|0;break}if(q&(T|0)>(Y|0)){$=Z;aa=(T<<1)-Y|0;break}if(H&(T|0)>(Z|0)){$=(T<<1)-Z|0;aa=Y;break}if(P){$=(T|0)<(Z|0)?(T<<1)-Z|0:Z;aa=0}else{$=Z;aa=Y}}else{$=Z;aa=Z}}else{$=Y;aa=Y}}else{$=N;aa=N}while(0);P=0-S|0;M=0-_|0;f[j>>2]=0-O;f[r>>2]=P;f[t>>2]=M;if((O|0)<1){ba=T-_|0;ca=T-S|0}else{H=(_|0)<1?M:_;M=(S|0)<1?P:S;ba=(_|0)>0?M:N-M|0;ca=(S|0)>0?H:N-H|0}H=(ca|0)==0;M=(ba|0)==0;do if(((ba|ca|0)!=0?(P=(N|0)==(ba|0),!(H&P)):0)?(q=(N|0)==(ca|0),!(M&q)):0){if(H&(T|0)<(ba|0)){da=0;ea=(T<<1)-ba|0;break}if(q&(T|0)>(ba|0)){da=N;ea=(T<<1)-ba|0;break}if(P&(T|0)>(ca|0)){da=(T<<1)-ca|0;ea=N;break}if(M){da=(T|0)<(ca|0)?(T<<1)-ca|0:ca;ea=0}else{da=ca;ea=ba}}else{da=N;ea=N}while(0);N=K<<1;M=b+(N<<2)|0;H=M+4|0;O=f[H>>2]|0;f[h>>2]=f[M>>2];f[x>>2]=O;f[i>>2]=$;f[y>>2]=aa;Od(d,n,h,i);O=f[d>>2]|0;f[k>>2]=O;P=f[z>>2]|0;f[A>>2]=P;q=f[H>>2]|0;f[h>>2]=f[M>>2];f[B>>2]=q;f[i>>2]=da;f[C>>2]=ea;Od(d,n,h,i);q=f[d>>2]|0;f[l>>2]=q;M=f[D>>2]|0;f[E>>2]=M;H=f[v>>2]|0;if((H|0)>=(O|0))if((O|0)<(0-H|0))fa=(f[F>>2]|0)+O|0;else fa=O;else fa=O-(f[F>>2]|0)|0;f[k>>2]=fa;if((H|0)>=(P|0))if((P|0)<(0-H|0))ga=(f[F>>2]|0)+P|0;else ga=P;else ga=P-(f[F>>2]|0)|0;f[a>>2]=ga;if((H|0)>=(q|0))if((q|0)<(0-H|0))ha=(f[F>>2]|0)+q|0;else ha=q;else ha=q-(f[F>>2]|0)|0;f[l>>2]=ha;if((H|0)>=(M|0))if((M|0)<(0-H|0))ia=(f[F>>2]|0)+M|0;else ia=M;else ia=M-(f[F>>2]|0)|0;f[G>>2]=ia;if((((ga|0)>-1?ga:0-ga|0)+((fa|0)>-1?fa:0-fa|0)|0)<(((ha|0)>-1?ha:0-ha|0)+((ia|0)>-1?ia:0-ia|0)|0)){fj(g,0);ja=k}else{fj(g,1);ja=l}M=f[ja>>2]|0;if((M|0)<0)ka=(f[F>>2]|0)+M|0;else ka=M;M=c+(N<<2)|0;f[M>>2]=ka;N=f[ja+4>>2]|0;if((N|0)<0)la=(f[F>>2]|0)+N|0;else la=N;f[M+4>>2]=la;K=K+1|0;if((K|0)>=(s|0)){ma=5;break}M=f[p>>2]|0;L=f[M>>2]|0;if((f[M+4>>2]|0)-L>>2>>>0<=K>>>0){J=M;ma=6;break}}if((ma|0)==5){u=e;return 1}else if((ma|0)==6)aq(J);return 0}function uc(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0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break a}}}else Q=N;while(1){K=f[Q+4>>2]|0;if((K|0)!=(F|0)){if(K>>>0>>0)R=K;else R=(K>>>0)%(G>>>0)|0;if((R|0)!=(L|0)){O=L;P=29;break a}}if(((f[Q+8>>2]|0)==(A|0)?(f[Q+12>>2]|0)==(D|0):0)?(f[Q+16>>2]|0)==(E|0):0)break a;Q=f[Q>>2]|0;if(!Q){O=L;P=29;break}}}else{O=L;P=29}}else{O=0;P=29}while(0);if((P|0)==29){P=0;C=ln(24)|0;f[C+8>>2]=A;f[C+12>>2]=D;f[C+16>>2]=E;f[C+20>>2]=y;f[C+4>>2]=F;f[C>>2]=0;S=$(((f[t>>2]|0)+1|0)>>>0);T=$(G>>>0);U=$(n[k>>2]);do if(H|$(U*T)>>0<3|(G+-1&G|0)!=0)&1;K=~~$(W($(S/U)))>>>0;Xh(g,N>>>0>>0?K:N);N=f[s>>2]|0;K=N+-1|0;if(!(K&N)){V=N;X=K&F;break}if(F>>>0>>0){V=N;X=F}else{V=N;X=(F>>>0)%(N>>>0)|0}}else{V=G;X=O}while(0);G=(f[g>>2]|0)+(X<<2)|0;F=f[G>>2]|0;if(!F){f[C>>2]=f[v>>2];f[v>>2]=C;f[G>>2]=v;G=f[C>>2]|0;if(G|0){H=f[G+4>>2]|0;G=V+-1|0;if(G&V)if(H>>>0>>0)Y=H;else Y=(H>>>0)%(V>>>0)|0;else Y=H&G;Z=(f[g>>2]|0)+(Y<<2)|0;P=42}}else{f[C>>2]=f[F>>2];Z=F;P=42}if((P|0)==42){P=0;f[Z>>2]=C}f[t>>2]=(f[t>>2]|0)+1}F=w;G=f[F>>2]|0;H=un(G|0,f[F+4>>2]|0,y|0,0)|0;kh((f[f[x>>2]>>2]|0)+H|0,h|0,G|0)|0;G=f[j>>2]|0;f[G+(z<<2)>>2]=y;_=y+1|0;aa=G}else{G=f[j>>2]|0;f[G+(z<<2)>>2]=f[B+20>>2];_=y;aa=G}z=z+1|0;ba=f[l>>2]|0;if(z>>>0>=ba>>>0)break;else y=_}if((_|0)==(ba|0))ca=aa;else{y=a+84|0;if(!(b[y>>0]|0)){z=f[a+72>>2]|0;h=f[a+68>>2]|0;x=h;if((z|0)==(h|0))da=aa;else{w=z-h>>2;h=0;do{z=x+(h<<2)|0;f[z>>2]=f[aa+(f[z>>2]<<2)>>2];h=h+1|0}while(h>>>0>>0);da=aa}}else{b[y>>0]=0;y=a+68|0;aa=a+72|0;w=f[aa>>2]|0;h=f[y>>2]|0;x=w-h>>2;z=h;h=w;if(ba>>>0<=x>>>0)if(ba>>>0>>0?(w=z+(ba<<2)|0,(w|0)!=(h|0)):0){f[aa>>2]=h+(~((h+-4-w|0)>>>2)<<2);ea=ba}else ea=ba;else{Ch(y,ba-x|0,1220);ea=f[l>>2]|0}x=f[j>>2]|0;if(!ea)da=x;else{j=f[a+68>>2]|0;a=0;do{f[j+(a<<2)>>2]=f[x+(a<<2)>>2];a=a+1|0}while(a>>>0>>0);da=x}}f[l>>2]=_;ca=da}if(!ca)fa=_;else{da=f[o>>2]|0;if((da|0)!=(ca|0))f[o>>2]=da+(~((da+-4-ca|0)>>>2)<<2);Oq(ca);fa=_}}else fa=0;_=f[g+8>>2]|0;if(_|0){ca=_;do{_=ca;ca=f[ca>>2]|0;Oq(_)}while((ca|0)!=0)}ca=f[g>>2]|0;f[g>>2]=0;if(!ca){u=e;return fa|0}Oq(ca);u=e;return fa|0} -function di(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0;d=u;u=u+16|0;e=d;Je(e,a+40|0,f[a+8>>2]|0,b,c);gj(a,e);a=f[e>>2]|0;f[e>>2]=0;if(!a){u=d;return 1}e=a+88|0;c=f[e>>2]|0;f[e>>2]=0;if(c|0){e=f[c+8>>2]|0;if(e|0){b=c+12|0;if((f[b>>2]|0)!=(e|0))f[b>>2]=e;Oq(e)}Oq(c)}c=f[a+68>>2]|0;if(c|0){e=a+72|0;b=f[e>>2]|0;if((b|0)!=(c|0))f[e>>2]=b+(~((b+-4-c|0)>>>2)<<2);Oq(c)}c=a+64|0;b=f[c>>2]|0;f[c>>2]=0;if(b|0){c=f[b>>2]|0;if(c|0){e=b+4|0;if((f[e>>2]|0)!=(c|0))f[e>>2]=c;Oq(c)}Oq(b)}Oq(a);u=d;return 1}function ei(a,b){a=a|0;b=b|0;var c=0,d=Oa,e=0,g=0;if((b|0)!=1)if(!(b+-1&b))c=b;else c=cb(b)|0;else c=2;b=f[a+4>>2]|0;if(c>>>0>b>>>0){Bd(a,c);return}if(c>>>0>=b>>>0)return;d=$((f[a+12>>2]|0)>>>0);e=~~$(W($(d/$(n[a+16>>2]))))>>>0;if(b>>>0>2&(b+-1&b|0)==0)g=1<<32-(_(e+-1|0)|0);else g=cb(e)|0;e=c>>>0>>0?g:c;if(e>>>0>=b>>>0)return;Bd(a,e);return}function fi(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0;e=u;u=u+48|0;g=e;h=e+32|0;if(!c){i=0;u=e;return i|0}Gn(g);if((dm(c,0)|0)!=-1?Qa[f[(f[c>>2]|0)+16>>2]&127](c)|0:0){Va[f[(f[c>>2]|0)+20>>2]&127](c);ch(h,a,c,g);c=(f[h>>2]|0)==0;a=h+4|0;if((b[a+11>>0]|0)<0)Oq(f[a>>2]|0);if(c){c=f[g>>2]|0;a=g+4|0;rg(d,c,c+((f[a>>2]|0)-c)|0);j=(f[a>>2]|0)-(f[g>>2]|0)|0}else j=0}else j=0;a=g+12|0;c=f[a>>2]|0;f[a>>2]=0;if(c|0)Oq(c);c=f[g>>2]|0;if(c|0){a=g+4|0;if((f[a>>2]|0)!=(c|0))f[a>>2]=c;Oq(c)}i=j;u=e;return i|0}function gi(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0;d=u;u=u+16|0;e=d;Fe(e,a+40|0,f[a+8>>2]|0,b,c);gj(a,e);a=f[e>>2]|0;f[e>>2]=0;if(!a){u=d;return 1}e=a+88|0;c=f[e>>2]|0;f[e>>2]=0;if(c|0){e=f[c+8>>2]|0;if(e|0){b=c+12|0;if((f[b>>2]|0)!=(e|0))f[b>>2]=e;Oq(e)}Oq(c)}c=f[a+68>>2]|0;if(c|0){e=a+72|0;b=f[e>>2]|0;if((b|0)!=(c|0))f[e>>2]=b+(~((b+-4-c|0)>>>2)<<2);Oq(c)}c=a+64|0;b=f[c>>2]|0;f[c>>2]=0;if(b|0){c=f[b>>2]|0;if(c|0){e=b+4|0;if((f[e>>2]|0)!=(c|0))f[e>>2]=c;Oq(c)}Oq(b)}Oq(a);u=d;return 1}function hi(a){a=a|0;var b=0,c=0,d=0,e=0,g=0,h=0,i=0,j=0;b=f[a>>2]|0;if(!b)return;c=a+4|0;d=f[c>>2]|0;if((d|0)==(b|0))e=b;else{g=d;do{d=g+-4|0;f[c>>2]=d;h=f[d>>2]|0;f[d>>2]=0;if(h|0){d=h+88|0;i=f[d>>2]|0;f[d>>2]=0;if(i|0){d=f[i+8>>2]|0;if(d|0){j=i+12|0;if((f[j>>2]|0)!=(d|0))f[j>>2]=d;Oq(d)}Oq(i)}i=f[h+68>>2]|0;if(i|0){d=h+72|0;j=f[d>>2]|0;if((j|0)!=(i|0))f[d>>2]=j+(~((j+-4-i|0)>>>2)<<2);Oq(i)}i=h+64|0;j=f[i>>2]|0;f[i>>2]=0;if(j|0){i=f[j>>2]|0;if(i|0){d=j+4|0;if((f[d>>2]|0)!=(i|0))f[d>>2]=i;Oq(i)}Oq(j)}Oq(h)}g=f[c>>2]|0}while((g|0)!=(b|0));e=f[a>>2]|0}Oq(e);return}function ii(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0;d=u;u=u+16|0;e=d+4|0;g=d;h=d+8|0;if(!(Ie(a,c)|0)){i=0;u=d;return i|0}j=a+36|0;k=a+40|0;a=f[j>>2]|0;if((f[k>>2]|0)==(a|0)){i=1;u=d;return i|0}l=c+16|0;m=c+4|0;n=h+1|0;o=0;p=a;do{a=f[p+(o<<2)>>2]|0;q=Qa[f[(f[a>>2]|0)+32>>2]&127](a)|0;b[h>>0]=q;q=l;a=f[q+4>>2]|0;if(!((a|0)>0|(a|0)==0&(f[q>>2]|0)>>>0>0)){f[g>>2]=f[m>>2];f[e>>2]=f[g>>2];Me(c,e,h,n)|0}o=o+1|0;p=f[j>>2]|0}while(o>>>0<(f[k>>2]|0)-p>>2>>>0);i=1;u=d;return i|0}function ji(a){a=a|0;var c=0,d=0,e=0,g=0,h=0,i=0;c=u;u=u+16|0;d=c;lp(a);f[a+16>>2]=0;f[a+20>>2]=0;f[a+12>>2]=a+16;e=a+24|0;lp(e);f[d>>2]=0;f[d+4>>2]=0;f[d+8>>2]=0;a=ln(32)|0;f[d>>2]=a;f[d+8>>2]=-2147483616;f[d+4>>2]=20;g=a;h=14538;i=g+20|0;do{b[g>>0]=b[h>>0]|0;g=g+1|0;h=h+1|0}while((g|0)<(i|0));b[a+20>>0]=0;Vj(e,d,1);if((b[d+11>>0]|0)<0)Oq(f[d>>2]|0);f[d>>2]=0;f[d+4>>2]=0;f[d+8>>2]=0;a=ln(32)|0;f[d>>2]=a;f[d+8>>2]=-2147483616;f[d+4>>2]=22;g=a;h=14559;i=g+22|0;do{b[g>>0]=b[h>>0]|0;g=g+1|0;h=h+1|0}while((g|0)<(i|0));b[a+22>>0]=0;Vj(e,d,1);if((b[d+11>>0]|0)>=0){u=c;return}Oq(f[d>>2]|0);u=c;return}function ki(a){a=a|0;var b=0,c=0,d=0,e=0,g=0,h=0,i=0;b=f[a+4>>2]|0;c=a+8|0;d=f[c>>2]|0;if((d|0)!=(b|0)){e=d;do{d=e+-4|0;f[c>>2]=d;g=f[d>>2]|0;f[d>>2]=0;if(g|0){d=g+88|0;h=f[d>>2]|0;f[d>>2]=0;if(h|0){d=f[h+8>>2]|0;if(d|0){i=h+12|0;if((f[i>>2]|0)!=(d|0))f[i>>2]=d;Oq(d)}Oq(h)}h=f[g+68>>2]|0;if(h|0){d=g+72|0;i=f[d>>2]|0;if((i|0)!=(h|0))f[d>>2]=i+(~((i+-4-h|0)>>>2)<<2);Oq(h)}h=g+64|0;i=f[h>>2]|0;f[h>>2]=0;if(i|0){h=f[i>>2]|0;if(h|0){d=i+4|0;if((f[d>>2]|0)!=(h|0))f[d>>2]=h;Oq(h)}Oq(i)}Oq(g)}e=f[c>>2]|0}while((e|0)!=(b|0))}b=f[a>>2]|0;if(!b)return;Oq(b);return}function li(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0;c=u;u=u+16|0;d=c+8|0;e=c+4|0;g=c;f[g>>2]=f[a+12>>2];h=b+16|0;i=h;j=f[i>>2]|0;k=f[i+4>>2]|0;if((k|0)>0|(k|0)==0&j>>>0>0){l=k;m=j}else{f[e>>2]=f[b+4>>2];f[d>>2]=f[e>>2];Me(b,d,g,g+4|0)|0;j=h;l=f[j+4>>2]|0;m=f[j>>2]|0}f[g>>2]=f[a+20>>2];if((l|0)>0|(l|0)==0&m>>>0>0){u=c;return 1}f[e>>2]=f[b+4>>2];f[d>>2]=f[e>>2];Me(b,d,g,g+4|0)|0;u=c;return 1}function mi(a){a=a|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;c=u;u=u+16|0;d=c;e=ln(16)|0;f[d>>2]=e;f[d+8>>2]=-2147483632;f[d+4>>2]=14;g=e;h=14408;i=g+14|0;do{b[g>>0]=b[h>>0]|0;g=g+1|0;h=h+1|0}while((g|0)<(i|0));b[e+14>>0]=0;e=Hk(a,d,-1)|0;if((b[d+11>>0]|0)<0)Oq(f[d>>2]|0);j=ln(16)|0;f[d>>2]=j;f[d+8>>2]=-2147483632;f[d+4>>2]=14;g=j;h=14423;i=g+14|0;do{b[g>>0]=b[h>>0]|0;g=g+1|0;h=h+1|0}while((g|0)<(i|0));b[j+14>>0]=0;j=Hk(a,d,-1)|0;if((b[d+11>>0]|0)>=0){k=(e|0)<(j|0);l=k?j:e;m=(l|0)==-1;n=m?5:l;u=c;return n|0}Oq(f[d>>2]|0);k=(e|0)<(j|0);l=k?j:e;m=(l|0)==-1;n=m?5:l;u=c;return n|0}function ni(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0;c=u;u=u+16|0;d=c+8|0;e=c+4|0;g=c;f[g>>2]=f[a+12>>2];h=b+16|0;i=h;j=f[i>>2]|0;k=f[i+4>>2]|0;if((k|0)>0|(k|0)==0&j>>>0>0){l=k;m=j}else{f[e>>2]=f[b+4>>2];f[d>>2]=f[e>>2];Me(b,d,g,g+4|0)|0;j=h;l=f[j+4>>2]|0;m=f[j>>2]|0}f[g>>2]=f[a+16>>2];if((l|0)>0|(l|0)==0&m>>>0>0){u=c;return 1}f[e>>2]=f[b+4>>2];f[d>>2]=f[e>>2];Me(b,d,g,g+4|0)|0;u=c;return 1}function oi(a,c,d,e){a=a|0;c=c|0;d=d|0;e=e|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;g=ln(32)|0;f[a>>2]=g;f[a+4>>2]=c+8;c=a+8|0;b[c>>0]=0;h=g+8|0;f[h>>2]=f[e>>2];f[h+4>>2]=f[e+4>>2];f[h+8>>2]=f[e+8>>2];f[e>>2]=0;f[e+4>>2]=0;f[e+8>>2]=0;h=g+20|0;i=e+12|0;f[h>>2]=0;f[g+24>>2]=0;f[g+28>>2]=0;g=e+16|0;e=f[g>>2]|0;j=f[i>>2]|0;k=e-j|0;if(!k){l=j;m=e;n=0}else{Fi(h,k);l=f[i>>2]|0;m=f[g>>2]|0;n=f[h>>2]|0}kh(n|0,l|0,m-l|0)|0;b[c>>0]=1;c=f[a>>2]|0;f[c+4>>2]=d;f[c>>2]=0;return}function pi(a){a=a|0;var b=0,c=0,d=0,e=0,g=0,h=0,i=0,j=0;b=a+32|0;ld(a,b);c=a+80|0;d=f[c>>2]|0;if((d|0?(e=a+84|0,(f[e>>2]|0)>0):0)?(ld(d,b),(f[e>>2]|0)>1):0){d=1;do{ld((f[c>>2]|0)+(d<<5)|0,b);d=d+1|0}while((d|0)<(f[e>>2]|0))}e=a+136|0;d=a+140|0;a=f[e>>2]|0;if((f[d>>2]|0)==(a|0))return;c=0;g=a;while(1){a=g;ci((f[a+(c*12|0)+4>>2]|0)-(f[a+(c*12|0)>>2]|0)>>2,b)|0;a=f[e>>2]|0;h=f[a+(c*12|0)>>2]|0;i=(f[a+(c*12|0)+4>>2]|0)-h>>2;if(!i)j=a;else{Mc(h,i,1,0,b)|0;j=f[e>>2]|0}c=c+1|0;if(c>>>0>=(((f[d>>2]|0)-j|0)/12|0)>>>0)break;else g=j}return}function qi(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;e=d+16|0;g=f[e>>2]|0;if(!g)if(!(vl(d)|0)){h=f[e>>2]|0;i=5}else j=0;else{h=g;i=5}a:do if((i|0)==5){g=d+20|0;e=f[g>>2]|0;k=e;if((h-e|0)>>>0>>0){j=Sa[f[d+36>>2]&31](d,a,c)|0;break}b:do if((b[d+75>>0]|0)>-1){e=c;while(1){if(!e){l=0;m=a;n=c;o=k;break b}p=e+-1|0;if((b[a+p>>0]|0)==10)break;else e=p}p=Sa[f[d+36>>2]&31](d,a,e)|0;if(p>>>0>>0){j=p;break a}l=e;m=a+e|0;n=c-e|0;o=f[g>>2]|0}else{l=0;m=a;n=c;o=k}while(0);kh(o|0,m|0,n|0)|0;f[g>>2]=(f[g>>2]|0)+n;j=l+n|0}while(0);return j|0}function ri(a){a=a|0;var c=0,d=0,e=0,g=0,h=0,i=0;c=a+12|0;d=f[c>>2]|0;f[c>>2]=0;if(d|0){c=f[d+28>>2]|0;if(c|0){e=c;do{c=e;e=f[e>>2]|0;ri(c+8|0);Oq(c)}while((e|0)!=0)}e=d+20|0;c=f[e>>2]|0;f[e>>2]=0;if(c|0)Oq(c);c=f[d+8>>2]|0;if(c|0){e=c;do{c=e;e=f[e>>2]|0;g=c+8|0;h=f[c+20>>2]|0;if(h|0){i=c+24|0;if((f[i>>2]|0)!=(h|0))f[i>>2]=h;Oq(h)}if((b[g+11>>0]|0)<0)Oq(f[g>>2]|0);Oq(c)}while((e|0)!=0)}e=f[d>>2]|0;f[d>>2]=0;if(e|0)Oq(e);Oq(d)}if((b[a+11>>0]|0)>=0)return;Oq(f[a>>2]|0);return}function si(a,c,d,e){a=a|0;c=c|0;d=d|0;e=e|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,o=0;g=u;u=u+32|0;h=g+12|0;i=g;f[h>>2]=0;f[h+4>>2]=0;f[h+8>>2]=0;if((e|0)>0){j=i+11|0;k=i+4|0;l=0;do{if((l|0)>0)An(h,14477)|0;il(i,$(n[d+(l<<2)>>2]));m=b[j>>0]|0;o=m<<24>>24<0;lj(h,o?f[i>>2]|0:i,o?f[k>>2]|0:m&255)|0;if((b[j>>0]|0)<0)Oq(f[i>>2]|0);l=l+1|0}while((l|0)<(e|0))}am(Ai(a,c)|0,h)|0;if((b[h+11>>0]|0)>=0){u=g;return}Oq(f[h>>2]|0);u=g;return}function ti(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0;c=u;u=u+16|0;d=c;if((Qa[f[(f[b>>2]|0)+20>>2]&127](b)|0)<=0){e=1;u=c;return e|0}g=a+4|0;h=a+20|0;i=a+24|0;j=a+16|0;a=0;while(1){k=f[(f[g>>2]|0)+4>>2]|0;l=dm(k,Ra[f[(f[b>>2]|0)+24>>2]&127](b,a)|0)|0;f[d>>2]=l;if((l|0)==-1)break;k=f[h>>2]|0;if((k|0)==(f[i>>2]|0))Ri(j,d);else{f[k>>2]=l;f[h>>2]=k+4}gl(f[g>>2]|0,f[d>>2]|0)|0;a=a+1|0;if((a|0)>=(Qa[f[(f[b>>2]|0)+20>>2]&127](b)|0)){e=1;m=9;break}}if((m|0)==9){u=c;return e|0}e=0;u=c;return e|0}function ui(a){a=a|0;var b=0,c=0,d=0,e=0,g=0,h=0;f[a>>2]=1292;hi(a+60|0);b=f[a+48>>2]|0;if(b|0){c=a+52|0;d=f[c>>2]|0;if((d|0)!=(b|0))f[c>>2]=d+(~((d+-4-b|0)>>>2)<<2);Oq(b)}b=a+36|0;d=f[b>>2]|0;if(d|0){c=a+40|0;e=f[c>>2]|0;if((e|0)==(d|0))g=d;else{h=e;do{e=h+-24|0;f[c>>2]=e;Va[f[f[e>>2]>>2]&127](e);h=f[c>>2]|0}while((h|0)!=(d|0));g=f[b>>2]|0}Oq(g)}f[a>>2]=1232;g=f[a+16>>2]|0;if(g|0){b=a+20|0;d=f[b>>2]|0;if((d|0)!=(g|0))f[b>>2]=d+(~((d+-4-g|0)>>>2)<<2);Oq(g)}g=f[a+4>>2]|0;if(!g)return;d=a+8|0;a=f[d>>2]|0;if((a|0)!=(g|0))f[d>>2]=a+(~((a+-4-g|0)>>>2)<<2);Oq(g);return}function vi(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0;c=u;u=u+32|0;d=c+16|0;e=c+8|0;g=c;h=a+8|0;if(f[h>>2]<<5>>>0>=b>>>0){u=c;return}f[d>>2]=0;i=d+4|0;f[i>>2]=0;j=d+8|0;f[j>>2]=0;if((b|0)<0)aq(d);k=((b+-1|0)>>>5)+1|0;b=ln(k<<2)|0;f[d>>2]=b;f[i>>2]=0;f[j>>2]=k;k=f[a>>2]|0;f[e>>2]=k;f[e+4>>2]=0;b=a+4|0;l=f[b>>2]|0;f[g>>2]=k+(l>>>5<<2);f[g+4>>2]=l&31;zg(d,e,g);g=f[a>>2]|0;f[a>>2]=f[d>>2];f[d>>2]=g;d=f[b>>2]|0;f[b>>2]=f[i>>2];f[i>>2]=d;d=f[h>>2]|0;f[h>>2]=f[j>>2];f[j>>2]=d;if(g|0)Oq(g);u=c;return}function wi(a){a=a|0;var b=0,c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0;b=a+136|0;c=f[b>>2]|0;if(c|0){d=a+140|0;e=f[d>>2]|0;if((e|0)==(c|0))g=c;else{h=e;while(1){e=h+-12|0;f[d>>2]=e;i=f[e>>2]|0;if(!i)j=e;else{e=h+-8|0;k=f[e>>2]|0;if((k|0)!=(i|0))f[e>>2]=k+(~((k+-4-i|0)>>>2)<<2);Oq(i);j=f[d>>2]|0}if((j|0)==(c|0))break;else h=j}g=f[b>>2]|0}Oq(g)}g=f[a+104>>2]|0;if(g|0){b=a+108|0;j=f[b>>2]|0;if((j|0)!=(g|0))f[b>>2]=j+(~((j+-4-g|0)>>>2)<<2);Oq(g)}g=f[a+92>>2]|0;if(!g){uj(a);return}j=a+96|0;b=f[j>>2]|0;if((b|0)!=(g|0))f[j>>2]=b+(~((b+-4-g|0)>>>2)<<2);Oq(g);uj(a);return}function xi(a){a=a|0;var c=0,d=0,e=0,g=0;f[a>>2]=3680;c=a+72|0;d=a+136|0;e=a+4|0;g=e+64|0;do{f[e>>2]=0;e=e+4|0}while((e|0)<(g|0));e=c;g=e+64|0;do{f[e>>2]=0;e=e+4|0}while((e|0)<(g|0));n[d>>2]=$(1.0);d=a+140|0;f[d>>2]=0;f[d+4>>2]=0;f[d+8>>2]=0;f[d+12>>2]=0;f[d+16>>2]=0;f[d+20>>2]=0;f[a+164>>2]=-1;d=a+168|0;f[d>>2]=0;f[d+4>>2]=0;f[d+8>>2]=0;f[d+12>>2]=0;f[d+16>>2]=0;f[d+20>>2]=0;f[d+24>>2]=0;wn(a+200|0);Gn(a+232|0);d=a+316|0;e=a+264|0;g=e+52|0;do{f[e>>2]=0;e=e+4|0}while((e|0)<(g|0));f[d>>2]=-1;f[a+320>>2]=-1;f[a+324>>2]=0;f[a+328>>2]=2;f[a+332>>2]=7;f[a+336>>2]=0;f[a+340>>2]=0;f[a+344>>2]=0;b[a+352>>0]=0;return}function yi(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0;c=a+4|0;d=f[a>>2]|0;e=(f[c>>2]|0)-d|0;g=(e|0)/12|0;h=g+1|0;if(h>>>0>357913941)aq(a);i=a+8|0;j=((f[i>>2]|0)-d|0)/12|0;k=j<<1;l=j>>>0<178956970?(k>>>0>>0?h:k):357913941;do if(l)if(l>>>0>357913941){k=ra(8)|0;Oo(k,16035);f[k>>2]=7256;va(k|0,1112,110)}else{m=ln(l*12|0)|0;break}else m=0;while(0);k=m+(g*12|0)|0;f[k>>2]=f[b>>2];f[k+4>>2]=f[b+4>>2];f[k+8>>2]=f[b+8>>2];b=k+(((e|0)/-12|0)*12|0)|0;if((e|0)>0)kh(b|0,d|0,e|0)|0;f[a>>2]=b;f[c>>2]=k+12;f[i>>2]=m+(l*12|0);if(!d)return;Oq(d);return}function zi(a,c,d,e){a=a|0;c=c|0;d=d|0;e=e|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;g=a+16|0;h=g;i=f[h+4>>2]|0;if((d|0)<0|(d|0)==0&c>>>0<1|((i|0)>0|(i|0)==0&(f[h>>2]|0)>>>0>0)){j=0;return j|0}b[a+24>>0]=e&1;h=Vn(c|0,d|0,7,0)|0;d=Ik(h|0,I|0,8,0)|0;h=I;c=g;f[c>>2]=d;f[c+4>>2]=h;c=a+4|0;g=f[c>>2]|0;i=f[a>>2]|0;k=g-i|0;l=Vn(k|0,0,8,0)|0;m=e?l:k;l=Vn(m|0,(e?I:0)|0,d|0,h|0)|0;h=i;i=g;if(k>>>0>=l>>>0)if(k>>>0>l>>>0?(g=h+l|0,(g|0)!=(i|0)):0){f[c>>2]=g;n=h}else n=h;else{Fi(a,l-k|0);n=f[a>>2]|0}k=ln(8)|0;f[k>>2]=n+m;f[k+4>>2]=0;m=a+12|0;a=f[m>>2]|0;f[m>>2]=k;if(!a){j=1;return j|0}Oq(a);j=1;return j|0}function Ai(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0;c=u;u=u+16|0;d=c;e=yg(a,d,b)|0;g=f[e>>2]|0;if(g|0){h=g;i=h+28|0;u=c;return i|0}g=ln(40)|0;pj(g+16|0,b);b=g+28|0;f[b>>2]=0;f[b+4>>2]=0;f[b+8>>2]=0;b=f[d>>2]|0;f[g>>2]=0;f[g+4>>2]=0;f[g+8>>2]=b;f[e>>2]=g;b=f[f[a>>2]>>2]|0;if(!b)j=g;else{f[a>>2]=b;j=f[e>>2]|0}Oe(f[a+4>>2]|0,j);j=a+8|0;f[j>>2]=(f[j>>2]|0)+1;h=g;i=h+28|0;u=c;return i|0}function Bi(a,c,d,e,g,h,i,j){a=a|0;c=c|0;d=d|0;e=e|0;g=g|0;h=h|0;i=i|0;j=j|0;var k=0,l=0,m=0,n=0,o=0,p=0;k=u;u=u+16|0;l=k;if((-18-c|0)>>>0>>0)aq(a);if((b[a+11>>0]|0)<0)m=f[a>>2]|0;else m=a;if(c>>>0<2147483623){n=d+c|0;d=c<<1;o=n>>>0>>0?d:n;p=o>>>0<11?11:o+16&-16}else p=-17;o=ln(p)|0;if(g|0)Fo(o,m,g)|0;if(i|0)Fo(o+g|0,j,i)|0;j=e-h|0;e=j-g|0;if(e|0)Fo(o+g+i|0,m+g+h|0,e)|0;if((c|0)!=10)Oq(m);f[a>>2]=o;f[a+8>>2]=p|-2147483648;p=j+i|0;f[a+4>>2]=p;b[l>>0]=0;up(o+p|0,l);u=k;return}function Ci(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;c=a+8|0;d=f[c>>2]|0;e=a+4|0;g=f[e>>2]|0;if(d-g>>2>>>0>=b>>>0){sj(g|0,0,b<<2|0)|0;f[e>>2]=g+(b<<2);return}h=f[a>>2]|0;i=g-h|0;g=i>>2;j=g+b|0;if(j>>>0>1073741823)aq(a);k=d-h|0;d=k>>1;l=k>>2>>>0<536870911?(d>>>0>>0?j:d):1073741823;do if(l)if(l>>>0>1073741823){d=ra(8)|0;Oo(d,16035);f[d>>2]=7256;va(d|0,1112,110)}else{d=ln(l<<2)|0;m=d;n=d;break}else{m=0;n=0}while(0);d=m+(g<<2)|0;sj(d|0,0,b<<2|0)|0;if((i|0)>0)kh(n|0,h|0,i|0)|0;f[a>>2]=m;f[e>>2]=d+(b<<2);f[c>>2]=m+(l<<2);if(!h)return;Oq(h);return}function Di(a,c,d,e){a=a|0;c=c|0;d=d|0;e=e|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;g=ln(32)|0;f[a>>2]=g;f[a+4>>2]=c+8;c=a+8|0;b[c>>0]=0;pj(g+8|0,e);h=g+20|0;i=e+12|0;f[h>>2]=0;f[g+24>>2]=0;f[g+28>>2]=0;g=e+16|0;e=f[g>>2]|0;j=f[i>>2]|0;k=e-j|0;if(!k){l=j;m=e;n=0}else{Fi(h,k);l=f[i>>2]|0;m=f[g>>2]|0;n=f[h>>2]|0}kh(n|0,l|0,m-l|0)|0;b[c>>0]=1;c=f[a>>2]|0;f[c+4>>2]=d;f[c>>2]=0;return}function Ei(a,c,d){a=a|0;c=c|0;d=$(d);var e=0,g=0,h=0,i=0,j=0,k=0.0,l=0,m=0,n=0,o=0;e=u;u=u+16|0;g=e;h=c+11|0;i=b[h>>0]|0;if(i<<24>>24<0)j=f[c+4>>2]|0;else j=i&255;k=+d;l=j;j=i;while(1){if(j<<24>>24<0)m=f[c>>2]|0;else m=c;p[g>>3]=k;n=Bn(m,l+1|0,18562,g)|0;if((n|0)>-1)if(n>>>0>l>>>0)o=n;else break;else o=l<<1|1;Hj(c,o,0);l=o;j=b[h>>0]|0}Hj(c,n,0);f[a>>2]=f[c>>2];f[a+4>>2]=f[c+4>>2];f[a+8>>2]=f[c+8>>2];a=0;while(1){if((a|0)==3)break;f[c+(a<<2)>>2]=0;a=a+1|0}u=e;return}function Fi(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0;d=a+8|0;e=f[d>>2]|0;g=a+4|0;h=f[g>>2]|0;if((e-h|0)>>>0>=c>>>0){i=c;j=h;do{b[j>>0]=0;j=(f[g>>2]|0)+1|0;f[g>>2]=j;i=i+-1|0}while((i|0)!=0);return}i=f[a>>2]|0;j=h-i|0;h=j+c|0;if((h|0)<0)aq(a);k=e-i|0;i=k<<1;e=k>>>0<1073741823?(i>>>0>>0?h:i):2147483647;if(!e)l=0;else l=ln(e)|0;i=l+j|0;j=l+e|0;e=c;c=i;l=i;do{b[l>>0]=0;l=c+1|0;c=l;e=e+-1|0}while((e|0)!=0);e=f[a>>2]|0;l=(f[g>>2]|0)-e|0;h=i+(0-l)|0;if((l|0)>0)kh(h|0,e|0,l|0)|0;f[a>>2]=h;f[g>>2]=c;f[d>>2]=j;if(!e)return;Oq(e);return}function Gi(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0;c=a+4|0;d=f[c>>2]|0;e=f[a>>2]|0;g=(d-e|0)/136|0;h=d;if(g>>>0>>0){Ge(a,b-g|0);return}if(g>>>0<=b>>>0)return;g=e+(b*136|0)|0;if((g|0)==(h|0))return;else i=h;do{f[c>>2]=i+-136;h=f[i+-20>>2]|0;if(h|0){b=i+-16|0;e=f[b>>2]|0;if((e|0)!=(h|0))f[b>>2]=e+(~((e+-4-h|0)>>>2)<<2);Oq(h)}h=f[i+-32>>2]|0;if(h|0){e=i+-28|0;b=f[e>>2]|0;if((b|0)!=(h|0))f[e>>2]=b+(~((b+-4-h|0)>>>2)<<2);Oq(h)}Mi(i+-132|0);i=f[c>>2]|0}while((i|0)!=(g|0));return}function Hi(a,b){a=a|0;b=b|0;var c=0,d=Oa,e=0,g=0;if((b|0)!=1)if(!(b+-1&b))c=b;else c=cb(b)|0;else c=2;b=f[a+4>>2]|0;if(c>>>0>b>>>0){Sd(a,c);return}if(c>>>0>=b>>>0)return;d=$((f[a+12>>2]|0)>>>0);e=~~$(W($(d/$(n[a+16>>2]))))>>>0;if(b>>>0>2&(b+-1&b|0)==0)g=1<<32-(_(e+-1|0)|0);else g=cb(e)|0;e=c>>>0>>0?g:c;if(e>>>0>=b>>>0)return;Sd(a,e);return}function Ii(a){a=a|0;var b=0,c=0,d=0;b=f[a+76>>2]|0;if(b|0){c=a+80|0;d=f[c>>2]|0;if((d|0)!=(b|0))f[c>>2]=d+(~((d+-4-b|0)>>>2)<<2);Oq(b)}b=f[a+64>>2]|0;if(b|0){d=a+68|0;if((f[d>>2]|0)!=(b|0))f[d>>2]=b;Oq(b)}b=f[a+48>>2]|0;if(b|0){d=a+52|0;c=f[d>>2]|0;if((c|0)!=(b|0))f[d>>2]=c+(~((c+-4-b|0)>>>2)<<2);Oq(b)}b=f[a+24>>2]|0;if(b|0){c=a+28|0;d=f[c>>2]|0;if((d|0)!=(b|0))f[c>>2]=d+(~((d+-4-b|0)>>>2)<<2);Oq(b)}b=f[a+12>>2]|0;if(b|0){d=a+16|0;c=f[d>>2]|0;if((c|0)!=(b|0))f[d>>2]=c+(~((c+-4-b|0)>>>2)<<2);Oq(b)}b=f[a>>2]|0;if(!b)return;c=a+4|0;a=f[c>>2]|0;if((a|0)!=(b|0))f[c>>2]=a+(~((a+-4-b|0)>>>2)<<2);Oq(b);return}function Ji(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;e=u;u=u+16|0;g=e;h=c+11|0;i=b[h>>0]|0;if(i<<24>>24<0)j=f[c+4>>2]|0;else j=i&255;k=j;j=i;while(1){if(j<<24>>24<0)l=f[c>>2]|0;else l=c;f[g>>2]=d;m=Bn(l,k+1|0,18559,g)|0;if((m|0)>-1)if(m>>>0>k>>>0)n=m;else break;else n=k<<1|1;Hj(c,n,0);k=n;j=b[h>>0]|0}Hj(c,m,0);f[a>>2]=f[c>>2];f[a+4>>2]=f[c+4>>2];f[a+8>>2]=f[c+8>>2];a=0;while(1){if((a|0)==3)break;f[c+(a<<2)>>2]=0;a=a+1|0}u=e;return}function Ki(a){a=a|0;var b=0,c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0;b=a+8|0;c=f[b>>2]|0;if((c|0)<0){d=0;return d|0}e=a+4|0;a=f[e>>2]|0;g=a+4|0;h=f[g>>2]|0;i=f[a>>2]|0;j=h-i>>2;k=i;i=h;if(c>>>0<=j>>>0)if(c>>>0>>0?(h=k+(c<<2)|0,(h|0)!=(i|0)):0){f[g>>2]=i+(~((i+-4-h|0)>>>2)<<2);l=c}else l=c;else{Ci(a,c-j|0);l=f[b>>2]|0}if((l|0)<=0){d=1;return d|0}b=f[e>>2]|0;e=f[b>>2]|0;j=(f[b+4>>2]|0)-e>>2;c=e;e=0;while(1){if(j>>>0<=e>>>0){m=10;break}f[c+(e<<2)>>2]=e;e=e+1|0;if((e|0)>=(l|0)){d=1;m=12;break}}if((m|0)==10)aq(b);else if((m|0)==12)return d|0;return 0}function Li(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0;e=u;u=u+16|0;g=e;h=ln(16)|0;f[g>>2]=h;f[g+8>>2]=-2147483632;f[g+4>>2]=14;i=h;j=14408;k=i+14|0;do{b[i>>0]=b[j>>0]|0;i=i+1|0;j=j+1|0}while((i|0)<(k|0));b[h+14>>0]=0;Xj(a,g,c);if((b[g+11>>0]|0)<0)Oq(f[g>>2]|0);c=ln(16)|0;f[g>>2]=c;f[g+8>>2]=-2147483632;f[g+4>>2]=14;i=c;j=14423;k=i+14|0;do{b[i>>0]=b[j>>0]|0;i=i+1|0;j=j+1|0}while((i|0)<(k|0));b[c+14>>0]=0;Xj(a,g,d);if((b[g+11>>0]|0)>=0){u=e;return}Oq(f[g>>2]|0);u=e;return}function Mi(a){a=a|0;var b=0,c=0,d=0;b=f[a+84>>2]|0;if(b|0){c=a+88|0;d=f[c>>2]|0;if((d|0)!=(b|0))f[c>>2]=d+(~((d+-4-b|0)>>>2)<<2);Oq(b)}b=f[a+72>>2]|0;if(b|0){d=a+76|0;if((f[d>>2]|0)!=(b|0))f[d>>2]=b;Oq(b)}b=f[a+52>>2]|0;if(b|0){d=a+56|0;c=f[d>>2]|0;if((c|0)!=(b|0))f[d>>2]=c+(~((c+-4-b|0)>>>2)<<2);Oq(b)}b=f[a+40>>2]|0;if(b|0){c=a+44|0;d=f[c>>2]|0;if((d|0)!=(b|0))f[c>>2]=d+(~((d+-4-b|0)>>>2)<<2);Oq(b)}b=f[a+28>>2]|0;if(b|0){d=a+32|0;c=f[d>>2]|0;if((c|0)!=(b|0))f[d>>2]=c+(~((c+-4-b|0)>>>2)<<2);Oq(b)}b=f[a+12>>2]|0;if(b|0)Oq(b);b=f[a>>2]|0;if(!b)return;Oq(b);return}function Ni(a){a=a|0;var b=0,c=0,d=0,e=0;f[a>>2]=1352;b=a+32|0;c=f[b>>2]|0;f[b>>2]=0;if(c|0){b=c+88|0;d=f[b>>2]|0;f[b>>2]=0;if(d|0){b=f[d+8>>2]|0;if(b|0){e=d+12|0;if((f[e>>2]|0)!=(b|0))f[e>>2]=b;Oq(b)}Oq(d)}d=f[c+68>>2]|0;if(d|0){b=c+72|0;e=f[b>>2]|0;if((e|0)!=(d|0))f[b>>2]=e+(~((e+-4-d|0)>>>2)<<2);Oq(d)}d=c+64|0;e=f[d>>2]|0;f[d>>2]=0;if(e|0){d=f[e>>2]|0;if(d|0){b=e+4|0;if((f[b>>2]|0)!=(d|0))f[b>>2]=d;Oq(d)}Oq(e)}Oq(c)}c=f[a+16>>2]|0;if(!c)return;e=a+20|0;a=f[e>>2]|0;if((a|0)!=(c|0))f[e>>2]=a+(~((a+-4-c|0)>>>2)<<2);Oq(c);return}function Oi(){var a=0,b=0,c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0;a=u;u=u+48|0;b=a+32|0;c=a+24|0;d=a+16|0;e=a;g=a+36|0;a=sn()|0;if(a|0?(h=f[a>>2]|0,h|0):0){a=h+48|0;i=f[a>>2]|0;j=f[a+4>>2]|0;if(!((i&-256|0)==1126902528&(j|0)==1129074247)){f[c>>2]=18701;Hn(18651,c)}if((i|0)==1126902529&(j|0)==1129074247)k=f[h+44>>2]|0;else k=h+80|0;f[g>>2]=k;k=f[h>>2]|0;h=f[k+4>>2]|0;if(Sa[f[(f[258]|0)+16>>2]&31](1032,k,g)|0){k=f[g>>2]|0;g=Qa[f[(f[k>>2]|0)+8>>2]&127](k)|0;f[e>>2]=18701;f[e+4>>2]=h;f[e+8>>2]=g;Hn(18565,e)}else{f[d>>2]=18701;f[d+4>>2]=h;Hn(18610,d)}}Hn(18689,b)}function Pi(a,c,d){a=a|0;c=c|0;d=d|0;var e=0;do if(a){if(c>>>0<128){b[a>>0]=c;e=1;break}d=(Jq()|0)+188|0;if(!(f[f[d>>2]>>2]|0))if((c&-128|0)==57216){b[a>>0]=c;e=1;break}else{d=Vq()|0;f[d>>2]=84;e=-1;break}if(c>>>0<2048){b[a>>0]=c>>>6|192;b[a+1>>0]=c&63|128;e=2;break}if(c>>>0<55296|(c&-8192|0)==57344){b[a>>0]=c>>>12|224;b[a+1>>0]=c>>>6&63|128;b[a+2>>0]=c&63|128;e=3;break}if((c+-65536|0)>>>0<1048576){b[a>>0]=c>>>18|240;b[a+1>>0]=c>>>12&63|128;b[a+2>>0]=c>>>6&63|128;b[a+3>>0]=c&63|128;e=4;break}else{d=Vq()|0;f[d>>2]=84;e=-1;break}}else e=1;while(0);return e|0}function Qi(a){a=a|0;var b=0,c=0,d=0;b=f[a+92>>2]|0;if(b|0){c=a+96|0;d=f[c>>2]|0;if((d|0)!=(b|0))f[c>>2]=d+(~((d+-4-b|0)>>>2)<<2);Oq(b)}b=f[a+76>>2]|0;if(b|0){d=a+80|0;c=f[d>>2]|0;if((c|0)!=(b|0))f[d>>2]=c+(~((c+-4-b|0)>>>2)<<2);Oq(b)}b=f[a+64>>2]|0;if(b|0){c=a+68|0;d=f[c>>2]|0;if((d|0)!=(b|0))f[c>>2]=d+(~((d+-4-b|0)>>>2)<<2);Oq(b)}b=f[a+52>>2]|0;if(b|0){d=a+56|0;c=f[d>>2]|0;if((c|0)!=(b|0))f[d>>2]=c+(~((c+-4-b|0)>>>2)<<2);Oq(b)}f[a+4>>2]=3636;b=f[a+24>>2]|0;if(b|0)Oq(b);b=f[a+12>>2]|0;if(!b)return;Oq(b);return}function Ri(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;c=a+4|0;d=f[a>>2]|0;e=(f[c>>2]|0)-d|0;g=e>>2;h=g+1|0;if(h>>>0>1073741823)aq(a);i=a+8|0;j=(f[i>>2]|0)-d|0;k=j>>1;l=j>>2>>>0<536870911?(k>>>0>>0?h:k):1073741823;do if(l)if(l>>>0>1073741823){k=ra(8)|0;Oo(k,16035);f[k>>2]=7256;va(k|0,1112,110)}else{k=ln(l<<2)|0;m=k;n=k;break}else{m=0;n=0}while(0);k=m+(g<<2)|0;f[k>>2]=f[b>>2];if((e|0)>0)kh(n|0,d|0,e|0)|0;f[a>>2]=m;f[c>>2]=k+4;f[i>>2]=m+(l<<2);if(!d)return;Oq(d);return}function Si(a){a=a|0;var c=0,d=0,e=0,g=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0;c=a+104|0;d=f[c>>2]|0;if((d|0)!=0?(f[a+108>>2]|0)>=(d|0):0)e=4;else{d=Wm(a)|0;if((d|0)>=0){g=f[c>>2]|0;c=a+8|0;if(g){i=f[c>>2]|0;j=f[a+4>>2]|0;k=g-(f[a+108>>2]|0)|0;g=i;if((i-j|0)<(k|0)){l=g;m=g}else{l=j+(k+-1)|0;m=g}}else{g=f[c>>2]|0;l=g;m=g}f[a+100>>2]=l;l=a+4|0;if(!m)n=f[l>>2]|0;else{g=f[l>>2]|0;l=a+108|0;f[l>>2]=m+1-g+(f[l>>2]|0);n=g}g=n+-1|0;if((d|0)==(h[g>>0]|0|0))o=d;else{b[g>>0]=d;o=d}}else e=4}if((e|0)==4){f[a+100>>2]=0;o=-1}return o|0}function Ti(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;f[a>>2]=1544;f[a+4>>2]=b;b=a+8|0;f[b>>2]=f[c>>2];f[b+4>>2]=f[c+4>>2];f[b+8>>2]=f[c+8>>2];f[b+12>>2]=f[c+12>>2];f[b+16>>2]=f[c+16>>2];f[b+20>>2]=f[c+20>>2];fk(a+32|0,c+24|0);f[a>>2]=2384;c=a+44|0;f[c>>2]=f[d>>2];f[c+4>>2]=f[d+4>>2];f[c+8>>2]=f[d+8>>2];f[c+12>>2]=f[d+12>>2];f[a>>2]=2440;d=a+112|0;c=a+60|0;b=c+52|0;do{f[c>>2]=0;c=c+4|0}while((c|0)<(b|0));Zm(d);f[a+152>>2]=0;f[a+156>>2]=0;f[a+160>>2]=0;return}function Ui(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;f[a>>2]=1544;f[a+4>>2]=b;b=a+8|0;f[b>>2]=f[c>>2];f[b+4>>2]=f[c+4>>2];f[b+8>>2]=f[c+8>>2];f[b+12>>2]=f[c+12>>2];f[b+16>>2]=f[c+16>>2];f[b+20>>2]=f[c+20>>2];fk(a+32|0,c+24|0);f[a>>2]=1964;c=a+44|0;f[c>>2]=f[d>>2];f[c+4>>2]=f[d+4>>2];f[c+8>>2]=f[d+8>>2];f[c+12>>2]=f[d+12>>2];f[a>>2]=2020;d=a+112|0;c=a+60|0;b=c+52|0;do{f[c>>2]=0;c=c+4|0}while((c|0)<(b|0));Zm(d);f[a+152>>2]=0;f[a+156>>2]=0;f[a+160>>2]=0;return}function Vi(a){a=a|0;var b=0,c=0,d=0;f[a>>2]=2440;b=f[a+152>>2]|0;if(b|0){c=a+156|0;d=f[c>>2]|0;if((d|0)!=(b|0))f[c>>2]=d+(~((d+-4-b|0)>>>2)<<2);Oq(b)}b=f[a+112>>2]|0;if(b|0){d=a+116|0;c=f[d>>2]|0;if((c|0)!=(b|0))f[d>>2]=c+(~((c+-4-b|0)>>>2)<<2);Oq(b)}b=f[a+96>>2]|0;if(b|0)Oq(b);b=f[a+84>>2]|0;if(b|0)Oq(b);b=f[a+72>>2]|0;if(b|0)Oq(b);b=f[a+60>>2]|0;if(b|0)Oq(b);f[a>>2]=1544;b=f[a+32>>2]|0;if(!b)return;c=a+36|0;a=f[c>>2]|0;if((a|0)!=(b|0))f[c>>2]=a+(~((a+-4-b|0)>>>2)<<2);Oq(b);return}function Wi(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0;d=u;u=u+16|0;e=d;g=f[(f[c+4>>2]|0)+4>>2]|0;if(!g){f[a>>2]=0;f[a+4>>2]=0;f[a+8>>2]=0;f[a+12>>2]=0;u=d;return}if(!(Dj(d+12|0,f[c+44>>2]|0,g)|0)){g=ln(32)|0;f[e>>2]=g;f[e+8>>2]=-2147483616;f[e+4>>2]=26;c=g;h=15859;i=c+26|0;do{b[c>>0]=b[h>>0]|0;c=c+1|0;h=h+1|0}while((c|0)<(i|0));b[g+26>>0]=0;f[a>>2]=-1;pj(a+4|0,e);if((b[e+11>>0]|0)<0)Oq(f[e>>2]|0)}else{f[a>>2]=0;f[a+4>>2]=0;f[a+8>>2]=0;f[a+12>>2]=0}u=d;return}function Xi(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0;c=b+48|0;if((mi(f[c>>2]|0)|0)>9){d=0;return d|0}if((Qa[f[(f[b>>2]|0)+8>>2]&127](b)|0)!=1){d=0;return d|0}e=b+4|0;b=(f[(f[(f[e>>2]|0)+8>>2]|0)+(a<<2)>>2]|0)+56|0;a=f[b>>2]|0;do if((a|0)==3)if((mi(f[c>>2]|0)|0)<4){d=5;return d|0}else{g=f[b>>2]|0;break}else g=a;while(0);a=mi(f[c>>2]|0)|0;if((g|0)==1){d=(a|0)<4?6:0;return d|0}if((a|0)>7){d=0;return d|0}if((mi(f[c>>2]|0)|0)>1){d=1;return d|0}else return ((f[(f[e>>2]|0)+80>>2]|0)>>>0<40?1:4)|0;return 0}function Yi(a){a=a|0;var b=0,c=0,d=0;f[a>>2]=2020;b=f[a+152>>2]|0;if(b|0){c=a+156|0;d=f[c>>2]|0;if((d|0)!=(b|0))f[c>>2]=d+(~((d+-4-b|0)>>>2)<<2);Oq(b)}b=f[a+112>>2]|0;if(b|0){d=a+116|0;c=f[d>>2]|0;if((c|0)!=(b|0))f[d>>2]=c+(~((c+-4-b|0)>>>2)<<2);Oq(b)}b=f[a+96>>2]|0;if(b|0)Oq(b);b=f[a+84>>2]|0;if(b|0)Oq(b);b=f[a+72>>2]|0;if(b|0)Oq(b);b=f[a+60>>2]|0;if(b|0)Oq(b);f[a>>2]=1544;b=f[a+32>>2]|0;if(!b)return;c=a+36|0;a=f[c>>2]|0;if((a|0)!=(b|0))f[c>>2]=a+(~((a+-4-b|0)>>>2)<<2);Oq(b);return}function Zi(a,c,d,e){a=a|0;c=c|0;d=d|0;e=e|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;g=u;u=u+128|0;h=g+124|0;i=g;j=i;k=6596;l=j+124|0;do{f[j>>2]=f[k>>2];j=j+4|0;k=k+4|0}while((j|0)<(l|0));if((c+-1|0)>>>0>2147483646)if(!c){m=h;n=1;o=4}else{h=Vq()|0;f[h>>2]=75;p=-1}else{m=a;n=c;o=4}if((o|0)==4){o=-2-m|0;c=n>>>0>o>>>0?o:n;f[i+48>>2]=c;n=i+20|0;f[n>>2]=m;f[i+44>>2]=m;o=m+c|0;m=i+16|0;f[m>>2]=o;f[i+28>>2]=o;o=Ah(i,d,e)|0;if(!c)p=o;else{c=f[n>>2]|0;b[c+(((c|0)==(f[m>>2]|0))<<31>>31)>>0]=0;p=o}}u=g;return p|0}function _i(a){a=a|0;var c=0,d=0,e=0,g=0;f[a>>2]=3480;c=a+72|0;d=a+136|0;e=a+4|0;g=e+64|0;do{f[e>>2]=0;e=e+4|0}while((e|0)<(g|0));e=c;g=e+64|0;do{f[e>>2]=0;e=e+4|0}while((e|0)<(g|0));n[d>>2]=$(1.0);d=a+140|0;f[d>>2]=0;f[d+4>>2]=0;f[d+8>>2]=0;f[d+12>>2]=0;f[d+16>>2]=0;f[d+20>>2]=0;f[a+164>>2]=-1;d=a+168|0;f[d>>2]=0;f[d+4>>2]=0;f[d+8>>2]=0;f[d+12>>2]=0;f[d+16>>2]=0;f[d+20>>2]=0;f[d+24>>2]=0;wn(a+200|0);Gn(a+232|0);d=a+264|0;f[d>>2]=0;f[d+4>>2]=0;f[d+8>>2]=0;f[d+12>>2]=0;f[d+16>>2]=0;f[d+20>>2]=0;b[d+24>>0]=0;return}function $i(a,c,d,e){a=a|0;c=c|0;d=d|0;e=+e;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;a=u;u=u+16|0;g=a;if(!c){h=0;u=a;return h|0}f[g>>2]=0;f[g+4>>2]=0;f[g+8>>2]=0;i=Gj(d)|0;if(i>>>0>4294967279)aq(g);if(i>>>0<11){b[g+11>>0]=i;if(!i)j=g;else{k=g;l=7}}else{m=i+16&-16;n=ln(m)|0;f[g>>2]=n;f[g+8>>2]=m|-2147483648;f[g+4>>2]=i;k=n;l=7}if((l|0)==7){kh(k|0,d|0,i|0)|0;j=k}b[j+i>>0]=0;Zl(c,g,e);if((b[g+11>>0]|0)<0)Oq(f[g>>2]|0);h=1;u=a;return h|0}function aj(a,c,d,e){a=a|0;c=c|0;d=d|0;e=e|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;a=u;u=u+16|0;g=a;if(!c){h=0;u=a;return h|0}f[g>>2]=0;f[g+4>>2]=0;f[g+8>>2]=0;i=Gj(d)|0;if(i>>>0>4294967279)aq(g);if(i>>>0<11){b[g+11>>0]=i;if(!i)j=g;else{k=g;l=7}}else{m=i+16&-16;n=ln(m)|0;f[g>>2]=n;f[g+8>>2]=m|-2147483648;f[g+4>>2]=i;k=n;l=7}if((l|0)==7){kh(k|0,d|0,i|0)|0;j=k}b[j+i>>0]=0;$l(c,g,e);if((b[g+11>>0]|0)<0)Oq(f[g>>2]|0);h=1;u=a;return h|0}function bj(a){a=a|0;var c=0,d=0,e=0,g=0,h=0;c=f[a+28>>2]|0;if(c|0){d=c;do{c=d;d=f[d>>2]|0;e=c+8|0;g=c+20|0;h=f[g>>2]|0;f[g>>2]=0;if(h|0){bj(h);Oq(h)}if((b[e+11>>0]|0)<0)Oq(f[e>>2]|0);Oq(c)}while((d|0)!=0)}d=a+20|0;c=f[d>>2]|0;f[d>>2]=0;if(c|0)Oq(c);c=f[a+8>>2]|0;if(c|0){d=c;do{c=d;d=f[d>>2]|0;e=c+8|0;h=f[c+20>>2]|0;if(h|0){g=c+24|0;if((f[g>>2]|0)!=(h|0))f[g>>2]=h;Oq(h)}if((b[e+11>>0]|0)<0)Oq(f[e>>2]|0);Oq(c)}while((d|0)!=0)}d=f[a>>2]|0;f[a>>2]=0;if(!d)return;Oq(d);return}function cj(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0;e=u;u=u+16|0;g=e;h=f[c+36>>2]|0;if(!h){i=ln(32)|0;f[g>>2]=i;f[g+8>>2]=-2147483616;f[g+4>>2]=23;j=i;k=15706;l=j+23|0;do{b[j>>0]=b[k>>0]|0;j=j+1|0;k=k+1|0}while((j|0)<(l|0));b[i+23>>0]=0;f[a>>2]=-1;pj(a+4|0,g);if((b[g+11>>0]|0)<0)Oq(f[g>>2]|0);u=e;return}g=f[c+40>>2]|0;if(!g){Sc(a,c,h,d);u=e;return}else{bi(a,c,g,d);u=e;return}}function dj(a){a=a|0;var b=0,c=0,d=0,e=0,g=0,h=0;tk(a);b=a+84|0;c=f[b>>2]|0;if((c|0)<=0)return;d=c<<5;e=Lq(c>>>0>134217727|d>>>0>4294967291?-1:d+4|0)|0;f[e>>2]=c;d=e+4|0;e=d+(c<<5)|0;c=d;do{wn(c);c=c+32|0}while((c|0)!=(e|0));e=a+80|0;a=f[e>>2]|0;f[e>>2]=d;if(a|0){d=a+-4|0;c=f[d>>2]|0;if(c|0){g=a+(c<<5)|0;do{g=g+-32|0;Fj(g)}while((g|0)!=(a|0))}Mq(d)}if((f[b>>2]|0)>0)h=0;else return;do{tk((f[e>>2]|0)+(h<<5)|0);h=h+1|0}while((h|0)<(f[b>>2]|0));return}function ej(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0;if(!b){d=0;return d|0}if(f[b+4>>2]|0){d=0;return d|0}a=ln(52)|0;Ub(a,c);f[a+40>>2]=0;f[a+44>>2]=0;f[a+48>>2]=0;c=b+4|0;b=f[c>>2]|0;f[c>>2]=a;if(!b){d=1;return d|0}a=b+40|0;c=f[a>>2]|0;if(c|0){e=b+44|0;g=f[e>>2]|0;if((g|0)==(c|0))h=c;else{i=g;do{g=i+-4|0;f[e>>2]=g;j=f[g>>2]|0;f[g>>2]=0;if(j|0){bj(j);Oq(j)}i=f[e>>2]|0}while((i|0)!=(c|0));h=f[a>>2]|0}Oq(h)}bj(b);Oq(b);d=1;return d|0}function fj(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0;c=f[a>>2]|0;if(b){b=c+8|0;d=b;e=Vn(f[d>>2]|0,f[d+4>>2]|0,1,0)|0;d=b;f[d>>2]=e;f[d+4>>2]=I;d=a+28|0;e=f[d>>2]|0;b=a+24|0;f[b>>2]=f[b>>2]|1<>2]|0,f[e+4>>2]|0,1,0)|0;e=c;f[e>>2]=d;f[e+4>>2]=I;e=a+28|0;g=e;h=f[e>>2]|0}e=h+1|0;f[g>>2]=e;if((e|0)!=32)return;e=a+24|0;h=a+16|0;d=f[h>>2]|0;if((d|0)==(f[a+20>>2]|0))Ri(a+12|0,e);else{f[d>>2]=f[e>>2];f[h>>2]=d+4}f[g>>2]=0;f[e>>2]=0;return}function gj(a,b){a=a|0;b=b|0;var c=0,d=0;c=a+32|0;a=f[b>>2]|0;f[b>>2]=0;b=f[c>>2]|0;f[c>>2]=a;if(!b)return;a=b+88|0;c=f[a>>2]|0;f[a>>2]=0;if(c|0){a=f[c+8>>2]|0;if(a|0){d=c+12|0;if((f[d>>2]|0)!=(a|0))f[d>>2]=a;Oq(a)}Oq(c)}c=f[b+68>>2]|0;if(c|0){a=b+72|0;d=f[a>>2]|0;if((d|0)!=(c|0))f[a>>2]=d+(~((d+-4-c|0)>>>2)<<2);Oq(c)}c=b+64|0;d=f[c>>2]|0;f[c>>2]=0;if(d|0){c=f[d>>2]|0;if(c|0){a=d+4|0;if((f[a>>2]|0)!=(c|0))f[a>>2]=c;Oq(c)}Oq(d)}Oq(b);return}function hj(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0;e=u;u=u+16|0;g=e;if(c|0){h=a+11|0;i=b[h>>0]|0;if(i<<24>>24<0){j=f[a+4>>2]|0;k=(f[a+8>>2]&2147483647)+-1|0}else{j=i&255;k=10}if((k-j|0)>>>0>>0){xj(a,k,c-k+j|0,j,j,0,0);l=b[h>>0]|0}else l=i;if(l<<24>>24<0)m=f[a>>2]|0;else m=a;Qn(m+j|0,c,d)|0;d=j+c|0;if((b[h>>0]|0)<0)f[a+4>>2]=d;else b[h>>0]=d;b[g>>0]=0;up(m+d|0,g)}u=e;return a|0}function ij(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0;d=u;u=u+48|0;e=d+4|0;g=d;h=f[b+12>>2]|0;i=f[b+4>>2]|0;b=e;j=b+36|0;do{f[b>>2]=0;b=b+4|0}while((b|0)<(j|0));zh(g,c,h,i,e);i=f[e+24>>2]|0;if(!i){k=f[g>>2]|0;f[a>>2]=k;u=d;return}h=e+28|0;e=f[h>>2]|0;if((e|0)!=(i|0))f[h>>2]=e+(~((e+-4-i|0)>>>2)<<2);Oq(i);k=f[g>>2]|0;f[a>>2]=k;u=d;return}function jj(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0;e=u;u=u+16|0;g=e;h=a+11|0;i=b[h>>0]|0;j=i<<24>>24<0;if(j)k=(f[a+8>>2]&2147483647)+-1|0;else k=10;do if(k>>>0>=d>>>0){if(j)l=f[a>>2]|0;else l=a;Eo(l,c,d)|0;b[g>>0]=0;up(l+d|0,g);if((b[h>>0]|0)<0){f[a+4>>2]=d;break}else{b[h>>0]=d;break}}else{if(j)m=f[a+4>>2]|0;else m=i&255;Bi(a,k,d-k|0,m,0,m,d,c)}while(0);u=e;return a|0}function kj(a){a=a|0;var b=0,c=0,d=0,e=0,g=0,h=0,i=0;b=f[a>>2]|0;if(!b)return;c=a+4|0;d=f[c>>2]|0;if((d|0)==(b|0))e=b;else{g=d;do{f[c>>2]=g+-136;d=f[g+-20>>2]|0;if(d|0){h=g+-16|0;i=f[h>>2]|0;if((i|0)!=(d|0))f[h>>2]=i+(~((i+-4-d|0)>>>2)<<2);Oq(d)}d=f[g+-32>>2]|0;if(d|0){i=g+-28|0;h=f[i>>2]|0;if((h|0)!=(d|0))f[i>>2]=h+(~((h+-4-d|0)>>>2)<<2);Oq(d)}Mi(g+-132|0);g=f[c>>2]|0}while((g|0)!=(b|0));e=f[a>>2]|0}Oq(e);return}function lj(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0;e=u;u=u+16|0;g=e;h=a+11|0;i=b[h>>0]|0;j=i<<24>>24<0;if(j){k=f[a+4>>2]|0;l=(f[a+8>>2]&2147483647)+-1|0}else{k=i&255;l=10}if((l-k|0)>>>0>=d>>>0){if(d|0){if(j)m=f[a>>2]|0;else m=a;Fo(m+k|0,c,d)|0;j=k+d|0;if((b[h>>0]|0)<0)f[a+4>>2]=j;else b[h>>0]=j;b[g>>0]=0;up(m+j|0,g)}}else Bi(a,l,d-l+k|0,k,k,0,d,c);u=e;return a|0}function mj(a){a=a|0;var b=0,c=0,d=0,e=0,g=0,h=0;f[a>>2]=3932;b=f[a+32>>2]|0;if(b|0){c=a+36|0;d=f[c>>2]|0;if((d|0)!=(b|0))f[c>>2]=d+(~((d+-4-b|0)>>>2)<<2);Oq(b)}b=f[a+20>>2]|0;if(b|0){d=a+24|0;c=f[d>>2]|0;if((c|0)!=(b|0))f[d>>2]=c+(~((c+-4-b|0)>>>2)<<2);Oq(b)}b=a+8|0;c=f[b>>2]|0;if(!c)return;d=a+12|0;a=f[d>>2]|0;if((a|0)==(c|0))e=c;else{g=a;do{a=g+-4|0;f[d>>2]=a;h=f[a>>2]|0;f[a>>2]=0;if(h|0)Va[f[(f[h>>2]|0)+4>>2]&127](h);g=f[d>>2]|0}while((g|0)!=(c|0));e=f[b>>2]|0}Oq(e);return}function nj(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0;c=a+4|0;if((Qa[f[(f[b>>2]|0)+20>>2]&127](b)|0)<=0){d=1;return d|0}a=0;while(1){e=f[(f[c>>2]|0)+4>>2]|0;g=dm(e,Ra[f[(f[b>>2]|0)+24>>2]&127](b,a)|0)|0;if((g|0)==-1){d=0;h=6;break}e=f[(f[b>>2]|0)+28>>2]|0;i=fl(f[c>>2]|0,g)|0;a=a+1|0;if(!(Ra[e&127](b,i)|0)){d=0;h=6;break}if((a|0)>=(Qa[f[(f[b>>2]|0)+20>>2]&127](b)|0)){d=1;h=6;break}}if((h|0)==6)return d|0;return 0}function oj(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0;if(!(ho(a,b,c)|0)){d=0;return d|0}if(!(Qa[f[(f[a>>2]|0)+52>>2]&127](a)|0)){d=0;return d|0}c=a+4|0;e=a+8|0;g=f[c>>2]|0;if((f[e>>2]|0)==(g|0)){d=1;return d|0}h=a+36|0;a=0;i=g;while(1){g=f[(f[h>>2]|0)+(a<<2)>>2]|0;if(!(Sa[f[(f[g>>2]|0)+8>>2]&31](g,b,f[i+(a<<2)>>2]|0)|0)){d=0;j=7;break}a=a+1|0;i=f[c>>2]|0;if(a>>>0>=(f[e>>2]|0)-i>>2>>>0){d=1;j=7;break}}if((j|0)==7)return d|0;return 0}function pj(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0;d=u;u=u+16|0;e=d;f[a>>2]=0;f[a+4>>2]=0;f[a+8>>2]=0;if((b[c+11>>0]|0)<0){g=f[c>>2]|0;h=f[c+4>>2]|0;if(h>>>0>4294967279)aq(a);if(h>>>0<11){b[a+11>>0]=h;i=a}else{j=h+16&-16;k=ln(j)|0;f[a>>2]=k;f[a+8>>2]=j|-2147483648;f[a+4>>2]=h;i=k}Fo(i,g,h)|0;b[e>>0]=0;up(i+h|0,e)}else{f[a>>2]=f[c>>2];f[a+4>>2]=f[c+4>>2];f[a+8>>2]=f[c+8>>2]}u=d;return}function qj(a,c,d,e,g){a=a|0;c=c|0;d=d|0;e=e|0;g=g|0;var h=0,i=0;b[c+53>>0]=1;do if((f[c+4>>2]|0)==(e|0)){b[c+52>>0]=1;a=c+16|0;h=f[a>>2]|0;if(!h){f[a>>2]=d;f[c+24>>2]=g;f[c+36>>2]=1;if(!((g|0)==1?(f[c+48>>2]|0)==1:0))break;b[c+54>>0]=1;break}if((h|0)!=(d|0)){h=c+36|0;f[h>>2]=(f[h>>2]|0)+1;b[c+54>>0]=1;break}h=c+24|0;a=f[h>>2]|0;if((a|0)==2){f[h>>2]=g;i=g}else i=a;if((i|0)==1?(f[c+48>>2]|0)==1:0)b[c+54>>0]=1}while(0);return}function rj(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0;c=a+36|0;d=a+40|0;e=f[c>>2]|0;if((f[d>>2]|0)!=(e|0)){g=0;h=e;do{vg(h+(g*24|0)|0,b)|0;g=g+1|0;h=f[c>>2]|0}while(g>>>0<(((f[d>>2]|0)-h|0)/24|0)>>>0)}h=a+48|0;d=a+52|0;a=f[h>>2]|0;if((f[d>>2]|0)==(a|0))return 1;else{i=0;j=a}do{a=f[j+(i<<2)>>2]|0;ci(a<<1^a>>31,b)|0;i=i+1|0;j=f[h>>2]|0}while(i>>>0<(f[d>>2]|0)-j>>2>>>0);return 1}function sj(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0;e=a+d|0;c=c&255;if((d|0)>=67){while(a&3){b[a>>0]=c;a=a+1|0}g=e&-4|0;h=g-64|0;i=c|c<<8|c<<16|c<<24;while((a|0)<=(h|0)){f[a>>2]=i;f[a+4>>2]=i;f[a+8>>2]=i;f[a+12>>2]=i;f[a+16>>2]=i;f[a+20>>2]=i;f[a+24>>2]=i;f[a+28>>2]=i;f[a+32>>2]=i;f[a+36>>2]=i;f[a+40>>2]=i;f[a+44>>2]=i;f[a+48>>2]=i;f[a+52>>2]=i;f[a+56>>2]=i;f[a+60>>2]=i;a=a+64|0}while((a|0)<(g|0)){f[a>>2]=i;a=a+4|0}}while((a|0)<(e|0)){b[a>>0]=c;a=a+1|0}return e-d|0}function tj(a,c,d,e,g){a=a|0;c=c|0;d=d|0;e=e|0;g=g|0;var h=0;do if(!(fp(a,f[c+8>>2]|0,g)|0)){if(fp(a,f[c>>2]|0,g)|0){if((f[c+16>>2]|0)!=(d|0)?(h=c+20|0,(f[h>>2]|0)!=(d|0)):0){f[c+32>>2]=e;f[h>>2]=d;h=c+40|0;f[h>>2]=(f[h>>2]|0)+1;if((f[c+36>>2]|0)==1?(f[c+24>>2]|0)==2:0)b[c+54>>0]=1;f[c+44>>2]=4;break}if((e|0)==1)f[c+32>>2]=1}}else Vm(0,c,d,e);while(0);return}function uj(a){a=a|0;var b=0,c=0,d=0,e=0;b=a+80|0;c=f[b>>2]|0;f[b>>2]=0;if(c|0){b=c+-4|0;d=f[b>>2]|0;if(d|0){e=c+(d<<5)|0;do{e=e+-32|0;Fj(e)}while((e|0)!=(c|0))}Mq(b)}b=f[a+68>>2]|0;if(b|0){c=a+72|0;e=f[c>>2]|0;if((e|0)!=(b|0))f[c>>2]=e+(~((e+-4-b|0)>>>2)<<2);Oq(b)}b=a+44|0;e=f[b>>2]|0;f[b>>2]=0;if(e|0)Oq(e);e=f[a+32>>2]|0;if(!e){Fj(a);return}b=a+36|0;if((f[b>>2]|0)!=(e|0))f[b>>2]=e;Oq(e);Fj(a);return}function vj(a){a=a|0;var b=0,c=0,d=0;f[a>>2]=3092;b=f[a+136>>2]|0;if(b|0){c=a+140|0;d=f[c>>2]|0;if((d|0)!=(b|0))f[c>>2]=d+(~((d+-4-b|0)>>>2)<<2);Oq(b)}b=f[a+96>>2]|0;if(b|0){d=a+100|0;c=f[d>>2]|0;if((c|0)!=(b|0))f[d>>2]=c+(~((c+-4-b|0)>>>2)<<2);Oq(b)}b=f[a+76>>2]|0;if(b|0)Oq(b);b=f[a+64>>2]|0;if(b|0)Oq(b);b=f[a+52>>2]|0;if(b|0)Oq(b);b=f[a+40>>2]|0;if(!b)return;Oq(b);return}function wj(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0;if((d|0)<0){e=0;return e|0}do if(!b){d=a+4|0;g=f[d>>2]|0;h=f[a>>2]|0;i=g-h|0;if(i>>>0>>0){Fi(a,c-i|0);break}if(i>>>0>c>>>0?(i=h+c|0,(i|0)!=(g|0)):0)f[d>>2]=i}else Cg(a,b,b+c|0);while(0);c=a+24|0;a=c;b=Vn(f[a>>2]|0,f[a+4>>2]|0,1,0)|0;a=c;f[a>>2]=b;f[a+4>>2]=I;e=1;return e|0}function xj(a,c,d,e,g,h,i){a=a|0;c=c|0;d=d|0;e=e|0;g=g|0;h=h|0;i=i|0;var j=0,k=0,l=0,m=0;if((-17-c|0)>>>0>>0)aq(a);if((b[a+11>>0]|0)<0)j=f[a>>2]|0;else j=a;if(c>>>0<2147483623){k=d+c|0;d=c<<1;l=k>>>0>>0?d:k;m=l>>>0<11?11:l+16&-16}else m=-17;l=ln(m)|0;if(g|0)Fo(l,j,g)|0;k=e-h-g|0;if(k|0)Fo(l+g+i|0,j+g+h|0,k)|0;if((c|0)!=10)Oq(j);f[a>>2]=l;f[a+8>>2]=m|-2147483648;return}function yj(a){a=a|0;var b=0,c=0,d=0;f[a>>2]=2728;b=f[a+136>>2]|0;if(b|0){c=a+140|0;d=f[c>>2]|0;if((d|0)!=(b|0))f[c>>2]=d+(~((d+-4-b|0)>>>2)<<2);Oq(b)}b=f[a+96>>2]|0;if(b|0){d=a+100|0;c=f[d>>2]|0;if((c|0)!=(b|0))f[d>>2]=c+(~((c+-4-b|0)>>>2)<<2);Oq(b)}b=f[a+76>>2]|0;if(b|0)Oq(b);b=f[a+64>>2]|0;if(b|0)Oq(b);b=f[a+52>>2]|0;if(b|0)Oq(b);b=f[a+40>>2]|0;if(!b)return;Oq(b);return}function zj(a,b){a=a|0;b=b|0;if(!b)return;else{zj(a,f[b>>2]|0);zj(a,f[b+4>>2]|0);Ej(b+20|0,f[b+24>>2]|0);Oq(b);return}}function Aj(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0;Yf(a,b,c);c=f[a+100>>2]|0;d=f[a+96>>2]|0;a=d;if((c|0)==(d|0))return;e=f[b>>2]|0;b=(c-d|0)/12|0;d=0;do{c=a+(d*12|0)|0;f[c>>2]=f[e+(f[c>>2]<<2)>>2];c=a+(d*12|0)+4|0;f[c>>2]=f[e+(f[c>>2]<<2)>>2];c=a+(d*12|0)+8|0;f[c>>2]=f[e+(f[c>>2]<<2)>>2];d=d+1|0}while(d>>>0>>0);return}function Bj(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0;d=a+64|0;if((f[d>>2]|0)==0?(e=ln(32)|0,yn(e),g=f[d>>2]|0,f[d>>2]=e,g|0):0){e=f[g>>2]|0;if(e|0){h=g+4|0;if((f[h>>2]|0)!=(e|0))f[h>>2]=e;Oq(e)}Oq(g)}g=Vl(f[a+28>>2]|0)|0;e=X(g,b[a+24>>0]|0)|0;g=((e|0)<0)<<31>>31;h=f[d>>2]|0;i=un(e|0,g|0,c|0,0)|0;if(!(wj(h,0,i,I)|0)){j=0;return j|0}Kk(a,f[d>>2]|0,e,g,0,0);f[a+80>>2]=c;j=1;return j|0}function Cj(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0;d=u;u=u+64|0;e=d;if(!(fp(a,b,0)|0))if((b|0)!=0?(g=Eh(b,1056,1040,0)|0,(g|0)!=0):0){b=e+4|0;h=b+52|0;do{f[b>>2]=0;b=b+4|0}while((b|0)<(h|0));f[e>>2]=g;f[e+8>>2]=a;f[e+12>>2]=-1;f[e+48>>2]=1;Ya[f[(f[g>>2]|0)+28>>2]&3](g,e,f[c>>2]|0,1);if((f[e+24>>2]|0)==1){f[c>>2]=f[e+16>>2];i=1}else i=0;j=i}else j=0;else j=1;u=d;return j|0}function Dj(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0;if(!c){d=0;return d|0}e=c+40|0;g=c+44|0;ci((f[g>>2]|0)-(f[e>>2]|0)>>2,b)|0;h=f[e>>2]|0;e=f[g>>2]|0;if((h|0)!=(e|0)){g=h;do{h=f[g>>2]|0;if(h|0){ci(f[h+40>>2]|0,b)|0;lg(a,b,h)|0}g=g+4|0}while((g|0)!=(e|0))}lg(a,b,c)|0;d=1;return d|0}function Ej(a,c){a=a|0;c=c|0;var d=0;if(!c)return;Ej(a,f[c>>2]|0);Ej(a,f[c+4>>2]|0);a=c+16|0;d=c+28|0;if((b[d+11>>0]|0)<0)Oq(f[d>>2]|0);if((b[a+11>>0]|0)<0)Oq(f[a>>2]|0);Oq(c);return}function Fj(a){a=a|0;var b=0,c=0,d=0,e=0,g=0,h=0;b=u;u=u+16|0;c=b;d=c;f[d>>2]=0;f[d+4>>2]=0;qf(a,2,c);c=f[a+12>>2]|0;d=a+16|0;e=f[d>>2]|0;if((e|0)==(c|0))g=c;else{h=e+(~((e+-4-c|0)>>>2)<<2)|0;f[d>>2]=h;g=h}f[a+24>>2]=0;f[a+28>>2]=0;if(c|0){if((g|0)!=(c|0))f[d>>2]=g+(~((g+-4-c|0)>>>2)<<2);Oq(c)}c=f[a>>2]|0;if(!c){u=b;return}g=a+4|0;a=f[g>>2]|0;if((a|0)!=(c|0))f[g>>2]=a+(~((a+-8-c|0)>>>3)<<3);Oq(c);u=b;return}function Gj(a){a=a|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0;c=a;a:do if(!(c&3)){d=a;e=4}else{g=a;h=c;while(1){if(!(b[g>>0]|0)){i=h;break a}j=g+1|0;h=j;if(!(h&3)){d=j;e=4;break}else g=j}}while(0);if((e|0)==4){e=d;while(1){k=f[e>>2]|0;if(!((k&-2139062144^-2139062144)&k+-16843009))e=e+4|0;else break}if(!((k&255)<<24>>24))l=e;else{k=e;while(1){e=k+1|0;if(!(b[e>>0]|0)){l=e;break}else k=e}}i=l}return i-c|0}function Hj(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0;e=u;u=u+16|0;g=e;h=a+11|0;i=b[h>>0]|0;j=i<<24>>24<0;if(j)k=f[a+4>>2]|0;else k=i&255;do if(k>>>0>=c>>>0)if(j){i=(f[a>>2]|0)+c|0;b[g>>0]=0;up(i,g);f[a+4>>2]=c;break}else{b[g>>0]=0;up(a+c|0,g);b[h>>0]=c;break}else hj(a,c-k|0,d)|0;while(0);u=e;return}function Ij(a){a=a|0;var b=0,c=0,d=0;if(!a)return;b=a+88|0;c=f[b>>2]|0;f[b>>2]=0;if(c|0){b=f[c+8>>2]|0;if(b|0){d=c+12|0;if((f[d>>2]|0)!=(b|0))f[d>>2]=b;Oq(b)}Oq(c)}c=f[a+68>>2]|0;if(c|0){b=a+72|0;d=f[b>>2]|0;if((d|0)!=(c|0))f[b>>2]=d+(~((d+-4-c|0)>>>2)<<2);Oq(c)}c=a+64|0;d=f[c>>2]|0;f[c>>2]=0;if(d|0){c=f[d>>2]|0;if(c|0){b=d+4|0;if((f[b>>2]|0)!=(c|0))f[b>>2]=c;Oq(c)}Oq(d)}Oq(a);return}function Jj(a,c,d,e,g,h,i,j,k,l){a=a|0;c=c|0;d=d|0;e=e|0;g=g|0;h=h|0;i=i|0;j=j|0;k=k|0;l=l|0;var m=0,n=0,o=0;f[a>>2]=d;if(d|0){m=d+16|0;n=f[m+4>>2]|0;o=a+8|0;f[o>>2]=f[m>>2];f[o+4>>2]=n;n=d+24|0;d=f[n+4>>2]|0;o=a+16|0;f[o>>2]=f[n>>2];f[o+4>>2]=d}b[a+24>>0]=e;f[a+28>>2]=g;b[a+32>>0]=h&1;h=a+40|0;f[h>>2]=i;f[h+4>>2]=j;j=a+48|0;f[j>>2]=k;f[j+4>>2]=l;f[a+56>>2]=c;return}function Kj(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0;c=ln(88)|0;d=c+60|0;e=c;g=e+60|0;do{f[e>>2]=0;e=e+4|0}while((e|0)<(g|0));f[d>>2]=c;d=c+64|0;f[d>>2]=0;f[d+4>>2]=0;f[d+8>>2]=0;f[d+12>>2]=0;f[d+16>>2]=0;f[d+20>>2]=0;d=cg(c,b)|0;f[a>>2]=d?c:0;a=d?0:c;if(d)return;Ii(a);Oq(a);return}function Lj(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0;if((f[c+76>>2]|0)>=0?(Tq(c)|0)!=0:0){d=a&255;e=a&255;if((e|0)!=(b[c+75>>0]|0)?(g=c+20|0,h=f[g>>2]|0,h>>>0<(f[c+16>>2]|0)>>>0):0){f[g>>2]=h+1;b[h>>0]=d;i=e}else i=Nj(c,a)|0;Sq(c);j=i}else k=3;do if((k|0)==3){i=a&255;e=a&255;if((e|0)!=(b[c+75>>0]|0)?(d=c+20|0,h=f[d>>2]|0,h>>>0<(f[c+16>>2]|0)>>>0):0){f[d>>2]=h+1;b[h>>0]=i;j=e;break}j=Nj(c,a)|0}while(0);return j|0}function Mj(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0;d=u;u=u+16|0;e=d+4|0;g=d;h=d+8|0;i=f[a+4>>2]|0;if((i|0)==-1){j=0;u=d;return j|0}b[h>>0]=i;i=c+16|0;a=f[i+4>>2]|0;if(!((a|0)>0|(a|0)==0&(f[i>>2]|0)>>>0>0)){f[g>>2]=f[c+4>>2];f[e>>2]=f[g>>2];Me(c,e,h,h+1|0)|0}j=1;u=d;return j|0}function Nj(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,i=0,j=0,k=0,l=0,m=0,n=0;d=u;u=u+16|0;e=d;g=c&255;b[e>>0]=g;i=a+16|0;j=f[i>>2]|0;if(!j)if(!(vl(a)|0)){k=f[i>>2]|0;l=4}else m=-1;else{k=j;l=4}do if((l|0)==4){j=a+20|0;i=f[j>>2]|0;if(i>>>0>>0?(n=c&255,(n|0)!=(b[a+75>>0]|0)):0){f[j>>2]=i+1;b[i>>0]=g;m=n;break}if((Sa[f[a+36>>2]&31](a,e,1)|0)==1)m=h[e>>0]|0;else m=-1}while(0);u=d;return m|0}function Oj(a,b){a=a|0;b=b|0;if(!b)return;else{Oj(a,f[b>>2]|0);Oj(a,f[b+4>>2]|0);Ej(b+20|0,f[b+24>>2]|0);Oq(b);return}}function Pj(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0;e=u;u=u+16|0;g=e;h=e+4|0;f[g>>2]=c;c=ln(32)|0;f[h>>2]=c;f[h+8>>2]=-2147483616;f[h+4>>2]=17;i=c;j=14495;k=i+17|0;do{b[i>>0]=b[j>>0]|0;i=i+1|0;j=j+1|0}while((i|0)<(k|0));b[c+17>>0]=0;Xj(Hd(a,g)|0,h,d);if((b[h+11>>0]|0)>=0){u=e;return}Oq(f[h>>2]|0);u=e;return}function Qj(a,b){a=a|0;b=b|0;var c=0,d=0,e=0;c=f[a+16>>2]|0;if(((f[a+20>>2]|0)-c>>2|0)<=(b|0)){d=0;return d|0}e=f[c+(b<<2)>>2]|0;if((e|0)<0){d=0;return d|0}b=a+48|0;if((f[a+52>>2]|0)>>>0<=e>>>0)Ce(b,e+1|0,0);c=(f[b>>2]|0)+(e>>>5<<2)|0;f[c>>2]=f[c>>2]|1<<(e&31);c=f[a+36>>2]|0;if((f[a+40>>2]|0)-c>>2>>>0<=e>>>0){d=1;return d|0}Bp(f[c+(e<<2)>>2]|0);d=1;return d|0}function Rj(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0;if(c>>>0>0|(c|0)==0&a>>>0>4294967295){e=d;f=a;g=c;while(1){c=hn(f|0,g|0,10,0)|0;e=e+-1|0;b[e>>0]=c&255|48;c=f;f=jp(f|0,g|0,10,0)|0;if(!(g>>>0>9|(g|0)==9&c>>>0>4294967295))break;else g=I}h=f;i=e}else{h=a;i=d}if(!h)j=i;else{d=h;h=i;while(1){i=h+-1|0;b[i>>0]=(d>>>0)%10|0|48;if(d>>>0<10){j=i;break}else{d=(d>>>0)/10|0;h=i}}}return j|0}function Sj(a){a=a|0;var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0;c=a;while(1){d=c+1|0;if(!(eq(b[c>>0]|0)|0))break;else c=d}a=b[c>>0]|0;switch(a<<24>>24|0){case 45:{e=1;f=5;break}case 43:{e=0;f=5;break}default:{g=0;h=c;i=a}}if((f|0)==5){g=e;h=d;i=b[d>>0]|0}if(!(Aq(i<<24>>24)|0))j=0;else{i=0;d=h;while(1){h=(i*10|0)+48-(b[d>>0]|0)|0;d=d+1|0;if(!(Aq(b[d>>0]|0)|0)){j=h;break}else i=h}}return (g|0?j:0-j|0)|0}function Tj(a,c,d){a=a|0;c=c|0;d=$(d);var e=0,g=0,h=0;e=u;u=u+16|0;g=e;il(g,d);h=Ai(a,c)|0;c=h+11|0;if((b[c>>0]|0)<0){b[f[h>>2]>>0]=0;f[h+4>>2]=0}else{b[h>>0]=0;b[c>>0]=0}gh(h,0);f[h>>2]=f[g>>2];f[h+4>>2]=f[g+4>>2];f[h+8>>2]=f[g+8>>2];u=e;return}function Uj(a){a=a|0;var b=0,c=0,d=0,e=0,g=0,h=0;b=u;u=u+16|0;c=b+8|0;d=b+4|0;e=b;f[e>>2]=f[(f[a+4>>2]|0)+80>>2];g=f[a+44>>2]|0;a=g+16|0;h=f[a+4>>2]|0;if((h|0)>0|(h|0)==0&(f[a>>2]|0)>>>0>0){u=b;return 1}f[d>>2]=f[g+4>>2];f[c>>2]=f[d>>2];Me(g,c,e,e+4|0)|0;u=b;return 1}function Vj(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0;e=u;u=u+16|0;g=e;ll(g,d&1);d=Ai(a,c)|0;c=d+11|0;if((b[c>>0]|0)<0){b[f[d>>2]>>0]=0;f[d+4>>2]=0}else{b[d>>0]=0;b[c>>0]=0}gh(d,0);f[d>>2]=f[g>>2];f[d+4>>2]=f[g+4>>2];f[d+8>>2]=f[g+8>>2];u=e;return}function Wj(a){a=a|0;if(!a)return;Ej(a+24|0,f[a+28>>2]|0);zj(a+12|0,f[a+16>>2]|0);Ej(a,f[a+4>>2]|0);Oq(a);return}function Xj(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0;e=u;u=u+16|0;g=e;ll(g,d);d=Ai(a,c)|0;c=d+11|0;if((b[c>>0]|0)<0){b[f[d>>2]>>0]=0;f[d+4>>2]=0}else{b[d>>0]=0;b[c>>0]=0}gh(d,0);f[d>>2]=f[g>>2];f[d+4>>2]=f[g+4>>2];f[d+8>>2]=f[g+8>>2];u=e;return}function Yj(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0;e=Rg(a,c)|0;if((e|0)==(a+4|0)){g=-1;h=(g|0)==-1;i=(g|0)!=0;j=h?d:i;return j|0}a=e+28|0;if((b[a+11>>0]|0)<0)k=f[a>>2]|0;else k=a;g=Sj(k)|0;h=(g|0)==-1;i=(g|0)!=0;j=h?d:i;return j|0}function Zj(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0;d=u;u=u+16|0;e=d;if(c>>>0>10){g=0;u=d;return g|0}h=ln(48)|0;f[e>>2]=h;f[e+8>>2]=-2147483600;f[e+4>>2]=33;i=h;j=15987;k=i+33|0;do{b[i>>0]=b[j>>0]|0;i=i+1|0;j=j+1|0}while((i|0)<(k|0));b[h+33>>0]=0;Xj(a,e,c);if((b[e+11>>0]|0)<0)Oq(f[e>>2]|0);g=1;u=d;return g|0}function _j(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0;c=f[b>>2]|0;if((c|0)==-1)return 1;b=c*3|0;if((b|0)==-1)return 1;c=f[a>>2]|0;a=f[c+(b<<2)>>2]|0;d=b+1|0;e=((d>>>0)%3|0|0)==0?b+-2|0:d;if((e|0)==-1)g=-1;else g=f[c+(e<<2)>>2]|0;e=(((b>>>0)%3|0|0)==0?2:-1)+b|0;if((e|0)==-1)h=-1;else h=f[c+(e<<2)>>2]|0;if((a|0)==(g|0))return 1;else return (a|0)==(h|0)|(g|0)==(h|0)|0;return 0}function $j(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,i=0,j=0,k=0;d=0;while(1){if((h[16654+d>>0]|0)==(a|0)){e=2;break}g=d+1|0;if((g|0)==87){i=16742;j=87;e=5;break}else d=g}if((e|0)==2)if(!d)k=16742;else{i=16742;j=d;e=5}if((e|0)==5)while(1){e=0;d=i;do{a=d;d=d+1|0}while((b[a>>0]|0)!=0);j=j+-1|0;if(!j){k=d;break}else{i=d;e=5}}return jq(k,f[c+20>>2]|0)|0}function ak(a,b){a=+a;b=b|0;var c=0,d=0,e=0,g=0.0,h=0.0,i=0,j=0.0;p[s>>3]=a;c=f[s>>2]|0;d=f[s+4>>2]|0;e=Yn(c|0,d|0,52)|0;switch(e&2047){case 0:{if(a!=0.0){g=+ak(a*18446744073709551616.0,b);h=g;i=(f[b>>2]|0)+-64|0}else{h=a;i=0}f[b>>2]=i;j=h;break}case 2047:{j=a;break}default:{f[b>>2]=(e&2047)+-1022;f[s>>2]=c;f[s+4>>2]=d&-2146435073|1071644672;j=+p[s>>3]}}return +j}function bk(a,b){a=+a;b=b|0;var c=0.0,d=0,e=0,g=0.0,h=0;if((b|0)<=1023)if((b|0)<-1022){c=a*2.2250738585072014e-308;d=(b|0)<-2044;e=b+2044|0;g=d?c*2.2250738585072014e-308:c;h=d?((e|0)>-1022?e:-1022):b+1022|0}else{g=a;h=b}else{c=a*8988465674311579538646525.0e283;e=(b|0)>2046;d=b+-2046|0;g=e?c*8988465674311579538646525.0e283:c;h=e?((d|0)<1023?d:1023):b+-1023|0}b=Tn(h+1023|0,0,52)|0;h=I;f[s>>2]=b;f[s+4>>2]=h;return +(g*+p[s>>3])}function ck(a){a=a|0;var b=0,c=0,d=0,e=0,g=0,h=0;if(!(f[a+80>>2]|0)){b=0;return b|0}c=a+8|0;d=a+12|0;a=f[c>>2]|0;if(((f[d>>2]|0)-a|0)>0){e=0;g=a}else{b=1;return b|0}while(1){a=f[g+(e<<2)>>2]|0;e=e+1|0;if(!(Gl(a,a)|0)){b=0;h=5;break}g=f[c>>2]|0;if((e|0)>=((f[d>>2]|0)-g>>2|0)){b=1;h=5;break}}if((h|0)==5)return b|0;return 0}function dk(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0;c=a+36|0;d=a+40|0;e=f[c>>2]|0;if((f[d>>2]|0)==(e|0)){g=1;return g|0}h=a+60|0;a=0;i=e;while(1){e=f[i+(a<<2)>>2]|0;a=a+1|0;if(!(Sa[f[(f[e>>2]|0)+20>>2]&31](e,h,b)|0)){g=0;j=5;break}i=f[c>>2]|0;if(a>>>0>=(f[d>>2]|0)-i>>2>>>0){g=1;j=5;break}}if((j|0)==5)return g|0;return 0}function ek(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0;c=a+36|0;d=a+40|0;a=f[c>>2]|0;if((f[d>>2]|0)==(a|0)){e=1;return e|0}else{g=0;h=a}while(1){a=f[h+(g<<2)>>2]|0;g=g+1|0;if(!(Ra[f[(f[a>>2]|0)+24>>2]&127](a,b)|0)){e=0;i=4;break}h=f[c>>2]|0;if(g>>>0>=(f[d>>2]|0)-h>>2>>>0){e=1;i=4;break}}if((i|0)==4)return e|0;return 0}function fk(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0;f[a>>2]=0;c=a+4|0;f[c>>2]=0;f[a+8>>2]=0;d=b+4|0;e=(f[d>>2]|0)-(f[b>>2]|0)|0;g=e>>2;if(!g)return;if(g>>>0>1073741823)aq(a);h=ln(e)|0;f[c>>2]=h;f[a>>2]=h;f[a+8>>2]=h+(g<<2);g=f[b>>2]|0;b=(f[d>>2]|0)-g|0;if((b|0)<=0)return;kh(h|0,g|0,b|0)|0;f[c>>2]=h+(b>>>2<<2);return}function gk(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0;c=a+8|0;d=f[a>>2]|0;if((f[c>>2]|0)-d>>2>>>0>=b>>>0)return;e=a+4|0;if(b>>>0>1073741823){g=ra(8)|0;Oo(g,16035);f[g>>2]=7256;va(g|0,1112,110)}g=(f[e>>2]|0)-d|0;h=ln(b<<2)|0;if((g|0)>0)kh(h|0,d|0,g|0)|0;f[a>>2]=h;f[e>>2]=h+(g>>2<<2);f[c>>2]=h+(b<<2);if(!d)return;Oq(d);return}function hk(a){a=a|0;var b=0,c=0,d=0,e=0,g=0,h=0,i=0;b=a+36|0;c=a+40|0;d=f[b>>2]|0;if((f[c>>2]|0)==(d|0)){e=1;return e|0}g=a+60|0;a=0;h=d;while(1){d=f[h+(a<<2)>>2]|0;a=a+1|0;if(!(Ra[f[(f[d>>2]|0)+16>>2]&127](d,g)|0)){e=0;i=5;break}h=f[b>>2]|0;if(a>>>0>=(f[c>>2]|0)-h>>2>>>0){e=1;i=5;break}}if((i|0)==5)return e|0;return 0}function ik(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0;d=f[a+176>>2]|0;e=f[a+172>>2]|0;a=e;if((d|0)==(e|0))return 0;g=(d-e|0)/136|0;e=0;while(1){if((f[a+(e*136|0)>>2]|0)==(c|0)){h=4;break}d=e+1|0;if(d>>>0>>0)e=d;else{h=6;break}}if((h|0)==4)return ((b[a+(e*136|0)+100>>0]|0)==0?0:a+(e*136|0)+4|0)|0;else if((h|0)==6)return 0;return 0}function jk(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0;d=u;u=u+16|0;e=d;g=ln(16)|0;f[e>>2]=g;f[e+8>>2]=-2147483632;f[e+4>>2]=15;h=g;i=14479;j=h+15|0;do{b[h>>0]=b[i>>0]|0;h=h+1|0;i=i+1|0}while((h|0)<(j|0));b[g+15>>0]=0;Xj(a,e,c);if((b[e+11>>0]|0)>=0){u=d;return}Oq(f[e>>2]|0);u=d;return}function kk(a,b){a=a|0;b=b|0;var c=0,d=0;c=f[a+72>>2]|0;if(!c){d=0;return d|0}f[c+4>>2]=a+60;if(!(Qa[f[(f[c>>2]|0)+12>>2]&127](c)|0)){d=0;return d|0}if(!(Qa[f[(f[a>>2]|0)+40>>2]&127](a)|0)){d=0;return d|0}if(!(Ra[f[(f[a>>2]|0)+44>>2]&127](a,b)|0)){d=0;return d|0}d=Ra[f[(f[a>>2]|0)+48>>2]&127](a,b)|0;return d|0}function lk(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0;f[a>>2]=0;d=a+4|0;f[d>>2]=0;f[a+8>>2]=0;if(!b)return;if(b>>>0>357913941)aq(a);e=ln(b*12|0)|0;f[d>>2]=e;f[a>>2]=e;f[a+8>>2]=e+(b*12|0);a=b;b=e;do{fk(b,c);b=(f[d>>2]|0)+12|0;f[d>>2]=b;a=a+-1|0}while((a|0)!=0);return}function mk(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0;c=f[b>>2]|0;if(!c){d=0;return d|0}e=a+44|0;g=f[e>>2]|0;if(g>>>0<(f[a+48>>2]|0)>>>0){f[b>>2]=0;f[g>>2]=c;f[e>>2]=(f[e>>2]|0)+4;d=1;return d|0}else{Ug(a+40|0,b);d=1;return d|0}return 0}function nk(a){a=a|0;var b=0,c=0,d=0;f[a>>2]=3564;b=f[a+64>>2]|0;if(b|0){c=a+68|0;d=f[c>>2]|0;if((d|0)!=(b|0))f[c>>2]=d+(~((d+-4-b|0)>>>2)<<2);Oq(b)}f[a+12>>2]=3588;b=f[a+32>>2]|0;if(b|0)Oq(b);b=f[a+20>>2]|0;if(!b){Oq(a);return}Oq(b);Oq(a);return}function ok(a){a=a|0;var b=0,c=0,d=0;f[a>>2]=3344;f[a+40>>2]=1196;b=f[a+48>>2]|0;if(b|0){c=a+52|0;d=f[c>>2]|0;if((d|0)!=(b|0))f[c>>2]=d+(~((d+-4-b|0)>>>2)<<2);Oq(b)}f[a>>2]=1476;b=a+36|0;d=f[b>>2]|0;f[b>>2]=0;if(!d){Ni(a);Oq(a);return}Va[f[(f[d>>2]|0)+4>>2]&127](d);Ni(a);Oq(a);return}function pk(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,i=0;f[c>>2]=2;d=a+4|0;a=c+8|0;e=f[a>>2]|0;g=(f[c+12>>2]|0)-e|0;if(g>>>0<4294967292){Lk(a,g+4|0,0);i=f[a>>2]|0}else i=e;e=i+g|0;g=h[d>>0]|h[d+1>>0]<<8|h[d+2>>0]<<16|h[d+3>>0]<<24;b[e>>0]=g;b[e+1>>0]=g>>8;b[e+2>>0]=g>>16;b[e+3>>0]=g>>24;return}function qk(a){a=a|0;var b=0,c=0,d=0;f[a>>2]=3612;b=f[a+64>>2]|0;if(b|0){c=a+68|0;d=f[c>>2]|0;if((d|0)!=(b|0))f[c>>2]=d+(~((d+-4-b|0)>>>2)<<2);Oq(b)}f[a+12>>2]=3636;b=f[a+32>>2]|0;if(b|0)Oq(b);b=f[a+20>>2]|0;if(!b){Oq(a);return}Oq(b);Oq(a);return}function rk(a){a=a|0;var b=0,c=0,d=0;f[a>>2]=2188;b=f[a+76>>2]|0;if(b|0)Oq(b);b=a+68|0;c=f[b>>2]|0;f[b>>2]=0;if(c|0)Mq(c);f[a>>2]=1544;c=f[a+32>>2]|0;if(!c){Oq(a);return}b=a+36|0;d=f[b>>2]|0;if((d|0)!=(c|0))f[b>>2]=d+(~((d+-4-c|0)>>>2)<<2);Oq(c);Oq(a);return}function sk(a,c,d){a=a|0;c=c|0;d=$(d);var e=0,g=Oa,h=0;e=Rg(a,c)|0;if((e|0)==(a+4|0)){g=d;return $(g)}a=e+28|0;if((b[a+11>>0]|0)<0)h=f[a>>2]|0;else h=a;g=$(+Iq(h));return $(g)}function tk(a){a=a|0;var b=0,c=0,d=0,e=0,g=0,h=0;b=u;u=u+16|0;c=b;d=c;f[d>>2]=0;f[d+4>>2]=0;qf(a,2,c);c=f[a+12>>2]|0;d=a+16|0;e=f[d>>2]|0;if((e|0)==(c|0)){g=a+24|0;f[g>>2]=0;h=a+28|0;f[h>>2]=0;u=b;return}f[d>>2]=e+(~((e+-4-c|0)>>>2)<<2);g=a+24|0;f[g>>2]=0;h=a+28|0;f[h>>2]=0;u=b;return}function uk(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0;c=f[a+176>>2]|0;d=f[a+172>>2]|0;e=d;a:do if((c|0)!=(d|0)){g=(c-d|0)/136|0;h=0;while(1){if((f[e+(h*136|0)>>2]|0)==(b|0))break;i=h+1|0;if(i>>>0>>0)h=i;else break a}j=e+(h*136|0)+104|0;return j|0}while(0);j=a+40|0;return j|0}function vk(a){a=a|0;var b=0,c=0,d=0;f[a>>2]=3564;b=f[a+64>>2]|0;if(b|0){c=a+68|0;d=f[c>>2]|0;if((d|0)!=(b|0))f[c>>2]=d+(~((d+-4-b|0)>>>2)<<2);Oq(b)}f[a+12>>2]=3588;b=f[a+32>>2]|0;if(b|0)Oq(b);b=f[a+20>>2]|0;if(!b)return;Oq(b);return}function wk(a){a=a|0;var b=0,c=0,d=0;f[a>>2]=1768;b=f[a+76>>2]|0;if(b|0)Oq(b);b=a+68|0;c=f[b>>2]|0;f[b>>2]=0;if(c|0)Mq(c);f[a>>2]=1544;c=f[a+32>>2]|0;if(!c){Oq(a);return}b=a+36|0;d=f[b>>2]|0;if((d|0)!=(c|0))f[b>>2]=d+(~((d+-4-c|0)>>>2)<<2);Oq(c);Oq(a);return}function xk(a){a=a|0;var b=0,c=0,d=0;f[a>>2]=3344;f[a+40>>2]=1196;b=f[a+48>>2]|0;if(b|0){c=a+52|0;d=f[c>>2]|0;if((d|0)!=(b|0))f[c>>2]=d+(~((d+-4-b|0)>>>2)<<2);Oq(b)}f[a>>2]=1476;b=a+36|0;d=f[b>>2]|0;f[b>>2]=0;if(!d){Ni(a);return}Va[f[(f[d>>2]|0)+4>>2]&127](d);Ni(a);return}function yk(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0;Nc(a,b);if((b|0)<=-1)return;c=a+88|0;d=f[c>>2]|0;e=f[a+84>>2]|0;if((d-e>>2|0)<=(b|0))return;a=e+(b<<2)|0;b=a+4|0;e=d-b|0;g=e>>2;if(!g)h=d;else{im(a|0,b|0,e|0)|0;h=f[c>>2]|0}e=a+(g<<2)|0;if((h|0)==(e|0))return;f[c>>2]=h+(~((h+-4-e|0)>>>2)<<2);return}function zk(a){a=a|0;var b=0,c=0,d=0,e=0,g=0,h=0;b=f[a+32>>2]|0;c=f[a+36>>2]|0;if((b|0)==(c|0)){d=1;return d|0}e=a+8|0;g=a+44|0;a=b;while(1){b=f[(f[e>>2]|0)+(f[a>>2]<<2)>>2]|0;a=a+4|0;if(!(Ra[f[(f[b>>2]|0)+20>>2]&127](b,f[g>>2]|0)|0)){d=0;h=5;break}if((a|0)==(c|0)){d=1;h=5;break}}if((h|0)==5)return d|0;return 0}function Ak(a){a=a|0;var b=0,c=0,d=0;f[a>>2]=3612;b=f[a+64>>2]|0;if(b|0){c=a+68|0;d=f[c>>2]|0;if((d|0)!=(b|0))f[c>>2]=d+(~((d+-4-b|0)>>>2)<<2);Oq(b)}f[a+12>>2]=3636;b=f[a+32>>2]|0;if(b|0)Oq(b);b=f[a+20>>2]|0;if(!b)return;Oq(b);return}function Bk(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0.0;d=u;u=u+128|0;e=d;g=e;h=g+124|0;do{f[g>>2]=0;g=g+4|0}while((g|0)<(h|0));g=e+4|0;f[g>>2]=a;h=e+8|0;f[h>>2]=-1;f[e+44>>2]=a;f[e+76>>2]=-1;Ym(e,0);i=+Rc(e,c,1);c=(f[g>>2]|0)-(f[h>>2]|0)+(f[e+108>>2]|0)|0;if(b|0)f[b>>2]=c|0?a+c|0:a;u=d;return +i}function Ck(a,c,d,e){a=a|0;c=c|0;d=d|0;e=e|0;var g=0,h=0;a=c+16|0;g=f[a>>2]|0;do if(g){if((g|0)!=(d|0)){h=c+36|0;f[h>>2]=(f[h>>2]|0)+1;f[c+24>>2]=2;b[c+54>>0]=1;break}h=c+24|0;if((f[h>>2]|0)==2)f[h>>2]=e}else{f[a>>2]=d;f[c+24>>2]=e;f[c+36>>2]=1}while(0);return}function Dk(a){a=a|0;var b=0,c=0;f[a>>2]=2188;b=f[a+76>>2]|0;if(b|0)Oq(b);b=a+68|0;c=f[b>>2]|0;f[b>>2]=0;if(c|0)Mq(c);f[a>>2]=1544;c=f[a+32>>2]|0;if(!c)return;b=a+36|0;a=f[b>>2]|0;if((a|0)!=(c|0))f[b>>2]=a+(~((a+-4-c|0)>>>2)<<2);Oq(c);return}function Ek(a){a=a|0;var c=0,d=0,e=0;c=a+74|0;d=b[c>>0]|0;b[c>>0]=d+255|d;d=a+20|0;c=a+28|0;if((f[d>>2]|0)>>>0>(f[c>>2]|0)>>>0)Sa[f[a+36>>2]&31](a,0,0)|0;f[a+16>>2]=0;f[c>>2]=0;f[d>>2]=0;d=f[a>>2]|0;if(!(d&4)){c=(f[a+44>>2]|0)+(f[a+48>>2]|0)|0;f[a+8>>2]=c;f[a+4>>2]=c;e=d<<27>>31}else{f[a>>2]=d|32;e=-1}return e|0}function Fk(a,c){a=a|0;c=c|0;var d=0,e=0,g=0;d=Rg(a,c)|0;if((d|0)==(a+4|0)){e=0;return e|0}a=d+28|0;if((b[a+11>>0]|0)<0)g=f[a>>2]|0;else g=a;e=((Sj(g)|0)+1|0)>>>0>1;return e|0}function Gk(a){a=a|0;var b=0,c=0,d=0;f[a>>2]=6152;b=f[a+96>>2]|0;if(b|0){c=a+100|0;d=f[c>>2]|0;if((d|0)!=(b|0))f[c>>2]=d+(~(((d+-12-b|0)>>>0)/12|0)*12|0);Oq(b)}b=f[a+84>>2]|0;if(!b){Og(a);Oq(a);return}d=a+88|0;c=f[d>>2]|0;if((c|0)!=(b|0))f[d>>2]=c+(~((c+-4-b|0)>>>2)<<2);Oq(b);Og(a);Oq(a);return}function Hk(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,h=0;e=Rg(a,c)|0;if((e|0)==(a+4|0)){g=d;return g|0}d=e+28|0;if((b[d+11>>0]|0)<0)h=f[d>>2]|0;else h=d;g=Sj(h)|0;return g|0}function Ik(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,f=0,g=0,h=0,i=0;e=b>>31|((b|0)<0?-1:0)<<1;f=((b|0)<0?-1:0)>>31|((b|0)<0?-1:0)<<1;g=d>>31|((d|0)<0?-1:0)<<1;h=((d|0)<0?-1:0)>>31|((d|0)<0?-1:0)<<1;i=Xn(e^a|0,f^b|0,e|0,f|0)|0;b=I;a=g^e;e=h^f;return Xn((Ld(i,b,Xn(g^c|0,h^d|0,g|0,h|0)|0,I,0)|0)^a|0,I^e|0,a|0,e|0)|0}function Jk(a){a=a|0;var b=0,c=0;f[a>>2]=1768;b=f[a+76>>2]|0;if(b|0)Oq(b);b=a+68|0;c=f[b>>2]|0;f[b>>2]=0;if(c|0)Mq(c);f[a>>2]=1544;c=f[a+32>>2]|0;if(!c)return;b=a+36|0;a=f[b>>2]|0;if((a|0)!=(c|0))f[b>>2]=a+(~((a+-4-c|0)>>>2)<<2);Oq(c);return}function Kk(a,b,c,d,e,g){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;g=g|0;var h=0,i=0,j=0;f[a>>2]=b;h=b+16|0;i=f[h+4>>2]|0;j=a+8|0;f[j>>2]=f[h>>2];f[j+4>>2]=i;i=b+24|0;b=f[i+4>>2]|0;j=a+16|0;f[j>>2]=f[i>>2];f[j+4>>2]=b;b=a+40|0;f[b>>2]=c;f[b+4>>2]=d;d=a+48|0;f[d>>2]=e;f[d+4>>2]=g;return}function Lk(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0;c=a+4|0;d=f[c>>2]|0;e=f[a>>2]|0;g=d-e|0;h=e;e=d;if(g>>>0>=b>>>0){if(g>>>0>b>>>0?(d=h+b|0,(d|0)!=(e|0)):0)f[c>>2]=d}else Fi(a,b-g|0);g=a+24|0;a=g;b=Vn(f[a>>2]|0,f[a+4>>2]|0,1,0)|0;a=g;f[a>>2]=b;f[a+4>>2]=I;return}function Mk(a,c){a=a|0;c=c|0;var d=0,e=0,g=0;d=Rg(a,c)|0;if((d|0)==(a+4|0)){e=-1;return e|0}a=d+28|0;if((b[a+11>>0]|0)<0)g=f[a>>2]|0;else g=a;e=Sj(g)|0;return e|0}function Nk(a){a=a|0;var b=0,c=0,d=0;f[a>>2]=6152;b=f[a+96>>2]|0;if(b|0){c=a+100|0;d=f[c>>2]|0;if((d|0)!=(b|0))f[c>>2]=d+(~(((d+-12-b|0)>>>0)/12|0)*12|0);Oq(b)}b=f[a+84>>2]|0;if(!b){Og(a);return}d=a+88|0;c=f[d>>2]|0;if((c|0)!=(b|0))f[d>>2]=c+(~((c+-4-b|0)>>>2)<<2);Oq(b);Og(a);return}function Ok(a){a=a|0;var c=0,d=0,e=0;f[a>>2]=0;f[a+4>>2]=0;f[a+8>>2]=0;f[a+12>>2]=0;f[a+16>>2]=0;f[a+20>>2]=0;b[a+24>>0]=1;c=a+68|0;d=a+28|0;e=d+40|0;do{f[d>>2]=0;d=d+4|0}while((d|0)<(e|0));f[c>>2]=a;c=a+72|0;f[c>>2]=0;f[c+4>>2]=0;f[c+8>>2]=0;f[c+12>>2]=0;f[c+16>>2]=0;f[c+20>>2]=0;return}function Pk(a){a=a|0;var b=0,c=0,d=0;f[a>>2]=2244;b=f[a+76>>2]|0;if(b|0)Oq(b);f[a>>2]=1544;b=f[a+32>>2]|0;if(!b){Oq(a);return}c=a+36|0;d=f[c>>2]|0;if((d|0)!=(b|0))f[c>>2]=d+(~((d+-4-b|0)>>>2)<<2);Oq(b);Oq(a);return}function Qk(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;var f=0,g=0,h=0;f=u;u=u+256|0;g=f;if((c|0)>(d|0)&(e&73728|0)==0){e=c-d|0;sj(g|0,b<<24>>24|0,(e>>>0<256?e:256)|0)|0;if(e>>>0>255){b=c-d|0;d=e;do{Xo(a,g,256);d=d+-256|0}while(d>>>0>255);h=b&255}else h=e;Xo(a,g,h)}u=f;return}function Rk(a){a=a|0;var b=0,c=0,d=0;f[a>>2]=1824;b=f[a+76>>2]|0;if(b|0)Oq(b);f[a>>2]=1544;b=f[a+32>>2]|0;if(!b){Oq(a);return}c=a+36|0;d=f[c>>2]|0;if((d|0)!=(b|0))f[c>>2]=d+(~((d+-4-b|0)>>>2)<<2);Oq(b);Oq(a);return}function Sk(a,b,c,d,e,g){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;g=g|0;var h=0;if(fp(a,f[b+8>>2]|0,g)|0)qj(0,b,c,d,e);else{h=f[a+8>>2]|0;_a[f[(f[h>>2]|0)+20>>2]&3](h,b,c,d,e,g)}return}function Tk(a){a=a|0;var b=0,c=0,d=0;f[a>>2]=2300;Fj(a+108|0);f[a>>2]=1544;b=f[a+32>>2]|0;if(!b){Oq(a);return}c=a+36|0;d=f[c>>2]|0;if((d|0)!=(b|0))f[c>>2]=d+(~((d+-4-b|0)>>>2)<<2);Oq(b);Oq(a);return}function Uk(a){a=a|0;var b=0,c=0,d=0;f[a>>2]=1880;Fj(a+108|0);f[a>>2]=1544;b=f[a+32>>2]|0;if(!b){Oq(a);return}c=a+36|0;d=f[c>>2]|0;if((d|0)!=(b|0))f[c>>2]=d+(~((d+-4-b|0)>>>2)<<2);Oq(b);Oq(a);return}function Vk(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0;a:do if(!d)e=0;else{f=a;g=d;h=c;while(1){i=b[f>>0]|0;j=b[h>>0]|0;if(i<<24>>24!=j<<24>>24)break;g=g+-1|0;if(!g){e=0;break a}else{f=f+1|0;h=h+1|0}}e=(i&255)-(j&255)|0}while(0);return e|0}function Wk(a){a=a|0;if(!(f[a+44>>2]|0))return 0;if(!(f[a+48>>2]|0))return 0;if(!(f[a+24>>2]|0))return 0;if(!(f[a+28>>2]|0))return 0;if(!(f[a+32>>2]|0))return 0;else return (f[a+36>>2]|0)!=0|0;return 0}function Xk(a){a=a|0;var b=0,c=0;f[a>>2]=2244;b=f[a+76>>2]|0;if(b|0)Oq(b);f[a>>2]=1544;b=f[a+32>>2]|0;if(!b)return;c=a+36|0;a=f[c>>2]|0;if((a|0)!=(b|0))f[c>>2]=a+(~((a+-4-b|0)>>>2)<<2);Oq(b);return}function Yk(a){a=a|0;var c=0,d=0;f[a>>2]=0;f[a+4>>2]=0;f[a+8>>2]=0;c=0;while(1){if((c|0)==3)break;f[a+(c<<2)>>2]=0;c=c+1|0}if((b[a+11>>0]|0)<0)d=(f[a+8>>2]&2147483647)+-1|0;else d=10;Hj(a,d,0);return}function Zk(a){a=a|0;var b=0,c=0,d=0,e=0.0,g=0.0;b=f[a+8>>2]|0;if((b|0)<2){c=0;d=0;I=c;return d|0}e=+(b|0);g=+Zg(e)*e;e=+W(+(g-+p[a>>3]));c=+K(e)>=1.0?(e>0.0?~~+Y(+J(e/4294967296.0),4294967295.0)>>>0:~~+W((e-+(~~e>>>0))/4294967296.0)>>>0):0;d=~~e>>>0;I=c;return d|0}function _k(a){a=a|0;var b=0,c=0;f[a>>2]=1824;b=f[a+76>>2]|0;if(b|0)Oq(b);f[a>>2]=1544;b=f[a+32>>2]|0;if(!b)return;c=a+36|0;a=f[c>>2]|0;if((a|0)!=(b|0))f[c>>2]=a+(~((a+-4-b|0)>>>2)<<2);Oq(b);return}function $k(a,b){a=a|0;b=b|0;var c=0,d=0,e=0;c=f[a+16>>2]|0;if(((f[a+20>>2]|0)-c>>2|0)<=(b|0)){d=0;return d|0}e=f[c+(b<<2)>>2]|0;if((e|0)<0){d=0;return d|0}b=f[(f[a+36>>2]|0)+(e<<2)>>2]|0;e=f[b+32>>2]|0;if(e|0){d=e;return d|0}d=f[b+8>>2]|0;return d|0}function al(a){a=a|0;var b=0,c=0,d=0;f[a>>2]=1232;b=f[a+16>>2]|0;if(b|0){c=a+20|0;d=f[c>>2]|0;if((d|0)!=(b|0))f[c>>2]=d+(~((d+-4-b|0)>>>2)<<2);Oq(b)}b=f[a+4>>2]|0;if(!b)return;d=a+8|0;a=f[d>>2]|0;if((a|0)!=(b|0))f[d>>2]=a+(~((a+-4-b|0)>>>2)<<2);Oq(b);return}function bl(a){a=a|0;var b=0,c=0;f[a>>2]=2300;Fj(a+108|0);f[a>>2]=1544;b=f[a+32>>2]|0;if(!b)return;c=a+36|0;a=f[c>>2]|0;if((a|0)!=(b|0))f[c>>2]=a+(~((a+-4-b|0)>>>2)<<2);Oq(b);return}function cl(a){a=a|0;if(!(f[a+64>>2]|0))return 0;if(!(f[a+68>>2]|0))return 0;if(!(f[a+44>>2]|0))return 0;if(!(f[a+48>>2]|0))return 0;if(!(f[a+52>>2]|0))return 0;else return (f[a+56>>2]|0)!=0|0;return 0}function dl(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0;if(fp(a,f[b+8>>2]|0,0)|0)Ck(0,b,c,d);else{e=f[a+8>>2]|0;Ya[f[(f[e>>2]|0)+28>>2]&3](e,b,c,d)}return}function el(a){a=a|0;var b=0,c=0;f[a>>2]=1880;Fj(a+108|0);f[a>>2]=1544;b=f[a+32>>2]|0;if(!b)return;c=a+36|0;a=f[c>>2]|0;if((a|0)!=(b|0))f[c>>2]=a+(~((a+-4-b|0)>>>2)<<2);Oq(b);return}function fl(a,b){a=a|0;b=b|0;var c=0,d=0;if((b|0)<0){c=0;return c|0}d=f[a+4>>2]|0;if(((f[d+12>>2]|0)-(f[d+8>>2]|0)>>2|0)<=(b|0)){c=0;return c|0}d=f[(f[a+8>>2]|0)+(f[(f[a+20>>2]|0)+(b<<2)>>2]<<2)>>2]|0;c=Ra[f[(f[d>>2]|0)+36>>2]&127](d,b)|0;return c|0}function gl(a,b){a=a|0;b=b|0;var c=0,d=0;if((b|0)<0){c=0;return c|0}d=f[a+4>>2]|0;if(((f[d+12>>2]|0)-(f[d+8>>2]|0)>>2|0)<=(b|0)){c=0;return c|0}d=f[(f[a+8>>2]|0)+(f[(f[a+20>>2]|0)+(b<<2)>>2]<<2)>>2]|0;c=Ra[f[(f[d>>2]|0)+32>>2]&127](d,b)|0;return c|0}function hl(a,c){a=a|0;c=c|0;var d=0,e=0,f=0,g=0;d=b[a>>0]|0;e=b[c>>0]|0;if(d<<24>>24==0?1:d<<24>>24!=e<<24>>24){f=e;g=d}else{d=c;c=a;do{c=c+1|0;d=d+1|0;a=b[c>>0]|0;e=b[d>>0]|0}while(!(a<<24>>24==0?1:a<<24>>24!=e<<24>>24));f=e;g=a}return (g&255)-(f&255)|0}function il(a,b){a=a|0;b=$(b);var c=0,d=0;c=u;u=u+16|0;d=c;Yk(d);Ei(a,d,b);Bo(d);u=c;return}function jl(a){a=a|0;var b=0,c=0,d=0,e=0,g=0;b=f[a>>2]|0;c=a+4|0;d=f[c>>2]|0;if((d|0)==(b|0))e=b;else{g=d+(~((d+-4-b|0)>>>2)<<2)|0;f[c>>2]=g;e=g}f[a+12>>2]=0;f[a+16>>2]=0;if(!b)return;if((e|0)!=(b|0))f[c>>2]=e+(~((e+-4-b|0)>>>2)<<2);Oq(b);return}function kl(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0;d=f[a+16>>2]|0;if(((f[a+20>>2]|0)-d>>2|0)<=(b|0)){e=-1;return e|0}g=f[d+(b<<2)>>2]|0;if((g|0)<0){e=-1;return e|0}e=f[(f[(f[(f[a+36>>2]|0)+(g<<2)>>2]|0)+16>>2]|0)+(c<<2)>>2]|0;return e|0}function ll(a,b){a=a|0;b=b|0;var c=0,d=0;c=u;u=u+16|0;d=c;Yk(d);Ji(a,d,b);Bo(d);u=c;return}function ml(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0;d=u;u=u+32|0;e=d;g=d+20|0;f[e>>2]=f[a+60>>2];f[e+4>>2]=0;f[e+8>>2]=b;f[e+12>>2]=g;f[e+16>>2]=c;if((to(za(140,e|0)|0)|0)<0){f[g>>2]=-1;h=-1}else h=f[g>>2]|0;u=d;return h|0}function nl(a,b){a=a|0;b=b|0;var c=0,d=0;if((b|0)==-1|(b|0)>4){c=0;return c|0}d=f[a+20+(b*12|0)>>2]|0;if(((f[a+20+(b*12|0)+4>>2]|0)-d|0)<=0){c=0;return c|0}b=f[d>>2]|0;if((b|0)==-1){c=0;return c|0}c=f[(f[a+8>>2]|0)+(b<<2)>>2]|0;return c|0}function ol(a,b){a=a|0;b=b|0;var c=0,d=0,e=0;c=f[a+16>>2]|0;if(((f[a+20>>2]|0)-c>>2|0)<=(b|0)){d=0;return d|0}e=f[c+(b<<2)>>2]|0;if((e|0)<0){d=0;return d|0}b=f[(f[a+36>>2]|0)+(e<<2)>>2]|0;d=(f[b+20>>2]|0)-(f[b+16>>2]|0)>>2;return d|0}function pl(a){a=a|0;if(!(f[a+40>>2]|0))return 0;if(!(f[a+24>>2]|0))return 0;if(!(f[a+28>>2]|0))return 0;if(!(f[a+32>>2]|0))return 0;else return (f[a+36>>2]|0)!=0|0;return 0}function ql(a){a=a|0;var b=0;if(!(f[a+24>>2]|0)){b=0;return b|0}if(!(f[a+28>>2]|0)){b=0;return b|0}if(!(f[a+32>>2]|0)){b=0;return b|0}b=(f[a+36>>2]|0)!=0;return b|0}function rl(a,b,c){a=a|0;b=b|0;c=c|0;var d=0;lh(a,c);f[a>>2]=1408;c=a+72|0;d=a+36|0;a=d+36|0;do{f[d>>2]=0;d=d+4|0}while((d|0)<(a|0));d=f[b>>2]|0;f[b>>2]=0;f[c>>2]=d;return}function sl(a){a=a|0;var b=0,c=0;f[a>>2]=3148;b=f[a+56>>2]|0;if(b|0)Oq(b);b=a+48|0;c=f[b>>2]|0;f[b>>2]=0;if(!c){Oq(a);return}Mq(c);Oq(a);return}function tl(a,c){a=a|0;c=c|0;var d=0,e=0;d=a;e=c;c=d+64|0;do{f[d>>2]=f[e>>2];d=d+4|0;e=e+4|0}while((d|0)<(c|0));e=a+64|0;f[a+88>>2]=0;f[e>>2]=0;f[e+4>>2]=0;f[e+8>>2]=0;f[e+12>>2]=0;f[e+16>>2]=0;b[e+20>>0]=0;return}function ul(a,c,d,e){a=a|0;c=c|0;d=d|0;e=e|0;var f=0,g=0;if((a|0)==0&(c|0)==0)f=d;else{g=d;d=c;c=a;while(1){a=g+-1|0;b[a>>0]=h[16636+(c&15)>>0]|0|e;c=Yn(c|0,d|0,4)|0;d=I;if((c|0)==0&(d|0)==0){f=a;break}else g=a}}return f|0}function vl(a){a=a|0;var c=0,d=0,e=0;c=a+74|0;d=b[c>>0]|0;b[c>>0]=d+255|d;d=f[a>>2]|0;if(!(d&8)){f[a+8>>2]=0;f[a+4>>2]=0;c=f[a+44>>2]|0;f[a+28>>2]=c;f[a+20>>2]=c;f[a+16>>2]=c+(f[a+48>>2]|0);e=0}else{f[a>>2]=d|32;e=-1}return e|0}function wl(a){a=a|0;if(!(f[a+60>>2]|0))return 0;if(!(f[a+44>>2]|0))return 0;if(!(f[a+48>>2]|0))return 0;if(!(f[a+52>>2]|0))return 0;else return (f[a+56>>2]|0)!=0|0;return 0}function xl(a,b){a=a|0;b=b|0;var c=0,d=0;c=f[b+88>>2]|0;if(!c){d=0;return d|0}if((f[c>>2]|0)!=2){d=0;return d|0}b=f[c+8>>2]|0;f[a+4>>2]=h[b>>0]|h[b+1>>0]<<8|h[b+2>>0]<<16|h[b+3>>0]<<24;d=1;return d|0}function yl(a){a=a|0;var b=0;if(!(f[a+44>>2]|0)){b=0;return b|0}if(!(f[a+48>>2]|0)){b=0;return b|0}if(!(f[a+52>>2]|0)){b=0;return b|0}b=(f[a+56>>2]|0)!=0;return b|0}function zl(a){a=a|0;vj(a);Oq(a);return}function Al(a){a=a|0;var b=0,c=0;f[a>>2]=2784;b=f[a+56>>2]|0;if(b|0)Oq(b);b=a+48|0;c=f[b>>2]|0;f[b>>2]=0;if(!c){Oq(a);return}Mq(c);Oq(a);return}function Bl(a,c){a=a|0;c=c|0;var d=0;if(f[c+56>>2]|0){d=0;return d|0}if((b[c+24>>0]|0)!=3){d=0;return d|0}f[a+44>>2]=c;d=1;return d|0}function Cl(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0;c=a+4|0;d=f[c>>2]|0;e=f[a>>2]|0;g=d-e|0;if(g>>>0>>0){Fi(a,b-g|0);return}if(g>>>0<=b>>>0)return;g=e+b|0;if((g|0)==(d|0))return;f[c>>2]=g;return}function Dl(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=$(e);f[a+4>>2]=b;Zf(a+8|0,c,c+(d<<2)|0);n[a+20>>2]=e;return}function El(a,b){a=a|0;b=b|0;var c=0;if(!(Qa[f[(f[a>>2]|0)+40>>2]&127](a)|0)){c=0;return c|0}if(!(Ra[f[(f[a>>2]|0)+44>>2]&127](a,b)|0)){c=0;return c|0}c=Ra[f[(f[a>>2]|0)+48>>2]&127](a,b)|0;return c|0}function Fl(a,c){a=a|0;c=c|0;var d=0;if(f[c+56>>2]|0){d=0;return d|0}if((b[c+24>>0]|0)!=3){d=0;return d|0}f[a+40>>2]=c;d=1;return d|0}function Gl(a,b){a=a|0;b=b|0;var c=0,d=0,e=0;c=u;u=u+16|0;d=c+4|0;e=c;f[e>>2]=0;f[d>>2]=f[e>>2];e=vc(a,b,d)|0;u=c;return e|0}function Hl(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,g=0;d=f[c>>2]|0;c=a;e=b-a>>2;while(1){if(!e)break;a=(e|0)/2|0;b=c+(a<<2)|0;g=(f[b>>2]|0)>>>0>>0;c=g?b+4|0:c;e=g?e+-1-a|0:a}return c|0}function Il(a){a=a|0;var c=0;f[a>>2]=0;c=a+8|0;f[c>>2]=0;f[c+4>>2]=0;f[c+8>>2]=0;f[c+12>>2]=0;b[a+24>>0]=1;f[a+28>>2]=9;c=a+40|0;f[c>>2]=0;f[c+4>>2]=0;f[c+8>>2]=0;f[c+12>>2]=0;f[a+56>>2]=-1;f[a+60>>2]=0;return}function Jl(a){a=a|0;yj(a);Oq(a);return}function Kl(a){a=a|0;var b=0;f[a>>2]=3148;b=f[a+56>>2]|0;if(b|0)Oq(b);b=a+48|0;a=f[b>>2]|0;f[b>>2]=0;if(!a)return;Mq(a);return}function Ll(a){a=a|0;var c=0,d=0,e=0,g=0,h=0;if(!(Aq(b[f[a>>2]>>0]|0)|0))c=0;else{d=0;while(1){e=f[a>>2]|0;g=(d*10|0)+-48+(b[e>>0]|0)|0;h=e+1|0;f[a>>2]=h;if(!(Aq(b[h>>0]|0)|0)){c=g;break}else d=g}}return c|0}function Ml(a,c){a=a|0;c=c|0;var d=0;if(f[c+56>>2]|0){d=0;return d|0}if((b[c+24>>0]|0)!=3){d=0;return d|0}f[a+64>>2]=c;d=1;return d|0}function Nl(a){a=a|0;var b=0,c=0;b=f[r>>2]|0;c=b+a|0;if((a|0)>0&(c|0)<(b|0)|(c|0)<0){ea()|0;ya(12);return -1}f[r>>2]=c;if((c|0)>(da()|0)?(ca()|0)==0:0){f[r>>2]=b;ya(12);return -1}return b|0}function Ol(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,f=0;if((a|0)==0&(c|0)==0)e=d;else{f=d;d=c;c=a;while(1){a=f+-1|0;b[a>>0]=c&7|48;c=Yn(c|0,d|0,3)|0;d=I;if((c|0)==0&(d|0)==0){e=a;break}else f=a}}return e|0}function Pl(a,c){a=a|0;c=c|0;var d=0;if(f[c+56>>2]|0){d=0;return d|0}if((b[c+24>>0]|0)!=3){d=0;return d|0}f[a+60>>2]=c;d=1;return d|0}function Ql(a){a=a|0;var b=0,c=0,d=0;f[a>>2]=1544;b=f[a+32>>2]|0;if(!b){Oq(a);return}c=a+36|0;d=f[c>>2]|0;if((d|0)!=(b|0))f[c>>2]=d+(~((d+-4-b|0)>>>2)<<2);Oq(b);Oq(a);return}function Rl(a,b,c,d,e,g){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;g=g|0;if(fp(a,f[b+8>>2]|0,g)|0)qj(0,b,c,d,e);return}function Sl(a){a=a|0;var b=0;f[a>>2]=2784;b=f[a+56>>2]|0;if(b|0)Oq(b);b=a+48|0;a=f[b>>2]|0;f[b>>2]=0;if(!a)return;Mq(a);return}function Tl(a){a=a|0;var c=0,d=0,e=0,g=0;c=u;u=u+16|0;d=c;e=f[a+4>>2]|0;g=(f[e+56>>2]|0)-(f[e+52>>2]|0)>>2;b[d>>0]=0;qh(a+20|0,g,d);u=c;return}function Ul(a){a=a|0;Vi(a);Oq(a);return}function Vl(a){a=a|0;var b=0;switch(a|0){case 11:case 2:case 1:{b=1;break}case 4:case 3:{b=2;break}case 6:case 5:{b=4;break}case 8:case 7:{b=8;break}case 9:{b=4;break}case 10:{b=8;break}default:b=-1}return b|0}function Wl(a){a=a|0;var c=0,d=0,e=0,g=0;c=u;u=u+16|0;d=c;e=f[a+4>>2]|0;g=(f[e+28>>2]|0)-(f[e+24>>2]|0)>>2;b[d>>0]=0;qh(a+20|0,g,d);u=c;return}function Xl(){var a=0,b=0;a=ln(40)|0;f[a>>2]=0;f[a+4>>2]=0;f[a+8>>2]=0;f[a+12>>2]=0;n[a+16>>2]=$(1.0);b=a+20|0;f[b>>2]=0;f[b+4>>2]=0;f[b+8>>2]=0;f[b+12>>2]=0;n[a+36>>2]=$(1.0);return a|0}function Yl(a,b){a=+a;b=+b;var c=0,d=0,e=0;p[s>>3]=a;c=f[s>>2]|0;d=f[s+4>>2]|0;p[s>>3]=b;e=f[s+4>>2]&-2147483648|d&2147483647;f[s>>2]=c;f[s+4>>2]=e;return +(+p[s>>3])}function Zl(a,b,c){a=a|0;b=b|0;c=+c;var d=0,e=0;d=u;u=u+16|0;e=d;p[e>>3]=c;_b(a,b,e);u=d;return}function _l(a){a=a|0;f[a>>2]=3656;Qi(a+8|0);Oq(a);return}function $l(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0;d=u;u=u+16|0;e=d;f[e>>2]=c;fc(a,b,e);u=d;return}function am(a,c){a=a|0;c=c|0;var d=0,e=0;if((a|0)!=(c|0)){d=b[c+11>>0]|0;e=d<<24>>24<0;jj(a,e?f[c>>2]|0:c,e?f[c+4>>2]|0:d&255)|0}return a|0}function bm(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,f=0;c=a&65535;d=b&65535;e=X(d,c)|0;f=a>>>16;a=(e>>>16)+(X(d,f)|0)|0;d=b>>>16;b=X(d,c)|0;return (I=(a>>>16)+(X(d,f)|0)+(((a&65535)+b|0)>>>16)|0,a+b<<16|e&65535|0)|0}function cm(a,b){a=a|0;b=b|0;var c=0,d=0,e=0;c=Gj(b)|0;d=ln(c+13|0)|0;f[d>>2]=c;f[d+4>>2]=c;f[d+8>>2]=0;e=Fp(d)|0;kh(e|0,b|0,c+1|0)|0;f[a>>2]=e;return}function dm(a,b){a=a|0;b=b|0;var c=0,d=0;if((b|0)==-1|(b|0)>4){c=-1;return c|0}d=f[a+20+(b*12|0)>>2]|0;if(((f[a+20+(b*12|0)+4>>2]|0)-d|0)<=0){c=-1;return c|0}c=f[d>>2]|0;return c|0}function em(a){a=a|0;Yi(a);Oq(a);return}function fm(a){a=a|0;f[a>>2]=3656;Qi(a+8|0);return}function gm(a){a=a|0;var b=0,c=0;f[a>>2]=1544;b=f[a+32>>2]|0;if(!b)return;c=a+36|0;a=f[c>>2]|0;if((a|0)!=(b|0))f[c>>2]=a+(~((a+-4-b|0)>>>2)<<2);Oq(b);return}function hm(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;if(fp(a,f[b+8>>2]|0,0)|0)Ck(0,b,c,d);return}function im(a,c,d){a=a|0;c=c|0;d=d|0;var e=0;if((c|0)<(a|0)&(a|0)<(c+d|0)){e=a;c=c+d|0;a=a+d|0;while((d|0)>0){a=a-1|0;c=c-1|0;d=d-1|0;b[a>>0]=b[c>>0]|0}a=e}else kh(a,c,d)|0;return a|0}function jm(a){a=a|0;var b=0,c=0,d=0;f[a>>2]=1196;b=f[a+8>>2]|0;if(!b){Oq(a);return}c=a+12|0;d=f[c>>2]|0;if((d|0)!=(b|0))f[c>>2]=d+(~((d+-4-b|0)>>>2)<<2);Oq(b);Oq(a);return}function km(a){a=a|0;var b=0;f[a>>2]=3204;b=f[a+56>>2]|0;if(!b){Oq(a);return}Oq(b);Oq(a);return}function lm(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0;d=u;u=u+16|0;e=d;f[e>>2]=f[c>>2];g=Sa[f[(f[a>>2]|0)+16>>2]&31](a,b,e)|0;if(g)f[c>>2]=f[e>>2];u=d;return g&1|0}function mm(a,b){a=a|0;b=b|0;var c=0;if(b>>>0>=2){c=0;return c|0}f[a+28>>2]=b;c=1;return c|0}function nm(a){a=a|0;var b=0,c=0;f[a>>2]=3408;b=a+56|0;c=f[b>>2]|0;f[b>>2]=0;if(!c){mj(a);return}Va[f[(f[c>>2]|0)+4>>2]&127](c);mj(a);return}function om(){var a=0,b=0;a=sn()|0;if((a|0?(b=f[a>>2]|0,b|0):0)?(a=b+48|0,(f[a>>2]&-256|0)==1126902528?(f[a+4>>2]|0)==1129074247:0):0)Ho(f[b+12>>2]|0);Ho(Qp()|0)}function pm(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;return Qf(a,b,c,d,e,f,6)|0}function qm(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;return Pf(a,b,c,d,e,f,4)|0}function rm(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;return Wf(a,b,c,d,e,f,2)|0}function sm(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;return Pf(a,b,c,d,e,f,3)|0}function tm(a){a=a|0;var b=0;f[a>>2]=2840;b=f[a+56>>2]|0;if(!b){Oq(a);return}Oq(b);Oq(a);return}function um(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;return Wf(a,b,c,d,e,f,1)|0}function vm(a){a=a|0;var c=0;c=b[w+(a&255)>>0]|0;if((c|0)<8)return c|0;c=b[w+(a>>8&255)>>0]|0;if((c|0)<8)return c+8|0;c=b[w+(a>>16&255)>>0]|0;if((c|0)<8)return c+16|0;return (b[w+(a>>>24)>>0]|0)+24|0}function wm(a,b){a=a|0;b=b|0;var c=0.0,d=0.0,e=0.0,f=0.0;if(!a){c=0.0;return +c}if((b|0)==0|(a|0)==(b|0)){c=0.0;return +c}d=+(b>>>0)/+(a>>>0);e=1.0-d;f=d*+Zg(d);c=-(f+e*+Zg(e));return +c}function xm(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0;if((b|0)>0)d=0;else return;do{e=f[a+(d<<2)>>2]|0;f[c+(d<<2)>>2]=e<<1^e>>31;d=d+1|0}while((d|0)!=(b|0));return}function ym(a){a=a|0;var b=0;zo(a);f[a>>2]=3344;f[a+40>>2]=1196;f[a+44>>2]=-1;b=a+48|0;f[b>>2]=0;f[b+4>>2]=0;f[b+8>>2]=0;f[b+12>>2]=0;return}function zm(a,c){a=a|0;c=c|0;var d=0;b[c+84>>0]=1;a=f[c+68>>2]|0;d=c+72|0;c=f[d>>2]|0;if((c|0)==(a|0))return 1;f[d>>2]=c+(~((c+-4-a|0)>>>2)<<2);return 1}function Am(a){a=a|0;var b=0,c=0;if(pq(a)|0?(b=Mp(f[a>>2]|0)|0,a=b+8|0,c=f[a>>2]|0,f[a>>2]=c+-1,(c+-1|0)<0):0)Oq(b);return}function Bm(a){a=a|0;var b=0,c=0;b=f[a+16>>2]|0;c=(((f[a+12>>2]|0)+1-b|0)/64|0)+b<<3;a=b<<3;b=Vn(c|0,((c|0)<0)<<31>>31|0,a|0,((a|0)<0)<<31>>31|0)|0;return b|0}function Cm(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;return Qf(a,b,c,d,e,f,5)|0}function Dm(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;return Qf(a,b,c,d,e,f,9)|0}function Em(a){a=a|0;var b=0;f[a>>2]=3204;b=f[a+56>>2]|0;if(!b)return;Oq(b);return}function Fm(a){a=a|0;var b=0,c=0;f[a>>2]=1476;b=a+36|0;c=f[b>>2]|0;f[b>>2]=0;if(c|0)Va[f[(f[c>>2]|0)+4>>2]&127](c);Ni(a);Oq(a);return}function Gm(a){a=a|0;var b=0,c=0;f[a>>2]=1196;b=f[a+8>>2]|0;if(!b)return;c=a+12|0;a=f[c>>2]|0;if((a|0)!=(b|0))f[c>>2]=a+(~((a+-4-b|0)>>>2)<<2);Oq(b);return}function Hm(a){a=a|0;var c=0;f[a>>2]=1352;f[a+4>>2]=0;f[a+8>>2]=0;f[a+12>>2]=-1;c=a+16|0;f[a+32>>2]=0;f[c>>2]=0;f[c+4>>2]=0;f[c+8>>2]=0;b[c+12>>0]=0;return}function Im(a){a=a|0;var b=0;f[a>>2]=2840;b=f[a+56>>2]|0;if(!b)return;Oq(b);return}function Jm(a){a=a|0;var b=0,c=0;f[a>>2]=1476;b=a+36|0;c=f[b>>2]|0;f[b>>2]=0;if(c|0)Va[f[(f[c>>2]|0)+4>>2]&127](c);Ni(a);return}function Km(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=$(f);Fg(a,b,c,d,e,f);return}function Lm(a){a=a|0;var b=0,c=0;f[a>>2]=3408;b=a+56|0;c=f[b>>2]|0;f[b>>2]=0;if(c|0)Va[f[(f[c>>2]|0)+4>>2]&127](c);mj(a);Oq(a);return}function Mm(a){a=a|0;var b=0,c=0,d=0;b=f[a>>2]|0;c=a+4|0;d=f[c>>2]|0;if((d|0)!=(b|0))f[c>>2]=d+(~((d+-4-b|0)>>>2)<<2);f[a+12>>2]=0;f[a+16>>2]=0;return}function Nm(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0;d=a+20|0;e=f[d>>2]|0;g=(f[a+16>>2]|0)-e|0;a=g>>>0>c>>>0?c:g;kh(e|0,b|0,a|0)|0;f[d>>2]=(f[d>>2]|0)+a;return c|0}function Om(a){a=a|0;var b=0;f[a>>2]=3588;b=f[a+20>>2]|0;if(b|0)Oq(b);b=f[a+8>>2]|0;if(!b){Oq(a);return}Oq(b);Oq(a);return}function Pm(a){a=a|0;var b=0,c=0;b=f[a>>2]|0;if(!b)return;c=a+4|0;a=f[c>>2]|0;if((a|0)!=(b|0))f[c>>2]=a+(~((a+-8-b|0)>>>3)<<3);Oq(b);return}function Qm(a){a=a|0;var b=0,c=0;b=f[a>>2]|0;if(!b)return;c=a+4|0;a=f[c>>2]|0;if((a|0)!=(b|0))f[c>>2]=a+(~((a+-4-b|0)>>>2)<<2);Oq(b);return}function Rm(a,b){a=a|0;b=b|0;var c=0;c=f[b>>2]|0;return (1<<(c&31)&f[(f[a+28>>2]|0)+(c>>>5<<2)>>2]|0)!=0|0}function Sm(a,b,c){a=a|0;b=b|0;c=c|0;return Sa[f[(f[a>>2]|0)+44>>2]&31](a,b,c)|0}function Tm(a){a=a|0;var c=0;Il(a);c=a+64|0;f[a+88>>2]=0;f[c>>2]=0;f[c+4>>2]=0;f[c+8>>2]=0;f[c+12>>2]=0;f[c+16>>2]=0;b[c+20>>0]=0;return}function Um(a){a=a|0;f[a>>2]=3260;Fj(a+88|0);Oq(a);return}function Vm(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;if((f[b+4>>2]|0)==(c|0)?(c=b+28|0,(f[c>>2]|0)!=1):0)f[c>>2]=d;return}function Wm(a){a=a|0;var b=0,c=0,d=0;b=u;u=u+16|0;c=b;if((Ek(a)|0)==0?(Sa[f[a+32>>2]&31](a,c,1)|0)==1:0)d=h[c>>0]|0;else d=-1;u=b;return d|0}function Xm(a){a=a|0;var b=0;f[a>>2]=3636;b=f[a+20>>2]|0;if(b|0)Oq(b);b=f[a+8>>2]|0;if(!b){Oq(a);return}Oq(b);Oq(a);return}function Ym(a,b){a=a|0;b=b|0;var c=0,d=0,e=0;f[a+104>>2]=b;c=f[a+8>>2]|0;d=f[a+4>>2]|0;e=c-d|0;f[a+108>>2]=e;f[a+100>>2]=(b|0)!=0&(e|0)>(b|0)?d+b|0:c;return}function Zm(a){a=a|0;var b=0;f[a>>2]=0;f[a+4>>2]=0;f[a+8>>2]=0;b=a+16|0;f[b>>2]=0;f[b+4>>2]=0;f[b+8>>2]=0;f[b+12>>2]=0;f[b+16>>2]=0;return}function _m(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=$(f);Km(a,b,c,d,e,f);return}function $m(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;return pm(a,b,c,d,e,f)|0}function an(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;return qm(a,b,c,d,e,f)|0}function bn(a,b,c){a=a|0;b=b|0;c=c|0;f[a+4>>2]=b;f[a+8>>2]=f[(f[(f[b+4>>2]|0)+8>>2]|0)+(c<<2)>>2];f[a+12>>2]=c;return 1}function cn(a){a=a|0;var b=0,c=0;if(!a)return;b=f[a>>2]|0;if(b|0){c=a+4|0;if((f[c>>2]|0)!=(b|0))f[c>>2]=b;Oq(b)}Oq(a);return}function dn(a){a=a|0;f[a>>2]=2896;Fj(a+88|0);Oq(a);return}function en(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;return rm(a,b,c,d,e,f)|0}function fn(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;return sm(a,b,c,d,e,f)|0}function gn(a){a=a|0;f[a>>2]=3260;Fj(a+88|0);return}function hn(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,g=0;e=u;u=u+16|0;g=e|0;Ld(a,b,c,d,g)|0;u=e;return (I=f[g+4>>2]|0,f[g>>2]|0)|0}function jn(a){a=a|0;var b=0;eo(a);f[a>>2]=6152;b=a+84|0;f[b>>2]=0;f[b+4>>2]=0;f[b+8>>2]=0;f[b+12>>2]=0;f[b+16>>2]=0;f[b+20>>2]=0;return}function kn(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;return um(a,b,c,d,e,f)|0}function ln(a){a=a|0;var b=0,c=0;b=(a|0)==0?1:a;while(1){a=$a(b)|0;if(a|0){c=a;break}a=Op()|0;if(!a){c=0;break}Ua[a&3]()}return c|0}function mn(a,b,c){a=a|0;b=b|0;c=c|0;ac(a,b,c);return}function nn(a){a=a|0;var b=0;f[a>>2]=3588;b=f[a+20>>2]|0;if(b|0)Oq(b);b=f[a+8>>2]|0;if(!b)return;Oq(b);return}function on(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;return Cm(a,b,c,d,e,f)|0}function pn(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;return Dm(a,b,c,d,e,f)|0}function qn(a){a=a|0;f[a>>2]=2896;Fj(a+88|0);return}function rn(a){a=a|0;var b=0,c=0,d=0;b=u;u=u+16|0;c=b;d=Qq(f[a+60>>2]|0)|0;f[c>>2]=d;d=to(Ba(6,c|0)|0)|0;u=b;return d|0}function sn(){var a=0,b=0;a=u;u=u+16|0;if(!(Ka(19700,3)|0)){b=Ia(f[4926]|0)|0;u=a;return b|0}else Hn(18840,a);return 0}function tn(a){a=a|0;var b=0;f[a>>2]=3636;b=f[a+20>>2]|0;if(b|0)Oq(b);b=f[a+8>>2]|0;if(!b)return;Oq(b);return}function un(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,f=0;e=a;a=c;c=bm(e,a)|0;f=I;return (I=(X(b,a)|0)+(X(d,e)|0)+f|f&0,c|0|0)|0}function vn(a,b){a=a|0;b=b|0;lh(a,b);f[a>>2]=1292;b=a+36|0;a=b+40|0;do{f[b>>2]=0;b=b+4|0}while((b|0)<(a|0));return}function wn(a){a=a|0;f[a>>2]=0;f[a+4>>2]=0;f[a+8>>2]=0;f[a+12>>2]=0;f[a+16>>2]=0;f[a+20>>2]=0;f[a+24>>2]=0;f[a+28>>2]=0;return}function xn(a){a=a|0;var b=0;b=u;u=u+16|0;yc(a);if(!(La(f[4926]|0,0)|0)){u=b;return}else Hn(18939,b)}function yn(a){a=a|0;var b=0;f[a>>2]=0;f[a+4>>2]=0;f[a+8>>2]=0;b=a+16|0;f[b>>2]=0;f[b+4>>2]=0;f[b+8>>2]=0;f[b+12>>2]=0;return}function zn(a,b){a=a|0;b=b|0;return vg(a+40|0,b)|0}function An(a,b){a=a|0;b=b|0;return lj(a,b,lq(b)|0)|0}function Bn(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,g=0;e=u;u=u+16|0;g=e;f[g>>2]=d;d=Zi(a,b,c,g)|0;u=e;return d|0}function Cn(a,b){a=a|0;b=b|0;return Mj(a+40|0,b)|0}function Dn(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;return Qh(a,b,c,d)|0}function En(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;return uh(a,b,c,d)|0}function Fn(a,b){a=a|0;b=b|0;var c=0;c=f[a+56>>2]|0;return Ra[f[(f[c>>2]|0)+24>>2]&127](c,b)|0}function Gn(a){a=a|0;f[a>>2]=0;f[a+4>>2]=0;f[a+8>>2]=0;f[a+12>>2]=0;f[a+16>>2]=0;f[a+20>>2]=0;b[a+24>>0]=0;return}function Hn(a,b){a=a|0;b=b|0;var c=0,d=0;c=u;u=u+16|0;d=c;f[d>>2]=b;b=f[1556]|0;Ah(b,a,d)|0;Lj(10,b)|0;Ca()}function In(a,b,c,d,e,f,g){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;g=g|0;return Ta[a&31](b|0,c|0,d|0,e|0,f|0,g|0)|0}function Jn(a,b){a=a|0;b=b|0;var c=0;c=f[a+56>>2]|0;return Ra[f[(f[c>>2]|0)+16>>2]&127](c,b)|0}function Kn(a,b){a=a|0;b=b|0;var c=0;c=f[a+56>>2]|0;return Ra[f[(f[c>>2]|0)+20>>2]&127](c,b)|0}function Ln(a,b){a=a|0;b=b|0;var c=0;c=f[a+56>>2]|0;return Ra[f[(f[c>>2]|0)+12>>2]&127](c,b)|0}function Mn(){var a=0;a=u;u=u+16|0;if(!(Ja(19704,113)|0)){u=a;return}else Hn(18889,a)}function Nn(a,b,c){a=a|0;b=b|0;c=c|0;Pj(a,b,c);return}function On(a){a=a|0;cf(a);Oq(a);return}function Pn(a,b,c,d,e,f,g){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;g=g|0;_a[a&3](b|0,c|0,d|0,e|0,f|0,g|0)}function Qn(a,b,c){a=a|0;b=b|0;c=c|0;if(b|0)sj(a|0,(kq(c)|0)&255|0,b|0)|0;return a|0}function Rn(a){a=a|0;return 4}function Sn(a,b,c){a=a|0;b=b|0;c=c|0;return ej(0,b,c)|0}function Tn(a,b,c){a=a|0;b=b|0;c=c|0;if((c|0)<32){I=b<>>32-c;return a<>>0;return (I=b+d+(e>>>0>>0|0)>>>0,e|0)|0}function Wn(a,b){a=a|0;b=b|0;var c=0;if(!b)c=0;else c=Dh(f[b>>2]|0,f[b+4>>2]|0,a)|0;return (c|0?c:a)|0}function Xn(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0;e=b-d>>>0;e=b-d-(c>>>0>a>>>0|0)>>>0;return (I=e,a-c>>>0|0)|0}function Yn(a,b,c){a=a|0;b=b|0;c=c|0;if((c|0)<32){I=b>>>c;return a>>>c|(b&(1<>>c-32|0}function Zn(a){a=a|0;var b=0;f[a>>2]=3932;b=a+4|0;a=b+44|0;do{f[b>>2]=0;b=b+4|0}while((b|0)<(a|0));return}function _n(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;return De(a,b,c,d)|0}function $n(a){a=a|0;ff(a);Oq(a);return}function ao(a,b){a=a|0;b=b|0;ji(a);f[a+36>>2]=b;f[a+40>>2]=0;return}function bo(a,b,c,d){a=a|0;b=b|0;c=c|0;d=+d;return $i(a,b,c,d)|0}function co(a){a=a|0;return 5}function eo(a){a=a|0;var b=0;f[a>>2]=6192;b=a+4|0;a=b+80|0;do{f[b>>2]=0;b=b+4|0}while((b|0)<(a|0));return}function fo(a){a=a|0;return 6}function go(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;return aj(a,b,c,d)|0}function ho(a,b,c){a=a|0;b=b|0;c=c|0;f[a+28>>2]=b;f[a+32>>2]=c;return 1}function io(a,b){a=a|0;b=b|0;ji(a);f[a+36>>2]=b;f[a+40>>2]=b;return}function jo(a,b,c){a=a|0;b=b|0;c=c|0;Nn(a,b,c);return}function ko(a){a=a|0;var b=0;b=f[a+56>>2]|0;return Qa[f[(f[b>>2]|0)+28>>2]&127](b)|0}function lo(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;Ve(a,b,c,d,1);return}function mo(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;Ve(a,b,c,d,0);return}function no(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;return Xg(a,b,c,d)|0}function oo(a,b,c){a=a|0;b=b|0;c=c|0;return fi(a,b,c)|0}function po(a){a=a|0;var b=0;b=f[a+56>>2]|0;return Qa[f[(f[b>>2]|0)+32>>2]&127](b)|0}function qo(a,b,c){a=a|0;b=b|0;c=c|0;return ej(a,b,c)|0}function ro(a,b,c){a=a|0;b=b|0;c=c|0;return Sn(a,b,c)|0}function so(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;Za[a&3](b|0,c|0,d|0,e|0,f|0)}function to(a){a=a|0;var b=0,c=0;if(a>>>0>4294963200){b=Vq()|0;f[b>>2]=0-a;c=-1}else c=a;return c|0}function uo(a,b,c){a=a|0;b=b|0;c=c|0;Li(a,b,c);return}function vo(a){a=a|0;f[a>>2]=0;f[a+4>>2]=0;f[a+8>>2]=0;f[a+12>>2]=0;f[a+16>>2]=0;return}function wo(a,b){a=a|0;b=b|0;f[a+8>>2]=b;f[a+12>>2]=-1;return 1}function xo(a,b){a=a|0;b=b|0;f[a+52>>2]=b;ip(a,b);return}function yo(a){a=+a;var b=0;p[s>>3]=a;b=f[s>>2]|0;I=f[s+4>>2]|0;return b|0}function zo(a){a=a|0;Hm(a);f[a>>2]=1476;f[a+36>>2]=0;return}function Ao(a){a=a|0;var b=0;if(!a)b=0;else b=(Eh(a,1056,1144,0)|0)!=0&1;return b|0}function Bo(a){a=a|0;if((b[a+11>>0]|0)<0)Oq(f[a>>2]|0);return}function Co(a){a=a|0;if(!a)return;Va[f[(f[a>>2]|0)+4>>2]&127](a);return}function Do(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;Ya[a&3](b|0,c|0,d|0,e|0)}function Eo(a,b,c){a=a|0;b=b|0;c=c|0;if(c|0)im(a|0,b|0,c|0)|0;return a|0}function Fo(a,b,c){a=a|0;b=b|0;c=c|0;if(c|0)kh(a|0,b|0,c|0)|0;return a|0}function Go(a,b){a=a|0;b=b|0;return -1}function Ho(a){a=a|0;var b=0;b=u;u=u+16|0;Ua[a&3]();Hn(18992,b)}function Io(a){a=a|0;Lh(a);Oq(a);return}function Jo(a,b,c){a=a|0;b=b|0;c=c|0;Ro(a,b,c);return}function Ko(a,b,c){a=a|0;b=$(b);c=c|0;f[a+4>>2]=c;n[a>>2]=b;return}function Lo(a){a=a|0;To(a);f[a>>2]=3408;f[a+56>>2]=0;return}function Mo(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;return Sa[a&31](b|0,c|0,d|0)|0}function No(a,b){a=a|0;b=b|0;return (wp(a,b)|0)<<24>>24|0}function Oo(a,b){a=a|0;b=b|0;f[a>>2]=7236;cm(a+4|0,b);return}function Po(a,b){a=a|0;b=b|0;var c=0;if(!a)c=0;else c=Pi(a,b,0)|0;return c|0}function Qo(a){a=a|0;return f[a+12>>2]|0}function Ro(a,b,c){a=a|0;b=b|0;c=c|0;uo(a,b,c);return}function So(){var a=0;a=ln(64)|0;Il(a);return a|0}function To(a){a=a|0;Zn(a);f[a>>2]=3764;f[a+52>>2]=0;return}function Uo(a){a=a|0;if(!a)return;bj(a);Oq(a);return}function Vo(a){a=a|0;return Qa[f[(f[a>>2]|0)+60>>2]&127](a)|0}function Wo(a){a=a|0;return f[a+4>>2]|0}function Xo(a,b,c){a=a|0;b=b|0;c=c|0;if(!(f[a>>2]&32))qi(b,c,a)|0;return}function Yo(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;Xa[a&15](b|0,c|0,d|0)}function Zo(){var a=0;a=ln(96)|0;Tm(a);return a|0}function _o(a){a=a|0;var b=0;b=u;u=u+a|0;u=u+15&-16;return b|0}function $o(a){a=a|0;var b=0;b=(Jq()|0)+188|0;return $j(a,f[b>>2]|0)|0}function ap(a){a=a|0;return ((f[a+100>>2]|0)-(f[a+96>>2]|0)|0)/12|0|0}function bp(a,b){a=a|0;b=b|0;kp(a,b);return}function cp(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;aa(3);return 0}function dp(){var a=0;a=ln(12)|0;op(a);return a|0}function ep(a){a=a|0;Ni(a);Oq(a);return}function fp(a,b,c){a=a|0;b=b|0;c=c|0;return (a|0)==(b|0)|0}function gp(a,b){a=a|0;b=b|0;var c=0;c=sp(a|0)|0;return ((b|0)==0?a:c)|0}function hp(a){a=a|0;return (f[a+12>>2]|0)-(f[a+8>>2]|0)>>2|0}function ip(a,b){a=a|0;b=b|0;f[a+4>>2]=b;return}function jp(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;return Ld(a,b,c,d,0)|0}function kp(a,b){a=a|0;b=b|0;jk(a,b);return}function lp(a){a=a|0;f[a+4>>2]=0;f[a+8>>2]=0;f[a>>2]=a+4;return}function mp(){var a=0;a=ln(84)|0;eo(a);return a|0}function np(a){a=a|0;ui(a);Oq(a);return}function op(a){a=a|0;f[a>>2]=0;f[a+4>>2]=0;f[a+8>>2]=0;return}function pp(a){a=a|0;f[a>>2]=7236;Am(a+4|0);return}function qp(a,b,c){a=a|0;b=b|0;c=c|0;return Ra[a&127](b|0,c|0)|0}function rp(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;aa(10)}function sp(a){a=a|0;return (a&255)<<24|(a>>8&255)<<16|(a>>16&255)<<8|a>>>24|0}function tp(a){a=a|0;To(a);f[a>>2]=3836;return}function up(a,c){a=a|0;c=c|0;b[a>>0]=b[c>>0]|0;return}function vp(a,b,c){a=a|0;b=b|0;c=c|0;return -1}function wp(a,c){a=a|0;c=c|0;return b[(f[a>>2]|0)+c>>0]|0}function xp(a){a=a|0;return (f[a+4>>2]|0)-(f[a>>2]|0)|0}function yp(a){a=a|0;mj(a);Oq(a);return}function zp(a){a=a|0;if(!a)return;Oq(a);return}function Ap(a){a=a|0;n[a>>2]=$(1.0);f[a+4>>2]=1;return}function Bp(a){a=a|0;b[a+28>>0]=1;return}function Cp(a,b){a=a|0;b=b|0;if(!x){x=a;y=b}}function Dp(a){a=a|0;ji(a);return}function Ep(a,b){a=a|0;b=b|0;return 1}function Fp(a){a=a|0;return a+12|0}function Gp(a,b){a=a|0;b=b|0;f[a+80>>2]=b;return}function Hp(a,b,c){a=a|0;b=b|0;c=c|0;Wa[a&7](b|0,c|0)}function Ip(){var a=0;a=ln(36)|0;qq(a);return a|0}function Jp(a){a=a|0;return gq(a+4|0)|0}function Kp(){var a=0;a=ln(108)|0;jn(a);return a|0}function Lp(a){a=a|0;return (b[a+32>>0]|0)!=0|0}function Mp(a){a=a|0;return a+-12|0}function Np(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;aa(9)}function Op(){var a=0;a=f[4927]|0;f[4927]=a+0;return a|0}function Pp(a){a=a|0;return f[a+56>>2]|0}function Qp(){var a=0;a=f[1786]|0;f[1786]=a+0;return a|0}function Rp(a){a=a|0;Og(a);Oq(a);return}function Sp(a){a=a|0;Sq(a);Oq(a);return}function Tp(a){a=a|0;return b[a+24>>0]|0}function Up(a,b){a=a|0;b=b|0;return 0}function Vp(a){a=a|0;return f[a+40>>2]|0}function Wp(a){a=a|0;return f[a+48>>2]|0}function Xp(a,b){a=a|0;b=b|0;return Qa[a&127](b|0)|0}function Yp(a){a=a|0;return f[a+60>>2]|0}function Zp(a){a=a|0;return f[a+28>>2]|0}function _p(a){a=a|0;sa(a|0)|0;om()}function $p(a){a=a|0;pp(a);Oq(a);return}function aq(a){a=a|0;Ca()}function bq(a,b){a=a|0;b=b|0;return $(+Bk(a,b,0))}function cq(a){a=a|0;return 3}function dq(a,b){a=a|0;b=b|0;u=a;v=b}function eq(a){a=a|0;return ((a|0)==32|(a+-9|0)>>>0<5)&1|0}function fq(a){a=a|0;return f[a+80>>2]|0}function gq(a){a=a|0;return f[a>>2]|0}function hq(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;aa(8)}function iq(a,b){a=a|0;b=b|0;Va[a&127](b|0)}function jq(a,b){a=a|0;b=b|0;return Wn(a,b)|0}function kq(a){a=a|0;return a&255|0}function lq(a){a=a|0;return Gj(a)|0}function mq(a,b){a=a|0;b=b|0;return +(+Bk(a,b,1))}function nq(a,b,c){a=a|0;b=b|0;c=c|0;aa(2);return 0}function oq(a){a=a|0;return 2}function pq(a){a=a|0;return 1}function qq(a){a=a|0;Dp(a);return}function rq(a,b){a=+a;b=+b;return +(+Yl(a,b))}function sq(a,b){a=+a;b=b|0;return +(+bk(a,b))}function tq(a,b){a=+a;b=b|0;return +(+ak(a,b))}function uq(){return 3}function vq(a,b,c){a=a|0;b=b|0;c=c|0;aa(7)}function wq(){return 0}function xq(){return -1}function yq(){return ln(1)|0}function zq(){return 4}function Aq(a){a=a|0;return (a+-48|0)>>>0<10|0}function Bq(){return 1}function Cq(){return 2}function Dq(a,b){a=+a;b=+b;return +(+xd(a,b))}function Eq(a,b){a=a|0;b=b|0;aa(1);return 0}function Fq(a){a=a|0;Ha()}function Gq(a){a=a|0;Ua[a&3]()}function Hq(){ua()}function Iq(a){a=a|0;return +(+mq(a,0))}function Jq(){return Yq()|0}function Kq(a,b){a=a|0;b=b|0;aa(6)}function Lq(a){a=a|0;return ln(a)|0}function Mq(a){a=a|0;Oq(a);return}function Nq(a){a=a|0;u=a}function Oq(a){a=a|0;yc(a);return}function Pq(a){a=a|0;I=a}function Qq(a){a=a|0;return a|0}function Rq(a){a=a|0;aa(0);return 0}function Sq(a){a=a|0;return}function Tq(a){a=a|0;return 0}function Uq(){return I|0}function Vq(){return 19632}function Wq(){return u|0}function Xq(a){a=a|0;aa(5)}function Yq(){return 6352}function Zq(){aa(4)} - -// EMSCRIPTEN_END_FUNCS -var Qa=[Rq,oq,pq,pq,oq,gb,Tq,Tq,Tq,hk,kg,pq,Wo,Tq,Tq,pq,Tq,pq,pq,yl,oq,yl,cq,wl,pq,co,wl,pq,fo,cl,pq,Zp,Rn,yl,pq,yl,oq,yl,cq,wl,pq,co,wl,pq,fo,cl,pq,Zp,Rn,yl,pq,cq,Tq,Wo,pq,Tq,pq,cq,pq,ql,oq,ql,Rn,ql,cq,pl,pq,co,pl,pq,fo,Wk,pq,Zp,pq,ql,oq,ql,Rn,ql,cq,pl,pq,co,pl,pq,fo,Wk,pq,Zp,pq,oq,pq,pq,Nd,pq,Vo,Xe,mh,zk,po,ko,pb,Qo,Wo,Mg,Wg,Lf,rb,Qo,Wo,pq,Tq,Tq,zc,Ki,Tq,pq,pq,Uj,Tq,Uj,ck,rn,Jp,Rq,Rq,Rq];var Ra=[Eq,xl,nh,Ie,El,Up,Up,Up,Ep,jb,rj,wo,Ep,Ep,ti,nj,ii,kk,ol,Qj,$k,dk,ek,Te,Go,Up,ni,Up,Pl,$d,Up,Pl,nf,Up,Ml,sh,mm,Ed,Up,Pl,$d,Up,Pl,nf,Up,Ml,sh,mm,Ed,Cn,Go,Up,li,Dd,Up,Fl,Zd,Up,Fl,hf,Up,Bl,rh,mm,Dd,Up,Fl,Zd,Up,Fl,hf,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];var _a=[rp,Rl,Sk,rp];return{___cxa_can_catch:lm,___cxa_is_pointer_type:Ao,___divdi3:Ik,___muldi3:un,___udivdi3:jp,___uremdi3:hn,_bitshift64Lshr:Yn,_bitshift64Shl:Tn,_emscripten_bind_DracoInt8Array_DracoInt8Array_0:dp,_emscripten_bind_DracoInt8Array_GetValue_1:No,_emscripten_bind_DracoInt8Array___destroy___0:cn,_emscripten_bind_DracoInt8Array_size_0:xp,_emscripten_bind_Encoder_EncodeMeshToDracoBuffer_2:oo,_emscripten_bind_Encoder_EncodePointCloudToDracoBuffer_3:En,_emscripten_bind_Encoder_Encoder_0:Ip,_emscripten_bind_Encoder_SetAttributeExplicitQuantization_5:_m,_emscripten_bind_Encoder_SetAttributeQuantization_2:jo,_emscripten_bind_Encoder_SetEncodingMethod_1:bp,_emscripten_bind_Encoder_SetSpeedOptions_2:Jo,_emscripten_bind_Encoder___destroy___0:Wj,_emscripten_bind_GeometryAttribute_GeometryAttribute_0:So,_emscripten_bind_GeometryAttribute___destroy___0:zp,_emscripten_bind_MeshBuilder_AddFacesToMesh_3:no,_emscripten_bind_MeshBuilder_AddFloatAttributeToMesh_5:pn,_emscripten_bind_MeshBuilder_AddFloatAttribute_5:pn,_emscripten_bind_MeshBuilder_AddInt16Attribute_5:fn,_emscripten_bind_MeshBuilder_AddInt32AttributeToMesh_5:on,_emscripten_bind_MeshBuilder_AddInt32Attribute_5:on,_emscripten_bind_MeshBuilder_AddInt8Attribute_5:kn,_emscripten_bind_MeshBuilder_AddMetadataToMesh_2:ro,_emscripten_bind_MeshBuilder_AddMetadata_2:qo,_emscripten_bind_MeshBuilder_AddUInt16Attribute_5:an,_emscripten_bind_MeshBuilder_AddUInt32Attribute_5:$m,_emscripten_bind_MeshBuilder_AddUInt8Attribute_5:en,_emscripten_bind_MeshBuilder_MeshBuilder_0:yq,_emscripten_bind_MeshBuilder_SetMetadataForAttribute_3:Dn,_emscripten_bind_MeshBuilder___destroy___0:zp,_emscripten_bind_Mesh_Mesh_0:Kp,_emscripten_bind_Mesh___destroy___0:Co,_emscripten_bind_Mesh_num_attributes_0:hp,_emscripten_bind_Mesh_num_faces_0:ap,_emscripten_bind_Mesh_num_points_0:fq,_emscripten_bind_Mesh_set_num_points_1:Gp,_emscripten_bind_MetadataBuilder_AddDoubleEntry_3:bo,_emscripten_bind_MetadataBuilder_AddIntEntry_3:go,_emscripten_bind_MetadataBuilder_AddStringEntry_3:_n,_emscripten_bind_MetadataBuilder_MetadataBuilder_0:yq,_emscripten_bind_MetadataBuilder___destroy___0:zp,_emscripten_bind_Metadata_Metadata_0:Xl,_emscripten_bind_Metadata___destroy___0:Uo,_emscripten_bind_PointAttribute_PointAttribute_0:Zo,_emscripten_bind_PointAttribute___destroy___0:Ij,_emscripten_bind_PointAttribute_attribute_type_0:Pp,_emscripten_bind_PointAttribute_byte_offset_0:Wp,_emscripten_bind_PointAttribute_byte_stride_0:Vp,_emscripten_bind_PointAttribute_data_type_0:Zp,_emscripten_bind_PointAttribute_normalized_0:Lp,_emscripten_bind_PointAttribute_num_components_0:Tp,_emscripten_bind_PointAttribute_size_0:fq,_emscripten_bind_PointAttribute_unique_id_0:Yp,_emscripten_bind_PointCloudBuilder_AddFloatAttribute_5:pn,_emscripten_bind_PointCloudBuilder_AddInt16Attribute_5:fn,_emscripten_bind_PointCloudBuilder_AddInt32Attribute_5:on,_emscripten_bind_PointCloudBuilder_AddInt8Attribute_5:kn,_emscripten_bind_PointCloudBuilder_AddMetadata_2:qo,_emscripten_bind_PointCloudBuilder_AddUInt16Attribute_5:an,_emscripten_bind_PointCloudBuilder_AddUInt32Attribute_5:$m,_emscripten_bind_PointCloudBuilder_AddUInt8Attribute_5:en,_emscripten_bind_PointCloudBuilder_PointCloudBuilder_0:yq,_emscripten_bind_PointCloudBuilder_SetMetadataForAttribute_3:Dn,_emscripten_bind_PointCloudBuilder___destroy___0:zp,_emscripten_bind_PointCloud_PointCloud_0:mp,_emscripten_bind_PointCloud___destroy___0:Co,_emscripten_bind_PointCloud_num_attributes_0:hp,_emscripten_bind_PointCloud_num_points_0:fq,_emscripten_bind_VoidPtr___destroy___0:zp,_emscripten_enum_draco_EncodedGeometryType_INVALID_GEOMETRY_TYPE:xq,_emscripten_enum_draco_EncodedGeometryType_POINT_CLOUD:wq,_emscripten_enum_draco_EncodedGeometryType_TRIANGULAR_MESH:Bq,_emscripten_enum_draco_GeometryAttribute_Type_COLOR:Cq,_emscripten_enum_draco_GeometryAttribute_Type_GENERIC:zq,_emscripten_enum_draco_GeometryAttribute_Type_INVALID:xq,_emscripten_enum_draco_GeometryAttribute_Type_NORMAL:Bq,_emscripten_enum_draco_GeometryAttribute_Type_POSITION:wq,_emscripten_enum_draco_GeometryAttribute_Type_TEX_COORD:uq,_emscripten_enum_draco_MeshEncoderMethod_MESH_EDGEBREAKER_ENCODING:Bq,_emscripten_enum_draco_MeshEncoderMethod_MESH_SEQUENTIAL_ENCODING:wq,_emscripten_replace_memory:Pa,_free:yc,_i64Add:Vn,_i64Subtract:Xn,_llvm_bswap_i32:sp,_malloc:$a,_memcpy:kh,_memmove:im,_memset:sj,_sbrk:Nl,dynCall_ii:Xp,dynCall_iii:qp,dynCall_iiii:Mo,dynCall_iiiiiii:In,dynCall_v:Gq,dynCall_vi:iq,dynCall_vii:Hp,dynCall_viii:Yo,dynCall_viiii:Do,dynCall_viiiii:so,dynCall_viiiiii:Pn,establishStackSpace:dq,getTempRet0:Uq,runPostSets:Un,setTempRet0:Pq,setThrew:Cp,stackAlloc:_o,stackRestore:Nq,stackSave:Wq}}) - - -// EMSCRIPTEN_END_ASM -(Module.asmGlobalArg,Module.asmLibraryArg,buffer);var ___cxa_can_catch=Module["___cxa_can_catch"]=asm["___cxa_can_catch"];var ___cxa_is_pointer_type=Module["___cxa_is_pointer_type"]=asm["___cxa_is_pointer_type"];var ___divdi3=Module["___divdi3"]=asm["___divdi3"];var ___muldi3=Module["___muldi3"]=asm["___muldi3"];var ___udivdi3=Module["___udivdi3"]=asm["___udivdi3"];var ___uremdi3=Module["___uremdi3"]=asm["___uremdi3"];var _bitshift64Lshr=Module["_bitshift64Lshr"]=asm["_bitshift64Lshr"];var _bitshift64Shl=Module["_bitshift64Shl"]=asm["_bitshift64Shl"];var _emscripten_bind_DracoInt8Array_DracoInt8Array_0=Module["_emscripten_bind_DracoInt8Array_DracoInt8Array_0"]=asm["_emscripten_bind_DracoInt8Array_DracoInt8Array_0"];var _emscripten_bind_DracoInt8Array_GetValue_1=Module["_emscripten_bind_DracoInt8Array_GetValue_1"]=asm["_emscripten_bind_DracoInt8Array_GetValue_1"];var _emscripten_bind_DracoInt8Array___destroy___0=Module["_emscripten_bind_DracoInt8Array___destroy___0"]=asm["_emscripten_bind_DracoInt8Array___destroy___0"];var _emscripten_bind_DracoInt8Array_size_0=Module["_emscripten_bind_DracoInt8Array_size_0"]=asm["_emscripten_bind_DracoInt8Array_size_0"];var _emscripten_bind_Encoder_EncodeMeshToDracoBuffer_2=Module["_emscripten_bind_Encoder_EncodeMeshToDracoBuffer_2"]=asm["_emscripten_bind_Encoder_EncodeMeshToDracoBuffer_2"];var _emscripten_bind_Encoder_EncodePointCloudToDracoBuffer_3=Module["_emscripten_bind_Encoder_EncodePointCloudToDracoBuffer_3"]=asm["_emscripten_bind_Encoder_EncodePointCloudToDracoBuffer_3"];var _emscripten_bind_Encoder_Encoder_0=Module["_emscripten_bind_Encoder_Encoder_0"]=asm["_emscripten_bind_Encoder_Encoder_0"];var _emscripten_bind_Encoder_SetAttributeExplicitQuantization_5=Module["_emscripten_bind_Encoder_SetAttributeExplicitQuantization_5"]=asm["_emscripten_bind_Encoder_SetAttributeExplicitQuantization_5"];var _emscripten_bind_Encoder_SetAttributeQuantization_2=Module["_emscripten_bind_Encoder_SetAttributeQuantization_2"]=asm["_emscripten_bind_Encoder_SetAttributeQuantization_2"];var _emscripten_bind_Encoder_SetEncodingMethod_1=Module["_emscripten_bind_Encoder_SetEncodingMethod_1"]=asm["_emscripten_bind_Encoder_SetEncodingMethod_1"];var _emscripten_bind_Encoder_SetSpeedOptions_2=Module["_emscripten_bind_Encoder_SetSpeedOptions_2"]=asm["_emscripten_bind_Encoder_SetSpeedOptions_2"];var _emscripten_bind_Encoder___destroy___0=Module["_emscripten_bind_Encoder___destroy___0"]=asm["_emscripten_bind_Encoder___destroy___0"];var _emscripten_bind_GeometryAttribute_GeometryAttribute_0=Module["_emscripten_bind_GeometryAttribute_GeometryAttribute_0"]=asm["_emscripten_bind_GeometryAttribute_GeometryAttribute_0"];var _emscripten_bind_GeometryAttribute___destroy___0=Module["_emscripten_bind_GeometryAttribute___destroy___0"]=asm["_emscripten_bind_GeometryAttribute___destroy___0"];var _emscripten_bind_MeshBuilder_AddFacesToMesh_3=Module["_emscripten_bind_MeshBuilder_AddFacesToMesh_3"]=asm["_emscripten_bind_MeshBuilder_AddFacesToMesh_3"];var _emscripten_bind_MeshBuilder_AddFloatAttributeToMesh_5=Module["_emscripten_bind_MeshBuilder_AddFloatAttributeToMesh_5"]=asm["_emscripten_bind_MeshBuilder_AddFloatAttributeToMesh_5"];var _emscripten_bind_MeshBuilder_AddFloatAttribute_5=Module["_emscripten_bind_MeshBuilder_AddFloatAttribute_5"]=asm["_emscripten_bind_MeshBuilder_AddFloatAttribute_5"];var _emscripten_bind_MeshBuilder_AddInt16Attribute_5=Module["_emscripten_bind_MeshBuilder_AddInt16Attribute_5"]=asm["_emscripten_bind_MeshBuilder_AddInt16Attribute_5"];var _emscripten_bind_MeshBuilder_AddInt32AttributeToMesh_5=Module["_emscripten_bind_MeshBuilder_AddInt32AttributeToMesh_5"]=asm["_emscripten_bind_MeshBuilder_AddInt32AttributeToMesh_5"];var _emscripten_bind_MeshBuilder_AddInt32Attribute_5=Module["_emscripten_bind_MeshBuilder_AddInt32Attribute_5"]=asm["_emscripten_bind_MeshBuilder_AddInt32Attribute_5"];var _emscripten_bind_MeshBuilder_AddInt8Attribute_5=Module["_emscripten_bind_MeshBuilder_AddInt8Attribute_5"]=asm["_emscripten_bind_MeshBuilder_AddInt8Attribute_5"];var _emscripten_bind_MeshBuilder_AddMetadataToMesh_2=Module["_emscripten_bind_MeshBuilder_AddMetadataToMesh_2"]=asm["_emscripten_bind_MeshBuilder_AddMetadataToMesh_2"];var _emscripten_bind_MeshBuilder_AddMetadata_2=Module["_emscripten_bind_MeshBuilder_AddMetadata_2"]=asm["_emscripten_bind_MeshBuilder_AddMetadata_2"];var _emscripten_bind_MeshBuilder_AddUInt16Attribute_5=Module["_emscripten_bind_MeshBuilder_AddUInt16Attribute_5"]=asm["_emscripten_bind_MeshBuilder_AddUInt16Attribute_5"];var _emscripten_bind_MeshBuilder_AddUInt32Attribute_5=Module["_emscripten_bind_MeshBuilder_AddUInt32Attribute_5"]=asm["_emscripten_bind_MeshBuilder_AddUInt32Attribute_5"];var _emscripten_bind_MeshBuilder_AddUInt8Attribute_5=Module["_emscripten_bind_MeshBuilder_AddUInt8Attribute_5"]=asm["_emscripten_bind_MeshBuilder_AddUInt8Attribute_5"];var _emscripten_bind_MeshBuilder_MeshBuilder_0=Module["_emscripten_bind_MeshBuilder_MeshBuilder_0"]=asm["_emscripten_bind_MeshBuilder_MeshBuilder_0"];var _emscripten_bind_MeshBuilder_SetMetadataForAttribute_3=Module["_emscripten_bind_MeshBuilder_SetMetadataForAttribute_3"]=asm["_emscripten_bind_MeshBuilder_SetMetadataForAttribute_3"];var _emscripten_bind_MeshBuilder___destroy___0=Module["_emscripten_bind_MeshBuilder___destroy___0"]=asm["_emscripten_bind_MeshBuilder___destroy___0"];var _emscripten_bind_Mesh_Mesh_0=Module["_emscripten_bind_Mesh_Mesh_0"]=asm["_emscripten_bind_Mesh_Mesh_0"];var _emscripten_bind_Mesh___destroy___0=Module["_emscripten_bind_Mesh___destroy___0"]=asm["_emscripten_bind_Mesh___destroy___0"];var _emscripten_bind_Mesh_num_attributes_0=Module["_emscripten_bind_Mesh_num_attributes_0"]=asm["_emscripten_bind_Mesh_num_attributes_0"];var _emscripten_bind_Mesh_num_faces_0=Module["_emscripten_bind_Mesh_num_faces_0"]=asm["_emscripten_bind_Mesh_num_faces_0"];var _emscripten_bind_Mesh_num_points_0=Module["_emscripten_bind_Mesh_num_points_0"]=asm["_emscripten_bind_Mesh_num_points_0"];var _emscripten_bind_Mesh_set_num_points_1=Module["_emscripten_bind_Mesh_set_num_points_1"]=asm["_emscripten_bind_Mesh_set_num_points_1"];var _emscripten_bind_MetadataBuilder_AddDoubleEntry_3=Module["_emscripten_bind_MetadataBuilder_AddDoubleEntry_3"]=asm["_emscripten_bind_MetadataBuilder_AddDoubleEntry_3"];var _emscripten_bind_MetadataBuilder_AddIntEntry_3=Module["_emscripten_bind_MetadataBuilder_AddIntEntry_3"]=asm["_emscripten_bind_MetadataBuilder_AddIntEntry_3"];var _emscripten_bind_MetadataBuilder_AddStringEntry_3=Module["_emscripten_bind_MetadataBuilder_AddStringEntry_3"]=asm["_emscripten_bind_MetadataBuilder_AddStringEntry_3"];var _emscripten_bind_MetadataBuilder_MetadataBuilder_0=Module["_emscripten_bind_MetadataBuilder_MetadataBuilder_0"]=asm["_emscripten_bind_MetadataBuilder_MetadataBuilder_0"];var _emscripten_bind_MetadataBuilder___destroy___0=Module["_emscripten_bind_MetadataBuilder___destroy___0"]=asm["_emscripten_bind_MetadataBuilder___destroy___0"];var _emscripten_bind_Metadata_Metadata_0=Module["_emscripten_bind_Metadata_Metadata_0"]=asm["_emscripten_bind_Metadata_Metadata_0"];var _emscripten_bind_Metadata___destroy___0=Module["_emscripten_bind_Metadata___destroy___0"]=asm["_emscripten_bind_Metadata___destroy___0"];var _emscripten_bind_PointAttribute_PointAttribute_0=Module["_emscripten_bind_PointAttribute_PointAttribute_0"]=asm["_emscripten_bind_PointAttribute_PointAttribute_0"];var _emscripten_bind_PointAttribute___destroy___0=Module["_emscripten_bind_PointAttribute___destroy___0"]=asm["_emscripten_bind_PointAttribute___destroy___0"];var _emscripten_bind_PointAttribute_attribute_type_0=Module["_emscripten_bind_PointAttribute_attribute_type_0"]=asm["_emscripten_bind_PointAttribute_attribute_type_0"];var _emscripten_bind_PointAttribute_byte_offset_0=Module["_emscripten_bind_PointAttribute_byte_offset_0"]=asm["_emscripten_bind_PointAttribute_byte_offset_0"];var _emscripten_bind_PointAttribute_byte_stride_0=Module["_emscripten_bind_PointAttribute_byte_stride_0"]=asm["_emscripten_bind_PointAttribute_byte_stride_0"];var _emscripten_bind_PointAttribute_data_type_0=Module["_emscripten_bind_PointAttribute_data_type_0"]=asm["_emscripten_bind_PointAttribute_data_type_0"];var _emscripten_bind_PointAttribute_normalized_0=Module["_emscripten_bind_PointAttribute_normalized_0"]=asm["_emscripten_bind_PointAttribute_normalized_0"];var _emscripten_bind_PointAttribute_num_components_0=Module["_emscripten_bind_PointAttribute_num_components_0"]=asm["_emscripten_bind_PointAttribute_num_components_0"];var _emscripten_bind_PointAttribute_size_0=Module["_emscripten_bind_PointAttribute_size_0"]=asm["_emscripten_bind_PointAttribute_size_0"];var _emscripten_bind_PointAttribute_unique_id_0=Module["_emscripten_bind_PointAttribute_unique_id_0"]=asm["_emscripten_bind_PointAttribute_unique_id_0"];var _emscripten_bind_PointCloudBuilder_AddFloatAttribute_5=Module["_emscripten_bind_PointCloudBuilder_AddFloatAttribute_5"]=asm["_emscripten_bind_PointCloudBuilder_AddFloatAttribute_5"];var _emscripten_bind_PointCloudBuilder_AddInt16Attribute_5=Module["_emscripten_bind_PointCloudBuilder_AddInt16Attribute_5"]=asm["_emscripten_bind_PointCloudBuilder_AddInt16Attribute_5"];var _emscripten_bind_PointCloudBuilder_AddInt32Attribute_5=Module["_emscripten_bind_PointCloudBuilder_AddInt32Attribute_5"]=asm["_emscripten_bind_PointCloudBuilder_AddInt32Attribute_5"];var _emscripten_bind_PointCloudBuilder_AddInt8Attribute_5=Module["_emscripten_bind_PointCloudBuilder_AddInt8Attribute_5"]=asm["_emscripten_bind_PointCloudBuilder_AddInt8Attribute_5"];var _emscripten_bind_PointCloudBuilder_AddMetadata_2=Module["_emscripten_bind_PointCloudBuilder_AddMetadata_2"]=asm["_emscripten_bind_PointCloudBuilder_AddMetadata_2"];var _emscripten_bind_PointCloudBuilder_AddUInt16Attribute_5=Module["_emscripten_bind_PointCloudBuilder_AddUInt16Attribute_5"]=asm["_emscripten_bind_PointCloudBuilder_AddUInt16Attribute_5"];var _emscripten_bind_PointCloudBuilder_AddUInt32Attribute_5=Module["_emscripten_bind_PointCloudBuilder_AddUInt32Attribute_5"]=asm["_emscripten_bind_PointCloudBuilder_AddUInt32Attribute_5"];var _emscripten_bind_PointCloudBuilder_AddUInt8Attribute_5=Module["_emscripten_bind_PointCloudBuilder_AddUInt8Attribute_5"]=asm["_emscripten_bind_PointCloudBuilder_AddUInt8Attribute_5"];var _emscripten_bind_PointCloudBuilder_PointCloudBuilder_0=Module["_emscripten_bind_PointCloudBuilder_PointCloudBuilder_0"]=asm["_emscripten_bind_PointCloudBuilder_PointCloudBuilder_0"];var _emscripten_bind_PointCloudBuilder_SetMetadataForAttribute_3=Module["_emscripten_bind_PointCloudBuilder_SetMetadataForAttribute_3"]=asm["_emscripten_bind_PointCloudBuilder_SetMetadataForAttribute_3"];var _emscripten_bind_PointCloudBuilder___destroy___0=Module["_emscripten_bind_PointCloudBuilder___destroy___0"]=asm["_emscripten_bind_PointCloudBuilder___destroy___0"];var _emscripten_bind_PointCloud_PointCloud_0=Module["_emscripten_bind_PointCloud_PointCloud_0"]=asm["_emscripten_bind_PointCloud_PointCloud_0"];var _emscripten_bind_PointCloud___destroy___0=Module["_emscripten_bind_PointCloud___destroy___0"]=asm["_emscripten_bind_PointCloud___destroy___0"];var _emscripten_bind_PointCloud_num_attributes_0=Module["_emscripten_bind_PointCloud_num_attributes_0"]=asm["_emscripten_bind_PointCloud_num_attributes_0"];var _emscripten_bind_PointCloud_num_points_0=Module["_emscripten_bind_PointCloud_num_points_0"]=asm["_emscripten_bind_PointCloud_num_points_0"];var _emscripten_bind_VoidPtr___destroy___0=Module["_emscripten_bind_VoidPtr___destroy___0"]=asm["_emscripten_bind_VoidPtr___destroy___0"];var _emscripten_enum_draco_EncodedGeometryType_INVALID_GEOMETRY_TYPE=Module["_emscripten_enum_draco_EncodedGeometryType_INVALID_GEOMETRY_TYPE"]=asm["_emscripten_enum_draco_EncodedGeometryType_INVALID_GEOMETRY_TYPE"];var _emscripten_enum_draco_EncodedGeometryType_POINT_CLOUD=Module["_emscripten_enum_draco_EncodedGeometryType_POINT_CLOUD"]=asm["_emscripten_enum_draco_EncodedGeometryType_POINT_CLOUD"];var _emscripten_enum_draco_EncodedGeometryType_TRIANGULAR_MESH=Module["_emscripten_enum_draco_EncodedGeometryType_TRIANGULAR_MESH"]=asm["_emscripten_enum_draco_EncodedGeometryType_TRIANGULAR_MESH"];var _emscripten_enum_draco_GeometryAttribute_Type_COLOR=Module["_emscripten_enum_draco_GeometryAttribute_Type_COLOR"]=asm["_emscripten_enum_draco_GeometryAttribute_Type_COLOR"];var _emscripten_enum_draco_GeometryAttribute_Type_GENERIC=Module["_emscripten_enum_draco_GeometryAttribute_Type_GENERIC"]=asm["_emscripten_enum_draco_GeometryAttribute_Type_GENERIC"];var _emscripten_enum_draco_GeometryAttribute_Type_INVALID=Module["_emscripten_enum_draco_GeometryAttribute_Type_INVALID"]=asm["_emscripten_enum_draco_GeometryAttribute_Type_INVALID"];var _emscripten_enum_draco_GeometryAttribute_Type_NORMAL=Module["_emscripten_enum_draco_GeometryAttribute_Type_NORMAL"]=asm["_emscripten_enum_draco_GeometryAttribute_Type_NORMAL"];var _emscripten_enum_draco_GeometryAttribute_Type_POSITION=Module["_emscripten_enum_draco_GeometryAttribute_Type_POSITION"]=asm["_emscripten_enum_draco_GeometryAttribute_Type_POSITION"];var _emscripten_enum_draco_GeometryAttribute_Type_TEX_COORD=Module["_emscripten_enum_draco_GeometryAttribute_Type_TEX_COORD"]=asm["_emscripten_enum_draco_GeometryAttribute_Type_TEX_COORD"];var _emscripten_enum_draco_MeshEncoderMethod_MESH_EDGEBREAKER_ENCODING=Module["_emscripten_enum_draco_MeshEncoderMethod_MESH_EDGEBREAKER_ENCODING"]=asm["_emscripten_enum_draco_MeshEncoderMethod_MESH_EDGEBREAKER_ENCODING"];var _emscripten_enum_draco_MeshEncoderMethod_MESH_SEQUENTIAL_ENCODING=Module["_emscripten_enum_draco_MeshEncoderMethod_MESH_SEQUENTIAL_ENCODING"]=asm["_emscripten_enum_draco_MeshEncoderMethod_MESH_SEQUENTIAL_ENCODING"];var _emscripten_replace_memory=Module["_emscripten_replace_memory"]=asm["_emscripten_replace_memory"];var _free=Module["_free"]=asm["_free"];var _i64Add=Module["_i64Add"]=asm["_i64Add"];var _i64Subtract=Module["_i64Subtract"]=asm["_i64Subtract"];var _llvm_bswap_i32=Module["_llvm_bswap_i32"]=asm["_llvm_bswap_i32"];var _malloc=Module["_malloc"]=asm["_malloc"];var _memcpy=Module["_memcpy"]=asm["_memcpy"];var _memmove=Module["_memmove"]=asm["_memmove"];var _memset=Module["_memset"]=asm["_memset"];var _sbrk=Module["_sbrk"]=asm["_sbrk"];var establishStackSpace=Module["establishStackSpace"]=asm["establishStackSpace"];var getTempRet0=Module["getTempRet0"]=asm["getTempRet0"];var runPostSets=Module["runPostSets"]=asm["runPostSets"];var setTempRet0=Module["setTempRet0"]=asm["setTempRet0"];var setThrew=Module["setThrew"]=asm["setThrew"];var stackAlloc=Module["stackAlloc"]=asm["stackAlloc"];var stackRestore=Module["stackRestore"]=asm["stackRestore"];var stackSave=Module["stackSave"]=asm["stackSave"];var dynCall_ii=Module["dynCall_ii"]=asm["dynCall_ii"];var dynCall_iii=Module["dynCall_iii"]=asm["dynCall_iii"];var dynCall_iiii=Module["dynCall_iiii"]=asm["dynCall_iiii"];var dynCall_iiiiiii=Module["dynCall_iiiiiii"]=asm["dynCall_iiiiiii"];var dynCall_v=Module["dynCall_v"]=asm["dynCall_v"];var dynCall_vi=Module["dynCall_vi"]=asm["dynCall_vi"];var dynCall_vii=Module["dynCall_vii"]=asm["dynCall_vii"];var dynCall_viii=Module["dynCall_viii"]=asm["dynCall_viii"];var dynCall_viiii=Module["dynCall_viiii"]=asm["dynCall_viiii"];var dynCall_viiiii=Module["dynCall_viiiii"]=asm["dynCall_viiiii"];var dynCall_viiiiii=Module["dynCall_viiiiii"]=asm["dynCall_viiiiii"];Module["asm"]=asm;if(memoryInitializer){if(!isDataURI(memoryInitializer)){if(typeof Module["locateFile"]==="function"){memoryInitializer=Module["locateFile"](memoryInitializer)}else if(Module["memoryInitializerPrefixURL"]){memoryInitializer=Module["memoryInitializerPrefixURL"]+memoryInitializer}}if(ENVIRONMENT_IS_NODE||ENVIRONMENT_IS_SHELL){var data=Module["readBinary"](memoryInitializer);HEAPU8.set(data,GLOBAL_BASE)}else{addRunDependency("memory initializer");var applyMemoryInitializer=(function(data){if(data.byteLength)data=new Uint8Array(data);HEAPU8.set(data,GLOBAL_BASE);if(Module["memoryInitializerRequest"])delete Module["memoryInitializerRequest"].response;removeRunDependency("memory initializer")});function doBrowserLoad(){Module["readAsync"](memoryInitializer,applyMemoryInitializer,(function(){throw"could not load memory initializer "+memoryInitializer}))}var memoryInitializerBytes=tryParseAsDataURI(memoryInitializer);if(memoryInitializerBytes){applyMemoryInitializer(memoryInitializerBytes.buffer)}else if(Module["memoryInitializerRequest"]){function useRequest(){var request=Module["memoryInitializerRequest"];var response=request.response;if(request.status!==200&&request.status!==0){var data=tryParseAsDataURI(Module["memoryInitializerRequestURL"]);if(data){response=data.buffer}else{console.warn("a problem seems to have happened with Module.memoryInitializerRequest, status: "+request.status+", retrying "+memoryInitializer);doBrowserLoad();return}}applyMemoryInitializer(response)}if(Module["memoryInitializerRequest"].response){setTimeout(useRequest,0)}else{Module["memoryInitializerRequest"].addEventListener("load",useRequest)}}else{doBrowserLoad()}}}Module["then"]=(function(func){if(Module["calledRun"]){func(Module)}else{var old=Module["onRuntimeInitialized"];Module["onRuntimeInitialized"]=(function(){if(old)old();func(Module)})}return Module});function ExitStatus(status){this.name="ExitStatus";this.message="Program terminated with exit("+status+")";this.status=status}ExitStatus.prototype=new Error;ExitStatus.prototype.constructor=ExitStatus;var initialStackTop;dependenciesFulfilled=function runCaller(){if(!Module["calledRun"])run();if(!Module["calledRun"])dependenciesFulfilled=runCaller};function run(args){args=args||Module["arguments"];if(runDependencies>0){return}preRun();if(runDependencies>0)return;if(Module["calledRun"])return;function doRun(){if(Module["calledRun"])return;Module["calledRun"]=true;if(ABORT)return;ensureInitRuntime();preMain();if(Module["onRuntimeInitialized"])Module["onRuntimeInitialized"]();postRun()}if(Module["setStatus"]){Module["setStatus"]("Running...");setTimeout((function(){setTimeout((function(){Module["setStatus"]("")}),1);doRun()}),1)}else{doRun()}}Module["run"]=run;function exit(status,implicit){if(implicit&&Module["noExitRuntime"]&&status===0){return}if(Module["noExitRuntime"]){}else{ABORT=true;EXITSTATUS=status;STACKTOP=initialStackTop;exitRuntime();if(Module["onExit"])Module["onExit"](status)}if(ENVIRONMENT_IS_NODE){process["exit"](status)}Module["quit"](status,new ExitStatus(status))}Module["exit"]=exit;function abort(what){if(Module["onAbort"]){Module["onAbort"](what)}if(what!==undefined){Module.print(what);Module.printErr(what);what=JSON.stringify(what)}else{what=""}ABORT=true;EXITSTATUS=1;throw"abort("+what+"). Build with -s ASSERTIONS=1 for more info."}Module["abort"]=abort;if(Module["preInit"]){if(typeof Module["preInit"]=="function")Module["preInit"]=[Module["preInit"]];while(Module["preInit"].length>0){Module["preInit"].pop()()}}Module["noExitRuntime"]=true;run();function WrapperObject(){}WrapperObject.prototype=Object.create(WrapperObject.prototype);WrapperObject.prototype.constructor=WrapperObject;WrapperObject.prototype.__class__=WrapperObject;WrapperObject.__cache__={};Module["WrapperObject"]=WrapperObject;function getCache(__class__){return(__class__||WrapperObject).__cache__}Module["getCache"]=getCache;function wrapPointer(ptr,__class__){var cache=getCache(__class__);var ret=cache[ptr];if(ret)return ret;ret=Object.create((__class__||WrapperObject).prototype);ret.ptr=ptr;return cache[ptr]=ret}Module["wrapPointer"]=wrapPointer;function castObject(obj,__class__){return wrapPointer(obj.ptr,__class__)}Module["castObject"]=castObject;Module["NULL"]=wrapPointer(0);function destroy(obj){if(!obj["__destroy__"])throw"Error: Cannot destroy object. (Did you create it yourself?)";obj["__destroy__"]();delete getCache(obj.__class__)[obj.ptr]}Module["destroy"]=destroy;function compare(obj1,obj2){return obj1.ptr===obj2.ptr}Module["compare"]=compare;function getPointer(obj){return obj.ptr}Module["getPointer"]=getPointer;function getClass(obj){return obj.__class__}Module["getClass"]=getClass;var ensureCache={buffer:0,size:0,pos:0,temps:[],needed:0,prepare:(function(){if(ensureCache.needed){for(var i=0;i=ensureCache.size){assert(len>0);ensureCache.needed+=len;ret=Module["_malloc"](len);ensureCache.temps.push(ret)}else{ret=ensureCache.buffer+ensureCache.pos;ensureCache.pos+=len}return ret}),copy:(function(array,view,offset){var offsetShifted=offset;var bytes=view.BYTES_PER_ELEMENT;switch(bytes){case 2:offsetShifted>>=1;break;case 4:offsetShifted>>=2;break;case 8:offsetShifted>>=3;break}for(var i=0;i=0&&o<=126||o>=161&&o<=223)&&a0;){var n=this.getUint8();if(t--,0===n)break;e+=String.fromCharCode(n)}for(;t>0;)this.getUint8(),t--;return e},getSjisStringsAsUnicode:function(t){for(var e=[];t>0;){var n=this.getUint8();if(t--,0===n)break;e.push(n)}for(;t>0;)this.getUint8(),t--;return this.encoder.s2u(new Uint8Array(e))},getUnicodeStrings:function(t){for(var e="";t>0;){var n=this.getUint16();if(t-=2,0===n)break;e+=String.fromCharCode(n)}for(;t>0;)this.getUint8(),t--;return e},getTextBuffer:function(){var t=this.getUint32();return this.getUnicodeStrings(t)}},a.prototype={constructor:a,leftToRightVector3:function(t){t[2]=-t[2]},leftToRightQuaternion:function(t){t[0]=-t[0],t[1]=-t[1]},leftToRightEuler:function(t){t[0]=-t[0],t[1]=-t[1]},leftToRightIndexOrder:function(t){var e=t[2];t[2]=t[0],t[0]=e},leftToRightVector3Range:function(t,e){var n=-e[2];e[2]=-t[2],t[2]=n},leftToRightEulerRange:function(t,e){var n=-e[0],a=-e[1];e[0]=-t[0],e[1]=-t[1],t[0]=n,t[1]=a}},o.prototype.parsePmd=function(t,e){var a={},o=new n(t);a.metadata={},a.metadata.format="pmd",a.metadata.coordinateSystem="left";var i=function(){var t=a.metadata;if(t.magic=o.getChars(3),"Pmd"!==t.magic)throw"PMD file magic is not Pmd, but "+t.magic;t.version=o.getFloat32(),t.modelName=o.getSjisStringsAsUnicode(20),t.comment=o.getSjisStringsAsUnicode(256)},r=function(){var t=function(){var t={};return t.position=o.getFloat32Array(3),t.normal=o.getFloat32Array(3),t.uv=o.getFloat32Array(2),t.skinIndices=o.getUint16Array(2),t.skinWeights=[o.getUint8()/100],t.skinWeights.push(1-t.skinWeights[0]),t.edgeFlag=o.getUint8(),t},e=a.metadata;e.vertexCount=o.getUint32(),a.vertices=[];for(var n=0;n0&&(t.englishModelName=o.getSjisStringsAsUnicode(20),t.englishComment=o.getSjisStringsAsUnicode(256))},p=function(){var t=function(){var t={};return t.name=o.getSjisStringsAsUnicode(20),t},e=a.metadata;if(0!==e.englishCompatibility){a.englishBoneNames=[];for(var n=0;nABCD - Any Body Can Dance movie in hindi torrent download

      Download Filehttps://urloso.com/2uyORC



      -
      - aaccfb2cb3
      -
      -
      -

      diff --git a/spaces/bioriAsaeru/text-to-voice/Darksiders 2 Official Strategy Guide 19 Secrets and Easter Eggs Revealed.md b/spaces/bioriAsaeru/text-to-voice/Darksiders 2 Official Strategy Guide 19 Secrets and Easter Eggs Revealed.md deleted file mode 100644 index bf9b7f102f1928cd7c23a3e021abfebf2e3f3e54..0000000000000000000000000000000000000000 --- a/spaces/bioriAsaeru/text-to-voice/Darksiders 2 Official Strategy Guide 19 Secrets and Easter Eggs Revealed.md +++ /dev/null @@ -1,6 +0,0 @@ -

      Darksiders 2 Official Strategy Guide 19


      Downloadhttps://urloso.com/2uyROo



      -
      - aaccfb2cb3
      -
      -
      -

      diff --git a/spaces/bioriAsaeru/text-to-voice/Driver Talent Pro 7.1.28.102 ((NEW)) Crack With Activation Key 2020.md b/spaces/bioriAsaeru/text-to-voice/Driver Talent Pro 7.1.28.102 ((NEW)) Crack With Activation Key 2020.md deleted file mode 100644 index 2b6bd78627c6a71ccdee4ea0e3a13f29515ee519..0000000000000000000000000000000000000000 --- a/spaces/bioriAsaeru/text-to-voice/Driver Talent Pro 7.1.28.102 ((NEW)) Crack With Activation Key 2020.md +++ /dev/null @@ -1,48 +0,0 @@ -
      -

      Driver Talent Pro 7.1.28.102 Crack with Activation Key 2020: A Review

      - -

      If you are looking for a software that can help you find and update all the drivers on your Windows computer, then you should check out Driver Talent Pro 7.1.28.102 Crack with Activation Key 2020. This software is a powerful and easy-to-use tool that scans your system for outdated, missing, or corrupted drivers and downloads and installs the latest versions automatically. In this article, we will review the features and benefits of Driver Talent Pro 7.1.28.102 Crack with Activation Key 2020 and show you how to download and install it on your Windows computer.

      - -

      What is Driver Talent Pro 7.1.28.102 Crack with Activation Key 2020?

      - -

      Driver Talent Pro 7.1.28.102 Crack with Activation Key 2020 is the latest version of the popular driver updater software from OSToto Co., Ltd. It comes with new features and improvements that make it more user-friendly and efficient. Some of the highlights include:

      -

      Driver Talent Pro 7.1.28.102 Crack with Activation Key 2020


      Download Zip ––– https://urloso.com/2uyPJC



      - -
        -
      • A one-click solution to fix all driver issues and errors.
      • -
      • A fast and reliable scan of your system for outdated, missing, or corrupted drivers.
      • -
      • A huge database of over 500,000 drivers for all kinds of devices and hardware.
      • -
      • An automatic download and installation of the latest and compatible drivers for your system.
      • -
      • A backup and restore feature that allows you to save and restore your drivers in case of system crash or reinstall.
      • -
      • A pre-download feature that allows you to download drivers for another computer or device.
      • -
      • A game component update feature that ensures the best performance of your games.
      • -
      • A driver uninstall feature that removes unwanted or problematic drivers from your system.
      • -
      - -

      With Driver Talent Pro 7.1.28.102 Crack with Activation Key 2020, you can keep your system running smoothly and efficiently, without any driver issues or errors. You can also save your time and energy by letting the software do all the work for you.

      - -

      How to use Driver Talent Pro 7.1.28.102 Crack with Activation Key 2020?

      - -

      To use Driver Talent Pro 7.1.28.102 Crack with Activation Key 2020, you need to follow these simple steps:

      - -
        -
      1. Download and install the software from the link below.
      2. -
      3. Run the software and click on the Scan button to scan your system for driver issues.
      4. -
      5. Click on the Repair or Update button to fix or update the drivers automatically.
      6. -
      7. Restart your computer to apply the changes.
      8. -
      9. Enjoy your system with updated and optimized drivers.
      10. -
      - -

      Driver Talent Pro 7.1.28.102 Crack with Activation Key 2020 is a great software for anyone who wants to keep their system up-to-date and error-free with the latest drivers. It is easy to use, fast and reliable, and supports all Windows versions from XP to 10. You can download it from the link below and enjoy it for free with the crack and activation key provided.

      - -

      Download Driver Talent Pro 7.1.28.102 Crack with Activation Key 2020

      - -

      To download Driver Talent Pro 7.1.28.102 Crack with Activation Key 2020, click on the button below and follow the instructions.

      - -Download Driver Talent Pro 7.1.28.102 Crack with Activation Key 2020 - -

      We hope you enjoyed this article and found it useful. If you have any questions or feedback, please leave a comment below.

      -

      -Driver Talent Pro 7.1.28.102 Crack with Activation Key 2020 is a software that you should not miss if you want to keep your system updated and error-free with the latest drivers. It is easy to use, versatile, and supports all Windows versions from XP to 10. You can download it for free from the link below and use the crack and activation key provided to activate it. We hope you liked this article and found it helpful. If you have any questions or feedback, please leave a comment below.

      3cee63e6c2
      -
      -
      \ No newline at end of file diff --git a/spaces/bioriAsaeru/text-to-voice/Exchange Server 2010 Administration Real World Skills For MCITP Certification And Beyond (Exams 70- Fix.md b/spaces/bioriAsaeru/text-to-voice/Exchange Server 2010 Administration Real World Skills For MCITP Certification And Beyond (Exams 70- Fix.md deleted file mode 100644 index 7d0d84a4c259fad70a82670cc919b70b26b3f161..0000000000000000000000000000000000000000 --- a/spaces/bioriAsaeru/text-to-voice/Exchange Server 2010 Administration Real World Skills For MCITP Certification And Beyond (Exams 70- Fix.md +++ /dev/null @@ -1,6 +0,0 @@ -

      Exchange Server 2010 Administration: Real World Skills for MCITP Certification and Beyond (Exams 70-


      Downloadhttps://urloso.com/2uyOeM



      -
      - aaccfb2cb3
      -
      -
      -

      diff --git a/spaces/bofenghuang/speech-to-text/run_demo.py b/spaces/bofenghuang/speech-to-text/run_demo.py deleted file mode 100644 index df9628d3c13cc728c9bc19dd722a15b373f3560b..0000000000000000000000000000000000000000 --- a/spaces/bofenghuang/speech-to-text/run_demo.py +++ /dev/null @@ -1,83 +0,0 @@ -import logging -import warnings - -import gradio as gr -import librosa -# import torchaudio -from transformers import pipeline -from transformers.utils.logging import disable_progress_bar - -warnings.filterwarnings("ignore") - -disable_progress_bar() - -logging.basicConfig( - format="%(asctime)s [%(levelname)s] [%(name)s] %(message)s", - datefmt="%Y-%m-%dT%H:%M:%SZ", -) -logger = logging.getLogger(__name__) -logger.setLevel(logging.DEBUG) - -MODEL_NAME = "bofenghuang/asr-wav2vec2-ctc-french" -SAMPLE_RATE = 16_000 - -pipe = pipeline(model=MODEL_NAME) -logger.info("ASR pipeline has been initialized") - - -def process_audio_file(audio_file): - # waveform, sample_rate = torchaudio.load(audio_file) - # waveform = waveform.squeeze(axis=0) # mono - # # resample - # if sample_rate != SAMPLE_RATE: - # resampler = torchaudio.transforms.Resample(sample_rate, SAMPLE_RATE) - # waveform = resampler(waveform) - - waveform, sample_rate = librosa.load(audio_file, mono=True) - # resample - if sample_rate != SAMPLE_RATE: - waveform = librosa.resample(waveform, orig_sr=sample_rate, target_sr=SAMPLE_RATE) - - return waveform - - -def transcribe(microphone_audio_file, uploaded_audio_file): - warning_message = "" - if (microphone_audio_file is not None) and (uploaded_audio_file is not None): - warning_message = ( - "WARNING: You've uploaded an audio file and used the microphone. " - "The recorded file from the microphone will be used and the uploaded audio will be discarded.\n" - ) - audio_file = microphone_audio_file - elif (microphone_audio_file is None) and (uploaded_audio_file is None): - return "ERROR: You have to either use the microphone or upload an audio file" - elif microphone_audio_file is not None: - audio_file = microphone_audio_file - else: - audio_file = uploaded_audio_file - - audio_data = process_audio_file(audio_file) - - # text = pipe(audio_data)["text"] - text = pipe(audio_data, chunk_length_s=30, stride_length_s=5)["text"] - logger.info(f"Transcription for {audio_file}: {text}") - - return warning_message + text - - -iface = gr.Interface( - fn=transcribe, - inputs=[ - gr.Audio(source="microphone", type="filepath", label="Record something...", optional=True), - gr.Audio(source="upload", type="filepath", label="Upload some audio file...", optional=True), - ], - outputs="text", - layout="horizontal", - # theme="huggingface", - title="Speech-to-Text in French", - description=f"Realtime demo for French automatic speech recognition. Demo uses the the fine-tuned checkpoint [{MODEL_NAME}](https://huggingface.co/{MODEL_NAME}) and 🤗 Transformers to transcribe audio files of arbitrary length.", - allow_flagging="never", -) - -# iface.launch(server_name="0.0.0.0", debug=True, share=True) -iface.launch(enable_queue=True) diff --git a/spaces/boli-ai/OIT/README.md b/spaces/boli-ai/OIT/README.md deleted file mode 100644 index fb31e4d475466a1e13b697d9b54c2d5f05790b09..0000000000000000000000000000000000000000 --- a/spaces/boli-ai/OIT/README.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -title: Open Indic Translator -emoji: 👀 -colorFrom: indigo -colorTo: gray -sdk: gradio -sdk_version: 3.0.25 -app_file: app.py -pinned: false -license: apache-2.0 ---- - -Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference diff --git a/spaces/bradarrML/stablediffusion-infinity/PyPatchMatch/examples/py_example.py b/spaces/bradarrML/stablediffusion-infinity/PyPatchMatch/examples/py_example.py deleted file mode 100644 index fa1b526f87b065a6acda35e06d563be134ffb27b..0000000000000000000000000000000000000000 --- a/spaces/bradarrML/stablediffusion-infinity/PyPatchMatch/examples/py_example.py +++ /dev/null @@ -1,21 +0,0 @@ -#! /usr/bin/env python3 -# -*- coding: utf-8 -*- -# File : test.py -# Author : Jiayuan Mao -# Email : maojiayuan@gmail.com -# Date : 01/09/2020 -# -# Distributed under terms of the MIT license. - -from PIL import Image - -import sys -sys.path.insert(0, '../') -import patch_match - - -if __name__ == '__main__': - source = Image.open('./images/forest_pruned.bmp') - result = patch_match.inpaint(source, patch_size=3) - Image.fromarray(result).save('./images/forest_recovered.bmp') - diff --git a/spaces/brainblow/AudioCreator_Music-Audio_Generation/tests/modules/test_transformer.py b/spaces/brainblow/AudioCreator_Music-Audio_Generation/tests/modules/test_transformer.py deleted file mode 100644 index 2bb79bfd58d535469f9b3c56b8a5fe254db5d8ba..0000000000000000000000000000000000000000 --- a/spaces/brainblow/AudioCreator_Music-Audio_Generation/tests/modules/test_transformer.py +++ /dev/null @@ -1,253 +0,0 @@ -# Copyright (c) Meta Platforms, Inc. and affiliates. -# All rights reserved. -# -# This source code is licensed under the license found in the -# LICENSE file in the root directory of this source tree. - -from itertools import product - -import pytest -import torch - -from audiocraft.modules.transformer import ( - StreamingMultiheadAttention, StreamingTransformer, set_efficient_attention_backend) - - -def test_transformer_causal_streaming(): - torch.manual_seed(1234) - - for context, custom in product([None, 10], [False, True]): - # Test that causality and receptive fields are properly handled. - # looking at the gradients - tr = StreamingTransformer( - 16, 4, 1 if context else 2, - causal=True, past_context=context, custom=custom, - dropout=0.) - steps = 20 - for k in [0, 10, 15, 19]: - x = torch.randn(4, steps, 16, requires_grad=True) - y = tr(x) - y[:, k].abs().sum().backward() - if k + 1 < steps: - assert torch.allclose(x.grad[:, k + 1:], torch.tensor(0.)), x.grad[:, k + 1:].norm() - assert not torch.allclose(x.grad[:, :k + 1], torch.tensor(0.)), x.grad[:, :k + 1].norm() - if context is not None and k > context: - limit = k - context - 1 - assert torch.allclose(x.grad[:, :limit], - torch.tensor(0.)), x.grad[:, :limit].norm() - - # Now check that streaming gives the same result at batch eval. - x = torch.randn(4, steps, 16) - y = tr(x) - ys = [] - with tr.streaming(): - for k in range(steps): - chunk = x[:, k:k + 1, :] - ys.append(tr(chunk)) - y_stream = torch.cat(ys, dim=1) - delta = torch.norm(y_stream - y) / torch.norm(y) - assert delta < 1e-6, delta - - -def test_transformer_vs_pytorch(): - torch.manual_seed(1234) - # Check that in the non causal setting, we get the same result as - # PyTorch Transformer encoder. - for custom in [False, True]: - tr = StreamingTransformer( - 16, 4, 2, - causal=False, custom=custom, dropout=0., positional_scale=0.) - layer = torch.nn.TransformerEncoderLayer(16, 4, dropout=0., batch_first=True) - tr_ref = torch.nn.TransformerEncoder(layer, 2) - tr.load_state_dict(tr_ref.state_dict()) - - x = torch.randn(4, 20, 16) - y = tr(x) - y2 = tr_ref(x) - delta = torch.norm(y2 - y) / torch.norm(y) - assert delta < 1e-6, delta - - -def test_streaming_api(): - tr = StreamingTransformer(16, 4, 2, causal=True, dropout=0.) - tr.eval() - steps = 12 - x = torch.randn(1, steps, 16) - - with torch.no_grad(): - with tr.streaming(): - _ = tr(x[:, :1]) - state = {k: v.clone() for k, v in tr.get_streaming_state().items()} - y = tr(x[:, 1:2]) - tr.set_streaming_state(state) - y2 = tr(x[:, 1:2]) - assert torch.allclose(y, y2), (y - y2).norm() - assert tr.flush() is None - - -def test_memory_efficient(): - for backend in ['torch', 'xformers']: - torch.manual_seed(1234) - set_efficient_attention_backend(backend) - - tr = StreamingTransformer( - 16, 4, 2, custom=True, dropout=0., layer_scale=0.1) - tr_mem_efficient = StreamingTransformer( - 16, 4, 2, dropout=0., memory_efficient=True, layer_scale=0.1) - tr_mem_efficient.load_state_dict(tr.state_dict()) - tr.eval() - steps = 12 - x = torch.randn(3, steps, 16) - - with torch.no_grad(): - y = tr(x) - y2 = tr_mem_efficient(x) - assert torch.allclose(y, y2), ((y - y2).norm(), backend) - - -def test_attention_as_float32(): - torch.manual_seed(1234) - cases = [ - {'custom': True}, - {'custom': False}, - ] - for case in cases: - tr = StreamingTransformer(16, 4, 2, dropout=0., dtype=torch.bfloat16, **case) - tr_float32 = StreamingTransformer( - 16, 4, 2, dropout=0., attention_as_float32=True, dtype=torch.bfloat16, **case) - if not case['custom']: - # we are not using autocast here because it doesn't really - # work as expected on CPU, so we have to manually cast the weights of the MHA. - for layer in tr_float32.layers: - layer.self_attn.mha.to(torch.float32) - tr_float32.load_state_dict(tr.state_dict()) - steps = 12 - x = torch.randn(3, steps, 16, dtype=torch.bfloat16) - - with torch.no_grad(): - y = tr(x) - y2 = tr_float32(x) - assert not torch.allclose(y, y2), (y - y2).norm() - - -@torch.no_grad() -def test_streaming_memory_efficient(): - for backend in ['torch', 'xformers']: - torch.manual_seed(1234) - set_efficient_attention_backend(backend) - tr = StreamingTransformer(16, 4, 2, causal=True, dropout=0., custom=True) - tr_mem_efficient = StreamingTransformer( - 16, 4, 2, dropout=0., memory_efficient=True, causal=True) - tr.load_state_dict(tr_mem_efficient.state_dict()) - tr.eval() - tr_mem_efficient.eval() - steps = 12 - x = torch.randn(3, steps, 16) - - ref = tr(x) - - with tr_mem_efficient.streaming(): - outs = [] - # frame_sizes = [2] + [1] * (steps - 2) - frame_sizes = [1] * steps - - for frame_size in frame_sizes: - frame = x[:, :frame_size] - x = x[:, frame_size:] - outs.append(tr_mem_efficient(frame)) - - out = torch.cat(outs, dim=1) - delta = torch.norm(out - ref) / torch.norm(out) - assert delta < 1e-6, delta - - -def test_cross_attention(): - torch.manual_seed(1234) - for norm_first in [True, False]: - m = StreamingTransformer( - 16, 4, 2, cross_attention=False, norm_first=norm_first, dropout=0., custom=True) - m_cross = StreamingTransformer( - 16, 4, 2, cross_attention=True, norm_first=norm_first, dropout=0., custom=True) - m_cross.load_state_dict(m.state_dict(), strict=False) - x = torch.randn(2, 5, 16) - cross_x = torch.randn(2, 3, 16) - y_ref = m(x) - y_cross_zero = m_cross(x, cross_attention_src=0 * cross_x) - # With norm_first, the two should be exactly the same, - # but with norm_first=False, we get 2 normalization in a row - # and the epsilon value leads to a tiny change. - atol = 0. if norm_first else 1e-6 - print((y_ref - y_cross_zero).norm() / y_ref.norm()) - assert torch.allclose(y_ref, y_cross_zero, atol=atol) - - # We now expect a difference even with a generous atol of 1e-2. - y_cross = m_cross(x, cross_attention_src=cross_x) - assert not torch.allclose(y_cross, y_cross_zero, atol=1e-2) - - with pytest.raises(AssertionError): - _ = m_cross(x) - _ = m(x, cross_attention_src=cross_x) - - -def test_cross_attention_compat(): - torch.manual_seed(1234) - num_heads = 2 - dim = num_heads * 64 - with pytest.raises(AssertionError): - StreamingMultiheadAttention(dim, num_heads, causal=True, cross_attention=True) - - cross_attn = StreamingMultiheadAttention( - dim, num_heads, dropout=0, cross_attention=True, custom=True) - ref_attn = torch.nn.MultiheadAttention(dim, num_heads, dropout=0, batch_first=True) - - # We can load the regular attention state dict - # so we have compat when loading old checkpoints. - cross_attn.load_state_dict(ref_attn.state_dict()) - - queries = torch.randn(3, 7, dim) - keys = torch.randn(3, 9, dim) - values = torch.randn(3, 9, dim) - - y = cross_attn(queries, keys, values)[0] - y_ref = ref_attn(queries, keys, values)[0] - assert torch.allclose(y, y_ref, atol=1e-7), (y - y_ref).norm() / y_ref.norm() - - # Now let's check that streaming is working properly. - with cross_attn.streaming(): - ys = [] - for step in range(queries.shape[1]): - ys.append(cross_attn(queries[:, step: step + 1], keys, values)[0]) - y_streaming = torch.cat(ys, dim=1) - assert torch.allclose(y_streaming, y, atol=1e-7) - - -def test_repeat_kv(): - torch.manual_seed(1234) - num_heads = 8 - kv_repeat = 4 - dim = num_heads * 64 - with pytest.raises(AssertionError): - mha = StreamingMultiheadAttention( - dim, num_heads, causal=True, kv_repeat=kv_repeat, cross_attention=True) - mha = StreamingMultiheadAttention( - dim, num_heads, causal=True, kv_repeat=kv_repeat) - mha = StreamingMultiheadAttention( - dim, num_heads, causal=True, kv_repeat=kv_repeat, custom=True) - x = torch.randn(4, 18, dim) - y = mha(x, x, x)[0] - assert x.shape == y.shape - - -def test_qk_layer_norm(): - torch.manual_seed(1234) - tr = StreamingTransformer( - 16, 4, 2, custom=True, dropout=0., qk_layer_norm=True, bias_attn=False) - steps = 12 - x = torch.randn(3, steps, 16) - y = tr(x) - - tr = StreamingTransformer( - 16, 4, 2, custom=True, dropout=0., qk_layer_norm=True, cross_attention=True) - z = torch.randn(3, 21, 16) - y = tr(x, cross_attention_src=z) - assert y.shape == x.shape diff --git a/spaces/brjathu/HMR2.0/vendor/detectron2/configs/COCO-PanopticSegmentation/panoptic_fpn_R_50_1x.py b/spaces/brjathu/HMR2.0/vendor/detectron2/configs/COCO-PanopticSegmentation/panoptic_fpn_R_50_1x.py deleted file mode 100644 index 40cf18131810307157a9a7d1f6d5922b00fd73d5..0000000000000000000000000000000000000000 --- a/spaces/brjathu/HMR2.0/vendor/detectron2/configs/COCO-PanopticSegmentation/panoptic_fpn_R_50_1x.py +++ /dev/null @@ -1,8 +0,0 @@ -from ..common.optim import SGD as optimizer -from ..common.coco_schedule import lr_multiplier_1x as lr_multiplier -from ..common.data.coco_panoptic_separated import dataloader -from ..common.models.panoptic_fpn import model -from ..common.train import train - -model.backbone.bottom_up.freeze_at = 2 -train.init_checkpoint = "detectron2://ImageNetPretrained/MSRA/R-50.pkl" diff --git a/spaces/brjathu/HMR2.0/vendor/detectron2/detectron2/layers/shape_spec.py b/spaces/brjathu/HMR2.0/vendor/detectron2/detectron2/layers/shape_spec.py deleted file mode 100644 index 8dac3c59b96576710656abebe9b5eac25868abbb..0000000000000000000000000000000000000000 --- a/spaces/brjathu/HMR2.0/vendor/detectron2/detectron2/layers/shape_spec.py +++ /dev/null @@ -1,18 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright (c) Facebook, Inc. and its affiliates. -from dataclasses import dataclass -from typing import Optional - - -@dataclass -class ShapeSpec: - """ - A simple structure that contains basic shape specification about a tensor. - It is often used as the auxiliary inputs/outputs of models, - to complement the lack of shape inference ability among pytorch modules. - """ - - channels: Optional[int] = None - height: Optional[int] = None - width: Optional[int] = None - stride: Optional[int] = None diff --git a/spaces/brjathu/HMR2.0/vendor/detectron2/projects/DensePose/README.md b/spaces/brjathu/HMR2.0/vendor/detectron2/projects/DensePose/README.md deleted file mode 100644 index 38f4f834adfcd5490a790a715b24c9ad26ab4dde..0000000000000000000000000000000000000000 --- a/spaces/brjathu/HMR2.0/vendor/detectron2/projects/DensePose/README.md +++ /dev/null @@ -1,64 +0,0 @@ -# DensePose in Detectron2 - -DensePose aims at learning and establishing dense correspondences between image pixels -and 3D object geometry for deformable objects, such as humans or animals. -In this repository, we provide the code to train and evaluate DensePose R-CNN and -various tools to visualize DensePose annotations and results. - -There are two main paradigms that are used within DensePose project. - -## [Chart-based Dense Pose Estimation for Humans and Animals](doc/DENSEPOSE_IUV.md) - -
      - -
      - -For chart-based estimation, 3D object mesh is split into charts and -for each pixel the model estimates chart index `I` and local chart coordinates `(U, V)`. -Please follow the link above to find a [detailed overview](doc/DENSEPOSE_IUV.md#Overview) -of the method, links to trained models along with their performance evaluation in the -[Model Zoo](doc/DENSEPOSE_IUV.md#ModelZoo) and -[references](doc/DENSEPOSE_IUV.md#References) to the corresponding papers. - -## [Continuous Surface Embeddings for Dense Pose Estimation for Humans and Animals](doc/DENSEPOSE_CSE.md) - -
      - -
      - -To establish continuous surface embeddings, the model simultaneously learns -descriptors for mesh vertices and for image pixels. -The embeddings are put into correspondence, thus the location -of each pixel on the 3D model is derived. -Please follow the link above to find a [detailed overview](doc/DENSEPOSE_CSE.md#Overview) -of the method, links to trained models along with their performance evaluation in the -[Model Zoo](doc/DENSEPOSE_CSE.md#ModelZoo) and -[references](doc/DENSEPOSE_CSE.md#References) to the corresponding papers. - -# Quick Start - -See [ Getting Started ](doc/GETTING_STARTED.md) - -# Model Zoo - -Please check the dedicated pages -for [chart-based model zoo](doc/DENSEPOSE_IUV.md#ModelZoo) -and for [continuous surface embeddings model zoo](doc/DENSEPOSE_CSE.md#ModelZoo). - -# What's New - -* June 2021: [DensePose CSE with Cycle Losses](doc/RELEASE_2021_06.md) -* March 2021: [DensePose CSE (a framework to extend DensePose to various categories using 3D models) - and DensePose Evolution (a framework to bootstrap DensePose on unlabeled data) released](doc/RELEASE_2021_03.md) -* April 2020: [DensePose Confidence Estimation and Model Zoo Improvements](doc/RELEASE_2020_04.md) - -# License - -Detectron2 is released under the [Apache 2.0 license](../../LICENSE) - -## Citing DensePose - -If you use DensePose, please refer to the BibTeX entries -for [chart-based models](doc/DENSEPOSE_IUV.md#References) -and for [continuous surface embeddings](doc/DENSEPOSE_CSE.md#References). - diff --git a/spaces/brjathu/HMR2.0/vendor/detectron2/projects/ViTDet/configs/COCO/cascade_mask_rcnn_swin_l_in21k_50ep.py b/spaces/brjathu/HMR2.0/vendor/detectron2/projects/ViTDet/configs/COCO/cascade_mask_rcnn_swin_l_in21k_50ep.py deleted file mode 100644 index 60bc917b5938338f87c96b17041432d1fb637ce3..0000000000000000000000000000000000000000 --- a/spaces/brjathu/HMR2.0/vendor/detectron2/projects/ViTDet/configs/COCO/cascade_mask_rcnn_swin_l_in21k_50ep.py +++ /dev/null @@ -1,15 +0,0 @@ -from .cascade_mask_rcnn_swin_b_in21k_50ep import ( - dataloader, - lr_multiplier, - model, - train, - optimizer, -) - -model.backbone.bottom_up.depths = [2, 2, 18, 2] -model.backbone.bottom_up.drop_path_rate = 0.4 -model.backbone.bottom_up.embed_dim = 192 -model.backbone.bottom_up.num_heads = [6, 12, 24, 48] - - -train.init_checkpoint = "detectron2://ImageNetPretrained/swin/swin_large_patch4_window7_224_22k.pth" diff --git a/spaces/cadige/01-3DModel-GradioDemo/files/Readme.md b/spaces/cadige/01-3DModel-GradioDemo/files/Readme.md deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/spaces/caoyongfu/gpt4/README.md b/spaces/caoyongfu/gpt4/README.md deleted file mode 100644 index 5d6936218874c647b5d22e13ad4be7edb8936f92..0000000000000000000000000000000000000000 --- a/spaces/caoyongfu/gpt4/README.md +++ /dev/null @@ -1,28 +0,0 @@ ---- -title: bingo -emoji: 😊 -colorFrom: red -colorTo: red -sdk: docker -license: mit -duplicated_from: hf4all/bingo ---- - -
      - -# Bingo - -Bingo,一个让你呼吸顺畅 New Bing。 - -高度还原 New Bing 网页版的主要操作,国内可用,兼容绝大多数微软 Bing AI 的功能,可自行部署使用。 - -![Github stars](https://badgen.net/github/stars/weaigc/bingo?icon=github&label=stars) -![Gthub issues](https://img.shields.io/github/issues/weaigc/bingo) -[![docker build](https://github.com/weaigc/bingo/actions/workflows/docker.yml/badge.svg)](https://hub.docker.com/repository/docker/weaigc/bingo/) -[![docker hub](https://badgen.net/docker/size/weaigc/bingo?icon=docker&label=image%20size)](https://hub.docker.com/repository/docker/weaigc/bingo/) -[![MIT License](https://img.shields.io/badge/license-MIT-97c50f)](https://github.com/weaigc/bingo/blob/main/license) - -问题反馈请前往 https://github.com/weaigc/bingo/issues -
      - - diff --git a/spaces/ceckenrode/AI.Dashboard.HEDIS.Terminology.Vocabulary.Codes/index.html b/spaces/ceckenrode/AI.Dashboard.HEDIS.Terminology.Vocabulary.Codes/index.html deleted file mode 100644 index e02d189806849282fc84628809f633804cbc8a0e..0000000000000000000000000000000000000000 --- a/spaces/ceckenrode/AI.Dashboard.HEDIS.Terminology.Vocabulary.Codes/index.html +++ /dev/null @@ -1,109 +0,0 @@ - - - - - - My static Space - - - - - - - - - - - - - - - - - - - - - -
      -journey - title Create AI - section Training - Format DataSet Inputs Files, Data Splits: 5: Teacher - Model Build w/ SKLearn, TF, Pytorch: 3: Student - Determine Model Performance: 1: Teacher, Student - section Deploy - Web Deploy Local and Cloud: 5: Teacher - Architecture Spaces Gradio Streamlit Heroku AWS Azure and GCCP: 5: Teacher - section Testing - Test Model with Input Datasets: 5: Teacher - Examples. Inputs that Work, Inputs That Break Model: 5: Teacher - Governance - Analyze, Publish Fairness, Equity, Bias for Datasets and Outputs: 5: Teacher -
      - -
      -sequenceDiagram - participant Alice - participant Bob - Alice->>John: Hello John, how are you? - loop Healthcheck - John->>John: Fight against hypochondria - end - Note right of John: Rational thoughts
      prevail... - John-->>Alice: Great! - John->>Bob: How about you? - Bob-->>John: Jolly good! -
      - -
      -

      Welcome to the Mermaid Modeler Tip Sheet

      -

      - You can use Mermaid inside HTML5 by including the script and a div with the class or mermaid. -

      -

      - Documentation is located here: - Mermaid documentation. -

      -
      - - -Links: -https://huggingface.co/spaces/awacke1/HEDIS.Roster.Dash.Component.Service -https://huggingface.co/spaces/awacke1/HEDIS.Roster.Dash.Component.SDOH -https://huggingface.co/spaces/awacke1/HEDIS.Dash.Component.Top.Clinical.Terminology.Vocabulary - - - - \ No newline at end of file diff --git a/spaces/changlisheng/shangChat/modules/openai_func.py b/spaces/changlisheng/shangChat/modules/openai_func.py deleted file mode 100644 index b8d44f2f76d17230b443f5636da79935d15fa288..0000000000000000000000000000000000000000 --- a/spaces/changlisheng/shangChat/modules/openai_func.py +++ /dev/null @@ -1,65 +0,0 @@ -import requests -import logging -from modules.presets import ( - timeout_all, - USAGE_API_URL, - BALANCE_API_URL, - standard_error_msg, - connection_timeout_prompt, - error_retrieve_prompt, - read_timeout_prompt -) - -from . import shared -from modules.config import retrieve_proxy -import os, datetime - -def get_billing_data(openai_api_key, billing_url): - headers = { - "Content-Type": "application/json", - "Authorization": f"Bearer {openai_api_key}" - } - - timeout = timeout_all - with retrieve_proxy(): - response = requests.get( - billing_url, - headers=headers, - timeout=timeout, - ) - - if response.status_code == 200: - data = response.json() - return data - else: - raise Exception(f"API request failed with status code {response.status_code}: {response.text}") - - -def get_usage(openai_api_key): - try: - curr_time = datetime.datetime.now() - last_day_of_month = get_last_day_of_month(curr_time).strftime("%Y-%m-%d") - first_day_of_month = curr_time.replace(day=1).strftime("%Y-%m-%d") - usage_url = f"{shared.state.usage_api_url}?start_date={first_day_of_month}&end_date={last_day_of_month}" - try: - usage_data = get_billing_data(openai_api_key, usage_url) - except Exception as e: - logging.error(f"获取API使用情况失败:"+str(e)) - return f"**获取API使用情况失败**" - rounded_usage = "{:.5f}".format(usage_data['total_usage']/100) - return f"**本月使用金额** \u3000 ${rounded_usage}" - except requests.exceptions.ConnectTimeout: - status_text = standard_error_msg + connection_timeout_prompt + error_retrieve_prompt - return status_text - except requests.exceptions.ReadTimeout: - status_text = standard_error_msg + read_timeout_prompt + error_retrieve_prompt - return status_text - except Exception as e: - logging.error(f"获取API使用情况失败:"+str(e)) - return standard_error_msg + error_retrieve_prompt - -def get_last_day_of_month(any_day): - # The day 28 exists in every month. 4 days later, it's always next month - next_month = any_day.replace(day=28) + datetime.timedelta(days=4) - # subtracting the number of the current day brings us back one month - return next_month - datetime.timedelta(days=next_month.day) \ No newline at end of file diff --git a/spaces/chaowei100/ChatGPT_Taiyi-Stable-Diffusion/config.py b/spaces/chaowei100/ChatGPT_Taiyi-Stable-Diffusion/config.py deleted file mode 100644 index d37a5d31a85f5eef6df6211fe8f806a1803962a5..0000000000000000000000000000000000000000 --- a/spaces/chaowei100/ChatGPT_Taiyi-Stable-Diffusion/config.py +++ /dev/null @@ -1,46 +0,0 @@ -# [step 1]>> 例如: API_KEY = "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" (此key无效) -API_KEY = "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" - -# [step 2]>> 改为True应用代理,如果直接在海外服务器部署,此处不修改 -USE_PROXY = True -if USE_PROXY: - # 填写格式是 [协议]:// [地址] :[端口],填写之前不要忘记把USE_PROXY改成True,如果直接在海外服务器部署,此处不修改 - # 例如 "socks5h://localhost:11284" - # [协议] 常见协议无非socks5h/http; 例如 v2**y 和 ss* 的默认本地协议是socks5h; 而cl**h 的默认本地协议是http - # [地址] 懂的都懂,不懂就填localhost或者127.0.0.1肯定错不了(localhost意思是代理软件安装在本机上) - # [端口] 在代理软件的设置里找。虽然不同的代理软件界面不一样,但端口号都应该在最显眼的位置上 - - # 代理网络的地址,打开你的科学上网软件查看代理的协议(socks5/http)、地址(localhost)和端口(11284) - proxies = { - # [协议]:// [地址] :[端口] - "http": "socks5h://localhost:7890", - "https": "socks5h://localhost:7890", - } -else: - proxies = None - - -# [step 3]>> 以下配置可以优化体验,但大部分场合下并不需要修改 -# 对话窗的高度 -CHATBOT_HEIGHT = 1115 - -# 发送请求到OpenAI后,等待多久判定为超时 -TIMEOUT_SECONDS = 25 - -# 网页的端口, -1代表随机端口 -WEB_PORT = -1 - -# 如果OpenAI不响应(网络卡顿、代理失败、KEY失效),重试的次数限制 -MAX_RETRY = 2 - -# OpenAI模型选择是(gpt4现在只对申请成功的人开放) -LLM_MODEL = "gpt-3.5-turbo" - -# OpenAI的API_URL -API_URL = "https://api.openai.com/v1/chat/completions" - -# 设置并行使用的线程数 -CONCURRENT_COUNT = 100 - -# 设置用户名和密码(相关功能不稳定,与gradio版本和网络都相关,如果本地使用不建议加这个) -AUTHENTICATION = [] # [("username", "password"), ("username2", "password2"), ...] diff --git a/spaces/chasemcdo/hf_localai/pkg/langchain/huggingface.go b/spaces/chasemcdo/hf_localai/pkg/langchain/huggingface.go deleted file mode 100644 index 38c55cd512da8cad274bea809f54df6e75cbe177..0000000000000000000000000000000000000000 --- a/spaces/chasemcdo/hf_localai/pkg/langchain/huggingface.go +++ /dev/null @@ -1,47 +0,0 @@ -package langchain - -import ( - "context" - - "github.com/tmc/langchaingo/llms" - "github.com/tmc/langchaingo/llms/huggingface" -) - -type HuggingFace struct { - modelPath string -} - -func NewHuggingFace(repoId string) (*HuggingFace, error) { - return &HuggingFace{ - modelPath: repoId, - }, nil -} - -func (s *HuggingFace) PredictHuggingFace(text string, opts ...PredictOption) (*Predict, error) { - po := NewPredictOptions(opts...) - - // Init client - llm, err := huggingface.New() - if err != nil { - return nil, err - } - - // Convert from LocalAI to LangChainGo format of options - co := []llms.CallOption{ - llms.WithModel(po.Model), - llms.WithMaxTokens(po.MaxTokens), - llms.WithTemperature(po.Temperature), - llms.WithStopWords(po.StopWords), - } - - // Call Inference API - ctx := context.Background() - completion, err := llm.Call(ctx, text, co...) - if err != nil { - return nil, err - } - - return &Predict{ - Completion: completion, - }, nil -} diff --git a/spaces/chendl/compositional_test/multimodal/tools/prepare_vg_regional_box.py b/spaces/chendl/compositional_test/multimodal/tools/prepare_vg_regional_box.py deleted file mode 100644 index c67dfc3554703a011955018b3c9b3d42b35ca15a..0000000000000000000000000000000000000000 --- a/spaces/chendl/compositional_test/multimodal/tools/prepare_vg_regional_box.py +++ /dev/null @@ -1,120 +0,0 @@ -import webdataset as wds -import glob -import os -from tqdm import tqdm -import orjson as json -import itertools -from PIL import Image -import numpy as np -from typing import List -import cv2 -import random -from tqdm.contrib.concurrent import process_map -from copy import deepcopy - -class Generator(): - def __init__(self, dataset_name): - self.dataset_name = dataset_name - self.is_end = False - - -class VisualGenomeGenerator(Generator): - def __init__(self, root: str): - super().__init__(dataset_name="vg") - data = json.loads(open(os.path.join(root, "region_descriptions.json")).read()) - image_data = json.loads(open(os.path.join(root, "image_data.json")).read()) - self.image_id_to_filename = {} - self.image_id_to_wh = {} - for image in image_data: - image_id = image["image_id"] - subfolder, filename = image['url'].split("/")[-2:] - self.image_id_to_filename[image_id] = os.path.join(root, subfolder, filename) - self.image_id_to_wh[image_id] = (image["width"], image["height"]) - self.regions = [] - total = 0 - total_image = 0 - used_image = 0 - for xx in tqdm(data): - total_image += 1 - flag = False - for region in xx['regions']: - total += 1 - region_w = int(region["width"]) - region_h = int(region["height"]) - x = int(region["x"]) - y = int(region["y"]) - image_w = self.image_id_to_wh[region["image_id"]][0] - image_h = self.image_id_to_wh[region["image_id"]][1] - region_w /= image_w - region_h /= image_h - x /= image_w - y /= image_h - if region_w * region_h < 1 / (16*16*4): - continue - if " is" in region["phrase"] or " are" in region["phrase"]: - continue - region["norm_xywh"] = (x, y, region_w, region_h) - self.regions.append(region) - flag = True - if flag: - used_image += 1 - random.shuffle(self.regions) - print("valid region", len(self.regions), total, len(self.regions) / total) - print("valid image", used_image, total_image, used_image / total_image) - - def __len__(self): - return len(self.regions) - - def __iter__(self): - for region in self.regions: - image_id = region["image_id"] - phrase = region["phrase"] - try: - image = Image.open(self.image_id_to_filename[image_id]) - except: - continue - image = image.resize((224, 224)) - x, y, region_w, region_h = region["norm_xywh"] - x1 = int(x * 224) - y1 = int(y * 224) - x2 = int(x1 + region_w * 224) - y2 = int(y1 + region_h * 224) - yield [self.dataset_name, image, phrase, np.array([x1, y1, x2, y2]), image_id] - self.is_end = True - - -def handle(args): - dataset_name = "vg" - iii, regions, image_id_to_filename = args - if iii == 0: - print(regions[:10]) - os.makedirs(os.path.join(OUT_DIR, str(iii)), exist_ok=True) - with wds.ShardWriter(os.path.join(OUT_DIR, str(iii), "%06d.tar"), maxcount=8500) as sink: - sink.verbose = False - for i, region in enumerate(tqdm(regions, disable=(iii != 0))): - image_id = region["image_id"] - phrase = region["phrase"] - image = Image.open(image_id_to_filename[image_id]) - image = image.resize((224, 224)) - x, y, region_w, region_h = region["norm_xywh"] - x1 = int(x * 224) - y1 = int(y * 224) - x2 = int(x1 + region_w * 224) - y2 = int(y1 + region_h * 224) - dataset_name, image, caption, xyxy, image_id = [dataset_name, image, phrase, np.array([x1, y1, x2, y2]), image_id] - sink.write({"__key__": f"{dataset_name}_{i}_containBox", "jpg": image, "txt": caption, "boxes.pyd": xyxy, "logits.pyd": xyxy}) - if i % 200 == 0 and iii == 0: - tqdm.write(f"{caption} {xyxy}") - - -if __name__ == "__main__": - OUT_DIR = "/gpfs/u/home/LMCG/LMCGljnn/scratch-shared/junyan/raw/vg_0826" - os.makedirs(OUT_DIR, exist_ok=True) - visual_genome_generator = VisualGenomeGenerator("/gpfs/u/home/LMCG/LMCGljnn/scratch/datasets/raw/vg") - N_PROC = 150 - data_list = [] - for i in range(N_PROC): - data_list.append([i, [], deepcopy(visual_genome_generator.image_id_to_filename)]) - for i, region in enumerate(visual_genome_generator.regions): - data_list[i % N_PROC][1].append(region) - process_map(handle, data_list, max_workers=N_PROC, disable=True) diff --git a/spaces/chuan-hd/law-assistant-chatbot/.venv/lib/python3.11/site-packages/aiohttp/helpers.py b/spaces/chuan-hd/law-assistant-chatbot/.venv/lib/python3.11/site-packages/aiohttp/helpers.py deleted file mode 100644 index 874ab1ac076bc311d8853f08bb5fe454b650099f..0000000000000000000000000000000000000000 --- a/spaces/chuan-hd/law-assistant-chatbot/.venv/lib/python3.11/site-packages/aiohttp/helpers.py +++ /dev/null @@ -1,878 +0,0 @@ -"""Various helper functions""" - -import asyncio -import base64 -import binascii -import datetime -import functools -import inspect -import netrc -import os -import platform -import re -import sys -import time -import warnings -import weakref -from collections import namedtuple -from contextlib import suppress -from email.parser import HeaderParser -from email.utils import parsedate -from math import ceil -from pathlib import Path -from types import TracebackType -from typing import ( - Any, - Callable, - ContextManager, - Dict, - Generator, - Generic, - Iterable, - Iterator, - List, - Mapping, - Optional, - Pattern, - Set, - Tuple, - Type, - TypeVar, - Union, - cast, -) -from urllib.parse import quote -from urllib.request import getproxies, proxy_bypass - -import async_timeout -import attr -from multidict import MultiDict, MultiDictProxy -from yarl import URL - -from . import hdrs -from .log import client_logger, internal_logger -from .typedefs import PathLike, Protocol # noqa - -__all__ = ("BasicAuth", "ChainMapProxy", "ETag") - -IS_MACOS = platform.system() == "Darwin" -IS_WINDOWS = platform.system() == "Windows" - -PY_36 = sys.version_info >= (3, 6) -PY_37 = sys.version_info >= (3, 7) -PY_38 = sys.version_info >= (3, 8) -PY_310 = sys.version_info >= (3, 10) -PY_311 = sys.version_info >= (3, 11) - -if sys.version_info < (3, 7): - import idna_ssl - - idna_ssl.patch_match_hostname() - - def all_tasks( - loop: Optional[asyncio.AbstractEventLoop] = None, - ) -> Set["asyncio.Task[Any]"]: - tasks = list(asyncio.Task.all_tasks(loop)) - return {t for t in tasks if not t.done()} - -else: - all_tasks = asyncio.all_tasks - - -_T = TypeVar("_T") -_S = TypeVar("_S") - - -sentinel: Any = object() -NO_EXTENSIONS: bool = bool(os.environ.get("AIOHTTP_NO_EXTENSIONS")) - -# N.B. sys.flags.dev_mode is available on Python 3.7+, use getattr -# for compatibility with older versions -DEBUG: bool = getattr(sys.flags, "dev_mode", False) or ( - not sys.flags.ignore_environment and bool(os.environ.get("PYTHONASYNCIODEBUG")) -) - - -CHAR = {chr(i) for i in range(0, 128)} -CTL = {chr(i) for i in range(0, 32)} | { - chr(127), -} -SEPARATORS = { - "(", - ")", - "<", - ">", - "@", - ",", - ";", - ":", - "\\", - '"', - "/", - "[", - "]", - "?", - "=", - "{", - "}", - " ", - chr(9), -} -TOKEN = CHAR ^ CTL ^ SEPARATORS - - -class noop: - def __await__(self) -> Generator[None, None, None]: - yield - - -class BasicAuth(namedtuple("BasicAuth", ["login", "password", "encoding"])): - """Http basic authentication helper.""" - - def __new__( - cls, login: str, password: str = "", encoding: str = "latin1" - ) -> "BasicAuth": - if login is None: - raise ValueError("None is not allowed as login value") - - if password is None: - raise ValueError("None is not allowed as password value") - - if ":" in login: - raise ValueError('A ":" is not allowed in login (RFC 1945#section-11.1)') - - return super().__new__(cls, login, password, encoding) - - @classmethod - def decode(cls, auth_header: str, encoding: str = "latin1") -> "BasicAuth": - """Create a BasicAuth object from an Authorization HTTP header.""" - try: - auth_type, encoded_credentials = auth_header.split(" ", 1) - except ValueError: - raise ValueError("Could not parse authorization header.") - - if auth_type.lower() != "basic": - raise ValueError("Unknown authorization method %s" % auth_type) - - try: - decoded = base64.b64decode( - encoded_credentials.encode("ascii"), validate=True - ).decode(encoding) - except binascii.Error: - raise ValueError("Invalid base64 encoding.") - - try: - # RFC 2617 HTTP Authentication - # https://www.ietf.org/rfc/rfc2617.txt - # the colon must be present, but the username and password may be - # otherwise blank. - username, password = decoded.split(":", 1) - except ValueError: - raise ValueError("Invalid credentials.") - - return cls(username, password, encoding=encoding) - - @classmethod - def from_url(cls, url: URL, *, encoding: str = "latin1") -> Optional["BasicAuth"]: - """Create BasicAuth from url.""" - if not isinstance(url, URL): - raise TypeError("url should be yarl.URL instance") - if url.user is None: - return None - return cls(url.user, url.password or "", encoding=encoding) - - def encode(self) -> str: - """Encode credentials.""" - creds = (f"{self.login}:{self.password}").encode(self.encoding) - return "Basic %s" % base64.b64encode(creds).decode(self.encoding) - - -def strip_auth_from_url(url: URL) -> Tuple[URL, Optional[BasicAuth]]: - auth = BasicAuth.from_url(url) - if auth is None: - return url, None - else: - return url.with_user(None), auth - - -def netrc_from_env() -> Optional[netrc.netrc]: - """Load netrc from file. - - Attempt to load it from the path specified by the env-var - NETRC or in the default location in the user's home directory. - - Returns None if it couldn't be found or fails to parse. - """ - netrc_env = os.environ.get("NETRC") - - if netrc_env is not None: - netrc_path = Path(netrc_env) - else: - try: - home_dir = Path.home() - except RuntimeError as e: # pragma: no cover - # if pathlib can't resolve home, it may raise a RuntimeError - client_logger.debug( - "Could not resolve home directory when " - "trying to look for .netrc file: %s", - e, - ) - return None - - netrc_path = home_dir / ("_netrc" if IS_WINDOWS else ".netrc") - - try: - return netrc.netrc(str(netrc_path)) - except netrc.NetrcParseError as e: - client_logger.warning("Could not parse .netrc file: %s", e) - except OSError as e: - # we couldn't read the file (doesn't exist, permissions, etc.) - if netrc_env or netrc_path.is_file(): - # only warn if the environment wanted us to load it, - # or it appears like the default file does actually exist - client_logger.warning("Could not read .netrc file: %s", e) - - return None - - -@attr.s(auto_attribs=True, frozen=True, slots=True) -class ProxyInfo: - proxy: URL - proxy_auth: Optional[BasicAuth] - - -def proxies_from_env() -> Dict[str, ProxyInfo]: - proxy_urls = { - k: URL(v) - for k, v in getproxies().items() - if k in ("http", "https", "ws", "wss") - } - netrc_obj = netrc_from_env() - stripped = {k: strip_auth_from_url(v) for k, v in proxy_urls.items()} - ret = {} - for proto, val in stripped.items(): - proxy, auth = val - if proxy.scheme in ("https", "wss"): - client_logger.warning( - "%s proxies %s are not supported, ignoring", proxy.scheme.upper(), proxy - ) - continue - if netrc_obj and auth is None: - auth_from_netrc = None - if proxy.host is not None: - auth_from_netrc = netrc_obj.authenticators(proxy.host) - if auth_from_netrc is not None: - # auth_from_netrc is a (`user`, `account`, `password`) tuple, - # `user` and `account` both can be username, - # if `user` is None, use `account` - *logins, password = auth_from_netrc - login = logins[0] if logins[0] else logins[-1] - auth = BasicAuth(cast(str, login), cast(str, password)) - ret[proto] = ProxyInfo(proxy, auth) - return ret - - -def current_task( - loop: Optional[asyncio.AbstractEventLoop] = None, -) -> "Optional[asyncio.Task[Any]]": - if sys.version_info >= (3, 7): - return asyncio.current_task(loop=loop) - else: - return asyncio.Task.current_task(loop=loop) - - -def get_running_loop( - loop: Optional[asyncio.AbstractEventLoop] = None, -) -> asyncio.AbstractEventLoop: - if loop is None: - loop = asyncio.get_event_loop() - if not loop.is_running(): - warnings.warn( - "The object should be created within an async function", - DeprecationWarning, - stacklevel=3, - ) - if loop.get_debug(): - internal_logger.warning( - "The object should be created within an async function", stack_info=True - ) - return loop - - -def isasyncgenfunction(obj: Any) -> bool: - func = getattr(inspect, "isasyncgenfunction", None) - if func is not None: - return func(obj) # type: ignore[no-any-return] - else: - return False - - -def get_env_proxy_for_url(url: URL) -> Tuple[URL, Optional[BasicAuth]]: - """Get a permitted proxy for the given URL from the env.""" - if url.host is not None and proxy_bypass(url.host): - raise LookupError(f"Proxying is disallowed for `{url.host!r}`") - - proxies_in_env = proxies_from_env() - try: - proxy_info = proxies_in_env[url.scheme] - except KeyError: - raise LookupError(f"No proxies found for `{url!s}` in the env") - else: - return proxy_info.proxy, proxy_info.proxy_auth - - -@attr.s(auto_attribs=True, frozen=True, slots=True) -class MimeType: - type: str - subtype: str - suffix: str - parameters: "MultiDictProxy[str]" - - -@functools.lru_cache(maxsize=56) -def parse_mimetype(mimetype: str) -> MimeType: - """Parses a MIME type into its components. - - mimetype is a MIME type string. - - Returns a MimeType object. - - Example: - - >>> parse_mimetype('text/html; charset=utf-8') - MimeType(type='text', subtype='html', suffix='', - parameters={'charset': 'utf-8'}) - - """ - if not mimetype: - return MimeType( - type="", subtype="", suffix="", parameters=MultiDictProxy(MultiDict()) - ) - - parts = mimetype.split(";") - params: MultiDict[str] = MultiDict() - for item in parts[1:]: - if not item: - continue - key, value = cast( - Tuple[str, str], item.split("=", 1) if "=" in item else (item, "") - ) - params.add(key.lower().strip(), value.strip(' "')) - - fulltype = parts[0].strip().lower() - if fulltype == "*": - fulltype = "*/*" - - mtype, stype = ( - cast(Tuple[str, str], fulltype.split("/", 1)) - if "/" in fulltype - else (fulltype, "") - ) - stype, suffix = ( - cast(Tuple[str, str], stype.split("+", 1)) if "+" in stype else (stype, "") - ) - - return MimeType( - type=mtype, subtype=stype, suffix=suffix, parameters=MultiDictProxy(params) - ) - - -def guess_filename(obj: Any, default: Optional[str] = None) -> Optional[str]: - name = getattr(obj, "name", None) - if name and isinstance(name, str) and name[0] != "<" and name[-1] != ">": - return Path(name).name - return default - - -not_qtext_re = re.compile(r"[^\041\043-\133\135-\176]") -QCONTENT = {chr(i) for i in range(0x20, 0x7F)} | {"\t"} - - -def quoted_string(content: str) -> str: - """Return 7-bit content as quoted-string. - - Format content into a quoted-string as defined in RFC5322 for - Internet Message Format. Notice that this is not the 8-bit HTTP - format, but the 7-bit email format. Content must be in usascii or - a ValueError is raised. - """ - if not (QCONTENT > set(content)): - raise ValueError(f"bad content for quoted-string {content!r}") - return not_qtext_re.sub(lambda x: "\\" + x.group(0), content) - - -def content_disposition_header( - disptype: str, quote_fields: bool = True, _charset: str = "utf-8", **params: str -) -> str: - """Sets ``Content-Disposition`` header for MIME. - - This is the MIME payload Content-Disposition header from RFC 2183 - and RFC 7579 section 4.2, not the HTTP Content-Disposition from - RFC 6266. - - disptype is a disposition type: inline, attachment, form-data. - Should be valid extension token (see RFC 2183) - - quote_fields performs value quoting to 7-bit MIME headers - according to RFC 7578. Set to quote_fields to False if recipient - can take 8-bit file names and field values. - - _charset specifies the charset to use when quote_fields is True. - - params is a dict with disposition params. - """ - if not disptype or not (TOKEN > set(disptype)): - raise ValueError("bad content disposition type {!r}" "".format(disptype)) - - value = disptype - if params: - lparams = [] - for key, val in params.items(): - if not key or not (TOKEN > set(key)): - raise ValueError( - "bad content disposition parameter" " {!r}={!r}".format(key, val) - ) - if quote_fields: - if key.lower() == "filename": - qval = quote(val, "", encoding=_charset) - lparams.append((key, '"%s"' % qval)) - else: - try: - qval = quoted_string(val) - except ValueError: - qval = "".join( - (_charset, "''", quote(val, "", encoding=_charset)) - ) - lparams.append((key + "*", qval)) - else: - lparams.append((key, '"%s"' % qval)) - else: - qval = val.replace("\\", "\\\\").replace('"', '\\"') - lparams.append((key, '"%s"' % qval)) - sparams = "; ".join("=".join(pair) for pair in lparams) - value = "; ".join((value, sparams)) - return value - - -class _TSelf(Protocol, Generic[_T]): - _cache: Dict[str, _T] - - -class reify(Generic[_T]): - """Use as a class method decorator. - - It operates almost exactly like - the Python `@property` decorator, but it puts the result of the - method it decorates into the instance dict after the first call, - effectively replacing the function it decorates with an instance - variable. It is, in Python parlance, a data descriptor. - """ - - def __init__(self, wrapped: Callable[..., _T]) -> None: - self.wrapped = wrapped - self.__doc__ = wrapped.__doc__ - self.name = wrapped.__name__ - - def __get__(self, inst: _TSelf[_T], owner: Optional[Type[Any]] = None) -> _T: - try: - try: - return inst._cache[self.name] - except KeyError: - val = self.wrapped(inst) - inst._cache[self.name] = val - return val - except AttributeError: - if inst is None: - return self - raise - - def __set__(self, inst: _TSelf[_T], value: _T) -> None: - raise AttributeError("reified property is read-only") - - -reify_py = reify - -try: - from ._helpers import reify as reify_c - - if not NO_EXTENSIONS: - reify = reify_c # type: ignore[misc,assignment] -except ImportError: - pass - -_ipv4_pattern = ( - r"^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}" - r"(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$" -) -_ipv6_pattern = ( - r"^(?:(?:(?:[A-F0-9]{1,4}:){6}|(?=(?:[A-F0-9]{0,4}:){0,6}" - r"(?:[0-9]{1,3}\.){3}[0-9]{1,3}$)(([0-9A-F]{1,4}:){0,5}|:)" - r"((:[0-9A-F]{1,4}){1,5}:|:)|::(?:[A-F0-9]{1,4}:){5})" - r"(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])\.){3}" - r"(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])|(?:[A-F0-9]{1,4}:){7}" - r"[A-F0-9]{1,4}|(?=(?:[A-F0-9]{0,4}:){0,7}[A-F0-9]{0,4}$)" - r"(([0-9A-F]{1,4}:){1,7}|:)((:[0-9A-F]{1,4}){1,7}|:)|(?:[A-F0-9]{1,4}:){7}" - r":|:(:[A-F0-9]{1,4}){7})$" -) -_ipv4_regex = re.compile(_ipv4_pattern) -_ipv6_regex = re.compile(_ipv6_pattern, flags=re.IGNORECASE) -_ipv4_regexb = re.compile(_ipv4_pattern.encode("ascii")) -_ipv6_regexb = re.compile(_ipv6_pattern.encode("ascii"), flags=re.IGNORECASE) - - -def _is_ip_address( - regex: Pattern[str], regexb: Pattern[bytes], host: Optional[Union[str, bytes]] -) -> bool: - if host is None: - return False - if isinstance(host, str): - return bool(regex.match(host)) - elif isinstance(host, (bytes, bytearray, memoryview)): - return bool(regexb.match(host)) - else: - raise TypeError(f"{host} [{type(host)}] is not a str or bytes") - - -is_ipv4_address = functools.partial(_is_ip_address, _ipv4_regex, _ipv4_regexb) -is_ipv6_address = functools.partial(_is_ip_address, _ipv6_regex, _ipv6_regexb) - - -def is_ip_address(host: Optional[Union[str, bytes, bytearray, memoryview]]) -> bool: - return is_ipv4_address(host) or is_ipv6_address(host) - - -def next_whole_second() -> datetime.datetime: - """Return current time rounded up to the next whole second.""" - return datetime.datetime.now(datetime.timezone.utc).replace( - microsecond=0 - ) + datetime.timedelta(seconds=0) - - -_cached_current_datetime: Optional[int] = None -_cached_formatted_datetime = "" - - -def rfc822_formatted_time() -> str: - global _cached_current_datetime - global _cached_formatted_datetime - - now = int(time.time()) - if now != _cached_current_datetime: - # Weekday and month names for HTTP date/time formatting; - # always English! - # Tuples are constants stored in codeobject! - _weekdayname = ("Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun") - _monthname = ( - "", # Dummy so we can use 1-based month numbers - "Jan", - "Feb", - "Mar", - "Apr", - "May", - "Jun", - "Jul", - "Aug", - "Sep", - "Oct", - "Nov", - "Dec", - ) - - year, month, day, hh, mm, ss, wd, *tail = time.gmtime(now) - _cached_formatted_datetime = "%s, %02d %3s %4d %02d:%02d:%02d GMT" % ( - _weekdayname[wd], - day, - _monthname[month], - year, - hh, - mm, - ss, - ) - _cached_current_datetime = now - return _cached_formatted_datetime - - -def _weakref_handle(info: "Tuple[weakref.ref[object], str]") -> None: - ref, name = info - ob = ref() - if ob is not None: - with suppress(Exception): - getattr(ob, name)() - - -def weakref_handle( - ob: object, name: str, timeout: float, loop: asyncio.AbstractEventLoop -) -> Optional[asyncio.TimerHandle]: - if timeout is not None and timeout > 0: - when = loop.time() + timeout - if timeout >= 5: - when = ceil(when) - - return loop.call_at(when, _weakref_handle, (weakref.ref(ob), name)) - return None - - -def call_later( - cb: Callable[[], Any], timeout: float, loop: asyncio.AbstractEventLoop -) -> Optional[asyncio.TimerHandle]: - if timeout is not None and timeout > 0: - when = loop.time() + timeout - if timeout > 5: - when = ceil(when) - return loop.call_at(when, cb) - return None - - -class TimeoutHandle: - """Timeout handle""" - - def __init__( - self, loop: asyncio.AbstractEventLoop, timeout: Optional[float] - ) -> None: - self._timeout = timeout - self._loop = loop - self._callbacks: List[ - Tuple[Callable[..., None], Tuple[Any, ...], Dict[str, Any]] - ] = [] - - def register( - self, callback: Callable[..., None], *args: Any, **kwargs: Any - ) -> None: - self._callbacks.append((callback, args, kwargs)) - - def close(self) -> None: - self._callbacks.clear() - - def start(self) -> Optional[asyncio.Handle]: - timeout = self._timeout - if timeout is not None and timeout > 0: - when = self._loop.time() + timeout - if timeout >= 5: - when = ceil(when) - return self._loop.call_at(when, self.__call__) - else: - return None - - def timer(self) -> "BaseTimerContext": - if self._timeout is not None and self._timeout > 0: - timer = TimerContext(self._loop) - self.register(timer.timeout) - return timer - else: - return TimerNoop() - - def __call__(self) -> None: - for cb, args, kwargs in self._callbacks: - with suppress(Exception): - cb(*args, **kwargs) - - self._callbacks.clear() - - -class BaseTimerContext(ContextManager["BaseTimerContext"]): - pass - - -class TimerNoop(BaseTimerContext): - def __enter__(self) -> BaseTimerContext: - return self - - def __exit__( - self, - exc_type: Optional[Type[BaseException]], - exc_val: Optional[BaseException], - exc_tb: Optional[TracebackType], - ) -> None: - return - - -class TimerContext(BaseTimerContext): - """Low resolution timeout context manager""" - - def __init__(self, loop: asyncio.AbstractEventLoop) -> None: - self._loop = loop - self._tasks: List[asyncio.Task[Any]] = [] - self._cancelled = False - - def __enter__(self) -> BaseTimerContext: - task = current_task(loop=self._loop) - - if task is None: - raise RuntimeError( - "Timeout context manager should be used " "inside a task" - ) - - if self._cancelled: - raise asyncio.TimeoutError from None - - self._tasks.append(task) - return self - - def __exit__( - self, - exc_type: Optional[Type[BaseException]], - exc_val: Optional[BaseException], - exc_tb: Optional[TracebackType], - ) -> Optional[bool]: - if self._tasks: - self._tasks.pop() - - if exc_type is asyncio.CancelledError and self._cancelled: - raise asyncio.TimeoutError from None - return None - - def timeout(self) -> None: - if not self._cancelled: - for task in set(self._tasks): - task.cancel() - - self._cancelled = True - - -def ceil_timeout(delay: Optional[float]) -> async_timeout.Timeout: - if delay is None or delay <= 0: - return async_timeout.timeout(None) - - loop = get_running_loop() - now = loop.time() - when = now + delay - if delay > 5: - when = ceil(when) - return async_timeout.timeout_at(when) - - -class HeadersMixin: - - ATTRS = frozenset(["_content_type", "_content_dict", "_stored_content_type"]) - - _content_type: Optional[str] = None - _content_dict: Optional[Dict[str, str]] = None - _stored_content_type = sentinel - - def _parse_content_type(self, raw: str) -> None: - self._stored_content_type = raw - if raw is None: - # default value according to RFC 2616 - self._content_type = "application/octet-stream" - self._content_dict = {} - else: - msg = HeaderParser().parsestr("Content-Type: " + raw) - self._content_type = msg.get_content_type() - params = msg.get_params() - self._content_dict = dict(params[1:]) # First element is content type again - - @property - def content_type(self) -> str: - """The value of content part for Content-Type HTTP header.""" - raw = self._headers.get(hdrs.CONTENT_TYPE) # type: ignore[attr-defined] - if self._stored_content_type != raw: - self._parse_content_type(raw) - return self._content_type # type: ignore[return-value] - - @property - def charset(self) -> Optional[str]: - """The value of charset part for Content-Type HTTP header.""" - raw = self._headers.get(hdrs.CONTENT_TYPE) # type: ignore[attr-defined] - if self._stored_content_type != raw: - self._parse_content_type(raw) - return self._content_dict.get("charset") # type: ignore[union-attr] - - @property - def content_length(self) -> Optional[int]: - """The value of Content-Length HTTP header.""" - content_length = self._headers.get( # type: ignore[attr-defined] - hdrs.CONTENT_LENGTH - ) - - if content_length is not None: - return int(content_length) - else: - return None - - -def set_result(fut: "asyncio.Future[_T]", result: _T) -> None: - if not fut.done(): - fut.set_result(result) - - -def set_exception(fut: "asyncio.Future[_T]", exc: BaseException) -> None: - if not fut.done(): - fut.set_exception(exc) - - -class ChainMapProxy(Mapping[str, Any]): - __slots__ = ("_maps",) - - def __init__(self, maps: Iterable[Mapping[str, Any]]) -> None: - self._maps = tuple(maps) - - def __init_subclass__(cls) -> None: - raise TypeError( - "Inheritance class {} from ChainMapProxy " - "is forbidden".format(cls.__name__) - ) - - def __getitem__(self, key: str) -> Any: - for mapping in self._maps: - try: - return mapping[key] - except KeyError: - pass - raise KeyError(key) - - def get(self, key: str, default: Any = None) -> Any: - return self[key] if key in self else default - - def __len__(self) -> int: - # reuses stored hash values if possible - return len(set().union(*self._maps)) # type: ignore[arg-type] - - def __iter__(self) -> Iterator[str]: - d: Dict[str, Any] = {} - for mapping in reversed(self._maps): - # reuses stored hash values if possible - d.update(mapping) - return iter(d) - - def __contains__(self, key: object) -> bool: - return any(key in m for m in self._maps) - - def __bool__(self) -> bool: - return any(self._maps) - - def __repr__(self) -> str: - content = ", ".join(map(repr, self._maps)) - return f"ChainMapProxy({content})" - - -# https://tools.ietf.org/html/rfc7232#section-2.3 -_ETAGC = r"[!#-}\x80-\xff]+" -_ETAGC_RE = re.compile(_ETAGC) -_QUOTED_ETAG = rf'(W/)?"({_ETAGC})"' -QUOTED_ETAG_RE = re.compile(_QUOTED_ETAG) -LIST_QUOTED_ETAG_RE = re.compile(rf"({_QUOTED_ETAG})(?:\s*,\s*|$)|(.)") - -ETAG_ANY = "*" - - -@attr.s(auto_attribs=True, frozen=True, slots=True) -class ETag: - value: str - is_weak: bool = False - - -def validate_etag_value(value: str) -> None: - if value != ETAG_ANY and not _ETAGC_RE.fullmatch(value): - raise ValueError( - f"Value {value!r} is not a valid etag. Maybe it contains '\"'?" - ) - - -def parse_http_date(date_str: Optional[str]) -> Optional[datetime.datetime]: - """Process a date string, return a datetime object""" - if date_str is not None: - timetuple = parsedate(date_str) - if timetuple is not None: - with suppress(ValueError): - return datetime.datetime(*timetuple[:6], tzinfo=datetime.timezone.utc) - return None diff --git a/spaces/chuan-hd/law-assistant-chatbot/.venv/lib/python3.11/site-packages/clickhouse_connect/driver/httpclient.py b/spaces/chuan-hd/law-assistant-chatbot/.venv/lib/python3.11/site-packages/clickhouse_connect/driver/httpclient.py deleted file mode 100644 index fe570f18d3091ba2e02df4b7c7741c5b5b7ebdbc..0000000000000000000000000000000000000000 --- a/spaces/chuan-hd/law-assistant-chatbot/.venv/lib/python3.11/site-packages/clickhouse_connect/driver/httpclient.py +++ /dev/null @@ -1,465 +0,0 @@ -import json -import logging -import re -import uuid -from base64 import b64encode -from typing import Optional, Dict, Any, Sequence, Union, List, Callable, Generator, BinaryIO -from urllib.parse import urlencode - -from urllib3 import Timeout -from urllib3.exceptions import HTTPError -from urllib3.poolmanager import PoolManager -from urllib3.response import HTTPResponse - -from clickhouse_connect import common -from clickhouse_connect.datatypes import registry -from clickhouse_connect.datatypes.base import ClickHouseType -from clickhouse_connect.driver.ctypes import RespBuffCls -from clickhouse_connect.driver.client import Client -from clickhouse_connect.driver.common import dict_copy, coerce_bool, coerce_int -from clickhouse_connect.driver.compression import available_compression -from clickhouse_connect.driver.exceptions import DatabaseError, OperationalError, ProgrammingError -from clickhouse_connect.driver.external import ExternalData -from clickhouse_connect.driver.httputil import ResponseSource, get_pool_manager, get_response_data, \ - default_pool_manager, get_proxy_manager, all_managers, check_env_proxy, check_conn_reset -from clickhouse_connect.driver.insert import InsertContext -from clickhouse_connect.driver.summary import QuerySummary -from clickhouse_connect.driver.query import QueryResult, QueryContext, quote_identifier, bind_query -from clickhouse_connect.driver.transform import NativeTransform - -logger = logging.getLogger(__name__) -columns_only_re = re.compile(r'LIMIT 0\s*$', re.IGNORECASE) - - -# pylint: disable=too-many-instance-attributes -class HttpClient(Client): - params = {} - valid_transport_settings = {'database', 'buffer_size', 'session_id', - 'compress', 'decompress', 'session_timeout', - 'session_check', 'query_id', 'quota_key', - 'wait_end_of_query', 'client_protocol_version'} - optional_transport_settings = {'send_progress_in_http_headers', - 'http_headers_progress_interval_ms', - 'enable_http_compression'} - _owns_pool_manager = False - - # pylint: disable=too-many-arguments,too-many-locals,too-many-branches,too-many-statements,unused-argument - def __init__(self, - interface: str, - host: str, - port: int, - username: str, - password: str, - database: str, - compress: Union[bool, str] = True, - query_limit: int = 0, - query_retries: int = 2, - connect_timeout: int = 10, - send_receive_timeout: int = 300, - client_name: Optional[str] = None, - verify: bool = True, - ca_cert: Optional[str] = None, - client_cert: Optional[str] = None, - client_cert_key: Optional[str] = None, - session_id: Optional[str] = None, - settings: Optional[Dict[str, Any]] = None, - pool_mgr: Optional[PoolManager] = None, - http_proxy: Optional[str] = None, - https_proxy: Optional[str] = None, - server_host_name: Optional[str] = None, - apply_server_timezone: Optional[Union[str, bool]] = True): - """ - Create an HTTP ClickHouse Connect client - See clickhouse_connect.get_client for parameters - """ - self.url = f'{interface}://{host}:{port}' - self.headers = {} - ch_settings = settings or {} - self.http = pool_mgr - if interface == 'https': - if not https_proxy: - https_proxy = check_env_proxy('https', host, port) - if client_cert: - if not username: - raise ProgrammingError('username parameter is required for Mutual TLS authentication') - self.headers['X-ClickHouse-User'] = username - self.headers['X-ClickHouse-SSL-Certificate-Auth'] = 'on' - verify = coerce_bool(verify) - # pylint: disable=too-many-boolean-expressions - if not self.http and (server_host_name or ca_cert or client_cert or not verify or https_proxy): - options = { - 'ca_cert': ca_cert, - 'client_cert': client_cert, - 'verify': verify, - 'client_cert_key': client_cert_key - } - if server_host_name: - if verify: - options['assert_hostname'] = server_host_name - options['server_hostname'] = server_host_name - self.http = get_pool_manager(https_proxy=https_proxy, **options) - self._owns_pool_manager = True - if not self.http: - if not http_proxy: - http_proxy = check_env_proxy('http', host, port) - if http_proxy: - self.http = get_proxy_manager(host, http_proxy) - else: - self.http = default_pool_manager() - - if not client_cert and username: - self.headers['Authorization'] = 'Basic ' + b64encode(f'{username}:{password}'.encode()).decode() - self.headers['User-Agent'] = common.build_client_name(client_name) - self._read_format = self._write_format = 'Native' - self._transform = NativeTransform() - - connect_timeout, send_receive_timeout = coerce_int(connect_timeout), coerce_int(send_receive_timeout) - self.timeout = Timeout(connect=connect_timeout, read=send_receive_timeout) - self.http_retries = 1 - self._send_progress = None - self._send_comp_setting = False - self._progress_interval = None - self._active_session = None - - if session_id: - ch_settings['session_id'] = session_id - elif 'session_id' not in ch_settings and common.get_setting('autogenerate_session_id'): - ch_settings['session_id'] = str(uuid.uuid4()) - - if coerce_bool(compress): - compression = ','.join(available_compression) - self.write_compression = available_compression[0] - elif compress and compress not in ('False', 'false', '0'): - if compress not in available_compression: - raise ProgrammingError(f'Unsupported compression method {compress}') - compression = compress - self.write_compression = compress - else: - compression = None - - super().__init__(database=database, - uri=self.url, - query_limit=query_limit, - query_retries=query_retries, - server_host_name=server_host_name, - apply_server_timezone=apply_server_timezone) - self.params = self._validate_settings(ch_settings) - comp_setting = self._setting_status('enable_http_compression') - self._send_comp_setting = not comp_setting.is_set and comp_setting.is_writable - if comp_setting.is_set or comp_setting.is_writable: - self.compression = compression - send_setting = self._setting_status('send_progress_in_http_headers') - self._send_progress = not send_setting.is_set and send_setting.is_writable - if (send_setting.is_set or send_setting.is_writable) and \ - self._setting_status('http_headers_progress_interval_ms').is_writable: - self._progress_interval = str(min(120000, (send_receive_timeout - 5) * 1000)) - - def set_client_setting(self, key, value): - str_value = self._validate_setting(key, value, common.get_setting('invalid_setting_action')) - if str_value is not None: - self.params[key] = str_value - - def get_client_setting(self, key) -> Optional[str]: - values = self.params.get(key) - return values[0] if values else None - - def _prep_query(self, context: QueryContext): - final_query = super()._prep_query(context) - if context.is_insert: - return final_query - return f'{final_query}\n FORMAT {self._write_format}' - - def _query_with_context(self, context: QueryContext) -> QueryResult: - headers = {} - params = {} - if self.database: - params['database'] = self.database - if self.protocol_version: - params['client_protocol_version'] = self.protocol_version - context.block_info = True - params.update(context.bind_params) - params.update(self._validate_settings(context.settings)) - if columns_only_re.search(context.uncommented_query): - response = self._raw_request(f'{context.final_query}\n FORMAT JSON', - params, headers, retries=self.query_retries) - json_result = json.loads(response.data) - # ClickHouse will respond with a JSON object of meta, data, and some other objects - # We just grab the column names and column types from the metadata sub object - names: List[str] = [] - types: List[ClickHouseType] = [] - for col in json_result['meta']: - names.append(col['name']) - types.append(registry.get_from_name(col['type'])) - return QueryResult([], None, tuple(names), tuple(types)) - - if self.compression: - headers['Accept-Encoding'] = self.compression - if self._send_comp_setting: - params['enable_http_compression'] = '1' - final_query = self._prep_query(context) - if context.external_data: - body = bytes() - params['query'] = final_query - params.update(context.external_data.query_params) - fields = context.external_data.form_data - else: - body = final_query - fields = None - headers['Content-Type'] = 'text/plain; charset=utf-8' - response = self._raw_request(body, - params, - headers, - stream=True, - retries=self.query_retries, - fields=fields, - server_wait=not context.streaming) - byte_source = RespBuffCls(ResponseSource(response)) # pylint: disable=not-callable - context.set_response_tz(self._check_tz_change(response.headers.get('X-ClickHouse-Timezone'))) - query_result = self._transform.parse_response(byte_source, context) - query_result.summary = self._summary(response) - return query_result - - def data_insert(self, context: InsertContext) -> QuerySummary: - """ - See BaseClient doc_string for this method - """ - if context.empty: - logger.debug('No data included in insert, skipping') - return QuerySummary() - if context.compression is None: - context.compression = self.write_compression - block_gen = self._transform.build_insert(context) - - def error_handler(response: HTTPResponse): - # If we actually had a local exception when building the insert, throw that instead - if context.insert_exception: - ex = context.insert_exception - context.insert_exception = None - raise ProgrammingError('Internal serialization error. This usually indicates invalid data types ' + - 'in an inserted row or column') from ex # type: ignore - self._error_handler(response) - - resp = self.raw_insert(insert_block=block_gen, - settings=context.settings, - compression=context.compression, - status_handler=error_handler) - context.data = None - return resp - - def raw_insert(self, table: str = None, - column_names: Optional[Sequence[str]] = None, - insert_block: Union[str, bytes, Generator[bytes, None, None], BinaryIO] = None, - settings: Optional[Dict] = None, - fmt: Optional[str] = None, - compression: Optional[str] = None, - status_handler: Optional[Callable] = None) -> QuerySummary: - """ - See BaseClient doc_string for this method - """ - write_format = fmt if fmt else self._write_format - params = {} - headers = {'Content-Type': 'application/octet-stream'} - if compression: - headers['Content-Encoding'] = compression - if table: - cols = f" ({', '.join([quote_identifier(x) for x in column_names])})" if column_names is not None else '' - query = f'INSERT INTO {table}{cols} FORMAT {write_format}' - if isinstance(insert_block, str): - insert_block = query + '\n' + insert_block - elif isinstance(insert_block, (bytes, bytearray, BinaryIO)): - insert_block = (query + '\n').encode() + insert_block - else: - params['query'] = query - if self.database: - params['database'] = self.database - params.update(self._validate_settings(settings or {})) - response = self._raw_request(insert_block, params, headers, - error_handler=status_handler, - server_wait=False) - logger.debug('Insert response code: %d, content: %s', response.status, response.data) - return QuerySummary(self._summary(response)) - - @staticmethod - def _summary(response: HTTPResponse): - summary = {} - if 'X-ClickHouse-Summary' in response.headers: - try: - summary = json.loads(response.headers['X-ClickHouse-Summary']) - except json.JSONDecodeError: - pass - summary['query_id'] = response.headers.get('X-ClickHouse-Query-Id', '') - return summary - - def command(self, - cmd, - parameters: Optional[Union[Sequence, Dict[str, Any]]] = None, - data: Union[str, bytes] = None, - settings: Optional[Dict] = None, - use_database: int = True, - external_data: Optional[ExternalData] = None) -> Union[str, int, Sequence[str], QuerySummary]: - """ - See BaseClient doc_string for this method - """ - cmd, params = bind_query(cmd, parameters, self.server_tz) - headers = {} - payload = None - fields = None - if external_data: - if data: - raise ProgrammingError('Cannot combine command data with external data') from None - fields = external_data.form_data - params.update(external_data.query_params) - elif isinstance(data, str): - headers['Content-Type'] = 'text/plain; charset=utf-8' - payload = data.encode() - elif isinstance(data, bytes): - headers['Content-Type'] = 'application/octet-stream' - payload = data - if payload is None and not cmd: - raise ProgrammingError('Command sent without query or recognized data') from None - if payload or fields: - params['query'] = cmd - else: - payload = cmd - if use_database and self.database: - params['database'] = self.database - params.update(self._validate_settings(settings or {})) - - method = 'POST' if payload or fields else 'GET' - response = self._raw_request(payload, params, headers, method, fields=fields) - if response.data: - try: - result = response.data.decode()[:-1].split('\t') - if len(result) == 1: - try: - return int(result[0]) - except ValueError: - return result[0] - return result - except UnicodeDecodeError: - return str(response.data) - return QuerySummary(self._summary(response)) - - def _error_handler(self, response: HTTPResponse, retried: bool = False) -> None: - err_str = f'HTTPDriver for {self.url} returned response code {response.status})' - err_content = get_response_data(response) - - if err_content: - err_msg = common.format_error(err_content.decode(errors='backslashreplace')) - err_str = f':{err_str}\n {err_msg}' - raise OperationalError(err_str) if retried else DatabaseError(err_str) from None - - def _raw_request(self, - data, - params: Dict[str, str], - headers: Optional[Dict[str, Any]] = None, - method: str = 'POST', - retries: int = 0, - stream: bool = False, - server_wait: bool = True, - fields: Optional[Dict[str, tuple]] = None, - error_handler: Callable = None) -> HTTPResponse: - if isinstance(data, str): - data = data.encode() - headers = dict_copy(self.headers, headers) - attempts = 0 - if server_wait: - params['wait_end_of_query'] = '1' - # We can't actually read the progress headers, but we enable them so ClickHouse sends something - # to keep the connection alive when waiting for long-running queries and (2) to get summary information - # if not streaming - if self._send_progress: - params['send_progress_in_http_headers'] = '1' - if self._progress_interval: - params['http_headers_progress_interval_ms'] = self._progress_interval - final_params = dict_copy(self.params, params) - url = f'{self.url}?{urlencode(final_params)}' - kwargs = { - 'headers': headers, - 'timeout': self.timeout, - 'retries': self.http_retries, - 'preload_content': not stream - } - if self.server_host_name: - kwargs['assert_same_host'] = False - kwargs['headers'].update({'Host': self.server_host_name}) - if fields: - kwargs['fields'] = fields - else: - kwargs['body'] = data - check_conn_reset(self.http) - query_session = final_params.get('session_id') - while True: - if query_session: - if query_session == self._active_session: - raise ProgrammingError('Attempt to execute concurrent queries within the same session.' + - 'Please use a separate client instance per thread/process.') - # There is a race condition here when using multiprocessing -- in that case the server will - # throw an error instead, but in most cases this more helpful error will be thrown first - self._active_session = query_session - try: - response: HTTPResponse = self.http.request(method, url, **kwargs) - except HTTPError as ex: - if isinstance(ex.__context__, ConnectionResetError): - # The server closed the connection, probably because the Keep Alive has expired - # We should be safe to retry, as ClickHouse should not have processed anything on a connection - # that it killed. We also only retry this once, as multiple disconnects are unlikely to be - # related to the Keep Alive settings - if attempts == 1: - logger.debug('Retrying remotely closed connection') - continue - logger.warning('Unexpected Http Driver Exception') - raise OperationalError(f'Error {ex} executing HTTP request {self.url}') from ex - finally: - if query_session: - self._active_session = None # Make sure we always clear this - if 200 <= response.status < 300: - return response - if response.status in (429, 503, 504): - if attempts > retries: - self._error_handler(response, True) - logger.debug('Retrying requests with status code %d', response.status) - else: - if error_handler: - error_handler(response) - self._error_handler(response) - - def ping(self): - """ - See BaseClient doc_string for this method - """ - try: - response = self.http.request('GET', f'{self.url}/ping', timeout=3) - return 200 <= response.status < 300 - except HTTPError: - logger.debug('ping failed', exc_info=True) - return False - - def raw_query(self, query: str, - parameters: Optional[Union[Sequence, Dict[str, Any]]] = None, - settings: Optional[Dict[str, Any]] = None, fmt: str = None, - use_database: bool = True, external_data: Optional[ExternalData] = None) -> bytes: - """ - See BaseClient doc_string for this method - """ - final_query, bind_params = bind_query(query, parameters, self.server_tz) - if fmt: - final_query += f'\n FORMAT {fmt}' - params = self._validate_settings(settings or {}) - if use_database and self.database: - params['database'] = self.database - params.update(bind_params) - if external_data: - body = bytes() - params['query'] = final_query - params.update(external_data.query_params) - fields = external_data.form_data - else: - body = final_query - fields = None - return self._raw_request(body, params, fields=fields).data - - def close(self): - if self._owns_pool_manager: - self.http.clear() - all_managers.pop(self.http, None) diff --git a/spaces/chuan-hd/law-assistant-chatbot/.venv/lib/python3.11/site-packages/dateutil/_common.py b/spaces/chuan-hd/law-assistant-chatbot/.venv/lib/python3.11/site-packages/dateutil/_common.py deleted file mode 100644 index 4eb2659bd2986125fcfb4afea5bae9efc2dcd1a0..0000000000000000000000000000000000000000 --- a/spaces/chuan-hd/law-assistant-chatbot/.venv/lib/python3.11/site-packages/dateutil/_common.py +++ /dev/null @@ -1,43 +0,0 @@ -""" -Common code used in multiple modules. -""" - - -class weekday(object): - __slots__ = ["weekday", "n"] - - def __init__(self, weekday, n=None): - self.weekday = weekday - self.n = n - - def __call__(self, n): - if n == self.n: - return self - else: - return self.__class__(self.weekday, n) - - def __eq__(self, other): - try: - if self.weekday != other.weekday or self.n != other.n: - return False - except AttributeError: - return False - return True - - def __hash__(self): - return hash(( - self.weekday, - self.n, - )) - - def __ne__(self, other): - return not (self == other) - - def __repr__(self): - s = ("MO", "TU", "WE", "TH", "FR", "SA", "SU")[self.weekday] - if not self.n: - return s - else: - return "%s(%+d)" % (s, self.n) - -# vim:ts=4:sw=4:et diff --git a/spaces/chuan-hd/law-assistant-chatbot/.venv/lib/python3.11/site-packages/fontTools/feaLib/ast.py b/spaces/chuan-hd/law-assistant-chatbot/.venv/lib/python3.11/site-packages/fontTools/feaLib/ast.py deleted file mode 100644 index 17c6cc3fbe494a076d2b59f4664ab9fe56ecd20f..0000000000000000000000000000000000000000 --- a/spaces/chuan-hd/law-assistant-chatbot/.venv/lib/python3.11/site-packages/fontTools/feaLib/ast.py +++ /dev/null @@ -1,2134 +0,0 @@ -from fontTools.feaLib.error import FeatureLibError -from fontTools.feaLib.location import FeatureLibLocation -from fontTools.misc.encodingTools import getEncoding -from fontTools.misc.textTools import byteord, tobytes -from collections import OrderedDict -import itertools - -SHIFT = " " * 4 - -__all__ = [ - "Element", - "FeatureFile", - "Comment", - "GlyphName", - "GlyphClass", - "GlyphClassName", - "MarkClassName", - "AnonymousBlock", - "Block", - "FeatureBlock", - "NestedBlock", - "LookupBlock", - "GlyphClassDefinition", - "GlyphClassDefStatement", - "MarkClass", - "MarkClassDefinition", - "AlternateSubstStatement", - "Anchor", - "AnchorDefinition", - "AttachStatement", - "AxisValueLocationStatement", - "BaseAxis", - "CVParametersNameStatement", - "ChainContextPosStatement", - "ChainContextSubstStatement", - "CharacterStatement", - "ConditionsetStatement", - "CursivePosStatement", - "ElidedFallbackName", - "ElidedFallbackNameID", - "Expression", - "FeatureNameStatement", - "FeatureReferenceStatement", - "FontRevisionStatement", - "HheaField", - "IgnorePosStatement", - "IgnoreSubstStatement", - "IncludeStatement", - "LanguageStatement", - "LanguageSystemStatement", - "LigatureCaretByIndexStatement", - "LigatureCaretByPosStatement", - "LigatureSubstStatement", - "LookupFlagStatement", - "LookupReferenceStatement", - "MarkBasePosStatement", - "MarkLigPosStatement", - "MarkMarkPosStatement", - "MultipleSubstStatement", - "NameRecord", - "OS2Field", - "PairPosStatement", - "ReverseChainSingleSubstStatement", - "ScriptStatement", - "SinglePosStatement", - "SingleSubstStatement", - "SizeParameters", - "Statement", - "STATAxisValueStatement", - "STATDesignAxisStatement", - "STATNameStatement", - "SubtableStatement", - "TableBlock", - "ValueRecord", - "ValueRecordDefinition", - "VheaField", -] - - -def deviceToString(device): - if device is None: - return "" - else: - return "" % ", ".join("%d %d" % t for t in device) - - -fea_keywords = set( - [ - "anchor", - "anchordef", - "anon", - "anonymous", - "by", - "contour", - "cursive", - "device", - "enum", - "enumerate", - "excludedflt", - "exclude_dflt", - "feature", - "from", - "ignore", - "ignorebaseglyphs", - "ignoreligatures", - "ignoremarks", - "include", - "includedflt", - "include_dflt", - "language", - "languagesystem", - "lookup", - "lookupflag", - "mark", - "markattachmenttype", - "markclass", - "nameid", - "null", - "parameters", - "pos", - "position", - "required", - "righttoleft", - "reversesub", - "rsub", - "script", - "sub", - "substitute", - "subtable", - "table", - "usemarkfilteringset", - "useextension", - "valuerecorddef", - "base", - "gdef", - "head", - "hhea", - "name", - "vhea", - "vmtx", - ] -) - - -def asFea(g): - if hasattr(g, "asFea"): - return g.asFea() - elif isinstance(g, tuple) and len(g) == 2: - return asFea(g[0]) + " - " + asFea(g[1]) # a range - elif g.lower() in fea_keywords: - return "\\" + g - else: - return g - - -class Element(object): - """A base class representing "something" in a feature file.""" - - def __init__(self, location=None): - #: location of this element as a `FeatureLibLocation` object. - if location and not isinstance(location, FeatureLibLocation): - location = FeatureLibLocation(*location) - self.location = location - - def build(self, builder): - pass - - def asFea(self, indent=""): - """Returns this element as a string of feature code. For block-type - elements (such as :class:`FeatureBlock`), the `indent` string is - added to the start of each line in the output.""" - raise NotImplementedError - - def __str__(self): - return self.asFea() - - -class Statement(Element): - pass - - -class Expression(Element): - pass - - -class Comment(Element): - """A comment in a feature file.""" - - def __init__(self, text, location=None): - super(Comment, self).__init__(location) - #: Text of the comment - self.text = text - - def asFea(self, indent=""): - return self.text - - -class NullGlyph(Expression): - """The NULL glyph, used in glyph deletion substitutions.""" - - def __init__(self, location=None): - Expression.__init__(self, location) - #: The name itself as a string - - def glyphSet(self): - """The glyphs in this class as a tuple of :class:`GlyphName` objects.""" - return () - - def asFea(self, indent=""): - return "NULL" - - -class GlyphName(Expression): - """A single glyph name, such as ``cedilla``.""" - - def __init__(self, glyph, location=None): - Expression.__init__(self, location) - #: The name itself as a string - self.glyph = glyph - - def glyphSet(self): - """The glyphs in this class as a tuple of :class:`GlyphName` objects.""" - return (self.glyph,) - - def asFea(self, indent=""): - return asFea(self.glyph) - - -class GlyphClass(Expression): - """A glyph class, such as ``[acute cedilla grave]``.""" - - def __init__(self, glyphs=None, location=None): - Expression.__init__(self, location) - #: The list of glyphs in this class, as :class:`GlyphName` objects. - self.glyphs = glyphs if glyphs is not None else [] - self.original = [] - self.curr = 0 - - def glyphSet(self): - """The glyphs in this class as a tuple of :class:`GlyphName` objects.""" - return tuple(self.glyphs) - - def asFea(self, indent=""): - if len(self.original): - if self.curr < len(self.glyphs): - self.original.extend(self.glyphs[self.curr :]) - self.curr = len(self.glyphs) - return "[" + " ".join(map(asFea, self.original)) + "]" - else: - return "[" + " ".join(map(asFea, self.glyphs)) + "]" - - def extend(self, glyphs): - """Add a list of :class:`GlyphName` objects to the class.""" - self.glyphs.extend(glyphs) - - def append(self, glyph): - """Add a single :class:`GlyphName` object to the class.""" - self.glyphs.append(glyph) - - def add_range(self, start, end, glyphs): - """Add a range (e.g. ``A-Z``) to the class. ``start`` and ``end`` - are either :class:`GlyphName` objects or strings representing the - start and end glyphs in the class, and ``glyphs`` is the full list of - :class:`GlyphName` objects in the range.""" - if self.curr < len(self.glyphs): - self.original.extend(self.glyphs[self.curr :]) - self.original.append((start, end)) - self.glyphs.extend(glyphs) - self.curr = len(self.glyphs) - - def add_cid_range(self, start, end, glyphs): - """Add a range to the class by glyph ID. ``start`` and ``end`` are the - initial and final IDs, and ``glyphs`` is the full list of - :class:`GlyphName` objects in the range.""" - if self.curr < len(self.glyphs): - self.original.extend(self.glyphs[self.curr :]) - self.original.append(("\\{}".format(start), "\\{}".format(end))) - self.glyphs.extend(glyphs) - self.curr = len(self.glyphs) - - def add_class(self, gc): - """Add glyphs from the given :class:`GlyphClassName` object to the - class.""" - if self.curr < len(self.glyphs): - self.original.extend(self.glyphs[self.curr :]) - self.original.append(gc) - self.glyphs.extend(gc.glyphSet()) - self.curr = len(self.glyphs) - - -class GlyphClassName(Expression): - """A glyph class name, such as ``@FRENCH_MARKS``. This must be instantiated - with a :class:`GlyphClassDefinition` object.""" - - def __init__(self, glyphclass, location=None): - Expression.__init__(self, location) - assert isinstance(glyphclass, GlyphClassDefinition) - self.glyphclass = glyphclass - - def glyphSet(self): - """The glyphs in this class as a tuple of :class:`GlyphName` objects.""" - return tuple(self.glyphclass.glyphSet()) - - def asFea(self, indent=""): - return "@" + self.glyphclass.name - - -class MarkClassName(Expression): - """A mark class name, such as ``@FRENCH_MARKS`` defined with ``markClass``. - This must be instantiated with a :class:`MarkClass` object.""" - - def __init__(self, markClass, location=None): - Expression.__init__(self, location) - assert isinstance(markClass, MarkClass) - self.markClass = markClass - - def glyphSet(self): - """The glyphs in this class as a tuple of :class:`GlyphName` objects.""" - return self.markClass.glyphSet() - - def asFea(self, indent=""): - return "@" + self.markClass.name - - -class AnonymousBlock(Statement): - """An anonymous data block.""" - - def __init__(self, tag, content, location=None): - Statement.__init__(self, location) - self.tag = tag #: string containing the block's "tag" - self.content = content #: block data as string - - def asFea(self, indent=""): - res = "anon {} {{\n".format(self.tag) - res += self.content - res += "}} {};\n\n".format(self.tag) - return res - - -class Block(Statement): - """A block of statements: feature, lookup, etc.""" - - def __init__(self, location=None): - Statement.__init__(self, location) - self.statements = [] #: Statements contained in the block - - def build(self, builder): - """When handed a 'builder' object of comparable interface to - :class:`fontTools.feaLib.builder`, walks the statements in this - block, calling the builder callbacks.""" - for s in self.statements: - s.build(builder) - - def asFea(self, indent=""): - indent += SHIFT - return ( - indent - + ("\n" + indent).join([s.asFea(indent=indent) for s in self.statements]) - + "\n" - ) - - -class FeatureFile(Block): - """The top-level element of the syntax tree, containing the whole feature - file in its ``statements`` attribute.""" - - def __init__(self): - Block.__init__(self, location=None) - self.markClasses = {} # name --> ast.MarkClass - - def asFea(self, indent=""): - return "\n".join(s.asFea(indent=indent) for s in self.statements) - - -class FeatureBlock(Block): - """A named feature block.""" - - def __init__(self, name, use_extension=False, location=None): - Block.__init__(self, location) - self.name, self.use_extension = name, use_extension - - def build(self, builder): - """Call the ``start_feature`` callback on the builder object, visit - all the statements in this feature, and then call ``end_feature``.""" - # TODO(sascha): Handle use_extension. - builder.start_feature(self.location, self.name) - # language exclude_dflt statements modify builder.features_ - # limit them to this block with temporary builder.features_ - features = builder.features_ - builder.features_ = {} - Block.build(self, builder) - for key, value in builder.features_.items(): - features.setdefault(key, []).extend(value) - builder.features_ = features - builder.end_feature() - - def asFea(self, indent=""): - res = indent + "feature %s " % self.name.strip() - if self.use_extension: - res += "useExtension " - res += "{\n" - res += Block.asFea(self, indent=indent) - res += indent + "} %s;\n" % self.name.strip() - return res - - -class NestedBlock(Block): - """A block inside another block, for example when found inside a - ``cvParameters`` block.""" - - def __init__(self, tag, block_name, location=None): - Block.__init__(self, location) - self.tag = tag - self.block_name = block_name - - def build(self, builder): - Block.build(self, builder) - if self.block_name == "ParamUILabelNameID": - builder.add_to_cv_num_named_params(self.tag) - - def asFea(self, indent=""): - res = "{}{} {{\n".format(indent, self.block_name) - res += Block.asFea(self, indent=indent) - res += "{}}};\n".format(indent) - return res - - -class LookupBlock(Block): - """A named lookup, containing ``statements``.""" - - def __init__(self, name, use_extension=False, location=None): - Block.__init__(self, location) - self.name, self.use_extension = name, use_extension - - def build(self, builder): - # TODO(sascha): Handle use_extension. - builder.start_lookup_block(self.location, self.name) - Block.build(self, builder) - builder.end_lookup_block() - - def asFea(self, indent=""): - res = "lookup {} ".format(self.name) - if self.use_extension: - res += "useExtension " - res += "{\n" - res += Block.asFea(self, indent=indent) - res += "{}}} {};\n".format(indent, self.name) - return res - - -class TableBlock(Block): - """A ``table ... { }`` block.""" - - def __init__(self, name, location=None): - Block.__init__(self, location) - self.name = name - - def asFea(self, indent=""): - res = "table {} {{\n".format(self.name.strip()) - res += super(TableBlock, self).asFea(indent=indent) - res += "}} {};\n".format(self.name.strip()) - return res - - -class GlyphClassDefinition(Statement): - """Example: ``@UPPERCASE = [A-Z];``.""" - - def __init__(self, name, glyphs, location=None): - Statement.__init__(self, location) - self.name = name #: class name as a string, without initial ``@`` - self.glyphs = glyphs #: a :class:`GlyphClass` object - - def glyphSet(self): - """The glyphs in this class as a tuple of :class:`GlyphName` objects.""" - return tuple(self.glyphs.glyphSet()) - - def asFea(self, indent=""): - return "@" + self.name + " = " + self.glyphs.asFea() + ";" - - -class GlyphClassDefStatement(Statement): - """Example: ``GlyphClassDef @UPPERCASE, [B], [C], [D];``. The parameters - must be either :class:`GlyphClass` or :class:`GlyphClassName` objects, or - ``None``.""" - - def __init__( - self, baseGlyphs, markGlyphs, ligatureGlyphs, componentGlyphs, location=None - ): - Statement.__init__(self, location) - self.baseGlyphs, self.markGlyphs = (baseGlyphs, markGlyphs) - self.ligatureGlyphs = ligatureGlyphs - self.componentGlyphs = componentGlyphs - - def build(self, builder): - """Calls the builder's ``add_glyphClassDef`` callback.""" - base = self.baseGlyphs.glyphSet() if self.baseGlyphs else tuple() - liga = self.ligatureGlyphs.glyphSet() if self.ligatureGlyphs else tuple() - mark = self.markGlyphs.glyphSet() if self.markGlyphs else tuple() - comp = self.componentGlyphs.glyphSet() if self.componentGlyphs else tuple() - builder.add_glyphClassDef(self.location, base, liga, mark, comp) - - def asFea(self, indent=""): - return "GlyphClassDef {}, {}, {}, {};".format( - self.baseGlyphs.asFea() if self.baseGlyphs else "", - self.ligatureGlyphs.asFea() if self.ligatureGlyphs else "", - self.markGlyphs.asFea() if self.markGlyphs else "", - self.componentGlyphs.asFea() if self.componentGlyphs else "", - ) - - -class MarkClass(object): - """One `or more` ``markClass`` statements for the same mark class. - - While glyph classes can be defined only once, the feature file format - allows expanding mark classes with multiple definitions, each using - different glyphs and anchors. The following are two ``MarkClassDefinitions`` - for the same ``MarkClass``:: - - markClass [acute grave] @FRENCH_ACCENTS; - markClass [cedilla] @FRENCH_ACCENTS; - - The ``MarkClass`` object is therefore just a container for a list of - :class:`MarkClassDefinition` statements. - """ - - def __init__(self, name): - self.name = name - self.definitions = [] - self.glyphs = OrderedDict() # glyph --> ast.MarkClassDefinitions - - def addDefinition(self, definition): - """Add a :class:`MarkClassDefinition` statement to this mark class.""" - assert isinstance(definition, MarkClassDefinition) - self.definitions.append(definition) - for glyph in definition.glyphSet(): - if glyph in self.glyphs: - otherLoc = self.glyphs[glyph].location - if otherLoc is None: - end = "" - else: - end = f" at {otherLoc}" - raise FeatureLibError( - "Glyph %s already defined%s" % (glyph, end), definition.location - ) - self.glyphs[glyph] = definition - - def glyphSet(self): - """The glyphs in this class as a tuple of :class:`GlyphName` objects.""" - return tuple(self.glyphs.keys()) - - def asFea(self, indent=""): - res = "\n".join(d.asFea() for d in self.definitions) - return res - - -class MarkClassDefinition(Statement): - """A single ``markClass`` statement. The ``markClass`` should be a - :class:`MarkClass` object, the ``anchor`` an :class:`Anchor` object, - and the ``glyphs`` parameter should be a `glyph-containing object`_ . - - Example: - - .. code:: python - - mc = MarkClass("FRENCH_ACCENTS") - mc.addDefinition( MarkClassDefinition(mc, Anchor(350, 800), - GlyphClass([ GlyphName("acute"), GlyphName("grave") ]) - ) ) - mc.addDefinition( MarkClassDefinition(mc, Anchor(350, -200), - GlyphClass([ GlyphName("cedilla") ]) - ) ) - - mc.asFea() - # markClass [acute grave] @FRENCH_ACCENTS; - # markClass [cedilla] @FRENCH_ACCENTS; - - """ - - def __init__(self, markClass, anchor, glyphs, location=None): - Statement.__init__(self, location) - assert isinstance(markClass, MarkClass) - assert isinstance(anchor, Anchor) and isinstance(glyphs, Expression) - self.markClass, self.anchor, self.glyphs = markClass, anchor, glyphs - - def glyphSet(self): - """The glyphs in this class as a tuple of :class:`GlyphName` objects.""" - return self.glyphs.glyphSet() - - def asFea(self, indent=""): - return "markClass {} {} @{};".format( - self.glyphs.asFea(), self.anchor.asFea(), self.markClass.name - ) - - -class AlternateSubstStatement(Statement): - """A ``sub ... from ...`` statement. - - ``prefix``, ``glyph``, ``suffix`` and ``replacement`` should be lists of - `glyph-containing objects`_. ``glyph`` should be a `one element list`.""" - - def __init__(self, prefix, glyph, suffix, replacement, location=None): - Statement.__init__(self, location) - self.prefix, self.glyph, self.suffix = (prefix, glyph, suffix) - self.replacement = replacement - - def build(self, builder): - """Calls the builder's ``add_alternate_subst`` callback.""" - glyph = self.glyph.glyphSet() - assert len(glyph) == 1, glyph - glyph = list(glyph)[0] - prefix = [p.glyphSet() for p in self.prefix] - suffix = [s.glyphSet() for s in self.suffix] - replacement = self.replacement.glyphSet() - builder.add_alternate_subst(self.location, prefix, glyph, suffix, replacement) - - def asFea(self, indent=""): - res = "sub " - if len(self.prefix) or len(self.suffix): - if len(self.prefix): - res += " ".join(map(asFea, self.prefix)) + " " - res += asFea(self.glyph) + "'" # even though we really only use 1 - if len(self.suffix): - res += " " + " ".join(map(asFea, self.suffix)) - else: - res += asFea(self.glyph) - res += " from " - res += asFea(self.replacement) - res += ";" - return res - - -class Anchor(Expression): - """An ``Anchor`` element, used inside a ``pos`` rule. - - If a ``name`` is given, this will be used in preference to the coordinates. - Other values should be integer. - """ - - def __init__( - self, - x, - y, - name=None, - contourpoint=None, - xDeviceTable=None, - yDeviceTable=None, - location=None, - ): - Expression.__init__(self, location) - self.name = name - self.x, self.y, self.contourpoint = x, y, contourpoint - self.xDeviceTable, self.yDeviceTable = xDeviceTable, yDeviceTable - - def asFea(self, indent=""): - if self.name is not None: - return "".format(self.name) - res = "" - exit = self.exitAnchor.asFea() if self.exitAnchor else "" - return "pos cursive {} {} {};".format(self.glyphclass.asFea(), entry, exit) - - -class FeatureReferenceStatement(Statement): - """Example: ``feature salt;``""" - - def __init__(self, featureName, location=None): - Statement.__init__(self, location) - self.location, self.featureName = (location, featureName) - - def build(self, builder): - """Calls the builder object's ``add_feature_reference`` callback.""" - builder.add_feature_reference(self.location, self.featureName) - - def asFea(self, indent=""): - return "feature {};".format(self.featureName) - - -class IgnorePosStatement(Statement): - """An ``ignore pos`` statement, containing `one or more` contexts to ignore. - - ``chainContexts`` should be a list of ``(prefix, glyphs, suffix)`` tuples, - with each of ``prefix``, ``glyphs`` and ``suffix`` being - `glyph-containing objects`_ .""" - - def __init__(self, chainContexts, location=None): - Statement.__init__(self, location) - self.chainContexts = chainContexts - - def build(self, builder): - """Calls the builder object's ``add_chain_context_pos`` callback on each - rule context.""" - for prefix, glyphs, suffix in self.chainContexts: - prefix = [p.glyphSet() for p in prefix] - glyphs = [g.glyphSet() for g in glyphs] - suffix = [s.glyphSet() for s in suffix] - builder.add_chain_context_pos(self.location, prefix, glyphs, suffix, []) - - def asFea(self, indent=""): - contexts = [] - for prefix, glyphs, suffix in self.chainContexts: - res = "" - if len(prefix) or len(suffix): - if len(prefix): - res += " ".join(map(asFea, prefix)) + " " - res += " ".join(g.asFea() + "'" for g in glyphs) - if len(suffix): - res += " " + " ".join(map(asFea, suffix)) - else: - res += " ".join(map(asFea, glyphs)) - contexts.append(res) - return "ignore pos " + ", ".join(contexts) + ";" - - -class IgnoreSubstStatement(Statement): - """An ``ignore sub`` statement, containing `one or more` contexts to ignore. - - ``chainContexts`` should be a list of ``(prefix, glyphs, suffix)`` tuples, - with each of ``prefix``, ``glyphs`` and ``suffix`` being - `glyph-containing objects`_ .""" - - def __init__(self, chainContexts, location=None): - Statement.__init__(self, location) - self.chainContexts = chainContexts - - def build(self, builder): - """Calls the builder object's ``add_chain_context_subst`` callback on - each rule context.""" - for prefix, glyphs, suffix in self.chainContexts: - prefix = [p.glyphSet() for p in prefix] - glyphs = [g.glyphSet() for g in glyphs] - suffix = [s.glyphSet() for s in suffix] - builder.add_chain_context_subst(self.location, prefix, glyphs, suffix, []) - - def asFea(self, indent=""): - contexts = [] - for prefix, glyphs, suffix in self.chainContexts: - res = "" - if len(prefix): - res += " ".join(map(asFea, prefix)) + " " - res += " ".join(g.asFea() + "'" for g in glyphs) - if len(suffix): - res += " " + " ".join(map(asFea, suffix)) - contexts.append(res) - return "ignore sub " + ", ".join(contexts) + ";" - - -class IncludeStatement(Statement): - """An ``include()`` statement.""" - - def __init__(self, filename, location=None): - super(IncludeStatement, self).__init__(location) - self.filename = filename #: String containing name of file to include - - def build(self): - # TODO: consider lazy-loading the including parser/lexer? - raise FeatureLibError( - "Building an include statement is not implemented yet. " - "Instead, use Parser(..., followIncludes=True) for building.", - self.location, - ) - - def asFea(self, indent=""): - return indent + "include(%s);" % self.filename - - -class LanguageStatement(Statement): - """A ``language`` statement within a feature.""" - - def __init__(self, language, include_default=True, required=False, location=None): - Statement.__init__(self, location) - assert len(language) == 4 - self.language = language #: A four-character language tag - self.include_default = include_default #: If false, "exclude_dflt" - self.required = required - - def build(self, builder): - """Call the builder object's ``set_language`` callback.""" - builder.set_language( - location=self.location, - language=self.language, - include_default=self.include_default, - required=self.required, - ) - - def asFea(self, indent=""): - res = "language {}".format(self.language.strip()) - if not self.include_default: - res += " exclude_dflt" - if self.required: - res += " required" - res += ";" - return res - - -class LanguageSystemStatement(Statement): - """A top-level ``languagesystem`` statement.""" - - def __init__(self, script, language, location=None): - Statement.__init__(self, location) - self.script, self.language = (script, language) - - def build(self, builder): - """Calls the builder object's ``add_language_system`` callback.""" - builder.add_language_system(self.location, self.script, self.language) - - def asFea(self, indent=""): - return "languagesystem {} {};".format(self.script, self.language.strip()) - - -class FontRevisionStatement(Statement): - """A ``head`` table ``FontRevision`` statement. ``revision`` should be a - number, and will be formatted to three significant decimal places.""" - - def __init__(self, revision, location=None): - Statement.__init__(self, location) - self.revision = revision - - def build(self, builder): - builder.set_font_revision(self.location, self.revision) - - def asFea(self, indent=""): - return "FontRevision {:.3f};".format(self.revision) - - -class LigatureCaretByIndexStatement(Statement): - """A ``GDEF`` table ``LigatureCaretByIndex`` statement. ``glyphs`` should be - a `glyph-containing object`_, and ``carets`` should be a list of integers.""" - - def __init__(self, glyphs, carets, location=None): - Statement.__init__(self, location) - self.glyphs, self.carets = (glyphs, carets) - - def build(self, builder): - """Calls the builder object's ``add_ligatureCaretByIndex_`` callback.""" - glyphs = self.glyphs.glyphSet() - builder.add_ligatureCaretByIndex_(self.location, glyphs, set(self.carets)) - - def asFea(self, indent=""): - return "LigatureCaretByIndex {} {};".format( - self.glyphs.asFea(), " ".join(str(x) for x in self.carets) - ) - - -class LigatureCaretByPosStatement(Statement): - """A ``GDEF`` table ``LigatureCaretByPos`` statement. ``glyphs`` should be - a `glyph-containing object`_, and ``carets`` should be a list of integers.""" - - def __init__(self, glyphs, carets, location=None): - Statement.__init__(self, location) - self.glyphs, self.carets = (glyphs, carets) - - def build(self, builder): - """Calls the builder object's ``add_ligatureCaretByPos_`` callback.""" - glyphs = self.glyphs.glyphSet() - builder.add_ligatureCaretByPos_(self.location, glyphs, set(self.carets)) - - def asFea(self, indent=""): - return "LigatureCaretByPos {} {};".format( - self.glyphs.asFea(), " ".join(str(x) for x in self.carets) - ) - - -class LigatureSubstStatement(Statement): - """A chained contextual substitution statement. - - ``prefix``, ``glyphs``, and ``suffix`` should be lists of - `glyph-containing objects`_; ``replacement`` should be a single - `glyph-containing object`_. - - If ``forceChain`` is True, this is expressed as a chaining rule - (e.g. ``sub f' i' by f_i``) even when no context is given.""" - - def __init__(self, prefix, glyphs, suffix, replacement, forceChain, location=None): - Statement.__init__(self, location) - self.prefix, self.glyphs, self.suffix = (prefix, glyphs, suffix) - self.replacement, self.forceChain = replacement, forceChain - - def build(self, builder): - prefix = [p.glyphSet() for p in self.prefix] - glyphs = [g.glyphSet() for g in self.glyphs] - suffix = [s.glyphSet() for s in self.suffix] - builder.add_ligature_subst( - self.location, prefix, glyphs, suffix, self.replacement, self.forceChain - ) - - def asFea(self, indent=""): - res = "sub " - if len(self.prefix) or len(self.suffix) or self.forceChain: - if len(self.prefix): - res += " ".join(g.asFea() for g in self.prefix) + " " - res += " ".join(g.asFea() + "'" for g in self.glyphs) - if len(self.suffix): - res += " " + " ".join(g.asFea() for g in self.suffix) - else: - res += " ".join(g.asFea() for g in self.glyphs) - res += " by " - res += asFea(self.replacement) - res += ";" - return res - - -class LookupFlagStatement(Statement): - """A ``lookupflag`` statement. The ``value`` should be an integer value - representing the flags in use, but not including the ``markAttachment`` - class and ``markFilteringSet`` values, which must be specified as - glyph-containing objects.""" - - def __init__( - self, value=0, markAttachment=None, markFilteringSet=None, location=None - ): - Statement.__init__(self, location) - self.value = value - self.markAttachment = markAttachment - self.markFilteringSet = markFilteringSet - - def build(self, builder): - """Calls the builder object's ``set_lookup_flag`` callback.""" - markAttach = None - if self.markAttachment is not None: - markAttach = self.markAttachment.glyphSet() - markFilter = None - if self.markFilteringSet is not None: - markFilter = self.markFilteringSet.glyphSet() - builder.set_lookup_flag(self.location, self.value, markAttach, markFilter) - - def asFea(self, indent=""): - res = [] - flags = ["RightToLeft", "IgnoreBaseGlyphs", "IgnoreLigatures", "IgnoreMarks"] - curr = 1 - for i in range(len(flags)): - if self.value & curr != 0: - res.append(flags[i]) - curr = curr << 1 - if self.markAttachment is not None: - res.append("MarkAttachmentType {}".format(self.markAttachment.asFea())) - if self.markFilteringSet is not None: - res.append("UseMarkFilteringSet {}".format(self.markFilteringSet.asFea())) - if not res: - res = ["0"] - return "lookupflag {};".format(" ".join(res)) - - -class LookupReferenceStatement(Statement): - """Represents a ``lookup ...;`` statement to include a lookup in a feature. - - The ``lookup`` should be a :class:`LookupBlock` object.""" - - def __init__(self, lookup, location=None): - Statement.__init__(self, location) - self.location, self.lookup = (location, lookup) - - def build(self, builder): - """Calls the builder object's ``add_lookup_call`` callback.""" - builder.add_lookup_call(self.lookup.name) - - def asFea(self, indent=""): - return "lookup {};".format(self.lookup.name) - - -class MarkBasePosStatement(Statement): - """A mark-to-base positioning rule. The ``base`` should be a - `glyph-containing object`_. The ``marks`` should be a list of - (:class:`Anchor`, :class:`MarkClass`) tuples.""" - - def __init__(self, base, marks, location=None): - Statement.__init__(self, location) - self.base, self.marks = base, marks - - def build(self, builder): - """Calls the builder object's ``add_mark_base_pos`` callback.""" - builder.add_mark_base_pos(self.location, self.base.glyphSet(), self.marks) - - def asFea(self, indent=""): - res = "pos base {}".format(self.base.asFea()) - for a, m in self.marks: - res += "\n" + indent + SHIFT + "{} mark @{}".format(a.asFea(), m.name) - res += ";" - return res - - -class MarkLigPosStatement(Statement): - """A mark-to-ligature positioning rule. The ``ligatures`` must be a - `glyph-containing object`_. The ``marks`` should be a list of lists: each - element in the top-level list represents a component glyph, and is made - up of a list of (:class:`Anchor`, :class:`MarkClass`) tuples representing - mark attachment points for that position. - - Example:: - - m1 = MarkClass("TOP_MARKS") - m2 = MarkClass("BOTTOM_MARKS") - # ... add definitions to mark classes... - - glyph = GlyphName("lam_meem_jeem") - marks = [ - [ (Anchor(625,1800), m1) ], # Attachments on 1st component (lam) - [ (Anchor(376,-378), m2) ], # Attachments on 2nd component (meem) - [ ] # No attachments on the jeem - ] - mlp = MarkLigPosStatement(glyph, marks) - - mlp.asFea() - # pos ligature lam_meem_jeem mark @TOP_MARKS - # ligComponent mark @BOTTOM_MARKS; - - """ - - def __init__(self, ligatures, marks, location=None): - Statement.__init__(self, location) - self.ligatures, self.marks = ligatures, marks - - def build(self, builder): - """Calls the builder object's ``add_mark_lig_pos`` callback.""" - builder.add_mark_lig_pos(self.location, self.ligatures.glyphSet(), self.marks) - - def asFea(self, indent=""): - res = "pos ligature {}".format(self.ligatures.asFea()) - ligs = [] - for l in self.marks: - temp = "" - if l is None or not len(l): - temp = "\n" + indent + SHIFT * 2 + "" - else: - for a, m in l: - temp += ( - "\n" - + indent - + SHIFT * 2 - + "{} mark @{}".format(a.asFea(), m.name) - ) - ligs.append(temp) - res += ("\n" + indent + SHIFT + "ligComponent").join(ligs) - res += ";" - return res - - -class MarkMarkPosStatement(Statement): - """A mark-to-mark positioning rule. The ``baseMarks`` must be a - `glyph-containing object`_. The ``marks`` should be a list of - (:class:`Anchor`, :class:`MarkClass`) tuples.""" - - def __init__(self, baseMarks, marks, location=None): - Statement.__init__(self, location) - self.baseMarks, self.marks = baseMarks, marks - - def build(self, builder): - """Calls the builder object's ``add_mark_mark_pos`` callback.""" - builder.add_mark_mark_pos(self.location, self.baseMarks.glyphSet(), self.marks) - - def asFea(self, indent=""): - res = "pos mark {}".format(self.baseMarks.asFea()) - for a, m in self.marks: - res += "\n" + indent + SHIFT + "{} mark @{}".format(a.asFea(), m.name) - res += ";" - return res - - -class MultipleSubstStatement(Statement): - """A multiple substitution statement. - - Args: - prefix: a list of `glyph-containing objects`_. - glyph: a single glyph-containing object. - suffix: a list of glyph-containing objects. - replacement: a list of glyph-containing objects. - forceChain: If true, the statement is expressed as a chaining rule - (e.g. ``sub f' i' by f_i``) even when no context is given. - """ - - def __init__( - self, prefix, glyph, suffix, replacement, forceChain=False, location=None - ): - Statement.__init__(self, location) - self.prefix, self.glyph, self.suffix = prefix, glyph, suffix - self.replacement = replacement - self.forceChain = forceChain - - def build(self, builder): - """Calls the builder object's ``add_multiple_subst`` callback.""" - prefix = [p.glyphSet() for p in self.prefix] - suffix = [s.glyphSet() for s in self.suffix] - if hasattr(self.glyph, "glyphSet"): - originals = self.glyph.glyphSet() - else: - originals = [self.glyph] - count = len(originals) - replaces = [] - for r in self.replacement: - if hasattr(r, "glyphSet"): - replace = r.glyphSet() - else: - replace = [r] - if len(replace) == 1 and len(replace) != count: - replace = replace * count - replaces.append(replace) - replaces = list(zip(*replaces)) - - seen_originals = set() - for i, original in enumerate(originals): - if original not in seen_originals: - seen_originals.add(original) - builder.add_multiple_subst( - self.location, - prefix, - original, - suffix, - replaces and replaces[i] or (), - self.forceChain, - ) - - def asFea(self, indent=""): - res = "sub " - if len(self.prefix) or len(self.suffix) or self.forceChain: - if len(self.prefix): - res += " ".join(map(asFea, self.prefix)) + " " - res += asFea(self.glyph) + "'" - if len(self.suffix): - res += " " + " ".join(map(asFea, self.suffix)) - else: - res += asFea(self.glyph) - replacement = self.replacement or [NullGlyph()] - res += " by " - res += " ".join(map(asFea, replacement)) - res += ";" - return res - - -class PairPosStatement(Statement): - """A pair positioning statement. - - ``glyphs1`` and ``glyphs2`` should be `glyph-containing objects`_. - ``valuerecord1`` should be a :class:`ValueRecord` object; - ``valuerecord2`` should be either a :class:`ValueRecord` object or ``None``. - If ``enumerated`` is true, then this is expressed as an - `enumerated pair `_. - """ - - def __init__( - self, - glyphs1, - valuerecord1, - glyphs2, - valuerecord2, - enumerated=False, - location=None, - ): - Statement.__init__(self, location) - self.enumerated = enumerated - self.glyphs1, self.valuerecord1 = glyphs1, valuerecord1 - self.glyphs2, self.valuerecord2 = glyphs2, valuerecord2 - - def build(self, builder): - """Calls a callback on the builder object: - - * If the rule is enumerated, calls ``add_specific_pair_pos`` on each - combination of first and second glyphs. - * If the glyphs are both single :class:`GlyphName` objects, calls - ``add_specific_pair_pos``. - * Else, calls ``add_class_pair_pos``. - """ - if self.enumerated: - g = [self.glyphs1.glyphSet(), self.glyphs2.glyphSet()] - seen_pair = False - for glyph1, glyph2 in itertools.product(*g): - seen_pair = True - builder.add_specific_pair_pos( - self.location, glyph1, self.valuerecord1, glyph2, self.valuerecord2 - ) - if not seen_pair: - raise FeatureLibError( - "Empty glyph class in positioning rule", self.location - ) - return - - is_specific = isinstance(self.glyphs1, GlyphName) and isinstance( - self.glyphs2, GlyphName - ) - if is_specific: - builder.add_specific_pair_pos( - self.location, - self.glyphs1.glyph, - self.valuerecord1, - self.glyphs2.glyph, - self.valuerecord2, - ) - else: - builder.add_class_pair_pos( - self.location, - self.glyphs1.glyphSet(), - self.valuerecord1, - self.glyphs2.glyphSet(), - self.valuerecord2, - ) - - def asFea(self, indent=""): - res = "enum " if self.enumerated else "" - if self.valuerecord2: - res += "pos {} {} {} {};".format( - self.glyphs1.asFea(), - self.valuerecord1.asFea(), - self.glyphs2.asFea(), - self.valuerecord2.asFea(), - ) - else: - res += "pos {} {} {};".format( - self.glyphs1.asFea(), self.glyphs2.asFea(), self.valuerecord1.asFea() - ) - return res - - -class ReverseChainSingleSubstStatement(Statement): - """A reverse chaining substitution statement. You don't see those every day. - - Note the unusual argument order: ``suffix`` comes `before` ``glyphs``. - ``old_prefix``, ``old_suffix``, ``glyphs`` and ``replacements`` should be - lists of `glyph-containing objects`_. ``glyphs`` and ``replacements`` should - be one-item lists. - """ - - def __init__(self, old_prefix, old_suffix, glyphs, replacements, location=None): - Statement.__init__(self, location) - self.old_prefix, self.old_suffix = old_prefix, old_suffix - self.glyphs = glyphs - self.replacements = replacements - - def build(self, builder): - prefix = [p.glyphSet() for p in self.old_prefix] - suffix = [s.glyphSet() for s in self.old_suffix] - originals = self.glyphs[0].glyphSet() - replaces = self.replacements[0].glyphSet() - if len(replaces) == 1: - replaces = replaces * len(originals) - builder.add_reverse_chain_single_subst( - self.location, prefix, suffix, dict(zip(originals, replaces)) - ) - - def asFea(self, indent=""): - res = "rsub " - if len(self.old_prefix) or len(self.old_suffix): - if len(self.old_prefix): - res += " ".join(asFea(g) for g in self.old_prefix) + " " - res += " ".join(asFea(g) + "'" for g in self.glyphs) - if len(self.old_suffix): - res += " " + " ".join(asFea(g) for g in self.old_suffix) - else: - res += " ".join(map(asFea, self.glyphs)) - res += " by {};".format(" ".join(asFea(g) for g in self.replacements)) - return res - - -class SingleSubstStatement(Statement): - """A single substitution statement. - - Note the unusual argument order: ``prefix`` and suffix come `after` - the replacement ``glyphs``. ``prefix``, ``suffix``, ``glyphs`` and - ``replace`` should be lists of `glyph-containing objects`_. ``glyphs`` and - ``replace`` should be one-item lists. - """ - - def __init__(self, glyphs, replace, prefix, suffix, forceChain, location=None): - Statement.__init__(self, location) - self.prefix, self.suffix = prefix, suffix - self.forceChain = forceChain - self.glyphs = glyphs - self.replacements = replace - - def build(self, builder): - """Calls the builder object's ``add_single_subst`` callback.""" - prefix = [p.glyphSet() for p in self.prefix] - suffix = [s.glyphSet() for s in self.suffix] - originals = self.glyphs[0].glyphSet() - replaces = self.replacements[0].glyphSet() - if len(replaces) == 1: - replaces = replaces * len(originals) - builder.add_single_subst( - self.location, - prefix, - suffix, - OrderedDict(zip(originals, replaces)), - self.forceChain, - ) - - def asFea(self, indent=""): - res = "sub " - if len(self.prefix) or len(self.suffix) or self.forceChain: - if len(self.prefix): - res += " ".join(asFea(g) for g in self.prefix) + " " - res += " ".join(asFea(g) + "'" for g in self.glyphs) - if len(self.suffix): - res += " " + " ".join(asFea(g) for g in self.suffix) - else: - res += " ".join(asFea(g) for g in self.glyphs) - res += " by {};".format(" ".join(asFea(g) for g in self.replacements)) - return res - - -class ScriptStatement(Statement): - """A ``script`` statement.""" - - def __init__(self, script, location=None): - Statement.__init__(self, location) - self.script = script #: the script code - - def build(self, builder): - """Calls the builder's ``set_script`` callback.""" - builder.set_script(self.location, self.script) - - def asFea(self, indent=""): - return "script {};".format(self.script.strip()) - - -class SinglePosStatement(Statement): - """A single position statement. ``prefix`` and ``suffix`` should be - lists of `glyph-containing objects`_. - - ``pos`` should be a one-element list containing a (`glyph-containing object`_, - :class:`ValueRecord`) tuple.""" - - def __init__(self, pos, prefix, suffix, forceChain, location=None): - Statement.__init__(self, location) - self.pos, self.prefix, self.suffix = pos, prefix, suffix - self.forceChain = forceChain - - def build(self, builder): - """Calls the builder object's ``add_single_pos`` callback.""" - prefix = [p.glyphSet() for p in self.prefix] - suffix = [s.glyphSet() for s in self.suffix] - pos = [(g.glyphSet(), value) for g, value in self.pos] - builder.add_single_pos(self.location, prefix, suffix, pos, self.forceChain) - - def asFea(self, indent=""): - res = "pos " - if len(self.prefix) or len(self.suffix) or self.forceChain: - if len(self.prefix): - res += " ".join(map(asFea, self.prefix)) + " " - res += " ".join( - [ - asFea(x[0]) + "'" + ((" " + x[1].asFea()) if x[1] else "") - for x in self.pos - ] - ) - if len(self.suffix): - res += " " + " ".join(map(asFea, self.suffix)) - else: - res += " ".join( - [asFea(x[0]) + " " + (x[1].asFea() if x[1] else "") for x in self.pos] - ) - res += ";" - return res - - -class SubtableStatement(Statement): - """Represents a subtable break.""" - - def __init__(self, location=None): - Statement.__init__(self, location) - - def build(self, builder): - """Calls the builder objects's ``add_subtable_break`` callback.""" - builder.add_subtable_break(self.location) - - def asFea(self, indent=""): - return "subtable;" - - -class ValueRecord(Expression): - """Represents a value record.""" - - def __init__( - self, - xPlacement=None, - yPlacement=None, - xAdvance=None, - yAdvance=None, - xPlaDevice=None, - yPlaDevice=None, - xAdvDevice=None, - yAdvDevice=None, - vertical=False, - location=None, - ): - Expression.__init__(self, location) - self.xPlacement, self.yPlacement = (xPlacement, yPlacement) - self.xAdvance, self.yAdvance = (xAdvance, yAdvance) - self.xPlaDevice, self.yPlaDevice = (xPlaDevice, yPlaDevice) - self.xAdvDevice, self.yAdvDevice = (xAdvDevice, yAdvDevice) - self.vertical = vertical - - def __eq__(self, other): - return ( - self.xPlacement == other.xPlacement - and self.yPlacement == other.yPlacement - and self.xAdvance == other.xAdvance - and self.yAdvance == other.yAdvance - and self.xPlaDevice == other.xPlaDevice - and self.xAdvDevice == other.xAdvDevice - ) - - def __ne__(self, other): - return not self.__eq__(other) - - def __hash__(self): - return ( - hash(self.xPlacement) - ^ hash(self.yPlacement) - ^ hash(self.xAdvance) - ^ hash(self.yAdvance) - ^ hash(self.xPlaDevice) - ^ hash(self.yPlaDevice) - ^ hash(self.xAdvDevice) - ^ hash(self.yAdvDevice) - ) - - def asFea(self, indent=""): - if not self: - return "" - - x, y = self.xPlacement, self.yPlacement - xAdvance, yAdvance = self.xAdvance, self.yAdvance - xPlaDevice, yPlaDevice = self.xPlaDevice, self.yPlaDevice - xAdvDevice, yAdvDevice = self.xAdvDevice, self.yAdvDevice - vertical = self.vertical - - # Try format A, if possible. - if x is None and y is None: - if xAdvance is None and vertical: - return str(yAdvance) - elif yAdvance is None and not vertical: - return str(xAdvance) - - # Make any remaining None value 0 to avoid generating invalid records. - x = x or 0 - y = y or 0 - xAdvance = xAdvance or 0 - yAdvance = yAdvance or 0 - - # Try format B, if possible. - if ( - xPlaDevice is None - and yPlaDevice is None - and xAdvDevice is None - and yAdvDevice is None - ): - return "<%s %s %s %s>" % (x, y, xAdvance, yAdvance) - - # Last resort is format C. - return "<%s %s %s %s %s %s %s %s>" % ( - x, - y, - xAdvance, - yAdvance, - deviceToString(xPlaDevice), - deviceToString(yPlaDevice), - deviceToString(xAdvDevice), - deviceToString(yAdvDevice), - ) - - def __bool__(self): - return any( - getattr(self, v) is not None - for v in [ - "xPlacement", - "yPlacement", - "xAdvance", - "yAdvance", - "xPlaDevice", - "yPlaDevice", - "xAdvDevice", - "yAdvDevice", - ] - ) - - __nonzero__ = __bool__ - - -class ValueRecordDefinition(Statement): - """Represents a named value record definition.""" - - def __init__(self, name, value, location=None): - Statement.__init__(self, location) - self.name = name #: Value record name as string - self.value = value #: :class:`ValueRecord` object - - def asFea(self, indent=""): - return "valueRecordDef {} {};".format(self.value.asFea(), self.name) - - -def simplify_name_attributes(pid, eid, lid): - if pid == 3 and eid == 1 and lid == 1033: - return "" - elif pid == 1 and eid == 0 and lid == 0: - return "1" - else: - return "{} {} {}".format(pid, eid, lid) - - -class NameRecord(Statement): - """Represents a name record. (`Section 9.e. `_)""" - - def __init__(self, nameID, platformID, platEncID, langID, string, location=None): - Statement.__init__(self, location) - self.nameID = nameID #: Name ID as integer (e.g. 9 for designer's name) - self.platformID = platformID #: Platform ID as integer - self.platEncID = platEncID #: Platform encoding ID as integer - self.langID = langID #: Language ID as integer - self.string = string #: Name record value - - def build(self, builder): - """Calls the builder object's ``add_name_record`` callback.""" - builder.add_name_record( - self.location, - self.nameID, - self.platformID, - self.platEncID, - self.langID, - self.string, - ) - - def asFea(self, indent=""): - def escape(c, escape_pattern): - # Also escape U+0022 QUOTATION MARK and U+005C REVERSE SOLIDUS - if c >= 0x20 and c <= 0x7E and c not in (0x22, 0x5C): - return chr(c) - else: - return escape_pattern % c - - encoding = getEncoding(self.platformID, self.platEncID, self.langID) - if encoding is None: - raise FeatureLibError("Unsupported encoding", self.location) - s = tobytes(self.string, encoding=encoding) - if encoding == "utf_16_be": - escaped_string = "".join( - [ - escape(byteord(s[i]) * 256 + byteord(s[i + 1]), r"\%04x") - for i in range(0, len(s), 2) - ] - ) - else: - escaped_string = "".join([escape(byteord(b), r"\%02x") for b in s]) - plat = simplify_name_attributes(self.platformID, self.platEncID, self.langID) - if plat != "": - plat += " " - return 'nameid {} {}"{}";'.format(self.nameID, plat, escaped_string) - - -class FeatureNameStatement(NameRecord): - """Represents a ``sizemenuname`` or ``name`` statement.""" - - def build(self, builder): - """Calls the builder object's ``add_featureName`` callback.""" - NameRecord.build(self, builder) - builder.add_featureName(self.nameID) - - def asFea(self, indent=""): - if self.nameID == "size": - tag = "sizemenuname" - else: - tag = "name" - plat = simplify_name_attributes(self.platformID, self.platEncID, self.langID) - if plat != "": - plat += " " - return '{} {}"{}";'.format(tag, plat, self.string) - - -class STATNameStatement(NameRecord): - """Represents a STAT table ``name`` statement.""" - - def asFea(self, indent=""): - plat = simplify_name_attributes(self.platformID, self.platEncID, self.langID) - if plat != "": - plat += " " - return 'name {}"{}";'.format(plat, self.string) - - -class SizeParameters(Statement): - """A ``parameters`` statement.""" - - def __init__(self, DesignSize, SubfamilyID, RangeStart, RangeEnd, location=None): - Statement.__init__(self, location) - self.DesignSize = DesignSize - self.SubfamilyID = SubfamilyID - self.RangeStart = RangeStart - self.RangeEnd = RangeEnd - - def build(self, builder): - """Calls the builder object's ``set_size_parameters`` callback.""" - builder.set_size_parameters( - self.location, - self.DesignSize, - self.SubfamilyID, - self.RangeStart, - self.RangeEnd, - ) - - def asFea(self, indent=""): - res = "parameters {:.1f} {}".format(self.DesignSize, self.SubfamilyID) - if self.RangeStart != 0 or self.RangeEnd != 0: - res += " {} {}".format(int(self.RangeStart * 10), int(self.RangeEnd * 10)) - return res + ";" - - -class CVParametersNameStatement(NameRecord): - """Represent a name statement inside a ``cvParameters`` block.""" - - def __init__( - self, nameID, platformID, platEncID, langID, string, block_name, location=None - ): - NameRecord.__init__( - self, nameID, platformID, platEncID, langID, string, location=location - ) - self.block_name = block_name - - def build(self, builder): - """Calls the builder object's ``add_cv_parameter`` callback.""" - item = "" - if self.block_name == "ParamUILabelNameID": - item = "_{}".format(builder.cv_num_named_params_.get(self.nameID, 0)) - builder.add_cv_parameter(self.nameID) - self.nameID = (self.nameID, self.block_name + item) - NameRecord.build(self, builder) - - def asFea(self, indent=""): - plat = simplify_name_attributes(self.platformID, self.platEncID, self.langID) - if plat != "": - plat += " " - return 'name {}"{}";'.format(plat, self.string) - - -class CharacterStatement(Statement): - """ - Statement used in cvParameters blocks of Character Variant features (cvXX). - The Unicode value may be written with either decimal or hexadecimal - notation. The value must be preceded by '0x' if it is a hexadecimal value. - The largest Unicode value allowed is 0xFFFFFF. - """ - - def __init__(self, character, tag, location=None): - Statement.__init__(self, location) - self.character = character - self.tag = tag - - def build(self, builder): - """Calls the builder object's ``add_cv_character`` callback.""" - builder.add_cv_character(self.character, self.tag) - - def asFea(self, indent=""): - return "Character {:#x};".format(self.character) - - -class BaseAxis(Statement): - """An axis definition, being either a ``VertAxis.BaseTagList/BaseScriptList`` - pair or a ``HorizAxis.BaseTagList/BaseScriptList`` pair.""" - - def __init__(self, bases, scripts, vertical, location=None): - Statement.__init__(self, location) - self.bases = bases #: A list of baseline tag names as strings - self.scripts = scripts #: A list of script record tuplets (script tag, default baseline tag, base coordinate) - self.vertical = vertical #: Boolean; VertAxis if True, HorizAxis if False - - def build(self, builder): - """Calls the builder object's ``set_base_axis`` callback.""" - builder.set_base_axis(self.bases, self.scripts, self.vertical) - - def asFea(self, indent=""): - direction = "Vert" if self.vertical else "Horiz" - scripts = [ - "{} {} {}".format(a[0], a[1], " ".join(map(str, a[2]))) - for a in self.scripts - ] - return "{}Axis.BaseTagList {};\n{}{}Axis.BaseScriptList {};".format( - direction, " ".join(self.bases), indent, direction, ", ".join(scripts) - ) - - -class OS2Field(Statement): - """An entry in the ``OS/2`` table. Most ``values`` should be numbers or - strings, apart from when the key is ``UnicodeRange``, ``CodePageRange`` - or ``Panose``, in which case it should be an array of integers.""" - - def __init__(self, key, value, location=None): - Statement.__init__(self, location) - self.key = key - self.value = value - - def build(self, builder): - """Calls the builder object's ``add_os2_field`` callback.""" - builder.add_os2_field(self.key, self.value) - - def asFea(self, indent=""): - def intarr2str(x): - return " ".join(map(str, x)) - - numbers = ( - "FSType", - "TypoAscender", - "TypoDescender", - "TypoLineGap", - "winAscent", - "winDescent", - "XHeight", - "CapHeight", - "WeightClass", - "WidthClass", - "LowerOpSize", - "UpperOpSize", - ) - ranges = ("UnicodeRange", "CodePageRange") - keywords = dict([(x.lower(), [x, str]) for x in numbers]) - keywords.update([(x.lower(), [x, intarr2str]) for x in ranges]) - keywords["panose"] = ["Panose", intarr2str] - keywords["vendor"] = ["Vendor", lambda y: '"{}"'.format(y)] - if self.key in keywords: - return "{} {};".format( - keywords[self.key][0], keywords[self.key][1](self.value) - ) - return "" # should raise exception - - -class HheaField(Statement): - """An entry in the ``hhea`` table.""" - - def __init__(self, key, value, location=None): - Statement.__init__(self, location) - self.key = key - self.value = value - - def build(self, builder): - """Calls the builder object's ``add_hhea_field`` callback.""" - builder.add_hhea_field(self.key, self.value) - - def asFea(self, indent=""): - fields = ("CaretOffset", "Ascender", "Descender", "LineGap") - keywords = dict([(x.lower(), x) for x in fields]) - return "{} {};".format(keywords[self.key], self.value) - - -class VheaField(Statement): - """An entry in the ``vhea`` table.""" - - def __init__(self, key, value, location=None): - Statement.__init__(self, location) - self.key = key - self.value = value - - def build(self, builder): - """Calls the builder object's ``add_vhea_field`` callback.""" - builder.add_vhea_field(self.key, self.value) - - def asFea(self, indent=""): - fields = ("VertTypoAscender", "VertTypoDescender", "VertTypoLineGap") - keywords = dict([(x.lower(), x) for x in fields]) - return "{} {};".format(keywords[self.key], self.value) - - -class STATDesignAxisStatement(Statement): - """A STAT table Design Axis - - Args: - tag (str): a 4 letter axis tag - axisOrder (int): an int - names (list): a list of :class:`STATNameStatement` objects - """ - - def __init__(self, tag, axisOrder, names, location=None): - Statement.__init__(self, location) - self.tag = tag - self.axisOrder = axisOrder - self.names = names - self.location = location - - def build(self, builder): - builder.addDesignAxis(self, self.location) - - def asFea(self, indent=""): - indent += SHIFT - res = f"DesignAxis {self.tag} {self.axisOrder} {{ \n" - res += ("\n" + indent).join([s.asFea(indent=indent) for s in self.names]) + "\n" - res += "};" - return res - - -class ElidedFallbackName(Statement): - """STAT table ElidedFallbackName - - Args: - names: a list of :class:`STATNameStatement` objects - """ - - def __init__(self, names, location=None): - Statement.__init__(self, location) - self.names = names - self.location = location - - def build(self, builder): - builder.setElidedFallbackName(self.names, self.location) - - def asFea(self, indent=""): - indent += SHIFT - res = "ElidedFallbackName { \n" - res += ("\n" + indent).join([s.asFea(indent=indent) for s in self.names]) + "\n" - res += "};" - return res - - -class ElidedFallbackNameID(Statement): - """STAT table ElidedFallbackNameID - - Args: - value: an int pointing to an existing name table name ID - """ - - def __init__(self, value, location=None): - Statement.__init__(self, location) - self.value = value - self.location = location - - def build(self, builder): - builder.setElidedFallbackName(self.value, self.location) - - def asFea(self, indent=""): - return f"ElidedFallbackNameID {self.value};" - - -class STATAxisValueStatement(Statement): - """A STAT table Axis Value Record - - Args: - names (list): a list of :class:`STATNameStatement` objects - locations (list): a list of :class:`AxisValueLocationStatement` objects - flags (int): an int - """ - - def __init__(self, names, locations, flags, location=None): - Statement.__init__(self, location) - self.names = names - self.locations = locations - self.flags = flags - - def build(self, builder): - builder.addAxisValueRecord(self, self.location) - - def asFea(self, indent=""): - res = "AxisValue {\n" - for location in self.locations: - res += location.asFea() - - for nameRecord in self.names: - res += nameRecord.asFea() - res += "\n" - - if self.flags: - flags = ["OlderSiblingFontAttribute", "ElidableAxisValueName"] - flagStrings = [] - curr = 1 - for i in range(len(flags)): - if self.flags & curr != 0: - flagStrings.append(flags[i]) - curr = curr << 1 - res += f"flag {' '.join(flagStrings)};\n" - res += "};" - return res - - -class AxisValueLocationStatement(Statement): - """ - A STAT table Axis Value Location - - Args: - tag (str): a 4 letter axis tag - values (list): a list of ints and/or floats - """ - - def __init__(self, tag, values, location=None): - Statement.__init__(self, location) - self.tag = tag - self.values = values - - def asFea(self, res=""): - res += f"location {self.tag} " - res += f"{' '.join(str(i) for i in self.values)};\n" - return res - - -class ConditionsetStatement(Statement): - """ - A variable layout conditionset - - Args: - name (str): the name of this conditionset - conditions (dict): a dictionary mapping axis tags to a - tuple of (min,max) userspace coordinates. - """ - - def __init__(self, name, conditions, location=None): - Statement.__init__(self, location) - self.name = name - self.conditions = conditions - - def build(self, builder): - builder.add_conditionset(self.location, self.name, self.conditions) - - def asFea(self, res="", indent=""): - res += indent + f"conditionset {self.name} " + "{\n" - for tag, (minvalue, maxvalue) in self.conditions.items(): - res += indent + SHIFT + f"{tag} {minvalue} {maxvalue};\n" - res += indent + "}" + f" {self.name};\n" - return res - - -class VariationBlock(Block): - """A variation feature block, applicable in a given set of conditions.""" - - def __init__(self, name, conditionset, use_extension=False, location=None): - Block.__init__(self, location) - self.name, self.conditionset, self.use_extension = ( - name, - conditionset, - use_extension, - ) - - def build(self, builder): - """Call the ``start_feature`` callback on the builder object, visit - all the statements in this feature, and then call ``end_feature``.""" - builder.start_feature(self.location, self.name) - if ( - self.conditionset != "NULL" - and self.conditionset not in builder.conditionsets_ - ): - raise FeatureLibError( - f"variation block used undefined conditionset {self.conditionset}", - self.location, - ) - - # language exclude_dflt statements modify builder.features_ - # limit them to this block with temporary builder.features_ - features = builder.features_ - builder.features_ = {} - Block.build(self, builder) - for key, value in builder.features_.items(): - items = builder.feature_variations_.setdefault(key, {}).setdefault( - self.conditionset, [] - ) - items.extend(value) - if key not in features: - features[key] = [] # Ensure we make a feature record - builder.features_ = features - builder.end_feature() - - def asFea(self, indent=""): - res = indent + "variation %s " % self.name.strip() - res += self.conditionset + " " - if self.use_extension: - res += "useExtension " - res += "{\n" - res += Block.asFea(self, indent=indent) - res += indent + "} %s;\n" % self.name.strip() - return res diff --git a/spaces/chuan-hd/law-assistant-chatbot/.venv/lib/python3.11/site-packages/fontTools/misc/eexec.py b/spaces/chuan-hd/law-assistant-chatbot/.venv/lib/python3.11/site-packages/fontTools/misc/eexec.py deleted file mode 100644 index cafa312cdaa4696b0624438e06418ade95438441..0000000000000000000000000000000000000000 --- a/spaces/chuan-hd/law-assistant-chatbot/.venv/lib/python3.11/site-packages/fontTools/misc/eexec.py +++ /dev/null @@ -1,119 +0,0 @@ -""" -PostScript Type 1 fonts make use of two types of encryption: charstring -encryption and ``eexec`` encryption. Charstring encryption is used for -the charstrings themselves, while ``eexec`` is used to encrypt larger -sections of the font program, such as the ``Private`` and ``CharStrings`` -dictionaries. Despite the different names, the algorithm is the same, -although ``eexec`` encryption uses a fixed initial key R=55665. - -The algorithm uses cipher feedback, meaning that the ciphertext is used -to modify the key. Because of this, the routines in this module return -the new key at the end of the operation. - -""" - -from fontTools.misc.textTools import bytechr, bytesjoin, byteord - - -def _decryptChar(cipher, R): - cipher = byteord(cipher) - plain = ((cipher ^ (R >> 8))) & 0xFF - R = ((cipher + R) * 52845 + 22719) & 0xFFFF - return bytechr(plain), R - - -def _encryptChar(plain, R): - plain = byteord(plain) - cipher = ((plain ^ (R >> 8))) & 0xFF - R = ((cipher + R) * 52845 + 22719) & 0xFFFF - return bytechr(cipher), R - - -def decrypt(cipherstring, R): - r""" - Decrypts a string using the Type 1 encryption algorithm. - - Args: - cipherstring: String of ciphertext. - R: Initial key. - - Returns: - decryptedStr: Plaintext string. - R: Output key for subsequent decryptions. - - Examples:: - - >>> testStr = b"\0\0asdadads asds\265" - >>> decryptedStr, R = decrypt(testStr, 12321) - >>> decryptedStr == b'0d\nh\x15\xe8\xc4\xb2\x15\x1d\x108\x1a<6\xa1' - True - >>> R == 36142 - True - """ - plainList = [] - for cipher in cipherstring: - plain, R = _decryptChar(cipher, R) - plainList.append(plain) - plainstring = bytesjoin(plainList) - return plainstring, int(R) - - -def encrypt(plainstring, R): - r""" - Encrypts a string using the Type 1 encryption algorithm. - - Note that the algorithm as described in the Type 1 specification requires the - plaintext to be prefixed with a number of random bytes. (For ``eexec`` the - number of random bytes is set to 4.) This routine does *not* add the random - prefix to its input. - - Args: - plainstring: String of plaintext. - R: Initial key. - - Returns: - cipherstring: Ciphertext string. - R: Output key for subsequent encryptions. - - Examples:: - - >>> testStr = b"\0\0asdadads asds\265" - >>> decryptedStr, R = decrypt(testStr, 12321) - >>> decryptedStr == b'0d\nh\x15\xe8\xc4\xb2\x15\x1d\x108\x1a<6\xa1' - True - >>> R == 36142 - True - - >>> testStr = b'0d\nh\x15\xe8\xc4\xb2\x15\x1d\x108\x1a<6\xa1' - >>> encryptedStr, R = encrypt(testStr, 12321) - >>> encryptedStr == b"\0\0asdadads asds\265" - True - >>> R == 36142 - True - """ - cipherList = [] - for plain in plainstring: - cipher, R = _encryptChar(plain, R) - cipherList.append(cipher) - cipherstring = bytesjoin(cipherList) - return cipherstring, int(R) - - -def hexString(s): - import binascii - - return binascii.hexlify(s) - - -def deHexString(h): - import binascii - - h = bytesjoin(h.split()) - return binascii.unhexlify(h) - - -if __name__ == "__main__": - import sys - import doctest - - sys.exit(doctest.testmod().failed) diff --git a/spaces/cihyFjudo/fairness-paper-search/Como Domesticar A Tus Papas Pdf El libro que te ensea a manejar a tus padres con inteligencia y cario.md b/spaces/cihyFjudo/fairness-paper-search/Como Domesticar A Tus Papas Pdf El libro que te ensea a manejar a tus padres con inteligencia y cario.md deleted file mode 100644 index ff390de842aa5e9493037ddfeb4f6add96aefb38..0000000000000000000000000000000000000000 --- a/spaces/cihyFjudo/fairness-paper-search/Como Domesticar A Tus Papas Pdf El libro que te ensea a manejar a tus padres con inteligencia y cario.md +++ /dev/null @@ -1,6 +0,0 @@ -

      Movavi Video Suite 17.5.0 Crack [CracksMind] utorrent


      DOWNLOAD »»» https://tinurli.com/2uwilF



      -
      - aaccfb2cb3
      -
      -
      -

      diff --git a/spaces/cloudtheboi/Lofi4All/.pythonlibs/lib/python3.10/site-packages/aiohttp/tcp_helpers.py b/spaces/cloudtheboi/Lofi4All/.pythonlibs/lib/python3.10/site-packages/aiohttp/tcp_helpers.py deleted file mode 100644 index 88b244223741ad2decb6cb612eae644fae88b2b2..0000000000000000000000000000000000000000 --- a/spaces/cloudtheboi/Lofi4All/.pythonlibs/lib/python3.10/site-packages/aiohttp/tcp_helpers.py +++ /dev/null @@ -1,37 +0,0 @@ -"""Helper methods to tune a TCP connection""" - -import asyncio -import socket -from contextlib import suppress -from typing import Optional # noqa - -__all__ = ("tcp_keepalive", "tcp_nodelay") - - -if hasattr(socket, "SO_KEEPALIVE"): - - def tcp_keepalive(transport: asyncio.Transport) -> None: - sock = transport.get_extra_info("socket") - if sock is not None: - sock.setsockopt(socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1) - -else: - - def tcp_keepalive(transport: asyncio.Transport) -> None: # pragma: no cover - pass - - -def tcp_nodelay(transport: asyncio.Transport, value: bool) -> None: - sock = transport.get_extra_info("socket") - - if sock is None: - return - - if sock.family not in (socket.AF_INET, socket.AF_INET6): - return - - value = bool(value) - - # socket may be closed already, on windows OSError get raised - with suppress(OSError): - sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, value) diff --git a/spaces/cloudtheboi/Lofi4All/.pythonlibs/lib/python3.10/site-packages/anyio/streams/tls.py b/spaces/cloudtheboi/Lofi4All/.pythonlibs/lib/python3.10/site-packages/anyio/streams/tls.py deleted file mode 100644 index 9f9e9fd89c891dd6285789811f7ce29a7b86c00f..0000000000000000000000000000000000000000 --- a/spaces/cloudtheboi/Lofi4All/.pythonlibs/lib/python3.10/site-packages/anyio/streams/tls.py +++ /dev/null @@ -1,320 +0,0 @@ -from __future__ import annotations - -import logging -import re -import ssl -from dataclasses import dataclass -from functools import wraps -from typing import Any, Callable, Mapping, Tuple, TypeVar - -from .. import ( - BrokenResourceError, - EndOfStream, - aclose_forcefully, - get_cancelled_exc_class, -) -from .._core._typedattr import TypedAttributeSet, typed_attribute -from ..abc import AnyByteStream, ByteStream, Listener, TaskGroup - -T_Retval = TypeVar("T_Retval") -_PCTRTT = Tuple[Tuple[str, str], ...] -_PCTRTTT = Tuple[_PCTRTT, ...] - - -class TLSAttribute(TypedAttributeSet): - """Contains Transport Layer Security related attributes.""" - - #: the selected ALPN protocol - alpn_protocol: str | None = typed_attribute() - #: the channel binding for type ``tls-unique`` - channel_binding_tls_unique: bytes = typed_attribute() - #: the selected cipher - cipher: tuple[str, str, int] = typed_attribute() - #: the peer certificate in dictionary form (see :meth:`ssl.SSLSocket.getpeercert` - #: for more information) - peer_certificate: dict[str, str | _PCTRTTT | _PCTRTT] | None = typed_attribute() - #: the peer certificate in binary form - peer_certificate_binary: bytes | None = typed_attribute() - #: ``True`` if this is the server side of the connection - server_side: bool = typed_attribute() - #: ciphers shared by the client during the TLS handshake (``None`` if this is the - #: client side) - shared_ciphers: list[tuple[str, str, int]] | None = typed_attribute() - #: the :class:`~ssl.SSLObject` used for encryption - ssl_object: ssl.SSLObject = typed_attribute() - #: ``True`` if this stream does (and expects) a closing TLS handshake when the - #: stream is being closed - standard_compatible: bool = typed_attribute() - #: the TLS protocol version (e.g. ``TLSv1.2``) - tls_version: str = typed_attribute() - - -@dataclass(eq=False) -class TLSStream(ByteStream): - """ - A stream wrapper that encrypts all sent data and decrypts received data. - - This class has no public initializer; use :meth:`wrap` instead. - All extra attributes from :class:`~TLSAttribute` are supported. - - :var AnyByteStream transport_stream: the wrapped stream - - """ - - transport_stream: AnyByteStream - standard_compatible: bool - _ssl_object: ssl.SSLObject - _read_bio: ssl.MemoryBIO - _write_bio: ssl.MemoryBIO - - @classmethod - async def wrap( - cls, - transport_stream: AnyByteStream, - *, - server_side: bool | None = None, - hostname: str | None = None, - ssl_context: ssl.SSLContext | None = None, - standard_compatible: bool = True, - ) -> TLSStream: - """ - Wrap an existing stream with Transport Layer Security. - - This performs a TLS handshake with the peer. - - :param transport_stream: a bytes-transporting stream to wrap - :param server_side: ``True`` if this is the server side of the connection, - ``False`` if this is the client side (if omitted, will be set to ``False`` - if ``hostname`` has been provided, ``False`` otherwise). Used only to create - a default context when an explicit context has not been provided. - :param hostname: host name of the peer (if host name checking is desired) - :param ssl_context: the SSLContext object to use (if not provided, a secure - default will be created) - :param standard_compatible: if ``False``, skip the closing handshake when closing the - connection, and don't raise an exception if the peer does the same - :raises ~ssl.SSLError: if the TLS handshake fails - - """ - if server_side is None: - server_side = not hostname - - if not ssl_context: - purpose = ( - ssl.Purpose.CLIENT_AUTH if server_side else ssl.Purpose.SERVER_AUTH - ) - ssl_context = ssl.create_default_context(purpose) - - # Re-enable detection of unexpected EOFs if it was disabled by Python - if hasattr(ssl, "OP_IGNORE_UNEXPECTED_EOF"): - ssl_context.options &= ~ssl.OP_IGNORE_UNEXPECTED_EOF - - bio_in = ssl.MemoryBIO() - bio_out = ssl.MemoryBIO() - ssl_object = ssl_context.wrap_bio( - bio_in, bio_out, server_side=server_side, server_hostname=hostname - ) - wrapper = cls( - transport_stream=transport_stream, - standard_compatible=standard_compatible, - _ssl_object=ssl_object, - _read_bio=bio_in, - _write_bio=bio_out, - ) - await wrapper._call_sslobject_method(ssl_object.do_handshake) - return wrapper - - async def _call_sslobject_method( - self, func: Callable[..., T_Retval], *args: object - ) -> T_Retval: - while True: - try: - result = func(*args) - except ssl.SSLWantReadError: - try: - # Flush any pending writes first - if self._write_bio.pending: - await self.transport_stream.send(self._write_bio.read()) - - data = await self.transport_stream.receive() - except EndOfStream: - self._read_bio.write_eof() - except OSError as exc: - self._read_bio.write_eof() - self._write_bio.write_eof() - raise BrokenResourceError from exc - else: - self._read_bio.write(data) - except ssl.SSLWantWriteError: - await self.transport_stream.send(self._write_bio.read()) - except ssl.SSLSyscallError as exc: - self._read_bio.write_eof() - self._write_bio.write_eof() - raise BrokenResourceError from exc - except ssl.SSLError as exc: - self._read_bio.write_eof() - self._write_bio.write_eof() - if ( - isinstance(exc, ssl.SSLEOFError) - or "UNEXPECTED_EOF_WHILE_READING" in exc.strerror - ): - if self.standard_compatible: - raise BrokenResourceError from exc - else: - raise EndOfStream from None - - raise - else: - # Flush any pending writes first - if self._write_bio.pending: - await self.transport_stream.send(self._write_bio.read()) - - return result - - async def unwrap(self) -> tuple[AnyByteStream, bytes]: - """ - Does the TLS closing handshake. - - :return: a tuple of (wrapped byte stream, bytes left in the read buffer) - - """ - await self._call_sslobject_method(self._ssl_object.unwrap) - self._read_bio.write_eof() - self._write_bio.write_eof() - return self.transport_stream, self._read_bio.read() - - async def aclose(self) -> None: - if self.standard_compatible: - try: - await self.unwrap() - except BaseException: - await aclose_forcefully(self.transport_stream) - raise - - await self.transport_stream.aclose() - - async def receive(self, max_bytes: int = 65536) -> bytes: - data = await self._call_sslobject_method(self._ssl_object.read, max_bytes) - if not data: - raise EndOfStream - - return data - - async def send(self, item: bytes) -> None: - await self._call_sslobject_method(self._ssl_object.write, item) - - async def send_eof(self) -> None: - tls_version = self.extra(TLSAttribute.tls_version) - match = re.match(r"TLSv(\d+)(?:\.(\d+))?", tls_version) - if match: - major, minor = int(match.group(1)), int(match.group(2) or 0) - if (major, minor) < (1, 3): - raise NotImplementedError( - f"send_eof() requires at least TLSv1.3; current " - f"session uses {tls_version}" - ) - - raise NotImplementedError( - "send_eof() has not yet been implemented for TLS streams" - ) - - @property - def extra_attributes(self) -> Mapping[Any, Callable[[], Any]]: - return { - **self.transport_stream.extra_attributes, - TLSAttribute.alpn_protocol: self._ssl_object.selected_alpn_protocol, - TLSAttribute.channel_binding_tls_unique: self._ssl_object.get_channel_binding, - TLSAttribute.cipher: self._ssl_object.cipher, - TLSAttribute.peer_certificate: lambda: self._ssl_object.getpeercert(False), - TLSAttribute.peer_certificate_binary: lambda: self._ssl_object.getpeercert( - True - ), - TLSAttribute.server_side: lambda: self._ssl_object.server_side, - TLSAttribute.shared_ciphers: lambda: self._ssl_object.shared_ciphers() - if self._ssl_object.server_side - else None, - TLSAttribute.standard_compatible: lambda: self.standard_compatible, - TLSAttribute.ssl_object: lambda: self._ssl_object, - TLSAttribute.tls_version: self._ssl_object.version, - } - - -@dataclass(eq=False) -class TLSListener(Listener[TLSStream]): - """ - A convenience listener that wraps another listener and auto-negotiates a TLS session on every - accepted connection. - - If the TLS handshake times out or raises an exception, :meth:`handle_handshake_error` is - called to do whatever post-mortem processing is deemed necessary. - - Supports only the :attr:`~TLSAttribute.standard_compatible` extra attribute. - - :param Listener listener: the listener to wrap - :param ssl_context: the SSL context object - :param standard_compatible: a flag passed through to :meth:`TLSStream.wrap` - :param handshake_timeout: time limit for the TLS handshake - (passed to :func:`~anyio.fail_after`) - """ - - listener: Listener[Any] - ssl_context: ssl.SSLContext - standard_compatible: bool = True - handshake_timeout: float = 30 - - @staticmethod - async def handle_handshake_error(exc: BaseException, stream: AnyByteStream) -> None: - """ - Handle an exception raised during the TLS handshake. - - This method does 3 things: - - #. Forcefully closes the original stream - #. Logs the exception (unless it was a cancellation exception) using the - ``anyio.streams.tls`` logger - #. Reraises the exception if it was a base exception or a cancellation exception - - :param exc: the exception - :param stream: the original stream - - """ - await aclose_forcefully(stream) - - # Log all except cancellation exceptions - if not isinstance(exc, get_cancelled_exc_class()): - logging.getLogger(__name__).exception("Error during TLS handshake") - - # Only reraise base exceptions and cancellation exceptions - if not isinstance(exc, Exception) or isinstance(exc, get_cancelled_exc_class()): - raise - - async def serve( - self, - handler: Callable[[TLSStream], Any], - task_group: TaskGroup | None = None, - ) -> None: - @wraps(handler) - async def handler_wrapper(stream: AnyByteStream) -> None: - from .. import fail_after - - try: - with fail_after(self.handshake_timeout): - wrapped_stream = await TLSStream.wrap( - stream, - ssl_context=self.ssl_context, - standard_compatible=self.standard_compatible, - ) - except BaseException as exc: - await self.handle_handshake_error(exc, stream) - else: - await handler(wrapped_stream) - - await self.listener.serve(handler_wrapper, task_group) - - async def aclose(self) -> None: - await self.listener.aclose() - - @property - def extra_attributes(self) -> Mapping[Any, Callable[[], Any]]: - return { - TLSAttribute.standard_compatible: lambda: self.standard_compatible, - } diff --git a/spaces/colakin/video-generater/public/ffmpeg/libavcodec/g723_1_parser.c b/spaces/colakin/video-generater/public/ffmpeg/libavcodec/g723_1_parser.c deleted file mode 100644 index 2ed1a8ab192e7dcb51e3da66b6dfad84ab4e4c10..0000000000000000000000000000000000000000 --- a/spaces/colakin/video-generater/public/ffmpeg/libavcodec/g723_1_parser.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * G723_1 audio parser - */ - -#include "parser.h" -#include "g723_1.h" - -typedef struct G723_1ParseContext { - ParseContext pc; -} G723_1ParseContext; - -static int g723_1_parse(AVCodecParserContext *s1, AVCodecContext *avctx, - const uint8_t **poutbuf, int *poutbuf_size, - const uint8_t *buf, int buf_size) -{ - G723_1ParseContext *s = s1->priv_data; - ParseContext *pc = &s->pc; - int next = END_NOT_FOUND; - - if (buf_size > 0) - next = frame_size[buf[0] & 3] * FFMAX(1, avctx->ch_layout.nb_channels); - - if (ff_combine_frame(pc, next, &buf, &buf_size) < 0 || !buf_size) { - *poutbuf = NULL; - *poutbuf_size = 0; - return buf_size; - } - - s1->duration = 240; - - *poutbuf = buf; - *poutbuf_size = buf_size; - return next; -} - -const AVCodecParser ff_g723_1_parser = { - .codec_ids = { AV_CODEC_ID_G723_1 }, - .priv_data_size = sizeof(G723_1ParseContext), - .parser_parse = g723_1_parse, - .parser_close = ff_parse_close, -}; diff --git a/spaces/colakin/video-generater/public/ffmpeg/libavcodec/h261enc.c b/spaces/colakin/video-generater/public/ffmpeg/libavcodec/h261enc.c deleted file mode 100644 index 438ebb63d9193673e08ddcb260d58f2101da5d0d..0000000000000000000000000000000000000000 --- a/spaces/colakin/video-generater/public/ffmpeg/libavcodec/h261enc.c +++ /dev/null @@ -1,417 +0,0 @@ -/* - * H.261 encoder - * Copyright (c) 2002-2004 Michael Niedermayer - * Copyright (c) 2004 Maarten Daniels - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * H.261 encoder. - */ - -#include "libavutil/attributes.h" -#include "libavutil/avassert.h" -#include "libavutil/thread.h" -#include "avcodec.h" -#include "codec_internal.h" -#include "mpegutils.h" -#include "mpegvideo.h" -#include "h261.h" -#include "h261enc.h" -#include "mpegvideodata.h" -#include "mpegvideoenc.h" - -static uint8_t uni_h261_rl_len [64*64*2*2]; -#define UNI_ENC_INDEX(last,run,level) ((last)*128*64 + (run)*128 + (level)) - -typedef struct H261EncContext { - MpegEncContext s; - - H261Context common; - - int gob_number; - enum { - H261_QCIF = 0, - H261_CIF = 1, - } format; -} H261EncContext; - -void ff_h261_encode_picture_header(MpegEncContext *s) -{ - H261EncContext *const h = (H261EncContext *)s; - int temp_ref; - - align_put_bits(&s->pb); - - /* Update the pointer to last GOB */ - s->ptr_lastgob = put_bits_ptr(&s->pb); - - put_bits(&s->pb, 20, 0x10); /* PSC */ - - temp_ref = s->picture_number * 30000LL * s->avctx->time_base.num / - (1001LL * s->avctx->time_base.den); // FIXME maybe this should use a timestamp - put_sbits(&s->pb, 5, temp_ref); /* TemporalReference */ - - put_bits(&s->pb, 1, 0); /* split screen off */ - put_bits(&s->pb, 1, 0); /* camera off */ - put_bits(&s->pb, 1, s->pict_type == AV_PICTURE_TYPE_I); /* freeze picture release on/off */ - - put_bits(&s->pb, 1, h->format); /* 0 == QCIF, 1 == CIF */ - - put_bits(&s->pb, 1, 1); /* still image mode */ - put_bits(&s->pb, 1, 1); /* reserved */ - - put_bits(&s->pb, 1, 0); /* no PEI */ - h->gob_number = h->format - 1; - s->mb_skip_run = 0; -} - -/** - * Encode a group of blocks header. - */ -static void h261_encode_gob_header(MpegEncContext *s, int mb_line) -{ - H261EncContext *const h = (H261EncContext *)s; - if (h->format == H261_QCIF) { - h->gob_number += 2; // QCIF - } else { - h->gob_number++; // CIF - } - put_bits(&s->pb, 16, 1); /* GBSC */ - put_bits(&s->pb, 4, h->gob_number); /* GN */ - put_bits(&s->pb, 5, s->qscale); /* GQUANT */ - put_bits(&s->pb, 1, 0); /* no GEI */ - s->mb_skip_run = 0; - s->last_mv[0][0][0] = 0; - s->last_mv[0][0][1] = 0; -} - -void ff_h261_reorder_mb_index(MpegEncContext *s) -{ - const H261EncContext *const h = (H261EncContext*)s; - int index = s->mb_x + s->mb_y * s->mb_width; - - if (index % 11 == 0) { - if (index % 33 == 0) - h261_encode_gob_header(s, 0); - s->last_mv[0][0][0] = 0; - s->last_mv[0][0][1] = 0; - } - - /* for CIF the GOB's are fragmented in the middle of a scanline - * that's why we need to adjust the x and y index of the macroblocks */ - if (h->format == H261_CIF) { - s->mb_x = index % 11; - index /= 11; - s->mb_y = index % 3; - index /= 3; - s->mb_x += 11 * (index % 2); - index /= 2; - s->mb_y += 3 * index; - - ff_init_block_index(s); - ff_update_block_index(s, 8, 0, 1); - } -} - -static void h261_encode_motion(PutBitContext *pb, int val) -{ - int sign, code; - if (val == 0) { - code = 0; - put_bits(pb, ff_h261_mv_tab[code][1], ff_h261_mv_tab[code][0]); - } else { - if (val > 15) - val -= 32; - if (val < -16) - val += 32; - sign = val < 0; - code = sign ? -val : val; - put_bits(pb, ff_h261_mv_tab[code][1], ff_h261_mv_tab[code][0]); - put_bits(pb, 1, sign); - } -} - -static inline int get_cbp(MpegEncContext *s, int16_t block[6][64]) -{ - int i, cbp; - cbp = 0; - for (i = 0; i < 6; i++) - if (s->block_last_index[i] >= 0) - cbp |= 1 << (5 - i); - return cbp; -} - -/** - * Encode an 8x8 block. - * @param block the 8x8 block - * @param n block index (0-3 are luma, 4-5 are chroma) - */ -static void h261_encode_block(H261EncContext *h, int16_t *block, int n) -{ - MpegEncContext *const s = &h->s; - int level, run, i, j, last_index, last_non_zero, sign, slevel, code; - RLTable *rl; - - rl = &ff_h261_rl_tcoeff; - if (s->mb_intra) { - /* DC coef */ - level = block[0]; - /* 255 cannot be represented, so we clamp */ - if (level > 254) { - level = 254; - block[0] = 254; - } - /* 0 cannot be represented also */ - else if (level < 1) { - level = 1; - block[0] = 1; - } - if (level == 128) - put_bits(&s->pb, 8, 0xff); - else - put_bits(&s->pb, 8, level); - i = 1; - } else if ((block[0] == 1 || block[0] == -1) && - (s->block_last_index[n] > -1)) { - // special case - put_bits(&s->pb, 2, block[0] > 0 ? 2 : 3); - i = 1; - } else { - i = 0; - } - - /* AC coefs */ - last_index = s->block_last_index[n]; - last_non_zero = i - 1; - for (; i <= last_index; i++) { - j = s->intra_scantable.permutated[i]; - level = block[j]; - if (level) { - run = i - last_non_zero - 1; - sign = 0; - slevel = level; - if (level < 0) { - sign = 1; - level = -level; - } - code = get_rl_index(rl, 0 /*no last in H.261, EOB is used*/, - run, level); - if (run == 0 && level < 16) - code += 1; - put_bits(&s->pb, rl->table_vlc[code][1], rl->table_vlc[code][0]); - if (code == rl->n) { - put_bits(&s->pb, 6, run); - av_assert1(slevel != 0); - av_assert1(level <= 127); - put_sbits(&s->pb, 8, slevel); - } else { - put_bits(&s->pb, 1, sign); - } - last_non_zero = i; - } - } - if (last_index > -1) - put_bits(&s->pb, rl->table_vlc[0][1], rl->table_vlc[0][0]); // EOB -} - -void ff_h261_encode_mb(MpegEncContext *s, int16_t block[6][64], - int motion_x, int motion_y) -{ - /* The following is only allowed because this encoder - * does not use slice threading. */ - H261EncContext *const h = (H261EncContext *)s; - H261Context *const com = &h->common; - int mvd, mv_diff_x, mv_diff_y, i, cbp; - cbp = 63; // avoid warning - mvd = 0; - - com->mtype = 0; - - if (!s->mb_intra) { - /* compute cbp */ - cbp = get_cbp(s, block); - - /* mvd indicates if this block is motion compensated */ - mvd = motion_x | motion_y; - - if ((cbp | mvd) == 0) { - /* skip macroblock */ - s->skip_count++; - s->mb_skip_run++; - s->last_mv[0][0][0] = 0; - s->last_mv[0][0][1] = 0; - s->qscale -= s->dquant; - return; - } - } - - /* MB is not skipped, encode MBA */ - put_bits(&s->pb, - ff_h261_mba_bits[s->mb_skip_run], - ff_h261_mba_code[s->mb_skip_run]); - s->mb_skip_run = 0; - - /* calculate MTYPE */ - if (!s->mb_intra) { - com->mtype++; - - if (mvd || s->loop_filter) - com->mtype += 3; - if (s->loop_filter) - com->mtype += 3; - if (cbp) - com->mtype++; - av_assert1(com->mtype > 1); - } - - if (s->dquant && cbp) { - com->mtype++; - } else - s->qscale -= s->dquant; - - put_bits(&s->pb, - ff_h261_mtype_bits[com->mtype], - ff_h261_mtype_code[com->mtype]); - - com->mtype = ff_h261_mtype_map[com->mtype]; - - if (IS_QUANT(com->mtype)) { - ff_set_qscale(s, s->qscale + s->dquant); - put_bits(&s->pb, 5, s->qscale); - } - - if (IS_16X16(com->mtype)) { - mv_diff_x = (motion_x >> 1) - s->last_mv[0][0][0]; - mv_diff_y = (motion_y >> 1) - s->last_mv[0][0][1]; - s->last_mv[0][0][0] = (motion_x >> 1); - s->last_mv[0][0][1] = (motion_y >> 1); - h261_encode_motion(&s->pb, mv_diff_x); - h261_encode_motion(&s->pb, mv_diff_y); - } - - if (HAS_CBP(com->mtype)) { - av_assert1(cbp > 0); - put_bits(&s->pb, - ff_h261_cbp_tab[cbp - 1][1], - ff_h261_cbp_tab[cbp - 1][0]); - } - for (i = 0; i < 6; i++) - /* encode each block */ - h261_encode_block(h, block[i], i); - - if (!IS_16X16(com->mtype)) { - s->last_mv[0][0][0] = 0; - s->last_mv[0][0][1] = 0; - } -} - -static av_cold void init_uni_h261_rl_tab(const RLTable *rl, uint8_t *len_tab) -{ - int slevel, run, last; - - av_assert0(MAX_LEVEL >= 64); - av_assert0(MAX_RUN >= 63); - - for(slevel=-64; slevel<64; slevel++){ - if(slevel==0) continue; - for(run=0; run<64; run++){ - for(last=0; last<=1; last++){ - const int index= UNI_ENC_INDEX(last, run, slevel+64); - int level= slevel < 0 ? -slevel : slevel; - int len, code; - - len_tab[index]= 100; - - /* ESC0 */ - code= get_rl_index(rl, 0, run, level); - len= rl->table_vlc[code][1] + 1; - if(last) - len += 2; - - if(code!=rl->n && len < len_tab[index]){ - len_tab [index]= len; - } - /* ESC */ - len = rl->table_vlc[rl->n][1]; - if(last) - len += 2; - - if(len < len_tab[index]){ - len_tab [index]= len; - } - } - } - } -} - -static av_cold void h261_encode_init_static(void) -{ - static uint8_t h261_rl_table_store[2][2 * MAX_RUN + MAX_LEVEL + 3]; - - ff_rl_init(&ff_h261_rl_tcoeff, h261_rl_table_store); - init_uni_h261_rl_tab(&ff_h261_rl_tcoeff, uni_h261_rl_len); -} - -av_cold int ff_h261_encode_init(MpegEncContext *s) -{ - H261EncContext *const h = (H261EncContext*)s; - static AVOnce init_static_once = AV_ONCE_INIT; - - if (s->width == 176 && s->height == 144) { - h->format = H261_QCIF; - } else if (s->width == 352 && s->height == 288) { - h->format = H261_CIF; - } else { - av_log(s->avctx, AV_LOG_ERROR, - "The specified picture size of %dx%d is not valid for the " - "H.261 codec.\nValid sizes are 176x144, 352x288\n", - s->width, s->height); - return AVERROR(EINVAL); - } - s->private_ctx = &h->common; - - s->min_qcoeff = -127; - s->max_qcoeff = 127; - s->y_dc_scale_table = - s->c_dc_scale_table = ff_mpeg1_dc_scale_table; - s->ac_esc_length = 6+6+8; - - s->intra_ac_vlc_length = s->inter_ac_vlc_length = uni_h261_rl_len; - s->intra_ac_vlc_last_length = s->inter_ac_vlc_last_length = uni_h261_rl_len + 128*64; - ff_thread_once(&init_static_once, h261_encode_init_static); - - return 0; -} - -const FFCodec ff_h261_encoder = { - .p.name = "h261", - CODEC_LONG_NAME("H.261"), - .p.type = AVMEDIA_TYPE_VIDEO, - .p.id = AV_CODEC_ID_H261, - .p.priv_class = &ff_mpv_enc_class, - .priv_data_size = sizeof(H261EncContext), - .init = ff_mpv_encode_init, - FF_CODEC_ENCODE_CB(ff_mpv_encode_picture), - .close = ff_mpv_encode_end, - .caps_internal = FF_CODEC_CAP_INIT_CLEANUP, - .p.pix_fmts = (const enum AVPixelFormat[]) { AV_PIX_FMT_YUV420P, - AV_PIX_FMT_NONE }, - .p.capabilities = AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE, -}; diff --git a/spaces/congsaPfin/Manga-OCR/logs/Download Hungry Shark World APK and Dive into the Ocean on Your iPhone.md b/spaces/congsaPfin/Manga-OCR/logs/Download Hungry Shark World APK and Dive into the Ocean on Your iPhone.md deleted file mode 100644 index 4e194cd83aeaffb5c6c28e308aa029067ff3d5c0..0000000000000000000000000000000000000000 --- a/spaces/congsaPfin/Manga-OCR/logs/Download Hungry Shark World APK and Dive into the Ocean on Your iPhone.md +++ /dev/null @@ -1,128 +0,0 @@ -
      -

      Hungry Shark World: A Review of the Jaw-Dropping Game for iPhone

      -

      If you are looking for a game that will satisfy your appetite for action, adventure, and carnage, then you should check out Hungry Shark World. This game is the sequel to the hit Hungry Shark Evolution, and it takes the shark simulation genre to a whole new level. In this game, you can control a shark in a feeding frenzy and eat your way through many oceans, feasting on everything from bite-size fish and birds to tasty whales and unwitting humans. You can also unlock new sharks, upgrade your abilities, customize your appearance, complete missions, fight bosses, and more. Hungry Shark World is available on the App Store for iPhone users, and it is free to download and play. In this article, we will review the game's features, gameplay, graphics, sound, and tips and tricks. We will also answer some frequently asked questions about the game.

      -

      hungry shark world apk iphone


      Download File ★★★ https://urlca.com/2uObl5



      -

      Introduction

      -

      What is Hungry Shark World?

      -

      Hungry Shark World is an aquatic adventure game developed by Ubisoft London and published by Ubisoft. It was released in 2016 for iOS and Android devices, and later ported to Xbox One, Nintendo Switch, PlayStation 4, and Apple TV. It is the sixth installment in the Hungry Shark series, which started in 2010 with Hungry Shark: Part 1. The game has been downloaded over 100 million times on mobile platforms, and it has received positive reviews from critics and players alike. It has also won several awards, such as the TIGA Games Industry Awards 2016 for Best Arcade Game.

      -

      How to play Hungry Shark World?

      -

      The gameplay of Hungry Shark World is simple but addictive. You control a shark using the left stick or the touchscreen, and you can use the ZR button or tap the screen to activate a boost that increases your speed and attack damage. Your goal is to survive as long as possible by eating everything that gets in your way. You have a life meter that depletes over time or when you get hurt by enemies or hazards. You can replenish your life by eating food or collecting health items. You also have a gold rush meter that fills up when you eat gold creatures or collect gold items. When the meter is full, you enter a gold rush mode that turns everything edible into gold, giving you extra coins and invincibility. You can also collect letters that spell out "HUNGRY" to trigger a super-sized mode that makes you huge and able to eat anything.

      -

      As you play, you can earn coins, gems, pearls, and experience points that you can use to unlock new sharks, upgrade your stats, buy accessories, power-ups, pets, skins, maps, and more. You can also complete missions that give you specific objectives to achieve in each run. There are four different locations to explore in the game: Pacific Islands, Arctic Ocean, Arabian Sea, and South China Sea. Each location has its own theme, scenery, creatures, secrets, and challenges.

      -

      Features of Hungry Shark World

      -

      41 species of sharks to choose from

      -

      One of the most appealing features of Hungry Shark World is the variety of sharks you can play as. There are 41 different species of sharks in the game, divided into seven tiers: XS, S, M, L, XL, XXL, and XXXL. Each tier has its own characteristics, such as size, speed, bite, boost, health, and diet. You can start with the Blacktip Reef Shark (XS) and work your way up to the Megalodon (XXXL), the largest and most powerful shark in the game. You can also unlock some special sharks, such as the Zombie Shark, the Robo Shark, the Pyro Shark, and the Atomic Shark. Each shark has its own unique abilities and animations that make them fun to play with.

      -

      Huge open worlds to explore

      -

      Another feature that makes Hungry Shark World stand out is the vastness and diversity of the worlds you can explore. There are four different locations in the game: Pacific Islands, Arctic Ocean, Arabian Sea, and South China Sea. Each location has its own theme, scenery, creatures, secrets, and challenges. You can swim through coral reefs, shipwrecks, icebergs, volcanoes, temples, oil rigs, and more. You can also discover hidden areas and portals that lead you to other worlds or mini-games. You can also interact with various objects and items in the environment, such as buoys, barrels, mines, bombs, jet skis, helicopters, and more.

      -

      Stunning graphics and sound effects

      -

      Hungry Shark World is also a feast for the eyes and ears. The game boasts stunning graphics and sound effects that immerse you in the underwater world. The game uses a 3D engine that renders realistic water effects, lighting effects, shadows, reflections, and textures. The game also features dynamic weather and day-night cycles that change the atmosphere and difficulty of the game. The game also has a great soundtrack and sound effects that match the mood and action of the game. You can hear the roar of your shark, the splash of the water, the screams of your prey, and the music that changes according to your situation.

      -

      Survival of the hungriest gameplay

      -

      The core gameplay of Hungry Shark World is simple but addictive. You control a shark using the left stick or the touchscreen, and you can use the ZR button or tap the screen to activate a boost that increases your speed and attack damage. Your goal is to survive as long as possible by eating everything that gets in your way. You have a life meter that depletes over time or when you get hurt by enemies or hazards. You can replenish your life by eating food or collecting health items. You also have a gold rush meter that fills up when you eat gold creatures or collect gold items. When the meter is full, you enter a gold rush mode that turns everything edible into gold, giving you extra coins and invincibility. You can also collect letters that spell out "HUNGRY" to trigger a super-sized mode that makes you huge and able to eat anything.

      -

      Smashing shark swag and super skins

      -

      As you play Hungry Shark World , you can earn coins, gems, pearls, and experience points that you can use to unlock new sharks, upgrade your stats, buy accessories, power-ups, pets, skins, maps, and more. You can also customize your shark's appearance with smashing shark swag and super skins. You can equip your shark with various items, such as hats, sunglasses, headphones, necklaces, rings, and more. You can also change your shark's skin color, pattern, and texture with different skins, such as the Tiger Shark skin, the Hammerhead Shark skin, the Clownfish skin, and more. Some skins also give you special abilities or effects, such as the Electro Shark skin that shocks nearby enemies, the Ice Shark skin that freezes enemies on contact, or the Fire Shark skin that sets enemies on fire.

      -

      hungry shark world ios download
      -hungry shark world app store
      -hungry shark world iphone game
      -hungry shark world apk for ipad
      -hungry shark world free download ios
      -hungry shark world iphone cheats
      -hungry shark world apple tv
      -hungry shark world apk mod ios
      -hungry shark world iphone x
      -hungry shark world app review
      -hungry shark world ios hack
      -hungry shark world app support
      -hungry shark world iphone 11
      -hungry shark world apk obb ios
      -hungry shark world free gems ios
      -hungry shark world iphone 12
      -hungry shark world app update
      -hungry shark world ios 14
      -hungry shark world iphone 8
      -hungry shark world apk latest version ios
      -hungry shark world free coins ios
      -hungry shark world iphone 7
      -hungry shark world app size
      -hungry shark world ios 15
      -hungry shark world iphone xr
      -hungry shark world apk offline ios
      -hungry shark world free pearls ios
      -hungry shark world iphone 6s
      -hungry shark world app download
      -hungry shark world ios 13
      -hungry shark world iphone se
      -hungry shark world apk unlimited money ios
      -hungry shark world free skins ios
      -hungry shark world iphone 5s
      -hungry shark world app not working
      -hungry shark world ios 12
      -hungry shark world iphone xs max
      -hungry shark world apk no verification ios
      -hungry shark world free pets ios
      -hungry shark world iphone 4s
      -hungry shark world app crashing
      -hungry shark world ios 11
      -hungry shark world iphone 6 plus
      -hungry shark world apk data ios
      -hungry shark world free sharks ios
      -hungry shark world iphone case
      -hungry shark world app refund
      -hungy shak wold iOs 10

      -

      Manic missions and badass bosses

      -

      Hungry Shark World also offers you many challenges and rewards to keep you hooked. You can complete missions that give you specific objectives to achieve in each run. For example, you may have to eat a certain number of fish, humans, or other creatures; reach a certain depth or distance; survive for a certain time; or perform a certain action. Completing missions will give you coins, gems, pearls, and experience points. You can also fight badass bosses that are bigger and stronger than you. These include giant crabs, colossal squids, prehistoric predators, and more. Defeating bosses will give you extra rewards and achievements.

      -

      Helpful predatory pets and supersized meal deal

      -

      Hungry Shark World also lets you have some companions to help you in your feeding frenzy. You can buy and equip predatory pets that will follow you around and assist you in eating and fighting. There are many pets to choose from, such as baby sharks, octopuses, turtles, whales, eagles, and more. Each pet has its own abilities and benefits that can boost your performance. For example, the baby shark will eat anything smaller than it; the octopus will ink enemies and make them slower; the turtle will shield you from damage; the whale will swallow large enemies; the eagle will snatch prey from the air; and more. You can also activate a supersized meal deal that will spawn a large amount of food in front of you for a limited time. This can help you fill up your life and gold rush meters quickly.

      -

      Extinction mode and apex sharks

      -

      Hungry Shark World also has some special modes and features that add more excitement and challenge to the game. One of them is the extinction mode that is unlocked after you complete all the missions in each location. In this mode, you have to survive as long as possible in a post-apocalyptic world where everything is radioactive and mutated. You will face new enemies and hazards that are more dangerous and deadly than before. You will also have access to apex sharks that are the ultimate predators in each location. These are enhanced versions of the regular sharks that have better stats and abilities. For example, the apex Great White Shark has increased health, bite, speed, and boost; the apex Megalodon has a larger size and a stronger bite; the apex Atomic Shark has a nuclear blast ability; and more.

      -

      Tips and tricks for Hungry Shark World

      -

      Persevere and complete missions

      -

      One of the best tips for Hungry Shark World is to persevere and complete missions. Missions are a great way to earn coins, gems, pearls, and experience points that you can use to unlock and upgrade new sharks, items, and features. Missions also give you a sense of direction and challenge in the game. Some missions may seem hard or impossible at first, but you should not give up on them. You can always try again with a different shark, strategy, or power-up. You can also watch videos or spend gems to skip missions that you don't like or can't complete. Completing missions will also unlock new locations and modes that will give you more fun and variety in the game.

      -

      Buy the map and collect bonuses

      -

      Another tip for Hungry Shark World is to buy the map and collect bonuses. The map is a very useful item that will show you the layout of each location, as well as the locations of various items, creatures, secrets, and portals. You can buy the map for each location with coins or gems, and you can access it by pressing the X button or tapping the map icon on the screen. The map will help you navigate the world and find what you are looking for. You should also collect as many bonuses as you can in each run. Bonuses are special items that give you extra benefits, such as coins, gems, pearls, health, gold rush, boost, score multiplier, and more. You can find bonuses in chests, crates, barrels, buoys, and other objects. You can also get bonuses by eating gold creatures or collecting gold items.

      -

      Get the drop on aggressive sea life and scuba divers

      -

      Another tip for Hungry Shark World is to get the drop on aggressive sea life and scuba divers. These are enemies that will attack you or harm you if you get too close to them. They include sharks, whales, dolphins, swordfish, stingrays, electric eels, mines, torpedoes, harpoons, and more. You should avoid them if they are bigger or stronger than you, or if they have weapons or defenses that can hurt you. You should also try to surprise them from behind or above, or use your boost to ram them before they can react. This will give you an advantage and allow you to eat them or escape from them more easily.

      -

      Use your boost for more than just speed

      -

      Another tip for Hungry Shark World is to use your boost for more than just speed. Your boost is a powerful ability that increases your speed and attack damage for a short time. You can activate it by pressing the ZR button or tapping the screen. You can use your boost to chase down fast or fleeing prey, escape from dangerous enemies or situations, break through obstacles or barriers, jump out of the water and perform stunts or tricks, and more. Your boost also has some hidden effects that can help you in the game. For example, your boost can make you immune to some hazards, such as jellyfish stings or electric shocks; your boost can also make you spit out anything that is stuck in your mouth, such as bombs or pufferfish; your boost can also make you bounce off walls or surfaces, which can help you reach higher places or change direction quickly.

      -

      Watch out for jellyfish, pufferfish, lionfish, giant squids, and more

      -

      Another tip for Hungry Shark World is to watch out for jellyfish , pufferfish, lionfish, giant squids, and more. These are some of the most annoying and dangerous creatures in the game. They can cause you damage, poison, stun, or slow you down if you touch them or eat them. You should avoid them if possible, or use your boost to get past them quickly. You can also use some items or pets that can protect you from their effects, such as the antidote, the force field, the turtle, or the octopus. You can also eat some creatures that can counteract their effects, such as the anglerfish, the seahorse, or the narwhal.

      -

      Don't forget the surface and the shore

      -

      Another tip for Hungry Shark World is to don't forget the surface and the shore. These are areas that you can explore and find more food and items. You can jump out of the water and eat birds, planes, balloons, and more. You can also land on the shore and eat humans, animals, vehicles, and more. You can also find chests, crates, barrels, buoys, and other objects that contain bonuses or secrets. However, you should also be careful when you are on the surface or the shore. You can lose life faster when you are out of the water, and you can also encounter enemies or hazards that can hurt you, such as hunters, soldiers, tanks, mines, bombs, and more. You should also watch out for your oxygen meter when you are underwater. If it runs out, you will start to lose life until you reach the surface again.

      -

      Eat entire schools of fish and upgrade your shark

      -

      Another tip for Hungry Shark World is to eat entire schools of fish and upgrade your shark. Schools of fish are groups of small fish that swim together in a formation. They are easy to spot and easy to eat. They can also give you a lot of benefits, such as filling up your life and gold rush meters quickly, increasing your score multiplier, and triggering a feeding frenzy that makes you faster and stronger for a short time. You should try to eat as many schools of fish as you can in each run. You should also use your coins and gems to upgrade your shark's stats, such as bite, speed, boost, and health. This will make your shark more powerful and able to eat more things.

      -

      Conclusion and FAQs

      -

      Hungry Shark World is a game that will keep you entertained and hungry for more. It is a game that lets you experience the thrill and fun of being a shark in a vast and diverse world. You can choose from 41 species of sharks, each with their own abilities and appearances. You can explore four locations with different themes and secrets. You can customize your shark with various items and skins. You can complete missions and fight bosses for rewards and achievements. You can also enjoy stunning graphics and sound effects that make the game more immersive and realistic. Hungry Shark World is a game that you should not miss if you love sharks or action games.

      -

      Here are some frequently asked questions about Hungry Shark World:

      -

      How do I download Hungry Shark World on my iPhone?

      -

      You can download Hungry Shark World on your iPhone by following these steps:

      -
        -
      1. Open the App Store on your iPhone.
      2. -
      3. Search for "Hungry Shark World" in the search bar.
      4. -
      5. Tap on the "Get" button next to the game icon.
      6. -
      7. Enter your Apple ID password or use Touch ID or Face ID to confirm.
      8. -
      9. Wait for the game to download and install on your iPhone.
      10. -
      11. Tap on the game icon to launch it and enjoy.
      12. -
      -

      How do I get gems and pearls in Hungry Shark World?

      -

      You can get gems and pearls in Hungry Shark World by doing these things:

      -
        -
      • Eating gemfish or pearl fish that are purple or pink in color.
      • -
      • Finding gems or pearls in chests, crates, barrels, buoys, or other objects.
      • -
      • Completing missions that reward you with gems or pearls.
      • -
      • Defeating bosses that drop gems or pearls.
      • -
      • Watching videos or completing offers that give you free gems or pearls.
      • -
      • Buying gems or pearls with real money through in-app purchases.
      • -
      -

      How do I unlock new locations in Hungry Shark World?

      -

      You can unlock new locations in Hungry Shark World by completing missions in each location. There are four locations in the game: Pacific Islands, Arctic Ocean, Arabian Sea, and South China Sea. Each location has 15 missions that you can complete by achieving specific objectives. For example, you may have to eat a certain number of creatures, reach a certain depth or distance, survive for a certain time, or perform a certain action. You can see your progress and objectives for each mission by pressing the Y button or tapping the mission icon on the screen. You can also skip missions that you don't like or can't complete by watching videos or spending gems. You need to complete all 15 missions in one location to unlock the next one.

      -

      How do I get the best score in Hungry Shark World?

      -

      You can get the best score in Hungry Shark World by doing these things:

      -
        -
      • Eat as much as you can and as fast as you can. Eating will increase your score and your score multiplier.
      • -
      • Activate gold rush and hungry modes as often as you can. These modes will give you extra coins and invincibility, and they will also increase your score and your score multiplier.
      • -
      • Complete missions and achievements that give you bonus points. You can see your missions and achievements by pressing the Y button or tapping the mission icon on the screen.
      • -
      • Use power-ups and pets that boost your performance. You can buy and equip power-ups and pets with coins, gems, or pearls. Some examples are the jetpack, the laser, the magnet, the baby shark, the octopus, and the whale.
      • -
      • Avoid dying or getting hurt by enemies or hazards. Dying or getting hurt will end your run and reduce your score.
      • -
      -

      How do I play Hungry Shark World with my friends?

      -

      You can play Hungry Shark World with your friends by connecting to Facebook or Game Center. You can do this by pressing the + button or tapping the social icon on the screen. You can then see your friends' scores and achievements, and compete with them on the leaderboards. You can also send and receive gifts from your friends, such as coins, gems, pearls, or power-ups. You can also invite your friends to play Hungry Shark World and earn rewards for doing so.

      401be4b1e0
      -
      -
      \ No newline at end of file diff --git a/spaces/congsaPfin/Manga-OCR/logs/Download The Legend of Korra Game and Experience the Four Elements.md b/spaces/congsaPfin/Manga-OCR/logs/Download The Legend of Korra Game and Experience the Four Elements.md deleted file mode 100644 index 2ee3748806aee31542063650446177ade46773b3..0000000000000000000000000000000000000000 --- a/spaces/congsaPfin/Manga-OCR/logs/Download The Legend of Korra Game and Experience the Four Elements.md +++ /dev/null @@ -1,169 +0,0 @@ - -

      How to Download The Legend of Korra (Video Game) for Your PC, Xbox or PlayStation

      -

      If you are a fan of The Legend of Korra, the animated drama TV series that aired on Nickelodeon from 2012 to 2014, you might be interested in playing its video game adaptation. The Legend of Korra (Video Game) is a third-person action beat 'em up game developed by PlatinumGames and published by Activision in 2014. It features an original story that takes place between Books Two and Three of the TV series, with Korra as the main protagonist who can bend the four elements – fire, earth, air, and water – in various combat styles and special moves. The game also includes an endless runner mode with Naga, Korra's polar bear dog companion, and a pro-bending mode where teams of three try to bend each other out of an arena.

      -

      download the legend of korra (video game)


      Download 🆗 https://urlca.com/2uOg34



      -

      The Legend of Korra (Video Game) is available for PC, Xbox One, Xbox 360, PlayStation 4, and PlayStation 3 platforms. However, it is not sold in physical copies, but only as a digital download. This means that you need to buy or download it online from authorized sources. In this article, we will show you how to do that for each platform, as well as provide some alternative options if you prefer. We will also give you some information about the requirements, prices, and features of the game. So, let's get started!

      -

      How to Download The Legend of Korra (Video Game) for PC

      -

      If you want to play The Legend of Korra (Video Game) on your PC, you have two main options: buying it from Steam or downloading it from other sources. Here are the steps for each option:

      -

      How to buy the game from Steam

      -

      Steam is one of the most popular and reliable platforms for buying and playing PC games online. It offers a large selection of games, including The Legend of Korra (Video Game), as well as various features such as cloud saving, achievements, community forums, reviews, and more. To buy The Legend of Korra (Video Game) from Steam, you need to follow these steps:

      -
        -
      1. https://store.steampowered.com/join/. You will need to provide a valid email address and a password, as well as agree to the terms of service and privacy policy. After creating your account, you will need to download and install the Steam client on your PC. You can do that from https://store.steampowered.com/about/. The Steam client is a software that allows you to access your Steam library, browse and buy games, chat with friends, and more. - Search for The Legend of Korra (Video Game) and purchase it. Once you have installed the Steam client and logged in with your account, you can search for The Legend of Korra (Video Game) in the search bar at the top of the window. Alternatively, you can go directly to the game's page at https://store.steampowered.com/app/281690/The_Legend_of_Korra/. There, you will see the game's description, screenshots, videos, reviews, and system requirements. You will also see the price of the game, which is $14.99 as of June 2023. To buy the game, you need to click on the "Add to Cart" button and then proceed to checkout. You will need to choose a payment method, such as credit card, PayPal, or Steam Wallet, and confirm your purchase. - Download and install the game from Steam library. After buying the game, it will be added to your Steam library, which you can access from the "Library" tab at the top of the window. There, you will see a list of all the games you own on Steam. To download and install The Legend of Korra (Video Game), you need to click on it and then click on the "Install" button. You will need to choose a location on your PC where you want to save the game files, and then wait for the download and installation to complete. The game's size is about 3 GB, so it may take some time depending on your internet speed. Once the game is installed, you can launch it from your Steam library or from your desktop shortcut.
      -

      How to download the game from other sources

      -

      If you don't want to buy the game from Steam or if you have any issues with Steam, you can also download the game from other sources online. However, you need to be careful when doing so, as some websites may offer illegal or unsafe downloads that may harm your PC or violate the game's license agreement. Here are some tips on how to download the game from other sources:

      -
        -
      • Look for reputable and trustworthy websites that offer legitimate downloads of The Legend of Korra (Video Game). Some examples are https://www.gog.com/game/the_legend_of_korra, https://www.humblebundle.com/store/the-legend-of-korra, and https://www.greenmangaming.com/games/the-legend-of-korra-pc/. These websites are known for selling DRM-free or discounted games that are safe and legal to download.
      • -
      • Check the credibility and security of the websites before downloading anything from them. You can do that by looking for reviews, ratings, feedbacks, certificates, seals, or badges that indicate the quality and reliability of the websites. You can also use tools such as https://www.virustotal.com/gui/home/url or https://sitecheck.sucuri.net/ to scan the websites for any malware or phishing attempts.
      • -
      • Download and install the game from the websites following their instructions. Each website may have different steps or requirements for downloading and installing The Legend of Korra (Video Game). For example, some websites may require you to create an account or use a specific launcher or client to access the game. Others may provide you with a direct download link or a code that you can redeem on another platform such as Steam. Make sure you follow the instructions carefully and keep your receipt or confirmation email in case of any issues.
      • -
      -

      How to Download The Legend of Korra (Video Game) for Xbox

      -

      If you want to play The Legend of Korra (Video Game) on your Xbox One or Xbox 360 console, you have two main options: buying it from Xbox Store or downloading it from other sources. Here are the steps for each option:

      -

      How to download the legend of korra game for free
      -The legend of korra video game review
      -The legend of korra game pc download
      -The legend of korra game xbox one
      -The legend of korra game ps4
      -The legend of korra game cheats
      -The legend of korra game walkthrough
      -The legend of korra game platinum games
      -The legend of korra game steam
      -The legend of korra game online
      -The legend of korra game trailer
      -The legend of korra game system requirements
      -The legend of korra game wiki
      -The legend of korra game soundtrack
      -The legend of korra game achievements
      -The legend of korra game costumes
      -The legend of korra game pro bending mode
      -The legend of korra game avatar state
      -The legend of korra game codes
      -The legend of korra game metacritic
      -The legend of korra game switch
      -The legend of korra game nintendo switch
      -The legend of korra game android
      -The legend of korra game ios
      -The legend of korra game apk
      -The legend of korra game mods
      -The legend of korra game download for android
      -The legend of korra game download for pc highly compressed
      -The legend of korra game download for windows 10
      -The legend of korra game download for ps3
      -The legend of korra game download for xbox 360
      -The legend of korra game download ocean of games
      -The legend of korra game download utorrent
      -The legend of korra game download size
      -The legend of korra game download reddit
      -The legend of korra video game gameplay
      -The legend of korra video game characters
      -The legend of korra video game voice actors
      -The legend of korra video game ending
      -The legend of korra video game sequel
      -Is the legend of korra video game canon?
      -Where to buy the legend of korra video game?
      -When was the legend of korra video game released?
      -Who made the legend of korra video game?
      -How long is the legend of korra video game?
      -How to play the legend of korra video game?
      -How to unlock all costumes in the legend of korra video game?
      -How to get avatar state in the legend of korra video game?
      -How to beat amon in the legend of korra video game?

      -

      How to buy the game from Xbox Store

      -

      Xbox Xbox Store is the official online marketplace for buying and playing Xbox games on your console. It offers a wide range of games, including The Legend of Korra (Video Game), as well as various features such as cloud saving, achievements, game clips, screenshots, and more. To buy The Legend of Korra (Video Game) from Xbox Store, you need to follow these steps:

        -
      1. Create an Xbox account and sign in to Xbox Live. If you don't have an Xbox account yet, you can create one for free at https://account.xbox.com/en-us/accountcreation. You will need to provide a valid email address and a password, as well as agree to the terms of service and privacy policy. After creating your account, you will need to sign in to Xbox Live on your console. You can do that by pressing the Xbox button on your controller and selecting "Sign in". You will need to enter your email and password, or use a PIN or a controller sign-in if you have set them up.
      2. -
      3. Search for The Legend of Korra (Video Game) and purchase it. Once you have signed in to Xbox Live, you can search for The Legend of Korra (Video Game) in the Xbox Store app on your console. Alternatively, you can go directly to the game's page at https://www.microsoft.com/en-us/p/the-legend-of-korra/bqz1x8j0w9xq. There, you will see the game's description, screenshots, videos, reviews, and system requirements. You will also see the price of the game, which is $14.99 as of June 2023. To buy the game, you need to click on the "Buy" button and then proceed to checkout. You will need to choose a payment method, such as credit card, PayPal, or Microsoft account balance, and confirm your purchase.
      4. -
      5. Download and install the game from Xbox library. After buying the game, it will be added to your Xbox library, which you can access from the "My games & apps" app on your console. There, you will see a list of all the games you own on Xbox. To download and install The Legend of Korra (Video Game), you need to select it and then select "Install". You will need to choose a location on your console where you want to save the game files, and then wait for the download and installation to complete. The game's size is about 3 GB, so it may take some time depending on your internet speed. Once the game is installed, you can launch it from your Xbox library or from your home screen.
      -

      How to download the game from other sources

      -

      If you don't want to buy the game from Xbox Store or if you have any issues with Xbox Live, you can also download the game from other sources online. However, you need to be careful when doing so, as some websites may offer illegal or unsafe downloads that may harm your console or violate the game's license agreement. Here are some tips on how to download the game from other sources:

      - -

      How to Download The Legend of Korra (Video Game) for PlayStation

      -

      If you want to play The Legend of Korra (Video Game) on your PlayStation 4 or PlayStation 3 console, you have two main options: buying it from PlayStation Store or downloading it from other sources. Here are the steps for each option:

      -

      How to buy the game from PlayStation Store

      -

      PlayStation Store is the official online marketplace for buying and playing PlayStation games on your console. It offers a wide range of games, including The Legend of Korra (Video Game), as well as various features such as cloud saving, trophies, game clips, screenshots, and more. To buy The Legend of Korra (Video Game) from PlayStation Store, you need to follow these steps:

      -
        -
      1. Create a PlayStation account and sign in to PlayStation Network. If you don't have a PlayStation account yet, you can create one for free at https://www.playstation.com/en-us/account/create/. You will need to provide a valid email address and a password, as well as agree to the terms of service and privacy policy. After creating your account, you will need to sign in to PlayStation Network on your console. You can do that by selecting "Sign In" from the home screen or by pressing the PS button on your controller and selecting "Sign In". You will need to enter your email and password, or use a PIN or a face recognition if you have set them up.
      2. -
      3. Search for The Legend of Korra (Video Game) and purchase it. Once you have signed in to PlayStation Network, you can search for The Legend of Korra (Video Game) in the PlayStation Store app on your console. Alternatively, you can go directly to the game's page at https://store.playstation.com/en-us/product/UP0002-CUSA00813_00-KORRAGAME0000000. There, you will see the game's description, screenshots, videos, reviews, and system requirements. You will also see the price of the game, which is $14.99 as of June 2023. To buy the game, you need to click on the "Add to Cart" button and then proceed to checkout. You will need to choose a payment method, such as credit card, PayPal, or PlayStation wallet, and confirm your purchase.
      4. -
      5. Download and install the game from PlayStation library. After buying the game, it will be added to your PlayStation library, which you can access from the "Library" app on your console. There, you will see a list of all the games you own on PlayStation. To download and install The Legend of Korra (Video Game), you need to select it and then select "Download". You will need to choose a location on your console where you want to save the game files, and then wait for the download and installation to complete. The game's size is about 3 GB, so it may take some time depending on your internet speed. Once the game is installed, you can launch it from your PlayStation library or from your home screen.
      -

      How to download the game from other sources

      -

      If you don't want to buy the game from PlayStation Store or if you have any issues with PlayStation Network, you can also download the game from other sources online. However, you need to be careful when doing so, as some websites may offer illegal or unsafe downloads that may harm your console or violate the game's license agreement. Here are some tips on how to download the game from other sources:

      - -

      Conclusion

      -

      The Legend of Korra (Video Game) is a fun and exciting game that lets you experience the world of the TV series in a new way. You can play as Korra, the Avatar who can bend the four elements, and fight against various enemies and challenges. You can also enjoy the endless runner mode with Naga, the pro-bending mode with your teammates, and the original story that takes place between Books Two and Three of the TV series.

      -

      To download The Legend of Korra (Video Game) for your PC, Xbox, or PlayStation, you have several options to choose from. You can buy it from Steam, Xbox Store, or PlayStation Store, which are the official and authorized sources for the game. You can also download it from other websites that offer legitimate and safe downloads of the game. However, you need to be careful and check the credibility and security of the websites before downloading anything from them.

      -

      We hope this article has helped you learn how to download The Legend of Korra (Video Game) for your preferred platform. If you have any questions, comments, or feedback, please feel free to share them with us below. We would love to hear from you!

      -

      FAQs

      -

      Q: What are the system requirements for The Legend of Korra (Video Game)?

      -

      A: The system requirements for The Legend of Korra (Video Game) vary depending on the platform you are using. Here are the minimum and recommended requirements for each platform:

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      PlatformMinimum RequirementsRecommended Requirements
      PC- OS: Windows XP, Vista, 7, 8 - Processor: AMD Athlon64 X2 5600+ or Intel Core 2 Duo or better - Memory: 2 GB RAM - Graphics: Radeon HD 3850 or GeForce 8800 GT or better - DirectX: Version 9.0 - Storage: 3 GB available space - Sound Card: 100% DirectX 9.0c compatible 16-bit sound card- OS: Windows 7, 8 - Processor: AMD Phenom II X4 805 or Intel Core i5-750 or better - Memory: 4 GB RAM - Graphics: Radeon HD 4670 or GeForce GTX 260 or better - DirectX: Version 9.0 - Storage: 3 GB available space - Sound Card: 100% DirectX 9.0c compatible 16-bit sound card
      Xbox One- OS: Xbox One - Processor: Custom AMD Jaguar CPU @1.75 GHz - Memory: 8 GB RAM - Graphics: Custom AMD GPU @853 MHz - Storage: 3 GB available space - Sound Card: Integrated- OS: Xbox One X - Processor: Custom AMD Jaguar CPU @2.3 GHz - Memory: 12 GB RAM - Graphics: Custom AMD GPU @1172 MHz - Storage: 3 GB available space - Sound Card: Integrated
      Xbox 360- OS: Xbox 360 - Processor: Xenon CPU @3.2 GHz - Memory: 512 MB RAM - Graphics: Xenos GPU @500 MHz - Storage: 3 GB available space - Sound Card: Integrated- OS: Xbox 360 S or E - Processor: Xenon CPU @3.2 GHz - Memory: 512 MB RAM - Graphics: Xenos GPU @500 MHz - Storage: 3 GB available space - Sound Card: Integrated
      PlayStation 4- OS: PlayStation 4 - Processor: AMD Jaguar CPU @1.6 GHz - Memory: 8 GB RAM - Graphics: AMD Radeon GPU @800 MHz - Storage: 3 GB available space - Sound Card: Integrated- OS: PlayStation 4 Pro - Processor: AMD Jaguar CPU @2.1 GHz - Memory: 8 GB RAM - Graphics: AMD Radeon GPU @911 MHz - Storage: 3 GB available space - Sound Card: Integrated
      PlayStation 3- OS: PlayStation 3 - Processor: Cell Broadband Engine CPU @3.2 GHz - Memory: 256 MB RAM - Graphics: RSX GPU @550 MHz - Storage: 3 GB available space - Sound Card: Integrated- OS: PlayStation 3 Slim or Super Slim - Processor: Cell Broadband Engine CPU @3.2 GHz - Memory: 256 MB RAM - Graphics: RSX GPU @550 MHz - Storage: 3 GB available space - Sound Card: Integrated
      -

      Q: How long is The Legend of Korra (Video Game)?

      -

      A: The Legend of Korra (Video Game) is a relatively short game, as it can be completed in about 4 to 6 hours, depending on your skill level and difficulty setting. However, you can replay the game with different bending styles, collectibles, costumes, and challenges to extend the gameplay. You can also try the endless runner mode with Naga and the pro-bending mode with your teammates for some extra fun and variety.

      -

      Q: Is The Legend of Korra (Video Game) canon?

      -

      A: The Legend of Korra (Video Game) is considered to be canon, as it was developed in collaboration with the TV series' creators, Michael Dante DiMartino and Bryan Konietzko, who also wrote the game's story. The game takes place between Books Two and Three of the TV series, and it features some characters and events that are referenced or shown in the later episodes. However, the game is not essential for understanding the TV series' plot, as it mostly focuses on Korra's personal journey and struggles.

      -

      Q: What are the differences between The Legend of Korra (Video Game) and the TV series?

      -

      A: The Legend of Korra (Video Game) is a video game adaptation of the TV series, so it has some differences in terms of style, format, and content. Some of the main differences are:

      -
        -
      • The game is a third-person action beat 'em up game, while the TV series is an animated drama series.
      • -
      • The game has a linear and straightforward story, while the TV series has a complex and layered story.
      • -
      • The game focuses on Korra as the main character, while the TV series features multiple characters and perspectives.
      • -
      • The game has a more cartoonish and exaggerated art style, while the TV series has a more realistic and detailed art style.
      • -
      • The game has more violence and combat scenes, while the TV series has more dialogue and character development scenes.
      • -
      -

      Q: How to unlock all the bending styles in The Legend of Korra (Video Game)?

      -

      A: In The Legend of Korra (Video Game), you start with only waterbending as your available bending style, as Korra loses her connection to the other elements at the beginning of the game. To unlock all the bending styles, you need to progress through the game's story mode and defeat certain bosses that will restore your bending abilities. Here is the order in which you will unlock the bending styles:

      -
        -
      1. Waterbending - available from the start
      2. -
      3. Earthbending - unlocked after defeating Hundun in Chapter 2
      4. -
      5. Firebending - unlocked after defeating Triple Threat Triad in Chapter 4
      6. -
      7. Airbending - unlocked after defeating Hundun again in Chapter 7
      8. -
      -

      Once you unlock a bending style, you can switch between them by pressing the directional buttons on your controller. You can also upgrade your bending skills by collecting spirit energy from enemies and chests, and spending it on new moves and combos in the pause menu.

      -

      Q: How to play pro-bending mode in The Legend of Korra (Video Game)?

      -

      A: Pro-bending mode is a special mode in The Legend of Korra (Video Game) that lets you play as a pro-bending team in an arena. Pro-bending is a sport that involves teams of three benders - one firebender, one earthbender, and one waterbender - who try to push each other out of the arena using their bending skills. To play pro-bending mode, you need to follow these steps:

      -
        -
      1. Select "Pro-Bending" from the main menu.
      2. -
      3. Select your difficulty level - easy, normal, or hard.
      4. -
      5. Select your team - - you can choose to play as the Fire Ferrets (Korra, Mako, and Bolin), the White Falls Wolfbats (Tahno, Ming, and Shaozu), or the Red Sands Rabaroos (Hasook, Viper, and Ghashiun).
      6. -
      7. Play the game according to the pro-bending rules. You will have three rounds to defeat your opponent, each lasting 90 seconds. You can use your bending skills to attack, defend, dodge, and counter. You can also use special moves and combos to gain an advantage. The goal is to push your opponent back to their zone or knock them out of the arena. You can also win by having more territory than your opponent at the end of the round. You will lose if you are pushed back to your zone or knocked out of the arena, or if you break any of the pro-bending rules, such as using illegal moves, crossing the center line, or stepping out of your zone.
      8. -
      9. Enjoy the game and try to win the championship. You will face different teams with different skills and strategies in each round. You will also earn spirit energy and trophies for your performance. You can use the spirit energy to upgrade your pro-bending skills in the pause menu. You can also replay any round or switch teams at any time. The game will save your progress automatically.
      10. -
      -

      Pro-bending mode is a fun and challenging way to test your bending skills and teamwork. It is also a great way to relive some of the memorable moments from the TV series. So, what are you waiting for? Grab your controller and join the pro-bending action!

      197e85843d
      -
      -
      \ No newline at end of file diff --git a/spaces/congsaPfin/Manga-OCR/logs/Learn from the Rich Dad Poor Dad The Secrets of Financial Literacy Investing and Entrepreneurship.md b/spaces/congsaPfin/Manga-OCR/logs/Learn from the Rich Dad Poor Dad The Secrets of Financial Literacy Investing and Entrepreneurship.md deleted file mode 100644 index 8deed3923db8f684fa082a456791c121e914973b..0000000000000000000000000000000000000000 --- a/spaces/congsaPfin/Manga-OCR/logs/Learn from the Rich Dad Poor Dad The Secrets of Financial Literacy Investing and Entrepreneurship.md +++ /dev/null @@ -1,147 +0,0 @@ - -

      Rich Dad Poor Dad: What the Rich Teach Their Kids About Money That the Poor and Middle Class Do Not

      -

      Introduction

      -

      Have you ever wondered why some people are rich and others are poor? Have you ever asked yourself what you can do to improve your financial situation and achieve your dreams? Have you ever felt frustrated by the lack of financial education in school and society?

      -

      If you answered yes to any of these questions, then you might want to read Rich Dad Poor Dad, a best-selling book by Robert Kiyosaki that has changed the lives of millions of people around the world. In this book, Kiyosaki shares his personal story of growing up with two dads: his biological father, who was highly educated but financially struggling, and his best friend's father, who was a high school dropout but a successful entrepreneur. He calls them his "poor dad" and his "rich dad", respectively.

      -

      rich dad poor dad


      Download File >>>>> https://urlca.com/2uOb8M



      -

      Kiyosaki learned valuable lessons from both of his dads, but he realized that they had very different views and attitudes towards money, work, and life. He decided to follow the advice of his rich dad, who taught him how to become financially literate, how to build wealth, and how to achieve financial freedom. He also realized that most people are stuck in the "rat race" of working hard for money, instead of making money work for them.

      -

      In this article, we will summarize the main lessons from Rich Dad Poor Dad that can help you change your mindset, increase your financial intelligence, and create your own destiny. We will also provide some quotes from the book that will inspire you to take action and pursue your goals.

      -

      Main Lessons from Rich Dad Poor Dad

      -

      Lesson 1: The Rich Don't Work for Money

      -

      The first lesson that Kiyosaki learned from his rich dad was that the rich don't work for money. They make money work for them. This means that they understand how money works, how to use it as a tool, and how to create multiple streams of income that generate cash flow without their active involvement.

      -

      The difference between assets and liabilities

      -

      One of the key concepts that Kiyosaki explains in his book is the difference between assets and liabilities. He defines an asset as something that puts money in your pocket, and a liability as something that takes money out of your pocket. For example, a rental property that produces positive cash flow is an asset, while a mortgage that requires monthly payments is a liability. A car that you use for personal transportation is also a liability, unless you use it for business purposes or rent it out to others.

      -

      Most people think that their home is their biggest asset, but Kiyosaki argues that it is actually their biggest liability. This is because a home costs money to maintain, repair, insure, and pay taxes on. Unless your home appreciates in value faster than your expenses, it is not generating any income for you.

      -

      The rich, on the other hand, focus on acquiring assets that produce passive income, such as stocks, bonds, businesses, royalties, and intellectual property. They use their income to buy more assets, creating a cycle of wealth accumulation. They also use debt strategically, borrowing money to invest in assets that generate higher returns than the interest they pay.

      -

      Rich Dad Poor Dad summary
      -Rich Dad Poor Dad glossary
      -Rich Dad Poor Dad book review
      -Rich Dad Poor Dad lessons
      -Rich Dad Poor Dad quotes
      -Rich Dad Poor Dad audiobook
      -Rich Dad Poor Dad pdf download
      -Rich Dad Poor Dad movie
      -Rich Dad Poor Dad game
      -Rich Dad Poor Dad podcast
      -Rich Dad Poor Dad seminar
      -Rich Dad Poor Dad board game
      -Rich Dad Poor Dad cash flow quadrant
      -Rich Dad Poor Dad workbook
      -Rich Dad Poor Dad ebook
      -Rich Dad Poor Dad series
      -Rich Dad Poor Dad amazon
      -Rich Dad Poor Dad flipkart
      -Rich Dad Poor Dad in hindi
      -Rich Dad Poor Dad in tamil
      -Rich Dad Poor Dad in telugu
      -Rich Dad Poor Dad in marathi
      -Rich Dad Poor Dad in urdu
      -Rich Dad Poor Dad in malayalam
      -Rich Dad Poor Dad in gujarati
      -Rich Dad Poor Dad in kannada
      -Rich Dad Poor Dad in bengali
      -Rich Dad Poor Dad in spanish
      -Rich Dad Poor Dad in french
      -Rich Dad Poor Dad in german
      -Rich Dad Poor Dad in chinese
      -Rich Dad Poor Dad in japanese
      -Rich Dad Poor Dad in korean
      -Rich dad poor dad vs think and grow rich
      -Rich dad poor dad vs the millionaire next door
      -Rich dad poor dad vs the richest man in babylon
      -Robert Kiyosaki biography
      -Robert Kiyosaki net worth
      -Robert Kiyosaki books list
      -Robert Kiyosaki quotes on money
      -Robert Kiyosaki youtube channel
      -Robert Kiyosaki instagram account
      -Robert Kiyosaki twitter handle
      -Robert Kiyosaki website link
      -Robert Kiyosaki podcast name
      -Robert Kiyosaki email address
      -Robert Kiyosaki contact number.

      -

      The power of passive income

      -

      Passive income is income that you earn without having to work for it. It is the opposite of active income, which is income that you earn by trading your time and energy for money. Examples of active income are salaries, wages, commissions, and tips.

      -

      Passive income is the key to financial freedom, because it allows you to have more time and money to do what you love. It also gives you more security and stability, because you don't have to worry about losing your job or getting sick. You can also leverage your passive income to create more passive income, by reinvesting your profits or diversifying your portfolio.

      -

      Kiyosaki says that the rich don't work for money; they work for assets that generate passive income. They use their money to buy or create systems that make money for them, such as businesses, franchises, licenses, patents, or websites. They also hire people who are smarter than them to run their systems, so they don't have to be involved in the day-to-day operations.

      -

      The mindset of abundance

      -

      Another important lesson that Kiyosaki learned from his rich dad was the mindset of abundance. He says that most people have a scarcity mentality, which means that they believe that there is not enough money, opportunities, or resources for everyone. They think that money is hard to come by, and that they have to compete with others for it. They also fear losing money or missing out on opportunities.

      -

      The rich have an abundance mentality, which means that they believe that there is more than enough money, opportunities, and resources for everyone. They think that money is easy to make, and that they can cooperate with others for mutual benefit. They also embrace risk and uncertainty as part of the game of wealth creation.

      -

      Kiyosaki says that the mindset of abundance is essential for becoming rich, because it allows you to see possibilities instead of limitations. It also motivates you to take action and pursue your goals with confidence and optimism. He says that you can develop an abundance mentality by changing your thoughts, words, and actions from negative to positive.

      -

      Lesson 2: Why Teach Financial Literacy?

      -

      The second lesson that Kiyosaki learned from his rich dad was why teach financial literacy. He says that financial literacy is the ability to understand how money works and how to make it work for you. It involves knowing how to read and interpret financial statements, how to manage your cash flow, how to plan your taxes and investments, and how to protect your assets.

      -

      The difference between income statement and balance sheet

      -

      One of the basic concepts of financial literacy is the difference between income statement and balance sheet. An income statement shows how much money you earn (income) and how much money you spend (expenses) over a period of time. A balance sheet shows how much money you own (assets) and how much money you owe (liabilities) at a point in time.

      -

      Kiyosaki says that most people only focus on their income statement, and try to increase their income by working harder or getting a raise. However, this does not necessarily make them richer, because they also increase their expenses by buying more things or paying more taxes. He says that the rich focus on their balance sheet, and try to increase their assets by investing in income-generating assets. They also reduce their liabilities by paying off their debts or using them wisely. He says that the rich measure their wealth by their net worth, which is the difference between their assets and liabilities, not by their income.

      -

      The importance of cash flow

      -

      Another concept of financial literacy is the importance of cash flow. Cash flow is the amount of money that flows in and out of your pocket. It is different from income, which is the amount of money that you earn, and profit, which is the amount of money that you keep after paying your expenses.

      -

      Kiyosaki says that cash flow is the most important factor in determining your financial health, because it shows how well you manage your money and how much money you have available to invest or spend. He says that there are two types of cash flow: positive and negative. Positive cash flow means that you have more money coming in than going out, and negative cash flow means that you have more money going out than coming in.

      -

      Kiyosaki says that most people have negative cash flow, because they spend more than they earn, or they have high expenses that eat up their income. He says that the rich have positive cash flow, because they earn more than they spend, or they have low expenses that allow them to keep more of their income. He also says that the rich use their positive cash flow to buy more assets that generate more cash flow, creating a virtuous cycle of wealth creation.

      -

      The impact of taxes and inflation

      -

      A third concept of financial literacy is the impact of taxes and inflation. Taxes are the amount of money that you pay to the government from your income or profits. Inflation is the increase in the prices of goods and services over time, which reduces the purchasing power of your money.

      -

      Kiyosaki says that taxes and inflation are the two biggest enemies of the poor and middle class, because they erode their income and savings. He says that most people pay taxes on their income before they spend it, which means that they pay taxes on every dollar they earn. He also says that most people save money in low-interest accounts or bonds, which means that they lose money to inflation every year.

      -

      Kiyosaki says that the rich use taxes and inflation to their advantage, because they know how to minimize their tax liability and maximize their return on investment. He says that the rich pay taxes on their income after they spend it, which means that they pay taxes on only a fraction of what they earn. He also says that the rich invest money in high-return assets or businesses, which means that they make money faster than inflation.

      -

      Lesson 3: Mind Your Own Business

      -

      The third lesson that Kiyosaki learned from his rich dad was to mind his own business. He says that this means to focus on building your own assets and creating your own sources of income, rather than working for someone else's business or relying on someone else's income.

      -

      The difference between profession and business

      -

      One of the distinctions that Kiyosaki makes in his book is the difference between profession and business. He defines a profession as a specialized skill or knowledge that you use to provide a service or product to others. He defines a business as a system or organization that you own or control, that provides a service or product to others.

      -

      Kiyosaki says that most people are trained to become professionals, such as doctors, lawyers, engineers, teachers, or accountants. They spend years studying and working hard to acquire a degree or certification, hoping to get a good job with a high salary and benefits. However, he says that this does not guarantee financial success or security, because professionals are still employees who depend on their employers for their income and security.

      -

      Kiyosaki says that the rich are entrepreneurs who create businesses, such as restaurants, hotels, factories, stores, or franchises. They spend years learning and working hard to develop a system or brand, hoping to create a loyal customer base and a competitive edge. He says that this leads to financial success and security, because entrepreneurs are owners who control their own income and security.

      The benefits of entrepreneurship

      -

      Some of the benefits of entrepreneurship that Kiyosaki highlights in his book are: - You have more freedom and flexibility to choose your own hours, location, and projects. - You have more creativity and innovation to solve problems, create value, and make a difference. - You have more potential and opportunity to grow your income, wealth, and impact. - You have more satisfaction and fulfillment from pursuing your passion, vision, and purpose.

      Of course, entrepreneurship also comes with challenges and risks, such as: - You have more responsibility and accountability for your own decisions, actions, and results. - You have more uncertainty and volatility in your income, expenses, and cash flow. - You have more competition and pressure from the market, customers, and regulations. - You have more stress and frustration from dealing with problems, failures, and setbacks.

      -

      Kiyosaki says that the key to overcoming these challenges and risks is to develop your financial intelligence, which is the combination of financial knowledge, skills, experience, and attitude. He says that financial intelligence will help you to: - Make better financial decisions based on facts, logic, and analysis. - Manage your finances effectively based on planning, budgeting, and monitoring. - Leverage your resources efficiently based on borrowing, investing, and partnering. - Protect your assets wisely based on insurance, legal, and tax strategies.

      -

      The skills of financial intelligence

      -

      Some of the skills of financial intelligence that Kiyosaki recommends to learn are: - Accounting: the ability to read and understand financial statements, such as income statement, balance sheet, and cash flow statement. - Investing: the ability to allocate your money into different types of assets, such as stocks, bonds, real estate, commodities, or businesses. - Marketing: the ability to communicate the value of your product or service to your target market, such as customers, investors, or partners. - Law: the ability to understand the rules and regulations that affect your business or industry, such as contracts, licenses, or taxes.

      -

      Kiyosaki says that these skills are not taught in school or college, but they are essential for becoming rich. He says that you can learn these skills by reading books, taking courses, attending seminars, or finding mentors. He also says that you can practice these skills by starting your own business or investing in other businesses.

      -

      Lesson 4: The History of Taxes and the Power of Corporations

      -

      The fourth lesson that Kiyosaki learned from his rich dad was the history of taxes and the power of corporations. He says that this lesson explains how the rich use the system to their advantage, while the poor and middle class are exploited by the system.

      -

      The origin of taxes and how they affect the poor and middle class

      -

      Kiyosaki says that taxes were originally created to fund wars and public services. They were only imposed on the rich landowners who had the most to gain from the protection of the government. However, and how they use corporations to reduce their tax burden and protect their assets.

      The advantages of corporations and how they protect the rich

      -

      A corporation is a legal entity that is separate from its owners, shareholders, and managers. It has its own rights and obligations, such as the ability to enter into contracts, own property, sue and be sued, and pay taxes. A corporation can also issue shares of stock, which represent ownership interests in the company.

      -

      Kiyosaki says that corporations are the most powerful tools that the rich use to create wealth and avoid taxes. He says that corporations provide several advantages, such as: - Limited liability: The owners of a corporation are not personally liable for the debts or obligations of the company, unless they commit fraud or negligence. This means that they can protect their personal assets from creditors or lawsuits. - Tax benefits: The owners of a corporation can deduct many expenses from their taxable income, such as salaries, travel, entertainment, education, and health care. They can also defer or avoid taxes by reinvesting their profits in the company or distributing them as dividends to shareholders. - Asset protection: The owners of a corporation can use various strategies to shield their assets from taxes, creditors, or lawsuits, such as creating trusts, foundations, or offshore entities. They can also use different types of corporations for different purposes, such as C corporations, S corporations, LLCs, or LLPs.

      -

      Kiyosaki says that the rich use corporations as vehicles to accumulate and transfer wealth, while the poor and middle class pay taxes on their income and savings. He says that the rich understand the rules of the game and play by them, while the poor and middle class are ignorant of the game and are played by it.

      -

      The loopholes and strategies of tax planning

      -

      Kiyosaki says that tax planning is one of the most important skills of financial intelligence. He says that tax planning is the art of arranging your financial affairs in such a way that you minimize your tax liability legally and ethically. He says that tax planning is not tax evasion, which is the illegal and unethical avoidance of paying taxes.

      -

      Kiyosaki says that there are many loopholes and strategies that the rich use to reduce their taxes, such as: - Depreciation: The deduction of the cost of an asset over its useful life, such as a building, a car, or a machine. This reduces the taxable income of the owner of the asset. - Capital gains: The profit from selling an asset for more than its purchase price, such as a stock, a bond, or a property. This is taxed at a lower rate than ordinary income in most countries. - Tax credits: The reduction of the amount of tax owed by a certain amount, such as for investing in renewable energy, hiring employees, or donating to charity. This reduces the tax liability of the taxpayer. - Tax deferral: The postponement of paying taxes until a later date, such as by using retirement accounts, annuities, or life insurance. This allows the taxpayer to compound their money without paying taxes until they withdraw it.

      -

      Kiyosaki says that these loopholes and strategies are available to anyone who is willing to learn and apply them. He says that the rich hire professionals such as accountants, lawyers, and financial advisors to help them with their tax planning. He also says that the rich lobby the government to create more loopholes and benefits for themselves.

      -

      Lesson 5: The Rich Invent Money

      -

      The fifth lesson that Kiyosaki learned from his rich dad was that the rich invent money. He says that this means that the rich create money out of thin air by using their imagination, creativity, and knowledge to create value and opportunities that others don't see or don't act on. He says that this is the essence of being an entrepreneur and an investor.

      -

      The difference between being creative and being competitive

      -

      One of the distinctions that Kiyosaki makes in his book is the difference between being creative and being competitive. He says that most people are trained to be competitive, which means that they try to win by being better, faster, or cheaper than others. They follow the rules of the game and try to beat their opponents. However, he says that this leads to a zero-sum game, where one person's gain is another person's loss.

      -

      Kiyosaki says that the rich are creative, which means that they try to win by creating new value, new solutions, or new markets. They change the rules of the game or create their own game. He says that this leads to a positive-sum game, where everyone can benefit from the innovation and growth.

      -

      Kiyosaki says that being creative is more important than being competitive, because it allows you to invent money and create wealth. He says that you can develop your creativity by expanding your mind, learning new things, seeking new experiences, and challenging yourself.

      -

      The opportunities and risks of investing

      -

      Another aspect of inventing money is investing. Investing is the process of putting your money into something that you expect to generate a return in the future, such as a business, a property, or a financial instrument. Investing is one of the main ways that the rich create passive income and grow their wealth.

      -

      Kiyosaki says that investing involves both opportunities and risks. Opportunities are the potential rewards or benefits that you can gain from investing, such as income, appreciation, or tax advantages. Risks are the potential losses or drawbacks that you can face from investing, such as volatility, depreciation, or liability.

      -

      Kiyosaki says that the rich are not afraid of risks, but they know how to manage them. He says that the rich use four strategies to reduce their risks and increase their opportunities: - Education: The rich learn as much as they can about the investment before they invest. They study the market, the industry, the company, and the deal. They also keep themselves updated on the trends, changes, and news that affect their investment. - Analysis: The rich analyze the numbers and facts of the investment before they invest. They calculate the return on investment (ROI), the cash flow, the break-even point, and the exit strategy. They also compare different options and scenarios to find the best one. - Due diligence: The rich verify the information and assumptions of the investment before they invest. They check the background, reputation, and track record of the people involved in the deal. They also inspect the property, documents, and contracts to make sure they are accurate and legal. - Risk control: The rich control their risk exposure and limit their downside before they invest. They use various tools and techniques to protect their investment, such as diversification, hedging, insurance, or legal entities.

      -

      The types and levels of investors

      -

      Kiyosaki says that there are different types and levels of investors, depending on their knowledge, experience, and goals. He uses a quadrant model to illustrate this: - The E quadrant: These are employees who work for someone else's business or organization. They invest in safe and secure assets such as savings accounts, certificates of deposit, or bonds. They have low risk tolerance and low return expectations. They rely on their salary or pension for their income. - The S quadrant: These are self-employed professionals who work for their own business or practice. They invest in their own skills, knowledge, or reputation. They have moderate risk tolerance and moderate return expectations. They rely on their fees or commissions for their income. - The B quadrant: These are business owners who own or control a system or organization that works for them. They invest in other people's skills, knowledge, or reputation. They have high risk tolerance and high return expectations. They rely on their profits or dividends for their income. - The I quadrant: These are investors who own or control assets that generate passive income for them. They invest in businesses, properties, or financial instruments that they don't have to work for. They have very high risk tolerance and very high return expectations. They rely on their cash flow or capital gains for their income.

      -

      Kiyosaki says that the rich are mostly in the B and I quadrants, while the poor and middle class are mostly in the E and S quadrants. He says that the goal is to move from the left side of the quadrant to the right side, where you have more freedom, wealth, and power.

      -

      Lesson 6: Work to Learn, Don't Work for Money

      -

      The sixth and final lesson that Kiyosaki learned from his rich dad was to work to learn, not to work for money. He says that this means to use your work as a platform to acquire new skills, knowledge, and experience that will help you become richer and more successful.

      -

      The difference between job security and financial freedom

      -

      One of the contrasts that Kiyosaki makes in his book is the difference between job security and financial freedom. He says that most people seek job security, which means that they want to have a stable and predictable income from a reliable employer. They want to have benefits such as health insurance, retirement plan, and paid vacation. They want to have a career path that leads to promotions and raises.

      -

      Kiyosaki says that job security is an illusion, because it depends on factors that are beyond your control, such as the economy, the market, the industry, or the company. He says that job security can also limit your potential, because it makes you complacent, dependent, and fearful of change.

      -

      Kiyosaki says that the rich seek financial freedom, which means that they want to have enough passive income from their assets to cover their expenses and lifestyle. They want to have options such as choosing when, where, and how to work. They want to have a purpose that drives them to create value and make a difference.

      -

      Kiyosaki says that financial freedom is a reality, because it depends on factors that are within your control, such as your mindset, your actions, your results, or your network. He says that financial freedom can also expand your potential, because it makes you curious, independent, and adaptable to change.

      The value of lifelong learning and self-education

      -

      Another point that Kiyosaki emphasizes in his book is the value of lifelong learning and self-education. He says that most people stop learning after they finish school or college, thinking that they have enough knowledge and skills to succeed in life. They rely on their diplomas, certificates, or degrees to get them a job or a promotion. They also rely on their employers, teachers, or experts to tell them what to learn and how to learn.

      -

      Kiyosaki says that the rich never stop learning, because they know that the world is constantly changing and evolving. They take responsibility for their own education and development, seeking new information, ideas, and perspectives. They also choose their own mentors, coaches, or role models to guide them and inspire them.

      -

      Kiyosaki says that lifelong learning and self-education are essential for becoming rich, because they help you to: - Stay relevant and competitive in the market, by updating your knowledge and skills according to the trends, demands, and opportunities. - Discover and develop your talents and passions, by exploring your interests, strengths, and values. - Create and leverage your network, by connecting with like-minded people who can support you, challenge you, and collaborate with you.

      -

      The skills and knowledge that make you rich

      -

      Some of the skills and knowledge that Kiyosaki suggests to learn are: - Communication: The ability to express yourself clearly and persuasively, both verbally and in writing. This includes listening, speaking, reading, writing, presenting, negotiating, and influencing skills. - Sales: The ability to convince others to buy your product or service, or to join your cause or vision. This includes marketing, branding, advertising, prospecting, closing, and servicing skills. - Leadership: The ability to inspire and motivate others to follow your direction and achieve your goals. This includes visioning, planning, organizing, delegating, coaching, and empowering skills. - Personal development: The ability to improve yourself continuously in all aspects of your life. This includes goal setting, time management, stress management, problem solving, decision making, and emotional intelligence skills.

      Kiyosaki says that these skills and knowledge are not taught in school or college, but they are crucial for becoming rich. He says that you can learn these skills and knowledge by reading books, taking courses, attending seminars, or finding mentors. He also says that you can practice these skills and knowledge by working in different fields, industries, or roles.

      -

      Conclusion

      -

      In conclusion, Rich Dad Poor Dad is a book that teaches you how to become rich by changing your mindset, increasing your financial intelligence, and creating your own destiny. It is based on the personal story and lessons of Robert Kiyosaki, who learned from his two dads: his poor dad, who was a highly educated but financially struggling employee, and his rich dad, who was a high school dropout but a successful entrepreneur.

      -

      The main lessons from the book are: - The rich don't work for money; they make money work for them. - Why teach financial literacy? - Mind your own business. - The history of taxes and the power of corporations. - The rich invent money. - Work to learn, don't work for money.

      -

      By applying these lessons to your life, you can achieve financial freedom and live your dreams. You can also help others to do the same, by sharing your knowledge and experience with them. You can also contribute to the society and the world, by creating value and making a difference.

      -

      FAQs

      -

      What is the main message of Rich Dad Poor Dad?

      -

      The main message of Rich Dad Poor Dad is that you can become rich by changing your mindset, increasing your financial intelligence, and creating your own destiny.

      -

      Who is the author of Rich Dad Poor Dad?

      -

      The author of Rich Dad Poor Dad is Robert Kiyosaki, a best-selling author, entrepreneur, investor, and educator.

      -

      When was Rich Dad Poor Dad published?

      -

      Rich Dad Poor Dad was first published in 1997. It has since sold over 32 million copies worldwide and has been translated into 51 languages.

      -

      Is Rich Dad Poor Dad based on a true story?

      -

      Rich Dad Poor Dad is based on the personal story and lessons of Robert Kiyosaki, who learned from his two dads: his poor dad, who was his biological father and a highly educated but financially struggling employee, and his rich dad, who was his best friend's father and a high school dropout but a successful entrepreneur.

      -

      How can I learn more from Robert Kiyosaki?

      -

      You can learn more from Robert Kiyosaki by visiting his website (https://www.richdad.com/), where you can find his books, courses, podcasts, blogs, events, and other resources. You can also follow him on social media platforms such as Facebook (https://www.facebook.com/RobertKiyosaki/), Twitter (https://twitter.com/theRealKiyosaki), Instagram (https://www.instagram.com/therealkiyosaki/), YouTube (https://www.youtube.com/user/RDdotcom), or LinkedIn (https://www.linkedin.com/in/robertkiyosaki/).

      197e85843d
      -
      -
      \ No newline at end of file diff --git a/spaces/congsaPfin/Manga-OCR/logs/Listen and Download Himesh Reshammiya New Song MP3 2021 - Top Songs and Music Videos.md b/spaces/congsaPfin/Manga-OCR/logs/Listen and Download Himesh Reshammiya New Song MP3 2021 - Top Songs and Music Videos.md deleted file mode 100644 index cc5c180a27327953b0610f28c28434b2a3647705..0000000000000000000000000000000000000000 --- a/spaces/congsaPfin/Manga-OCR/logs/Listen and Download Himesh Reshammiya New Song MP3 2021 - Top Songs and Music Videos.md +++ /dev/null @@ -1,132 +0,0 @@ - -

      Himesh Reshammiya New Song MP3 Download 2021

      -

      If you are a fan of Bollywood music, you must have heard of Himesh Reshammiya, the versatile singer, composer, actor, and producer who has given us some of the most memorable songs in Hindi cinema. He is back with a bang with his latest song Terre Pyaar Mein from his album Surroor 2021, which is creating waves on the internet. In this article, we will tell you everything you need to know about Himesh Reshammiya and his new song, and how you can download it in MP3 format.

      -

      Who is Himesh Reshammiya?

      -

      Himesh Reshammiya was born on 23 July 1973 in Mumbai to Vipin Reshammiya, an Indian music composer, and Madhu Reshammiya. He started his career as a music director in 1998 with the Salman Khan film Pyaar Kiya To Darna Kya, and since then he has composed music for over 100 films. He made his debut as a singer in 2005 with the song Aashiq Banaya Aapne, which became a huge hit and earned him several awards. He also ventured into acting in 2007 with the film Aap Kaa Surroor, which was a success at the box office. He has won many accolades for his music and singing, such as Filmfare Award, Zee Cine Award, IIFA Award, Screen Award, Star Guild Award, etc.

      -

      himesh reshammiya new song mp3 download 2021


      Download File »»» https://urlca.com/2uO86K



      -

      What is Surroor 2021?

      -

      Surroor 2021 is the upcoming studio album by Himesh Reshammiya, which is a sequel to his 2006 album Aap Kaa Surroor. The album will feature ten songs composed and written by Himesh Reshammiya himself. The first song from the album, Surroor Title Track, was released on 11 June 2021 and received a positive response from the listeners. The second song, Terre Pyaar Mein, was released on 22 June 2021 and became an instant hit. The album is expected to release soon under the label of Himesh Res

      What is Terre Pyaar Mein?

      -

      Terre Pyaar Mein is the latest romantic track by Himesh Reshammiya, which features the model and actress Shivangi Verma as the female lead. The song is a beautiful expression of love and longing, with soulful lyrics and melodious music. The song is also directed by Himesh Reshammiya himself, who has shown his skills behind the camera as well. The song has a catchy hook line, Terre pyaar mein main marjawan, which means I will die in your love. The song has a soothing and refreshing vibe, which will make you fall in love with it.

      -

      How to download Terre Pyaar Mein MP3?

      -

      If you want to download Terre Pyaar Mein MP3 and enjoy it offline, you can follow these simple steps:

      -
        -
      1. Go to YouTube and search for Terre Pyaar Mein Himesh Reshammiya.
      2. -
      3. Select the official video of the song from the channel of Himesh Reshammiya.
      4. -
      5. Copy the URL of the video from the address bar.
      6. -
      7. Go to a YouTube to MP3 converter website, such as ytmp3.cc, y2mate.com, mp3juices.cc, etc.
      8. -
      9. Paste the URL of the video in the search box and click on convert.
      10. -
      11. Download the MP3 file of the song and save it on your device.
      12. -
      -

      You can also download Terre Pyaar Mein MP3 from other online music streaming platforms, such as JioSaavn, Spotify, Gaana, Wynk, etc. You will need to have a subscription or a free trial account to access these platforms. You can also listen to the song online on these platforms without downloading it.

      -

      What are some other popular songs by Himesh Reshammiya?

      -

      Himesh Reshammiya has given us many hit songs over the years, which have become evergreen classics. Here are some of his most popular songs from his previous albums and films:

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

      What are some upcoming projects by Himesh Reshammiya?

      -

      Himesh Reshammiya is not only a talented musician, but also a busy actor and producer. He has several projects lined up for the future, which will showcase his versatility and creativity. Here are some of his upcoming projects that you can look forward to:

      -

      Terre Pyaar Mein mp3 song download by Himesh Reshammiya
      -Surroor 2021 title track Himesh Reshammiya mp3 download
      -Himesh Reshammiya latest songs 2021 free download
      -Himesh Reshammiya new album Surroor 2021 mp3 songs
      -Download Himesh Reshammiya Shivangi Verma Terre Pyaar Mein video
      -Surroor 2021 title track video download Himesh Reshammiya Uditi Singh
      -Himesh Reshammiya new romantic songs 2021 mp3 download
      -Himesh Reshammiya Surroor 2021 full album download zip file
      -Terre Pyaar Mein lyrics and mp3 song download Himesh Reshammiya
      -Surroor 2021 title track lyrics and mp3 song download Himesh Reshammiya
      -Himesh Reshammiya new song 2021 ringtone download
      -Himesh Reshammiya best songs 2021 mp3 download
      -Himesh Reshammiya new song Terre Pyaar Mein audio download
      -Himesh Reshammiya new song Surroor 2021 title track audio download
      -Himesh Reshammiya new song 2021 Spotify playlist
      -Himesh Reshammiya new song 2021 JioSaavn playlist
      -Himesh Reshammiya new song 2021 Wynk playlist
      -Himesh Reshammiya new song 2021 Gaana playlist
      -Himesh Reshammiya new song 2021 Apple Music playlist
      -Himesh Reshammiya new song 2021 Amazon Prime Music playlist
      -Himesh Reshammiya new song Terre Pyaar Mein video teaser download
      -Himesh Reshammiya new song Surroor 2021 title track video teaser download
      -Himesh Reshammiya new song Terre Pyaar Mein behind the scenes video download
      -Himesh Reshammiya new song Surroor 2021 title track behind the scenes video download
      -Himesh Reshammiya new song Terre Pyaar Mein reaction video download
      -Himesh Reshammiya new song Surroor 2021 title track reaction video download
      -Himesh Reshammiya new song Terre Pyaar Mein dance cover video download
      -Himesh Reshammiya new song Surroor 2021 title track dance cover video download
      -Himesh Reshammiya new song Terre Pyaar Mein instrumental version download
      -Himesh Reshammiya new song Surroor 2021 title track instrumental version download
      -Himesh Reshammiya new song Terre Pyaar Mein karaoke version download
      -Himesh Reshammiya new song Surroor 2021 title track karaoke version download
      -Himesh Reshammiya new song Terre Pyaar Mein remix version download
      -Himesh Reshammiya new song Surroor 2021 title track remix version download
      -Himesh Reshammiya new song Terre Pyaar Mein unplugged version download
      -Himesh Reshammiya new song Surroor 2021 title track unplugged version download
      -Himesh Reshammiya new song Terre Pyaar Mein mashup version download
      -Himesh Reshammiya new song Surroor 2021 title track mashup version download
      -Himesh Reshammiya new song Terre Pyaar Mein cover version download
      -Himesh Reshammiya new song Surroor 2021 title track cover version download.

      -
        -
      • Apne 2: This is the sequel to the 2007 film Apne, which starred Dharmendra, Sunny Deol, Bobby Deol, and Katrina Kaif. Himesh Reshammiya will be composing the music for this film, which will also feature Karan Deol and Shilpa Shetty. The film is expected to release in 2022.
      • -
      • Bad Boy: This is an action comedy film, which will mark the debut of Mithun Chakraborty's son Namashi Chakraborty and Amrin Qureshi. Himesh Reshammiya will be producing and composing the music for this film, which is directed by Rajkumar Santoshi. The film is slated to release in 2021.
      • -
      • The Xposè 2: This is the sequel to the 2014 film The Xposè, which starred Himesh Reshammiya, Yo Yo Honey Singh, Zoya Afroz, and Sonali Raut. Himesh Reshammiya will be reprising his role as Ravi Kumar, a former cop turned superstar, in this film, which will also feature Irrfan Khan and Urvashi Rautela. The film is expected to release in 2022.
      • -
      -

      Conclusion

      -

      Himesh Reshammiya is one of the most popular and successful artists in Bollywood, who has given us many hit songs and albums over the years. His latest song Terre Pyaar Mein from his album Surroor 2021 is a romantic melody that will touch your heart and soul. You can download this song in MP3 format from various online platforms and enjoy it offline. You can also listen to his other songs from his previous albums and films, which are equally amazing and catchy. And don't forget to watch out for his upcoming projects, which will surely entertain you and impress you with his talent and skills.

      -

      So what are you waiting for? Go ahead and listen to Terre Pyaar Mein and Surroor 2021 and let us know your feedback in the comments section below. And if you liked this article, please share it with your friends and family who are fans of Himesh Reshammiya.

      -

      FAQs

      -

      Here are some frequently asked questions and answers about Himesh Reshammiya and his new song:

      -
        -
      1. Q: When will Surroor 2021 release?
      2. -
      3. A: Surroor 2021 is expected to release soon, but the exact date has not been announced yet. You can follow Himesh Reshammiya on his social media handles to get the latest updates on his album.
      4. -
      5. Q: Who is Shivangi Verma?
      6. -
      7. A: Shivangi Verma is an Indian model and actress, who has appeared in several TV shows, such as Pavitra Rishta, Piya Basanti Re, Reporters, etc. She is also the wife of actor Rajeshwari Sachdev. She has featured as the female lead in Terre Pyaar Mein opposite Himesh Reshammiya.
      8. -
      9. Q: How can I watch the video of Terre Pyaar Mein?
      10. -
      11. A: You can watch the video of Terre Pyaar Mein on YouTube on the official channel of Himesh Reshammiya. You can also watch it on other platforms, such as MX Player, Hungama Play, etc.
      12. -
      13. Q: How can I contact Himesh Reshammiya?
      14. -
      15. A: You can contact Himesh Reshammiya through his official website www.himeshreshammiya.com or through his social media handles on Facebook, Twitter, Instagram, etc.
      16. -
      17. Q: How can I buy tickets for Himesh Reshammiya's live concerts?
      18. -
      19. A: You can buy tickets for Himesh Reshammiya's live concerts from various online portals, such as Book My Ticket, Paytm, Insider, etc. You can also check his official website and social media handles for the latest updates on his live concerts.
      20. -

      401be4b1e0
      -
      -
      \ No newline at end of file diff --git a/spaces/congsaPfin/Manga-OCR/logs/Mendix The Ultimate Low-Code Platform for Enterprise Apps.md b/spaces/congsaPfin/Manga-OCR/logs/Mendix The Ultimate Low-Code Platform for Enterprise Apps.md deleted file mode 100644 index 9d9f3bcff4e6fa912899b6d73b8d192d944faaec..0000000000000000000000000000000000000000 --- a/spaces/congsaPfin/Manga-OCR/logs/Mendix The Ultimate Low-Code Platform for Enterprise Apps.md +++ /dev/null @@ -1,133 +0,0 @@ - -

      How Mendix Can Accelerate Your Web and Mobile App Development

      -

      Do you want to build and deploy enterprise-grade applications faster and easier? Do you want to collaborate with your business and IT teams to deliver better digital solutions? Do you want to leverage the power of low-code and cloud-native technologies to innovate and transform your business? If you answered yes to any of these questions, then you should consider Mendix, a leading low-code application development platform.

      -

      mendix


      Download Filehttps://urlca.com/2uO7ro



      -

      What is Mendix and what does it do?

      -

      Mendix is a high-productivity platform that enables you to build and continuously improve mobile and web applications at scale. The Mendix Platform is designed to accelerate enterprise app delivery across your entire application development lifecycle, from ideation to deployment and operations.

      -

      Mendix enables you to implement both Agile and DevOps best practices. It even goes beyond that by involving business stakeholders in the actual development of the applications. Mendix offers low-code tooling via the extensive and powerful desktop-based visual app-modeling IDE Mendix Studio Pro, which is tailored towards professional developers and can be integrated with coding IDEs to extend capabilities. The result of this no-code and low-code combination is that business domain experts (like analysts and citizen developers) can work alongside expert developers to achieve much greater levels of alignment and accelerated delivery.

      -

      Moreover, the Mendix Platform’s cloud-native architecture and automation tools support the deployment, management, and monitoring of highly available enterprise-grade applications. You can deploy your apps to any cloud, on-premise environment, or edge device with a single click.

      -

      Why use Mendix for web and mobile app development?

      -

      Mendix is not just another low-code platform. It is a complete solution for your enterprise application development needs. Here are some of the reasons why you should use Mendix for web and mobile app development:

      -
        -
      • Mendix is the most secure low-code platform, with built-in proactive, reactive, preventative, and defensive controls for both the Platform and your apps.
      • -
      • Mendix is the most collaborative low-code platform, with tools that foster communication, feedback, and innovation among cross-functional teams.
      • -
      • Mendix is the most scalable low-code platform, with cloud-native capabilities that enable you to deploy and scale your apps anywhere without rearchitecting or redesigning.
      • -
      • Mendix is the most flexible low-code platform, with unlimited extensibility options that allow you to customize and integrate your apps with any system or data source.
      • -
      • Mendix is the most user-friendly low-code platform, with a modern, cross-platform UI and UX that deliver consistent, engaging multi-channel experiences across web, mobile, wearable, conversational, and immersive touch points.
      • -
      -

      Mendix Benefits and Features

      -

      Let’s take a closer look at some of the benefits and features that make Mendix stand out from other low-code platforms:

      -

      mendix low-code platform
      -mendix app development
      -mendix cloud deployment
      -mendix native mobile apps
      -mendix progressive web apps
      -mendix agile project management
      -mendix atlas UI framework
      -mendix version control
      -mendix developer portal
      -mendix enterprise app development
      -mendix digital transformation
      -mendix customer experiences
      -mendix legacy modernization
      -mendix workflow automation
      -mendix collaboration tools
      -mendix open-source frameworks
      -mendix multi-channel experiences
      -mendix containerized apps
      -mendix auto-provisioning
      -mendix auto-healing
      -mendix CI/CD support
      -mendix cloud interoperability
      -mendix responsive web apps
      -mendix offline-first apps
      -mendix IoT-enabled apps
      -mendix conversational apps
      -mendix immersive apps
      -mendix React and React Native
      -mendix model-driven development
      -mendix visual language
      -mendix feedback management
      -mendix DevOps tools
      -mendix scalability and performance
      -mendix security and compliance
      -mendix data integration and orchestration
      -mendix artificial intelligence and machine learning
      -mendix blockchain and smart contracts
      -mendix augmented reality and virtual reality
      -mendix business process management and optimization
      -mendix event-driven architecture and microservices
      -mendix application lifecycle management and governance
      -mendix application quality assurance and testing
      -mendix application monitoring and analytics
      -mendix application maintenance and support
      -mendix application migration and modernization services

      -

      Enterprise security and integration

      -

      Mendix supports various authentication and authorization mechanisms, such as SAML, OAuth, LDAP, Active Directory, Kerberos, certificates, tokens, etc. You can also apply role-based access control (RBAC) to your apps at different levels (app model, UI elements, data objects) to ensure data privacy and compliance.

      -

      Mendix also enables you to integrate your apps with existing systems and data sources using REST APIs, SOAP web services, OData services, JDBC connectors, message queues (MQTT , AMQP, etc.), and file transfer protocols (FTP, SFTP, etc.). You can also use Mendix Data Hub to discover, share, and consume data from any source in a governed way.

      -

      Central application management

      -

      Mendix provides a centralized platform for managing your applications throughout their lifecycle. You can use Mendix Studio and Mendix Studio Pro to design, develop, test, and debug your apps in a collaborative environment. You can also use Mendix Assist to get AI-powered code suggestions and quality checks.

      -

      Mendix also offers a cloud-based application management console called Mendix Cloud. With Mendix Cloud, you can deploy, monitor, and operate your apps with ease. You can also use Mendix Cloud to manage your app resources, backups, logs, alerts, metrics, and feedback.

      -

      One-click deployment

      -

      Mendix simplifies the deployment process by allowing you to deploy your apps to any cloud or on-premise environment with a single click. You can choose from various deployment options, such as Mendix Cloud (public or private), AWS, Azure, IBM Cloud, SAP Cloud Platform, Kubernetes, Docker, or your own infrastructure.

      -

      Mendix also supports continuous delivery and integration (CD/CI) workflows by integrating with tools like Git, Jenkins, Azure DevOps, etc. You can automate your build, test, and release processes using Mendix pipelines and webhooks.

      -

      Modern, cross-platform UI and UX

      -

      Mendix enables you to create beautiful and responsive user interfaces and user experiences for your apps. You can use Mendix Studio and Mendix Studio Pro to drag and drop UI elements, widgets, layouts, templates, themes, and navigation patterns to build your app pages. You can also use Mendix Atlas UI Framework to customize the look and feel of your apps using CSS and SASS.

      -

      Mendix also supports cross-platform development for web, mobile, wearable, conversational, and immersive devices. You can use Mendix Native Mobile Builder to create native iOS and Android apps using JavaScript and React Native. You can also use Mendix Web Modeler to create progressive web apps (PWAs) that work offline and on any device.

      -

      Unlimited extensibility

      -

      Mendix gives you the freedom to extend your apps with any functionality you need. You can use Mendix Studio Pro to write custom code in Java or JavaScript to add logic or integrations to your apps. You can also use the Mendix SDK to create custom widgets or modules using TypeScript or JavaScript.

      -

      Mendix also offers a rich ecosystem of third-party extensions that you can leverage to enhance your apps. You can use the Mendix App Store to browse and download hundreds of ready-made components, such as connectors, templates, widgets, themes, etc. You can also use the Mendix Marketplace to find and purchase solutions from certified partners.

      -

      Mendix Pricing and Plans

      -

      Mendix offers various pricing and plans to suit your needs and budget. Here is a summary of the main plans and their features:

      -
      SongAlbum/Film
      Aashiq Banaya AapneAashiq Banaya Aapne
      Tere NaamTere Naam
      Jhalak DikhlajaAksar
      Hookah BarKhiladi 786
      Teri Meri KahaniHappy Hardy and Heer
      Main Jahan RahoonNamastey London
      I Love You SayyoniAap Kaa Surroor
      Tum Hi Ho RemixThe Xposè
      Teri Meri Prem KahaniBodyguard
      Mann Ka RadioRadio
      - - - - - - - - - - - - - - - - - - - - - - - - -
      PlanFeaturesPrice
      Free- Up to 10 users
      - 1 GB app storage
      - 100 MB database storage
      - Community support
      - Public cloud deployment
      - Basic security features
      - Basic collaboration features
      - Basic app management features
      - Basic UI/UX features
      - Basic extensibility features
      $0/month
      Single App- Up to 100 users
      - 10 GB app storage
      - 1 GB database storage
      - Standard support
      - Public or private cloud deployment
      - Advanced security features
      - Advanced collaboration features
      - Advanced app management features
      - Advanced UI/UX features
      - Advanced extensibility features
      $1,875/month
      Pro- Unlimited users
      - Unlimited app storage
      - Unlimited database storage
      - Premium support
      - Any cloud or on-premise deployment
      - Enterprise security features
      - Enterprise collaboration features
      - Enterprise app management features
      - Enterprise UI/UX features
      - Enterprise extensibility features
      $5,375/month
      EnterpriseAll Pro features plus:
      - Dedicated account manager
      - Custom SLA
      - Custom training
      - Custom integrations
      - Custom solutions
      Contact sales for a quote
      -

      You can also try Mendix for free for 30 days with no credit card required. You can sign up for a free trial here.

      -

      Mendix Customer Reviews and Testimonials

      -

      Mendix has received positive feedback from its customers and industry analysts. Here are some of the reviews and testimonials that showcase the value and impact of Mendix:

      -
      -

      "Mendix is a game-changer for us. It enables us to deliver applications faster, cheaper, and better than before. We can now focus on solving business problems instead of technical challenges." - John Smith, CIO of ABC Inc.

      -
      -
      -

      "Mendix has helped us transform our digital strategy and accelerate our innovation. We have been able to build and launch new apps in weeks instead of months, and deliver exceptional user experiences across multiple channels." - Jane Doe, Director of Digital Transformation at XYZ Ltd.

      -
      -
      -

      "Mendix is the leader in the low-code development platforms market. It offers a comprehensive and integrated solution that supports the entire application lifecycle, from design to deployment and beyond. Mendix enables organizations to deliver high-quality applications faster and easier, while reducing costs and risks." - Gartner Magic Quadrant for Enterprise Low-Code Application Platforms, 2022

      -
      -

      Conclusion

      -

      Mendix is a powerful and versatile low-code application development platform that can help you build and deploy enterprise-grade applications faster and easier. Whether you need web, mobile, wearable, conversational, or immersive apps, Mendix can help you create them with minimal coding and maximum collaboration.

      -

      Mendix offers various benefits and features, such as enterprise security and integration, central application management, one-click deployment, modern cross-platform UI and UX, and unlimited extensibility. Mendix also offers various pricing and plans to suit your needs and budget. You can even try Mendix for free for 30 days with no credit card required.

      -

      If you are looking for a low-code platform that can accelerate your web and mobile app development, you should consider Mendix. Mendix has proven its value and impact for thousands of customers across various industries and use cases. You can join them by signing up for a free trial or contacting sales today.

      -

      FAQs

      -
        -
      • What is low-code?
        Low-code is a software development approach that enables you to create applications with minimal coding, using visual tools and drag-and-drop interfaces. Low-code platforms abstract away the complexity of coding and provide ready-made components, templates, widgets, integrations, etc. that you can use to build your apps faster and easier.
      • -
      • What is Mendix?
        Mendix is a leading low-code application development platform that enables you to build and continuously improve mobile and web applications at scale. The Mendix Platform is designed to accelerate enterprise app delivery across your entire application development lifecycle, from ideation to deployment and operations.
      • -
      • How does Mendix work?
        Mendix works by allowing you to design, develop, test, debug, deploy, monitor, and operate your apps using visual tools and minimal coding. You can use Mendix Studio and Mendix Studio Pro to create your app models using drag-and-drop interfaces. You can also use Mendix Assist to get AI-powered code suggestions and quality checks. You can then deploy your apps to any cloud or on-premise environment with a single click using Mendix Cloud or other deployment options.
      • -
      • Who uses Mendix?
        Mendix is used by thousands of customers across various industries and use cases, such as banking, insurance, manufacturing, healthcare, education, government, retail, etc. Some of the well-known customers include KLM, Zurich Insurance, Siemens, Philips, eXp Realty, etc.
      • -
      • How much does Mendix cost?
        Mendix offers various pricing and plans to suit your needs and budget. The main plans are Free (up to 10 users), Single App ($1,875/month), Pro ($5,375/month), and Enterprise (custom pricing). You can also try Mendix for free for 30 days with no credit card required.
      • -

      401be4b1e0
      -
      -
      \ No newline at end of file diff --git a/spaces/congsaPfin/Manga-OCR/logs/Traffic Rider Mod Apk Versi Terbaru Nikmati Berkendara Tanpa Batas dengan Uang Tak Terhingga.md b/spaces/congsaPfin/Manga-OCR/logs/Traffic Rider Mod Apk Versi Terbaru Nikmati Berkendara Tanpa Batas dengan Uang Tak Terhingga.md deleted file mode 100644 index eae8f646de7d1689d1d26a1a2d2b6af61fa83a40..0000000000000000000000000000000000000000 --- a/spaces/congsaPfin/Manga-OCR/logs/Traffic Rider Mod Apk Versi Terbaru Nikmati Berkendara Tanpa Batas dengan Uang Tak Terhingga.md +++ /dev/null @@ -1,92 +0,0 @@ - -

      Download Traffic Rider Mod Apk Versi Terbaru: A Guide for Android Users

      -

      If you are a fan of racing games, you might have heard of Traffic Rider, a popular game for android devices that lets you ride a motorcycle through traffic with a first-person view. But did you know that there is a modded version of this game that gives you unlimited money, all bikes unlocked, and no ads? In this article, we will tell you everything you need to know about Traffic Rider Mod Apk, how to download and install it, and why you should play it.

      -

      What is Traffic Rider Mod Apk?

      -

      Traffic Rider Mod Apk is a modified version of the original Traffic Rider game developed by Soner Kara. It is a racing game that simulates the experience of riding a motorcycle on various roads and highways. You can choose from over 30 different bikes, each with its own characteristics and sound effects. You can also customize your bike with different colors and wheels. The game has four modes: career, endless, time trial, and free ride. You can complete over 70 missions in career mode, or just enjoy the scenery in free ride mode. The game also has realistic graphics, sound effects, and weather conditions that make you feel like you are really on the road.

      -

      download traffic rider mod apk versi terbaru


      Download Filehttps://urlca.com/2uOc8J



      -

      Features of Traffic Rider Mod Apk

      -

      What makes Traffic Rider Mod Apk different from the original game is that it has some extra features that enhance your gameplay and make it more fun. Here are some of the features of Traffic Rider Mod Apk:

      -

      Unlimited money

      -

      With Traffic Rider Mod Apk, you don't have to worry about running out of money to buy new bikes or upgrade your existing ones. You can get unlimited money by completing missions or just by playing the game. You can use the money to buy any bike you want, or to upgrade your speed, handling, braking, and nitro.

      -

      All bikes unlocked

      -

      Another feature of Traffic Rider Mod Apk is that it unlocks all the bikes in the game. You don't have to wait until you reach a certain level or complete a certain mission to unlock a new bike. You can access all the bikes from the beginning of the game and choose the one that suits your style and preference.

      -

      No ads

      -

      One of the most annoying things about playing games on android devices is the ads that pop up every now and then. They interrupt your gameplay and sometimes even cause lag or crashes. With Traffic Rider Mod Apk, you don't have to deal with any ads at all. The game is completely ad-free and smooth.

      -

      brain test 2 tricky stories
      -brain test 2 walkthrough all levels
      -brain test 2 poki
      -brain test 2 answers
      -brain test 2 cheats
      -brain test 2 download
      -brain test 2 online
      -brain test 2 game
      -brain test 2 apk
      -brain test 2 mod
      -brain test 2 tom's adventure
      -brain test 2 agent smith
      -brain test 2 emily's farm
      -brain test 2 joe the hunter
      -brain test 2 tricky prison escape
      -brain test 2 monster hunter joe
      -brain test 2 tricky stories mod apk
      -brain test 2 tricky stories online
      -brain test 2 tricky stories answers
      -brain test 2 tricky stories cheats
      -brain test 2 tricky stories walkthrough
      -brain test 2 tricky stories download
      -brain test 2 tricky stories game
      -brain test 2 tricky stories poki
      -brain test 2 tricky stories apk
      -brain test 2 solutions
      -brain test 2 hints
      -brain test 2 levels
      -brain test 2 unblocked
      -brain test 2 free
      -brain test 2 app store
      -brain test 2 google play
      -brain test 2 review
      -brain test 2 reddit
      -brain test 2 youtube
      -brain test 2 update
      -brain test 2 new levels
      -brain test 2 ios
      -brain test 2 android
      -brain test 2 pc
      -brain test 2 mac
      -brain test 2 windows
      -brain test 2 linux
      -brain test 2 steam
      -brain test 2 facebook
      -brain test 2 instagram
      -brain test 2 twitter
      -brain test 2 tiktok
      -brain test 2 discord

      -

      How to download and install Traffic Rider Mod Apk?

      -

      If you are interested in downloading and installing Traffic Rider Mod Apk on your android device, you can follow these simple steps:

      -

      Step 1: Enable unknown sources

      -

      Since Traffic Rider Mod Apk is not available on the Google Play Store, you need to enable unknown sources on your device to install it. To do this, go to Settings > Security > Unknown Sources and toggle it on.

      -

      Step 2: Download the mod apk file

      -

      Next, you need to download the mod apk file from a reliable source. You can use one of these links to download it:

      - -

      Step 3: Install the mod apk file

      -

      After downloading the mod apk file, you need to install it on your device. To do this, locate the file in your file manager and tap on it. You will see a prompt asking you to confirm the installation. Tap on Install and wait for the process to finish.

      -

      Step 4: Launch the game and enjoy

      -

      Once the installation is done, you can launch the game from your app drawer or home screen. You will see a welcome screen with the Traffic Rider logo and a loading bar. After the game loads, you can start playing and enjoy the modded features.

      -

      Why should you play Traffic Rider Mod Apk?

      -

      Traffic Rider Mod Apk is not just a simple racing game. It is a game that offers you a lot of fun, excitement, and challenge. Here are some of the reasons why you should play Traffic Rider Mod Apk:

      -

      Realistic graphics and sound effects

      -

      Traffic Rider Mod Apk has stunning graphics that make you feel like you are riding a real bike on real roads. The game has detailed environments, dynamic shadows, realistic lighting, and smooth animations. The game also has amazing sound effects that match the engine sounds of different bikes and the ambient noises of traffic and weather.

      -

      First-person view and multiple camera angles

      -

      Traffic Rider Mod Apk gives you a first-person view of riding a bike, which makes the game more immersive and thrilling. You can see the handlebars, the speedometer, the mirrors, and the road ahead of you. You can also switch to different camera angles, such as third-person view, side view, or rear view, to get a different perspective of the game.

      -

      Various modes and missions

      -

      Traffic Rider Mod Apk has four modes that offer you different ways of playing the game. You can choose from career mode, endless mode, time trial mode, or free ride mode. In career mode, you can complete over 70 missions that test your skills and reward you with money and new bikes. In endless mode, you can ride as long as you can without crashing or running out of time. In time trial mode, you can race against the clock and try to beat your own records. In free ride mode, you can explore the map and enjoy the scenery without any pressure.

      -

      Leaderboards and achievements

      -

      Traffic Rider Mod Apk also has leaderboards and achievements that add more challenge and fun to the game. You can compete with other players around the world and see who is the best rider in each mode. You can also unlock over 30 achievements that show your progress and skills in the game.

      -

      Conclusion

      -

      Traffic Rider Mod Apk is a great game for android users who love racing games and motorcycles. It has realistic graphics, sound effects, and gameplay that make you feel like you are on the road. It also has modded features that give you unlimited money, all bikes unlocked, and no ads. You can download and install Traffic Rider Mod Apk easily by following our guide above. So what are you waiting for? Download Traffic Rider Mod Apk versi terbaru now and enjoy the ride!

      - FAQs Q: Is Traffic Rider Mod Apk safe to download and install? A: Yes, Traffic Rider Mod Apk is safe to download and install as long as you use a reliable source like the ones we provided above. The mod apk file does not contain any viruses or malware that can harm your device. Q: Do I need to root my device to use Traffic Rider Mod Apk? A: No, you do not need to root your device to use Traffic Rider Mod Apk. The mod apk file works on any android device without requiring root access. Q: Can I play Traffic Rider Mod Apk offline? A: Yes, you can play Traffic Rider Mod Apk offline without an internet connection. However, some features like leaderboards and achievements may not work properly offline. Q: Can I update Traffic Rider Mod Apk to the latest version? A: Yes, you can update Traffic Rider Mod Apk to the latest version by downloading and installing the new mod apk file from the same source you used before. However, you may lose your progress and data if you update without backing up your files. Q: How can I contact the developer of Traffic Rider Mod Apk? A: You can contact the developer of Traffic Rider Mod Apk by sending an email to sonerkara@gmail.com or visiting their website at https://skgames.com/. You can also follow them on Facebook, Twitter, and Instagram for the latest news and updates.

      197e85843d
      -
      -
      \ No newline at end of file diff --git a/spaces/congsaPfin/Manga-OCR/logs/World Soccer Champs APK 7.0 Para Hilesi le Futbolun Zirvesine kn!.md b/spaces/congsaPfin/Manga-OCR/logs/World Soccer Champs APK 7.0 Para Hilesi le Futbolun Zirvesine kn!.md deleted file mode 100644 index d89a3798ffe04e1706ce084b270b4dc497adca12..0000000000000000000000000000000000000000 --- a/spaces/congsaPfin/Manga-OCR/logs/World Soccer Champs APK 7.0 Para Hilesi le Futbolun Zirvesine kn!.md +++ /dev/null @@ -1,123 +0,0 @@ -
      -

      World Soccer Champs APK 7.0 Para Hilesi: How to Download and Play with Unlimited Money

      | The main title of the article | |

      Introduction

      If you

      If you are a fan of soccer games, you might have heard of World Soccer Champs, a popular mobile game that lets you manage your team and compete in various soccer leagues and cups. But did you know that there is a modded version of this game that gives you unlimited money to spend on your team? It's called World Soccer Champs APK 7.0 Para Hilesi, and it's a Turkish phrase that means "world soccer champs apk 7.0 money cheat". In this article, I will show you how to download and play World Soccer Champs APK 7.0 Para Hilesi, and what are some of the benefits and features of this modded version. I will also give you some tips and tricks on how to play the game and win trophies and achievements. So, if you are ready to become the ultimate soccer manager, read on!

      -

      world soccer champs apk 7.0 para hilesi


      Download ✦✦✦ https://urlca.com/2uO6te



      -

      What is World Soccer Champs?

      -

      World Soccer Champs is a mobile game developed by Monkey I-Brow Studios, a UK-based indie game studio. It is available for both Android and iOS devices, and it has over 10 million downloads on Google Play Store. The game is inspired by classic soccer games like Sensible Soccer and Kick Off, and it features simple but addictive gameplay, intuitive swipe controls, realistic physics, and stunning graphics. The game also has a lot of content and variety, as you can choose from over 100 national teams and 360 clubs from around the world, and compete in different leagues and cups, such as the World Cup, the Champions League, the Premier League, the Bundesliga, the La Liga, and more. You can also customize your team's kits, logos, names, and formations, as well as train your players, buy new players, and sell unwanted players. The game is free to play, but it also has in-app purchases that allow you to buy coins and gems, which are the currencies of the game. You can use coins and gems to buy new players, upgrade your players' skills, unlock new kits, etc.

      -

      What is World Soccer Champs APK 7.0 Para Hilesi?

      -

      World Soccer Champs APK 7.0 Para Hilesi is a modded version of World Soccer Champs that gives you unlimited money to spend on your team. It is not an official version of the game, but rather a modified version that has been created by some fans or hackers who have altered the original game files. The modded version has the same gameplay and features as the original version, except that you don't have to worry about running out of coins or gems. You can buy any player you want, upgrade your players' skills to the max, unlock all the kits and logos, etc. You can also enjoy all the leagues and cups without any restrictions or ads. The modded version is only available for Android devices, and it requires you to download an APK file from a third-party website and install it on your device manually.

      -

      Why would you want to play World Soccer Champs APK 7.0 Para Hilesi?

      -

      There are many reasons why you might want to play World Soccer Champs APK 7.0 Para Hilesi instead of the original version. Here are some of them:

      -

      world soccer champs mod apk 7.0 unlimited money
      -world soccer champs 7.0 apk download for android
      -world soccer champs hack apk 7.0 free coins
      -world soccer champs latest version 7.0 mod menu
      -world soccer champs 7.0 para hilesi indir
      -world soccer champs apk 7.0 full unlocked
      -world soccer champs cheats apk 7.0 no root
      -world soccer champs premium apk 7.0 offline
      -world soccer champs 7.0 apk mod money and gems
      -world soccer champs apk 7.0 android oyun club
      -world soccer champs 7.0 para hilesi nasıl yapılır
      -world soccer champs pro apk 7.0 all teams
      -world soccer champs 7.0 mod apk unlimited everything
      -world soccer champs apk 7.0 online multiplayer
      -world soccer champs hack 7.0 para hilesi apk
      -world soccer champs apk 7.0 real football clubs
      -world soccer champs modded apk 7.0 no ads
      -world soccer champs 7.0 para hilesi yapma
      -world soccer champs apk 7.0 best players
      -world soccer champs 7.0 mod apk revdl
      -world soccer champs apk 7.0 realistic gameplay
      -world soccer champs cracked apk 7.0 vip
      -world soccer champs 7.0 para hilesi android
      -world soccer champs apk 7.0 easy controls
      -world soccer champs mod apk 7.0 rexdl
      -world soccer champs apk 7.0 high graphics
      -world soccer champs hacked apk 7.0 unlimited gold
      -world soccer champs 7.0 para hilesi hileli indir
      -world soccer champs apk 7.0 new features
      -world soccer champs mod apk 7.0 apkpure
      -world soccer champs apk 7.0 low mb size
      -world soccer champs hack tool 7.0 para hilesi
      -world soccer champs apk 7.0 custom kits
      -world soccer champs modded apk 7.0 all unlocked
      -world soccer champs 7.0 para hilesi güncel sürüm
      -world soccer champs apk 7.0 fun gameplay modes
      -world soccer champs mod apk 7.0 happymod
      -world soccer champs apk 7.0 awesome sound effects
      -world soccer champs cheat engine 7.0 para hilesi
      -world soccer champs apk 7.0 smooth performance
      -world soccer champs modded apk 7.0 unlimited energy
      -world soccer champs 7.0 para hilesi kolay yolu
      -world soccer champs apk 7.0 amazing animations
      -world soccer champs modded apk 7.0 all leagues
      -world soccer champs hack version 7.0 para hilesi indirme linki[^1^]

      -
        -
      • You can have unlimited money to spend on your team. This means you can buy any player you want, upgrade your players' skills to the max, unlock all the kits and logos, etc. You can also experiment with different formations and strategies without worrying about losing money.
      • -
      • You can enjoy all the leagues and cups without any restrictions or ads. You can participate in any competition you want, from local clubs to national teams, from regional tournaments to global championships. You can also play offline without any internet connection.
      • -
      • You can have more fun and challenge yourself with different difficulty levels. You can choose from easy, normal, hard, or expert modes depending on your skill level and preference. You can also adjust the match length from 2 minutes to 10 minutes per half.
      • -
      • You can support the developers of the original game by buying their in-app purchases if you want to. Even though you have unlimited money in the modded version, you can still buy coins and gems from the original version if you want to show your appreciation for their work.
      • -

      How to download and install World Soccer Champs APK 7.0 Para Hilesi?

      -

      Now that you know what World Soccer Champs APK 7.0 Para Hilesi is and why you might want to play it, you might be wondering how to get it on your device. Well, it's not very hard, but you need to follow some steps carefully. Here is a step-by-step guide on how to download and install World Soccer Champs APK 7.0 Para Hilesi on your Android device:

      -

      Step 1: Enable unknown sources on your device

      -

      Before you can install World Soccer Champs APK 7.0 Para Hilesi, you need to enable unknown sources on your device. This will allow you to install apps from sources other than the Google Play Store. To do this, go to your device's settings, then security, then unknown sources, and toggle it on. You might see a warning message, but don't worry, it's safe to proceed.

      -

      Screenshot of enabling unknown sources

      -

      Step 2: Download World Soccer Champs APK 7.0 Para Hilesi from a reliable source

      -

      Next, you need to download World Soccer Champs APK 7.0 Para Hilesi from a reliable source. There are many websites that offer modded versions of games, but not all of them are trustworthy. Some of them might contain viruses, malware, or spyware that can harm your device or steal your personal information. Therefore, you need to be careful and choose a reputable website that has positive reviews and ratings from other users. One such website is APKMODY, which is a popular and trusted source for modded games and apps. You can download World Soccer Champs APK 7.0 Para Hilesi from this website by clicking on the download button and choosing the latest version.

      -

      Screenshot of downloading World Soccer Champs APK 7.0 Para Hilesi from APKMODY

      -

      Step 3: Install World Soccer Champs APK 7.0 Para Hilesi on your device

      -

      After you have downloaded World Soccer Champs APK 7.0 Para Hilesi, you need to install it on your device. To do this, go to your device's file manager and locate the downloaded file. It should be in the downloads folder or wherever you saved it. Tap on the file and follow the instructions on the screen to install it. You might see a pop-up message asking for permissions, just allow them and continue.

      -

      Screenshot of installing World Soccer Champs APK 7.0 Para Hilesi on your device

      -

      Step 4: Launch World Soccer Champs APK 7.0 Para Hilesi and enjoy unlimited money

      -

      Congratulations! You have successfully installed World Soccer Champs APK 7.0 Para Hilesi on your device. Now you can launch the game and enjoy unlimited money to spend on your team. You will see that you have a lot of coins and gems in your account, and you can use them to buy any player you want, upgrade your players' skills, unlock all the kits and logos, etc. You can also play any league or cup without any restrictions or ads.

      -

      Screenshot of launching World Soccer Champs APK 7.0 Para Hilesi and enjoying unlimited money

      How to play World Soccer Champs APK 7.0 Para Hilesi?

      -

      Now that you have downloaded and installed World Soccer Champs APK 7.0 Para Hilesi, you might be wondering how to play it and what are some of the tips and tricks to improve your performance. Well, don't worry, I will give you a brief overview of how to play the game and some useful advice to help you become a better soccer manager. Here are some of the things you need to know:

      -

      How to manage your team?

      -

      One of the most important aspects of World Soccer Champs APK 7.0 Para Hilesi is managing your team. You need to select your team, train your players, buy new players, change your kits, etc. Here are some of the steps you need to follow:

      -
        -
      • Select your team: You can choose from over 100 national teams and 360 clubs from around the world. You can also create your own custom team by editing the name, logo, kit, etc. You can also change your team anytime you want by going to the settings menu.
      • -
      • Train your players: You can train your players to improve their skills and attributes, such as speed, stamina, shooting, passing, dribbling, etc. You can use coins or gems to upgrade your players' skills, or you can use training cards that you can earn by playing matches or completing achievements. You can also assign different roles to your players, such as captain, free kick taker, penalty taker, etc.
      • -
      • Buy new players: You can buy new players to strengthen your team and replace unwanted players. You can use coins or gems to buy new players, or you can use scout cards that you can earn by playing matches or completing achievements. You can also use the transfer market to bid for other players or sell your own players.
      • -
      • Change your kits: You can change your team's kits to suit your style and preference. You can use coins or gems to unlock new kits, or you can use kit cards that you can earn by playing matches or completing achievements. You can also customize your kits by changing the colors, patterns, sponsors, etc.
      • -
      -

      How to compete in leagues and cups?

      -

      Another important aspect of World Soccer Champs APK 7.0 Para Hilesi is competing in various soccer leagues and cups. You can participate in different competitions from around the world, including local clubs and national teams. Here are some of the steps you need to follow:

      -
        -
      • Choose a competition: You can choose from different competitions depending on your team's level and reputation. You can start with lower-tier competitions and work your way up to higher-tier competitions as you progress in the game. Some of the competitions you can join are the World Cup, the Champions League, the Premier League, the Bundesliga, the La Liga, and more.
      • -
      • Play matches: You can play matches against other teams in your competition by tapping on the match icon on the screen. You can also simulate matches if you don't want to play them yourself. You will earn coins and gems for winning matches, as well as trophies and achievements for completing certain objectives.
      • -
      • Win trophies: You can win trophies by finishing at the top of your league table or by winning the final of your cup tournament. You will also earn coins and gems for winning trophies, as well as trophies and achievements for completing certain objectives.
      • -
      -

      How to use swipe controls?

      -

      One of the most fun aspects of World Soccer Champs APK 7.0 Para Hilesi is using swipe controls to control your players on the pitch. You can use intuitive swipe controls to pass, dribble, shoot, etc. Here are some of the steps you need to follow:

      -
        -
      • Pass: To pass the ball to another player, swipe on the screen in the direction of the player you want to pass to. The longer you swipe, the harder the pass will be.
      • -
      • Dribble: To dribble with the ball, swipe on the screen in the direction you want to move. The longer you swipe, the faster you will move.
      • -
      • Shoot: To shoot at the goal, swipe on the screen in the direction of the goal. The longer you swipe, the harder the shot will be. You can also swipe in a curve to bend the ball.
      • -
      • Tackle: To tackle an opponent with the ball, swipe on the screen in the direction of the opponent. The longer you swipe, the harder the tackle will be.
      • -
      • Switch: To switch between different players on your team, tap on the screen.
      • -
      -

      How to earn trophies and achievements?

      -

      One

      One of the most rewarding aspects of World Soccer Champs APK 7.0 Para Hilesi is earning trophies and achievements. You can earn trophies and achievements by scoring goals, winning matches, completing objectives, etc. Here are some of the steps you need to follow:

      -
        -
      • Score goals: You can score goals by using swipe controls to shoot at the goal. You can also score goals by using free kicks, penalties, headers, volleys, etc. You will earn coins and gems for scoring goals, as well as trophies and achievements for scoring certain types of goals or scoring a certain number of goals.
      • -
      • Win matches: You can win matches by scoring more goals than your opponent. You can also win matches by using tactics, formations, substitutions, etc. You will earn coins and gems for winning matches, as well as trophies and achievements for winning certain types of matches or winning a certain number of matches.
      • -
      • Complete objectives: You can complete objectives by fulfilling certain criteria or tasks in the game. For example, you can complete objectives by winning a specific competition, buying a specific player, scoring a specific goal, etc. You will earn coins and gems for completing objectives, as well as trophies and achievements for completing certain types of objectives or completing a certain number of objectives.
      • -
      -

      Conclusion

      -

      In conclusion, World Soccer Champs APK 7.0 Para Hilesi is a modded version of World Soccer Champs that gives you unlimited money to spend on your team. It is a fun and addictive soccer game that lets you manage your team and compete in various soccer leagues and cups. It also has simple but intuitive swipe controls, realistic physics, and stunning graphics. You can download and install World Soccer Champs APK 7.0 Para Hilesi on your Android device by following the steps in this article. You can also play World Soccer Champs APK 7.0 Para Hilesi by following the tips and tricks in this article. You can also earn trophies and achievements by scoring goals, winning matches, and completing objectives. If you are a fan of soccer games, you should definitely give World Soccer Champs APK 7.0 Para Hilesi a try!

      -

      FAQs

      -

      Here are some of the frequently asked questions and answers about World Soccer Champs APK 7.0 Para Hilesi:

      -
        -
      1. Is World Soccer Champs APK 7.0 Para Hilesi safe to download and install?
      2. -

        Yes, World Soccer Champs APK 7.0 Para Hilesi is safe to download and install if you use a reliable source like APKMODY. However, you should always be careful when downloading and installing apps from unknown sources, as they might contain viruses or malware that can harm your device or steal your personal information.

        -
      3. Is World Soccer Champs APK 7.0 Para Hilesi legal to use?
      4. -

        No, World Soccer Champs APK 7.0 Para Hilesi is not legal to use, as it is a modded version of World Soccer Champs that violates the terms and conditions of the original game. Using World Soccer Champs APK 7.0 Para Hilesi might result in your account being banned or suspended by the developers of the original game.

        -
      5. Can I play World Soccer Champs APK 7.0 Para Hilesi online with other players?
      6. -

        No, World Soccer Champs APK 7.0 Para Hilesi does not support online multiplayer mode, as it is a modded version of World Soccer Champs that does not connect to the official servers of the original game. You can only play World Soccer Champs APK 7.0 Para Hilesi offline with AI opponents.

        -
      7. Can I update World Soccer Champs APK 7.0 Para Hilesi to the latest version?
      8. -

        No, World Soccer Champs APK 7.0 Para Hilesi does not support automatic updates, as it is a modded version of World Soccer Champs that does not receive updates from the developers of the original game. You will have to download and install the latest version of World Soccer Champs APK 7.0 Para Hilesi manually from a reliable source like APKMODY.

        -
      9. Can I transfer my progress from World Soccer Champs to World Soccer Champs APK 7.0 Para Hilesi or vice versa?
      10. -

        No, you cannot transfer your progress from World Soccer Champs to World Soccer Champs APK 7.0 Para Hilesi or vice versa, as they are different versions of the same game that have different data files and settings. You will have to start from scratch if you switch between them.

        -

      401be4b1e0
      -
      -
      \ No newline at end of file diff --git a/spaces/contluForse/HuggingGPT/assets/Dispara Que Ya Estoy Muerto Epub Reader ((NEW)).md b/spaces/contluForse/HuggingGPT/assets/Dispara Que Ya Estoy Muerto Epub Reader ((NEW)).md deleted file mode 100644 index 9c26f3f786a3baeb35e59aa42a07309e549adb9d..0000000000000000000000000000000000000000 --- a/spaces/contluForse/HuggingGPT/assets/Dispara Que Ya Estoy Muerto Epub Reader ((NEW)).md +++ /dev/null @@ -1,6 +0,0 @@ -

      dispara que ya estoy muerto epub reader


      DOWNLOADhttps://ssurll.com/2uzy4v



      - - aaccfb2cb3
      -
      -
      -

      diff --git a/spaces/coreml-community/ControlNet-v1-1-Annotators-cpu/annotator/mmpkg/mmcv/utils/registry.py b/spaces/coreml-community/ControlNet-v1-1-Annotators-cpu/annotator/mmpkg/mmcv/utils/registry.py deleted file mode 100644 index fa9df39bc9f3d8d568361e7250ab35468f2b74e0..0000000000000000000000000000000000000000 --- a/spaces/coreml-community/ControlNet-v1-1-Annotators-cpu/annotator/mmpkg/mmcv/utils/registry.py +++ /dev/null @@ -1,315 +0,0 @@ -# Copyright (c) OpenMMLab. All rights reserved. -import inspect -import warnings -from functools import partial - -from .misc import is_seq_of - - -def build_from_cfg(cfg, registry, default_args=None): - """Build a module from config dict. - - Args: - cfg (dict): Config dict. It should at least contain the key "type". - registry (:obj:`Registry`): The registry to search the type from. - default_args (dict, optional): Default initialization arguments. - - Returns: - object: The constructed object. - """ - if not isinstance(cfg, dict): - raise TypeError(f'cfg must be a dict, but got {type(cfg)}') - if 'type' not in cfg: - if default_args is None or 'type' not in default_args: - raise KeyError( - '`cfg` or `default_args` must contain the key "type", ' - f'but got {cfg}\n{default_args}') - if not isinstance(registry, Registry): - raise TypeError('registry must be an mmcv.Registry object, ' - f'but got {type(registry)}') - if not (isinstance(default_args, dict) or default_args is None): - raise TypeError('default_args must be a dict or None, ' - f'but got {type(default_args)}') - - args = cfg.copy() - - if default_args is not None: - for name, value in default_args.items(): - args.setdefault(name, value) - - obj_type = args.pop('type') - if isinstance(obj_type, str): - obj_cls = registry.get(obj_type) - if obj_cls is None: - raise KeyError( - f'{obj_type} is not in the {registry.name} registry') - elif inspect.isclass(obj_type): - obj_cls = obj_type - else: - raise TypeError( - f'type must be a str or valid type, but got {type(obj_type)}') - try: - return obj_cls(**args) - except Exception as e: - # Normal TypeError does not print class name. - raise type(e)(f'{obj_cls.__name__}: {e}') - - -class Registry: - """A registry to map strings to classes. - - Registered object could be built from registry. - Example: - >>> MODELS = Registry('models') - >>> @MODELS.register_module() - >>> class ResNet: - >>> pass - >>> resnet = MODELS.build(dict(type='ResNet')) - - Please refer to - https://mmcv.readthedocs.io/en/latest/understand_mmcv/registry.html for - advanced usage. - - Args: - name (str): Registry name. - build_func(func, optional): Build function to construct instance from - Registry, func:`build_from_cfg` is used if neither ``parent`` or - ``build_func`` is specified. If ``parent`` is specified and - ``build_func`` is not given, ``build_func`` will be inherited - from ``parent``. Default: None. - parent (Registry, optional): Parent registry. The class registered in - children registry could be built from parent. Default: None. - scope (str, optional): The scope of registry. It is the key to search - for children registry. If not specified, scope will be the name of - the package where class is defined, e.g. mmdet, mmcls, mmseg. - Default: None. - """ - - def __init__(self, name, build_func=None, parent=None, scope=None): - self._name = name - self._module_dict = dict() - self._children = dict() - self._scope = self.infer_scope() if scope is None else scope - - # self.build_func will be set with the following priority: - # 1. build_func - # 2. parent.build_func - # 3. build_from_cfg - if build_func is None: - if parent is not None: - self.build_func = parent.build_func - else: - self.build_func = build_from_cfg - else: - self.build_func = build_func - if parent is not None: - assert isinstance(parent, Registry) - parent._add_children(self) - self.parent = parent - else: - self.parent = None - - def __len__(self): - return len(self._module_dict) - - def __contains__(self, key): - return self.get(key) is not None - - def __repr__(self): - format_str = self.__class__.__name__ + \ - f'(name={self._name}, ' \ - f'items={self._module_dict})' - return format_str - - @staticmethod - def infer_scope(): - """Infer the scope of registry. - - The name of the package where registry is defined will be returned. - - Example: - # in mmdet/models/backbone/resnet.py - >>> MODELS = Registry('models') - >>> @MODELS.register_module() - >>> class ResNet: - >>> pass - The scope of ``ResNet`` will be ``mmdet``. - - - Returns: - scope (str): The inferred scope name. - """ - # inspect.stack() trace where this function is called, the index-2 - # indicates the frame where `infer_scope()` is called - filename = inspect.getmodule(inspect.stack()[2][0]).__name__ - split_filename = filename.split('.') - return split_filename[0] - - @staticmethod - def split_scope_key(key): - """Split scope and key. - - The first scope will be split from key. - - Examples: - >>> Registry.split_scope_key('mmdet.ResNet') - 'mmdet', 'ResNet' - >>> Registry.split_scope_key('ResNet') - None, 'ResNet' - - Return: - scope (str, None): The first scope. - key (str): The remaining key. - """ - split_index = key.find('.') - if split_index != -1: - return key[:split_index], key[split_index + 1:] - else: - return None, key - - @property - def name(self): - return self._name - - @property - def scope(self): - return self._scope - - @property - def module_dict(self): - return self._module_dict - - @property - def children(self): - return self._children - - def get(self, key): - """Get the registry record. - - Args: - key (str): The class name in string format. - - Returns: - class: The corresponding class. - """ - scope, real_key = self.split_scope_key(key) - if scope is None or scope == self._scope: - # get from self - if real_key in self._module_dict: - return self._module_dict[real_key] - else: - # get from self._children - if scope in self._children: - return self._children[scope].get(real_key) - else: - # goto root - parent = self.parent - while parent.parent is not None: - parent = parent.parent - return parent.get(key) - - def build(self, *args, **kwargs): - return self.build_func(*args, **kwargs, registry=self) - - def _add_children(self, registry): - """Add children for a registry. - - The ``registry`` will be added as children based on its scope. - The parent registry could build objects from children registry. - - Example: - >>> models = Registry('models') - >>> mmdet_models = Registry('models', parent=models) - >>> @mmdet_models.register_module() - >>> class ResNet: - >>> pass - >>> resnet = models.build(dict(type='mmdet.ResNet')) - """ - - assert isinstance(registry, Registry) - assert registry.scope is not None - assert registry.scope not in self.children, \ - f'scope {registry.scope} exists in {self.name} registry' - self.children[registry.scope] = registry - - def _register_module(self, module_class, module_name=None, force=False): - if not inspect.isclass(module_class): - raise TypeError('module must be a class, ' - f'but got {type(module_class)}') - - if module_name is None: - module_name = module_class.__name__ - if isinstance(module_name, str): - module_name = [module_name] - for name in module_name: - if not force and name in self._module_dict: - raise KeyError(f'{name} is already registered ' - f'in {self.name}') - self._module_dict[name] = module_class - - def deprecated_register_module(self, cls=None, force=False): - warnings.warn( - 'The old API of register_module(module, force=False) ' - 'is deprecated and will be removed, please use the new API ' - 'register_module(name=None, force=False, module=None) instead.') - if cls is None: - return partial(self.deprecated_register_module, force=force) - self._register_module(cls, force=force) - return cls - - def register_module(self, name=None, force=False, module=None): - """Register a module. - - A record will be added to `self._module_dict`, whose key is the class - name or the specified name, and value is the class itself. - It can be used as a decorator or a normal function. - - Example: - >>> backbones = Registry('backbone') - >>> @backbones.register_module() - >>> class ResNet: - >>> pass - - >>> backbones = Registry('backbone') - >>> @backbones.register_module(name='mnet') - >>> class MobileNet: - >>> pass - - >>> backbones = Registry('backbone') - >>> class ResNet: - >>> pass - >>> backbones.register_module(ResNet) - - Args: - name (str | None): The module name to be registered. If not - specified, the class name will be used. - force (bool, optional): Whether to override an existing class with - the same name. Default: False. - module (type): Module class to be registered. - """ - if not isinstance(force, bool): - raise TypeError(f'force must be a boolean, but got {type(force)}') - # NOTE: This is a walkaround to be compatible with the old api, - # while it may introduce unexpected bugs. - if isinstance(name, type): - return self.deprecated_register_module(name, force=force) - - # raise the error ahead of time - if not (name is None or isinstance(name, str) or is_seq_of(name, str)): - raise TypeError( - 'name must be either of None, an instance of str or a sequence' - f' of str, but got {type(name)}') - - # use it as a normal method: x.register_module(module=SomeClass) - if module is not None: - self._register_module( - module_class=module, module_name=name, force=force) - return module - - # use it as a decorator: @x.register_module() - def _register(cls): - self._register_module( - module_class=cls, module_name=name, force=force) - return cls - - return _register diff --git a/spaces/coreml-community/ControlNet-v1-1-Annotators-cpu/annotator/mmpkg/mmseg/ops/encoding.py b/spaces/coreml-community/ControlNet-v1-1-Annotators-cpu/annotator/mmpkg/mmseg/ops/encoding.py deleted file mode 100644 index 7eb3629a6426550b8e4c537ee1ff4341893e489e..0000000000000000000000000000000000000000 --- a/spaces/coreml-community/ControlNet-v1-1-Annotators-cpu/annotator/mmpkg/mmseg/ops/encoding.py +++ /dev/null @@ -1,74 +0,0 @@ -import torch -from torch import nn -from torch.nn import functional as F - - -class Encoding(nn.Module): - """Encoding Layer: a learnable residual encoder. - - Input is of shape (batch_size, channels, height, width). - Output is of shape (batch_size, num_codes, channels). - - Args: - channels: dimension of the features or feature channels - num_codes: number of code words - """ - - def __init__(self, channels, num_codes): - super(Encoding, self).__init__() - # init codewords and smoothing factor - self.channels, self.num_codes = channels, num_codes - std = 1. / ((num_codes * channels)**0.5) - # [num_codes, channels] - self.codewords = nn.Parameter( - torch.empty(num_codes, channels, - dtype=torch.float).uniform_(-std, std), - requires_grad=True) - # [num_codes] - self.scale = nn.Parameter( - torch.empty(num_codes, dtype=torch.float).uniform_(-1, 0), - requires_grad=True) - - @staticmethod - def scaled_l2(x, codewords, scale): - num_codes, channels = codewords.size() - batch_size = x.size(0) - reshaped_scale = scale.view((1, 1, num_codes)) - expanded_x = x.unsqueeze(2).expand( - (batch_size, x.size(1), num_codes, channels)) - reshaped_codewords = codewords.view((1, 1, num_codes, channels)) - - scaled_l2_norm = reshaped_scale * ( - expanded_x - reshaped_codewords).pow(2).sum(dim=3) - return scaled_l2_norm - - @staticmethod - def aggregate(assignment_weights, x, codewords): - num_codes, channels = codewords.size() - reshaped_codewords = codewords.view((1, 1, num_codes, channels)) - batch_size = x.size(0) - - expanded_x = x.unsqueeze(2).expand( - (batch_size, x.size(1), num_codes, channels)) - encoded_feat = (assignment_weights.unsqueeze(3) * - (expanded_x - reshaped_codewords)).sum(dim=1) - return encoded_feat - - def forward(self, x): - assert x.dim() == 4 and x.size(1) == self.channels - # [batch_size, channels, height, width] - batch_size = x.size(0) - # [batch_size, height x width, channels] - x = x.view(batch_size, self.channels, -1).transpose(1, 2).contiguous() - # assignment_weights: [batch_size, channels, num_codes] - assignment_weights = F.softmax( - self.scaled_l2(x, self.codewords, self.scale), dim=2) - # aggregate - encoded_feat = self.aggregate(assignment_weights, x, self.codewords) - return encoded_feat - - def __repr__(self): - repr_str = self.__class__.__name__ - repr_str += f'(Nx{self.channels}xHxW =>Nx{self.num_codes}' \ - f'x{self.channels})' - return repr_str diff --git a/spaces/coreml-community/ControlNet-v1-1-Annotators-cpu/annotator/oneformer/detectron2/export/__init__.py b/spaces/coreml-community/ControlNet-v1-1-Annotators-cpu/annotator/oneformer/detectron2/export/__init__.py deleted file mode 100644 index 5a58758f64aae6071fa688be4400622ce6036efa..0000000000000000000000000000000000000000 --- a/spaces/coreml-community/ControlNet-v1-1-Annotators-cpu/annotator/oneformer/detectron2/export/__init__.py +++ /dev/null @@ -1,30 +0,0 @@ -# -*- coding: utf-8 -*- - -import warnings - -from .flatten import TracingAdapter -from .torchscript import dump_torchscript_IR, scripting_with_instances - -try: - from caffe2.proto import caffe2_pb2 as _tmp - from caffe2.python import core - - # caffe2 is optional -except ImportError: - pass -else: - from .api import * - - -# TODO: Update ONNX Opset version and run tests when a newer PyTorch is supported -STABLE_ONNX_OPSET_VERSION = 11 - - -def add_export_config(cfg): - warnings.warn( - "add_export_config has been deprecated and behaves as no-op function.", DeprecationWarning - ) - return cfg - - -__all__ = [k for k in globals().keys() if not k.startswith("_")] diff --git a/spaces/crylake/img2poem/query2labels/main_mlc.py b/spaces/crylake/img2poem/query2labels/main_mlc.py deleted file mode 100644 index e32a24c2d4f6a102cabf41986d9444fe31039534..0000000000000000000000000000000000000000 --- a/spaces/crylake/img2poem/query2labels/main_mlc.py +++ /dev/null @@ -1,736 +0,0 @@ -import argparse -import math -import os, sys -import random -import datetime -import time -from typing import List -import json -import numpy as np -from copy import deepcopy - -import torch -import torch.nn as nn -import torch.nn.parallel -from torch.optim import lr_scheduler -import torch.backends.cudnn as cudnn -import torch.distributed as dist -import torch.optim -import torch.multiprocessing as mp -import torch.utils.data -import torch.utils.data.distributed - -from torch.utils.tensorboard import SummaryWriter - -import _init_paths -from dataset.get_dataset import get_datasets - -from utils.logger import setup_logger -import models -import models.aslloss -from models.query2label import build_q2l -from utils.metric import voc_mAP -from utils.misc import clean_state_dict -from utils.slconfig import get_raw_dict - - -def parser_args(): - parser = argparse.ArgumentParser(description='Query2Label MSCOCO Training') - parser.add_argument('--dataname', help='dataname', default='coco14', choices=['coco14']) - parser.add_argument('--dataset_dir', help='dir of dataset', default='/comp_robot/liushilong/data/COCO14/') - parser.add_argument('--img_size', default=448, type=int, - help='size of input images') - - parser.add_argument('--output', metavar='DIR', - help='path to output folder') - parser.add_argument('--num_class', default=76, type=int, - help="Number of query slots") - parser.add_argument('--pretrained', dest='pretrained', action='store_true', - help='use pre-trained model. default is False. ') - parser.add_argument('--optim', default='AdamW', type=str, choices=['AdamW', 'Adam_twd'], - help='which optim to use') - - # loss - parser.add_argument('--eps', default=1e-5, type=float, - help='eps for focal loss (default: 1e-5)') - parser.add_argument('--dtgfl', action='store_true', default=False, - help='disable_torch_grad_focal_loss in asl') - parser.add_argument('--gamma_pos', default=0, type=float, - metavar='gamma_pos', help='gamma pos for simplified asl loss') - parser.add_argument('--gamma_neg', default=2, type=float, - metavar='gamma_neg', help='gamma neg for simplified asl loss') - parser.add_argument('--loss_dev', default=-1, type=float, - help='scale factor for loss') - - parser.add_argument('-j', '--workers', default=32, type=int, metavar='N', - help='number of data loading workers (default: 32)') - parser.add_argument('--epochs', default=80, type=int, metavar='N', - help='number of total epochs to run') - - parser.add_argument('--val_interval', default=1, type=int, metavar='N', - help='interval of validation') - - parser.add_argument('--start-epoch', default=0, type=int, metavar='N', - help='manual epoch number (useful on restarts)') - parser.add_argument('-b', '--batch-size', default=256, type=int, - metavar='N', - help='mini-batch size (default: 256), this is the total ' - 'batch size of all GPUs') - - parser.add_argument('--lr', '--learning-rate', default=0.1, type=float, - metavar='LR', help='initial learning rate', dest='lr') - parser.add_argument('--wd', '--weight-decay', default=1e-2, type=float, - metavar='W', help='weight decay (default: 1e-2)', - dest='weight_decay') - - parser.add_argument('-p', '--print-freq', default=10, type=int, - metavar='N', help='print frequency (default: 10)') - parser.add_argument('--resume', default='', type=str, metavar='PATH', - help='path to latest checkpoint (default: none)') - parser.add_argument('--resume_omit', default=[], type=str, nargs='*') - parser.add_argument('-e', '--evaluate', dest='evaluate', action='store_true', - help='evaluate model on validation set') - - parser.add_argument('--ema-decay', default=0.9997, type=float, metavar='M', - help='decay of model ema') - parser.add_argument('--ema-epoch', default=0, type=int, metavar='M', - help='start ema epoch') - - - # distribution training - parser.add_argument('--world-size', default=-1, type=int, - help='number of nodes for distributed training') - parser.add_argument('--rank', default=-1, type=int, - help='node rank for distributed training') - parser.add_argument('--dist-url', default='env://', type=str, - help='url used to set up distributed training') - parser.add_argument('--seed', default=None, type=int, - help='seed for initializing training. ') - parser.add_argument("--local_rank", type=int, help='local rank for DistributedDataParallel') - - - # data aug - parser.add_argument('--cutout', action='store_true', default=False, - help='apply cutout') - parser.add_argument('--n_holes', type=int, default=1, - help='number of holes to cut out from image') - parser.add_argument('--length', type=int, default=-1, - help='length of the holes. suggest to use default setting -1.') - parser.add_argument('--cut_fact', type=float, default=0.5, - help='mutual exclusion with length. ') - - parser.add_argument('--orid_norm', action='store_true', default=False, - help='using mean [0,0,0] and std [1,1,1] to normalize input images') - - - # * Transformer - parser.add_argument('--enc_layers', default=1, type=int, - help="Number of encoding layers in the transformer") - parser.add_argument('--dec_layers', default=2, type=int, - help="Number of decoding layers in the transformer") - parser.add_argument('--dim_feedforward', default=8192, type=int, - help="Intermediate size of the feedforward layers in the transformer blocks") - parser.add_argument('--hidden_dim', default=2048, type=int, - help="Size of the embeddings (dimension of the transformer)") - parser.add_argument('--dropout', default=0.1, type=float, - help="Dropout applied in the transformer") - parser.add_argument('--nheads', default=4, type=int, - help="Number of attention heads inside the transformer's attentions") - parser.add_argument('--pre_norm', action='store_true') - parser.add_argument('--position_embedding', default='sine', type=str, choices=('sine'), - help="Type of positional embedding to use on top of the image features") - parser.add_argument('--backbone', default='resnet101', type=str, - help="Name of the convolutional backbone to use") - parser.add_argument('--keep_other_self_attn_dec', action='store_true', - help='keep the other self attention modules in transformer decoders, which will be removed default.') - parser.add_argument('--keep_first_self_attn_dec', action='store_true', - help='keep the first self attention module in transformer decoders, which will be removed default.') - parser.add_argument('--keep_input_proj', action='store_true', - help="keep the input projection layer. Needed when the channel of image features is different from hidden_dim of Transformer layers.") - - # * raining - parser.add_argument('--amp', action='store_true', default=False, - help='apply amp') - parser.add_argument('--early-stop', action='store_true', default=False, - help='apply early stop') - parser.add_argument('--kill-stop', action='store_true', default=False, - help='apply early stop') - args = parser.parse_args() - return args - -def get_args(): - args = parser_args() - return args - - - -best_mAP = 0 - -def main(): - args = get_args() - - if 'WORLD_SIZE' in os.environ: - assert args.world_size > 0, 'please set --world-size and --rank in the command line' - # launch by torch.distributed.launch - # Single node - # python -m torch.distributed.launch --nproc_per_node=8 main.py --world-size 1 --rank 0 ... - # Multi nodes - # python -m torch.distributed.launch --nproc_per_node=8 main.py --world-size 2 --rank 0 --dist-url 'tcp://IP_OF_NODE0:FREEPORT' ... - # python -m torch.distributed.launch --nproc_per_node=8 main.py --world-size 2 --rank 1 --dist-url 'tcp://IP_OF_NODE0:FREEPORT' ... - local_world_size = int(os.environ['WORLD_SIZE']) - args.world_size = args.world_size * local_world_size - args.rank = args.rank * local_world_size + args.local_rank - print('world size: {}, world rank: {}, local rank: {}'.format(args.world_size, args.rank, args.local_rank)) - print('os.environ:', os.environ) - else: - # single process, useful for debugging - # python main.py ... - args.world_size = 1 - args.rank = 0 - args.local_rank = 0 - - if args.seed is not None: - random.seed(args.seed) - torch.manual_seed(args.seed) - np.random.seed(args.seed) - - - torch.cuda.set_device(args.local_rank) - print('| distributed init (local_rank {}): {}'.format( - args.local_rank, args.dist_url), flush=True) - torch.distributed.init_process_group(backend='nccl', init_method=args.dist_url, - world_size=args.world_size, rank=args.rank) - cudnn.benchmark = True - - - os.makedirs(args.output, exist_ok=True) - logger = setup_logger(output=args.output, distributed_rank=dist.get_rank(), color=False, name="Q2L") - logger.info("Command: "+' '.join(sys.argv)) - if dist.get_rank() == 0: - path = os.path.join(args.output, "config.json") - with open(path, 'w') as f: - json.dump(get_raw_dict(args), f, indent=2) - logger.info("Full config saved to {}".format(path)) - - logger.info('world size: {}'.format(dist.get_world_size())) - logger.info('dist.get_rank(): {}'.format(dist.get_rank())) - logger.info('local_rank: {}'.format(args.local_rank)) - - return main_worker(args, logger) - -def main_worker(args, logger): - global best_mAP - - # build model - model = build_q2l(args) - model = model.cuda() - ema_m = ModelEma(model, args.ema_decay) # 0.9997 - model = torch.nn.parallel.DistributedDataParallel(model, device_ids=[args.local_rank], broadcast_buffers=False) - - # criterion - criterion = models.aslloss.AsymmetricLossOptimized( - gamma_neg=args.gamma_neg, gamma_pos=args.gamma_pos, - disable_torch_grad_focal_loss=args.dtgfl, - eps=args.eps, - ) - - # optimizer - args.lr_mult = args.batch_size / 256 - if args.optim == 'AdamW': - param_dicts = [ - {"params": [p for n, p in model.module.named_parameters() if p.requires_grad]}, - ] - optimizer = getattr(torch.optim, args.optim)( - param_dicts, - args.lr_mult * args.lr, - betas=(0.9, 0.999), eps=1e-08, weight_decay=args.weight_decay - ) - elif args.optim == 'Adam_twd': - parameters = add_weight_decay(model, args.weight_decay) - optimizer = torch.optim.Adam( - parameters, - args.lr_mult * args.lr, - betas=(0.9, 0.999), eps=1e-08, weight_decay=0 - ) - else: - raise NotImplementedError - - - # tensorboard - if dist.get_rank() == 0: - summary_writer = SummaryWriter(log_dir=args.output) - else: - summary_writer = None - - # optionally resume from a checkpoint - if args.resume: - if os.path.isfile(args.resume): - logger.info("=> loading checkpoint '{}'".format(args.resume)) - checkpoint = torch.load(args.resume, map_location=torch.device(dist.get_rank())) - - if 'state_dict' in checkpoint: - state_dict = clean_state_dict(checkpoint['state_dict']) - elif 'model' in checkpoint: - state_dict = clean_state_dict(checkpoint['model']) - else: - raise ValueError("No model or state_dicr Found!!!") - logger.info("Omitting {}".format(args.resume_omit)) - # import ipdb; ipdb.set_trace() - for omit_name in args.resume_omit: - del state_dict[omit_name] - model.module.load_state_dict(state_dict, strict=False) - # model.module.load_state_dict(checkpoint['state_dict']) - logger.info("=> loaded checkpoint '{}' (epoch {})" - .format(args.resume, checkpoint['epoch'])) - del checkpoint - del state_dict - torch.cuda.empty_cache() - else: - logger.info("=> no checkpoint found at '{}'".format(args.resume)) - - # Data loading code - train_dataset, val_dataset = get_datasets(args) - - train_sampler = torch.utils.data.distributed.DistributedSampler(train_dataset) - assert args.batch_size // dist.get_world_size() == args.batch_size / dist.get_world_size(), 'Batch size is not divisible by num of gpus.' - train_loader = torch.utils.data.DataLoader( - train_dataset, batch_size=args.batch_size // dist.get_world_size(), shuffle=(train_sampler is None), - num_workers=args.workers, pin_memory=True, sampler=train_sampler, drop_last=True) - - val_sampler = torch.utils.data.distributed.DistributedSampler(val_dataset, shuffle=False) - val_loader = torch.utils.data.DataLoader( - val_dataset, batch_size=args.batch_size // dist.get_world_size(), shuffle=False, - num_workers=args.workers, pin_memory=True, sampler=val_sampler) - - - if args.evaluate: - _, mAP = validate(val_loader, model, criterion, args, logger) - logger.info(' * mAP {mAP:.5f}' - .format(mAP=mAP)) - return - - - epoch_time = AverageMeterHMS('TT') - eta = AverageMeterHMS('ETA', val_only=True) - losses = AverageMeter('Loss', ':5.3f', val_only=True) - losses_ema = AverageMeter('Loss_ema', ':5.3f', val_only=True) - mAPs = AverageMeter('mAP', ':5.5f', val_only=True) - mAPs_ema = AverageMeter('mAP_ema', ':5.5f', val_only=True) - progress = ProgressMeter( - args.epochs, - [eta, epoch_time, losses, mAPs, losses_ema, mAPs_ema], - prefix='=> Test Epoch: ') - - # one cycle learning rate - scheduler = lr_scheduler.OneCycleLR(optimizer, max_lr=args.lr, steps_per_epoch=len(train_loader), epochs=args.epochs, pct_start=0.2) - - - end = time.time() - best_epoch = -1 - best_regular_mAP = 0 - best_regular_epoch = -1 - best_ema_mAP = 0 - regular_mAP_list = [] - ema_mAP_list = [] - torch.cuda.empty_cache() - for epoch in range(args.start_epoch, args.epochs): - train_sampler.set_epoch(epoch) - if args.ema_epoch == epoch: - ema_m = ModelEma(model.module, args.ema_decay) - torch.cuda.empty_cache() - torch.cuda.empty_cache() - - # train for one epoch - loss = train(train_loader, model, ema_m, criterion, optimizer, scheduler, epoch, args, logger) - - if summary_writer: - # tensorboard logger - summary_writer.add_scalar('train_loss', loss, epoch) - # summary_writer.add_scalar('train_acc1', acc1, epoch) - summary_writer.add_scalar('learning_rate', optimizer.param_groups[0]['lr'], epoch) - - if epoch % args.val_interval == 0: - - # evaluate on validation set - loss, mAP = validate(val_loader, model, criterion, args, logger) - loss_ema, mAP_ema = validate(val_loader, ema_m.module, criterion, args, logger) - losses.update(loss) - mAPs.update(mAP) - losses_ema.update(loss_ema) - mAPs_ema.update(mAP_ema) - epoch_time.update(time.time() - end) - end = time.time() - eta.update(epoch_time.avg * (args.epochs - epoch - 1)) - - regular_mAP_list.append(mAP) - ema_mAP_list.append(mAP_ema) - - progress.display(epoch, logger) - - if summary_writer: - # tensorboard logger - summary_writer.add_scalar('val_loss', loss, epoch) - summary_writer.add_scalar('val_mAP', mAP, epoch) - summary_writer.add_scalar('val_loss_ema', loss_ema, epoch) - summary_writer.add_scalar('val_mAP_ema', mAP_ema, epoch) - - # remember best (regular) mAP and corresponding epochs - if mAP > best_regular_mAP: - best_regular_mAP = max(best_regular_mAP, mAP) - best_regular_epoch = epoch - if mAP_ema > best_ema_mAP: - best_ema_mAP = max(mAP_ema, best_ema_mAP) - - if mAP_ema > mAP: - mAP = mAP_ema - state_dict = ema_m.module.state_dict() - else: - state_dict = model.state_dict() - is_best = mAP > best_mAP - if is_best: - best_epoch = epoch - best_mAP = max(mAP, best_mAP) - - logger.info("{} | Set best mAP {} in ep {}".format(epoch, best_mAP, best_epoch)) - logger.info(" | best regular mAP {} in ep {}".format(best_regular_mAP, best_regular_epoch)) - - if dist.get_rank() == 0: - save_checkpoint({ - 'epoch': epoch + 1, - 'state_dict': state_dict, - 'best_mAP': best_mAP, - 'optimizer' : optimizer.state_dict(), - }, is_best=is_best, filename=os.path.join(args.output, 'checkpoint.pth.tar')) - - #save_checkpoint({ - # 'epoch': epoch + 1, - # 'arch': args.arch, - # 'state_dict': state_dict, - # 'best_mAP': best_mAP, - # 'optimizer' : optimizer.state_dict(), - #}, is_best=is_best, filename=os.path.join(args.output, 'checkpoint.pth.tar')) - - # filename=os.path.join(args.output, 'checkpoint_{:04d}.pth.tar'.format(epoch)) - - if math.isnan(loss) or math.isnan(loss_ema): - save_checkpoint({ - 'epoch': epoch + 1, - 'state_dict': model.state_dict(), - 'best_mAP': best_mAP, - 'optimizer' : optimizer.state_dict(), - }, is_best=is_best, filename=os.path.join(args.output, 'checkpoint_nan.pth.tar')) - - #save_checkpoint({ - # 'epoch': epoch + 1, - # 'arch': args.arch, - # 'state_dict': model.state_dict(), - # 'best_mAP': best_mAP, - # 'optimizer' : optimizer.state_dict(), - #}, is_best=is_best, filename=os.path.join(args.output, 'checkpoint_nan.pth.tar')) - - logger.info('Loss is NaN, break') - sys.exit(1) - - - # early stop - if args.early_stop: - if best_epoch >= 0 and epoch - max(best_epoch, best_regular_epoch) > 8: - if len(ema_mAP_list) > 1 and ema_mAP_list[-1] < best_ema_mAP: - logger.info("epoch - best_epoch = {}, stop!".format(epoch - best_epoch)) - if dist.get_rank() == 0 and args.kill_stop: - filename = sys.argv[0].split(' ')[0].strip() - killedlist = kill_process(filename, os.getpid()) - logger.info("Kill all process of {}: ".format(filename) + " ".join(killedlist)) - break - - print("Best mAP:", best_mAP) - - if summary_writer: - summary_writer.close() - - return 0 - - - -def train(train_loader, model, ema_m, criterion, optimizer, scheduler, epoch, args, logger): - scaler = torch.cuda.amp.GradScaler(enabled=args.amp) - - batch_time = AverageMeter('T', ':5.3f') - data_time = AverageMeter('DT', ':5.3f') - speed_gpu = AverageMeter('S1', ':.1f') - speed_all = AverageMeter('SA', ':.1f') - losses = AverageMeter('Loss', ':5.3f') - lr = AverageMeter('LR', ':.3e', val_only=True) - mem = AverageMeter('Mem', ':.0f', val_only=True) - progress = ProgressMeter( - len(train_loader), - [batch_time, data_time, speed_gpu, speed_all, lr, losses, mem], - prefix="Epoch: [{}/{}]".format(epoch, args.epochs)) - - def get_learning_rate(optimizer): - for param_group in optimizer.param_groups: - return param_group['lr'] - - lr.update(get_learning_rate(optimizer)) - logger.info("lr:{}".format(get_learning_rate(optimizer))) - - # switch to train mode - model.train() - - end = time.time() - for i, (images, target) in enumerate(train_loader): - # measure data loading time - data_time.update(time.time() - end) - - images = images.cuda(non_blocking=True) - target = target.cuda(non_blocking=True) - - # compute output - with torch.cuda.amp.autocast(enabled=args.amp): - output = model(images) - loss = criterion(output, target) - if args.loss_dev > 0: - loss *= args.loss_dev - - # record loss - losses.update(loss.item(), images.size(0)) - mem.update(torch.cuda.max_memory_allocated() / 1024.0 / 1024.0) - - # compute gradient and do SGD step - optimizer.zero_grad() - scaler.scale(loss).backward() - scaler.step(optimizer) - scaler.update() - # one cycle learning rate - scheduler.step() - lr.update(get_learning_rate(optimizer)) - if epoch >= args.ema_epoch: - ema_m.update(model) - # measure elapsed time - batch_time.update(time.time() - end) - end = time.time() - speed_gpu.update(images.size(0) / batch_time.val, batch_time.val) - speed_all.update(images.size(0) * dist.get_world_size() / batch_time.val, batch_time.val) - - if i % args.print_freq == 0: - progress.display(i, logger) - - return losses.avg - - - -@torch.no_grad() -def validate(val_loader, model, criterion, args, logger): - batch_time = AverageMeter('Time', ':5.3f') - losses = AverageMeter('Loss', ':5.3f') - # Acc1 = AverageMeter('Acc@1', ':5.2f') - # top5 = AverageMeter('Acc@5', ':5.2f') - mem = AverageMeter('Mem', ':.0f', val_only=True) - # mAP = AverageMeter('mAP', ':5.3f', val_only=) - - progress = ProgressMeter( - len(val_loader), - [batch_time, losses, mem], - prefix='Test: ') - - # switch to evaluate mode - saveflag = False - model.eval() - saved_data = [] - with torch.no_grad(): - end = time.time() - for i, (images, target) in enumerate(val_loader): - images = images.cuda(non_blocking=True) - target = target.cuda(non_blocking=True) - - # compute output - with torch.cuda.amp.autocast(enabled=args.amp): - output = model(images) - loss = criterion(output, target) - if args.loss_dev > 0: - loss *= args.loss_dev - output_sm = nn.functional.sigmoid(output) - if torch.isnan(loss): - saveflag = True - - # record loss - losses.update(loss.item(), images.size(0)) - mem.update(torch.cuda.max_memory_allocated() / 1024.0 / 1024.0) - - # save some data - # output_sm = nn.functional.sigmoid(output) - _item = torch.cat((output_sm.detach().cpu(), target.detach().cpu()), 1) - # del output_sm - # del target - saved_data.append(_item) - - # measure elapsed time - batch_time.update(time.time() - end) - end = time.time() - - if i % args.print_freq == 0 and dist.get_rank() == 0: - progress.display(i, logger) - - logger.info('=> synchronize...') - if dist.get_world_size() > 1: - dist.barrier() - loss_avg, = map( - _meter_reduce if dist.get_world_size() > 1 else lambda x: x.avg, - [losses] - ) - - # import ipdb; ipdb.set_trace() - # calculate mAP - saved_data = torch.cat(saved_data, 0).numpy() - saved_name = 'saved_data_tmp.{}.txt'.format(dist.get_rank()) - np.savetxt(os.path.join(args.output, saved_name), saved_data) - if dist.get_world_size() > 1: - dist.barrier() - - if dist.get_rank() == 0: - print("Calculating mAP:") - filenamelist = ['saved_data_tmp.{}.txt'.format(ii) for ii in range(dist.get_world_size())] - metric_func = voc_mAP - mAP, aps = metric_func([os.path.join(args.output, _filename) for _filename in filenamelist], args.num_class, return_each=True) - - logger.info(" mAP: {}".format(mAP)) - logger.info(" aps: {}".format(np.array2string(aps, precision=5))) - else: - mAP = 0 - - if dist.get_world_size() > 1: - dist.barrier() - - return loss_avg, mAP - - -################################################################################## -def add_weight_decay(model, weight_decay=1e-4, skip_list=()): - decay = [] - no_decay = [] - for name, param in model.named_parameters(): - if not param.requires_grad: - continue # frozen weights - if len(param.shape) == 1 or name.endswith(".bias") or name in skip_list: - no_decay.append(param) - else: - decay.append(param) - return [ - {'params': no_decay, 'weight_decay': 0.}, - {'params': decay, 'weight_decay': weight_decay}] - -class ModelEma(torch.nn.Module): - def __init__(self, model, decay=0.9997, device=None): - super(ModelEma, self).__init__() - # make a copy of the model for accumulating moving average of weights - self.module = deepcopy(model) - self.module.eval() - - # import ipdb; ipdb.set_trace() - - self.decay = decay - self.device = device # perform ema on different device from model if set - if self.device is not None: - self.module.to(device=device) - - def _update(self, model, update_fn): - with torch.no_grad(): - for ema_v, model_v in zip(self.module.state_dict().values(), model.state_dict().values()): - if self.device is not None: - model_v = model_v.to(device=self.device) - ema_v.copy_(update_fn(ema_v, model_v)) - - def update(self, model): - self._update(model, update_fn=lambda e, m: self.decay * e + (1. - self.decay) * m) - - def set(self, model): - self._update(model, update_fn=lambda e, m: m) - - -def _meter_reduce(meter): - meter_sum = torch.FloatTensor([meter.sum]).cuda() - meter_count = torch.FloatTensor([meter.count]).cuda() - torch.distributed.reduce(meter_sum, 0) - torch.distributed.reduce(meter_count, 0) - meter_avg = meter_sum / meter_count - - return meter_avg.item() - - -def save_checkpoint(state, is_best, filename='checkpoint.pth.tar'): - # torch.save(state, filename) - if is_best: - torch.save(state, os.path.split(filename)[0] + '/model_best.pth.tar') - # shutil.copyfile(filename, os.path.split(filename)[0] + '/model_best.pth.tar') - - -class AverageMeter(object): - """Computes and stores the average and current value""" - def __init__(self, name, fmt=':f', val_only=False): - self.name = name - self.fmt = fmt - self.val_only = val_only - self.reset() - - def reset(self): - self.val = 0 - self.avg = 0 - self.sum = 0 - self.count = 0 - - def update(self, val, n=1): - self.val = val - self.sum += val * n - self.count += n - self.avg = self.sum / self.count - - def __str__(self): - if self.val_only: - fmtstr = '{name} {val' + self.fmt + '}' - else: - fmtstr = '{name} {val' + self.fmt + '} ({avg' + self.fmt + '})' - return fmtstr.format(**self.__dict__) - - -class AverageMeterHMS(AverageMeter): - """Meter for timer in HH:MM:SS format""" - def __str__(self): - if self.val_only: - fmtstr = '{name} {val}' - else: - fmtstr = '{name} {val} ({sum})' - return fmtstr.format(name=self.name, - val=str(datetime.timedelta(seconds=int(self.val))), - sum=str(datetime.timedelta(seconds=int(self.sum)))) - -class ProgressMeter(object): - def __init__(self, num_batches, meters, prefix=""): - self.batch_fmtstr = self._get_batch_fmtstr(num_batches) - self.meters = meters - self.prefix = prefix - - def display(self, batch, logger): - entries = [self.prefix + self.batch_fmtstr.format(batch)] - entries += [str(meter) for meter in self.meters] - logger.info(' '.join(entries)) - - def _get_batch_fmtstr(self, num_batches): - num_digits = len(str(num_batches // 1)) - fmt = '{:' + str(num_digits) + 'd}' - return '[' + fmt + '/' + fmt.format(num_batches) + ']' - - - -def kill_process(filename:str, holdpid:int) -> List[str]: - import subprocess, signal - res = subprocess.check_output("ps aux | grep {} | grep -v grep | awk '{{print $2}}'".format(filename), shell=True, cwd="./") - res = res.decode('utf-8') - idlist = [i.strip() for i in res.split('\n') if i != ''] - print("kill: {}".format(idlist)) - for idname in idlist: - if idname != str(holdpid): - os.kill(int(idname), signal.SIGKILL) - return idlist - -if __name__ == '__main__': - main() diff --git a/spaces/curtpond/mle10-glg-demo/README.md b/spaces/curtpond/mle10-glg-demo/README.md deleted file mode 100644 index 6a229dfbc86bcf5f0dc47e9d973fe39e43a9ca54..0000000000000000000000000000000000000000 --- a/spaces/curtpond/mle10-glg-demo/README.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -title: Mle10 Glg Demo -emoji: 📈 -colorFrom: gray -colorTo: yellow -sdk: gradio -sdk_version: 3.18.0 -app_file: app.py -pinned: false -license: cc ---- - -Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference diff --git a/spaces/dahaoGPT/THUDM-chatglm2-6b/README.md b/spaces/dahaoGPT/THUDM-chatglm2-6b/README.md deleted file mode 100644 index 397c62497fe5ad1c777c1f946e3b44639636b0a0..0000000000000000000000000000000000000000 --- a/spaces/dahaoGPT/THUDM-chatglm2-6b/README.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -title: THUDM Chatglm2 6b -emoji: 🐨 -colorFrom: pink -colorTo: gray -sdk: gradio -sdk_version: 3.35.2 -app_file: app.py -pinned: false -license: apache-2.0 ---- - -Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference diff --git a/spaces/daveckw/custom-chatgpt/my_functions/save_response.py b/spaces/daveckw/custom-chatgpt/my_functions/save_response.py deleted file mode 100644 index e81ab0cefb1fc080af19dac4f23ed10c85ba613b..0000000000000000000000000000000000000000 --- a/spaces/daveckw/custom-chatgpt/my_functions/save_response.py +++ /dev/null @@ -1,61 +0,0 @@ -import os -import os.path -import datetime -import json -import codecs - -# Get the current date -today = datetime.date.today() -# Convert the date to a string using the strftime() method -date_string = today.strftime("%Y-%m-%d") -# Print the date string -print(date_string) - - -def save_response(input_text, response): - # Open the responses.txt file using the UTF-8 encoding - with codecs.open("responses.txt", "a", "utf-8") as file: - # Write or append text to the file - response_txt = ( - date_string - + "\n" - + "Input: " - + input_text - + "\n" - + "Response: " - + response.response - + "\n\nSource:" - + response.get_formatted_sources() - + "\n------------------------\n\n" - ) - file.write(response_txt + "\n") - - # Save as JSON format - response_json = { - "date": date_string, - "input": input_text, - "response": response.response, - "source": response.get_formatted_sources(), - } - - # Check if the responses.json file exists - if os.path.isfile("responses.json"): - # Open the existing JSON file in read mode using the UTF-8 encoding - with codecs.open("responses.json", "r", "utf-8") as f: - # Load the existing JSON data into memory and parse it - data = json.load(f) - else: - # The file doesn't exist, initialize the data with an empty list - data = [] - - # Append the new JSON object to the existing data - if isinstance(data, list): - # The existing data is a list, so we can append to it - data.append(response_json) - else: - # The existing data is not a list, so we create a new list - data = [data, response_json] - - # Open the JSON file in write mode using the UTF-8 encoding and write the updated data to it - with open("responses.json", "w", encoding="utf-8") as f: - json.dump(data, f, ensure_ascii=False) diff --git a/spaces/dcarpintero/nlp-summarizer-pegasus/.venv/lib/python3.9/site-packages/gradio/blocks.py b/spaces/dcarpintero/nlp-summarizer-pegasus/.venv/lib/python3.9/site-packages/gradio/blocks.py deleted file mode 100644 index 46be3864ec90877fac725e99679ede3e4ffe2f76..0000000000000000000000000000000000000000 --- a/spaces/dcarpintero/nlp-summarizer-pegasus/.venv/lib/python3.9/site-packages/gradio/blocks.py +++ /dev/null @@ -1,2243 +0,0 @@ -from __future__ import annotations - -import copy -import inspect -import json -import os -import random -import secrets -import sys -import threading -import time -import warnings -import webbrowser -from abc import abstractmethod -from collections import defaultdict -from pathlib import Path -from types import ModuleType -from typing import TYPE_CHECKING, Any, AsyncIterator, Callable, Literal, cast - -import anyio -import requests -from anyio import CapacityLimiter -from gradio_client import serializing -from gradio_client import utils as client_utils -from gradio_client.documentation import document, set_documentation_group -from packaging import version - -from gradio import ( - analytics, - components, - external, - networking, - queueing, - routes, - strings, - themes, - utils, - wasm_utils, -) -from gradio.context import Context -from gradio.deprecation import check_deprecated_parameters, warn_deprecation -from gradio.exceptions import ( - DuplicateBlockError, - InvalidApiNameError, - InvalidBlockError, -) -from gradio.helpers import EventData, create_tracker, skip, special_args -from gradio.themes import Default as DefaultTheme -from gradio.themes import ThemeClass as Theme -from gradio.tunneling import ( - BINARY_FILENAME, - BINARY_FOLDER, - BINARY_PATH, - BINARY_URL, - CURRENT_TUNNELS, -) -from gradio.utils import ( - GRADIO_VERSION, - TupleNoPrint, - check_function_inputs_match, - component_or_layout_class, - concurrency_count_warning, - delete_none, - get_cancel_function, - get_continuous_fn, -) - -try: - import spaces # type: ignore -except Exception: - spaces = None - -set_documentation_group("blocks") - -if TYPE_CHECKING: # Only import for type checking (is False at runtime). - from fastapi.applications import FastAPI - - from gradio.components import Component - -BUILT_IN_THEMES: dict[str, Theme] = { - t.name: t - for t in [ - themes.Base(), - themes.Default(), - themes.Monochrome(), - themes.Soft(), - themes.Glass(), - ] -} - - -class Block: - def __init__( - self, - *, - render: bool = True, - elem_id: str | None = None, - elem_classes: list[str] | str | None = None, - visible: bool = True, - root_url: str | None = None, # URL that is prepended to all file paths - _skip_init_processing: bool = False, # Used for loading from Spaces - **kwargs, - ): - self._id = Context.id - Context.id += 1 - self.visible = visible - self.elem_id = elem_id - self.elem_classes = ( - [elem_classes] if isinstance(elem_classes, str) else elem_classes - ) - self.root_url = root_url - self.share_token = secrets.token_urlsafe(32) - self._skip_init_processing = _skip_init_processing - self.parent: BlockContext | None = None - self.is_rendered: bool = False - - if render: - self.render() - check_deprecated_parameters(self.__class__.__name__, kwargs=kwargs) - - def render(self): - """ - Adds self into appropriate BlockContext - """ - if Context.root_block is not None and self._id in Context.root_block.blocks: - raise DuplicateBlockError( - f"A block with id: {self._id} has already been rendered in the current Blocks." - ) - if Context.block is not None: - Context.block.add(self) - if Context.root_block is not None: - Context.root_block.blocks[self._id] = self - self.is_rendered = True - if isinstance(self, components.IOComponent): - Context.root_block.temp_file_sets.append(self.temp_files) - return self - - def unrender(self): - """ - Removes self from BlockContext if it has been rendered (otherwise does nothing). - Removes self from the layout and collection of blocks, but does not delete any event triggers. - """ - if Context.block is not None: - try: - Context.block.children.remove(self) - except ValueError: - pass - if Context.root_block is not None: - try: - del Context.root_block.blocks[self._id] - self.is_rendered = False - except KeyError: - pass - return self - - def get_block_name(self) -> str: - """ - Gets block's class name. - - If it is template component it gets the parent's class name. - - @return: class name - """ - return ( - self.__class__.__base__.__name__.lower() - if hasattr(self, "is_template") - else self.__class__.__name__.lower() - ) - - def get_expected_parent(self) -> type[BlockContext] | None: - return None - - def set_event_trigger( - self, - event_name: str, - fn: Callable | None, - inputs: Component | list[Component] | set[Component] | None, - outputs: Component | list[Component] | None, - preprocess: bool = True, - postprocess: bool = True, - scroll_to_output: bool = False, - show_progress: str = "full", - api_name: str | None | Literal[False] = None, - js: str | None = None, - no_target: bool = False, - queue: bool | None = None, - batch: bool = False, - max_batch_size: int = 4, - cancels: list[int] | None = None, - every: float | None = None, - collects_event_data: bool | None = None, - trigger_after: int | None = None, - trigger_only_on_success: bool = False, - ) -> tuple[dict[str, Any], int]: - """ - Adds an event to the component's dependencies. - Parameters: - event_name: event name - fn: Callable function - inputs: input list - outputs: output list - preprocess: whether to run the preprocess methods of components - postprocess: whether to run the postprocess methods of components - scroll_to_output: whether to scroll to output of dependency on trigger - show_progress: whether to show progress animation while running. - api_name: defines how the endpoint appears in the API docs. Can be a string, None, or False. If False, the endpoint will not be exposed in the api docs. If set to None, the endpoint will be exposed in the api docs as an unnamed endpoint, although this behavior will be changed in Gradio 4.0. If set to a string, the endpoint will be exposed in the api docs with the given name. - js: Experimental parameter (API may change): Optional frontend js method to run before running 'fn'. Input arguments for js method are values of 'inputs' and 'outputs', return should be a list of values for output components - no_target: if True, sets "targets" to [], used for Blocks "load" event - queue: If True, will place the request on the queue, if the queue has been enabled. If False, will not put this event on the queue, even if the queue has been enabled. If None, will use the queue setting of the gradio app. - batch: whether this function takes in a batch of inputs - max_batch_size: the maximum batch size to send to the function - cancels: a list of other events to cancel when this event is triggered. For example, setting cancels=[click_event] will cancel the click_event, where click_event is the return value of another components .click method. - every: Run this event 'every' number of seconds while the client connection is open. Interpreted in seconds. Queue must be enabled. - collects_event_data: whether to collect event data for this event - trigger_after: if set, this event will be triggered after 'trigger_after' function index - trigger_only_on_success: if True, this event will only be triggered if the previous event was successful (only applies if `trigger_after` is set) - Returns: dependency information, dependency index - """ - # Support for singular parameter - if isinstance(inputs, set): - inputs_as_dict = True - inputs = sorted(inputs, key=lambda x: x._id) - else: - inputs_as_dict = False - if inputs is None: - inputs = [] - elif not isinstance(inputs, list): - inputs = [inputs] - - if isinstance(outputs, set): - outputs = sorted(outputs, key=lambda x: x._id) - else: - if outputs is None: - outputs = [] - elif not isinstance(outputs, list): - outputs = [outputs] - - if fn is not None and not cancels: - check_function_inputs_match(fn, inputs, inputs_as_dict) - - if Context.root_block is None: - raise AttributeError( - f"{event_name}() and other events can only be called within a Blocks context." - ) - if every is not None and every <= 0: - raise ValueError("Parameter every must be positive or None") - if every and batch: - raise ValueError( - f"Cannot run {event_name} event in a batch and every {every} seconds. " - "Either batch is True or every is non-zero but not both." - ) - - if every and fn: - fn = get_continuous_fn(fn, every) - elif every: - raise ValueError("Cannot set a value for `every` without a `fn`.") - - _, progress_index, event_data_index = ( - special_args(fn) if fn else (None, None, None) - ) - Context.root_block.fns.append( - BlockFunction( - fn, - inputs, - outputs, - preprocess, - postprocess, - inputs_as_dict, - progress_index is not None, - ) - ) - if api_name is not None and api_name is not False: - api_name_ = utils.append_unique_suffix( - api_name, [dep["api_name"] for dep in Context.root_block.dependencies] - ) - if api_name != api_name_: - warnings.warn(f"api_name {api_name} already exists, using {api_name_}") - api_name = api_name_ - - if collects_event_data is None: - collects_event_data = event_data_index is not None - - dependency = { - "targets": [self._id] if not no_target else [], - "trigger": event_name, - "inputs": [block._id for block in inputs], - "outputs": [block._id for block in outputs], - "backend_fn": fn is not None, - "js": js, - "queue": False if fn is None else queue, - "api_name": api_name, - "scroll_to_output": False if utils.get_space() else scroll_to_output, - "show_progress": show_progress, - "every": every, - "batch": batch, - "max_batch_size": max_batch_size, - "cancels": cancels or [], - "types": { - "continuous": bool(every), - "generator": inspect.isgeneratorfunction(fn) or bool(every), - }, - "collects_event_data": collects_event_data, - "trigger_after": trigger_after, - "trigger_only_on_success": trigger_only_on_success, - } - Context.root_block.dependencies.append(dependency) - return dependency, len(Context.root_block.dependencies) - 1 - - def get_config(self): - return { - "visible": self.visible, - "elem_id": self.elem_id, - "elem_classes": self.elem_classes, - "root_url": self.root_url, - } - - @staticmethod - @abstractmethod - def update(**kwargs) -> dict: - return {} - - @classmethod - def get_specific_update(cls, generic_update: dict[str, Any]) -> dict: - generic_update = generic_update.copy() - del generic_update["__type__"] - specific_update = cls.update(**generic_update) - return specific_update - - -class BlockContext(Block): - def __init__( - self, - visible: bool = True, - render: bool = True, - **kwargs, - ): - """ - Parameters: - visible: If False, this will be hidden but included in the Blocks config file (its visibility can later be updated). - render: If False, this will not be included in the Blocks config file at all. - """ - self.children: list[Block] = [] - Block.__init__(self, visible=visible, render=render, **kwargs) - - def add_child(self, child: Block): - self.children.append(child) - - def __enter__(self): - self.parent = Context.block - Context.block = self - return self - - def add(self, child: Block): - child.parent = self - self.children.append(child) - - def fill_expected_parents(self): - children = [] - pseudo_parent = None - for child in self.children: - expected_parent = child.get_expected_parent() - if not expected_parent or isinstance(self, expected_parent): - pseudo_parent = None - children.append(child) - else: - if pseudo_parent is not None and isinstance( - pseudo_parent, expected_parent - ): - pseudo_parent.add_child(child) - else: - pseudo_parent = expected_parent(render=False) - pseudo_parent.parent = self - children.append(pseudo_parent) - pseudo_parent.add_child(child) - if Context.root_block: - Context.root_block.blocks[pseudo_parent._id] = pseudo_parent - child.parent = pseudo_parent - self.children = children - - def __exit__(self, *args): - if getattr(self, "allow_expected_parents", True): - self.fill_expected_parents() - Context.block = self.parent - - def postprocess(self, y): - """ - Any postprocessing needed to be performed on a block context. - """ - return y - - -class BlockFunction: - def __init__( - self, - fn: Callable | None, - inputs: list[Component], - outputs: list[Component], - preprocess: bool, - postprocess: bool, - inputs_as_dict: bool, - tracks_progress: bool = False, - ): - self.fn = fn - self.inputs = inputs - self.outputs = outputs - self.preprocess = preprocess - self.postprocess = postprocess - self.tracks_progress = tracks_progress - self.total_runtime = 0 - self.total_runs = 0 - self.inputs_as_dict = inputs_as_dict - self.name = getattr(fn, "__name__", "fn") if fn is not None else None - self.spaces_auto_wrap() - - def spaces_auto_wrap(self): - if spaces is None: - return - if utils.get_space() is None: - return - self.fn = spaces.gradio_auto_wrap(self.fn) - - def __str__(self): - return str( - { - "fn": self.name, - "preprocess": self.preprocess, - "postprocess": self.postprocess, - } - ) - - def __repr__(self): - return str(self) - - -class class_or_instancemethod(classmethod): # noqa: N801 - def __get__(self, instance, type_): - descr_get = super().__get__ if instance is None else self.__func__.__get__ - return descr_get(instance, type_) - - -def postprocess_update_dict(block: Block, update_dict: dict, postprocess: bool = True): - """ - Converts a dictionary of updates into a format that can be sent to the frontend. - E.g. {"__type__": "generic_update", "value": "2", "interactive": False} - Into -> {"__type__": "update", "value": 2.0, "mode": "static"} - - Parameters: - block: The Block that is being updated with this update dictionary. - update_dict: The original update dictionary - postprocess: Whether to postprocess the "value" key of the update dictionary. - """ - if update_dict.get("__type__", "") == "generic_update": - update_dict = block.get_specific_update(update_dict) - if update_dict.get("value") is components._Keywords.NO_VALUE: - update_dict.pop("value") - interactive = update_dict.pop("interactive", None) - if interactive is not None: - update_dict["mode"] = "dynamic" if interactive else "static" - prediction_value = delete_none(update_dict, skip_value=True) - if "value" in prediction_value and postprocess: - assert isinstance( - block, components.IOComponent - ), f"Component {block.__class__} does not support value" - prediction_value["value"] = block.postprocess(prediction_value["value"]) - return prediction_value - - -def convert_component_dict_to_list( - outputs_ids: list[int], predictions: dict -) -> list | dict: - """ - Converts a dictionary of component updates into a list of updates in the order of - the outputs_ids and including every output component. Leaves other types of dictionaries unchanged. - E.g. {"textbox": "hello", "number": {"__type__": "generic_update", "value": "2"}} - Into -> ["hello", {"__type__": "generic_update"}, {"__type__": "generic_update", "value": "2"}] - """ - keys_are_blocks = [isinstance(key, Block) for key in predictions] - if all(keys_are_blocks): - reordered_predictions = [skip() for _ in outputs_ids] - for component, value in predictions.items(): - if component._id not in outputs_ids: - raise ValueError( - f"Returned component {component} not specified as output of function." - ) - output_index = outputs_ids.index(component._id) - reordered_predictions[output_index] = value - predictions = utils.resolve_singleton(reordered_predictions) - elif any(keys_are_blocks): - raise ValueError( - "Returned dictionary included some keys as Components. Either all keys must be Components to assign Component values, or return a List of values to assign output values in order." - ) - return predictions - - -def get_api_info(config: dict, serialize: bool = True): - """ - Gets the information needed to generate the API docs from a Blocks config. - Parameters: - config: a Blocks config dictionary - serialize: If True, returns the serialized version of the typed information. If False, returns the raw version. - """ - api_info = {"named_endpoints": {}, "unnamed_endpoints": {}} - mode = config.get("mode", None) - after_new_format = version.parse(config.get("version", "2.0")) > version.Version( - "3.28.3" - ) - - for d, dependency in enumerate(config["dependencies"]): - dependency_info = {"parameters": [], "returns": []} - skip_endpoint = False - - inputs = dependency["inputs"] - for i in inputs: - for component in config["components"]: - if component["id"] == i: - break - else: - skip_endpoint = True # if component not found, skip endpoint - break - type = component["type"] - if type in client_utils.SKIP_COMPONENTS: - continue - if ( - not component.get("serializer") - and type not in serializing.COMPONENT_MAPPING - ): - skip_endpoint = True # if component not serializable, skip endpoint - break - if type in client_utils.SKIP_COMPONENTS: - continue - label = component["props"].get("label", f"parameter_{i}") - # The config has the most specific API info (taking into account the parameters - # of the component), so we use that if it exists. Otherwise, we fallback to the - # Serializer's API info. - serializer = serializing.COMPONENT_MAPPING[type]() - if component.get("api_info") and after_new_format: - info = component["api_info"] - example = component["example_inputs"]["serialized"] - else: - assert isinstance(serializer, serializing.Serializable) - info = serializer.api_info() - example = serializer.example_inputs()["raw"] - python_info = info["info"] - if serialize and info["serialized_info"]: - python_info = serializer.serialized_info() - if ( - isinstance(serializer, serializing.FileSerializable) - and component["props"].get("file_count", "single") != "single" - ): - python_info = serializer._multiple_file_serialized_info() - - python_type = client_utils.json_schema_to_python_type(python_info) - serializer_name = serializing.COMPONENT_MAPPING[type].__name__ - dependency_info["parameters"].append( - { - "label": label, - "type": info["info"], - "python_type": { - "type": python_type, - "description": python_info.get("description", ""), - }, - "component": type.capitalize(), - "example_input": example, - "serializer": serializer_name, - } - ) - - outputs = dependency["outputs"] - for o in outputs: - for component in config["components"]: - if component["id"] == o: - break - else: - skip_endpoint = True # if component not found, skip endpoint - break - type = component["type"] - if type in client_utils.SKIP_COMPONENTS: - continue - if ( - not component.get("serializer") - and type not in serializing.COMPONENT_MAPPING - ): - skip_endpoint = True # if component not serializable, skip endpoint - break - label = component["props"].get("label", f"value_{o}") - serializer = serializing.COMPONENT_MAPPING[type]() - if component.get("api_info") and after_new_format: - info = component["api_info"] - example = component["example_inputs"]["serialized"] - else: - assert isinstance(serializer, serializing.Serializable) - info = serializer.api_info() - example = serializer.example_inputs()["raw"] - python_info = info["info"] - if serialize and info["serialized_info"]: - python_info = serializer.serialized_info() - if ( - isinstance(serializer, serializing.FileSerializable) - and component["props"].get("file_count", "single") != "single" - ): - python_info = serializer._multiple_file_serialized_info() - python_type = client_utils.json_schema_to_python_type(python_info) - serializer_name = serializing.COMPONENT_MAPPING[type].__name__ - dependency_info["returns"].append( - { - "label": label, - "type": info["info"], - "python_type": { - "type": python_type, - "description": python_info.get("description", ""), - }, - "component": type.capitalize(), - "serializer": serializer_name, - } - ) - - if not dependency["backend_fn"]: - skip_endpoint = True - - if skip_endpoint: - continue - if dependency["api_name"] is not None and dependency["api_name"] is not False: - api_info["named_endpoints"][f"/{dependency['api_name']}"] = dependency_info - elif ( - dependency["api_name"] is False - or mode == "interface" - or mode == "tabbed_interface" - ): - pass # Skip unnamed endpoints in interface mode - else: - api_info["unnamed_endpoints"][str(d)] = dependency_info - - return api_info - - -@document("launch", "queue", "integrate", "load") -class Blocks(BlockContext): - """ - Blocks is Gradio's low-level API that allows you to create more custom web - applications and demos than Interfaces (yet still entirely in Python). - - - Compared to the Interface class, Blocks offers more flexibility and control over: - (1) the layout of components (2) the events that - trigger the execution of functions (3) data flows (e.g. inputs can trigger outputs, - which can trigger the next level of outputs). Blocks also offers ways to group - together related demos such as with tabs. - - - The basic usage of Blocks is as follows: create a Blocks object, then use it as a - context (with the "with" statement), and then define layouts, components, or events - within the Blocks context. Finally, call the launch() method to launch the demo. - - Example: - import gradio as gr - def update(name): - return f"Welcome to Gradio, {name}!" - - with gr.Blocks() as demo: - gr.Markdown("Start typing below and then click **Run** to see the output.") - with gr.Row(): - inp = gr.Textbox(placeholder="What is your name?") - out = gr.Textbox() - btn = gr.Button("Run") - btn.click(fn=update, inputs=inp, outputs=out) - - demo.launch() - Demos: blocks_hello, blocks_flipper, blocks_speech_text_sentiment, generate_english_german, sound_alert - Guides: blocks-and-event-listeners, controlling-layout, state-in-blocks, custom-CSS-and-JS, custom-interpretations-with-blocks, using-blocks-like-functions - """ - - def __init__( - self, - theme: Theme | str | None = None, - analytics_enabled: bool | None = None, - mode: str = "blocks", - title: str = "Gradio", - css: str | None = None, - **kwargs, - ): - """ - Parameters: - theme: a Theme object or a string representing a theme. If a string, will look for a built-in theme with that name (e.g. "soft" or "default"), or will attempt to load a theme from the HF Hub (e.g. "gradio/monochrome"). If None, will use the Default theme. - analytics_enabled: whether to allow basic telemetry. If None, will use GRADIO_ANALYTICS_ENABLED environment variable or default to True. - mode: a human-friendly name for the kind of Blocks or Interface being created. - title: The tab title to display when this is opened in a browser window. - css: custom css or path to custom css file to apply to entire Blocks - """ - self.limiter = None - if theme is None: - theme = DefaultTheme() - elif isinstance(theme, str): - if theme.lower() in BUILT_IN_THEMES: - theme = BUILT_IN_THEMES[theme.lower()] - else: - try: - theme = Theme.from_hub(theme) - except Exception as e: - warnings.warn(f"Cannot load {theme}. Caught Exception: {str(e)}") - theme = DefaultTheme() - if not isinstance(theme, Theme): - warnings.warn("Theme should be a class loaded from gradio.themes") - theme = DefaultTheme() - self.theme: Theme = theme - self.theme_css = theme._get_theme_css() - self.stylesheets = theme._stylesheets - self.encrypt = False - self.share = False - self.enable_queue = None - self.max_threads = 40 - self.pending_streams = defaultdict(dict) - self.show_error = True - if css is not None and os.path.exists(css): - with open(css) as css_file: - self.css = css_file.read() - else: - self.css = css - - # For analytics_enabled and allow_flagging: (1) first check for - # parameter, (2) check for env variable, (3) default to True/"manual" - self.analytics_enabled = ( - analytics_enabled - if analytics_enabled is not None - else analytics.analytics_enabled() - ) - if self.analytics_enabled: - if not wasm_utils.IS_WASM: - t = threading.Thread(target=analytics.version_check) - t.start() - else: - os.environ["HF_HUB_DISABLE_TELEMETRY"] = "True" - super().__init__(render=False, **kwargs) - self.blocks: dict[int, Block] = {} - self.fns: list[BlockFunction] = [] - self.dependencies = [] - self.mode = mode - - self.is_running = False - self.local_url = None - self.share_url = None - self.width = None - self.height = None - self.api_open = True - - self.space_id = utils.get_space() - self.favicon_path = None - self.auth = None - self.dev_mode = True - self.app_id = random.getrandbits(64) - self.temp_file_sets = [] - self.title = title - self.show_api = True - - # Only used when an Interface is loaded from a config - self.predict = None - self.input_components = None - self.output_components = None - self.__name__ = None - self.api_mode = None - self.progress_tracking = None - self.ssl_verify = True - - self.allowed_paths = [] - self.blocked_paths = [] - self.root_path = os.environ.get("GRADIO_ROOT_PATH", "") - self.root_urls = set() - - if self.analytics_enabled: - is_custom_theme = not any( - self.theme.to_dict() == built_in_theme.to_dict() - for built_in_theme in BUILT_IN_THEMES.values() - ) - data = { - "mode": self.mode, - "custom_css": self.css is not None, - "theme": self.theme.name, - "is_custom_theme": is_custom_theme, - "version": GRADIO_VERSION, - } - analytics.initiated_analytics(data) - - @classmethod - def from_config( - cls, - config: dict, - fns: list[Callable], - root_url: str, - ) -> Blocks: - """ - Factory method that creates a Blocks from a config and list of functions. Used - internally by the gradio.external.load() method. - - Parameters: - config: a dictionary containing the configuration of the Blocks. - fns: a list of functions that are used in the Blocks. Must be in the same order as the dependencies in the config. - root_url: an external url to use as a root URL when serving files for components in the Blocks. - """ - config = copy.deepcopy(config) - components_config = config["components"] - for component_config in components_config: - # for backwards compatibility, extract style into props - if "style" in component_config["props"]: - component_config["props"].update(component_config["props"]["style"]) - del component_config["props"]["style"] - theme = config.get("theme", "default") - original_mapping: dict[int, Block] = {} - root_urls = {root_url} - - def get_block_instance(id: int) -> Block: - for block_config in components_config: - if block_config["id"] == id: - break - else: - raise ValueError(f"Cannot find block with id {id}") - cls = component_or_layout_class(block_config["type"]) - block_config["props"].pop("type", None) - block_config["props"].pop("name", None) - # If a Gradio app B is loaded into a Gradio app A, and B itself loads a - # Gradio app C, then the root_urls of the components in A need to be the - # URL of C, not B. The else clause below handles this case. - if block_config["props"].get("root_url") is None: - block_config["props"]["root_url"] = f"{root_url}/" - else: - root_urls.add(block_config["props"]["root_url"]) - # Any component has already processed its initial value, so we skip that step here - block = cls(**block_config["props"], _skip_init_processing=True) - return block - - def iterate_over_children(children_list): - for child_config in children_list: - id = child_config["id"] - block = get_block_instance(id) - - original_mapping[id] = block - - children = child_config.get("children") - if children is not None: - assert isinstance( - block, BlockContext - ), f"Invalid config, Block with id {id} has children but is not a BlockContext." - with block: - iterate_over_children(children) - - derived_fields = ["types"] - - with Blocks(theme=theme) as blocks: - # ID 0 should be the root Blocks component - original_mapping[0] = Context.root_block or blocks - - iterate_over_children(config["layout"]["children"]) - - first_dependency = None - - # add the event triggers - for dependency, fn in zip(config["dependencies"], fns): - # We used to add a "fake_event" to the config to cache examples - # without removing it. This was causing bugs in calling gr.load - # We fixed the issue by removing "fake_event" from the config in examples.py - # but we still need to skip these events when loading the config to support - # older demos - if dependency["trigger"] == "fake_event": - continue - for field in derived_fields: - dependency.pop(field, None) - targets = dependency.pop("targets") - trigger = dependency.pop("trigger") - dependency.pop("backend_fn") - dependency.pop("documentation", None) - dependency["inputs"] = [ - original_mapping[i] for i in dependency["inputs"] - ] - dependency["outputs"] = [ - original_mapping[o] for o in dependency["outputs"] - ] - dependency.pop("status_tracker", None) - dependency["preprocess"] = False - dependency["postprocess"] = False - - for target in targets: - dependency = original_mapping[target].set_event_trigger( - event_name=trigger, fn=fn, **dependency - )[0] - if first_dependency is None: - first_dependency = dependency - - # Allows some use of Interface-specific methods with loaded Spaces - if first_dependency and Context.root_block: - blocks.predict = [fns[0]] - blocks.input_components = [ - Context.root_block.blocks[i] for i in first_dependency["inputs"] - ] - blocks.output_components = [ - Context.root_block.blocks[o] for o in first_dependency["outputs"] - ] - blocks.__name__ = "Interface" - blocks.api_mode = True - - blocks.root_urls = root_urls - return blocks - - def __str__(self): - return self.__repr__() - - def __repr__(self): - num_backend_fns = len([d for d in self.dependencies if d["backend_fn"]]) - repr = f"Gradio Blocks instance: {num_backend_fns} backend functions" - repr += f"\n{'-' * len(repr)}" - for d, dependency in enumerate(self.dependencies): - if dependency["backend_fn"]: - repr += f"\nfn_index={d}" - repr += "\n inputs:" - for input_id in dependency["inputs"]: - block = self.blocks[input_id] - repr += f"\n |-{block}" - repr += "\n outputs:" - for output_id in dependency["outputs"]: - block = self.blocks[output_id] - repr += f"\n |-{block}" - return repr - - @property - def expects_oauth(self): - """Return whether the app expects user to authenticate via OAuth.""" - return any( - isinstance(block, (components.LoginButton, components.LogoutButton)) - for block in self.blocks.values() - ) - - def render(self): - if Context.root_block is not None: - if self._id in Context.root_block.blocks: - raise DuplicateBlockError( - f"A block with id: {self._id} has already been rendered in the current Blocks." - ) - overlapping_ids = set(Context.root_block.blocks).intersection(self.blocks) - for id in overlapping_ids: - # State components are allowed to be reused between Blocks - if not isinstance(self.blocks[id], components.State): - raise DuplicateBlockError( - "At least one block in this Blocks has already been rendered." - ) - - Context.root_block.blocks.update(self.blocks) - Context.root_block.fns.extend(self.fns) - dependency_offset = len(Context.root_block.dependencies) - for i, dependency in enumerate(self.dependencies): - api_name = dependency["api_name"] - if api_name is not None and api_name is not False: - api_name_ = utils.append_unique_suffix( - api_name, - [dep["api_name"] for dep in Context.root_block.dependencies], - ) - if api_name != api_name_: - warnings.warn( - f"api_name {api_name} already exists, using {api_name_}" - ) - dependency["api_name"] = api_name_ - dependency["cancels"] = [ - c + dependency_offset for c in dependency["cancels"] - ] - if dependency.get("trigger_after") is not None: - dependency["trigger_after"] += dependency_offset - # Recreate the cancel function so that it has the latest - # dependency fn indices. This is necessary to properly cancel - # events in the backend - if dependency["cancels"]: - updated_cancels = [ - Context.root_block.dependencies[i] - for i in dependency["cancels"] - ] - new_fn = BlockFunction( - get_cancel_function(updated_cancels)[0], - [], - [], - False, - True, - False, - ) - Context.root_block.fns[dependency_offset + i] = new_fn - Context.root_block.dependencies.append(dependency) - Context.root_block.temp_file_sets.extend(self.temp_file_sets) - Context.root_block.root_urls.update(self.root_urls) - - if Context.block is not None: - Context.block.children.extend(self.children) - return self - - def is_callable(self, fn_index: int = 0) -> bool: - """Checks if a particular Blocks function is callable (i.e. not stateful or a generator).""" - block_fn = self.fns[fn_index] - dependency = self.dependencies[fn_index] - - if inspect.isasyncgenfunction(block_fn.fn): - return False - if inspect.isgeneratorfunction(block_fn.fn): - return False - for input_id in dependency["inputs"]: - block = self.blocks[input_id] - if getattr(block, "stateful", False): - return False - for output_id in dependency["outputs"]: - block = self.blocks[output_id] - if getattr(block, "stateful", False): - return False - - return True - - def __call__(self, *inputs, fn_index: int = 0, api_name: str | None = None): - """ - Allows Blocks objects to be called as functions. Supply the parameters to the - function as positional arguments. To choose which function to call, use the - fn_index parameter, which must be a keyword argument. - - Parameters: - *inputs: the parameters to pass to the function - fn_index: the index of the function to call (defaults to 0, which for Interfaces, is the default prediction function) - api_name: The api_name of the dependency to call. Will take precedence over fn_index. - """ - if api_name is not None: - inferred_fn_index = next( - ( - i - for i, d in enumerate(self.dependencies) - if d.get("api_name") == api_name - ), - None, - ) - if inferred_fn_index is None: - raise InvalidApiNameError( - f"Cannot find a function with api_name {api_name}" - ) - fn_index = inferred_fn_index - if not (self.is_callable(fn_index)): - raise ValueError( - "This function is not callable because it is either stateful or is a generator. Please use the .launch() method instead to create an interactive user interface." - ) - - inputs = list(inputs) - processed_inputs = self.serialize_data(fn_index, inputs) - batch = self.dependencies[fn_index]["batch"] - if batch: - processed_inputs = [[inp] for inp in processed_inputs] - - outputs = client_utils.synchronize_async( - self.process_api, - fn_index=fn_index, - inputs=processed_inputs, - request=None, - state={}, - ) - outputs = outputs["data"] - - if batch: - outputs = [out[0] for out in outputs] - - processed_outputs = self.deserialize_data(fn_index, outputs) - processed_outputs = utils.resolve_singleton(processed_outputs) - - return processed_outputs - - async def call_function( - self, - fn_index: int, - processed_input: list[Any], - iterator: AsyncIterator[Any] | None = None, - requests: routes.Request | list[routes.Request] | None = None, - event_id: str | None = None, - event_data: EventData | None = None, - ): - """ - Calls function with given index and preprocessed input, and measures process time. - Parameters: - fn_index: index of function to call - processed_input: preprocessed input to pass to function - iterator: iterator to use if function is a generator - requests: requests to pass to function - event_id: id of event in queue - event_data: data associated with event trigger - """ - block_fn = self.fns[fn_index] - assert block_fn.fn, f"function with index {fn_index} not defined." - is_generating = False - - if block_fn.inputs_as_dict: - processed_input = [dict(zip(block_fn.inputs, processed_input))] - - request = requests[0] if isinstance(requests, list) else requests - processed_input, progress_index, _ = special_args( - block_fn.fn, processed_input, request, event_data - ) - progress_tracker = ( - processed_input[progress_index] if progress_index is not None else None - ) - - start = time.time() - - fn = utils.get_function_with_locals(block_fn.fn, self, event_id) - - if iterator is None: # If not a generator function that has already run - if progress_tracker is not None and progress_index is not None: - progress_tracker, fn = create_tracker( - self, event_id, fn, progress_tracker.track_tqdm - ) - processed_input[progress_index] = progress_tracker - - if inspect.iscoroutinefunction(fn): - prediction = await fn(*processed_input) - else: - prediction = await anyio.to_thread.run_sync( - fn, *processed_input, limiter=self.limiter - ) - else: - prediction = None - - if inspect.isgeneratorfunction(fn) or inspect.isasyncgenfunction(fn): - if not self.enable_queue: - raise ValueError("Need to enable queue to use generators.") - try: - if iterator is None: - iterator = cast(AsyncIterator[Any], prediction) - if inspect.isgenerator(iterator): - iterator = utils.SyncToAsyncIterator(iterator, self.limiter) - prediction = await utils.async_iteration(iterator) - is_generating = True - except StopAsyncIteration: - n_outputs = len(self.dependencies[fn_index].get("outputs")) - prediction = ( - components._Keywords.FINISHED_ITERATING - if n_outputs == 1 - else (components._Keywords.FINISHED_ITERATING,) * n_outputs - ) - iterator = None - - duration = time.time() - start - - return { - "prediction": prediction, - "duration": duration, - "is_generating": is_generating, - "iterator": iterator, - } - - def serialize_data(self, fn_index: int, inputs: list[Any]) -> list[Any]: - dependency = self.dependencies[fn_index] - processed_input = [] - - for i, input_id in enumerate(dependency["inputs"]): - try: - block = self.blocks[input_id] - except KeyError as e: - raise InvalidBlockError( - f"Input component with id {input_id} used in {dependency['trigger']}() event is not defined in this gr.Blocks context. You are allowed to nest gr.Blocks contexts, but there must be a gr.Blocks context that contains all components and events." - ) from e - assert isinstance( - block, components.IOComponent - ), f"{block.__class__} Component with id {input_id} not a valid input component." - serialized_input = block.serialize(inputs[i]) - processed_input.append(serialized_input) - - return processed_input - - def deserialize_data(self, fn_index: int, outputs: list[Any]) -> list[Any]: - dependency = self.dependencies[fn_index] - predictions = [] - - for o, output_id in enumerate(dependency["outputs"]): - try: - block = self.blocks[output_id] - except KeyError as e: - raise InvalidBlockError( - f"Output component with id {output_id} used in {dependency['trigger']}() event not found in this gr.Blocks context. You are allowed to nest gr.Blocks contexts, but there must be a gr.Blocks context that contains all components and events." - ) from e - assert isinstance( - block, components.IOComponent - ), f"{block.__class__} Component with id {output_id} not a valid output component." - deserialized = block.deserialize( - outputs[o], - save_dir=block.DEFAULT_TEMP_DIR, - root_url=block.root_url, - hf_token=Context.hf_token, - ) - predictions.append(deserialized) - - return predictions - - def validate_inputs(self, fn_index: int, inputs: list[Any]): - block_fn = self.fns[fn_index] - dependency = self.dependencies[fn_index] - - dep_inputs = dependency["inputs"] - - # This handles incorrect inputs when args are changed by a JS function - # Only check not enough args case, ignore extra arguments (for now) - # TODO: make this stricter? - if len(inputs) < len(dep_inputs): - name = ( - f" ({block_fn.name})" - if block_fn.name and block_fn.name != "" - else "" - ) - - wanted_args = [] - received_args = [] - for input_id in dep_inputs: - block = self.blocks[input_id] - wanted_args.append(str(block)) - for inp in inputs: - v = f'"{inp}"' if isinstance(inp, str) else str(inp) - received_args.append(v) - - wanted = ", ".join(wanted_args) - received = ", ".join(received_args) - - # JS func didn't pass enough arguments - raise ValueError( - f"""An event handler{name} didn't receive enough input values (needed: {len(dep_inputs)}, got: {len(inputs)}). -Check if the event handler calls a Javascript function, and make sure its return value is correct. -Wanted inputs: - [{wanted}] -Received inputs: - [{received}]""" - ) - - def preprocess_data(self, fn_index: int, inputs: list[Any], state: dict[int, Any]): - block_fn = self.fns[fn_index] - dependency = self.dependencies[fn_index] - - self.validate_inputs(fn_index, inputs) - - if block_fn.preprocess: - processed_input = [] - for i, input_id in enumerate(dependency["inputs"]): - try: - block = self.blocks[input_id] - except KeyError as e: - raise InvalidBlockError( - f"Input component with id {input_id} used in {dependency['trigger']}() event not found in this gr.Blocks context. You are allowed to nest gr.Blocks contexts, but there must be a gr.Blocks context that contains all components and events." - ) from e - assert isinstance( - block, components.Component - ), f"{block.__class__} Component with id {input_id} not a valid input component." - if getattr(block, "stateful", False): - processed_input.append(state.get(input_id)) - else: - processed_input.append(block.preprocess(inputs[i])) - else: - processed_input = inputs - return processed_input - - def validate_outputs(self, fn_index: int, predictions: Any | list[Any]): - block_fn = self.fns[fn_index] - dependency = self.dependencies[fn_index] - - dep_outputs = dependency["outputs"] - - if type(predictions) is not list and type(predictions) is not tuple: - predictions = [predictions] - - if len(predictions) < len(dep_outputs): - name = ( - f" ({block_fn.name})" - if block_fn.name and block_fn.name != "" - else "" - ) - - wanted_args = [] - received_args = [] - for output_id in dep_outputs: - block = self.blocks[output_id] - wanted_args.append(str(block)) - for pred in predictions: - v = f'"{pred}"' if isinstance(pred, str) else str(pred) - received_args.append(v) - - wanted = ", ".join(wanted_args) - received = ", ".join(received_args) - - raise ValueError( - f"""An event handler{name} didn't receive enough output values (needed: {len(dep_outputs)}, received: {len(predictions)}). -Wanted outputs: - [{wanted}] -Received outputs: - [{received}]""" - ) - - def postprocess_data( - self, fn_index: int, predictions: list | dict, state: dict[int, Any] - ): - block_fn = self.fns[fn_index] - dependency = self.dependencies[fn_index] - batch = dependency["batch"] - - if type(predictions) is dict and len(predictions) > 0: - predictions = convert_component_dict_to_list( - dependency["outputs"], predictions - ) - - if len(dependency["outputs"]) == 1 and not (batch): - predictions = [ - predictions, - ] - - self.validate_outputs(fn_index, predictions) # type: ignore - - output = [] - for i, output_id in enumerate(dependency["outputs"]): - try: - if predictions[i] is components._Keywords.FINISHED_ITERATING: - output.append(None) - continue - except (IndexError, KeyError) as err: - raise ValueError( - "Number of output components does not match number " - f"of values returned from from function {block_fn.name}" - ) from err - - try: - block = self.blocks[output_id] - except KeyError as e: - raise InvalidBlockError( - f"Output component with id {output_id} used in {dependency['trigger']}() event not found in this gr.Blocks context. You are allowed to nest gr.Blocks contexts, but there must be a gr.Blocks context that contains all components and events." - ) from e - - if getattr(block, "stateful", False): - if not utils.is_update(predictions[i]): - state[output_id] = predictions[i] - output.append(None) - else: - prediction_value = predictions[i] - if utils.is_update(prediction_value): - assert isinstance(prediction_value, dict) - prediction_value = postprocess_update_dict( - block=block, - update_dict=prediction_value, - postprocess=block_fn.postprocess, - ) - elif block_fn.postprocess: - assert isinstance( - block, components.Component - ), f"{block.__class__} Component with id {output_id} not a valid output component." - prediction_value = block.postprocess(prediction_value) - output.append(prediction_value) - - return output - - def handle_streaming_outputs( - self, - fn_index: int, - data: list, - session_hash: str | None, - run: int | None, - ) -> list: - if session_hash is None or run is None: - return data - - from gradio.events import StreamableOutput - - for i, output_id in enumerate(self.dependencies[fn_index]["outputs"]): - block = self.blocks[output_id] - if isinstance(block, StreamableOutput) and block.streaming: - stream = block.stream_output(data[i]) - if run not in self.pending_streams[session_hash]: - self.pending_streams[session_hash][run] = defaultdict(list) - self.pending_streams[session_hash][run][output_id].append(stream) - data[i] = { - "name": f"{session_hash}/{run}/{output_id}", - "is_stream": True, - } - return data - - async def process_api( - self, - fn_index: int, - inputs: list[Any], - state: dict[int, Any], - request: routes.Request | list[routes.Request] | None = None, - iterators: dict[int, Any] | None = None, - session_hash: str | None = None, - event_id: str | None = None, - event_data: EventData | None = None, - ) -> dict[str, Any]: - """ - Processes API calls from the frontend. First preprocesses the data, - then runs the relevant function, then postprocesses the output. - Parameters: - fn_index: Index of function to run. - inputs: input data received from the frontend - state: data stored from stateful components for session (key is input block id) - request: the gr.Request object containing information about the network request (e.g. IP address, headers, query parameters, username) - iterators: the in-progress iterators for each generator function (key is function index) - event_id: id of event that triggered this API call - event_data: data associated with the event trigger itself - Returns: None - """ - block_fn = self.fns[fn_index] - batch = self.dependencies[fn_index]["batch"] - - if batch: - max_batch_size = self.dependencies[fn_index]["max_batch_size"] - batch_sizes = [len(inp) for inp in inputs] - batch_size = batch_sizes[0] - if inspect.isasyncgenfunction(block_fn.fn) or inspect.isgeneratorfunction( - block_fn.fn - ): - raise ValueError("Gradio does not support generators in batch mode.") - if not all(x == batch_size for x in batch_sizes): - raise ValueError( - f"All inputs to a batch function must have the same length but instead have sizes: {batch_sizes}." - ) - if batch_size > max_batch_size: - raise ValueError( - f"Batch size ({batch_size}) exceeds the max_batch_size for this function ({max_batch_size})" - ) - - inputs = [ - self.preprocess_data(fn_index, list(i), state) for i in zip(*inputs) - ] - result = await self.call_function( - fn_index, list(zip(*inputs)), None, request, event_id, event_data - ) - preds = result["prediction"] - data = [ - self.postprocess_data(fn_index, list(o), state) for o in zip(*preds) - ] - data = list(zip(*data)) - is_generating, iterator = None, None - else: - inputs = self.preprocess_data(fn_index, inputs, state) - old_iterator = iterators.get(fn_index, None) if iterators else None - was_generating = old_iterator is not None - result = await self.call_function( - fn_index, inputs, old_iterator, request, event_id, event_data - ) - data = self.postprocess_data(fn_index, result["prediction"], state) - is_generating, iterator = result["is_generating"], result["iterator"] - if is_generating or was_generating: - data = self.handle_streaming_outputs( - fn_index, - data, - session_hash=session_hash, - run=id(old_iterator) if was_generating else id(iterator), - ) - - block_fn.total_runtime += result["duration"] - block_fn.total_runs += 1 - return { - "data": data, - "is_generating": is_generating, - "iterator": iterator, - "duration": result["duration"], - "average_duration": block_fn.total_runtime / block_fn.total_runs, - } - - async def create_limiter(self): - self.limiter = ( - None - if self.max_threads == 40 - else CapacityLimiter(total_tokens=self.max_threads) - ) - - def get_config(self): - return {"type": "column"} - - def get_config_file(self): - config = { - "version": routes.VERSION, - "mode": self.mode, - "dev_mode": self.dev_mode, - "analytics_enabled": self.analytics_enabled, - "components": [], - "css": self.css, - "title": self.title or "Gradio", - "space_id": self.space_id, - "enable_queue": getattr(self, "enable_queue", False), # launch attributes - "show_error": getattr(self, "show_error", False), - "show_api": self.show_api, - "is_colab": utils.colab_check(), - "stylesheets": self.stylesheets, - "theme": self.theme.name, - } - - def get_layout(block): - if not isinstance(block, BlockContext): - return {"id": block._id} - children_layout = [] - for child in block.children: - children_layout.append(get_layout(child)) - return {"id": block._id, "children": children_layout} - - config["layout"] = get_layout(self) - - for _id, block in self.blocks.items(): - props = block.get_config() if hasattr(block, "get_config") else {} - block_config = { - "id": _id, - "type": block.get_block_name(), - "props": utils.delete_none(props), - } - serializer = utils.get_serializer_name(block) - if serializer: - assert isinstance(block, serializing.Serializable) - block_config["serializer"] = serializer - block_config["api_info"] = block.api_info() # type: ignore - block_config["example_inputs"] = block.example_inputs() # type: ignore - config["components"].append(block_config) - config["dependencies"] = self.dependencies - return config - - def __enter__(self): - if Context.block is None: - Context.root_block = self - self.parent = Context.block - Context.block = self - self.exited = False - return self - - def __exit__(self, *args): - super().fill_expected_parents() - Context.block = self.parent - # Configure the load events before root_block is reset - self.attach_load_events() - if self.parent is None: - Context.root_block = None - else: - self.parent.children.extend(self.children) - self.config = self.get_config_file() - self.app = routes.App.create_app(self) - self.progress_tracking = any(block_fn.tracks_progress for block_fn in self.fns) - self.exited = True - - @class_or_instancemethod - def load( - self_or_cls, # noqa: N805 - fn: Callable | None = None, - inputs: list[Component] | None = None, - outputs: list[Component] | None = None, - api_name: str | None | Literal[False] = None, - scroll_to_output: bool = False, - show_progress: str = "full", - queue=None, - batch: bool = False, - max_batch_size: int = 4, - preprocess: bool = True, - postprocess: bool = True, - every: float | None = None, - _js: str | None = None, - *, - name: str | None = None, - src: str | None = None, - api_key: str | None = None, - alias: str | None = None, - **kwargs, - ) -> Blocks | dict[str, Any] | None: - """ - For reverse compatibility reasons, this is both a class method and an instance - method, the two of which, confusingly, do two completely different things. - - - Class method: loads a demo from a Hugging Face Spaces repo and creates it locally and returns a block instance. Warning: this method will be deprecated. Use the equivalent `gradio.load()` instead. - - - Instance method: adds event that runs as soon as the demo loads in the browser. Example usage below. - Parameters: - name: Class Method - the name of the model (e.g. "gpt2" or "facebook/bart-base") or space (e.g. "flax-community/spanish-gpt2"), can include the `src` as prefix (e.g. "models/facebook/bart-base") - src: Class Method - the source of the model: `models` or `spaces` (or leave empty if source is provided as a prefix in `name`) - api_key: Class Method - optional access token for loading private Hugging Face Hub models or spaces. Find your token here: https://huggingface.co/settings/tokens. Warning: only provide this if you are loading a trusted private Space as it can be read by the Space you are loading. - alias: Class Method - optional string used as the name of the loaded model instead of the default name (only applies if loading a Space running Gradio 2.x) - fn: Instance Method - the function to wrap an interface around. Often a machine learning model's prediction function. Each parameter of the function corresponds to one input component, and the function should return a single value or a tuple of values, with each element in the tuple corresponding to one output component. - inputs: Instance Method - List of gradio.components to use as inputs. If the function takes no inputs, this should be an empty list. - outputs: Instance Method - List of gradio.components to use as inputs. If the function returns no outputs, this should be an empty list. - api_name: Instance Method - Defines how the endpoint appears in the API docs. Can be a string, None, or False. If False, the endpoint will not be exposed in the api docs. If set to None, the endpoint will be exposed in the api docs as an unnamed endpoint, although this behavior will be changed in Gradio 4.0. If set to a string, the endpoint will be exposed in the api docs with the given name. - scroll_to_output: Instance Method - If True, will scroll to output component on completion - show_progress: Instance Method - If True, will show progress animation while pending - queue: Instance Method - If True, will place the request on the queue, if the queue exists - batch: Instance Method - If True, then the function should process a batch of inputs, meaning that it should accept a list of input values for each parameter. The lists should be of equal length (and be up to length `max_batch_size`). The function is then *required* to return a tuple of lists (even if there is only 1 output component), with each list in the tuple corresponding to one output component. - max_batch_size: Instance Method - Maximum number of inputs to batch together if this is called from the queue (only relevant if batch=True) - preprocess: Instance Method - If False, will not run preprocessing of component data before running 'fn' (e.g. leaving it as a base64 string if this method is called with the `Image` component). - postprocess: Instance Method - If False, will not run postprocessing of component data before returning 'fn' output to the browser. - every: Instance Method - Run this event 'every' number of seconds. Interpreted in seconds. Queue must be enabled. - Example: - import gradio as gr - import datetime - with gr.Blocks() as demo: - def get_time(): - return datetime.datetime.now().time() - dt = gr.Textbox(label="Current time") - demo.load(get_time, inputs=None, outputs=dt) - demo.launch() - """ - if isinstance(self_or_cls, type): - warn_deprecation( - "gr.Blocks.load() will be deprecated. Use gr.load() instead." - ) - if name is None: - raise ValueError( - "Blocks.load() requires passing parameters as keyword arguments" - ) - return external.load( - name=name, src=src, hf_token=api_key, alias=alias, **kwargs - ) - else: - from gradio.events import Dependency - - dep, dep_index = self_or_cls.set_event_trigger( - event_name="load", - fn=fn, - inputs=inputs, - outputs=outputs, - api_name=api_name, - preprocess=preprocess, - postprocess=postprocess, - scroll_to_output=scroll_to_output, - show_progress=show_progress, - js=_js, - queue=queue, - batch=batch, - max_batch_size=max_batch_size, - every=every, - no_target=True, - ) - return Dependency(self_or_cls, dep, dep_index) - - def clear(self): - """Resets the layout of the Blocks object.""" - self.blocks = {} - self.fns = [] - self.dependencies = [] - self.children = [] - return self - - @concurrency_count_warning - @document() - def queue( - self, - concurrency_count: int = 1, - status_update_rate: float | Literal["auto"] = "auto", - client_position_to_load_data: int | None = None, - default_enabled: bool | None = None, - api_open: bool = True, - max_size: int | None = None, - ): - """ - By enabling the queue you can control the rate of processed requests, let users know their position in the queue, and set a limit on maximum number of events allowed. - Parameters: - concurrency_count: Number of worker threads that will be processing requests from the queue concurrently. Increasing this number will increase the rate at which requests are processed, but will also increase the memory usage of the queue. - status_update_rate: If "auto", Queue will send status estimations to all clients whenever a job is finished. Otherwise Queue will send status at regular intervals set by this parameter as the number of seconds. - client_position_to_load_data: DEPRECATED. This parameter is deprecated and has no effect. - default_enabled: Deprecated and has no effect. - api_open: If True, the REST routes of the backend will be open, allowing requests made directly to those endpoints to skip the queue. - max_size: The maximum number of events the queue will store at any given moment. If the queue is full, new events will not be added and a user will receive a message saying that the queue is full. If None, the queue size will be unlimited. - Example: (Blocks) - with gr.Blocks() as demo: - button = gr.Button(label="Generate Image") - button.click(fn=image_generator, inputs=gr.Textbox(), outputs=gr.Image()) - demo.queue(max_size=10) - demo.launch() - Example: (Interface) - demo = gr.Interface(image_generator, gr.Textbox(), gr.Image()) - demo.queue(max_size=20) - demo.launch() - """ - if default_enabled is not None: - warn_deprecation( - "The default_enabled parameter of queue has no effect and will be removed " - "in a future version of gradio." - ) - self.enable_queue = True - self.api_open = api_open - if client_position_to_load_data is not None: - warn_deprecation( - "The client_position_to_load_data parameter is deprecated." - ) - if utils.is_zero_gpu_space(): - concurrency_count = self.max_threads - max_size = 1 if max_size is None else max_size - self._queue = queueing.Queue( - live_updates=status_update_rate == "auto", - concurrency_count=concurrency_count, - update_intervals=status_update_rate if status_update_rate != "auto" else 1, - max_size=max_size, - blocks_dependencies=self.dependencies, - ) - self.config = self.get_config_file() - self.app = routes.App.create_app(self) - return self - - def validate_queue_settings(self): - if not self.enable_queue and self.progress_tracking: - raise ValueError("Progress tracking requires queuing to be enabled.") - - for fn_index, dep in enumerate(self.dependencies): - if not self.enable_queue and self.queue_enabled_for_fn(fn_index): - raise ValueError( - f"The queue is enabled for event {dep['api_name'] if dep['api_name'] else fn_index} " - "but the queue has not been enabled for the app. Please call .queue() " - "on your app. Consult https://gradio.app/docs/#blocks-queue for information on how " - "to configure the queue." - ) - for i in dep["cancels"]: - if not self.queue_enabled_for_fn(i): - raise ValueError( - "Queue needs to be enabled! " - "You may get this error by either 1) passing a function that uses the yield keyword " - "into an interface without enabling the queue or 2) defining an event that cancels " - "another event without enabling the queue. Both can be solved by calling .queue() " - "before .launch()" - ) - if dep["batch"] and ( - dep["queue"] is False - or (dep["queue"] is None and not self.enable_queue) - ): - raise ValueError("In order to use batching, the queue must be enabled.") - - def launch( - self, - inline: bool | None = None, - inbrowser: bool = False, - share: bool | None = None, - debug: bool = False, - enable_queue: bool | None = None, - max_threads: int = 40, - auth: Callable | tuple[str, str] | list[tuple[str, str]] | None = None, - auth_message: str | None = None, - prevent_thread_lock: bool = False, - show_error: bool = False, - server_name: str | None = None, - server_port: int | None = None, - show_tips: bool = False, - height: int = 500, - width: int | str = "100%", - encrypt: bool | None = None, - favicon_path: str | None = None, - ssl_keyfile: str | None = None, - ssl_certfile: str | None = None, - ssl_keyfile_password: str | None = None, - ssl_verify: bool = True, - quiet: bool = False, - show_api: bool = True, - file_directories: list[str] | None = None, - allowed_paths: list[str] | None = None, - blocked_paths: list[str] | None = None, - root_path: str | None = None, - _frontend: bool = True, - app_kwargs: dict[str, Any] | None = None, - ) -> tuple[FastAPI, str, str]: - """ - Launches a simple web server that serves the demo. Can also be used to create a - public link used by anyone to access the demo from their browser by setting share=True. - - Parameters: - inline: whether to display in the interface inline in an iframe. Defaults to True in python notebooks; False otherwise. - inbrowser: whether to automatically launch the interface in a new tab on the default browser. - share: whether to create a publicly shareable link for the interface. Creates an SSH tunnel to make your UI accessible from anywhere. If not provided, it is set to False by default every time, except when running in Google Colab. When localhost is not accessible (e.g. Google Colab), setting share=False is not supported. - debug: if True, blocks the main thread from running. If running in Google Colab, this is needed to print the errors in the cell output. - auth: If provided, username and password (or list of username-password tuples) required to access interface. Can also provide function that takes username and password and returns True if valid login. - auth_message: If provided, HTML message provided on login page. - prevent_thread_lock: If True, the interface will block the main thread while the server is running. - show_error: If True, any errors in the interface will be displayed in an alert modal and printed in the browser console log - server_port: will start gradio app on this port (if available). Can be set by environment variable GRADIO_SERVER_PORT. If None, will search for an available port starting at 7860. - server_name: to make app accessible on local network, set this to "0.0.0.0". Can be set by environment variable GRADIO_SERVER_NAME. If None, will use "127.0.0.1". - show_tips: if True, will occasionally show tips about new Gradio features - enable_queue: DEPRECATED (use .queue() method instead.) if True, inference requests will be served through a queue instead of with parallel threads. Required for longer inference times (> 1min) to prevent timeout. The default option in HuggingFace Spaces is True. The default option elsewhere is False. - max_threads: the maximum number of total threads that the Gradio app can generate in parallel. The default is inherited from the starlette library (currently 40). Applies whether the queue is enabled or not. But if queuing is enabled, this parameter is increaseed to be at least the concurrency_count of the queue. - width: The width in pixels of the iframe element containing the interface (used if inline=True) - height: The height in pixels of the iframe element containing the interface (used if inline=True) - encrypt: DEPRECATED. Has no effect. - favicon_path: If a path to a file (.png, .gif, or .ico) is provided, it will be used as the favicon for the web page. - ssl_keyfile: If a path to a file is provided, will use this as the private key file to create a local server running on https. - ssl_certfile: If a path to a file is provided, will use this as the signed certificate for https. Needs to be provided if ssl_keyfile is provided. - ssl_keyfile_password: If a password is provided, will use this with the ssl certificate for https. - ssl_verify: If False, skips certificate validation which allows self-signed certificates to be used. - quiet: If True, suppresses most print statements. - show_api: If True, shows the api docs in the footer of the app. Default True. If the queue is enabled, then api_open parameter of .queue() will determine if the api docs are shown, independent of the value of show_api. - file_directories: This parameter has been renamed to `allowed_paths`. It will be removed in a future version. - allowed_paths: List of complete filepaths or parent directories that gradio is allowed to serve (in addition to the directory containing the gradio python file). Must be absolute paths. Warning: if you provide directories, any files in these directories or their subdirectories are accessible to all users of your app. - blocked_paths: List of complete filepaths or parent directories that gradio is not allowed to serve (i.e. users of your app are not allowed to access). Must be absolute paths. Warning: takes precedence over `allowed_paths` and all other directories exposed by Gradio by default. - root_path: The root path (or "mount point") of the application, if it's not served from the root ("/") of the domain. Often used when the application is behind a reverse proxy that forwards requests to the application. For example, if the application is served at "https://example.com/myapp", the `root_path` should be set to "/myapp". Can be set by environment variable GRADIO_ROOT_PATH. Defaults to "". - app_kwargs: Additional keyword arguments to pass to the underlying FastAPI app as a dictionary of parameter keys and argument values. For example, `{"docs_url": "/docs"}` - Returns: - app: FastAPI app object that is running the demo - local_url: Locally accessible link to the demo - share_url: Publicly accessible link to the demo (if share=True, otherwise None) - Example: (Blocks) - import gradio as gr - def reverse(text): - return text[::-1] - with gr.Blocks() as demo: - button = gr.Button(value="Reverse") - button.click(reverse, gr.Textbox(), gr.Textbox()) - demo.launch(share=True, auth=("username", "password")) - Example: (Interface) - import gradio as gr - def reverse(text): - return text[::-1] - demo = gr.Interface(reverse, "text", "text") - demo.launch(share=True, auth=("username", "password")) - """ - if not self.exited: - self.__exit__() - - self.dev_mode = False - if ( - auth - and not callable(auth) - and not isinstance(auth[0], tuple) - and not isinstance(auth[0], list) - ): - self.auth = [auth] - else: - self.auth = auth - self.auth_message = auth_message - self.show_tips = show_tips - self.show_error = show_error - self.height = height - self.width = width - self.favicon_path = favicon_path - self.ssl_verify = ssl_verify - if root_path is None: - self.root_path = os.environ.get("GRADIO_ROOT_PATH", "") - else: - self.root_path = root_path - - if enable_queue is not None: - self.enable_queue = enable_queue - warn_deprecation( - "The `enable_queue` parameter has been deprecated. " - "Please use the `.queue()` method instead.", - ) - if encrypt is not None: - warn_deprecation( - "The `encrypt` parameter has been deprecated and has no effect.", - ) - - if self.space_id: - self.enable_queue = self.enable_queue is not False - else: - self.enable_queue = self.enable_queue is True - if self.enable_queue and not hasattr(self, "_queue"): - self.queue() - self.show_api = self.api_open if self.enable_queue else show_api - - if file_directories is not None: - warn_deprecation( - "The `file_directories` parameter has been renamed to `allowed_paths`. " - "Please use that instead.", - ) - if allowed_paths is None: - allowed_paths = file_directories - self.allowed_paths = allowed_paths or [] - self.blocked_paths = blocked_paths or [] - - if not isinstance(self.allowed_paths, list): - raise ValueError("`allowed_paths` must be a list of directories.") - if not isinstance(self.blocked_paths, list): - raise ValueError("`blocked_paths` must be a list of directories.") - - self.validate_queue_settings() - - self.config = self.get_config_file() - self.max_threads = max( - self._queue.max_thread_count if self.enable_queue else 0, max_threads - ) - - if self.is_running: - assert isinstance( - self.local_url, str - ), f"Invalid local_url: {self.local_url}" - if not (quiet): - print( - "Rerunning server... use `close()` to stop if you need to change `launch()` parameters.\n----" - ) - else: - if wasm_utils.IS_WASM: - server_name = "xxx" - server_port = 99999 - local_url = "" - server = None - - # In the Wasm environment, we only need the app object - # which the frontend app will directly communicate with through the Worker API, - # and we don't need to start a server. - # So we just create the app object and register it here, - # and avoid using `networking.start_server` that would start a server that don't work in the Wasm env. - from gradio.routes import App - - app = App.create_app(self, app_kwargs=app_kwargs) - wasm_utils.register_app(app) - else: - ( - server_name, - server_port, - local_url, - app, - server, - ) = networking.start_server( - self, - server_name, - server_port, - ssl_keyfile, - ssl_certfile, - ssl_keyfile_password, - app_kwargs=app_kwargs, - ) - self.server_name = server_name - self.local_url = local_url - self.server_port = server_port - self.server_app = app - self.server = server - self.is_running = True - self.is_colab = utils.colab_check() - self.is_kaggle = utils.kaggle_check() - - self.protocol = ( - "https" - if self.local_url.startswith("https") or self.is_colab - else "http" - ) - if not wasm_utils.IS_WASM and not self.is_colab: - print( - strings.en["RUNNING_LOCALLY_SEPARATED"].format( - self.protocol, self.server_name, self.server_port - ) - ) - - if self.enable_queue: - self._queue.set_url(self.local_url) - - if not wasm_utils.IS_WASM: - # Cannot run async functions in background other than app's scope. - # Workaround by triggering the app endpoint - requests.get(f"{self.local_url}startup-events", verify=ssl_verify) - else: - pass - # TODO: Call the startup endpoint in the Wasm env too. - - utils.launch_counter() - self.is_sagemaker = utils.sagemaker_check() - if share is None: - if self.is_colab and self.enable_queue: - if not quiet: - print( - "Setting queue=True in a Colab notebook requires sharing enabled. Setting `share=True` (you can turn this off by setting `share=False` in `launch()` explicitly).\n" - ) - self.share = True - elif self.is_kaggle: - if not quiet: - print( - "Kaggle notebooks require sharing enabled. Setting `share=True` (you can turn this off by setting `share=False` in `launch()` explicitly).\n" - ) - self.share = True - elif self.is_sagemaker: - if not quiet: - print( - "Sagemaker notebooks may require sharing enabled. Setting `share=True` (you can turn this off by setting `share=False` in `launch()` explicitly).\n" - ) - self.share = True - else: - self.share = False - else: - self.share = share - - # If running in a colab or not able to access localhost, - # a shareable link must be created. - if ( - _frontend - and not wasm_utils.IS_WASM - and not networking.url_ok(self.local_url) - and not self.share - ): - raise ValueError( - "When localhost is not accessible, a shareable link must be created. Please set share=True or check your proxy settings to allow access to localhost." - ) - - if self.is_colab: - if not quiet: - if debug: - print(strings.en["COLAB_DEBUG_TRUE"]) - else: - print(strings.en["COLAB_DEBUG_FALSE"]) - if not self.share: - print(strings.en["COLAB_WARNING"].format(self.server_port)) - if self.enable_queue and not self.share: - raise ValueError( - "When using queueing in Colab, a shareable link must be created. Please set share=True." - ) - - if self.share: - if self.space_id: - raise RuntimeError("Share is not supported when you are in Spaces") - if wasm_utils.IS_WASM: - raise RuntimeError("Share is not supported in the Wasm environment") - try: - if self.share_url is None: - self.share_url = networking.setup_tunnel( - self.server_name, self.server_port, self.share_token - ) - print(strings.en["SHARE_LINK_DISPLAY"].format(self.share_url)) - if not (quiet): - print(strings.en["SHARE_LINK_MESSAGE"]) - except (RuntimeError, requests.exceptions.ConnectionError): - if self.analytics_enabled: - analytics.error_analytics("Not able to set up tunnel") - self.share_url = None - self.share = False - if Path(BINARY_PATH).exists(): - print(strings.en["COULD_NOT_GET_SHARE_LINK"]) - else: - print( - strings.en["COULD_NOT_GET_SHARE_LINK_MISSING_FILE"].format( - BINARY_PATH, - BINARY_URL, - BINARY_FILENAME, - BINARY_FOLDER, - ) - ) - else: - if not quiet and not wasm_utils.IS_WASM: - print(strings.en["PUBLIC_SHARE_TRUE"]) - self.share_url = None - - if inbrowser and not wasm_utils.IS_WASM: - link = self.share_url if self.share and self.share_url else self.local_url - webbrowser.open(link) - - # Check if running in a Python notebook in which case, display inline - if inline is None: - inline = utils.ipython_check() - if inline: - try: - from IPython.display import HTML, Javascript, display # type: ignore - - if self.share and self.share_url: - while not networking.url_ok(self.share_url): - time.sleep(0.25) - display( - HTML( - f'
      ' - ) - ) - elif self.is_colab: - # modified from /usr/local/lib/python3.7/dist-packages/google/colab/output/_util.py within Colab environment - code = """(async (port, path, width, height, cache, element) => { - if (!google.colab.kernel.accessAllowed && !cache) { - return; - } - element.appendChild(document.createTextNode('')); - const url = await google.colab.kernel.proxyPort(port, {cache}); - - const external_link = document.createElement('div'); - external_link.innerHTML = ` - - `; - element.appendChild(external_link); - - const iframe = document.createElement('iframe'); - iframe.src = new URL(path, url).toString(); - iframe.height = height; - iframe.allow = "autoplay; camera; microphone; clipboard-read; clipboard-write;" - iframe.width = width; - iframe.style.border = 0; - element.appendChild(iframe); - })""" + "({port}, {path}, {width}, {height}, {cache}, window.element)".format( - port=json.dumps(self.server_port), - path=json.dumps("/"), - width=json.dumps(self.width), - height=json.dumps(self.height), - cache=json.dumps(False), - ) - - display(Javascript(code)) - else: - display( - HTML( - f'
      ' - ) - ) - except ImportError: - pass - - if getattr(self, "analytics_enabled", False): - data = { - "launch_method": "browser" if inbrowser else "inline", - "is_google_colab": self.is_colab, - "is_sharing_on": self.share, - "share_url": self.share_url, - "enable_queue": self.enable_queue, - "show_tips": self.show_tips, - "server_name": server_name, - "server_port": server_port, - "is_space": self.space_id is not None, - "mode": self.mode, - } - analytics.launched_analytics(self, data) - - utils.show_tip(self) - - # Block main thread if debug==True - if debug or int(os.getenv("GRADIO_DEBUG", 0)) == 1 and not wasm_utils.IS_WASM: - self.block_thread() - # Block main thread if running in a script to stop script from exiting - is_in_interactive_mode = bool(getattr(sys, "ps1", sys.flags.interactive)) - - if ( - not prevent_thread_lock - and not is_in_interactive_mode - # In the Wasm env, we don't have to block the main thread because the server won't be shut down after the execution finishes. - # Moreover, we MUST NOT do it because there is only one thread in the Wasm env and blocking it will stop the subsequent code from running. - and not wasm_utils.IS_WASM - ): - self.block_thread() - - return TupleNoPrint((self.server_app, self.local_url, self.share_url)) - - def integrate( - self, - comet_ml=None, - wandb: ModuleType | None = None, - mlflow: ModuleType | None = None, - ) -> None: - """ - A catch-all method for integrating with other libraries. This method should be run after launch() - Parameters: - comet_ml: If a comet_ml Experiment object is provided, will integrate with the experiment and appear on Comet dashboard - wandb: If the wandb module is provided, will integrate with it and appear on WandB dashboard - mlflow: If the mlflow module is provided, will integrate with the experiment and appear on ML Flow dashboard - """ - analytics_integration = "" - if comet_ml is not None: - analytics_integration = "CometML" - comet_ml.log_other("Created from", "Gradio") - if self.share_url is not None: - comet_ml.log_text(f"gradio: {self.share_url}") - comet_ml.end() - elif self.local_url: - comet_ml.log_text(f"gradio: {self.local_url}") - comet_ml.end() - else: - raise ValueError("Please run `launch()` first.") - if wandb is not None: - analytics_integration = "WandB" - if self.share_url is not None: - wandb.log( - { - "Gradio panel": wandb.Html( - '' - ) - } - ) - else: - print( - "The WandB integration requires you to " - "`launch(share=True)` first." - ) - if mlflow is not None: - analytics_integration = "MLFlow" - if self.share_url is not None: - mlflow.log_param("Gradio Interface Share Link", self.share_url) - else: - mlflow.log_param("Gradio Interface Local Link", self.local_url) - if self.analytics_enabled and analytics_integration: - data = {"integration": analytics_integration} - analytics.integration_analytics(data) - - def close(self, verbose: bool = True) -> None: - """ - Closes the Interface that was launched and frees the port. - """ - try: - if self.enable_queue: - self._queue.close() - if self.server: - self.server.close() - self.is_running = False - # So that the startup events (starting the queue) - # happen the next time the app is launched - self.app.startup_events_triggered = False - if verbose: - print(f"Closing server running on port: {self.server_port}") - except (AttributeError, OSError): # can't close if not running - pass - - def block_thread( - self, - ) -> None: - """Block main thread until interrupted by user.""" - try: - while True: - time.sleep(0.1) - except (KeyboardInterrupt, OSError): - print("Keyboard interruption in main thread... closing server.") - if self.server: - self.server.close() - for tunnel in CURRENT_TUNNELS: - tunnel.kill() - - def attach_load_events(self): - """Add a load event for every component whose initial value should be randomized.""" - if Context.root_block: - for component in Context.root_block.blocks.values(): - if ( - isinstance(component, components.IOComponent) - and component.load_event_to_attach - ): - load_fn, every = component.load_event_to_attach - # Use set_event_trigger to avoid ambiguity between load class/instance method - dep = self.set_event_trigger( - "load", - load_fn, - None, - component, - no_target=True, - # If every is None, for sure skip the queue - # else, let the enable_queue parameter take precedence - # this will raise a nice error message is every is used - # without queue - queue=False if every is None else None, - every=every, - )[0] - component.load_event = dep - - def startup_events(self): - """Events that should be run when the app containing this block starts up.""" - - if self.enable_queue: - utils.run_coro_in_background(self._queue.start, self.ssl_verify) - # So that processing can resume in case the queue was stopped - self._queue.stopped = False - utils.run_coro_in_background(self.create_limiter) - - def queue_enabled_for_fn(self, fn_index: int): - if self.dependencies[fn_index]["queue"] is None: - return self.enable_queue - return self.dependencies[fn_index]["queue"] diff --git a/spaces/dcarpintero/nlp-summarizer-pegasus/.venv/lib/python3.9/site-packages/gradio/templates/cdn/assets/index-a44c805b.js b/spaces/dcarpintero/nlp-summarizer-pegasus/.venv/lib/python3.9/site-packages/gradio/templates/cdn/assets/index-a44c805b.js deleted file mode 100644 index 34a6296436061d480e6ff34e4ec6c87a395ed73c..0000000000000000000000000000000000000000 --- a/spaces/dcarpintero/nlp-summarizer-pegasus/.venv/lib/python3.9/site-packages/gradio/templates/cdn/assets/index-a44c805b.js +++ /dev/null @@ -1,7 +0,0 @@ -import{S,e as D,s as j,m as y,t as q,g as h,Y as u,h as b,j as H,x as T,n as k,k as v,I as N,Z as P,P as Y,y as Fe,ar as Ve,D as De,N as je,X as ne,p as B,b as se,B as x,o as p,K as Q,F as Z,G,w as M,u as A,H as K,C as We,f as ie,r as F,v as V,M as U,as as ae}from"./index-9e76ffee.js";import{B as Oe}from"./Button-30a08c0b.js";import{E as Ye}from"./Image-39fd5447.js";/* empty css */import{c as Ze}from"./csv-b0b7514a.js";import{d as Ge}from"./dsv-576afacd.js";import{E as Ke}from"./Model3d-e3d4c400.js";var Xe=Ge(" "),Je=Xe.parseRows;function Qe(s){let e,l;return{c(){e=y("div"),l=q(s[0]),h(e,"class","svelte-1ayixqk"),u(e,"table",s[1]==="table"),u(e,"gallery",s[1]==="gallery"),u(e,"selected",s[2])},m(t,n){b(t,e,n),H(e,l)},p(t,[n]){n&1&&T(l,t[0]),n&2&&u(e,"table",t[1]==="table"),n&2&&u(e,"gallery",t[1]==="gallery"),n&4&&u(e,"selected",t[2])},i:k,o:k,d(t){t&&v(e)}}}function Ue(s,e,l){let{value:t}=e,{type:n}=e,{selected:a=!1}=e;return s.$$set=i=>{"value"in i&&l(0,t=i.value),"type"in i&&l(1,n=i.type),"selected"in i&&l(2,a=i.selected)},[t,n,a]}class xe extends S{constructor(e){super(),D(this,e,Ue,Qe,j,{value:0,type:1,selected:2})}}function $e(s){let e,l;return{c(){e=y("div"),l=q(s[0]),h(e,"class","svelte-1ayixqk"),u(e,"table",s[1]==="table"),u(e,"gallery",s[1]==="gallery"),u(e,"selected",s[2])},m(t,n){b(t,e,n),H(e,l)},p(t,[n]){n&1&&T(l,t[0]),n&2&&u(e,"table",t[1]==="table"),n&2&&u(e,"gallery",t[1]==="gallery"),n&4&&u(e,"selected",t[2])},i:k,o:k,d(t){t&&v(e)}}}function el(s,e,l){let{value:t}=e,{type:n}=e,{selected:a=!1}=e;return s.$$set=i=>{"value"in i&&l(0,t=i.value),"type"in i&&l(1,n=i.type),"selected"in i&&l(2,a=i.selected)},[t,n,a]}class ll extends S{constructor(e){super(),D(this,e,el,$e,j,{value:0,type:1,selected:2})}}function tl(s){let e,l=s[0].toLocaleString()+"",t;return{c(){e=y("div"),t=q(l),h(e,"class","svelte-1ayixqk"),u(e,"table",s[1]==="table"),u(e,"gallery",s[1]==="gallery"),u(e,"selected",s[2])},m(n,a){b(n,e,a),H(e,t)},p(n,[a]){a&1&&l!==(l=n[0].toLocaleString()+"")&&T(t,l),a&2&&u(e,"table",n[1]==="table"),a&2&&u(e,"gallery",n[1]==="gallery"),a&4&&u(e,"selected",n[2])},i:k,o:k,d(n){n&&v(e)}}}function nl(s,e,l){let{value:t}=e,{type:n}=e,{selected:a=!1}=e;return s.$$set=i=>{"value"in i&&l(0,t=i.value),"type"in i&&l(1,n=i.type),"selected"in i&&l(2,a=i.selected)},[t,n,a]}class sl extends S{constructor(e){super(),D(this,e,nl,tl,j,{value:0,type:1,selected:2})}}function fe(s,e,l){const t=s.slice();return t[3]=e[l],t[5]=l,t}function ce(s){let e;return{c(){e=q(", ")},m(l,t){b(l,e,t)},d(l){l&&v(e)}}}function ue(s){let e=s[3].toLocaleString()+"",l,t,n=s[5]!==s[0].length-1&&ce();return{c(){l=q(e),n&&n.c(),t=Y()},m(a,i){b(a,l,i),n&&n.m(a,i),b(a,t,i)},p(a,i){i&1&&e!==(e=a[3].toLocaleString()+"")&&T(l,e),a[5]!==a[0].length-1?n||(n=ce(),n.c(),n.m(t.parentNode,t)):n&&(n.d(1),n=null)},d(a){a&&(v(l),v(t)),n&&n.d(a)}}}function il(s){let e,l=N(s[0]),t=[];for(let n=0;n{"value"in i&&l(0,t=i.value),"type"in i&&l(1,n=i.type),"selected"in i&&l(2,a=i.selected)},[t,n,a]}class fl extends S{constructor(e){super(),D(this,e,al,il,j,{value:0,type:1,selected:2})}}function cl(s){let e,l;return{c(){e=y("div"),l=q(s[0]),h(e,"class","svelte-1ayixqk"),u(e,"table",s[1]==="table"),u(e,"gallery",s[1]==="gallery"),u(e,"selected",s[2])},m(t,n){b(t,e,n),H(e,l)},p(t,[n]){n&1&&T(l,t[0]),n&2&&u(e,"table",t[1]==="table"),n&2&&u(e,"gallery",t[1]==="gallery"),n&4&&u(e,"selected",t[2])},i:k,o:k,d(t){t&&v(e)}}}function ul(s,e,l){let{value:t}=e,{type:n}=e,{selected:a=!1}=e;return s.$$set=i=>{"value"in i&&l(0,t=i.value),"type"in i&&l(1,n=i.type),"selected"in i&&l(2,a=i.selected)},[t,n,a]}class rl extends S{constructor(e){super(),D(this,e,ul,cl,j,{value:0,type:1,selected:2})}}function ol(s){let e,l;return{c(){e=y("div"),l=q(s[0]),h(e,"class","svelte-1ayixqk"),u(e,"table",s[1]==="table"),u(e,"gallery",s[1]==="gallery"),u(e,"selected",s[2])},m(t,n){b(t,e,n),H(e,l)},p(t,[n]){n&1&&T(l,t[0]),n&2&&u(e,"table",t[1]==="table"),n&2&&u(e,"gallery",t[1]==="gallery"),n&4&&u(e,"selected",t[2])},i:k,o:k,d(t){t&&v(e)}}}function _l(s,e,l){let{value:t}=e,{type:n}=e,{selected:a=!1}=e;return s.$$set=i=>{"value"in i&&l(0,t=i.value),"type"in i&&l(1,n=i.type),"selected"in i&&l(2,a=i.selected)},[t,n,a]}class dl extends S{constructor(e){super(),D(this,e,_l,ol,j,{value:0,type:1,selected:2})}}function ml(s){let e,l,t;return{c(){e=y("div"),l=q(s[0]),h(e,"class","svelte-1viwdyg"),Fe(()=>s[5].call(e)),u(e,"table",s[1]==="table"),u(e,"gallery",s[1]==="gallery"),u(e,"selected",s[2])},m(n,a){b(n,e,a),H(e,l),t=Ve(e,s[5].bind(e)),s[6](e)},p(n,[a]){a&1&&T(l,n[0]),a&2&&u(e,"table",n[1]==="table"),a&2&&u(e,"gallery",n[1]==="gallery"),a&4&&u(e,"selected",n[2])},i:k,o:k,d(n){n&&v(e),t(),s[6](null)}}}function hl(s,e,l){let{value:t}=e,{type:n}=e,{selected:a=!1}=e,i,f;function c(o,w){!o||!w||(f.style.setProperty("--local-text-width",`${w<150?w:200}px`),l(4,f.style.whiteSpace="unset",f))}De(()=>{c(f,i)});function _(){i=this.clientWidth,l(3,i)}function m(o){je[o?"unshift":"push"](()=>{f=o,l(4,f)})}return s.$$set=o=>{"value"in o&&l(0,t=o.value),"type"in o&&l(1,n=o.type),"selected"in o&&l(2,a=o.selected)},[t,n,a,i,f,_,m]}class gl extends S{constructor(e){super(),D(this,e,hl,ml,j,{value:0,type:1,selected:2})}}function bl(s){let e,l;return{c(){e=y("div"),l=q(s[0]),h(e,"class","svelte-1ayixqk"),u(e,"table",s[1]==="table"),u(e,"gallery",s[1]==="gallery"),u(e,"selected",s[2])},m(t,n){b(t,e,n),H(e,l)},p(t,[n]){n&1&&T(l,t[0]),n&2&&u(e,"table",t[1]==="table"),n&2&&u(e,"gallery",t[1]==="gallery"),n&4&&u(e,"selected",t[2])},i:k,o:k,d(t){t&&v(e)}}}function vl(s,e,l){let{value:t}=e,{type:n}=e,{selected:a=!1}=e;return s.$$set=i=>{"value"in i&&l(0,t=i.value),"type"in i&&l(1,n=i.type),"selected"in i&&l(2,a=i.selected)},[t,n,a]}class yl extends S{constructor(e){super(),D(this,e,vl,bl,j,{value:0,type:1,selected:2})}}function kl(s){let e,l,t,n;return{c(){e=y("video"),e.muted=!0,e.playsInline=!0,ne(e.src,l=s[3]+s[2])||h(e,"src",l),h(e,"class","svelte-1tntsc1"),u(e,"table",s[0]==="table"),u(e,"gallery",s[0]==="gallery"),u(e,"selected",s[1])},m(a,i){b(a,e,i),s[5](e),t||(n=[B(e,"mouseover",function(){se(s[4].play)&&s[4].play.apply(this,arguments)}),B(e,"mouseout",function(){se(s[4].pause)&&s[4].pause.apply(this,arguments)})],t=!0)},p(a,i){s=a,i&12&&!ne(e.src,l=s[3]+s[2])&&h(e,"src",l),i&1&&u(e,"table",s[0]==="table"),i&1&&u(e,"gallery",s[0]==="gallery"),i&2&&u(e,"selected",s[1])},d(a){a&&v(e),s[5](null),t=!1,x(n)}}}function wl(s){let e;function l(a,i){return kl}let n=l()(s);return{c(){n.c(),e=Y()},m(a,i){n.m(a,i),b(a,e,i)},p(a,[i]){n.p(a,i)},i:k,o:k,d(a){a&&v(e),n.d(a)}}}function Cl(s,e,l){let{type:t}=e,{selected:n=!1}=e,{value:a}=e,{samples_dir:i}=e,f;async function c(){l(4,f.muted=!0,f),l(4,f.playsInline=!0,f),l(4,f.controls=!1,f),f.setAttribute("muted",""),await f.play(),f.pause()}De(()=>{c()});function _(m){je[m?"unshift":"push"](()=>{f=m,l(4,f)})}return s.$$set=m=>{"type"in m&&l(0,t=m.type),"selected"in m&&l(1,n=m.selected),"value"in m&&l(2,a=m.value),"samples_dir"in m&&l(3,i=m.samples_dir)},[t,n,a,i,f,_]}class zl extends S{constructor(e){super(),D(this,e,Cl,wl,j,{type:0,selected:1,value:2,samples_dir:3})}}function Hl(s){let e,l=(Array.isArray(s[0])?s[0].join(", "):s[0])+"",t;return{c(){e=y("div"),t=q(l),h(e,"class","svelte-rgtszb"),u(e,"table",s[1]==="table"),u(e,"gallery",s[1]==="gallery"),u(e,"selected",s[2])},m(n,a){b(n,e,a),H(e,t)},p(n,[a]){a&1&&l!==(l=(Array.isArray(n[0])?n[0].join(", "):n[0])+"")&&T(t,l),a&2&&u(e,"table",n[1]==="table"),a&2&&u(e,"gallery",n[1]==="gallery"),a&4&&u(e,"selected",n[2])},i:k,o:k,d(n){n&&v(e)}}}function Ml(s,e,l){let{value:t}=e,{type:n}=e,{selected:a=!1}=e;return s.$$set=i=>{"value"in i&&l(0,t=i.value),"type"in i&&l(1,n=i.type),"selected"in i&&l(2,a=i.selected)},[t,n,a]}class ql extends S{constructor(e){super(),D(this,e,Ml,Hl,j,{value:0,type:1,selected:2})}}function re(s,e,l){const t=s.slice();return t[10]=e[l],t[12]=l,t}function oe(s,e,l){const t=s.slice();return t[13]=e[l],t[15]=l,t}function _e(s){let e,l,t;function n(f,c){return typeof f[6]=="string"?Sl:Al}let a=n(s),i=a(s);return{c(){e=y("div"),i.c(),h(e,"class","svelte-1cib1xd"),u(e,"table",s[1]==="table"),u(e,"gallery",s[1]==="gallery"),u(e,"selected",s[2])},m(f,c){b(f,e,c),i.m(e,null),l||(t=[B(e,"mouseenter",s[8]),B(e,"mouseleave",s[9])],l=!0)},p(f,c){a===(a=n(f))&&i?i.p(f,c):(i.d(1),i=a(f),i&&(i.c(),i.m(e,null))),c&2&&u(e,"table",f[1]==="table"),c&2&&u(e,"gallery",f[1]==="gallery"),c&4&&u(e,"selected",f[2])},d(f){f&&v(e),i.d(),l=!1,x(t)}}}function Al(s){let e,l,t=N(s[6].slice(0,3)),n=[];for(let i=0;i3&&ge(s);return{c(){e=y("table");for(let i=0;i3?a?a.p(i,f):(a=ge(i),a.c(),a.m(e,null)):a&&(a.d(1),a=null)},d(i){i&&v(e),P(n,i),a&&a.d()}}}function Sl(s){let e;return{c(){e=q(s[6])},m(l,t){b(l,e,t)},p(l,t){t&64&&T(e,l[6])},d(l){l&&v(e)}}}function de(s){let e,l=s[13]+"",t;return{c(){e=y("td"),t=q(l),h(e,"class","svelte-1cib1xd")},m(n,a){b(n,e,a),H(e,t)},p(n,a){a&64&&l!==(l=n[13]+"")&&T(t,l)},d(n){n&&v(e)}}}function me(s){let e;return{c(){e=y("td"),e.textContent="…",h(e,"class","svelte-1cib1xd")},m(l,t){b(l,e,t)},d(l){l&&v(e)}}}function he(s){let e,l,t=N(s[10].slice(0,3)),n=[];for(let i=0;i3&&me();return{c(){e=y("tr");for(let i=0;i3?a||(a=me(),a.c(),a.m(e,null)):a&&(a.d(1),a=null)},d(i){i&&v(e),P(n,i),a&&a.d()}}}function ge(s){let e;return{c(){e=y("div"),h(e,"class","overlay svelte-1cib1xd"),u(e,"odd",s[3]%2!=0),u(e,"even",s[3]%2==0),u(e,"button",s[1]==="gallery")},m(l,t){b(l,e,t)},p(l,t){t&8&&u(e,"odd",l[3]%2!=0),t&8&&u(e,"even",l[3]%2==0),t&2&&u(e,"button",l[1]==="gallery")},d(l){l&&v(e)}}}function Dl(s){let e,l=s[4]&&_e(s);return{c(){l&&l.c(),e=Y()},m(t,n){l&&l.m(t,n),b(t,e,n)},p(t,[n]){t[4]?l?l.p(t,n):(l=_e(t),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},i:k,o:k,d(t){t&&v(e),l&&l.d(t)}}}function jl(s,e,l){let{value:t}=e,{samples_dir:n}=e,{type:a}=e,{selected:i=!1}=e,{index:f}=e,c=!1,_=t,m=Array.isArray(_);const o=()=>l(5,c=!0),w=()=>l(5,c=!1);return s.$$set=r=>{"value"in r&&l(0,t=r.value),"samples_dir"in r&&l(7,n=r.samples_dir),"type"in r&&l(1,a=r.type),"selected"in r&&l(2,i=r.selected),"index"in r&&l(3,f=r.index)},s.$$.update=()=>{s.$$.dirty&145&&!m&&typeof t=="string"&&/\.[a-zA-Z]+$/.test(t)&&fetch(n+t).then(r=>r.text()).then(r=>{try{if(t.endsWith("csv")){const C=r.split(` -`).slice(0,4).map(d=>d.split(",").slice(0,4).join(",")).join(` -`);l(6,_=Ze(C))}else if(t.endsWith("tsv")){const C=r.split(` -`).slice(0,4).map(d=>d.split(" ").slice(0,4).join(" ")).join(` -`);l(6,_=Je(C))}else throw new Error("Incorrect format, only CSV and TSV files are supported");l(4,m=!0)}catch(C){console.error(C)}}).catch(r=>{l(6,_=t),l(4,m=!0)})},[t,a,i,f,m,c,_,n,o,w]}class Nl extends S{constructor(e){super(),D(this,e,jl,Dl,j,{value:0,samples_dir:7,type:1,selected:2,index:3})}}function Tl(s){let e;return{c(){e=y("div"),Q(e,"background-color",s[0]),h(e,"class","svelte-h6ogpl"),u(e,"table",s[1]==="table"),u(e,"gallery",s[1]==="gallery"),u(e,"selected",s[2])},m(l,t){b(l,e,t)},p(l,[t]){t&1&&Q(e,"background-color",l[0]),t&2&&u(e,"table",l[1]==="table"),t&2&&u(e,"gallery",l[1]==="gallery"),t&4&&u(e,"selected",l[2])},i:k,o:k,d(l){l&&v(e)}}}function El(s,e,l){let{value:t}=e,{type:n}=e,{selected:a=!1}=e;return s.$$set=i=>{"value"in i&&l(0,t=i.value),"type"in i&&l(1,n=i.type),"selected"in i&&l(2,a=i.selected)},[t,n,a]}class Ll extends S{constructor(e){super(),D(this,e,El,Tl,j,{value:0,type:1,selected:2})}}function Bl(s){let e,l;return{c(){e=y("div"),l=q(s[0]),h(e,"class","svelte-1ayixqk"),u(e,"table",s[1]==="table"),u(e,"gallery",s[1]==="gallery"),u(e,"selected",s[2])},m(t,n){b(t,e,n),H(e,l)},p(t,[n]){n&1&&T(l,t[0]),n&2&&u(e,"table",t[1]==="table"),n&2&&u(e,"gallery",t[1]==="gallery"),n&4&&u(e,"selected",t[2])},i:k,o:k,d(t){t&&v(e)}}}function pl(s,e,l){let{value:t}=e,{type:n}=e,{selected:a=!1}=e;return s.$$set=i=>{"value"in i&&l(0,t=i.value),"type"in i&&l(1,n=i.type),"selected"in i&&l(2,a=i.selected)},[t,n,a]}class Rl extends S{constructor(e){super(),D(this,e,pl,Bl,j,{value:0,type:1,selected:2})}}function Il(s){let e;return{c(){e=y("div"),h(e,"class","prose svelte-1ayixqk"),u(e,"table",s[1]==="table"),u(e,"gallery",s[1]==="gallery"),u(e,"selected",s[2])},m(l,t){b(l,e,t),e.innerHTML=s[0]},p(l,[t]){t&1&&(e.innerHTML=l[0]),t&2&&u(e,"table",l[1]==="table"),t&2&&u(e,"gallery",l[1]==="gallery"),t&4&&u(e,"selected",l[2])},i:k,o:k,d(l){l&&v(e)}}}function Pl(s,e,l){let{value:t}=e,{type:n}=e,{selected:a=!1}=e;return s.$$set=i=>{"value"in i&&l(0,t=i.value),"type"in i&&l(1,n=i.type),"selected"in i&&l(2,a=i.selected)},[t,n,a]}class Fl extends S{constructor(e){super(),D(this,e,Pl,Il,j,{value:0,type:1,selected:2})}}function Vl(s){let e;return{c(){e=y("div"),h(e,"class","prose svelte-zvfedn"),u(e,"table",s[1]==="table"),u(e,"gallery",s[1]==="gallery"),u(e,"selected",s[2])},m(l,t){b(l,e,t),e.innerHTML=s[0]},p(l,[t]){t&1&&(e.innerHTML=l[0]),t&2&&u(e,"table",l[1]==="table"),t&2&&u(e,"gallery",l[1]==="gallery"),t&4&&u(e,"selected",l[2])},i:k,o:k,d(l){l&&v(e)}}}function Wl(s,e,l){let{value:t}=e,{type:n}=e,{selected:a=!1}=e;return s.$$set=i=>{"value"in i&&l(0,t=i.value),"type"in i&&l(1,n=i.type),"selected"in i&&l(2,a=i.selected)},[t,n,a]}class Ol extends S{constructor(e){super(),D(this,e,Wl,Vl,j,{value:0,type:1,selected:2})}}function Yl(s){let e,l;return{c(){e=y("pre"),l=q(s[0]),h(e,"class","svelte-agpzo2"),u(e,"table",s[1]==="table"),u(e,"gallery",s[1]==="gallery"),u(e,"selected",s[2])},m(t,n){b(t,e,n),H(e,l)},p(t,[n]){n&1&&T(l,t[0]),n&2&&u(e,"table",t[1]==="table"),n&2&&u(e,"gallery",t[1]==="gallery"),n&4&&u(e,"selected",t[2])},i:k,o:k,d(t){t&&v(e)}}}function Zl(s,e,l){let{value:t}=e,{type:n}=e,{selected:a=!1}=e;return s.$$set=i=>{"value"in i&&l(0,t=i.value),"type"in i&&l(1,n=i.type),"selected"in i&&l(2,a=i.selected)},[t,n,a]}class Gl extends S{constructor(e){super(),D(this,e,Zl,Yl,j,{value:0,type:1,selected:2})}}const O={dropdown:ll,checkbox:sl,checkboxgroup:fl,number:xe,slider:rl,radio:dl,image:Ye,textbox:gl,audio:yl,video:zl,file:ql,dataframe:Nl,model3d:Ke,colorpicker:Ll,timeseries:Rl,markdown:Fl,html:Ol,code:Gl};function be(s,e,l){const t=s.slice();return t[32]=e[l],t}function ve(s,e,l){const t=s.slice();return t[35]=e[l],t[37]=l,t}function ye(s,e,l){const t=s.slice();t[0]=e[l].value,t[39]=e[l].component,t[42]=l;const n=t[1][t[42]];return t[40]=n,t}function ke(s,e,l){const t=s.slice();return t[43]=e[l],t}function we(s,e,l){const t=s.slice();return t[35]=e[l],t[37]=l,t}function Kl(s){let e,l,t,n,a,i,f,c=N(s[3]),_=[];for(let r=0;rA(o[r],1,1,()=>{o[r]=null});return{c(){e=y("div"),l=y("table"),t=y("thead"),n=y("tr");for(let r=0;r<_.length;r+=1)_[r].c();a=p(),i=y("tbody");for(let r=0;rA(n[i],1,1,()=>{n[i]=null});return{c(){e=y("div");for(let i=0;i{K(m,1)}),V()}a?(l=U(a,i(f)),Z(l.$$.fragment),M(l.$$.fragment,1),G(l,e,null)):l=null}else a&&l.$set(_);(!n||c[0]&2)&&Q(e,"max-width",f[40]==="textbox"?"35ch":"auto"),(!n||c[0]&2&&t!==(t=ae(f[40])+" svelte-13hsdno"))&&h(e,"class",t)},i(f){n||(l&&M(l.$$.fragment,f),n=!0)},o(f){l&&A(l.$$.fragment,f),n=!1},d(f){f&&v(e),l&&K(l)}}}function He(s){let e,l,t=s[40]!==void 0&&O[s[40]]!==void 0&&ze(s);return{c(){t&&t.c(),e=Y()},m(n,a){t&&t.m(n,a),b(n,e,a),l=!0},p(n,a){n[40]!==void 0&&O[n[40]]!==void 0?t?(t.p(n,a),a[0]&2&&M(t,1)):(t=ze(n),t.c(),M(t,1),t.m(e.parentNode,e)):t&&(F(),A(t,1,1,()=>{t=null}),V())},i(n){l||(M(t),l=!0)},o(n){A(t),l=!1},d(n){n&&v(e),t&&t.d(n)}}}function Me(s){let e,l,t,n,a,i=N(s[35]),f=[];for(let o=0;oA(f[o],1,1,()=>{f[o]=null});function _(){return s[28](s[37])}function m(){return s[29](s[37])}return{c(){e=y("tr");for(let o=0;o{K(_,1)}),V()}n?(e=U(n,a(i)),Z(e.$$.fragment),M(e.$$.fragment,1),G(e,l.parentNode,l)):e=null}else n&&e.$set(c)},i(i){t||(e&&M(e.$$.fragment,i),t=!0)},o(i){e&&A(e.$$.fragment,i),t=!1},d(i){i&&v(l),e&&K(e,i)}}}function Ae(s){let e,l=Object.keys(O).includes(s[1][0])&&O[s[1][0]],t,n,a,i,f=l&&qe(s);function c(){return s[25](s[37],s[35])}function _(){return s[26](s[37])}return{c(){e=y("button"),f&&f.c(),t=p(),h(e,"class","gallery-item svelte-13hsdno")},m(m,o){b(m,e,o),f&&f.m(e,null),H(e,t),n=!0,a||(i=[B(e,"click",c),B(e,"mouseenter",_),B(e,"mouseleave",s[27])],a=!0)},p(m,o){s=m,o[0]&2&&(l=Object.keys(O).includes(s[1][0])&&O[s[1][0]]),l?f?(f.p(s,o),o[0]&2&&M(f,1)):(f=qe(s),f.c(),M(f,1),f.m(e,t)):f&&(F(),A(f,1,1,()=>{f=null}),V())},i(m){n||(M(f),n=!0)},o(m){A(f),n=!1},d(m){m&&v(e),f&&f.d(),a=!1,x(i)}}}function Jl(s){let e,l,t=N(s[12]),n=[];for(let a=0;a{r[R]=null}),V(),c=r[f],c?c.p(z,E):(c=r[f]=w[f](z),c.c()),M(c,1),c.m(_.parentNode,_)),z[18]&&d.p(z,E)},i(z){o||(M(c),o=!0)},o(z){A(c),o=!1},d(z){z&&(v(e),v(i),v(_),v(m)),r[f].d(z),d&&d.d(z)}}}function $l(s){let e,l;return e=new Oe({props:{visible:s[6],padding:!1,elem_id:s[4],elem_classes:s[5],scale:s[8],min_width:s[9],allow_overflow:!1,container:!1,$$slots:{default:[xl]},$$scope:{ctx:s}}}),{c(){Z(e.$$.fragment)},m(t,n){G(e,t,n),l=!0},p(t,n){const a={};n[0]&64&&(a.visible=t[6]),n[0]&16&&(a.elem_id=t[4]),n[0]&32&&(a.elem_classes=t[5]),n[0]&256&&(a.scale=t[8]),n[0]&512&&(a.min_width=t[9]),n[0]&64655|n[1]&32768&&(a.$$scope={dirty:n,ctx:t}),e.$set(a)},i(t){l||(M(e.$$.fragment,t),l=!0)},o(t){A(e.$$.fragment,t),l=!1},d(t){K(e,t)}}}function et(s,e,l){let t,n,{components:a}=e,{label:i="Examples"}=e,{headers:f}=e,{samples:c}=e,{elem_id:_=""}=e,{elem_classes:m=[]}=e,{visible:o=!0}=e,{value:w=null}=e,{root:r}=e,{root_url:C}=e,{samples_per_page:d=10}=e,{scale:z=null}=e,{min_width:E=void 0}=e;const R=We();let Ne=C?"proxy="+C+"file=":r+"/file=",W=0,te=c.length>d,X,J,I=[],$=-1;function ee(g){l(13,$=g)}function le(){l(13,$=-1)}const Te=(g,L)=>{l(0,w=g+W*d),R("click",w),R("select",{index:w,value:L})},Ee=g=>ee(g),Le=()=>le(),Be=g=>{l(0,w=g+W*d),R("click",w)},pe=g=>ee(g),Re=()=>le(),Ie=g=>l(10,W=g);return s.$$set=g=>{"components"in g&&l(1,a=g.components),"label"in g&&l(2,i=g.label),"headers"in g&&l(3,f=g.headers),"samples"in g&&l(21,c=g.samples),"elem_id"in g&&l(4,_=g.elem_id),"elem_classes"in g&&l(5,m=g.elem_classes),"visible"in g&&l(6,o=g.visible),"value"in g&&l(0,w=g.value),"root"in g&&l(22,r=g.root),"root_url"in g&&l(23,C=g.root_url),"samples_per_page"in g&&l(7,d=g.samples_per_page),"scale"in g&&l(8,z=g.scale),"min_width"in g&&l(9,E=g.min_width)},s.$$.update=()=>{s.$$.dirty[0]&2&&l(15,t=a.length<2),s.$$.dirty[0]&18879616&&(te?(l(12,I=[]),l(11,X=c.slice(W*d,(W+1)*d)),l(24,J=Math.ceil(c.length/d)),[0,W,J-1].forEach(g=>{for(let L=g-2;L<=g+2;L++)L>=0&&L0&&L-I[I.length-1]>1&&I.push(-1),I.push(L))})):l(11,X=c.slice())),s.$$.dirty[0]&2050&&l(14,n=X.map(g=>g.map((L,Pe)=>({value:L,component:O[a[Pe]]}))))},[w,a,i,f,_,m,o,d,z,E,W,X,I,$,n,t,R,Ne,te,ee,le,c,r,C,J,Te,Ee,Le,Be,pe,Re,Ie]}class lt extends S{constructor(e){super(),D(this,e,et,$l,j,{components:1,label:2,headers:3,samples:21,elem_id:4,elem_classes:5,visible:6,value:0,root:22,root_url:23,samples_per_page:7,scale:8,min_width:9},null,[-1,-1])}}const ut=lt,rt=["dynamic"];export{ut as Component,rt as modes}; -//# sourceMappingURL=index-a44c805b.js.map diff --git a/spaces/dcarpintero/nlp-summarizer-pegasus/.venv/lib/python3.9/site-packages/idna/uts46data.py b/spaces/dcarpintero/nlp-summarizer-pegasus/.venv/lib/python3.9/site-packages/idna/uts46data.py deleted file mode 100644 index 186796c17b25c1e766112ef4d9f16bb2dea4b306..0000000000000000000000000000000000000000 --- a/spaces/dcarpintero/nlp-summarizer-pegasus/.venv/lib/python3.9/site-packages/idna/uts46data.py +++ /dev/null @@ -1,8600 +0,0 @@ -# This file is automatically generated by tools/idna-data -# vim: set fileencoding=utf-8 : - -from typing import List, Tuple, Union - - -"""IDNA Mapping Table from UTS46.""" - - -__version__ = '15.0.0' -def _seg_0() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x0, '3'), - (0x1, '3'), - (0x2, '3'), - (0x3, '3'), - (0x4, '3'), - (0x5, '3'), - (0x6, '3'), - (0x7, '3'), - (0x8, '3'), - (0x9, '3'), - (0xA, '3'), - (0xB, '3'), - (0xC, '3'), - (0xD, '3'), - (0xE, '3'), - (0xF, '3'), - (0x10, '3'), - (0x11, '3'), - (0x12, '3'), - (0x13, '3'), - (0x14, '3'), - (0x15, '3'), - (0x16, '3'), - (0x17, '3'), - (0x18, '3'), - (0x19, '3'), - (0x1A, '3'), - (0x1B, '3'), - (0x1C, '3'), - (0x1D, '3'), - (0x1E, '3'), - (0x1F, '3'), - (0x20, '3'), - (0x21, '3'), - (0x22, '3'), - (0x23, '3'), - (0x24, '3'), - (0x25, '3'), - (0x26, '3'), - (0x27, '3'), - (0x28, '3'), - (0x29, '3'), - (0x2A, '3'), - (0x2B, '3'), - (0x2C, '3'), - (0x2D, 'V'), - (0x2E, 'V'), - (0x2F, '3'), - (0x30, 'V'), - (0x31, 'V'), - (0x32, 'V'), - (0x33, 'V'), - (0x34, 'V'), - (0x35, 'V'), - (0x36, 'V'), - (0x37, 'V'), - (0x38, 'V'), - (0x39, 'V'), - (0x3A, '3'), - (0x3B, '3'), - (0x3C, '3'), - (0x3D, '3'), - (0x3E, '3'), - (0x3F, '3'), - (0x40, '3'), - (0x41, 'M', 'a'), - (0x42, 'M', 'b'), - (0x43, 'M', 'c'), - (0x44, 'M', 'd'), - (0x45, 'M', 'e'), - (0x46, 'M', 'f'), - (0x47, 'M', 'g'), - (0x48, 'M', 'h'), - (0x49, 'M', 'i'), - (0x4A, 'M', 'j'), - (0x4B, 'M', 'k'), - (0x4C, 'M', 'l'), - (0x4D, 'M', 'm'), - (0x4E, 'M', 'n'), - (0x4F, 'M', 'o'), - (0x50, 'M', 'p'), - (0x51, 'M', 'q'), - (0x52, 'M', 'r'), - (0x53, 'M', 's'), - (0x54, 'M', 't'), - (0x55, 'M', 'u'), - (0x56, 'M', 'v'), - (0x57, 'M', 'w'), - (0x58, 'M', 'x'), - (0x59, 'M', 'y'), - (0x5A, 'M', 'z'), - (0x5B, '3'), - (0x5C, '3'), - (0x5D, '3'), - (0x5E, '3'), - (0x5F, '3'), - (0x60, '3'), - (0x61, 'V'), - (0x62, 'V'), - (0x63, 'V'), - ] - -def _seg_1() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x64, 'V'), - (0x65, 'V'), - (0x66, 'V'), - (0x67, 'V'), - (0x68, 'V'), - (0x69, 'V'), - (0x6A, 'V'), - (0x6B, 'V'), - (0x6C, 'V'), - (0x6D, 'V'), - (0x6E, 'V'), - (0x6F, 'V'), - (0x70, 'V'), - (0x71, 'V'), - (0x72, 'V'), - (0x73, 'V'), - (0x74, 'V'), - (0x75, 'V'), - (0x76, 'V'), - (0x77, 'V'), - (0x78, 'V'), - (0x79, 'V'), - (0x7A, 'V'), - (0x7B, '3'), - (0x7C, '3'), - (0x7D, '3'), - (0x7E, '3'), - (0x7F, '3'), - (0x80, 'X'), - (0x81, 'X'), - (0x82, 'X'), - (0x83, 'X'), - (0x84, 'X'), - (0x85, 'X'), - (0x86, 'X'), - (0x87, 'X'), - (0x88, 'X'), - (0x89, 'X'), - (0x8A, 'X'), - (0x8B, 'X'), - (0x8C, 'X'), - (0x8D, 'X'), - (0x8E, 'X'), - (0x8F, 'X'), - (0x90, 'X'), - (0x91, 'X'), - (0x92, 'X'), - (0x93, 'X'), - (0x94, 'X'), - (0x95, 'X'), - (0x96, 'X'), - (0x97, 'X'), - (0x98, 'X'), - (0x99, 'X'), - (0x9A, 'X'), - (0x9B, 'X'), - (0x9C, 'X'), - (0x9D, 'X'), - (0x9E, 'X'), - (0x9F, 'X'), - (0xA0, '3', ' '), - (0xA1, 'V'), - (0xA2, 'V'), - (0xA3, 'V'), - (0xA4, 'V'), - (0xA5, 'V'), - (0xA6, 'V'), - (0xA7, 'V'), - (0xA8, '3', ' ̈'), - (0xA9, 'V'), - (0xAA, 'M', 'a'), - (0xAB, 'V'), - (0xAC, 'V'), - (0xAD, 'I'), - (0xAE, 'V'), - (0xAF, '3', ' ̄'), - (0xB0, 'V'), - (0xB1, 'V'), - (0xB2, 'M', '2'), - (0xB3, 'M', '3'), - (0xB4, '3', ' ́'), - (0xB5, 'M', 'μ'), - (0xB6, 'V'), - (0xB7, 'V'), - (0xB8, '3', ' ̧'), - (0xB9, 'M', '1'), - (0xBA, 'M', 'o'), - (0xBB, 'V'), - (0xBC, 'M', '1⁄4'), - (0xBD, 'M', '1⁄2'), - (0xBE, 'M', '3⁄4'), - (0xBF, 'V'), - (0xC0, 'M', 'à'), - (0xC1, 'M', 'á'), - (0xC2, 'M', 'â'), - (0xC3, 'M', 'ã'), - (0xC4, 'M', 'ä'), - (0xC5, 'M', 'å'), - (0xC6, 'M', 'æ'), - (0xC7, 'M', 'ç'), - ] - -def _seg_2() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0xC8, 'M', 'è'), - (0xC9, 'M', 'é'), - (0xCA, 'M', 'ê'), - (0xCB, 'M', 'ë'), - (0xCC, 'M', 'ì'), - (0xCD, 'M', 'í'), - (0xCE, 'M', 'î'), - (0xCF, 'M', 'ï'), - (0xD0, 'M', 'ð'), - (0xD1, 'M', 'ñ'), - (0xD2, 'M', 'ò'), - (0xD3, 'M', 'ó'), - (0xD4, 'M', 'ô'), - (0xD5, 'M', 'õ'), - (0xD6, 'M', 'ö'), - (0xD7, 'V'), - (0xD8, 'M', 'ø'), - (0xD9, 'M', 'ù'), - (0xDA, 'M', 'ú'), - (0xDB, 'M', 'û'), - (0xDC, 'M', 'ü'), - (0xDD, 'M', 'ý'), - (0xDE, 'M', 'þ'), - (0xDF, 'D', 'ss'), - (0xE0, 'V'), - (0xE1, 'V'), - (0xE2, 'V'), - (0xE3, 'V'), - (0xE4, 'V'), - (0xE5, 'V'), - (0xE6, 'V'), - (0xE7, 'V'), - (0xE8, 'V'), - (0xE9, 'V'), - (0xEA, 'V'), - (0xEB, 'V'), - (0xEC, 'V'), - (0xED, 'V'), - (0xEE, 'V'), - (0xEF, 'V'), - (0xF0, 'V'), - (0xF1, 'V'), - (0xF2, 'V'), - (0xF3, 'V'), - (0xF4, 'V'), - (0xF5, 'V'), - (0xF6, 'V'), - (0xF7, 'V'), - (0xF8, 'V'), - (0xF9, 'V'), - (0xFA, 'V'), - (0xFB, 'V'), - (0xFC, 'V'), - (0xFD, 'V'), - (0xFE, 'V'), - (0xFF, 'V'), - (0x100, 'M', 'ā'), - (0x101, 'V'), - (0x102, 'M', 'ă'), - (0x103, 'V'), - (0x104, 'M', 'ą'), - (0x105, 'V'), - (0x106, 'M', 'ć'), - (0x107, 'V'), - (0x108, 'M', 'ĉ'), - (0x109, 'V'), - (0x10A, 'M', 'ċ'), - (0x10B, 'V'), - (0x10C, 'M', 'č'), - (0x10D, 'V'), - (0x10E, 'M', 'ď'), - (0x10F, 'V'), - (0x110, 'M', 'đ'), - (0x111, 'V'), - (0x112, 'M', 'ē'), - (0x113, 'V'), - (0x114, 'M', 'ĕ'), - (0x115, 'V'), - (0x116, 'M', 'ė'), - (0x117, 'V'), - (0x118, 'M', 'ę'), - (0x119, 'V'), - (0x11A, 'M', 'ě'), - (0x11B, 'V'), - (0x11C, 'M', 'ĝ'), - (0x11D, 'V'), - (0x11E, 'M', 'ğ'), - (0x11F, 'V'), - (0x120, 'M', 'ġ'), - (0x121, 'V'), - (0x122, 'M', 'ģ'), - (0x123, 'V'), - (0x124, 'M', 'ĥ'), - (0x125, 'V'), - (0x126, 'M', 'ħ'), - (0x127, 'V'), - (0x128, 'M', 'ĩ'), - (0x129, 'V'), - (0x12A, 'M', 'ī'), - (0x12B, 'V'), - ] - -def _seg_3() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x12C, 'M', 'ĭ'), - (0x12D, 'V'), - (0x12E, 'M', 'į'), - (0x12F, 'V'), - (0x130, 'M', 'i̇'), - (0x131, 'V'), - (0x132, 'M', 'ij'), - (0x134, 'M', 'ĵ'), - (0x135, 'V'), - (0x136, 'M', 'ķ'), - (0x137, 'V'), - (0x139, 'M', 'ĺ'), - (0x13A, 'V'), - (0x13B, 'M', 'ļ'), - (0x13C, 'V'), - (0x13D, 'M', 'ľ'), - (0x13E, 'V'), - (0x13F, 'M', 'l·'), - (0x141, 'M', 'ł'), - (0x142, 'V'), - (0x143, 'M', 'ń'), - (0x144, 'V'), - (0x145, 'M', 'ņ'), - (0x146, 'V'), - (0x147, 'M', 'ň'), - (0x148, 'V'), - (0x149, 'M', 'ʼn'), - (0x14A, 'M', 'ŋ'), - (0x14B, 'V'), - (0x14C, 'M', 'ō'), - (0x14D, 'V'), - (0x14E, 'M', 'ŏ'), - (0x14F, 'V'), - (0x150, 'M', 'ő'), - (0x151, 'V'), - (0x152, 'M', 'œ'), - (0x153, 'V'), - (0x154, 'M', 'ŕ'), - (0x155, 'V'), - (0x156, 'M', 'ŗ'), - (0x157, 'V'), - (0x158, 'M', 'ř'), - (0x159, 'V'), - (0x15A, 'M', 'ś'), - (0x15B, 'V'), - (0x15C, 'M', 'ŝ'), - (0x15D, 'V'), - (0x15E, 'M', 'ş'), - (0x15F, 'V'), - (0x160, 'M', 'š'), - (0x161, 'V'), - (0x162, 'M', 'ţ'), - (0x163, 'V'), - (0x164, 'M', 'ť'), - (0x165, 'V'), - (0x166, 'M', 'ŧ'), - (0x167, 'V'), - (0x168, 'M', 'ũ'), - (0x169, 'V'), - (0x16A, 'M', 'ū'), - (0x16B, 'V'), - (0x16C, 'M', 'ŭ'), - (0x16D, 'V'), - (0x16E, 'M', 'ů'), - (0x16F, 'V'), - (0x170, 'M', 'ű'), - (0x171, 'V'), - (0x172, 'M', 'ų'), - (0x173, 'V'), - (0x174, 'M', 'ŵ'), - (0x175, 'V'), - (0x176, 'M', 'ŷ'), - (0x177, 'V'), - (0x178, 'M', 'ÿ'), - (0x179, 'M', 'ź'), - (0x17A, 'V'), - (0x17B, 'M', 'ż'), - (0x17C, 'V'), - (0x17D, 'M', 'ž'), - (0x17E, 'V'), - (0x17F, 'M', 's'), - (0x180, 'V'), - (0x181, 'M', 'ɓ'), - (0x182, 'M', 'ƃ'), - (0x183, 'V'), - (0x184, 'M', 'ƅ'), - (0x185, 'V'), - (0x186, 'M', 'ɔ'), - (0x187, 'M', 'ƈ'), - (0x188, 'V'), - (0x189, 'M', 'ɖ'), - (0x18A, 'M', 'ɗ'), - (0x18B, 'M', 'ƌ'), - (0x18C, 'V'), - (0x18E, 'M', 'ǝ'), - (0x18F, 'M', 'ə'), - (0x190, 'M', 'ɛ'), - (0x191, 'M', 'ƒ'), - (0x192, 'V'), - (0x193, 'M', 'ɠ'), - ] - -def _seg_4() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x194, 'M', 'ɣ'), - (0x195, 'V'), - (0x196, 'M', 'ɩ'), - (0x197, 'M', 'ɨ'), - (0x198, 'M', 'ƙ'), - (0x199, 'V'), - (0x19C, 'M', 'ɯ'), - (0x19D, 'M', 'ɲ'), - (0x19E, 'V'), - (0x19F, 'M', 'ɵ'), - (0x1A0, 'M', 'ơ'), - (0x1A1, 'V'), - (0x1A2, 'M', 'ƣ'), - (0x1A3, 'V'), - (0x1A4, 'M', 'ƥ'), - (0x1A5, 'V'), - (0x1A6, 'M', 'ʀ'), - (0x1A7, 'M', 'ƨ'), - (0x1A8, 'V'), - (0x1A9, 'M', 'ʃ'), - (0x1AA, 'V'), - (0x1AC, 'M', 'ƭ'), - (0x1AD, 'V'), - (0x1AE, 'M', 'ʈ'), - (0x1AF, 'M', 'ư'), - (0x1B0, 'V'), - (0x1B1, 'M', 'ʊ'), - (0x1B2, 'M', 'ʋ'), - (0x1B3, 'M', 'ƴ'), - (0x1B4, 'V'), - (0x1B5, 'M', 'ƶ'), - (0x1B6, 'V'), - (0x1B7, 'M', 'ʒ'), - (0x1B8, 'M', 'ƹ'), - (0x1B9, 'V'), - (0x1BC, 'M', 'ƽ'), - (0x1BD, 'V'), - (0x1C4, 'M', 'dž'), - (0x1C7, 'M', 'lj'), - (0x1CA, 'M', 'nj'), - (0x1CD, 'M', 'ǎ'), - (0x1CE, 'V'), - (0x1CF, 'M', 'ǐ'), - (0x1D0, 'V'), - (0x1D1, 'M', 'ǒ'), - (0x1D2, 'V'), - (0x1D3, 'M', 'ǔ'), - (0x1D4, 'V'), - (0x1D5, 'M', 'ǖ'), - (0x1D6, 'V'), - (0x1D7, 'M', 'ǘ'), - (0x1D8, 'V'), - (0x1D9, 'M', 'ǚ'), - (0x1DA, 'V'), - (0x1DB, 'M', 'ǜ'), - (0x1DC, 'V'), - (0x1DE, 'M', 'ǟ'), - (0x1DF, 'V'), - (0x1E0, 'M', 'ǡ'), - (0x1E1, 'V'), - (0x1E2, 'M', 'ǣ'), - (0x1E3, 'V'), - (0x1E4, 'M', 'ǥ'), - (0x1E5, 'V'), - (0x1E6, 'M', 'ǧ'), - (0x1E7, 'V'), - (0x1E8, 'M', 'ǩ'), - (0x1E9, 'V'), - (0x1EA, 'M', 'ǫ'), - (0x1EB, 'V'), - (0x1EC, 'M', 'ǭ'), - (0x1ED, 'V'), - (0x1EE, 'M', 'ǯ'), - (0x1EF, 'V'), - (0x1F1, 'M', 'dz'), - (0x1F4, 'M', 'ǵ'), - (0x1F5, 'V'), - (0x1F6, 'M', 'ƕ'), - (0x1F7, 'M', 'ƿ'), - (0x1F8, 'M', 'ǹ'), - (0x1F9, 'V'), - (0x1FA, 'M', 'ǻ'), - (0x1FB, 'V'), - (0x1FC, 'M', 'ǽ'), - (0x1FD, 'V'), - (0x1FE, 'M', 'ǿ'), - (0x1FF, 'V'), - (0x200, 'M', 'ȁ'), - (0x201, 'V'), - (0x202, 'M', 'ȃ'), - (0x203, 'V'), - (0x204, 'M', 'ȅ'), - (0x205, 'V'), - (0x206, 'M', 'ȇ'), - (0x207, 'V'), - (0x208, 'M', 'ȉ'), - (0x209, 'V'), - (0x20A, 'M', 'ȋ'), - (0x20B, 'V'), - (0x20C, 'M', 'ȍ'), - ] - -def _seg_5() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x20D, 'V'), - (0x20E, 'M', 'ȏ'), - (0x20F, 'V'), - (0x210, 'M', 'ȑ'), - (0x211, 'V'), - (0x212, 'M', 'ȓ'), - (0x213, 'V'), - (0x214, 'M', 'ȕ'), - (0x215, 'V'), - (0x216, 'M', 'ȗ'), - (0x217, 'V'), - (0x218, 'M', 'ș'), - (0x219, 'V'), - (0x21A, 'M', 'ț'), - (0x21B, 'V'), - (0x21C, 'M', 'ȝ'), - (0x21D, 'V'), - (0x21E, 'M', 'ȟ'), - (0x21F, 'V'), - (0x220, 'M', 'ƞ'), - (0x221, 'V'), - (0x222, 'M', 'ȣ'), - (0x223, 'V'), - (0x224, 'M', 'ȥ'), - (0x225, 'V'), - (0x226, 'M', 'ȧ'), - (0x227, 'V'), - (0x228, 'M', 'ȩ'), - (0x229, 'V'), - (0x22A, 'M', 'ȫ'), - (0x22B, 'V'), - (0x22C, 'M', 'ȭ'), - (0x22D, 'V'), - (0x22E, 'M', 'ȯ'), - (0x22F, 'V'), - (0x230, 'M', 'ȱ'), - (0x231, 'V'), - (0x232, 'M', 'ȳ'), - (0x233, 'V'), - (0x23A, 'M', 'ⱥ'), - (0x23B, 'M', 'ȼ'), - (0x23C, 'V'), - (0x23D, 'M', 'ƚ'), - (0x23E, 'M', 'ⱦ'), - (0x23F, 'V'), - (0x241, 'M', 'ɂ'), - (0x242, 'V'), - (0x243, 'M', 'ƀ'), - (0x244, 'M', 'ʉ'), - (0x245, 'M', 'ʌ'), - (0x246, 'M', 'ɇ'), - (0x247, 'V'), - (0x248, 'M', 'ɉ'), - (0x249, 'V'), - (0x24A, 'M', 'ɋ'), - (0x24B, 'V'), - (0x24C, 'M', 'ɍ'), - (0x24D, 'V'), - (0x24E, 'M', 'ɏ'), - (0x24F, 'V'), - (0x2B0, 'M', 'h'), - (0x2B1, 'M', 'ɦ'), - (0x2B2, 'M', 'j'), - (0x2B3, 'M', 'r'), - (0x2B4, 'M', 'ɹ'), - (0x2B5, 'M', 'ɻ'), - (0x2B6, 'M', 'ʁ'), - (0x2B7, 'M', 'w'), - (0x2B8, 'M', 'y'), - (0x2B9, 'V'), - (0x2D8, '3', ' ̆'), - (0x2D9, '3', ' ̇'), - (0x2DA, '3', ' ̊'), - (0x2DB, '3', ' ̨'), - (0x2DC, '3', ' ̃'), - (0x2DD, '3', ' ̋'), - (0x2DE, 'V'), - (0x2E0, 'M', 'ɣ'), - (0x2E1, 'M', 'l'), - (0x2E2, 'M', 's'), - (0x2E3, 'M', 'x'), - (0x2E4, 'M', 'ʕ'), - (0x2E5, 'V'), - (0x340, 'M', '̀'), - (0x341, 'M', '́'), - (0x342, 'V'), - (0x343, 'M', '̓'), - (0x344, 'M', '̈́'), - (0x345, 'M', 'ι'), - (0x346, 'V'), - (0x34F, 'I'), - (0x350, 'V'), - (0x370, 'M', 'ͱ'), - (0x371, 'V'), - (0x372, 'M', 'ͳ'), - (0x373, 'V'), - (0x374, 'M', 'ʹ'), - (0x375, 'V'), - (0x376, 'M', 'ͷ'), - (0x377, 'V'), - ] - -def _seg_6() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x378, 'X'), - (0x37A, '3', ' ι'), - (0x37B, 'V'), - (0x37E, '3', ';'), - (0x37F, 'M', 'ϳ'), - (0x380, 'X'), - (0x384, '3', ' ́'), - (0x385, '3', ' ̈́'), - (0x386, 'M', 'ά'), - (0x387, 'M', '·'), - (0x388, 'M', 'έ'), - (0x389, 'M', 'ή'), - (0x38A, 'M', 'ί'), - (0x38B, 'X'), - (0x38C, 'M', 'ό'), - (0x38D, 'X'), - (0x38E, 'M', 'ύ'), - (0x38F, 'M', 'ώ'), - (0x390, 'V'), - (0x391, 'M', 'α'), - (0x392, 'M', 'β'), - (0x393, 'M', 'γ'), - (0x394, 'M', 'δ'), - (0x395, 'M', 'ε'), - (0x396, 'M', 'ζ'), - (0x397, 'M', 'η'), - (0x398, 'M', 'θ'), - (0x399, 'M', 'ι'), - (0x39A, 'M', 'κ'), - (0x39B, 'M', 'λ'), - (0x39C, 'M', 'μ'), - (0x39D, 'M', 'ν'), - (0x39E, 'M', 'ξ'), - (0x39F, 'M', 'ο'), - (0x3A0, 'M', 'π'), - (0x3A1, 'M', 'ρ'), - (0x3A2, 'X'), - (0x3A3, 'M', 'σ'), - (0x3A4, 'M', 'τ'), - (0x3A5, 'M', 'υ'), - (0x3A6, 'M', 'φ'), - (0x3A7, 'M', 'χ'), - (0x3A8, 'M', 'ψ'), - (0x3A9, 'M', 'ω'), - (0x3AA, 'M', 'ϊ'), - (0x3AB, 'M', 'ϋ'), - (0x3AC, 'V'), - (0x3C2, 'D', 'σ'), - (0x3C3, 'V'), - (0x3CF, 'M', 'ϗ'), - (0x3D0, 'M', 'β'), - (0x3D1, 'M', 'θ'), - (0x3D2, 'M', 'υ'), - (0x3D3, 'M', 'ύ'), - (0x3D4, 'M', 'ϋ'), - (0x3D5, 'M', 'φ'), - (0x3D6, 'M', 'π'), - (0x3D7, 'V'), - (0x3D8, 'M', 'ϙ'), - (0x3D9, 'V'), - (0x3DA, 'M', 'ϛ'), - (0x3DB, 'V'), - (0x3DC, 'M', 'ϝ'), - (0x3DD, 'V'), - (0x3DE, 'M', 'ϟ'), - (0x3DF, 'V'), - (0x3E0, 'M', 'ϡ'), - (0x3E1, 'V'), - (0x3E2, 'M', 'ϣ'), - (0x3E3, 'V'), - (0x3E4, 'M', 'ϥ'), - (0x3E5, 'V'), - (0x3E6, 'M', 'ϧ'), - (0x3E7, 'V'), - (0x3E8, 'M', 'ϩ'), - (0x3E9, 'V'), - (0x3EA, 'M', 'ϫ'), - (0x3EB, 'V'), - (0x3EC, 'M', 'ϭ'), - (0x3ED, 'V'), - (0x3EE, 'M', 'ϯ'), - (0x3EF, 'V'), - (0x3F0, 'M', 'κ'), - (0x3F1, 'M', 'ρ'), - (0x3F2, 'M', 'σ'), - (0x3F3, 'V'), - (0x3F4, 'M', 'θ'), - (0x3F5, 'M', 'ε'), - (0x3F6, 'V'), - (0x3F7, 'M', 'ϸ'), - (0x3F8, 'V'), - (0x3F9, 'M', 'σ'), - (0x3FA, 'M', 'ϻ'), - (0x3FB, 'V'), - (0x3FD, 'M', 'ͻ'), - (0x3FE, 'M', 'ͼ'), - (0x3FF, 'M', 'ͽ'), - (0x400, 'M', 'ѐ'), - (0x401, 'M', 'ё'), - (0x402, 'M', 'ђ'), - ] - -def _seg_7() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x403, 'M', 'ѓ'), - (0x404, 'M', 'є'), - (0x405, 'M', 'ѕ'), - (0x406, 'M', 'і'), - (0x407, 'M', 'ї'), - (0x408, 'M', 'ј'), - (0x409, 'M', 'љ'), - (0x40A, 'M', 'њ'), - (0x40B, 'M', 'ћ'), - (0x40C, 'M', 'ќ'), - (0x40D, 'M', 'ѝ'), - (0x40E, 'M', 'ў'), - (0x40F, 'M', 'џ'), - (0x410, 'M', 'а'), - (0x411, 'M', 'б'), - (0x412, 'M', 'в'), - (0x413, 'M', 'г'), - (0x414, 'M', 'д'), - (0x415, 'M', 'е'), - (0x416, 'M', 'ж'), - (0x417, 'M', 'з'), - (0x418, 'M', 'и'), - (0x419, 'M', 'й'), - (0x41A, 'M', 'к'), - (0x41B, 'M', 'л'), - (0x41C, 'M', 'м'), - (0x41D, 'M', 'н'), - (0x41E, 'M', 'о'), - (0x41F, 'M', 'п'), - (0x420, 'M', 'р'), - (0x421, 'M', 'с'), - (0x422, 'M', 'т'), - (0x423, 'M', 'у'), - (0x424, 'M', 'ф'), - (0x425, 'M', 'х'), - (0x426, 'M', 'ц'), - (0x427, 'M', 'ч'), - (0x428, 'M', 'ш'), - (0x429, 'M', 'щ'), - (0x42A, 'M', 'ъ'), - (0x42B, 'M', 'ы'), - (0x42C, 'M', 'ь'), - (0x42D, 'M', 'э'), - (0x42E, 'M', 'ю'), - (0x42F, 'M', 'я'), - (0x430, 'V'), - (0x460, 'M', 'ѡ'), - (0x461, 'V'), - (0x462, 'M', 'ѣ'), - (0x463, 'V'), - (0x464, 'M', 'ѥ'), - (0x465, 'V'), - (0x466, 'M', 'ѧ'), - (0x467, 'V'), - (0x468, 'M', 'ѩ'), - (0x469, 'V'), - (0x46A, 'M', 'ѫ'), - (0x46B, 'V'), - (0x46C, 'M', 'ѭ'), - (0x46D, 'V'), - (0x46E, 'M', 'ѯ'), - (0x46F, 'V'), - (0x470, 'M', 'ѱ'), - (0x471, 'V'), - (0x472, 'M', 'ѳ'), - (0x473, 'V'), - (0x474, 'M', 'ѵ'), - (0x475, 'V'), - (0x476, 'M', 'ѷ'), - (0x477, 'V'), - (0x478, 'M', 'ѹ'), - (0x479, 'V'), - (0x47A, 'M', 'ѻ'), - (0x47B, 'V'), - (0x47C, 'M', 'ѽ'), - (0x47D, 'V'), - (0x47E, 'M', 'ѿ'), - (0x47F, 'V'), - (0x480, 'M', 'ҁ'), - (0x481, 'V'), - (0x48A, 'M', 'ҋ'), - (0x48B, 'V'), - (0x48C, 'M', 'ҍ'), - (0x48D, 'V'), - (0x48E, 'M', 'ҏ'), - (0x48F, 'V'), - (0x490, 'M', 'ґ'), - (0x491, 'V'), - (0x492, 'M', 'ғ'), - (0x493, 'V'), - (0x494, 'M', 'ҕ'), - (0x495, 'V'), - (0x496, 'M', 'җ'), - (0x497, 'V'), - (0x498, 'M', 'ҙ'), - (0x499, 'V'), - (0x49A, 'M', 'қ'), - (0x49B, 'V'), - (0x49C, 'M', 'ҝ'), - (0x49D, 'V'), - ] - -def _seg_8() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x49E, 'M', 'ҟ'), - (0x49F, 'V'), - (0x4A0, 'M', 'ҡ'), - (0x4A1, 'V'), - (0x4A2, 'M', 'ң'), - (0x4A3, 'V'), - (0x4A4, 'M', 'ҥ'), - (0x4A5, 'V'), - (0x4A6, 'M', 'ҧ'), - (0x4A7, 'V'), - (0x4A8, 'M', 'ҩ'), - (0x4A9, 'V'), - (0x4AA, 'M', 'ҫ'), - (0x4AB, 'V'), - (0x4AC, 'M', 'ҭ'), - (0x4AD, 'V'), - (0x4AE, 'M', 'ү'), - (0x4AF, 'V'), - (0x4B0, 'M', 'ұ'), - (0x4B1, 'V'), - (0x4B2, 'M', 'ҳ'), - (0x4B3, 'V'), - (0x4B4, 'M', 'ҵ'), - (0x4B5, 'V'), - (0x4B6, 'M', 'ҷ'), - (0x4B7, 'V'), - (0x4B8, 'M', 'ҹ'), - (0x4B9, 'V'), - (0x4BA, 'M', 'һ'), - (0x4BB, 'V'), - (0x4BC, 'M', 'ҽ'), - (0x4BD, 'V'), - (0x4BE, 'M', 'ҿ'), - (0x4BF, 'V'), - (0x4C0, 'X'), - (0x4C1, 'M', 'ӂ'), - (0x4C2, 'V'), - (0x4C3, 'M', 'ӄ'), - (0x4C4, 'V'), - (0x4C5, 'M', 'ӆ'), - (0x4C6, 'V'), - (0x4C7, 'M', 'ӈ'), - (0x4C8, 'V'), - (0x4C9, 'M', 'ӊ'), - (0x4CA, 'V'), - (0x4CB, 'M', 'ӌ'), - (0x4CC, 'V'), - (0x4CD, 'M', 'ӎ'), - (0x4CE, 'V'), - (0x4D0, 'M', 'ӑ'), - (0x4D1, 'V'), - (0x4D2, 'M', 'ӓ'), - (0x4D3, 'V'), - (0x4D4, 'M', 'ӕ'), - (0x4D5, 'V'), - (0x4D6, 'M', 'ӗ'), - (0x4D7, 'V'), - (0x4D8, 'M', 'ә'), - (0x4D9, 'V'), - (0x4DA, 'M', 'ӛ'), - (0x4DB, 'V'), - (0x4DC, 'M', 'ӝ'), - (0x4DD, 'V'), - (0x4DE, 'M', 'ӟ'), - (0x4DF, 'V'), - (0x4E0, 'M', 'ӡ'), - (0x4E1, 'V'), - (0x4E2, 'M', 'ӣ'), - (0x4E3, 'V'), - (0x4E4, 'M', 'ӥ'), - (0x4E5, 'V'), - (0x4E6, 'M', 'ӧ'), - (0x4E7, 'V'), - (0x4E8, 'M', 'ө'), - (0x4E9, 'V'), - (0x4EA, 'M', 'ӫ'), - (0x4EB, 'V'), - (0x4EC, 'M', 'ӭ'), - (0x4ED, 'V'), - (0x4EE, 'M', 'ӯ'), - (0x4EF, 'V'), - (0x4F0, 'M', 'ӱ'), - (0x4F1, 'V'), - (0x4F2, 'M', 'ӳ'), - (0x4F3, 'V'), - (0x4F4, 'M', 'ӵ'), - (0x4F5, 'V'), - (0x4F6, 'M', 'ӷ'), - (0x4F7, 'V'), - (0x4F8, 'M', 'ӹ'), - (0x4F9, 'V'), - (0x4FA, 'M', 'ӻ'), - (0x4FB, 'V'), - (0x4FC, 'M', 'ӽ'), - (0x4FD, 'V'), - (0x4FE, 'M', 'ӿ'), - (0x4FF, 'V'), - (0x500, 'M', 'ԁ'), - (0x501, 'V'), - (0x502, 'M', 'ԃ'), - ] - -def _seg_9() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x503, 'V'), - (0x504, 'M', 'ԅ'), - (0x505, 'V'), - (0x506, 'M', 'ԇ'), - (0x507, 'V'), - (0x508, 'M', 'ԉ'), - (0x509, 'V'), - (0x50A, 'M', 'ԋ'), - (0x50B, 'V'), - (0x50C, 'M', 'ԍ'), - (0x50D, 'V'), - (0x50E, 'M', 'ԏ'), - (0x50F, 'V'), - (0x510, 'M', 'ԑ'), - (0x511, 'V'), - (0x512, 'M', 'ԓ'), - (0x513, 'V'), - (0x514, 'M', 'ԕ'), - (0x515, 'V'), - (0x516, 'M', 'ԗ'), - (0x517, 'V'), - (0x518, 'M', 'ԙ'), - (0x519, 'V'), - (0x51A, 'M', 'ԛ'), - (0x51B, 'V'), - (0x51C, 'M', 'ԝ'), - (0x51D, 'V'), - (0x51E, 'M', 'ԟ'), - (0x51F, 'V'), - (0x520, 'M', 'ԡ'), - (0x521, 'V'), - (0x522, 'M', 'ԣ'), - (0x523, 'V'), - (0x524, 'M', 'ԥ'), - (0x525, 'V'), - (0x526, 'M', 'ԧ'), - (0x527, 'V'), - (0x528, 'M', 'ԩ'), - (0x529, 'V'), - (0x52A, 'M', 'ԫ'), - (0x52B, 'V'), - (0x52C, 'M', 'ԭ'), - (0x52D, 'V'), - (0x52E, 'M', 'ԯ'), - (0x52F, 'V'), - (0x530, 'X'), - (0x531, 'M', 'ա'), - (0x532, 'M', 'բ'), - (0x533, 'M', 'գ'), - (0x534, 'M', 'դ'), - (0x535, 'M', 'ե'), - (0x536, 'M', 'զ'), - (0x537, 'M', 'է'), - (0x538, 'M', 'ը'), - (0x539, 'M', 'թ'), - (0x53A, 'M', 'ժ'), - (0x53B, 'M', 'ի'), - (0x53C, 'M', 'լ'), - (0x53D, 'M', 'խ'), - (0x53E, 'M', 'ծ'), - (0x53F, 'M', 'կ'), - (0x540, 'M', 'հ'), - (0x541, 'M', 'ձ'), - (0x542, 'M', 'ղ'), - (0x543, 'M', 'ճ'), - (0x544, 'M', 'մ'), - (0x545, 'M', 'յ'), - (0x546, 'M', 'ն'), - (0x547, 'M', 'շ'), - (0x548, 'M', 'ո'), - (0x549, 'M', 'չ'), - (0x54A, 'M', 'պ'), - (0x54B, 'M', 'ջ'), - (0x54C, 'M', 'ռ'), - (0x54D, 'M', 'ս'), - (0x54E, 'M', 'վ'), - (0x54F, 'M', 'տ'), - (0x550, 'M', 'ր'), - (0x551, 'M', 'ց'), - (0x552, 'M', 'ւ'), - (0x553, 'M', 'փ'), - (0x554, 'M', 'ք'), - (0x555, 'M', 'օ'), - (0x556, 'M', 'ֆ'), - (0x557, 'X'), - (0x559, 'V'), - (0x587, 'M', 'եւ'), - (0x588, 'V'), - (0x58B, 'X'), - (0x58D, 'V'), - (0x590, 'X'), - (0x591, 'V'), - (0x5C8, 'X'), - (0x5D0, 'V'), - (0x5EB, 'X'), - (0x5EF, 'V'), - (0x5F5, 'X'), - (0x606, 'V'), - (0x61C, 'X'), - (0x61D, 'V'), - ] - -def _seg_10() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x675, 'M', 'اٴ'), - (0x676, 'M', 'وٴ'), - (0x677, 'M', 'ۇٴ'), - (0x678, 'M', 'يٴ'), - (0x679, 'V'), - (0x6DD, 'X'), - (0x6DE, 'V'), - (0x70E, 'X'), - (0x710, 'V'), - (0x74B, 'X'), - (0x74D, 'V'), - (0x7B2, 'X'), - (0x7C0, 'V'), - (0x7FB, 'X'), - (0x7FD, 'V'), - (0x82E, 'X'), - (0x830, 'V'), - (0x83F, 'X'), - (0x840, 'V'), - (0x85C, 'X'), - (0x85E, 'V'), - (0x85F, 'X'), - (0x860, 'V'), - (0x86B, 'X'), - (0x870, 'V'), - (0x88F, 'X'), - (0x898, 'V'), - (0x8E2, 'X'), - (0x8E3, 'V'), - (0x958, 'M', 'क़'), - (0x959, 'M', 'ख़'), - (0x95A, 'M', 'ग़'), - (0x95B, 'M', 'ज़'), - (0x95C, 'M', 'ड़'), - (0x95D, 'M', 'ढ़'), - (0x95E, 'M', 'फ़'), - (0x95F, 'M', 'य़'), - (0x960, 'V'), - (0x984, 'X'), - (0x985, 'V'), - (0x98D, 'X'), - (0x98F, 'V'), - (0x991, 'X'), - (0x993, 'V'), - (0x9A9, 'X'), - (0x9AA, 'V'), - (0x9B1, 'X'), - (0x9B2, 'V'), - (0x9B3, 'X'), - (0x9B6, 'V'), - (0x9BA, 'X'), - (0x9BC, 'V'), - (0x9C5, 'X'), - (0x9C7, 'V'), - (0x9C9, 'X'), - (0x9CB, 'V'), - (0x9CF, 'X'), - (0x9D7, 'V'), - (0x9D8, 'X'), - (0x9DC, 'M', 'ড়'), - (0x9DD, 'M', 'ঢ়'), - (0x9DE, 'X'), - (0x9DF, 'M', 'য়'), - (0x9E0, 'V'), - (0x9E4, 'X'), - (0x9E6, 'V'), - (0x9FF, 'X'), - (0xA01, 'V'), - (0xA04, 'X'), - (0xA05, 'V'), - (0xA0B, 'X'), - (0xA0F, 'V'), - (0xA11, 'X'), - (0xA13, 'V'), - (0xA29, 'X'), - (0xA2A, 'V'), - (0xA31, 'X'), - (0xA32, 'V'), - (0xA33, 'M', 'ਲ਼'), - (0xA34, 'X'), - (0xA35, 'V'), - (0xA36, 'M', 'ਸ਼'), - (0xA37, 'X'), - (0xA38, 'V'), - (0xA3A, 'X'), - (0xA3C, 'V'), - (0xA3D, 'X'), - (0xA3E, 'V'), - (0xA43, 'X'), - (0xA47, 'V'), - (0xA49, 'X'), - (0xA4B, 'V'), - (0xA4E, 'X'), - (0xA51, 'V'), - (0xA52, 'X'), - (0xA59, 'M', 'ਖ਼'), - (0xA5A, 'M', 'ਗ਼'), - (0xA5B, 'M', 'ਜ਼'), - (0xA5C, 'V'), - (0xA5D, 'X'), - ] - -def _seg_11() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0xA5E, 'M', 'ਫ਼'), - (0xA5F, 'X'), - (0xA66, 'V'), - (0xA77, 'X'), - (0xA81, 'V'), - (0xA84, 'X'), - (0xA85, 'V'), - (0xA8E, 'X'), - (0xA8F, 'V'), - (0xA92, 'X'), - (0xA93, 'V'), - (0xAA9, 'X'), - (0xAAA, 'V'), - (0xAB1, 'X'), - (0xAB2, 'V'), - (0xAB4, 'X'), - (0xAB5, 'V'), - (0xABA, 'X'), - (0xABC, 'V'), - (0xAC6, 'X'), - (0xAC7, 'V'), - (0xACA, 'X'), - (0xACB, 'V'), - (0xACE, 'X'), - (0xAD0, 'V'), - (0xAD1, 'X'), - (0xAE0, 'V'), - (0xAE4, 'X'), - (0xAE6, 'V'), - (0xAF2, 'X'), - (0xAF9, 'V'), - (0xB00, 'X'), - (0xB01, 'V'), - (0xB04, 'X'), - (0xB05, 'V'), - (0xB0D, 'X'), - (0xB0F, 'V'), - (0xB11, 'X'), - (0xB13, 'V'), - (0xB29, 'X'), - (0xB2A, 'V'), - (0xB31, 'X'), - (0xB32, 'V'), - (0xB34, 'X'), - (0xB35, 'V'), - (0xB3A, 'X'), - (0xB3C, 'V'), - (0xB45, 'X'), - (0xB47, 'V'), - (0xB49, 'X'), - (0xB4B, 'V'), - (0xB4E, 'X'), - (0xB55, 'V'), - (0xB58, 'X'), - (0xB5C, 'M', 'ଡ଼'), - (0xB5D, 'M', 'ଢ଼'), - (0xB5E, 'X'), - (0xB5F, 'V'), - (0xB64, 'X'), - (0xB66, 'V'), - (0xB78, 'X'), - (0xB82, 'V'), - (0xB84, 'X'), - (0xB85, 'V'), - (0xB8B, 'X'), - (0xB8E, 'V'), - (0xB91, 'X'), - (0xB92, 'V'), - (0xB96, 'X'), - (0xB99, 'V'), - (0xB9B, 'X'), - (0xB9C, 'V'), - (0xB9D, 'X'), - (0xB9E, 'V'), - (0xBA0, 'X'), - (0xBA3, 'V'), - (0xBA5, 'X'), - (0xBA8, 'V'), - (0xBAB, 'X'), - (0xBAE, 'V'), - (0xBBA, 'X'), - (0xBBE, 'V'), - (0xBC3, 'X'), - (0xBC6, 'V'), - (0xBC9, 'X'), - (0xBCA, 'V'), - (0xBCE, 'X'), - (0xBD0, 'V'), - (0xBD1, 'X'), - (0xBD7, 'V'), - (0xBD8, 'X'), - (0xBE6, 'V'), - (0xBFB, 'X'), - (0xC00, 'V'), - (0xC0D, 'X'), - (0xC0E, 'V'), - (0xC11, 'X'), - (0xC12, 'V'), - (0xC29, 'X'), - (0xC2A, 'V'), - ] - -def _seg_12() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0xC3A, 'X'), - (0xC3C, 'V'), - (0xC45, 'X'), - (0xC46, 'V'), - (0xC49, 'X'), - (0xC4A, 'V'), - (0xC4E, 'X'), - (0xC55, 'V'), - (0xC57, 'X'), - (0xC58, 'V'), - (0xC5B, 'X'), - (0xC5D, 'V'), - (0xC5E, 'X'), - (0xC60, 'V'), - (0xC64, 'X'), - (0xC66, 'V'), - (0xC70, 'X'), - (0xC77, 'V'), - (0xC8D, 'X'), - (0xC8E, 'V'), - (0xC91, 'X'), - (0xC92, 'V'), - (0xCA9, 'X'), - (0xCAA, 'V'), - (0xCB4, 'X'), - (0xCB5, 'V'), - (0xCBA, 'X'), - (0xCBC, 'V'), - (0xCC5, 'X'), - (0xCC6, 'V'), - (0xCC9, 'X'), - (0xCCA, 'V'), - (0xCCE, 'X'), - (0xCD5, 'V'), - (0xCD7, 'X'), - (0xCDD, 'V'), - (0xCDF, 'X'), - (0xCE0, 'V'), - (0xCE4, 'X'), - (0xCE6, 'V'), - (0xCF0, 'X'), - (0xCF1, 'V'), - (0xCF4, 'X'), - (0xD00, 'V'), - (0xD0D, 'X'), - (0xD0E, 'V'), - (0xD11, 'X'), - (0xD12, 'V'), - (0xD45, 'X'), - (0xD46, 'V'), - (0xD49, 'X'), - (0xD4A, 'V'), - (0xD50, 'X'), - (0xD54, 'V'), - (0xD64, 'X'), - (0xD66, 'V'), - (0xD80, 'X'), - (0xD81, 'V'), - (0xD84, 'X'), - (0xD85, 'V'), - (0xD97, 'X'), - (0xD9A, 'V'), - (0xDB2, 'X'), - (0xDB3, 'V'), - (0xDBC, 'X'), - (0xDBD, 'V'), - (0xDBE, 'X'), - (0xDC0, 'V'), - (0xDC7, 'X'), - (0xDCA, 'V'), - (0xDCB, 'X'), - (0xDCF, 'V'), - (0xDD5, 'X'), - (0xDD6, 'V'), - (0xDD7, 'X'), - (0xDD8, 'V'), - (0xDE0, 'X'), - (0xDE6, 'V'), - (0xDF0, 'X'), - (0xDF2, 'V'), - (0xDF5, 'X'), - (0xE01, 'V'), - (0xE33, 'M', 'ํา'), - (0xE34, 'V'), - (0xE3B, 'X'), - (0xE3F, 'V'), - (0xE5C, 'X'), - (0xE81, 'V'), - (0xE83, 'X'), - (0xE84, 'V'), - (0xE85, 'X'), - (0xE86, 'V'), - (0xE8B, 'X'), - (0xE8C, 'V'), - (0xEA4, 'X'), - (0xEA5, 'V'), - (0xEA6, 'X'), - (0xEA7, 'V'), - (0xEB3, 'M', 'ໍາ'), - (0xEB4, 'V'), - ] - -def _seg_13() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0xEBE, 'X'), - (0xEC0, 'V'), - (0xEC5, 'X'), - (0xEC6, 'V'), - (0xEC7, 'X'), - (0xEC8, 'V'), - (0xECF, 'X'), - (0xED0, 'V'), - (0xEDA, 'X'), - (0xEDC, 'M', 'ຫນ'), - (0xEDD, 'M', 'ຫມ'), - (0xEDE, 'V'), - (0xEE0, 'X'), - (0xF00, 'V'), - (0xF0C, 'M', '་'), - (0xF0D, 'V'), - (0xF43, 'M', 'གྷ'), - (0xF44, 'V'), - (0xF48, 'X'), - (0xF49, 'V'), - (0xF4D, 'M', 'ཌྷ'), - (0xF4E, 'V'), - (0xF52, 'M', 'དྷ'), - (0xF53, 'V'), - (0xF57, 'M', 'བྷ'), - (0xF58, 'V'), - (0xF5C, 'M', 'ཛྷ'), - (0xF5D, 'V'), - (0xF69, 'M', 'ཀྵ'), - (0xF6A, 'V'), - (0xF6D, 'X'), - (0xF71, 'V'), - (0xF73, 'M', 'ཱི'), - (0xF74, 'V'), - (0xF75, 'M', 'ཱུ'), - (0xF76, 'M', 'ྲྀ'), - (0xF77, 'M', 'ྲཱྀ'), - (0xF78, 'M', 'ླྀ'), - (0xF79, 'M', 'ླཱྀ'), - (0xF7A, 'V'), - (0xF81, 'M', 'ཱྀ'), - (0xF82, 'V'), - (0xF93, 'M', 'ྒྷ'), - (0xF94, 'V'), - (0xF98, 'X'), - (0xF99, 'V'), - (0xF9D, 'M', 'ྜྷ'), - (0xF9E, 'V'), - (0xFA2, 'M', 'ྡྷ'), - (0xFA3, 'V'), - (0xFA7, 'M', 'ྦྷ'), - (0xFA8, 'V'), - (0xFAC, 'M', 'ྫྷ'), - (0xFAD, 'V'), - (0xFB9, 'M', 'ྐྵ'), - (0xFBA, 'V'), - (0xFBD, 'X'), - (0xFBE, 'V'), - (0xFCD, 'X'), - (0xFCE, 'V'), - (0xFDB, 'X'), - (0x1000, 'V'), - (0x10A0, 'X'), - (0x10C7, 'M', 'ⴧ'), - (0x10C8, 'X'), - (0x10CD, 'M', 'ⴭ'), - (0x10CE, 'X'), - (0x10D0, 'V'), - (0x10FC, 'M', 'ნ'), - (0x10FD, 'V'), - (0x115F, 'X'), - (0x1161, 'V'), - (0x1249, 'X'), - (0x124A, 'V'), - (0x124E, 'X'), - (0x1250, 'V'), - (0x1257, 'X'), - (0x1258, 'V'), - (0x1259, 'X'), - (0x125A, 'V'), - (0x125E, 'X'), - (0x1260, 'V'), - (0x1289, 'X'), - (0x128A, 'V'), - (0x128E, 'X'), - (0x1290, 'V'), - (0x12B1, 'X'), - (0x12B2, 'V'), - (0x12B6, 'X'), - (0x12B8, 'V'), - (0x12BF, 'X'), - (0x12C0, 'V'), - (0x12C1, 'X'), - (0x12C2, 'V'), - (0x12C6, 'X'), - (0x12C8, 'V'), - (0x12D7, 'X'), - (0x12D8, 'V'), - (0x1311, 'X'), - (0x1312, 'V'), - ] - -def _seg_14() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x1316, 'X'), - (0x1318, 'V'), - (0x135B, 'X'), - (0x135D, 'V'), - (0x137D, 'X'), - (0x1380, 'V'), - (0x139A, 'X'), - (0x13A0, 'V'), - (0x13F6, 'X'), - (0x13F8, 'M', 'Ᏸ'), - (0x13F9, 'M', 'Ᏹ'), - (0x13FA, 'M', 'Ᏺ'), - (0x13FB, 'M', 'Ᏻ'), - (0x13FC, 'M', 'Ᏼ'), - (0x13FD, 'M', 'Ᏽ'), - (0x13FE, 'X'), - (0x1400, 'V'), - (0x1680, 'X'), - (0x1681, 'V'), - (0x169D, 'X'), - (0x16A0, 'V'), - (0x16F9, 'X'), - (0x1700, 'V'), - (0x1716, 'X'), - (0x171F, 'V'), - (0x1737, 'X'), - (0x1740, 'V'), - (0x1754, 'X'), - (0x1760, 'V'), - (0x176D, 'X'), - (0x176E, 'V'), - (0x1771, 'X'), - (0x1772, 'V'), - (0x1774, 'X'), - (0x1780, 'V'), - (0x17B4, 'X'), - (0x17B6, 'V'), - (0x17DE, 'X'), - (0x17E0, 'V'), - (0x17EA, 'X'), - (0x17F0, 'V'), - (0x17FA, 'X'), - (0x1800, 'V'), - (0x1806, 'X'), - (0x1807, 'V'), - (0x180B, 'I'), - (0x180E, 'X'), - (0x180F, 'I'), - (0x1810, 'V'), - (0x181A, 'X'), - (0x1820, 'V'), - (0x1879, 'X'), - (0x1880, 'V'), - (0x18AB, 'X'), - (0x18B0, 'V'), - (0x18F6, 'X'), - (0x1900, 'V'), - (0x191F, 'X'), - (0x1920, 'V'), - (0x192C, 'X'), - (0x1930, 'V'), - (0x193C, 'X'), - (0x1940, 'V'), - (0x1941, 'X'), - (0x1944, 'V'), - (0x196E, 'X'), - (0x1970, 'V'), - (0x1975, 'X'), - (0x1980, 'V'), - (0x19AC, 'X'), - (0x19B0, 'V'), - (0x19CA, 'X'), - (0x19D0, 'V'), - (0x19DB, 'X'), - (0x19DE, 'V'), - (0x1A1C, 'X'), - (0x1A1E, 'V'), - (0x1A5F, 'X'), - (0x1A60, 'V'), - (0x1A7D, 'X'), - (0x1A7F, 'V'), - (0x1A8A, 'X'), - (0x1A90, 'V'), - (0x1A9A, 'X'), - (0x1AA0, 'V'), - (0x1AAE, 'X'), - (0x1AB0, 'V'), - (0x1ACF, 'X'), - (0x1B00, 'V'), - (0x1B4D, 'X'), - (0x1B50, 'V'), - (0x1B7F, 'X'), - (0x1B80, 'V'), - (0x1BF4, 'X'), - (0x1BFC, 'V'), - (0x1C38, 'X'), - (0x1C3B, 'V'), - (0x1C4A, 'X'), - (0x1C4D, 'V'), - (0x1C80, 'M', 'в'), - ] - -def _seg_15() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x1C81, 'M', 'д'), - (0x1C82, 'M', 'о'), - (0x1C83, 'M', 'с'), - (0x1C84, 'M', 'т'), - (0x1C86, 'M', 'ъ'), - (0x1C87, 'M', 'ѣ'), - (0x1C88, 'M', 'ꙋ'), - (0x1C89, 'X'), - (0x1C90, 'M', 'ა'), - (0x1C91, 'M', 'ბ'), - (0x1C92, 'M', 'გ'), - (0x1C93, 'M', 'დ'), - (0x1C94, 'M', 'ე'), - (0x1C95, 'M', 'ვ'), - (0x1C96, 'M', 'ზ'), - (0x1C97, 'M', 'თ'), - (0x1C98, 'M', 'ი'), - (0x1C99, 'M', 'კ'), - (0x1C9A, 'M', 'ლ'), - (0x1C9B, 'M', 'მ'), - (0x1C9C, 'M', 'ნ'), - (0x1C9D, 'M', 'ო'), - (0x1C9E, 'M', 'პ'), - (0x1C9F, 'M', 'ჟ'), - (0x1CA0, 'M', 'რ'), - (0x1CA1, 'M', 'ს'), - (0x1CA2, 'M', 'ტ'), - (0x1CA3, 'M', 'უ'), - (0x1CA4, 'M', 'ფ'), - (0x1CA5, 'M', 'ქ'), - (0x1CA6, 'M', 'ღ'), - (0x1CA7, 'M', 'ყ'), - (0x1CA8, 'M', 'შ'), - (0x1CA9, 'M', 'ჩ'), - (0x1CAA, 'M', 'ც'), - (0x1CAB, 'M', 'ძ'), - (0x1CAC, 'M', 'წ'), - (0x1CAD, 'M', 'ჭ'), - (0x1CAE, 'M', 'ხ'), - (0x1CAF, 'M', 'ჯ'), - (0x1CB0, 'M', 'ჰ'), - (0x1CB1, 'M', 'ჱ'), - (0x1CB2, 'M', 'ჲ'), - (0x1CB3, 'M', 'ჳ'), - (0x1CB4, 'M', 'ჴ'), - (0x1CB5, 'M', 'ჵ'), - (0x1CB6, 'M', 'ჶ'), - (0x1CB7, 'M', 'ჷ'), - (0x1CB8, 'M', 'ჸ'), - (0x1CB9, 'M', 'ჹ'), - (0x1CBA, 'M', 'ჺ'), - (0x1CBB, 'X'), - (0x1CBD, 'M', 'ჽ'), - (0x1CBE, 'M', 'ჾ'), - (0x1CBF, 'M', 'ჿ'), - (0x1CC0, 'V'), - (0x1CC8, 'X'), - (0x1CD0, 'V'), - (0x1CFB, 'X'), - (0x1D00, 'V'), - (0x1D2C, 'M', 'a'), - (0x1D2D, 'M', 'æ'), - (0x1D2E, 'M', 'b'), - (0x1D2F, 'V'), - (0x1D30, 'M', 'd'), - (0x1D31, 'M', 'e'), - (0x1D32, 'M', 'ǝ'), - (0x1D33, 'M', 'g'), - (0x1D34, 'M', 'h'), - (0x1D35, 'M', 'i'), - (0x1D36, 'M', 'j'), - (0x1D37, 'M', 'k'), - (0x1D38, 'M', 'l'), - (0x1D39, 'M', 'm'), - (0x1D3A, 'M', 'n'), - (0x1D3B, 'V'), - (0x1D3C, 'M', 'o'), - (0x1D3D, 'M', 'ȣ'), - (0x1D3E, 'M', 'p'), - (0x1D3F, 'M', 'r'), - (0x1D40, 'M', 't'), - (0x1D41, 'M', 'u'), - (0x1D42, 'M', 'w'), - (0x1D43, 'M', 'a'), - (0x1D44, 'M', 'ɐ'), - (0x1D45, 'M', 'ɑ'), - (0x1D46, 'M', 'ᴂ'), - (0x1D47, 'M', 'b'), - (0x1D48, 'M', 'd'), - (0x1D49, 'M', 'e'), - (0x1D4A, 'M', 'ə'), - (0x1D4B, 'M', 'ɛ'), - (0x1D4C, 'M', 'ɜ'), - (0x1D4D, 'M', 'g'), - (0x1D4E, 'V'), - (0x1D4F, 'M', 'k'), - (0x1D50, 'M', 'm'), - (0x1D51, 'M', 'ŋ'), - (0x1D52, 'M', 'o'), - (0x1D53, 'M', 'ɔ'), - ] - -def _seg_16() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x1D54, 'M', 'ᴖ'), - (0x1D55, 'M', 'ᴗ'), - (0x1D56, 'M', 'p'), - (0x1D57, 'M', 't'), - (0x1D58, 'M', 'u'), - (0x1D59, 'M', 'ᴝ'), - (0x1D5A, 'M', 'ɯ'), - (0x1D5B, 'M', 'v'), - (0x1D5C, 'M', 'ᴥ'), - (0x1D5D, 'M', 'β'), - (0x1D5E, 'M', 'γ'), - (0x1D5F, 'M', 'δ'), - (0x1D60, 'M', 'φ'), - (0x1D61, 'M', 'χ'), - (0x1D62, 'M', 'i'), - (0x1D63, 'M', 'r'), - (0x1D64, 'M', 'u'), - (0x1D65, 'M', 'v'), - (0x1D66, 'M', 'β'), - (0x1D67, 'M', 'γ'), - (0x1D68, 'M', 'ρ'), - (0x1D69, 'M', 'φ'), - (0x1D6A, 'M', 'χ'), - (0x1D6B, 'V'), - (0x1D78, 'M', 'н'), - (0x1D79, 'V'), - (0x1D9B, 'M', 'ɒ'), - (0x1D9C, 'M', 'c'), - (0x1D9D, 'M', 'ɕ'), - (0x1D9E, 'M', 'ð'), - (0x1D9F, 'M', 'ɜ'), - (0x1DA0, 'M', 'f'), - (0x1DA1, 'M', 'ɟ'), - (0x1DA2, 'M', 'ɡ'), - (0x1DA3, 'M', 'ɥ'), - (0x1DA4, 'M', 'ɨ'), - (0x1DA5, 'M', 'ɩ'), - (0x1DA6, 'M', 'ɪ'), - (0x1DA7, 'M', 'ᵻ'), - (0x1DA8, 'M', 'ʝ'), - (0x1DA9, 'M', 'ɭ'), - (0x1DAA, 'M', 'ᶅ'), - (0x1DAB, 'M', 'ʟ'), - (0x1DAC, 'M', 'ɱ'), - (0x1DAD, 'M', 'ɰ'), - (0x1DAE, 'M', 'ɲ'), - (0x1DAF, 'M', 'ɳ'), - (0x1DB0, 'M', 'ɴ'), - (0x1DB1, 'M', 'ɵ'), - (0x1DB2, 'M', 'ɸ'), - (0x1DB3, 'M', 'ʂ'), - (0x1DB4, 'M', 'ʃ'), - (0x1DB5, 'M', 'ƫ'), - (0x1DB6, 'M', 'ʉ'), - (0x1DB7, 'M', 'ʊ'), - (0x1DB8, 'M', 'ᴜ'), - (0x1DB9, 'M', 'ʋ'), - (0x1DBA, 'M', 'ʌ'), - (0x1DBB, 'M', 'z'), - (0x1DBC, 'M', 'ʐ'), - (0x1DBD, 'M', 'ʑ'), - (0x1DBE, 'M', 'ʒ'), - (0x1DBF, 'M', 'θ'), - (0x1DC0, 'V'), - (0x1E00, 'M', 'ḁ'), - (0x1E01, 'V'), - (0x1E02, 'M', 'ḃ'), - (0x1E03, 'V'), - (0x1E04, 'M', 'ḅ'), - (0x1E05, 'V'), - (0x1E06, 'M', 'ḇ'), - (0x1E07, 'V'), - (0x1E08, 'M', 'ḉ'), - (0x1E09, 'V'), - (0x1E0A, 'M', 'ḋ'), - (0x1E0B, 'V'), - (0x1E0C, 'M', 'ḍ'), - (0x1E0D, 'V'), - (0x1E0E, 'M', 'ḏ'), - (0x1E0F, 'V'), - (0x1E10, 'M', 'ḑ'), - (0x1E11, 'V'), - (0x1E12, 'M', 'ḓ'), - (0x1E13, 'V'), - (0x1E14, 'M', 'ḕ'), - (0x1E15, 'V'), - (0x1E16, 'M', 'ḗ'), - (0x1E17, 'V'), - (0x1E18, 'M', 'ḙ'), - (0x1E19, 'V'), - (0x1E1A, 'M', 'ḛ'), - (0x1E1B, 'V'), - (0x1E1C, 'M', 'ḝ'), - (0x1E1D, 'V'), - (0x1E1E, 'M', 'ḟ'), - (0x1E1F, 'V'), - (0x1E20, 'M', 'ḡ'), - (0x1E21, 'V'), - (0x1E22, 'M', 'ḣ'), - (0x1E23, 'V'), - ] - -def _seg_17() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x1E24, 'M', 'ḥ'), - (0x1E25, 'V'), - (0x1E26, 'M', 'ḧ'), - (0x1E27, 'V'), - (0x1E28, 'M', 'ḩ'), - (0x1E29, 'V'), - (0x1E2A, 'M', 'ḫ'), - (0x1E2B, 'V'), - (0x1E2C, 'M', 'ḭ'), - (0x1E2D, 'V'), - (0x1E2E, 'M', 'ḯ'), - (0x1E2F, 'V'), - (0x1E30, 'M', 'ḱ'), - (0x1E31, 'V'), - (0x1E32, 'M', 'ḳ'), - (0x1E33, 'V'), - (0x1E34, 'M', 'ḵ'), - (0x1E35, 'V'), - (0x1E36, 'M', 'ḷ'), - (0x1E37, 'V'), - (0x1E38, 'M', 'ḹ'), - (0x1E39, 'V'), - (0x1E3A, 'M', 'ḻ'), - (0x1E3B, 'V'), - (0x1E3C, 'M', 'ḽ'), - (0x1E3D, 'V'), - (0x1E3E, 'M', 'ḿ'), - (0x1E3F, 'V'), - (0x1E40, 'M', 'ṁ'), - (0x1E41, 'V'), - (0x1E42, 'M', 'ṃ'), - (0x1E43, 'V'), - (0x1E44, 'M', 'ṅ'), - (0x1E45, 'V'), - (0x1E46, 'M', 'ṇ'), - (0x1E47, 'V'), - (0x1E48, 'M', 'ṉ'), - (0x1E49, 'V'), - (0x1E4A, 'M', 'ṋ'), - (0x1E4B, 'V'), - (0x1E4C, 'M', 'ṍ'), - (0x1E4D, 'V'), - (0x1E4E, 'M', 'ṏ'), - (0x1E4F, 'V'), - (0x1E50, 'M', 'ṑ'), - (0x1E51, 'V'), - (0x1E52, 'M', 'ṓ'), - (0x1E53, 'V'), - (0x1E54, 'M', 'ṕ'), - (0x1E55, 'V'), - (0x1E56, 'M', 'ṗ'), - (0x1E57, 'V'), - (0x1E58, 'M', 'ṙ'), - (0x1E59, 'V'), - (0x1E5A, 'M', 'ṛ'), - (0x1E5B, 'V'), - (0x1E5C, 'M', 'ṝ'), - (0x1E5D, 'V'), - (0x1E5E, 'M', 'ṟ'), - (0x1E5F, 'V'), - (0x1E60, 'M', 'ṡ'), - (0x1E61, 'V'), - (0x1E62, 'M', 'ṣ'), - (0x1E63, 'V'), - (0x1E64, 'M', 'ṥ'), - (0x1E65, 'V'), - (0x1E66, 'M', 'ṧ'), - (0x1E67, 'V'), - (0x1E68, 'M', 'ṩ'), - (0x1E69, 'V'), - (0x1E6A, 'M', 'ṫ'), - (0x1E6B, 'V'), - (0x1E6C, 'M', 'ṭ'), - (0x1E6D, 'V'), - (0x1E6E, 'M', 'ṯ'), - (0x1E6F, 'V'), - (0x1E70, 'M', 'ṱ'), - (0x1E71, 'V'), - (0x1E72, 'M', 'ṳ'), - (0x1E73, 'V'), - (0x1E74, 'M', 'ṵ'), - (0x1E75, 'V'), - (0x1E76, 'M', 'ṷ'), - (0x1E77, 'V'), - (0x1E78, 'M', 'ṹ'), - (0x1E79, 'V'), - (0x1E7A, 'M', 'ṻ'), - (0x1E7B, 'V'), - (0x1E7C, 'M', 'ṽ'), - (0x1E7D, 'V'), - (0x1E7E, 'M', 'ṿ'), - (0x1E7F, 'V'), - (0x1E80, 'M', 'ẁ'), - (0x1E81, 'V'), - (0x1E82, 'M', 'ẃ'), - (0x1E83, 'V'), - (0x1E84, 'M', 'ẅ'), - (0x1E85, 'V'), - (0x1E86, 'M', 'ẇ'), - (0x1E87, 'V'), - ] - -def _seg_18() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x1E88, 'M', 'ẉ'), - (0x1E89, 'V'), - (0x1E8A, 'M', 'ẋ'), - (0x1E8B, 'V'), - (0x1E8C, 'M', 'ẍ'), - (0x1E8D, 'V'), - (0x1E8E, 'M', 'ẏ'), - (0x1E8F, 'V'), - (0x1E90, 'M', 'ẑ'), - (0x1E91, 'V'), - (0x1E92, 'M', 'ẓ'), - (0x1E93, 'V'), - (0x1E94, 'M', 'ẕ'), - (0x1E95, 'V'), - (0x1E9A, 'M', 'aʾ'), - (0x1E9B, 'M', 'ṡ'), - (0x1E9C, 'V'), - (0x1E9E, 'M', 'ss'), - (0x1E9F, 'V'), - (0x1EA0, 'M', 'ạ'), - (0x1EA1, 'V'), - (0x1EA2, 'M', 'ả'), - (0x1EA3, 'V'), - (0x1EA4, 'M', 'ấ'), - (0x1EA5, 'V'), - (0x1EA6, 'M', 'ầ'), - (0x1EA7, 'V'), - (0x1EA8, 'M', 'ẩ'), - (0x1EA9, 'V'), - (0x1EAA, 'M', 'ẫ'), - (0x1EAB, 'V'), - (0x1EAC, 'M', 'ậ'), - (0x1EAD, 'V'), - (0x1EAE, 'M', 'ắ'), - (0x1EAF, 'V'), - (0x1EB0, 'M', 'ằ'), - (0x1EB1, 'V'), - (0x1EB2, 'M', 'ẳ'), - (0x1EB3, 'V'), - (0x1EB4, 'M', 'ẵ'), - (0x1EB5, 'V'), - (0x1EB6, 'M', 'ặ'), - (0x1EB7, 'V'), - (0x1EB8, 'M', 'ẹ'), - (0x1EB9, 'V'), - (0x1EBA, 'M', 'ẻ'), - (0x1EBB, 'V'), - (0x1EBC, 'M', 'ẽ'), - (0x1EBD, 'V'), - (0x1EBE, 'M', 'ế'), - (0x1EBF, 'V'), - (0x1EC0, 'M', 'ề'), - (0x1EC1, 'V'), - (0x1EC2, 'M', 'ể'), - (0x1EC3, 'V'), - (0x1EC4, 'M', 'ễ'), - (0x1EC5, 'V'), - (0x1EC6, 'M', 'ệ'), - (0x1EC7, 'V'), - (0x1EC8, 'M', 'ỉ'), - (0x1EC9, 'V'), - (0x1ECA, 'M', 'ị'), - (0x1ECB, 'V'), - (0x1ECC, 'M', 'ọ'), - (0x1ECD, 'V'), - (0x1ECE, 'M', 'ỏ'), - (0x1ECF, 'V'), - (0x1ED0, 'M', 'ố'), - (0x1ED1, 'V'), - (0x1ED2, 'M', 'ồ'), - (0x1ED3, 'V'), - (0x1ED4, 'M', 'ổ'), - (0x1ED5, 'V'), - (0x1ED6, 'M', 'ỗ'), - (0x1ED7, 'V'), - (0x1ED8, 'M', 'ộ'), - (0x1ED9, 'V'), - (0x1EDA, 'M', 'ớ'), - (0x1EDB, 'V'), - (0x1EDC, 'M', 'ờ'), - (0x1EDD, 'V'), - (0x1EDE, 'M', 'ở'), - (0x1EDF, 'V'), - (0x1EE0, 'M', 'ỡ'), - (0x1EE1, 'V'), - (0x1EE2, 'M', 'ợ'), - (0x1EE3, 'V'), - (0x1EE4, 'M', 'ụ'), - (0x1EE5, 'V'), - (0x1EE6, 'M', 'ủ'), - (0x1EE7, 'V'), - (0x1EE8, 'M', 'ứ'), - (0x1EE9, 'V'), - (0x1EEA, 'M', 'ừ'), - (0x1EEB, 'V'), - (0x1EEC, 'M', 'ử'), - (0x1EED, 'V'), - (0x1EEE, 'M', 'ữ'), - (0x1EEF, 'V'), - (0x1EF0, 'M', 'ự'), - ] - -def _seg_19() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x1EF1, 'V'), - (0x1EF2, 'M', 'ỳ'), - (0x1EF3, 'V'), - (0x1EF4, 'M', 'ỵ'), - (0x1EF5, 'V'), - (0x1EF6, 'M', 'ỷ'), - (0x1EF7, 'V'), - (0x1EF8, 'M', 'ỹ'), - (0x1EF9, 'V'), - (0x1EFA, 'M', 'ỻ'), - (0x1EFB, 'V'), - (0x1EFC, 'M', 'ỽ'), - (0x1EFD, 'V'), - (0x1EFE, 'M', 'ỿ'), - (0x1EFF, 'V'), - (0x1F08, 'M', 'ἀ'), - (0x1F09, 'M', 'ἁ'), - (0x1F0A, 'M', 'ἂ'), - (0x1F0B, 'M', 'ἃ'), - (0x1F0C, 'M', 'ἄ'), - (0x1F0D, 'M', 'ἅ'), - (0x1F0E, 'M', 'ἆ'), - (0x1F0F, 'M', 'ἇ'), - (0x1F10, 'V'), - (0x1F16, 'X'), - (0x1F18, 'M', 'ἐ'), - (0x1F19, 'M', 'ἑ'), - (0x1F1A, 'M', 'ἒ'), - (0x1F1B, 'M', 'ἓ'), - (0x1F1C, 'M', 'ἔ'), - (0x1F1D, 'M', 'ἕ'), - (0x1F1E, 'X'), - (0x1F20, 'V'), - (0x1F28, 'M', 'ἠ'), - (0x1F29, 'M', 'ἡ'), - (0x1F2A, 'M', 'ἢ'), - (0x1F2B, 'M', 'ἣ'), - (0x1F2C, 'M', 'ἤ'), - (0x1F2D, 'M', 'ἥ'), - (0x1F2E, 'M', 'ἦ'), - (0x1F2F, 'M', 'ἧ'), - (0x1F30, 'V'), - (0x1F38, 'M', 'ἰ'), - (0x1F39, 'M', 'ἱ'), - (0x1F3A, 'M', 'ἲ'), - (0x1F3B, 'M', 'ἳ'), - (0x1F3C, 'M', 'ἴ'), - (0x1F3D, 'M', 'ἵ'), - (0x1F3E, 'M', 'ἶ'), - (0x1F3F, 'M', 'ἷ'), - (0x1F40, 'V'), - (0x1F46, 'X'), - (0x1F48, 'M', 'ὀ'), - (0x1F49, 'M', 'ὁ'), - (0x1F4A, 'M', 'ὂ'), - (0x1F4B, 'M', 'ὃ'), - (0x1F4C, 'M', 'ὄ'), - (0x1F4D, 'M', 'ὅ'), - (0x1F4E, 'X'), - (0x1F50, 'V'), - (0x1F58, 'X'), - (0x1F59, 'M', 'ὑ'), - (0x1F5A, 'X'), - (0x1F5B, 'M', 'ὓ'), - (0x1F5C, 'X'), - (0x1F5D, 'M', 'ὕ'), - (0x1F5E, 'X'), - (0x1F5F, 'M', 'ὗ'), - (0x1F60, 'V'), - (0x1F68, 'M', 'ὠ'), - (0x1F69, 'M', 'ὡ'), - (0x1F6A, 'M', 'ὢ'), - (0x1F6B, 'M', 'ὣ'), - (0x1F6C, 'M', 'ὤ'), - (0x1F6D, 'M', 'ὥ'), - (0x1F6E, 'M', 'ὦ'), - (0x1F6F, 'M', 'ὧ'), - (0x1F70, 'V'), - (0x1F71, 'M', 'ά'), - (0x1F72, 'V'), - (0x1F73, 'M', 'έ'), - (0x1F74, 'V'), - (0x1F75, 'M', 'ή'), - (0x1F76, 'V'), - (0x1F77, 'M', 'ί'), - (0x1F78, 'V'), - (0x1F79, 'M', 'ό'), - (0x1F7A, 'V'), - (0x1F7B, 'M', 'ύ'), - (0x1F7C, 'V'), - (0x1F7D, 'M', 'ώ'), - (0x1F7E, 'X'), - (0x1F80, 'M', 'ἀι'), - (0x1F81, 'M', 'ἁι'), - (0x1F82, 'M', 'ἂι'), - (0x1F83, 'M', 'ἃι'), - (0x1F84, 'M', 'ἄι'), - (0x1F85, 'M', 'ἅι'), - (0x1F86, 'M', 'ἆι'), - (0x1F87, 'M', 'ἇι'), - ] - -def _seg_20() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x1F88, 'M', 'ἀι'), - (0x1F89, 'M', 'ἁι'), - (0x1F8A, 'M', 'ἂι'), - (0x1F8B, 'M', 'ἃι'), - (0x1F8C, 'M', 'ἄι'), - (0x1F8D, 'M', 'ἅι'), - (0x1F8E, 'M', 'ἆι'), - (0x1F8F, 'M', 'ἇι'), - (0x1F90, 'M', 'ἠι'), - (0x1F91, 'M', 'ἡι'), - (0x1F92, 'M', 'ἢι'), - (0x1F93, 'M', 'ἣι'), - (0x1F94, 'M', 'ἤι'), - (0x1F95, 'M', 'ἥι'), - (0x1F96, 'M', 'ἦι'), - (0x1F97, 'M', 'ἧι'), - (0x1F98, 'M', 'ἠι'), - (0x1F99, 'M', 'ἡι'), - (0x1F9A, 'M', 'ἢι'), - (0x1F9B, 'M', 'ἣι'), - (0x1F9C, 'M', 'ἤι'), - (0x1F9D, 'M', 'ἥι'), - (0x1F9E, 'M', 'ἦι'), - (0x1F9F, 'M', 'ἧι'), - (0x1FA0, 'M', 'ὠι'), - (0x1FA1, 'M', 'ὡι'), - (0x1FA2, 'M', 'ὢι'), - (0x1FA3, 'M', 'ὣι'), - (0x1FA4, 'M', 'ὤι'), - (0x1FA5, 'M', 'ὥι'), - (0x1FA6, 'M', 'ὦι'), - (0x1FA7, 'M', 'ὧι'), - (0x1FA8, 'M', 'ὠι'), - (0x1FA9, 'M', 'ὡι'), - (0x1FAA, 'M', 'ὢι'), - (0x1FAB, 'M', 'ὣι'), - (0x1FAC, 'M', 'ὤι'), - (0x1FAD, 'M', 'ὥι'), - (0x1FAE, 'M', 'ὦι'), - (0x1FAF, 'M', 'ὧι'), - (0x1FB0, 'V'), - (0x1FB2, 'M', 'ὰι'), - (0x1FB3, 'M', 'αι'), - (0x1FB4, 'M', 'άι'), - (0x1FB5, 'X'), - (0x1FB6, 'V'), - (0x1FB7, 'M', 'ᾶι'), - (0x1FB8, 'M', 'ᾰ'), - (0x1FB9, 'M', 'ᾱ'), - (0x1FBA, 'M', 'ὰ'), - (0x1FBB, 'M', 'ά'), - (0x1FBC, 'M', 'αι'), - (0x1FBD, '3', ' ̓'), - (0x1FBE, 'M', 'ι'), - (0x1FBF, '3', ' ̓'), - (0x1FC0, '3', ' ͂'), - (0x1FC1, '3', ' ̈͂'), - (0x1FC2, 'M', 'ὴι'), - (0x1FC3, 'M', 'ηι'), - (0x1FC4, 'M', 'ήι'), - (0x1FC5, 'X'), - (0x1FC6, 'V'), - (0x1FC7, 'M', 'ῆι'), - (0x1FC8, 'M', 'ὲ'), - (0x1FC9, 'M', 'έ'), - (0x1FCA, 'M', 'ὴ'), - (0x1FCB, 'M', 'ή'), - (0x1FCC, 'M', 'ηι'), - (0x1FCD, '3', ' ̓̀'), - (0x1FCE, '3', ' ̓́'), - (0x1FCF, '3', ' ̓͂'), - (0x1FD0, 'V'), - (0x1FD3, 'M', 'ΐ'), - (0x1FD4, 'X'), - (0x1FD6, 'V'), - (0x1FD8, 'M', 'ῐ'), - (0x1FD9, 'M', 'ῑ'), - (0x1FDA, 'M', 'ὶ'), - (0x1FDB, 'M', 'ί'), - (0x1FDC, 'X'), - (0x1FDD, '3', ' ̔̀'), - (0x1FDE, '3', ' ̔́'), - (0x1FDF, '3', ' ̔͂'), - (0x1FE0, 'V'), - (0x1FE3, 'M', 'ΰ'), - (0x1FE4, 'V'), - (0x1FE8, 'M', 'ῠ'), - (0x1FE9, 'M', 'ῡ'), - (0x1FEA, 'M', 'ὺ'), - (0x1FEB, 'M', 'ύ'), - (0x1FEC, 'M', 'ῥ'), - (0x1FED, '3', ' ̈̀'), - (0x1FEE, '3', ' ̈́'), - (0x1FEF, '3', '`'), - (0x1FF0, 'X'), - (0x1FF2, 'M', 'ὼι'), - (0x1FF3, 'M', 'ωι'), - (0x1FF4, 'M', 'ώι'), - (0x1FF5, 'X'), - (0x1FF6, 'V'), - ] - -def _seg_21() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x1FF7, 'M', 'ῶι'), - (0x1FF8, 'M', 'ὸ'), - (0x1FF9, 'M', 'ό'), - (0x1FFA, 'M', 'ὼ'), - (0x1FFB, 'M', 'ώ'), - (0x1FFC, 'M', 'ωι'), - (0x1FFD, '3', ' ́'), - (0x1FFE, '3', ' ̔'), - (0x1FFF, 'X'), - (0x2000, '3', ' '), - (0x200B, 'I'), - (0x200C, 'D', ''), - (0x200E, 'X'), - (0x2010, 'V'), - (0x2011, 'M', '‐'), - (0x2012, 'V'), - (0x2017, '3', ' ̳'), - (0x2018, 'V'), - (0x2024, 'X'), - (0x2027, 'V'), - (0x2028, 'X'), - (0x202F, '3', ' '), - (0x2030, 'V'), - (0x2033, 'M', '′′'), - (0x2034, 'M', '′′′'), - (0x2035, 'V'), - (0x2036, 'M', '‵‵'), - (0x2037, 'M', '‵‵‵'), - (0x2038, 'V'), - (0x203C, '3', '!!'), - (0x203D, 'V'), - (0x203E, '3', ' ̅'), - (0x203F, 'V'), - (0x2047, '3', '??'), - (0x2048, '3', '?!'), - (0x2049, '3', '!?'), - (0x204A, 'V'), - (0x2057, 'M', '′′′′'), - (0x2058, 'V'), - (0x205F, '3', ' '), - (0x2060, 'I'), - (0x2061, 'X'), - (0x2064, 'I'), - (0x2065, 'X'), - (0x2070, 'M', '0'), - (0x2071, 'M', 'i'), - (0x2072, 'X'), - (0x2074, 'M', '4'), - (0x2075, 'M', '5'), - (0x2076, 'M', '6'), - (0x2077, 'M', '7'), - (0x2078, 'M', '8'), - (0x2079, 'M', '9'), - (0x207A, '3', '+'), - (0x207B, 'M', '−'), - (0x207C, '3', '='), - (0x207D, '3', '('), - (0x207E, '3', ')'), - (0x207F, 'M', 'n'), - (0x2080, 'M', '0'), - (0x2081, 'M', '1'), - (0x2082, 'M', '2'), - (0x2083, 'M', '3'), - (0x2084, 'M', '4'), - (0x2085, 'M', '5'), - (0x2086, 'M', '6'), - (0x2087, 'M', '7'), - (0x2088, 'M', '8'), - (0x2089, 'M', '9'), - (0x208A, '3', '+'), - (0x208B, 'M', '−'), - (0x208C, '3', '='), - (0x208D, '3', '('), - (0x208E, '3', ')'), - (0x208F, 'X'), - (0x2090, 'M', 'a'), - (0x2091, 'M', 'e'), - (0x2092, 'M', 'o'), - (0x2093, 'M', 'x'), - (0x2094, 'M', 'ə'), - (0x2095, 'M', 'h'), - (0x2096, 'M', 'k'), - (0x2097, 'M', 'l'), - (0x2098, 'M', 'm'), - (0x2099, 'M', 'n'), - (0x209A, 'M', 'p'), - (0x209B, 'M', 's'), - (0x209C, 'M', 't'), - (0x209D, 'X'), - (0x20A0, 'V'), - (0x20A8, 'M', 'rs'), - (0x20A9, 'V'), - (0x20C1, 'X'), - (0x20D0, 'V'), - (0x20F1, 'X'), - (0x2100, '3', 'a/c'), - (0x2101, '3', 'a/s'), - (0x2102, 'M', 'c'), - (0x2103, 'M', '°c'), - (0x2104, 'V'), - ] - -def _seg_22() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x2105, '3', 'c/o'), - (0x2106, '3', 'c/u'), - (0x2107, 'M', 'ɛ'), - (0x2108, 'V'), - (0x2109, 'M', '°f'), - (0x210A, 'M', 'g'), - (0x210B, 'M', 'h'), - (0x210F, 'M', 'ħ'), - (0x2110, 'M', 'i'), - (0x2112, 'M', 'l'), - (0x2114, 'V'), - (0x2115, 'M', 'n'), - (0x2116, 'M', 'no'), - (0x2117, 'V'), - (0x2119, 'M', 'p'), - (0x211A, 'M', 'q'), - (0x211B, 'M', 'r'), - (0x211E, 'V'), - (0x2120, 'M', 'sm'), - (0x2121, 'M', 'tel'), - (0x2122, 'M', 'tm'), - (0x2123, 'V'), - (0x2124, 'M', 'z'), - (0x2125, 'V'), - (0x2126, 'M', 'ω'), - (0x2127, 'V'), - (0x2128, 'M', 'z'), - (0x2129, 'V'), - (0x212A, 'M', 'k'), - (0x212B, 'M', 'å'), - (0x212C, 'M', 'b'), - (0x212D, 'M', 'c'), - (0x212E, 'V'), - (0x212F, 'M', 'e'), - (0x2131, 'M', 'f'), - (0x2132, 'X'), - (0x2133, 'M', 'm'), - (0x2134, 'M', 'o'), - (0x2135, 'M', 'א'), - (0x2136, 'M', 'ב'), - (0x2137, 'M', 'ג'), - (0x2138, 'M', 'ד'), - (0x2139, 'M', 'i'), - (0x213A, 'V'), - (0x213B, 'M', 'fax'), - (0x213C, 'M', 'π'), - (0x213D, 'M', 'γ'), - (0x213F, 'M', 'π'), - (0x2140, 'M', '∑'), - (0x2141, 'V'), - (0x2145, 'M', 'd'), - (0x2147, 'M', 'e'), - (0x2148, 'M', 'i'), - (0x2149, 'M', 'j'), - (0x214A, 'V'), - (0x2150, 'M', '1⁄7'), - (0x2151, 'M', '1⁄9'), - (0x2152, 'M', '1⁄10'), - (0x2153, 'M', '1⁄3'), - (0x2154, 'M', '2⁄3'), - (0x2155, 'M', '1⁄5'), - (0x2156, 'M', '2⁄5'), - (0x2157, 'M', '3⁄5'), - (0x2158, 'M', '4⁄5'), - (0x2159, 'M', '1⁄6'), - (0x215A, 'M', '5⁄6'), - (0x215B, 'M', '1⁄8'), - (0x215C, 'M', '3⁄8'), - (0x215D, 'M', '5⁄8'), - (0x215E, 'M', '7⁄8'), - (0x215F, 'M', '1⁄'), - (0x2160, 'M', 'i'), - (0x2161, 'M', 'ii'), - (0x2162, 'M', 'iii'), - (0x2163, 'M', 'iv'), - (0x2164, 'M', 'v'), - (0x2165, 'M', 'vi'), - (0x2166, 'M', 'vii'), - (0x2167, 'M', 'viii'), - (0x2168, 'M', 'ix'), - (0x2169, 'M', 'x'), - (0x216A, 'M', 'xi'), - (0x216B, 'M', 'xii'), - (0x216C, 'M', 'l'), - (0x216D, 'M', 'c'), - (0x216E, 'M', 'd'), - (0x216F, 'M', 'm'), - (0x2170, 'M', 'i'), - (0x2171, 'M', 'ii'), - (0x2172, 'M', 'iii'), - (0x2173, 'M', 'iv'), - (0x2174, 'M', 'v'), - (0x2175, 'M', 'vi'), - (0x2176, 'M', 'vii'), - (0x2177, 'M', 'viii'), - (0x2178, 'M', 'ix'), - (0x2179, 'M', 'x'), - (0x217A, 'M', 'xi'), - (0x217B, 'M', 'xii'), - (0x217C, 'M', 'l'), - ] - -def _seg_23() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x217D, 'M', 'c'), - (0x217E, 'M', 'd'), - (0x217F, 'M', 'm'), - (0x2180, 'V'), - (0x2183, 'X'), - (0x2184, 'V'), - (0x2189, 'M', '0⁄3'), - (0x218A, 'V'), - (0x218C, 'X'), - (0x2190, 'V'), - (0x222C, 'M', '∫∫'), - (0x222D, 'M', '∫∫∫'), - (0x222E, 'V'), - (0x222F, 'M', '∮∮'), - (0x2230, 'M', '∮∮∮'), - (0x2231, 'V'), - (0x2260, '3'), - (0x2261, 'V'), - (0x226E, '3'), - (0x2270, 'V'), - (0x2329, 'M', '〈'), - (0x232A, 'M', '〉'), - (0x232B, 'V'), - (0x2427, 'X'), - (0x2440, 'V'), - (0x244B, 'X'), - (0x2460, 'M', '1'), - (0x2461, 'M', '2'), - (0x2462, 'M', '3'), - (0x2463, 'M', '4'), - (0x2464, 'M', '5'), - (0x2465, 'M', '6'), - (0x2466, 'M', '7'), - (0x2467, 'M', '8'), - (0x2468, 'M', '9'), - (0x2469, 'M', '10'), - (0x246A, 'M', '11'), - (0x246B, 'M', '12'), - (0x246C, 'M', '13'), - (0x246D, 'M', '14'), - (0x246E, 'M', '15'), - (0x246F, 'M', '16'), - (0x2470, 'M', '17'), - (0x2471, 'M', '18'), - (0x2472, 'M', '19'), - (0x2473, 'M', '20'), - (0x2474, '3', '(1)'), - (0x2475, '3', '(2)'), - (0x2476, '3', '(3)'), - (0x2477, '3', '(4)'), - (0x2478, '3', '(5)'), - (0x2479, '3', '(6)'), - (0x247A, '3', '(7)'), - (0x247B, '3', '(8)'), - (0x247C, '3', '(9)'), - (0x247D, '3', '(10)'), - (0x247E, '3', '(11)'), - (0x247F, '3', '(12)'), - (0x2480, '3', '(13)'), - (0x2481, '3', '(14)'), - (0x2482, '3', '(15)'), - (0x2483, '3', '(16)'), - (0x2484, '3', '(17)'), - (0x2485, '3', '(18)'), - (0x2486, '3', '(19)'), - (0x2487, '3', '(20)'), - (0x2488, 'X'), - (0x249C, '3', '(a)'), - (0x249D, '3', '(b)'), - (0x249E, '3', '(c)'), - (0x249F, '3', '(d)'), - (0x24A0, '3', '(e)'), - (0x24A1, '3', '(f)'), - (0x24A2, '3', '(g)'), - (0x24A3, '3', '(h)'), - (0x24A4, '3', '(i)'), - (0x24A5, '3', '(j)'), - (0x24A6, '3', '(k)'), - (0x24A7, '3', '(l)'), - (0x24A8, '3', '(m)'), - (0x24A9, '3', '(n)'), - (0x24AA, '3', '(o)'), - (0x24AB, '3', '(p)'), - (0x24AC, '3', '(q)'), - (0x24AD, '3', '(r)'), - (0x24AE, '3', '(s)'), - (0x24AF, '3', '(t)'), - (0x24B0, '3', '(u)'), - (0x24B1, '3', '(v)'), - (0x24B2, '3', '(w)'), - (0x24B3, '3', '(x)'), - (0x24B4, '3', '(y)'), - (0x24B5, '3', '(z)'), - (0x24B6, 'M', 'a'), - (0x24B7, 'M', 'b'), - (0x24B8, 'M', 'c'), - (0x24B9, 'M', 'd'), - (0x24BA, 'M', 'e'), - (0x24BB, 'M', 'f'), - (0x24BC, 'M', 'g'), - ] - -def _seg_24() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x24BD, 'M', 'h'), - (0x24BE, 'M', 'i'), - (0x24BF, 'M', 'j'), - (0x24C0, 'M', 'k'), - (0x24C1, 'M', 'l'), - (0x24C2, 'M', 'm'), - (0x24C3, 'M', 'n'), - (0x24C4, 'M', 'o'), - (0x24C5, 'M', 'p'), - (0x24C6, 'M', 'q'), - (0x24C7, 'M', 'r'), - (0x24C8, 'M', 's'), - (0x24C9, 'M', 't'), - (0x24CA, 'M', 'u'), - (0x24CB, 'M', 'v'), - (0x24CC, 'M', 'w'), - (0x24CD, 'M', 'x'), - (0x24CE, 'M', 'y'), - (0x24CF, 'M', 'z'), - (0x24D0, 'M', 'a'), - (0x24D1, 'M', 'b'), - (0x24D2, 'M', 'c'), - (0x24D3, 'M', 'd'), - (0x24D4, 'M', 'e'), - (0x24D5, 'M', 'f'), - (0x24D6, 'M', 'g'), - (0x24D7, 'M', 'h'), - (0x24D8, 'M', 'i'), - (0x24D9, 'M', 'j'), - (0x24DA, 'M', 'k'), - (0x24DB, 'M', 'l'), - (0x24DC, 'M', 'm'), - (0x24DD, 'M', 'n'), - (0x24DE, 'M', 'o'), - (0x24DF, 'M', 'p'), - (0x24E0, 'M', 'q'), - (0x24E1, 'M', 'r'), - (0x24E2, 'M', 's'), - (0x24E3, 'M', 't'), - (0x24E4, 'M', 'u'), - (0x24E5, 'M', 'v'), - (0x24E6, 'M', 'w'), - (0x24E7, 'M', 'x'), - (0x24E8, 'M', 'y'), - (0x24E9, 'M', 'z'), - (0x24EA, 'M', '0'), - (0x24EB, 'V'), - (0x2A0C, 'M', '∫∫∫∫'), - (0x2A0D, 'V'), - (0x2A74, '3', '::='), - (0x2A75, '3', '=='), - (0x2A76, '3', '==='), - (0x2A77, 'V'), - (0x2ADC, 'M', '⫝̸'), - (0x2ADD, 'V'), - (0x2B74, 'X'), - (0x2B76, 'V'), - (0x2B96, 'X'), - (0x2B97, 'V'), - (0x2C00, 'M', 'ⰰ'), - (0x2C01, 'M', 'ⰱ'), - (0x2C02, 'M', 'ⰲ'), - (0x2C03, 'M', 'ⰳ'), - (0x2C04, 'M', 'ⰴ'), - (0x2C05, 'M', 'ⰵ'), - (0x2C06, 'M', 'ⰶ'), - (0x2C07, 'M', 'ⰷ'), - (0x2C08, 'M', 'ⰸ'), - (0x2C09, 'M', 'ⰹ'), - (0x2C0A, 'M', 'ⰺ'), - (0x2C0B, 'M', 'ⰻ'), - (0x2C0C, 'M', 'ⰼ'), - (0x2C0D, 'M', 'ⰽ'), - (0x2C0E, 'M', 'ⰾ'), - (0x2C0F, 'M', 'ⰿ'), - (0x2C10, 'M', 'ⱀ'), - (0x2C11, 'M', 'ⱁ'), - (0x2C12, 'M', 'ⱂ'), - (0x2C13, 'M', 'ⱃ'), - (0x2C14, 'M', 'ⱄ'), - (0x2C15, 'M', 'ⱅ'), - (0x2C16, 'M', 'ⱆ'), - (0x2C17, 'M', 'ⱇ'), - (0x2C18, 'M', 'ⱈ'), - (0x2C19, 'M', 'ⱉ'), - (0x2C1A, 'M', 'ⱊ'), - (0x2C1B, 'M', 'ⱋ'), - (0x2C1C, 'M', 'ⱌ'), - (0x2C1D, 'M', 'ⱍ'), - (0x2C1E, 'M', 'ⱎ'), - (0x2C1F, 'M', 'ⱏ'), - (0x2C20, 'M', 'ⱐ'), - (0x2C21, 'M', 'ⱑ'), - (0x2C22, 'M', 'ⱒ'), - (0x2C23, 'M', 'ⱓ'), - (0x2C24, 'M', 'ⱔ'), - (0x2C25, 'M', 'ⱕ'), - (0x2C26, 'M', 'ⱖ'), - (0x2C27, 'M', 'ⱗ'), - (0x2C28, 'M', 'ⱘ'), - ] - -def _seg_25() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x2C29, 'M', 'ⱙ'), - (0x2C2A, 'M', 'ⱚ'), - (0x2C2B, 'M', 'ⱛ'), - (0x2C2C, 'M', 'ⱜ'), - (0x2C2D, 'M', 'ⱝ'), - (0x2C2E, 'M', 'ⱞ'), - (0x2C2F, 'M', 'ⱟ'), - (0x2C30, 'V'), - (0x2C60, 'M', 'ⱡ'), - (0x2C61, 'V'), - (0x2C62, 'M', 'ɫ'), - (0x2C63, 'M', 'ᵽ'), - (0x2C64, 'M', 'ɽ'), - (0x2C65, 'V'), - (0x2C67, 'M', 'ⱨ'), - (0x2C68, 'V'), - (0x2C69, 'M', 'ⱪ'), - (0x2C6A, 'V'), - (0x2C6B, 'M', 'ⱬ'), - (0x2C6C, 'V'), - (0x2C6D, 'M', 'ɑ'), - (0x2C6E, 'M', 'ɱ'), - (0x2C6F, 'M', 'ɐ'), - (0x2C70, 'M', 'ɒ'), - (0x2C71, 'V'), - (0x2C72, 'M', 'ⱳ'), - (0x2C73, 'V'), - (0x2C75, 'M', 'ⱶ'), - (0x2C76, 'V'), - (0x2C7C, 'M', 'j'), - (0x2C7D, 'M', 'v'), - (0x2C7E, 'M', 'ȿ'), - (0x2C7F, 'M', 'ɀ'), - (0x2C80, 'M', 'ⲁ'), - (0x2C81, 'V'), - (0x2C82, 'M', 'ⲃ'), - (0x2C83, 'V'), - (0x2C84, 'M', 'ⲅ'), - (0x2C85, 'V'), - (0x2C86, 'M', 'ⲇ'), - (0x2C87, 'V'), - (0x2C88, 'M', 'ⲉ'), - (0x2C89, 'V'), - (0x2C8A, 'M', 'ⲋ'), - (0x2C8B, 'V'), - (0x2C8C, 'M', 'ⲍ'), - (0x2C8D, 'V'), - (0x2C8E, 'M', 'ⲏ'), - (0x2C8F, 'V'), - (0x2C90, 'M', 'ⲑ'), - (0x2C91, 'V'), - (0x2C92, 'M', 'ⲓ'), - (0x2C93, 'V'), - (0x2C94, 'M', 'ⲕ'), - (0x2C95, 'V'), - (0x2C96, 'M', 'ⲗ'), - (0x2C97, 'V'), - (0x2C98, 'M', 'ⲙ'), - (0x2C99, 'V'), - (0x2C9A, 'M', 'ⲛ'), - (0x2C9B, 'V'), - (0x2C9C, 'M', 'ⲝ'), - (0x2C9D, 'V'), - (0x2C9E, 'M', 'ⲟ'), - (0x2C9F, 'V'), - (0x2CA0, 'M', 'ⲡ'), - (0x2CA1, 'V'), - (0x2CA2, 'M', 'ⲣ'), - (0x2CA3, 'V'), - (0x2CA4, 'M', 'ⲥ'), - (0x2CA5, 'V'), - (0x2CA6, 'M', 'ⲧ'), - (0x2CA7, 'V'), - (0x2CA8, 'M', 'ⲩ'), - (0x2CA9, 'V'), - (0x2CAA, 'M', 'ⲫ'), - (0x2CAB, 'V'), - (0x2CAC, 'M', 'ⲭ'), - (0x2CAD, 'V'), - (0x2CAE, 'M', 'ⲯ'), - (0x2CAF, 'V'), - (0x2CB0, 'M', 'ⲱ'), - (0x2CB1, 'V'), - (0x2CB2, 'M', 'ⲳ'), - (0x2CB3, 'V'), - (0x2CB4, 'M', 'ⲵ'), - (0x2CB5, 'V'), - (0x2CB6, 'M', 'ⲷ'), - (0x2CB7, 'V'), - (0x2CB8, 'M', 'ⲹ'), - (0x2CB9, 'V'), - (0x2CBA, 'M', 'ⲻ'), - (0x2CBB, 'V'), - (0x2CBC, 'M', 'ⲽ'), - (0x2CBD, 'V'), - (0x2CBE, 'M', 'ⲿ'), - (0x2CBF, 'V'), - (0x2CC0, 'M', 'ⳁ'), - (0x2CC1, 'V'), - (0x2CC2, 'M', 'ⳃ'), - ] - -def _seg_26() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x2CC3, 'V'), - (0x2CC4, 'M', 'ⳅ'), - (0x2CC5, 'V'), - (0x2CC6, 'M', 'ⳇ'), - (0x2CC7, 'V'), - (0x2CC8, 'M', 'ⳉ'), - (0x2CC9, 'V'), - (0x2CCA, 'M', 'ⳋ'), - (0x2CCB, 'V'), - (0x2CCC, 'M', 'ⳍ'), - (0x2CCD, 'V'), - (0x2CCE, 'M', 'ⳏ'), - (0x2CCF, 'V'), - (0x2CD0, 'M', 'ⳑ'), - (0x2CD1, 'V'), - (0x2CD2, 'M', 'ⳓ'), - (0x2CD3, 'V'), - (0x2CD4, 'M', 'ⳕ'), - (0x2CD5, 'V'), - (0x2CD6, 'M', 'ⳗ'), - (0x2CD7, 'V'), - (0x2CD8, 'M', 'ⳙ'), - (0x2CD9, 'V'), - (0x2CDA, 'M', 'ⳛ'), - (0x2CDB, 'V'), - (0x2CDC, 'M', 'ⳝ'), - (0x2CDD, 'V'), - (0x2CDE, 'M', 'ⳟ'), - (0x2CDF, 'V'), - (0x2CE0, 'M', 'ⳡ'), - (0x2CE1, 'V'), - (0x2CE2, 'M', 'ⳣ'), - (0x2CE3, 'V'), - (0x2CEB, 'M', 'ⳬ'), - (0x2CEC, 'V'), - (0x2CED, 'M', 'ⳮ'), - (0x2CEE, 'V'), - (0x2CF2, 'M', 'ⳳ'), - (0x2CF3, 'V'), - (0x2CF4, 'X'), - (0x2CF9, 'V'), - (0x2D26, 'X'), - (0x2D27, 'V'), - (0x2D28, 'X'), - (0x2D2D, 'V'), - (0x2D2E, 'X'), - (0x2D30, 'V'), - (0x2D68, 'X'), - (0x2D6F, 'M', 'ⵡ'), - (0x2D70, 'V'), - (0x2D71, 'X'), - (0x2D7F, 'V'), - (0x2D97, 'X'), - (0x2DA0, 'V'), - (0x2DA7, 'X'), - (0x2DA8, 'V'), - (0x2DAF, 'X'), - (0x2DB0, 'V'), - (0x2DB7, 'X'), - (0x2DB8, 'V'), - (0x2DBF, 'X'), - (0x2DC0, 'V'), - (0x2DC7, 'X'), - (0x2DC8, 'V'), - (0x2DCF, 'X'), - (0x2DD0, 'V'), - (0x2DD7, 'X'), - (0x2DD8, 'V'), - (0x2DDF, 'X'), - (0x2DE0, 'V'), - (0x2E5E, 'X'), - (0x2E80, 'V'), - (0x2E9A, 'X'), - (0x2E9B, 'V'), - (0x2E9F, 'M', '母'), - (0x2EA0, 'V'), - (0x2EF3, 'M', '龟'), - (0x2EF4, 'X'), - (0x2F00, 'M', '一'), - (0x2F01, 'M', '丨'), - (0x2F02, 'M', '丶'), - (0x2F03, 'M', '丿'), - (0x2F04, 'M', '乙'), - (0x2F05, 'M', '亅'), - (0x2F06, 'M', '二'), - (0x2F07, 'M', '亠'), - (0x2F08, 'M', '人'), - (0x2F09, 'M', '儿'), - (0x2F0A, 'M', '入'), - (0x2F0B, 'M', '八'), - (0x2F0C, 'M', '冂'), - (0x2F0D, 'M', '冖'), - (0x2F0E, 'M', '冫'), - (0x2F0F, 'M', '几'), - (0x2F10, 'M', '凵'), - (0x2F11, 'M', '刀'), - (0x2F12, 'M', '力'), - (0x2F13, 'M', '勹'), - (0x2F14, 'M', '匕'), - (0x2F15, 'M', '匚'), - ] - -def _seg_27() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x2F16, 'M', '匸'), - (0x2F17, 'M', '十'), - (0x2F18, 'M', '卜'), - (0x2F19, 'M', '卩'), - (0x2F1A, 'M', '厂'), - (0x2F1B, 'M', '厶'), - (0x2F1C, 'M', '又'), - (0x2F1D, 'M', '口'), - (0x2F1E, 'M', '囗'), - (0x2F1F, 'M', '土'), - (0x2F20, 'M', '士'), - (0x2F21, 'M', '夂'), - (0x2F22, 'M', '夊'), - (0x2F23, 'M', '夕'), - (0x2F24, 'M', '大'), - (0x2F25, 'M', '女'), - (0x2F26, 'M', '子'), - (0x2F27, 'M', '宀'), - (0x2F28, 'M', '寸'), - (0x2F29, 'M', '小'), - (0x2F2A, 'M', '尢'), - (0x2F2B, 'M', '尸'), - (0x2F2C, 'M', '屮'), - (0x2F2D, 'M', '山'), - (0x2F2E, 'M', '巛'), - (0x2F2F, 'M', '工'), - (0x2F30, 'M', '己'), - (0x2F31, 'M', '巾'), - (0x2F32, 'M', '干'), - (0x2F33, 'M', '幺'), - (0x2F34, 'M', '广'), - (0x2F35, 'M', '廴'), - (0x2F36, 'M', '廾'), - (0x2F37, 'M', '弋'), - (0x2F38, 'M', '弓'), - (0x2F39, 'M', '彐'), - (0x2F3A, 'M', '彡'), - (0x2F3B, 'M', '彳'), - (0x2F3C, 'M', '心'), - (0x2F3D, 'M', '戈'), - (0x2F3E, 'M', '戶'), - (0x2F3F, 'M', '手'), - (0x2F40, 'M', '支'), - (0x2F41, 'M', '攴'), - (0x2F42, 'M', '文'), - (0x2F43, 'M', '斗'), - (0x2F44, 'M', '斤'), - (0x2F45, 'M', '方'), - (0x2F46, 'M', '无'), - (0x2F47, 'M', '日'), - (0x2F48, 'M', '曰'), - (0x2F49, 'M', '月'), - (0x2F4A, 'M', '木'), - (0x2F4B, 'M', '欠'), - (0x2F4C, 'M', '止'), - (0x2F4D, 'M', '歹'), - (0x2F4E, 'M', '殳'), - (0x2F4F, 'M', '毋'), - (0x2F50, 'M', '比'), - (0x2F51, 'M', '毛'), - (0x2F52, 'M', '氏'), - (0x2F53, 'M', '气'), - (0x2F54, 'M', '水'), - (0x2F55, 'M', '火'), - (0x2F56, 'M', '爪'), - (0x2F57, 'M', '父'), - (0x2F58, 'M', '爻'), - (0x2F59, 'M', '爿'), - (0x2F5A, 'M', '片'), - (0x2F5B, 'M', '牙'), - (0x2F5C, 'M', '牛'), - (0x2F5D, 'M', '犬'), - (0x2F5E, 'M', '玄'), - (0x2F5F, 'M', '玉'), - (0x2F60, 'M', '瓜'), - (0x2F61, 'M', '瓦'), - (0x2F62, 'M', '甘'), - (0x2F63, 'M', '生'), - (0x2F64, 'M', '用'), - (0x2F65, 'M', '田'), - (0x2F66, 'M', '疋'), - (0x2F67, 'M', '疒'), - (0x2F68, 'M', '癶'), - (0x2F69, 'M', '白'), - (0x2F6A, 'M', '皮'), - (0x2F6B, 'M', '皿'), - (0x2F6C, 'M', '目'), - (0x2F6D, 'M', '矛'), - (0x2F6E, 'M', '矢'), - (0x2F6F, 'M', '石'), - (0x2F70, 'M', '示'), - (0x2F71, 'M', '禸'), - (0x2F72, 'M', '禾'), - (0x2F73, 'M', '穴'), - (0x2F74, 'M', '立'), - (0x2F75, 'M', '竹'), - (0x2F76, 'M', '米'), - (0x2F77, 'M', '糸'), - (0x2F78, 'M', '缶'), - (0x2F79, 'M', '网'), - ] - -def _seg_28() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x2F7A, 'M', '羊'), - (0x2F7B, 'M', '羽'), - (0x2F7C, 'M', '老'), - (0x2F7D, 'M', '而'), - (0x2F7E, 'M', '耒'), - (0x2F7F, 'M', '耳'), - (0x2F80, 'M', '聿'), - (0x2F81, 'M', '肉'), - (0x2F82, 'M', '臣'), - (0x2F83, 'M', '自'), - (0x2F84, 'M', '至'), - (0x2F85, 'M', '臼'), - (0x2F86, 'M', '舌'), - (0x2F87, 'M', '舛'), - (0x2F88, 'M', '舟'), - (0x2F89, 'M', '艮'), - (0x2F8A, 'M', '色'), - (0x2F8B, 'M', '艸'), - (0x2F8C, 'M', '虍'), - (0x2F8D, 'M', '虫'), - (0x2F8E, 'M', '血'), - (0x2F8F, 'M', '行'), - (0x2F90, 'M', '衣'), - (0x2F91, 'M', '襾'), - (0x2F92, 'M', '見'), - (0x2F93, 'M', '角'), - (0x2F94, 'M', '言'), - (0x2F95, 'M', '谷'), - (0x2F96, 'M', '豆'), - (0x2F97, 'M', '豕'), - (0x2F98, 'M', '豸'), - (0x2F99, 'M', '貝'), - (0x2F9A, 'M', '赤'), - (0x2F9B, 'M', '走'), - (0x2F9C, 'M', '足'), - (0x2F9D, 'M', '身'), - (0x2F9E, 'M', '車'), - (0x2F9F, 'M', '辛'), - (0x2FA0, 'M', '辰'), - (0x2FA1, 'M', '辵'), - (0x2FA2, 'M', '邑'), - (0x2FA3, 'M', '酉'), - (0x2FA4, 'M', '釆'), - (0x2FA5, 'M', '里'), - (0x2FA6, 'M', '金'), - (0x2FA7, 'M', '長'), - (0x2FA8, 'M', '門'), - (0x2FA9, 'M', '阜'), - (0x2FAA, 'M', '隶'), - (0x2FAB, 'M', '隹'), - (0x2FAC, 'M', '雨'), - (0x2FAD, 'M', '靑'), - (0x2FAE, 'M', '非'), - (0x2FAF, 'M', '面'), - (0x2FB0, 'M', '革'), - (0x2FB1, 'M', '韋'), - (0x2FB2, 'M', '韭'), - (0x2FB3, 'M', '音'), - (0x2FB4, 'M', '頁'), - (0x2FB5, 'M', '風'), - (0x2FB6, 'M', '飛'), - (0x2FB7, 'M', '食'), - (0x2FB8, 'M', '首'), - (0x2FB9, 'M', '香'), - (0x2FBA, 'M', '馬'), - (0x2FBB, 'M', '骨'), - (0x2FBC, 'M', '高'), - (0x2FBD, 'M', '髟'), - (0x2FBE, 'M', '鬥'), - (0x2FBF, 'M', '鬯'), - (0x2FC0, 'M', '鬲'), - (0x2FC1, 'M', '鬼'), - (0x2FC2, 'M', '魚'), - (0x2FC3, 'M', '鳥'), - (0x2FC4, 'M', '鹵'), - (0x2FC5, 'M', '鹿'), - (0x2FC6, 'M', '麥'), - (0x2FC7, 'M', '麻'), - (0x2FC8, 'M', '黃'), - (0x2FC9, 'M', '黍'), - (0x2FCA, 'M', '黑'), - (0x2FCB, 'M', '黹'), - (0x2FCC, 'M', '黽'), - (0x2FCD, 'M', '鼎'), - (0x2FCE, 'M', '鼓'), - (0x2FCF, 'M', '鼠'), - (0x2FD0, 'M', '鼻'), - (0x2FD1, 'M', '齊'), - (0x2FD2, 'M', '齒'), - (0x2FD3, 'M', '龍'), - (0x2FD4, 'M', '龜'), - (0x2FD5, 'M', '龠'), - (0x2FD6, 'X'), - (0x3000, '3', ' '), - (0x3001, 'V'), - (0x3002, 'M', '.'), - (0x3003, 'V'), - (0x3036, 'M', '〒'), - (0x3037, 'V'), - (0x3038, 'M', '十'), - ] - -def _seg_29() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x3039, 'M', '卄'), - (0x303A, 'M', '卅'), - (0x303B, 'V'), - (0x3040, 'X'), - (0x3041, 'V'), - (0x3097, 'X'), - (0x3099, 'V'), - (0x309B, '3', ' ゙'), - (0x309C, '3', ' ゚'), - (0x309D, 'V'), - (0x309F, 'M', 'より'), - (0x30A0, 'V'), - (0x30FF, 'M', 'コト'), - (0x3100, 'X'), - (0x3105, 'V'), - (0x3130, 'X'), - (0x3131, 'M', 'ᄀ'), - (0x3132, 'M', 'ᄁ'), - (0x3133, 'M', 'ᆪ'), - (0x3134, 'M', 'ᄂ'), - (0x3135, 'M', 'ᆬ'), - (0x3136, 'M', 'ᆭ'), - (0x3137, 'M', 'ᄃ'), - (0x3138, 'M', 'ᄄ'), - (0x3139, 'M', 'ᄅ'), - (0x313A, 'M', 'ᆰ'), - (0x313B, 'M', 'ᆱ'), - (0x313C, 'M', 'ᆲ'), - (0x313D, 'M', 'ᆳ'), - (0x313E, 'M', 'ᆴ'), - (0x313F, 'M', 'ᆵ'), - (0x3140, 'M', 'ᄚ'), - (0x3141, 'M', 'ᄆ'), - (0x3142, 'M', 'ᄇ'), - (0x3143, 'M', 'ᄈ'), - (0x3144, 'M', 'ᄡ'), - (0x3145, 'M', 'ᄉ'), - (0x3146, 'M', 'ᄊ'), - (0x3147, 'M', 'ᄋ'), - (0x3148, 'M', 'ᄌ'), - (0x3149, 'M', 'ᄍ'), - (0x314A, 'M', 'ᄎ'), - (0x314B, 'M', 'ᄏ'), - (0x314C, 'M', 'ᄐ'), - (0x314D, 'M', 'ᄑ'), - (0x314E, 'M', 'ᄒ'), - (0x314F, 'M', 'ᅡ'), - (0x3150, 'M', 'ᅢ'), - (0x3151, 'M', 'ᅣ'), - (0x3152, 'M', 'ᅤ'), - (0x3153, 'M', 'ᅥ'), - (0x3154, 'M', 'ᅦ'), - (0x3155, 'M', 'ᅧ'), - (0x3156, 'M', 'ᅨ'), - (0x3157, 'M', 'ᅩ'), - (0x3158, 'M', 'ᅪ'), - (0x3159, 'M', 'ᅫ'), - (0x315A, 'M', 'ᅬ'), - (0x315B, 'M', 'ᅭ'), - (0x315C, 'M', 'ᅮ'), - (0x315D, 'M', 'ᅯ'), - (0x315E, 'M', 'ᅰ'), - (0x315F, 'M', 'ᅱ'), - (0x3160, 'M', 'ᅲ'), - (0x3161, 'M', 'ᅳ'), - (0x3162, 'M', 'ᅴ'), - (0x3163, 'M', 'ᅵ'), - (0x3164, 'X'), - (0x3165, 'M', 'ᄔ'), - (0x3166, 'M', 'ᄕ'), - (0x3167, 'M', 'ᇇ'), - (0x3168, 'M', 'ᇈ'), - (0x3169, 'M', 'ᇌ'), - (0x316A, 'M', 'ᇎ'), - (0x316B, 'M', 'ᇓ'), - (0x316C, 'M', 'ᇗ'), - (0x316D, 'M', 'ᇙ'), - (0x316E, 'M', 'ᄜ'), - (0x316F, 'M', 'ᇝ'), - (0x3170, 'M', 'ᇟ'), - (0x3171, 'M', 'ᄝ'), - (0x3172, 'M', 'ᄞ'), - (0x3173, 'M', 'ᄠ'), - (0x3174, 'M', 'ᄢ'), - (0x3175, 'M', 'ᄣ'), - (0x3176, 'M', 'ᄧ'), - (0x3177, 'M', 'ᄩ'), - (0x3178, 'M', 'ᄫ'), - (0x3179, 'M', 'ᄬ'), - (0x317A, 'M', 'ᄭ'), - (0x317B, 'M', 'ᄮ'), - (0x317C, 'M', 'ᄯ'), - (0x317D, 'M', 'ᄲ'), - (0x317E, 'M', 'ᄶ'), - (0x317F, 'M', 'ᅀ'), - (0x3180, 'M', 'ᅇ'), - (0x3181, 'M', 'ᅌ'), - (0x3182, 'M', 'ᇱ'), - (0x3183, 'M', 'ᇲ'), - (0x3184, 'M', 'ᅗ'), - ] - -def _seg_30() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x3185, 'M', 'ᅘ'), - (0x3186, 'M', 'ᅙ'), - (0x3187, 'M', 'ᆄ'), - (0x3188, 'M', 'ᆅ'), - (0x3189, 'M', 'ᆈ'), - (0x318A, 'M', 'ᆑ'), - (0x318B, 'M', 'ᆒ'), - (0x318C, 'M', 'ᆔ'), - (0x318D, 'M', 'ᆞ'), - (0x318E, 'M', 'ᆡ'), - (0x318F, 'X'), - (0x3190, 'V'), - (0x3192, 'M', '一'), - (0x3193, 'M', '二'), - (0x3194, 'M', '三'), - (0x3195, 'M', '四'), - (0x3196, 'M', '上'), - (0x3197, 'M', '中'), - (0x3198, 'M', '下'), - (0x3199, 'M', '甲'), - (0x319A, 'M', '乙'), - (0x319B, 'M', '丙'), - (0x319C, 'M', '丁'), - (0x319D, 'M', '天'), - (0x319E, 'M', '地'), - (0x319F, 'M', '人'), - (0x31A0, 'V'), - (0x31E4, 'X'), - (0x31F0, 'V'), - (0x3200, '3', '(ᄀ)'), - (0x3201, '3', '(ᄂ)'), - (0x3202, '3', '(ᄃ)'), - (0x3203, '3', '(ᄅ)'), - (0x3204, '3', '(ᄆ)'), - (0x3205, '3', '(ᄇ)'), - (0x3206, '3', '(ᄉ)'), - (0x3207, '3', '(ᄋ)'), - (0x3208, '3', '(ᄌ)'), - (0x3209, '3', '(ᄎ)'), - (0x320A, '3', '(ᄏ)'), - (0x320B, '3', '(ᄐ)'), - (0x320C, '3', '(ᄑ)'), - (0x320D, '3', '(ᄒ)'), - (0x320E, '3', '(가)'), - (0x320F, '3', '(나)'), - (0x3210, '3', '(다)'), - (0x3211, '3', '(라)'), - (0x3212, '3', '(마)'), - (0x3213, '3', '(바)'), - (0x3214, '3', '(사)'), - (0x3215, '3', '(아)'), - (0x3216, '3', '(자)'), - (0x3217, '3', '(차)'), - (0x3218, '3', '(카)'), - (0x3219, '3', '(타)'), - (0x321A, '3', '(파)'), - (0x321B, '3', '(하)'), - (0x321C, '3', '(주)'), - (0x321D, '3', '(오전)'), - (0x321E, '3', '(오후)'), - (0x321F, 'X'), - (0x3220, '3', '(一)'), - (0x3221, '3', '(二)'), - (0x3222, '3', '(三)'), - (0x3223, '3', '(四)'), - (0x3224, '3', '(五)'), - (0x3225, '3', '(六)'), - (0x3226, '3', '(七)'), - (0x3227, '3', '(八)'), - (0x3228, '3', '(九)'), - (0x3229, '3', '(十)'), - (0x322A, '3', '(月)'), - (0x322B, '3', '(火)'), - (0x322C, '3', '(水)'), - (0x322D, '3', '(木)'), - (0x322E, '3', '(金)'), - (0x322F, '3', '(土)'), - (0x3230, '3', '(日)'), - (0x3231, '3', '(株)'), - (0x3232, '3', '(有)'), - (0x3233, '3', '(社)'), - (0x3234, '3', '(名)'), - (0x3235, '3', '(特)'), - (0x3236, '3', '(財)'), - (0x3237, '3', '(祝)'), - (0x3238, '3', '(労)'), - (0x3239, '3', '(代)'), - (0x323A, '3', '(呼)'), - (0x323B, '3', '(学)'), - (0x323C, '3', '(監)'), - (0x323D, '3', '(企)'), - (0x323E, '3', '(資)'), - (0x323F, '3', '(協)'), - (0x3240, '3', '(祭)'), - (0x3241, '3', '(休)'), - (0x3242, '3', '(自)'), - (0x3243, '3', '(至)'), - (0x3244, 'M', '問'), - (0x3245, 'M', '幼'), - (0x3246, 'M', '文'), - ] - -def _seg_31() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x3247, 'M', '箏'), - (0x3248, 'V'), - (0x3250, 'M', 'pte'), - (0x3251, 'M', '21'), - (0x3252, 'M', '22'), - (0x3253, 'M', '23'), - (0x3254, 'M', '24'), - (0x3255, 'M', '25'), - (0x3256, 'M', '26'), - (0x3257, 'M', '27'), - (0x3258, 'M', '28'), - (0x3259, 'M', '29'), - (0x325A, 'M', '30'), - (0x325B, 'M', '31'), - (0x325C, 'M', '32'), - (0x325D, 'M', '33'), - (0x325E, 'M', '34'), - (0x325F, 'M', '35'), - (0x3260, 'M', 'ᄀ'), - (0x3261, 'M', 'ᄂ'), - (0x3262, 'M', 'ᄃ'), - (0x3263, 'M', 'ᄅ'), - (0x3264, 'M', 'ᄆ'), - (0x3265, 'M', 'ᄇ'), - (0x3266, 'M', 'ᄉ'), - (0x3267, 'M', 'ᄋ'), - (0x3268, 'M', 'ᄌ'), - (0x3269, 'M', 'ᄎ'), - (0x326A, 'M', 'ᄏ'), - (0x326B, 'M', 'ᄐ'), - (0x326C, 'M', 'ᄑ'), - (0x326D, 'M', 'ᄒ'), - (0x326E, 'M', '가'), - (0x326F, 'M', '나'), - (0x3270, 'M', '다'), - (0x3271, 'M', '라'), - (0x3272, 'M', '마'), - (0x3273, 'M', '바'), - (0x3274, 'M', '사'), - (0x3275, 'M', '아'), - (0x3276, 'M', '자'), - (0x3277, 'M', '차'), - (0x3278, 'M', '카'), - (0x3279, 'M', '타'), - (0x327A, 'M', '파'), - (0x327B, 'M', '하'), - (0x327C, 'M', '참고'), - (0x327D, 'M', '주의'), - (0x327E, 'M', '우'), - (0x327F, 'V'), - (0x3280, 'M', '一'), - (0x3281, 'M', '二'), - (0x3282, 'M', '三'), - (0x3283, 'M', '四'), - (0x3284, 'M', '五'), - (0x3285, 'M', '六'), - (0x3286, 'M', '七'), - (0x3287, 'M', '八'), - (0x3288, 'M', '九'), - (0x3289, 'M', '十'), - (0x328A, 'M', '月'), - (0x328B, 'M', '火'), - (0x328C, 'M', '水'), - (0x328D, 'M', '木'), - (0x328E, 'M', '金'), - (0x328F, 'M', '土'), - (0x3290, 'M', '日'), - (0x3291, 'M', '株'), - (0x3292, 'M', '有'), - (0x3293, 'M', '社'), - (0x3294, 'M', '名'), - (0x3295, 'M', '特'), - (0x3296, 'M', '財'), - (0x3297, 'M', '祝'), - (0x3298, 'M', '労'), - (0x3299, 'M', '秘'), - (0x329A, 'M', '男'), - (0x329B, 'M', '女'), - (0x329C, 'M', '適'), - (0x329D, 'M', '優'), - (0x329E, 'M', '印'), - (0x329F, 'M', '注'), - (0x32A0, 'M', '項'), - (0x32A1, 'M', '休'), - (0x32A2, 'M', '写'), - (0x32A3, 'M', '正'), - (0x32A4, 'M', '上'), - (0x32A5, 'M', '中'), - (0x32A6, 'M', '下'), - (0x32A7, 'M', '左'), - (0x32A8, 'M', '右'), - (0x32A9, 'M', '医'), - (0x32AA, 'M', '宗'), - (0x32AB, 'M', '学'), - (0x32AC, 'M', '監'), - (0x32AD, 'M', '企'), - (0x32AE, 'M', '資'), - (0x32AF, 'M', '協'), - (0x32B0, 'M', '夜'), - (0x32B1, 'M', '36'), - ] - -def _seg_32() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x32B2, 'M', '37'), - (0x32B3, 'M', '38'), - (0x32B4, 'M', '39'), - (0x32B5, 'M', '40'), - (0x32B6, 'M', '41'), - (0x32B7, 'M', '42'), - (0x32B8, 'M', '43'), - (0x32B9, 'M', '44'), - (0x32BA, 'M', '45'), - (0x32BB, 'M', '46'), - (0x32BC, 'M', '47'), - (0x32BD, 'M', '48'), - (0x32BE, 'M', '49'), - (0x32BF, 'M', '50'), - (0x32C0, 'M', '1月'), - (0x32C1, 'M', '2月'), - (0x32C2, 'M', '3月'), - (0x32C3, 'M', '4月'), - (0x32C4, 'M', '5月'), - (0x32C5, 'M', '6月'), - (0x32C6, 'M', '7月'), - (0x32C7, 'M', '8月'), - (0x32C8, 'M', '9月'), - (0x32C9, 'M', '10月'), - (0x32CA, 'M', '11月'), - (0x32CB, 'M', '12月'), - (0x32CC, 'M', 'hg'), - (0x32CD, 'M', 'erg'), - (0x32CE, 'M', 'ev'), - (0x32CF, 'M', 'ltd'), - (0x32D0, 'M', 'ア'), - (0x32D1, 'M', 'イ'), - (0x32D2, 'M', 'ウ'), - (0x32D3, 'M', 'エ'), - (0x32D4, 'M', 'オ'), - (0x32D5, 'M', 'カ'), - (0x32D6, 'M', 'キ'), - (0x32D7, 'M', 'ク'), - (0x32D8, 'M', 'ケ'), - (0x32D9, 'M', 'コ'), - (0x32DA, 'M', 'サ'), - (0x32DB, 'M', 'シ'), - (0x32DC, 'M', 'ス'), - (0x32DD, 'M', 'セ'), - (0x32DE, 'M', 'ソ'), - (0x32DF, 'M', 'タ'), - (0x32E0, 'M', 'チ'), - (0x32E1, 'M', 'ツ'), - (0x32E2, 'M', 'テ'), - (0x32E3, 'M', 'ト'), - (0x32E4, 'M', 'ナ'), - (0x32E5, 'M', 'ニ'), - (0x32E6, 'M', 'ヌ'), - (0x32E7, 'M', 'ネ'), - (0x32E8, 'M', 'ノ'), - (0x32E9, 'M', 'ハ'), - (0x32EA, 'M', 'ヒ'), - (0x32EB, 'M', 'フ'), - (0x32EC, 'M', 'ヘ'), - (0x32ED, 'M', 'ホ'), - (0x32EE, 'M', 'マ'), - (0x32EF, 'M', 'ミ'), - (0x32F0, 'M', 'ム'), - (0x32F1, 'M', 'メ'), - (0x32F2, 'M', 'モ'), - (0x32F3, 'M', 'ヤ'), - (0x32F4, 'M', 'ユ'), - (0x32F5, 'M', 'ヨ'), - (0x32F6, 'M', 'ラ'), - (0x32F7, 'M', 'リ'), - (0x32F8, 'M', 'ル'), - (0x32F9, 'M', 'レ'), - (0x32FA, 'M', 'ロ'), - (0x32FB, 'M', 'ワ'), - (0x32FC, 'M', 'ヰ'), - (0x32FD, 'M', 'ヱ'), - (0x32FE, 'M', 'ヲ'), - (0x32FF, 'M', '令和'), - (0x3300, 'M', 'アパート'), - (0x3301, 'M', 'アルファ'), - (0x3302, 'M', 'アンペア'), - (0x3303, 'M', 'アール'), - (0x3304, 'M', 'イニング'), - (0x3305, 'M', 'インチ'), - (0x3306, 'M', 'ウォン'), - (0x3307, 'M', 'エスクード'), - (0x3308, 'M', 'エーカー'), - (0x3309, 'M', 'オンス'), - (0x330A, 'M', 'オーム'), - (0x330B, 'M', 'カイリ'), - (0x330C, 'M', 'カラット'), - (0x330D, 'M', 'カロリー'), - (0x330E, 'M', 'ガロン'), - (0x330F, 'M', 'ガンマ'), - (0x3310, 'M', 'ギガ'), - (0x3311, 'M', 'ギニー'), - (0x3312, 'M', 'キュリー'), - (0x3313, 'M', 'ギルダー'), - (0x3314, 'M', 'キロ'), - (0x3315, 'M', 'キログラム'), - ] - -def _seg_33() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x3316, 'M', 'キロメートル'), - (0x3317, 'M', 'キロワット'), - (0x3318, 'M', 'グラム'), - (0x3319, 'M', 'グラムトン'), - (0x331A, 'M', 'クルゼイロ'), - (0x331B, 'M', 'クローネ'), - (0x331C, 'M', 'ケース'), - (0x331D, 'M', 'コルナ'), - (0x331E, 'M', 'コーポ'), - (0x331F, 'M', 'サイクル'), - (0x3320, 'M', 'サンチーム'), - (0x3321, 'M', 'シリング'), - (0x3322, 'M', 'センチ'), - (0x3323, 'M', 'セント'), - (0x3324, 'M', 'ダース'), - (0x3325, 'M', 'デシ'), - (0x3326, 'M', 'ドル'), - (0x3327, 'M', 'トン'), - (0x3328, 'M', 'ナノ'), - (0x3329, 'M', 'ノット'), - (0x332A, 'M', 'ハイツ'), - (0x332B, 'M', 'パーセント'), - (0x332C, 'M', 'パーツ'), - (0x332D, 'M', 'バーレル'), - (0x332E, 'M', 'ピアストル'), - (0x332F, 'M', 'ピクル'), - (0x3330, 'M', 'ピコ'), - (0x3331, 'M', 'ビル'), - (0x3332, 'M', 'ファラッド'), - (0x3333, 'M', 'フィート'), - (0x3334, 'M', 'ブッシェル'), - (0x3335, 'M', 'フラン'), - (0x3336, 'M', 'ヘクタール'), - (0x3337, 'M', 'ペソ'), - (0x3338, 'M', 'ペニヒ'), - (0x3339, 'M', 'ヘルツ'), - (0x333A, 'M', 'ペンス'), - (0x333B, 'M', 'ページ'), - (0x333C, 'M', 'ベータ'), - (0x333D, 'M', 'ポイント'), - (0x333E, 'M', 'ボルト'), - (0x333F, 'M', 'ホン'), - (0x3340, 'M', 'ポンド'), - (0x3341, 'M', 'ホール'), - (0x3342, 'M', 'ホーン'), - (0x3343, 'M', 'マイクロ'), - (0x3344, 'M', 'マイル'), - (0x3345, 'M', 'マッハ'), - (0x3346, 'M', 'マルク'), - (0x3347, 'M', 'マンション'), - (0x3348, 'M', 'ミクロン'), - (0x3349, 'M', 'ミリ'), - (0x334A, 'M', 'ミリバール'), - (0x334B, 'M', 'メガ'), - (0x334C, 'M', 'メガトン'), - (0x334D, 'M', 'メートル'), - (0x334E, 'M', 'ヤード'), - (0x334F, 'M', 'ヤール'), - (0x3350, 'M', 'ユアン'), - (0x3351, 'M', 'リットル'), - (0x3352, 'M', 'リラ'), - (0x3353, 'M', 'ルピー'), - (0x3354, 'M', 'ルーブル'), - (0x3355, 'M', 'レム'), - (0x3356, 'M', 'レントゲン'), - (0x3357, 'M', 'ワット'), - (0x3358, 'M', '0点'), - (0x3359, 'M', '1点'), - (0x335A, 'M', '2点'), - (0x335B, 'M', '3点'), - (0x335C, 'M', '4点'), - (0x335D, 'M', '5点'), - (0x335E, 'M', '6点'), - (0x335F, 'M', '7点'), - (0x3360, 'M', '8点'), - (0x3361, 'M', '9点'), - (0x3362, 'M', '10点'), - (0x3363, 'M', '11点'), - (0x3364, 'M', '12点'), - (0x3365, 'M', '13点'), - (0x3366, 'M', '14点'), - (0x3367, 'M', '15点'), - (0x3368, 'M', '16点'), - (0x3369, 'M', '17点'), - (0x336A, 'M', '18点'), - (0x336B, 'M', '19点'), - (0x336C, 'M', '20点'), - (0x336D, 'M', '21点'), - (0x336E, 'M', '22点'), - (0x336F, 'M', '23点'), - (0x3370, 'M', '24点'), - (0x3371, 'M', 'hpa'), - (0x3372, 'M', 'da'), - (0x3373, 'M', 'au'), - (0x3374, 'M', 'bar'), - (0x3375, 'M', 'ov'), - (0x3376, 'M', 'pc'), - (0x3377, 'M', 'dm'), - (0x3378, 'M', 'dm2'), - (0x3379, 'M', 'dm3'), - ] - -def _seg_34() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x337A, 'M', 'iu'), - (0x337B, 'M', '平成'), - (0x337C, 'M', '昭和'), - (0x337D, 'M', '大正'), - (0x337E, 'M', '明治'), - (0x337F, 'M', '株式会社'), - (0x3380, 'M', 'pa'), - (0x3381, 'M', 'na'), - (0x3382, 'M', 'μa'), - (0x3383, 'M', 'ma'), - (0x3384, 'M', 'ka'), - (0x3385, 'M', 'kb'), - (0x3386, 'M', 'mb'), - (0x3387, 'M', 'gb'), - (0x3388, 'M', 'cal'), - (0x3389, 'M', 'kcal'), - (0x338A, 'M', 'pf'), - (0x338B, 'M', 'nf'), - (0x338C, 'M', 'μf'), - (0x338D, 'M', 'μg'), - (0x338E, 'M', 'mg'), - (0x338F, 'M', 'kg'), - (0x3390, 'M', 'hz'), - (0x3391, 'M', 'khz'), - (0x3392, 'M', 'mhz'), - (0x3393, 'M', 'ghz'), - (0x3394, 'M', 'thz'), - (0x3395, 'M', 'μl'), - (0x3396, 'M', 'ml'), - (0x3397, 'M', 'dl'), - (0x3398, 'M', 'kl'), - (0x3399, 'M', 'fm'), - (0x339A, 'M', 'nm'), - (0x339B, 'M', 'μm'), - (0x339C, 'M', 'mm'), - (0x339D, 'M', 'cm'), - (0x339E, 'M', 'km'), - (0x339F, 'M', 'mm2'), - (0x33A0, 'M', 'cm2'), - (0x33A1, 'M', 'm2'), - (0x33A2, 'M', 'km2'), - (0x33A3, 'M', 'mm3'), - (0x33A4, 'M', 'cm3'), - (0x33A5, 'M', 'm3'), - (0x33A6, 'M', 'km3'), - (0x33A7, 'M', 'm∕s'), - (0x33A8, 'M', 'm∕s2'), - (0x33A9, 'M', 'pa'), - (0x33AA, 'M', 'kpa'), - (0x33AB, 'M', 'mpa'), - (0x33AC, 'M', 'gpa'), - (0x33AD, 'M', 'rad'), - (0x33AE, 'M', 'rad∕s'), - (0x33AF, 'M', 'rad∕s2'), - (0x33B0, 'M', 'ps'), - (0x33B1, 'M', 'ns'), - (0x33B2, 'M', 'μs'), - (0x33B3, 'M', 'ms'), - (0x33B4, 'M', 'pv'), - (0x33B5, 'M', 'nv'), - (0x33B6, 'M', 'μv'), - (0x33B7, 'M', 'mv'), - (0x33B8, 'M', 'kv'), - (0x33B9, 'M', 'mv'), - (0x33BA, 'M', 'pw'), - (0x33BB, 'M', 'nw'), - (0x33BC, 'M', 'μw'), - (0x33BD, 'M', 'mw'), - (0x33BE, 'M', 'kw'), - (0x33BF, 'M', 'mw'), - (0x33C0, 'M', 'kω'), - (0x33C1, 'M', 'mω'), - (0x33C2, 'X'), - (0x33C3, 'M', 'bq'), - (0x33C4, 'M', 'cc'), - (0x33C5, 'M', 'cd'), - (0x33C6, 'M', 'c∕kg'), - (0x33C7, 'X'), - (0x33C8, 'M', 'db'), - (0x33C9, 'M', 'gy'), - (0x33CA, 'M', 'ha'), - (0x33CB, 'M', 'hp'), - (0x33CC, 'M', 'in'), - (0x33CD, 'M', 'kk'), - (0x33CE, 'M', 'km'), - (0x33CF, 'M', 'kt'), - (0x33D0, 'M', 'lm'), - (0x33D1, 'M', 'ln'), - (0x33D2, 'M', 'log'), - (0x33D3, 'M', 'lx'), - (0x33D4, 'M', 'mb'), - (0x33D5, 'M', 'mil'), - (0x33D6, 'M', 'mol'), - (0x33D7, 'M', 'ph'), - (0x33D8, 'X'), - (0x33D9, 'M', 'ppm'), - (0x33DA, 'M', 'pr'), - (0x33DB, 'M', 'sr'), - (0x33DC, 'M', 'sv'), - (0x33DD, 'M', 'wb'), - ] - -def _seg_35() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x33DE, 'M', 'v∕m'), - (0x33DF, 'M', 'a∕m'), - (0x33E0, 'M', '1日'), - (0x33E1, 'M', '2日'), - (0x33E2, 'M', '3日'), - (0x33E3, 'M', '4日'), - (0x33E4, 'M', '5日'), - (0x33E5, 'M', '6日'), - (0x33E6, 'M', '7日'), - (0x33E7, 'M', '8日'), - (0x33E8, 'M', '9日'), - (0x33E9, 'M', '10日'), - (0x33EA, 'M', '11日'), - (0x33EB, 'M', '12日'), - (0x33EC, 'M', '13日'), - (0x33ED, 'M', '14日'), - (0x33EE, 'M', '15日'), - (0x33EF, 'M', '16日'), - (0x33F0, 'M', '17日'), - (0x33F1, 'M', '18日'), - (0x33F2, 'M', '19日'), - (0x33F3, 'M', '20日'), - (0x33F4, 'M', '21日'), - (0x33F5, 'M', '22日'), - (0x33F6, 'M', '23日'), - (0x33F7, 'M', '24日'), - (0x33F8, 'M', '25日'), - (0x33F9, 'M', '26日'), - (0x33FA, 'M', '27日'), - (0x33FB, 'M', '28日'), - (0x33FC, 'M', '29日'), - (0x33FD, 'M', '30日'), - (0x33FE, 'M', '31日'), - (0x33FF, 'M', 'gal'), - (0x3400, 'V'), - (0xA48D, 'X'), - (0xA490, 'V'), - (0xA4C7, 'X'), - (0xA4D0, 'V'), - (0xA62C, 'X'), - (0xA640, 'M', 'ꙁ'), - (0xA641, 'V'), - (0xA642, 'M', 'ꙃ'), - (0xA643, 'V'), - (0xA644, 'M', 'ꙅ'), - (0xA645, 'V'), - (0xA646, 'M', 'ꙇ'), - (0xA647, 'V'), - (0xA648, 'M', 'ꙉ'), - (0xA649, 'V'), - (0xA64A, 'M', 'ꙋ'), - (0xA64B, 'V'), - (0xA64C, 'M', 'ꙍ'), - (0xA64D, 'V'), - (0xA64E, 'M', 'ꙏ'), - (0xA64F, 'V'), - (0xA650, 'M', 'ꙑ'), - (0xA651, 'V'), - (0xA652, 'M', 'ꙓ'), - (0xA653, 'V'), - (0xA654, 'M', 'ꙕ'), - (0xA655, 'V'), - (0xA656, 'M', 'ꙗ'), - (0xA657, 'V'), - (0xA658, 'M', 'ꙙ'), - (0xA659, 'V'), - (0xA65A, 'M', 'ꙛ'), - (0xA65B, 'V'), - (0xA65C, 'M', 'ꙝ'), - (0xA65D, 'V'), - (0xA65E, 'M', 'ꙟ'), - (0xA65F, 'V'), - (0xA660, 'M', 'ꙡ'), - (0xA661, 'V'), - (0xA662, 'M', 'ꙣ'), - (0xA663, 'V'), - (0xA664, 'M', 'ꙥ'), - (0xA665, 'V'), - (0xA666, 'M', 'ꙧ'), - (0xA667, 'V'), - (0xA668, 'M', 'ꙩ'), - (0xA669, 'V'), - (0xA66A, 'M', 'ꙫ'), - (0xA66B, 'V'), - (0xA66C, 'M', 'ꙭ'), - (0xA66D, 'V'), - (0xA680, 'M', 'ꚁ'), - (0xA681, 'V'), - (0xA682, 'M', 'ꚃ'), - (0xA683, 'V'), - (0xA684, 'M', 'ꚅ'), - (0xA685, 'V'), - (0xA686, 'M', 'ꚇ'), - (0xA687, 'V'), - (0xA688, 'M', 'ꚉ'), - (0xA689, 'V'), - (0xA68A, 'M', 'ꚋ'), - (0xA68B, 'V'), - (0xA68C, 'M', 'ꚍ'), - (0xA68D, 'V'), - ] - -def _seg_36() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0xA68E, 'M', 'ꚏ'), - (0xA68F, 'V'), - (0xA690, 'M', 'ꚑ'), - (0xA691, 'V'), - (0xA692, 'M', 'ꚓ'), - (0xA693, 'V'), - (0xA694, 'M', 'ꚕ'), - (0xA695, 'V'), - (0xA696, 'M', 'ꚗ'), - (0xA697, 'V'), - (0xA698, 'M', 'ꚙ'), - (0xA699, 'V'), - (0xA69A, 'M', 'ꚛ'), - (0xA69B, 'V'), - (0xA69C, 'M', 'ъ'), - (0xA69D, 'M', 'ь'), - (0xA69E, 'V'), - (0xA6F8, 'X'), - (0xA700, 'V'), - (0xA722, 'M', 'ꜣ'), - (0xA723, 'V'), - (0xA724, 'M', 'ꜥ'), - (0xA725, 'V'), - (0xA726, 'M', 'ꜧ'), - (0xA727, 'V'), - (0xA728, 'M', 'ꜩ'), - (0xA729, 'V'), - (0xA72A, 'M', 'ꜫ'), - (0xA72B, 'V'), - (0xA72C, 'M', 'ꜭ'), - (0xA72D, 'V'), - (0xA72E, 'M', 'ꜯ'), - (0xA72F, 'V'), - (0xA732, 'M', 'ꜳ'), - (0xA733, 'V'), - (0xA734, 'M', 'ꜵ'), - (0xA735, 'V'), - (0xA736, 'M', 'ꜷ'), - (0xA737, 'V'), - (0xA738, 'M', 'ꜹ'), - (0xA739, 'V'), - (0xA73A, 'M', 'ꜻ'), - (0xA73B, 'V'), - (0xA73C, 'M', 'ꜽ'), - (0xA73D, 'V'), - (0xA73E, 'M', 'ꜿ'), - (0xA73F, 'V'), - (0xA740, 'M', 'ꝁ'), - (0xA741, 'V'), - (0xA742, 'M', 'ꝃ'), - (0xA743, 'V'), - (0xA744, 'M', 'ꝅ'), - (0xA745, 'V'), - (0xA746, 'M', 'ꝇ'), - (0xA747, 'V'), - (0xA748, 'M', 'ꝉ'), - (0xA749, 'V'), - (0xA74A, 'M', 'ꝋ'), - (0xA74B, 'V'), - (0xA74C, 'M', 'ꝍ'), - (0xA74D, 'V'), - (0xA74E, 'M', 'ꝏ'), - (0xA74F, 'V'), - (0xA750, 'M', 'ꝑ'), - (0xA751, 'V'), - (0xA752, 'M', 'ꝓ'), - (0xA753, 'V'), - (0xA754, 'M', 'ꝕ'), - (0xA755, 'V'), - (0xA756, 'M', 'ꝗ'), - (0xA757, 'V'), - (0xA758, 'M', 'ꝙ'), - (0xA759, 'V'), - (0xA75A, 'M', 'ꝛ'), - (0xA75B, 'V'), - (0xA75C, 'M', 'ꝝ'), - (0xA75D, 'V'), - (0xA75E, 'M', 'ꝟ'), - (0xA75F, 'V'), - (0xA760, 'M', 'ꝡ'), - (0xA761, 'V'), - (0xA762, 'M', 'ꝣ'), - (0xA763, 'V'), - (0xA764, 'M', 'ꝥ'), - (0xA765, 'V'), - (0xA766, 'M', 'ꝧ'), - (0xA767, 'V'), - (0xA768, 'M', 'ꝩ'), - (0xA769, 'V'), - (0xA76A, 'M', 'ꝫ'), - (0xA76B, 'V'), - (0xA76C, 'M', 'ꝭ'), - (0xA76D, 'V'), - (0xA76E, 'M', 'ꝯ'), - (0xA76F, 'V'), - (0xA770, 'M', 'ꝯ'), - (0xA771, 'V'), - (0xA779, 'M', 'ꝺ'), - (0xA77A, 'V'), - (0xA77B, 'M', 'ꝼ'), - ] - -def _seg_37() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0xA77C, 'V'), - (0xA77D, 'M', 'ᵹ'), - (0xA77E, 'M', 'ꝿ'), - (0xA77F, 'V'), - (0xA780, 'M', 'ꞁ'), - (0xA781, 'V'), - (0xA782, 'M', 'ꞃ'), - (0xA783, 'V'), - (0xA784, 'M', 'ꞅ'), - (0xA785, 'V'), - (0xA786, 'M', 'ꞇ'), - (0xA787, 'V'), - (0xA78B, 'M', 'ꞌ'), - (0xA78C, 'V'), - (0xA78D, 'M', 'ɥ'), - (0xA78E, 'V'), - (0xA790, 'M', 'ꞑ'), - (0xA791, 'V'), - (0xA792, 'M', 'ꞓ'), - (0xA793, 'V'), - (0xA796, 'M', 'ꞗ'), - (0xA797, 'V'), - (0xA798, 'M', 'ꞙ'), - (0xA799, 'V'), - (0xA79A, 'M', 'ꞛ'), - (0xA79B, 'V'), - (0xA79C, 'M', 'ꞝ'), - (0xA79D, 'V'), - (0xA79E, 'M', 'ꞟ'), - (0xA79F, 'V'), - (0xA7A0, 'M', 'ꞡ'), - (0xA7A1, 'V'), - (0xA7A2, 'M', 'ꞣ'), - (0xA7A3, 'V'), - (0xA7A4, 'M', 'ꞥ'), - (0xA7A5, 'V'), - (0xA7A6, 'M', 'ꞧ'), - (0xA7A7, 'V'), - (0xA7A8, 'M', 'ꞩ'), - (0xA7A9, 'V'), - (0xA7AA, 'M', 'ɦ'), - (0xA7AB, 'M', 'ɜ'), - (0xA7AC, 'M', 'ɡ'), - (0xA7AD, 'M', 'ɬ'), - (0xA7AE, 'M', 'ɪ'), - (0xA7AF, 'V'), - (0xA7B0, 'M', 'ʞ'), - (0xA7B1, 'M', 'ʇ'), - (0xA7B2, 'M', 'ʝ'), - (0xA7B3, 'M', 'ꭓ'), - (0xA7B4, 'M', 'ꞵ'), - (0xA7B5, 'V'), - (0xA7B6, 'M', 'ꞷ'), - (0xA7B7, 'V'), - (0xA7B8, 'M', 'ꞹ'), - (0xA7B9, 'V'), - (0xA7BA, 'M', 'ꞻ'), - (0xA7BB, 'V'), - (0xA7BC, 'M', 'ꞽ'), - (0xA7BD, 'V'), - (0xA7BE, 'M', 'ꞿ'), - (0xA7BF, 'V'), - (0xA7C0, 'M', 'ꟁ'), - (0xA7C1, 'V'), - (0xA7C2, 'M', 'ꟃ'), - (0xA7C3, 'V'), - (0xA7C4, 'M', 'ꞔ'), - (0xA7C5, 'M', 'ʂ'), - (0xA7C6, 'M', 'ᶎ'), - (0xA7C7, 'M', 'ꟈ'), - (0xA7C8, 'V'), - (0xA7C9, 'M', 'ꟊ'), - (0xA7CA, 'V'), - (0xA7CB, 'X'), - (0xA7D0, 'M', 'ꟑ'), - (0xA7D1, 'V'), - (0xA7D2, 'X'), - (0xA7D3, 'V'), - (0xA7D4, 'X'), - (0xA7D5, 'V'), - (0xA7D6, 'M', 'ꟗ'), - (0xA7D7, 'V'), - (0xA7D8, 'M', 'ꟙ'), - (0xA7D9, 'V'), - (0xA7DA, 'X'), - (0xA7F2, 'M', 'c'), - (0xA7F3, 'M', 'f'), - (0xA7F4, 'M', 'q'), - (0xA7F5, 'M', 'ꟶ'), - (0xA7F6, 'V'), - (0xA7F8, 'M', 'ħ'), - (0xA7F9, 'M', 'œ'), - (0xA7FA, 'V'), - (0xA82D, 'X'), - (0xA830, 'V'), - (0xA83A, 'X'), - (0xA840, 'V'), - (0xA878, 'X'), - (0xA880, 'V'), - (0xA8C6, 'X'), - ] - -def _seg_38() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0xA8CE, 'V'), - (0xA8DA, 'X'), - (0xA8E0, 'V'), - (0xA954, 'X'), - (0xA95F, 'V'), - (0xA97D, 'X'), - (0xA980, 'V'), - (0xA9CE, 'X'), - (0xA9CF, 'V'), - (0xA9DA, 'X'), - (0xA9DE, 'V'), - (0xA9FF, 'X'), - (0xAA00, 'V'), - (0xAA37, 'X'), - (0xAA40, 'V'), - (0xAA4E, 'X'), - (0xAA50, 'V'), - (0xAA5A, 'X'), - (0xAA5C, 'V'), - (0xAAC3, 'X'), - (0xAADB, 'V'), - (0xAAF7, 'X'), - (0xAB01, 'V'), - (0xAB07, 'X'), - (0xAB09, 'V'), - (0xAB0F, 'X'), - (0xAB11, 'V'), - (0xAB17, 'X'), - (0xAB20, 'V'), - (0xAB27, 'X'), - (0xAB28, 'V'), - (0xAB2F, 'X'), - (0xAB30, 'V'), - (0xAB5C, 'M', 'ꜧ'), - (0xAB5D, 'M', 'ꬷ'), - (0xAB5E, 'M', 'ɫ'), - (0xAB5F, 'M', 'ꭒ'), - (0xAB60, 'V'), - (0xAB69, 'M', 'ʍ'), - (0xAB6A, 'V'), - (0xAB6C, 'X'), - (0xAB70, 'M', 'Ꭰ'), - (0xAB71, 'M', 'Ꭱ'), - (0xAB72, 'M', 'Ꭲ'), - (0xAB73, 'M', 'Ꭳ'), - (0xAB74, 'M', 'Ꭴ'), - (0xAB75, 'M', 'Ꭵ'), - (0xAB76, 'M', 'Ꭶ'), - (0xAB77, 'M', 'Ꭷ'), - (0xAB78, 'M', 'Ꭸ'), - (0xAB79, 'M', 'Ꭹ'), - (0xAB7A, 'M', 'Ꭺ'), - (0xAB7B, 'M', 'Ꭻ'), - (0xAB7C, 'M', 'Ꭼ'), - (0xAB7D, 'M', 'Ꭽ'), - (0xAB7E, 'M', 'Ꭾ'), - (0xAB7F, 'M', 'Ꭿ'), - (0xAB80, 'M', 'Ꮀ'), - (0xAB81, 'M', 'Ꮁ'), - (0xAB82, 'M', 'Ꮂ'), - (0xAB83, 'M', 'Ꮃ'), - (0xAB84, 'M', 'Ꮄ'), - (0xAB85, 'M', 'Ꮅ'), - (0xAB86, 'M', 'Ꮆ'), - (0xAB87, 'M', 'Ꮇ'), - (0xAB88, 'M', 'Ꮈ'), - (0xAB89, 'M', 'Ꮉ'), - (0xAB8A, 'M', 'Ꮊ'), - (0xAB8B, 'M', 'Ꮋ'), - (0xAB8C, 'M', 'Ꮌ'), - (0xAB8D, 'M', 'Ꮍ'), - (0xAB8E, 'M', 'Ꮎ'), - (0xAB8F, 'M', 'Ꮏ'), - (0xAB90, 'M', 'Ꮐ'), - (0xAB91, 'M', 'Ꮑ'), - (0xAB92, 'M', 'Ꮒ'), - (0xAB93, 'M', 'Ꮓ'), - (0xAB94, 'M', 'Ꮔ'), - (0xAB95, 'M', 'Ꮕ'), - (0xAB96, 'M', 'Ꮖ'), - (0xAB97, 'M', 'Ꮗ'), - (0xAB98, 'M', 'Ꮘ'), - (0xAB99, 'M', 'Ꮙ'), - (0xAB9A, 'M', 'Ꮚ'), - (0xAB9B, 'M', 'Ꮛ'), - (0xAB9C, 'M', 'Ꮜ'), - (0xAB9D, 'M', 'Ꮝ'), - (0xAB9E, 'M', 'Ꮞ'), - (0xAB9F, 'M', 'Ꮟ'), - (0xABA0, 'M', 'Ꮠ'), - (0xABA1, 'M', 'Ꮡ'), - (0xABA2, 'M', 'Ꮢ'), - (0xABA3, 'M', 'Ꮣ'), - (0xABA4, 'M', 'Ꮤ'), - (0xABA5, 'M', 'Ꮥ'), - (0xABA6, 'M', 'Ꮦ'), - (0xABA7, 'M', 'Ꮧ'), - (0xABA8, 'M', 'Ꮨ'), - (0xABA9, 'M', 'Ꮩ'), - (0xABAA, 'M', 'Ꮪ'), - ] - -def _seg_39() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0xABAB, 'M', 'Ꮫ'), - (0xABAC, 'M', 'Ꮬ'), - (0xABAD, 'M', 'Ꮭ'), - (0xABAE, 'M', 'Ꮮ'), - (0xABAF, 'M', 'Ꮯ'), - (0xABB0, 'M', 'Ꮰ'), - (0xABB1, 'M', 'Ꮱ'), - (0xABB2, 'M', 'Ꮲ'), - (0xABB3, 'M', 'Ꮳ'), - (0xABB4, 'M', 'Ꮴ'), - (0xABB5, 'M', 'Ꮵ'), - (0xABB6, 'M', 'Ꮶ'), - (0xABB7, 'M', 'Ꮷ'), - (0xABB8, 'M', 'Ꮸ'), - (0xABB9, 'M', 'Ꮹ'), - (0xABBA, 'M', 'Ꮺ'), - (0xABBB, 'M', 'Ꮻ'), - (0xABBC, 'M', 'Ꮼ'), - (0xABBD, 'M', 'Ꮽ'), - (0xABBE, 'M', 'Ꮾ'), - (0xABBF, 'M', 'Ꮿ'), - (0xABC0, 'V'), - (0xABEE, 'X'), - (0xABF0, 'V'), - (0xABFA, 'X'), - (0xAC00, 'V'), - (0xD7A4, 'X'), - (0xD7B0, 'V'), - (0xD7C7, 'X'), - (0xD7CB, 'V'), - (0xD7FC, 'X'), - (0xF900, 'M', '豈'), - (0xF901, 'M', '更'), - (0xF902, 'M', '車'), - (0xF903, 'M', '賈'), - (0xF904, 'M', '滑'), - (0xF905, 'M', '串'), - (0xF906, 'M', '句'), - (0xF907, 'M', '龜'), - (0xF909, 'M', '契'), - (0xF90A, 'M', '金'), - (0xF90B, 'M', '喇'), - (0xF90C, 'M', '奈'), - (0xF90D, 'M', '懶'), - (0xF90E, 'M', '癩'), - (0xF90F, 'M', '羅'), - (0xF910, 'M', '蘿'), - (0xF911, 'M', '螺'), - (0xF912, 'M', '裸'), - (0xF913, 'M', '邏'), - (0xF914, 'M', '樂'), - (0xF915, 'M', '洛'), - (0xF916, 'M', '烙'), - (0xF917, 'M', '珞'), - (0xF918, 'M', '落'), - (0xF919, 'M', '酪'), - (0xF91A, 'M', '駱'), - (0xF91B, 'M', '亂'), - (0xF91C, 'M', '卵'), - (0xF91D, 'M', '欄'), - (0xF91E, 'M', '爛'), - (0xF91F, 'M', '蘭'), - (0xF920, 'M', '鸞'), - (0xF921, 'M', '嵐'), - (0xF922, 'M', '濫'), - (0xF923, 'M', '藍'), - (0xF924, 'M', '襤'), - (0xF925, 'M', '拉'), - (0xF926, 'M', '臘'), - (0xF927, 'M', '蠟'), - (0xF928, 'M', '廊'), - (0xF929, 'M', '朗'), - (0xF92A, 'M', '浪'), - (0xF92B, 'M', '狼'), - (0xF92C, 'M', '郎'), - (0xF92D, 'M', '來'), - (0xF92E, 'M', '冷'), - (0xF92F, 'M', '勞'), - (0xF930, 'M', '擄'), - (0xF931, 'M', '櫓'), - (0xF932, 'M', '爐'), - (0xF933, 'M', '盧'), - (0xF934, 'M', '老'), - (0xF935, 'M', '蘆'), - (0xF936, 'M', '虜'), - (0xF937, 'M', '路'), - (0xF938, 'M', '露'), - (0xF939, 'M', '魯'), - (0xF93A, 'M', '鷺'), - (0xF93B, 'M', '碌'), - (0xF93C, 'M', '祿'), - (0xF93D, 'M', '綠'), - (0xF93E, 'M', '菉'), - (0xF93F, 'M', '錄'), - (0xF940, 'M', '鹿'), - (0xF941, 'M', '論'), - (0xF942, 'M', '壟'), - (0xF943, 'M', '弄'), - (0xF944, 'M', '籠'), - (0xF945, 'M', '聾'), - ] - -def _seg_40() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0xF946, 'M', '牢'), - (0xF947, 'M', '磊'), - (0xF948, 'M', '賂'), - (0xF949, 'M', '雷'), - (0xF94A, 'M', '壘'), - (0xF94B, 'M', '屢'), - (0xF94C, 'M', '樓'), - (0xF94D, 'M', '淚'), - (0xF94E, 'M', '漏'), - (0xF94F, 'M', '累'), - (0xF950, 'M', '縷'), - (0xF951, 'M', '陋'), - (0xF952, 'M', '勒'), - (0xF953, 'M', '肋'), - (0xF954, 'M', '凜'), - (0xF955, 'M', '凌'), - (0xF956, 'M', '稜'), - (0xF957, 'M', '綾'), - (0xF958, 'M', '菱'), - (0xF959, 'M', '陵'), - (0xF95A, 'M', '讀'), - (0xF95B, 'M', '拏'), - (0xF95C, 'M', '樂'), - (0xF95D, 'M', '諾'), - (0xF95E, 'M', '丹'), - (0xF95F, 'M', '寧'), - (0xF960, 'M', '怒'), - (0xF961, 'M', '率'), - (0xF962, 'M', '異'), - (0xF963, 'M', '北'), - (0xF964, 'M', '磻'), - (0xF965, 'M', '便'), - (0xF966, 'M', '復'), - (0xF967, 'M', '不'), - (0xF968, 'M', '泌'), - (0xF969, 'M', '數'), - (0xF96A, 'M', '索'), - (0xF96B, 'M', '參'), - (0xF96C, 'M', '塞'), - (0xF96D, 'M', '省'), - (0xF96E, 'M', '葉'), - (0xF96F, 'M', '說'), - (0xF970, 'M', '殺'), - (0xF971, 'M', '辰'), - (0xF972, 'M', '沈'), - (0xF973, 'M', '拾'), - (0xF974, 'M', '若'), - (0xF975, 'M', '掠'), - (0xF976, 'M', '略'), - (0xF977, 'M', '亮'), - (0xF978, 'M', '兩'), - (0xF979, 'M', '凉'), - (0xF97A, 'M', '梁'), - (0xF97B, 'M', '糧'), - (0xF97C, 'M', '良'), - (0xF97D, 'M', '諒'), - (0xF97E, 'M', '量'), - (0xF97F, 'M', '勵'), - (0xF980, 'M', '呂'), - (0xF981, 'M', '女'), - (0xF982, 'M', '廬'), - (0xF983, 'M', '旅'), - (0xF984, 'M', '濾'), - (0xF985, 'M', '礪'), - (0xF986, 'M', '閭'), - (0xF987, 'M', '驪'), - (0xF988, 'M', '麗'), - (0xF989, 'M', '黎'), - (0xF98A, 'M', '力'), - (0xF98B, 'M', '曆'), - (0xF98C, 'M', '歷'), - (0xF98D, 'M', '轢'), - (0xF98E, 'M', '年'), - (0xF98F, 'M', '憐'), - (0xF990, 'M', '戀'), - (0xF991, 'M', '撚'), - (0xF992, 'M', '漣'), - (0xF993, 'M', '煉'), - (0xF994, 'M', '璉'), - (0xF995, 'M', '秊'), - (0xF996, 'M', '練'), - (0xF997, 'M', '聯'), - (0xF998, 'M', '輦'), - (0xF999, 'M', '蓮'), - (0xF99A, 'M', '連'), - (0xF99B, 'M', '鍊'), - (0xF99C, 'M', '列'), - (0xF99D, 'M', '劣'), - (0xF99E, 'M', '咽'), - (0xF99F, 'M', '烈'), - (0xF9A0, 'M', '裂'), - (0xF9A1, 'M', '說'), - (0xF9A2, 'M', '廉'), - (0xF9A3, 'M', '念'), - (0xF9A4, 'M', '捻'), - (0xF9A5, 'M', '殮'), - (0xF9A6, 'M', '簾'), - (0xF9A7, 'M', '獵'), - (0xF9A8, 'M', '令'), - (0xF9A9, 'M', '囹'), - ] - -def _seg_41() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0xF9AA, 'M', '寧'), - (0xF9AB, 'M', '嶺'), - (0xF9AC, 'M', '怜'), - (0xF9AD, 'M', '玲'), - (0xF9AE, 'M', '瑩'), - (0xF9AF, 'M', '羚'), - (0xF9B0, 'M', '聆'), - (0xF9B1, 'M', '鈴'), - (0xF9B2, 'M', '零'), - (0xF9B3, 'M', '靈'), - (0xF9B4, 'M', '領'), - (0xF9B5, 'M', '例'), - (0xF9B6, 'M', '禮'), - (0xF9B7, 'M', '醴'), - (0xF9B8, 'M', '隸'), - (0xF9B9, 'M', '惡'), - (0xF9BA, 'M', '了'), - (0xF9BB, 'M', '僚'), - (0xF9BC, 'M', '寮'), - (0xF9BD, 'M', '尿'), - (0xF9BE, 'M', '料'), - (0xF9BF, 'M', '樂'), - (0xF9C0, 'M', '燎'), - (0xF9C1, 'M', '療'), - (0xF9C2, 'M', '蓼'), - (0xF9C3, 'M', '遼'), - (0xF9C4, 'M', '龍'), - (0xF9C5, 'M', '暈'), - (0xF9C6, 'M', '阮'), - (0xF9C7, 'M', '劉'), - (0xF9C8, 'M', '杻'), - (0xF9C9, 'M', '柳'), - (0xF9CA, 'M', '流'), - (0xF9CB, 'M', '溜'), - (0xF9CC, 'M', '琉'), - (0xF9CD, 'M', '留'), - (0xF9CE, 'M', '硫'), - (0xF9CF, 'M', '紐'), - (0xF9D0, 'M', '類'), - (0xF9D1, 'M', '六'), - (0xF9D2, 'M', '戮'), - (0xF9D3, 'M', '陸'), - (0xF9D4, 'M', '倫'), - (0xF9D5, 'M', '崙'), - (0xF9D6, 'M', '淪'), - (0xF9D7, 'M', '輪'), - (0xF9D8, 'M', '律'), - (0xF9D9, 'M', '慄'), - (0xF9DA, 'M', '栗'), - (0xF9DB, 'M', '率'), - (0xF9DC, 'M', '隆'), - (0xF9DD, 'M', '利'), - (0xF9DE, 'M', '吏'), - (0xF9DF, 'M', '履'), - (0xF9E0, 'M', '易'), - (0xF9E1, 'M', '李'), - (0xF9E2, 'M', '梨'), - (0xF9E3, 'M', '泥'), - (0xF9E4, 'M', '理'), - (0xF9E5, 'M', '痢'), - (0xF9E6, 'M', '罹'), - (0xF9E7, 'M', '裏'), - (0xF9E8, 'M', '裡'), - (0xF9E9, 'M', '里'), - (0xF9EA, 'M', '離'), - (0xF9EB, 'M', '匿'), - (0xF9EC, 'M', '溺'), - (0xF9ED, 'M', '吝'), - (0xF9EE, 'M', '燐'), - (0xF9EF, 'M', '璘'), - (0xF9F0, 'M', '藺'), - (0xF9F1, 'M', '隣'), - (0xF9F2, 'M', '鱗'), - (0xF9F3, 'M', '麟'), - (0xF9F4, 'M', '林'), - (0xF9F5, 'M', '淋'), - (0xF9F6, 'M', '臨'), - (0xF9F7, 'M', '立'), - (0xF9F8, 'M', '笠'), - (0xF9F9, 'M', '粒'), - (0xF9FA, 'M', '狀'), - (0xF9FB, 'M', '炙'), - (0xF9FC, 'M', '識'), - (0xF9FD, 'M', '什'), - (0xF9FE, 'M', '茶'), - (0xF9FF, 'M', '刺'), - (0xFA00, 'M', '切'), - (0xFA01, 'M', '度'), - (0xFA02, 'M', '拓'), - (0xFA03, 'M', '糖'), - (0xFA04, 'M', '宅'), - (0xFA05, 'M', '洞'), - (0xFA06, 'M', '暴'), - (0xFA07, 'M', '輻'), - (0xFA08, 'M', '行'), - (0xFA09, 'M', '降'), - (0xFA0A, 'M', '見'), - (0xFA0B, 'M', '廓'), - (0xFA0C, 'M', '兀'), - (0xFA0D, 'M', '嗀'), - ] - -def _seg_42() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0xFA0E, 'V'), - (0xFA10, 'M', '塚'), - (0xFA11, 'V'), - (0xFA12, 'M', '晴'), - (0xFA13, 'V'), - (0xFA15, 'M', '凞'), - (0xFA16, 'M', '猪'), - (0xFA17, 'M', '益'), - (0xFA18, 'M', '礼'), - (0xFA19, 'M', '神'), - (0xFA1A, 'M', '祥'), - (0xFA1B, 'M', '福'), - (0xFA1C, 'M', '靖'), - (0xFA1D, 'M', '精'), - (0xFA1E, 'M', '羽'), - (0xFA1F, 'V'), - (0xFA20, 'M', '蘒'), - (0xFA21, 'V'), - (0xFA22, 'M', '諸'), - (0xFA23, 'V'), - (0xFA25, 'M', '逸'), - (0xFA26, 'M', '都'), - (0xFA27, 'V'), - (0xFA2A, 'M', '飯'), - (0xFA2B, 'M', '飼'), - (0xFA2C, 'M', '館'), - (0xFA2D, 'M', '鶴'), - (0xFA2E, 'M', '郞'), - (0xFA2F, 'M', '隷'), - (0xFA30, 'M', '侮'), - (0xFA31, 'M', '僧'), - (0xFA32, 'M', '免'), - (0xFA33, 'M', '勉'), - (0xFA34, 'M', '勤'), - (0xFA35, 'M', '卑'), - (0xFA36, 'M', '喝'), - (0xFA37, 'M', '嘆'), - (0xFA38, 'M', '器'), - (0xFA39, 'M', '塀'), - (0xFA3A, 'M', '墨'), - (0xFA3B, 'M', '層'), - (0xFA3C, 'M', '屮'), - (0xFA3D, 'M', '悔'), - (0xFA3E, 'M', '慨'), - (0xFA3F, 'M', '憎'), - (0xFA40, 'M', '懲'), - (0xFA41, 'M', '敏'), - (0xFA42, 'M', '既'), - (0xFA43, 'M', '暑'), - (0xFA44, 'M', '梅'), - (0xFA45, 'M', '海'), - (0xFA46, 'M', '渚'), - (0xFA47, 'M', '漢'), - (0xFA48, 'M', '煮'), - (0xFA49, 'M', '爫'), - (0xFA4A, 'M', '琢'), - (0xFA4B, 'M', '碑'), - (0xFA4C, 'M', '社'), - (0xFA4D, 'M', '祉'), - (0xFA4E, 'M', '祈'), - (0xFA4F, 'M', '祐'), - (0xFA50, 'M', '祖'), - (0xFA51, 'M', '祝'), - (0xFA52, 'M', '禍'), - (0xFA53, 'M', '禎'), - (0xFA54, 'M', '穀'), - (0xFA55, 'M', '突'), - (0xFA56, 'M', '節'), - (0xFA57, 'M', '練'), - (0xFA58, 'M', '縉'), - (0xFA59, 'M', '繁'), - (0xFA5A, 'M', '署'), - (0xFA5B, 'M', '者'), - (0xFA5C, 'M', '臭'), - (0xFA5D, 'M', '艹'), - (0xFA5F, 'M', '著'), - (0xFA60, 'M', '褐'), - (0xFA61, 'M', '視'), - (0xFA62, 'M', '謁'), - (0xFA63, 'M', '謹'), - (0xFA64, 'M', '賓'), - (0xFA65, 'M', '贈'), - (0xFA66, 'M', '辶'), - (0xFA67, 'M', '逸'), - (0xFA68, 'M', '難'), - (0xFA69, 'M', '響'), - (0xFA6A, 'M', '頻'), - (0xFA6B, 'M', '恵'), - (0xFA6C, 'M', '𤋮'), - (0xFA6D, 'M', '舘'), - (0xFA6E, 'X'), - (0xFA70, 'M', '並'), - (0xFA71, 'M', '况'), - (0xFA72, 'M', '全'), - (0xFA73, 'M', '侀'), - (0xFA74, 'M', '充'), - (0xFA75, 'M', '冀'), - (0xFA76, 'M', '勇'), - (0xFA77, 'M', '勺'), - (0xFA78, 'M', '喝'), - ] - -def _seg_43() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0xFA79, 'M', '啕'), - (0xFA7A, 'M', '喙'), - (0xFA7B, 'M', '嗢'), - (0xFA7C, 'M', '塚'), - (0xFA7D, 'M', '墳'), - (0xFA7E, 'M', '奄'), - (0xFA7F, 'M', '奔'), - (0xFA80, 'M', '婢'), - (0xFA81, 'M', '嬨'), - (0xFA82, 'M', '廒'), - (0xFA83, 'M', '廙'), - (0xFA84, 'M', '彩'), - (0xFA85, 'M', '徭'), - (0xFA86, 'M', '惘'), - (0xFA87, 'M', '慎'), - (0xFA88, 'M', '愈'), - (0xFA89, 'M', '憎'), - (0xFA8A, 'M', '慠'), - (0xFA8B, 'M', '懲'), - (0xFA8C, 'M', '戴'), - (0xFA8D, 'M', '揄'), - (0xFA8E, 'M', '搜'), - (0xFA8F, 'M', '摒'), - (0xFA90, 'M', '敖'), - (0xFA91, 'M', '晴'), - (0xFA92, 'M', '朗'), - (0xFA93, 'M', '望'), - (0xFA94, 'M', '杖'), - (0xFA95, 'M', '歹'), - (0xFA96, 'M', '殺'), - (0xFA97, 'M', '流'), - (0xFA98, 'M', '滛'), - (0xFA99, 'M', '滋'), - (0xFA9A, 'M', '漢'), - (0xFA9B, 'M', '瀞'), - (0xFA9C, 'M', '煮'), - (0xFA9D, 'M', '瞧'), - (0xFA9E, 'M', '爵'), - (0xFA9F, 'M', '犯'), - (0xFAA0, 'M', '猪'), - (0xFAA1, 'M', '瑱'), - (0xFAA2, 'M', '甆'), - (0xFAA3, 'M', '画'), - (0xFAA4, 'M', '瘝'), - (0xFAA5, 'M', '瘟'), - (0xFAA6, 'M', '益'), - (0xFAA7, 'M', '盛'), - (0xFAA8, 'M', '直'), - (0xFAA9, 'M', '睊'), - (0xFAAA, 'M', '着'), - (0xFAAB, 'M', '磌'), - (0xFAAC, 'M', '窱'), - (0xFAAD, 'M', '節'), - (0xFAAE, 'M', '类'), - (0xFAAF, 'M', '絛'), - (0xFAB0, 'M', '練'), - (0xFAB1, 'M', '缾'), - (0xFAB2, 'M', '者'), - (0xFAB3, 'M', '荒'), - (0xFAB4, 'M', '華'), - (0xFAB5, 'M', '蝹'), - (0xFAB6, 'M', '襁'), - (0xFAB7, 'M', '覆'), - (0xFAB8, 'M', '視'), - (0xFAB9, 'M', '調'), - (0xFABA, 'M', '諸'), - (0xFABB, 'M', '請'), - (0xFABC, 'M', '謁'), - (0xFABD, 'M', '諾'), - (0xFABE, 'M', '諭'), - (0xFABF, 'M', '謹'), - (0xFAC0, 'M', '變'), - (0xFAC1, 'M', '贈'), - (0xFAC2, 'M', '輸'), - (0xFAC3, 'M', '遲'), - (0xFAC4, 'M', '醙'), - (0xFAC5, 'M', '鉶'), - (0xFAC6, 'M', '陼'), - (0xFAC7, 'M', '難'), - (0xFAC8, 'M', '靖'), - (0xFAC9, 'M', '韛'), - (0xFACA, 'M', '響'), - (0xFACB, 'M', '頋'), - (0xFACC, 'M', '頻'), - (0xFACD, 'M', '鬒'), - (0xFACE, 'M', '龜'), - (0xFACF, 'M', '𢡊'), - (0xFAD0, 'M', '𢡄'), - (0xFAD1, 'M', '𣏕'), - (0xFAD2, 'M', '㮝'), - (0xFAD3, 'M', '䀘'), - (0xFAD4, 'M', '䀹'), - (0xFAD5, 'M', '𥉉'), - (0xFAD6, 'M', '𥳐'), - (0xFAD7, 'M', '𧻓'), - (0xFAD8, 'M', '齃'), - (0xFAD9, 'M', '龎'), - (0xFADA, 'X'), - (0xFB00, 'M', 'ff'), - (0xFB01, 'M', 'fi'), - ] - -def _seg_44() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0xFB02, 'M', 'fl'), - (0xFB03, 'M', 'ffi'), - (0xFB04, 'M', 'ffl'), - (0xFB05, 'M', 'st'), - (0xFB07, 'X'), - (0xFB13, 'M', 'մն'), - (0xFB14, 'M', 'մե'), - (0xFB15, 'M', 'մի'), - (0xFB16, 'M', 'վն'), - (0xFB17, 'M', 'մխ'), - (0xFB18, 'X'), - (0xFB1D, 'M', 'יִ'), - (0xFB1E, 'V'), - (0xFB1F, 'M', 'ײַ'), - (0xFB20, 'M', 'ע'), - (0xFB21, 'M', 'א'), - (0xFB22, 'M', 'ד'), - (0xFB23, 'M', 'ה'), - (0xFB24, 'M', 'כ'), - (0xFB25, 'M', 'ל'), - (0xFB26, 'M', 'ם'), - (0xFB27, 'M', 'ר'), - (0xFB28, 'M', 'ת'), - (0xFB29, '3', '+'), - (0xFB2A, 'M', 'שׁ'), - (0xFB2B, 'M', 'שׂ'), - (0xFB2C, 'M', 'שּׁ'), - (0xFB2D, 'M', 'שּׂ'), - (0xFB2E, 'M', 'אַ'), - (0xFB2F, 'M', 'אָ'), - (0xFB30, 'M', 'אּ'), - (0xFB31, 'M', 'בּ'), - (0xFB32, 'M', 'גּ'), - (0xFB33, 'M', 'דּ'), - (0xFB34, 'M', 'הּ'), - (0xFB35, 'M', 'וּ'), - (0xFB36, 'M', 'זּ'), - (0xFB37, 'X'), - (0xFB38, 'M', 'טּ'), - (0xFB39, 'M', 'יּ'), - (0xFB3A, 'M', 'ךּ'), - (0xFB3B, 'M', 'כּ'), - (0xFB3C, 'M', 'לּ'), - (0xFB3D, 'X'), - (0xFB3E, 'M', 'מּ'), - (0xFB3F, 'X'), - (0xFB40, 'M', 'נּ'), - (0xFB41, 'M', 'סּ'), - (0xFB42, 'X'), - (0xFB43, 'M', 'ףּ'), - (0xFB44, 'M', 'פּ'), - (0xFB45, 'X'), - (0xFB46, 'M', 'צּ'), - (0xFB47, 'M', 'קּ'), - (0xFB48, 'M', 'רּ'), - (0xFB49, 'M', 'שּ'), - (0xFB4A, 'M', 'תּ'), - (0xFB4B, 'M', 'וֹ'), - (0xFB4C, 'M', 'בֿ'), - (0xFB4D, 'M', 'כֿ'), - (0xFB4E, 'M', 'פֿ'), - (0xFB4F, 'M', 'אל'), - (0xFB50, 'M', 'ٱ'), - (0xFB52, 'M', 'ٻ'), - (0xFB56, 'M', 'پ'), - (0xFB5A, 'M', 'ڀ'), - (0xFB5E, 'M', 'ٺ'), - (0xFB62, 'M', 'ٿ'), - (0xFB66, 'M', 'ٹ'), - (0xFB6A, 'M', 'ڤ'), - (0xFB6E, 'M', 'ڦ'), - (0xFB72, 'M', 'ڄ'), - (0xFB76, 'M', 'ڃ'), - (0xFB7A, 'M', 'چ'), - (0xFB7E, 'M', 'ڇ'), - (0xFB82, 'M', 'ڍ'), - (0xFB84, 'M', 'ڌ'), - (0xFB86, 'M', 'ڎ'), - (0xFB88, 'M', 'ڈ'), - (0xFB8A, 'M', 'ژ'), - (0xFB8C, 'M', 'ڑ'), - (0xFB8E, 'M', 'ک'), - (0xFB92, 'M', 'گ'), - (0xFB96, 'M', 'ڳ'), - (0xFB9A, 'M', 'ڱ'), - (0xFB9E, 'M', 'ں'), - (0xFBA0, 'M', 'ڻ'), - (0xFBA4, 'M', 'ۀ'), - (0xFBA6, 'M', 'ہ'), - (0xFBAA, 'M', 'ھ'), - (0xFBAE, 'M', 'ے'), - (0xFBB0, 'M', 'ۓ'), - (0xFBB2, 'V'), - (0xFBC3, 'X'), - (0xFBD3, 'M', 'ڭ'), - (0xFBD7, 'M', 'ۇ'), - (0xFBD9, 'M', 'ۆ'), - (0xFBDB, 'M', 'ۈ'), - (0xFBDD, 'M', 'ۇٴ'), - (0xFBDE, 'M', 'ۋ'), - ] - -def _seg_45() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0xFBE0, 'M', 'ۅ'), - (0xFBE2, 'M', 'ۉ'), - (0xFBE4, 'M', 'ې'), - (0xFBE8, 'M', 'ى'), - (0xFBEA, 'M', 'ئا'), - (0xFBEC, 'M', 'ئە'), - (0xFBEE, 'M', 'ئو'), - (0xFBF0, 'M', 'ئۇ'), - (0xFBF2, 'M', 'ئۆ'), - (0xFBF4, 'M', 'ئۈ'), - (0xFBF6, 'M', 'ئې'), - (0xFBF9, 'M', 'ئى'), - (0xFBFC, 'M', 'ی'), - (0xFC00, 'M', 'ئج'), - (0xFC01, 'M', 'ئح'), - (0xFC02, 'M', 'ئم'), - (0xFC03, 'M', 'ئى'), - (0xFC04, 'M', 'ئي'), - (0xFC05, 'M', 'بج'), - (0xFC06, 'M', 'بح'), - (0xFC07, 'M', 'بخ'), - (0xFC08, 'M', 'بم'), - (0xFC09, 'M', 'بى'), - (0xFC0A, 'M', 'بي'), - (0xFC0B, 'M', 'تج'), - (0xFC0C, 'M', 'تح'), - (0xFC0D, 'M', 'تخ'), - (0xFC0E, 'M', 'تم'), - (0xFC0F, 'M', 'تى'), - (0xFC10, 'M', 'تي'), - (0xFC11, 'M', 'ثج'), - (0xFC12, 'M', 'ثم'), - (0xFC13, 'M', 'ثى'), - (0xFC14, 'M', 'ثي'), - (0xFC15, 'M', 'جح'), - (0xFC16, 'M', 'جم'), - (0xFC17, 'M', 'حج'), - (0xFC18, 'M', 'حم'), - (0xFC19, 'M', 'خج'), - (0xFC1A, 'M', 'خح'), - (0xFC1B, 'M', 'خم'), - (0xFC1C, 'M', 'سج'), - (0xFC1D, 'M', 'سح'), - (0xFC1E, 'M', 'سخ'), - (0xFC1F, 'M', 'سم'), - (0xFC20, 'M', 'صح'), - (0xFC21, 'M', 'صم'), - (0xFC22, 'M', 'ضج'), - (0xFC23, 'M', 'ضح'), - (0xFC24, 'M', 'ضخ'), - (0xFC25, 'M', 'ضم'), - (0xFC26, 'M', 'طح'), - (0xFC27, 'M', 'طم'), - (0xFC28, 'M', 'ظم'), - (0xFC29, 'M', 'عج'), - (0xFC2A, 'M', 'عم'), - (0xFC2B, 'M', 'غج'), - (0xFC2C, 'M', 'غم'), - (0xFC2D, 'M', 'فج'), - (0xFC2E, 'M', 'فح'), - (0xFC2F, 'M', 'فخ'), - (0xFC30, 'M', 'فم'), - (0xFC31, 'M', 'فى'), - (0xFC32, 'M', 'في'), - (0xFC33, 'M', 'قح'), - (0xFC34, 'M', 'قم'), - (0xFC35, 'M', 'قى'), - (0xFC36, 'M', 'قي'), - (0xFC37, 'M', 'كا'), - (0xFC38, 'M', 'كج'), - (0xFC39, 'M', 'كح'), - (0xFC3A, 'M', 'كخ'), - (0xFC3B, 'M', 'كل'), - (0xFC3C, 'M', 'كم'), - (0xFC3D, 'M', 'كى'), - (0xFC3E, 'M', 'كي'), - (0xFC3F, 'M', 'لج'), - (0xFC40, 'M', 'لح'), - (0xFC41, 'M', 'لخ'), - (0xFC42, 'M', 'لم'), - (0xFC43, 'M', 'لى'), - (0xFC44, 'M', 'لي'), - (0xFC45, 'M', 'مج'), - (0xFC46, 'M', 'مح'), - (0xFC47, 'M', 'مخ'), - (0xFC48, 'M', 'مم'), - (0xFC49, 'M', 'مى'), - (0xFC4A, 'M', 'مي'), - (0xFC4B, 'M', 'نج'), - (0xFC4C, 'M', 'نح'), - (0xFC4D, 'M', 'نخ'), - (0xFC4E, 'M', 'نم'), - (0xFC4F, 'M', 'نى'), - (0xFC50, 'M', 'ني'), - (0xFC51, 'M', 'هج'), - (0xFC52, 'M', 'هم'), - (0xFC53, 'M', 'هى'), - (0xFC54, 'M', 'هي'), - (0xFC55, 'M', 'يج'), - (0xFC56, 'M', 'يح'), - ] - -def _seg_46() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0xFC57, 'M', 'يخ'), - (0xFC58, 'M', 'يم'), - (0xFC59, 'M', 'يى'), - (0xFC5A, 'M', 'يي'), - (0xFC5B, 'M', 'ذٰ'), - (0xFC5C, 'M', 'رٰ'), - (0xFC5D, 'M', 'ىٰ'), - (0xFC5E, '3', ' ٌّ'), - (0xFC5F, '3', ' ٍّ'), - (0xFC60, '3', ' َّ'), - (0xFC61, '3', ' ُّ'), - (0xFC62, '3', ' ِّ'), - (0xFC63, '3', ' ّٰ'), - (0xFC64, 'M', 'ئر'), - (0xFC65, 'M', 'ئز'), - (0xFC66, 'M', 'ئم'), - (0xFC67, 'M', 'ئن'), - (0xFC68, 'M', 'ئى'), - (0xFC69, 'M', 'ئي'), - (0xFC6A, 'M', 'بر'), - (0xFC6B, 'M', 'بز'), - (0xFC6C, 'M', 'بم'), - (0xFC6D, 'M', 'بن'), - (0xFC6E, 'M', 'بى'), - (0xFC6F, 'M', 'بي'), - (0xFC70, 'M', 'تر'), - (0xFC71, 'M', 'تز'), - (0xFC72, 'M', 'تم'), - (0xFC73, 'M', 'تن'), - (0xFC74, 'M', 'تى'), - (0xFC75, 'M', 'تي'), - (0xFC76, 'M', 'ثر'), - (0xFC77, 'M', 'ثز'), - (0xFC78, 'M', 'ثم'), - (0xFC79, 'M', 'ثن'), - (0xFC7A, 'M', 'ثى'), - (0xFC7B, 'M', 'ثي'), - (0xFC7C, 'M', 'فى'), - (0xFC7D, 'M', 'في'), - (0xFC7E, 'M', 'قى'), - (0xFC7F, 'M', 'قي'), - (0xFC80, 'M', 'كا'), - (0xFC81, 'M', 'كل'), - (0xFC82, 'M', 'كم'), - (0xFC83, 'M', 'كى'), - (0xFC84, 'M', 'كي'), - (0xFC85, 'M', 'لم'), - (0xFC86, 'M', 'لى'), - (0xFC87, 'M', 'لي'), - (0xFC88, 'M', 'ما'), - (0xFC89, 'M', 'مم'), - (0xFC8A, 'M', 'نر'), - (0xFC8B, 'M', 'نز'), - (0xFC8C, 'M', 'نم'), - (0xFC8D, 'M', 'نن'), - (0xFC8E, 'M', 'نى'), - (0xFC8F, 'M', 'ني'), - (0xFC90, 'M', 'ىٰ'), - (0xFC91, 'M', 'ير'), - (0xFC92, 'M', 'يز'), - (0xFC93, 'M', 'يم'), - (0xFC94, 'M', 'ين'), - (0xFC95, 'M', 'يى'), - (0xFC96, 'M', 'يي'), - (0xFC97, 'M', 'ئج'), - (0xFC98, 'M', 'ئح'), - (0xFC99, 'M', 'ئخ'), - (0xFC9A, 'M', 'ئم'), - (0xFC9B, 'M', 'ئه'), - (0xFC9C, 'M', 'بج'), - (0xFC9D, 'M', 'بح'), - (0xFC9E, 'M', 'بخ'), - (0xFC9F, 'M', 'بم'), - (0xFCA0, 'M', 'به'), - (0xFCA1, 'M', 'تج'), - (0xFCA2, 'M', 'تح'), - (0xFCA3, 'M', 'تخ'), - (0xFCA4, 'M', 'تم'), - (0xFCA5, 'M', 'ته'), - (0xFCA6, 'M', 'ثم'), - (0xFCA7, 'M', 'جح'), - (0xFCA8, 'M', 'جم'), - (0xFCA9, 'M', 'حج'), - (0xFCAA, 'M', 'حم'), - (0xFCAB, 'M', 'خج'), - (0xFCAC, 'M', 'خم'), - (0xFCAD, 'M', 'سج'), - (0xFCAE, 'M', 'سح'), - (0xFCAF, 'M', 'سخ'), - (0xFCB0, 'M', 'سم'), - (0xFCB1, 'M', 'صح'), - (0xFCB2, 'M', 'صخ'), - (0xFCB3, 'M', 'صم'), - (0xFCB4, 'M', 'ضج'), - (0xFCB5, 'M', 'ضح'), - (0xFCB6, 'M', 'ضخ'), - (0xFCB7, 'M', 'ضم'), - (0xFCB8, 'M', 'طح'), - (0xFCB9, 'M', 'ظم'), - (0xFCBA, 'M', 'عج'), - ] - -def _seg_47() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0xFCBB, 'M', 'عم'), - (0xFCBC, 'M', 'غج'), - (0xFCBD, 'M', 'غم'), - (0xFCBE, 'M', 'فج'), - (0xFCBF, 'M', 'فح'), - (0xFCC0, 'M', 'فخ'), - (0xFCC1, 'M', 'فم'), - (0xFCC2, 'M', 'قح'), - (0xFCC3, 'M', 'قم'), - (0xFCC4, 'M', 'كج'), - (0xFCC5, 'M', 'كح'), - (0xFCC6, 'M', 'كخ'), - (0xFCC7, 'M', 'كل'), - (0xFCC8, 'M', 'كم'), - (0xFCC9, 'M', 'لج'), - (0xFCCA, 'M', 'لح'), - (0xFCCB, 'M', 'لخ'), - (0xFCCC, 'M', 'لم'), - (0xFCCD, 'M', 'له'), - (0xFCCE, 'M', 'مج'), - (0xFCCF, 'M', 'مح'), - (0xFCD0, 'M', 'مخ'), - (0xFCD1, 'M', 'مم'), - (0xFCD2, 'M', 'نج'), - (0xFCD3, 'M', 'نح'), - (0xFCD4, 'M', 'نخ'), - (0xFCD5, 'M', 'نم'), - (0xFCD6, 'M', 'نه'), - (0xFCD7, 'M', 'هج'), - (0xFCD8, 'M', 'هم'), - (0xFCD9, 'M', 'هٰ'), - (0xFCDA, 'M', 'يج'), - (0xFCDB, 'M', 'يح'), - (0xFCDC, 'M', 'يخ'), - (0xFCDD, 'M', 'يم'), - (0xFCDE, 'M', 'يه'), - (0xFCDF, 'M', 'ئم'), - (0xFCE0, 'M', 'ئه'), - (0xFCE1, 'M', 'بم'), - (0xFCE2, 'M', 'به'), - (0xFCE3, 'M', 'تم'), - (0xFCE4, 'M', 'ته'), - (0xFCE5, 'M', 'ثم'), - (0xFCE6, 'M', 'ثه'), - (0xFCE7, 'M', 'سم'), - (0xFCE8, 'M', 'سه'), - (0xFCE9, 'M', 'شم'), - (0xFCEA, 'M', 'شه'), - (0xFCEB, 'M', 'كل'), - (0xFCEC, 'M', 'كم'), - (0xFCED, 'M', 'لم'), - (0xFCEE, 'M', 'نم'), - (0xFCEF, 'M', 'نه'), - (0xFCF0, 'M', 'يم'), - (0xFCF1, 'M', 'يه'), - (0xFCF2, 'M', 'ـَّ'), - (0xFCF3, 'M', 'ـُّ'), - (0xFCF4, 'M', 'ـِّ'), - (0xFCF5, 'M', 'طى'), - (0xFCF6, 'M', 'طي'), - (0xFCF7, 'M', 'عى'), - (0xFCF8, 'M', 'عي'), - (0xFCF9, 'M', 'غى'), - (0xFCFA, 'M', 'غي'), - (0xFCFB, 'M', 'سى'), - (0xFCFC, 'M', 'سي'), - (0xFCFD, 'M', 'شى'), - (0xFCFE, 'M', 'شي'), - (0xFCFF, 'M', 'حى'), - (0xFD00, 'M', 'حي'), - (0xFD01, 'M', 'جى'), - (0xFD02, 'M', 'جي'), - (0xFD03, 'M', 'خى'), - (0xFD04, 'M', 'خي'), - (0xFD05, 'M', 'صى'), - (0xFD06, 'M', 'صي'), - (0xFD07, 'M', 'ضى'), - (0xFD08, 'M', 'ضي'), - (0xFD09, 'M', 'شج'), - (0xFD0A, 'M', 'شح'), - (0xFD0B, 'M', 'شخ'), - (0xFD0C, 'M', 'شم'), - (0xFD0D, 'M', 'شر'), - (0xFD0E, 'M', 'سر'), - (0xFD0F, 'M', 'صر'), - (0xFD10, 'M', 'ضر'), - (0xFD11, 'M', 'طى'), - (0xFD12, 'M', 'طي'), - (0xFD13, 'M', 'عى'), - (0xFD14, 'M', 'عي'), - (0xFD15, 'M', 'غى'), - (0xFD16, 'M', 'غي'), - (0xFD17, 'M', 'سى'), - (0xFD18, 'M', 'سي'), - (0xFD19, 'M', 'شى'), - (0xFD1A, 'M', 'شي'), - (0xFD1B, 'M', 'حى'), - (0xFD1C, 'M', 'حي'), - (0xFD1D, 'M', 'جى'), - (0xFD1E, 'M', 'جي'), - ] - -def _seg_48() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0xFD1F, 'M', 'خى'), - (0xFD20, 'M', 'خي'), - (0xFD21, 'M', 'صى'), - (0xFD22, 'M', 'صي'), - (0xFD23, 'M', 'ضى'), - (0xFD24, 'M', 'ضي'), - (0xFD25, 'M', 'شج'), - (0xFD26, 'M', 'شح'), - (0xFD27, 'M', 'شخ'), - (0xFD28, 'M', 'شم'), - (0xFD29, 'M', 'شر'), - (0xFD2A, 'M', 'سر'), - (0xFD2B, 'M', 'صر'), - (0xFD2C, 'M', 'ضر'), - (0xFD2D, 'M', 'شج'), - (0xFD2E, 'M', 'شح'), - (0xFD2F, 'M', 'شخ'), - (0xFD30, 'M', 'شم'), - (0xFD31, 'M', 'سه'), - (0xFD32, 'M', 'شه'), - (0xFD33, 'M', 'طم'), - (0xFD34, 'M', 'سج'), - (0xFD35, 'M', 'سح'), - (0xFD36, 'M', 'سخ'), - (0xFD37, 'M', 'شج'), - (0xFD38, 'M', 'شح'), - (0xFD39, 'M', 'شخ'), - (0xFD3A, 'M', 'طم'), - (0xFD3B, 'M', 'ظم'), - (0xFD3C, 'M', 'اً'), - (0xFD3E, 'V'), - (0xFD50, 'M', 'تجم'), - (0xFD51, 'M', 'تحج'), - (0xFD53, 'M', 'تحم'), - (0xFD54, 'M', 'تخم'), - (0xFD55, 'M', 'تمج'), - (0xFD56, 'M', 'تمح'), - (0xFD57, 'M', 'تمخ'), - (0xFD58, 'M', 'جمح'), - (0xFD5A, 'M', 'حمي'), - (0xFD5B, 'M', 'حمى'), - (0xFD5C, 'M', 'سحج'), - (0xFD5D, 'M', 'سجح'), - (0xFD5E, 'M', 'سجى'), - (0xFD5F, 'M', 'سمح'), - (0xFD61, 'M', 'سمج'), - (0xFD62, 'M', 'سمم'), - (0xFD64, 'M', 'صحح'), - (0xFD66, 'M', 'صمم'), - (0xFD67, 'M', 'شحم'), - (0xFD69, 'M', 'شجي'), - (0xFD6A, 'M', 'شمخ'), - (0xFD6C, 'M', 'شمم'), - (0xFD6E, 'M', 'ضحى'), - (0xFD6F, 'M', 'ضخم'), - (0xFD71, 'M', 'طمح'), - (0xFD73, 'M', 'طمم'), - (0xFD74, 'M', 'طمي'), - (0xFD75, 'M', 'عجم'), - (0xFD76, 'M', 'عمم'), - (0xFD78, 'M', 'عمى'), - (0xFD79, 'M', 'غمم'), - (0xFD7A, 'M', 'غمي'), - (0xFD7B, 'M', 'غمى'), - (0xFD7C, 'M', 'فخم'), - (0xFD7E, 'M', 'قمح'), - (0xFD7F, 'M', 'قمم'), - (0xFD80, 'M', 'لحم'), - (0xFD81, 'M', 'لحي'), - (0xFD82, 'M', 'لحى'), - (0xFD83, 'M', 'لجج'), - (0xFD85, 'M', 'لخم'), - (0xFD87, 'M', 'لمح'), - (0xFD89, 'M', 'محج'), - (0xFD8A, 'M', 'محم'), - (0xFD8B, 'M', 'محي'), - (0xFD8C, 'M', 'مجح'), - (0xFD8D, 'M', 'مجم'), - (0xFD8E, 'M', 'مخج'), - (0xFD8F, 'M', 'مخم'), - (0xFD90, 'X'), - (0xFD92, 'M', 'مجخ'), - (0xFD93, 'M', 'همج'), - (0xFD94, 'M', 'همم'), - (0xFD95, 'M', 'نحم'), - (0xFD96, 'M', 'نحى'), - (0xFD97, 'M', 'نجم'), - (0xFD99, 'M', 'نجى'), - (0xFD9A, 'M', 'نمي'), - (0xFD9B, 'M', 'نمى'), - (0xFD9C, 'M', 'يمم'), - (0xFD9E, 'M', 'بخي'), - (0xFD9F, 'M', 'تجي'), - (0xFDA0, 'M', 'تجى'), - (0xFDA1, 'M', 'تخي'), - (0xFDA2, 'M', 'تخى'), - (0xFDA3, 'M', 'تمي'), - (0xFDA4, 'M', 'تمى'), - (0xFDA5, 'M', 'جمي'), - (0xFDA6, 'M', 'جحى'), - ] - -def _seg_49() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0xFDA7, 'M', 'جمى'), - (0xFDA8, 'M', 'سخى'), - (0xFDA9, 'M', 'صحي'), - (0xFDAA, 'M', 'شحي'), - (0xFDAB, 'M', 'ضحي'), - (0xFDAC, 'M', 'لجي'), - (0xFDAD, 'M', 'لمي'), - (0xFDAE, 'M', 'يحي'), - (0xFDAF, 'M', 'يجي'), - (0xFDB0, 'M', 'يمي'), - (0xFDB1, 'M', 'ممي'), - (0xFDB2, 'M', 'قمي'), - (0xFDB3, 'M', 'نحي'), - (0xFDB4, 'M', 'قمح'), - (0xFDB5, 'M', 'لحم'), - (0xFDB6, 'M', 'عمي'), - (0xFDB7, 'M', 'كمي'), - (0xFDB8, 'M', 'نجح'), - (0xFDB9, 'M', 'مخي'), - (0xFDBA, 'M', 'لجم'), - (0xFDBB, 'M', 'كمم'), - (0xFDBC, 'M', 'لجم'), - (0xFDBD, 'M', 'نجح'), - (0xFDBE, 'M', 'جحي'), - (0xFDBF, 'M', 'حجي'), - (0xFDC0, 'M', 'مجي'), - (0xFDC1, 'M', 'فمي'), - (0xFDC2, 'M', 'بحي'), - (0xFDC3, 'M', 'كمم'), - (0xFDC4, 'M', 'عجم'), - (0xFDC5, 'M', 'صمم'), - (0xFDC6, 'M', 'سخي'), - (0xFDC7, 'M', 'نجي'), - (0xFDC8, 'X'), - (0xFDCF, 'V'), - (0xFDD0, 'X'), - (0xFDF0, 'M', 'صلے'), - (0xFDF1, 'M', 'قلے'), - (0xFDF2, 'M', 'الله'), - (0xFDF3, 'M', 'اكبر'), - (0xFDF4, 'M', 'محمد'), - (0xFDF5, 'M', 'صلعم'), - (0xFDF6, 'M', 'رسول'), - (0xFDF7, 'M', 'عليه'), - (0xFDF8, 'M', 'وسلم'), - (0xFDF9, 'M', 'صلى'), - (0xFDFA, '3', 'صلى الله عليه وسلم'), - (0xFDFB, '3', 'جل جلاله'), - (0xFDFC, 'M', 'ریال'), - (0xFDFD, 'V'), - (0xFE00, 'I'), - (0xFE10, '3', ','), - (0xFE11, 'M', '、'), - (0xFE12, 'X'), - (0xFE13, '3', ':'), - (0xFE14, '3', ';'), - (0xFE15, '3', '!'), - (0xFE16, '3', '?'), - (0xFE17, 'M', '〖'), - (0xFE18, 'M', '〗'), - (0xFE19, 'X'), - (0xFE20, 'V'), - (0xFE30, 'X'), - (0xFE31, 'M', '—'), - (0xFE32, 'M', '–'), - (0xFE33, '3', '_'), - (0xFE35, '3', '('), - (0xFE36, '3', ')'), - (0xFE37, '3', '{'), - (0xFE38, '3', '}'), - (0xFE39, 'M', '〔'), - (0xFE3A, 'M', '〕'), - (0xFE3B, 'M', '【'), - (0xFE3C, 'M', '】'), - (0xFE3D, 'M', '《'), - (0xFE3E, 'M', '》'), - (0xFE3F, 'M', '〈'), - (0xFE40, 'M', '〉'), - (0xFE41, 'M', '「'), - (0xFE42, 'M', '」'), - (0xFE43, 'M', '『'), - (0xFE44, 'M', '』'), - (0xFE45, 'V'), - (0xFE47, '3', '['), - (0xFE48, '3', ']'), - (0xFE49, '3', ' ̅'), - (0xFE4D, '3', '_'), - (0xFE50, '3', ','), - (0xFE51, 'M', '、'), - (0xFE52, 'X'), - (0xFE54, '3', ';'), - (0xFE55, '3', ':'), - (0xFE56, '3', '?'), - (0xFE57, '3', '!'), - (0xFE58, 'M', '—'), - (0xFE59, '3', '('), - (0xFE5A, '3', ')'), - (0xFE5B, '3', '{'), - (0xFE5C, '3', '}'), - (0xFE5D, 'M', '〔'), - ] - -def _seg_50() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0xFE5E, 'M', '〕'), - (0xFE5F, '3', '#'), - (0xFE60, '3', '&'), - (0xFE61, '3', '*'), - (0xFE62, '3', '+'), - (0xFE63, 'M', '-'), - (0xFE64, '3', '<'), - (0xFE65, '3', '>'), - (0xFE66, '3', '='), - (0xFE67, 'X'), - (0xFE68, '3', '\\'), - (0xFE69, '3', '$'), - (0xFE6A, '3', '%'), - (0xFE6B, '3', '@'), - (0xFE6C, 'X'), - (0xFE70, '3', ' ً'), - (0xFE71, 'M', 'ـً'), - (0xFE72, '3', ' ٌ'), - (0xFE73, 'V'), - (0xFE74, '3', ' ٍ'), - (0xFE75, 'X'), - (0xFE76, '3', ' َ'), - (0xFE77, 'M', 'ـَ'), - (0xFE78, '3', ' ُ'), - (0xFE79, 'M', 'ـُ'), - (0xFE7A, '3', ' ِ'), - (0xFE7B, 'M', 'ـِ'), - (0xFE7C, '3', ' ّ'), - (0xFE7D, 'M', 'ـّ'), - (0xFE7E, '3', ' ْ'), - (0xFE7F, 'M', 'ـْ'), - (0xFE80, 'M', 'ء'), - (0xFE81, 'M', 'آ'), - (0xFE83, 'M', 'أ'), - (0xFE85, 'M', 'ؤ'), - (0xFE87, 'M', 'إ'), - (0xFE89, 'M', 'ئ'), - (0xFE8D, 'M', 'ا'), - (0xFE8F, 'M', 'ب'), - (0xFE93, 'M', 'ة'), - (0xFE95, 'M', 'ت'), - (0xFE99, 'M', 'ث'), - (0xFE9D, 'M', 'ج'), - (0xFEA1, 'M', 'ح'), - (0xFEA5, 'M', 'خ'), - (0xFEA9, 'M', 'د'), - (0xFEAB, 'M', 'ذ'), - (0xFEAD, 'M', 'ر'), - (0xFEAF, 'M', 'ز'), - (0xFEB1, 'M', 'س'), - (0xFEB5, 'M', 'ش'), - (0xFEB9, 'M', 'ص'), - (0xFEBD, 'M', 'ض'), - (0xFEC1, 'M', 'ط'), - (0xFEC5, 'M', 'ظ'), - (0xFEC9, 'M', 'ع'), - (0xFECD, 'M', 'غ'), - (0xFED1, 'M', 'ف'), - (0xFED5, 'M', 'ق'), - (0xFED9, 'M', 'ك'), - (0xFEDD, 'M', 'ل'), - (0xFEE1, 'M', 'م'), - (0xFEE5, 'M', 'ن'), - (0xFEE9, 'M', 'ه'), - (0xFEED, 'M', 'و'), - (0xFEEF, 'M', 'ى'), - (0xFEF1, 'M', 'ي'), - (0xFEF5, 'M', 'لآ'), - (0xFEF7, 'M', 'لأ'), - (0xFEF9, 'M', 'لإ'), - (0xFEFB, 'M', 'لا'), - (0xFEFD, 'X'), - (0xFEFF, 'I'), - (0xFF00, 'X'), - (0xFF01, '3', '!'), - (0xFF02, '3', '"'), - (0xFF03, '3', '#'), - (0xFF04, '3', '$'), - (0xFF05, '3', '%'), - (0xFF06, '3', '&'), - (0xFF07, '3', '\''), - (0xFF08, '3', '('), - (0xFF09, '3', ')'), - (0xFF0A, '3', '*'), - (0xFF0B, '3', '+'), - (0xFF0C, '3', ','), - (0xFF0D, 'M', '-'), - (0xFF0E, 'M', '.'), - (0xFF0F, '3', '/'), - (0xFF10, 'M', '0'), - (0xFF11, 'M', '1'), - (0xFF12, 'M', '2'), - (0xFF13, 'M', '3'), - (0xFF14, 'M', '4'), - (0xFF15, 'M', '5'), - (0xFF16, 'M', '6'), - (0xFF17, 'M', '7'), - (0xFF18, 'M', '8'), - (0xFF19, 'M', '9'), - (0xFF1A, '3', ':'), - ] - -def _seg_51() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0xFF1B, '3', ';'), - (0xFF1C, '3', '<'), - (0xFF1D, '3', '='), - (0xFF1E, '3', '>'), - (0xFF1F, '3', '?'), - (0xFF20, '3', '@'), - (0xFF21, 'M', 'a'), - (0xFF22, 'M', 'b'), - (0xFF23, 'M', 'c'), - (0xFF24, 'M', 'd'), - (0xFF25, 'M', 'e'), - (0xFF26, 'M', 'f'), - (0xFF27, 'M', 'g'), - (0xFF28, 'M', 'h'), - (0xFF29, 'M', 'i'), - (0xFF2A, 'M', 'j'), - (0xFF2B, 'M', 'k'), - (0xFF2C, 'M', 'l'), - (0xFF2D, 'M', 'm'), - (0xFF2E, 'M', 'n'), - (0xFF2F, 'M', 'o'), - (0xFF30, 'M', 'p'), - (0xFF31, 'M', 'q'), - (0xFF32, 'M', 'r'), - (0xFF33, 'M', 's'), - (0xFF34, 'M', 't'), - (0xFF35, 'M', 'u'), - (0xFF36, 'M', 'v'), - (0xFF37, 'M', 'w'), - (0xFF38, 'M', 'x'), - (0xFF39, 'M', 'y'), - (0xFF3A, 'M', 'z'), - (0xFF3B, '3', '['), - (0xFF3C, '3', '\\'), - (0xFF3D, '3', ']'), - (0xFF3E, '3', '^'), - (0xFF3F, '3', '_'), - (0xFF40, '3', '`'), - (0xFF41, 'M', 'a'), - (0xFF42, 'M', 'b'), - (0xFF43, 'M', 'c'), - (0xFF44, 'M', 'd'), - (0xFF45, 'M', 'e'), - (0xFF46, 'M', 'f'), - (0xFF47, 'M', 'g'), - (0xFF48, 'M', 'h'), - (0xFF49, 'M', 'i'), - (0xFF4A, 'M', 'j'), - (0xFF4B, 'M', 'k'), - (0xFF4C, 'M', 'l'), - (0xFF4D, 'M', 'm'), - (0xFF4E, 'M', 'n'), - (0xFF4F, 'M', 'o'), - (0xFF50, 'M', 'p'), - (0xFF51, 'M', 'q'), - (0xFF52, 'M', 'r'), - (0xFF53, 'M', 's'), - (0xFF54, 'M', 't'), - (0xFF55, 'M', 'u'), - (0xFF56, 'M', 'v'), - (0xFF57, 'M', 'w'), - (0xFF58, 'M', 'x'), - (0xFF59, 'M', 'y'), - (0xFF5A, 'M', 'z'), - (0xFF5B, '3', '{'), - (0xFF5C, '3', '|'), - (0xFF5D, '3', '}'), - (0xFF5E, '3', '~'), - (0xFF5F, 'M', '⦅'), - (0xFF60, 'M', '⦆'), - (0xFF61, 'M', '.'), - (0xFF62, 'M', '「'), - (0xFF63, 'M', '」'), - (0xFF64, 'M', '、'), - (0xFF65, 'M', '・'), - (0xFF66, 'M', 'ヲ'), - (0xFF67, 'M', 'ァ'), - (0xFF68, 'M', 'ィ'), - (0xFF69, 'M', 'ゥ'), - (0xFF6A, 'M', 'ェ'), - (0xFF6B, 'M', 'ォ'), - (0xFF6C, 'M', 'ャ'), - (0xFF6D, 'M', 'ュ'), - (0xFF6E, 'M', 'ョ'), - (0xFF6F, 'M', 'ッ'), - (0xFF70, 'M', 'ー'), - (0xFF71, 'M', 'ア'), - (0xFF72, 'M', 'イ'), - (0xFF73, 'M', 'ウ'), - (0xFF74, 'M', 'エ'), - (0xFF75, 'M', 'オ'), - (0xFF76, 'M', 'カ'), - (0xFF77, 'M', 'キ'), - (0xFF78, 'M', 'ク'), - (0xFF79, 'M', 'ケ'), - (0xFF7A, 'M', 'コ'), - (0xFF7B, 'M', 'サ'), - (0xFF7C, 'M', 'シ'), - (0xFF7D, 'M', 'ス'), - (0xFF7E, 'M', 'セ'), - ] - -def _seg_52() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0xFF7F, 'M', 'ソ'), - (0xFF80, 'M', 'タ'), - (0xFF81, 'M', 'チ'), - (0xFF82, 'M', 'ツ'), - (0xFF83, 'M', 'テ'), - (0xFF84, 'M', 'ト'), - (0xFF85, 'M', 'ナ'), - (0xFF86, 'M', 'ニ'), - (0xFF87, 'M', 'ヌ'), - (0xFF88, 'M', 'ネ'), - (0xFF89, 'M', 'ノ'), - (0xFF8A, 'M', 'ハ'), - (0xFF8B, 'M', 'ヒ'), - (0xFF8C, 'M', 'フ'), - (0xFF8D, 'M', 'ヘ'), - (0xFF8E, 'M', 'ホ'), - (0xFF8F, 'M', 'マ'), - (0xFF90, 'M', 'ミ'), - (0xFF91, 'M', 'ム'), - (0xFF92, 'M', 'メ'), - (0xFF93, 'M', 'モ'), - (0xFF94, 'M', 'ヤ'), - (0xFF95, 'M', 'ユ'), - (0xFF96, 'M', 'ヨ'), - (0xFF97, 'M', 'ラ'), - (0xFF98, 'M', 'リ'), - (0xFF99, 'M', 'ル'), - (0xFF9A, 'M', 'レ'), - (0xFF9B, 'M', 'ロ'), - (0xFF9C, 'M', 'ワ'), - (0xFF9D, 'M', 'ン'), - (0xFF9E, 'M', '゙'), - (0xFF9F, 'M', '゚'), - (0xFFA0, 'X'), - (0xFFA1, 'M', 'ᄀ'), - (0xFFA2, 'M', 'ᄁ'), - (0xFFA3, 'M', 'ᆪ'), - (0xFFA4, 'M', 'ᄂ'), - (0xFFA5, 'M', 'ᆬ'), - (0xFFA6, 'M', 'ᆭ'), - (0xFFA7, 'M', 'ᄃ'), - (0xFFA8, 'M', 'ᄄ'), - (0xFFA9, 'M', 'ᄅ'), - (0xFFAA, 'M', 'ᆰ'), - (0xFFAB, 'M', 'ᆱ'), - (0xFFAC, 'M', 'ᆲ'), - (0xFFAD, 'M', 'ᆳ'), - (0xFFAE, 'M', 'ᆴ'), - (0xFFAF, 'M', 'ᆵ'), - (0xFFB0, 'M', 'ᄚ'), - (0xFFB1, 'M', 'ᄆ'), - (0xFFB2, 'M', 'ᄇ'), - (0xFFB3, 'M', 'ᄈ'), - (0xFFB4, 'M', 'ᄡ'), - (0xFFB5, 'M', 'ᄉ'), - (0xFFB6, 'M', 'ᄊ'), - (0xFFB7, 'M', 'ᄋ'), - (0xFFB8, 'M', 'ᄌ'), - (0xFFB9, 'M', 'ᄍ'), - (0xFFBA, 'M', 'ᄎ'), - (0xFFBB, 'M', 'ᄏ'), - (0xFFBC, 'M', 'ᄐ'), - (0xFFBD, 'M', 'ᄑ'), - (0xFFBE, 'M', 'ᄒ'), - (0xFFBF, 'X'), - (0xFFC2, 'M', 'ᅡ'), - (0xFFC3, 'M', 'ᅢ'), - (0xFFC4, 'M', 'ᅣ'), - (0xFFC5, 'M', 'ᅤ'), - (0xFFC6, 'M', 'ᅥ'), - (0xFFC7, 'M', 'ᅦ'), - (0xFFC8, 'X'), - (0xFFCA, 'M', 'ᅧ'), - (0xFFCB, 'M', 'ᅨ'), - (0xFFCC, 'M', 'ᅩ'), - (0xFFCD, 'M', 'ᅪ'), - (0xFFCE, 'M', 'ᅫ'), - (0xFFCF, 'M', 'ᅬ'), - (0xFFD0, 'X'), - (0xFFD2, 'M', 'ᅭ'), - (0xFFD3, 'M', 'ᅮ'), - (0xFFD4, 'M', 'ᅯ'), - (0xFFD5, 'M', 'ᅰ'), - (0xFFD6, 'M', 'ᅱ'), - (0xFFD7, 'M', 'ᅲ'), - (0xFFD8, 'X'), - (0xFFDA, 'M', 'ᅳ'), - (0xFFDB, 'M', 'ᅴ'), - (0xFFDC, 'M', 'ᅵ'), - (0xFFDD, 'X'), - (0xFFE0, 'M', '¢'), - (0xFFE1, 'M', '£'), - (0xFFE2, 'M', '¬'), - (0xFFE3, '3', ' ̄'), - (0xFFE4, 'M', '¦'), - (0xFFE5, 'M', '¥'), - (0xFFE6, 'M', '₩'), - (0xFFE7, 'X'), - (0xFFE8, 'M', '│'), - (0xFFE9, 'M', '←'), - ] - -def _seg_53() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0xFFEA, 'M', '↑'), - (0xFFEB, 'M', '→'), - (0xFFEC, 'M', '↓'), - (0xFFED, 'M', '■'), - (0xFFEE, 'M', '○'), - (0xFFEF, 'X'), - (0x10000, 'V'), - (0x1000C, 'X'), - (0x1000D, 'V'), - (0x10027, 'X'), - (0x10028, 'V'), - (0x1003B, 'X'), - (0x1003C, 'V'), - (0x1003E, 'X'), - (0x1003F, 'V'), - (0x1004E, 'X'), - (0x10050, 'V'), - (0x1005E, 'X'), - (0x10080, 'V'), - (0x100FB, 'X'), - (0x10100, 'V'), - (0x10103, 'X'), - (0x10107, 'V'), - (0x10134, 'X'), - (0x10137, 'V'), - (0x1018F, 'X'), - (0x10190, 'V'), - (0x1019D, 'X'), - (0x101A0, 'V'), - (0x101A1, 'X'), - (0x101D0, 'V'), - (0x101FE, 'X'), - (0x10280, 'V'), - (0x1029D, 'X'), - (0x102A0, 'V'), - (0x102D1, 'X'), - (0x102E0, 'V'), - (0x102FC, 'X'), - (0x10300, 'V'), - (0x10324, 'X'), - (0x1032D, 'V'), - (0x1034B, 'X'), - (0x10350, 'V'), - (0x1037B, 'X'), - (0x10380, 'V'), - (0x1039E, 'X'), - (0x1039F, 'V'), - (0x103C4, 'X'), - (0x103C8, 'V'), - (0x103D6, 'X'), - (0x10400, 'M', '𐐨'), - (0x10401, 'M', '𐐩'), - (0x10402, 'M', '𐐪'), - (0x10403, 'M', '𐐫'), - (0x10404, 'M', '𐐬'), - (0x10405, 'M', '𐐭'), - (0x10406, 'M', '𐐮'), - (0x10407, 'M', '𐐯'), - (0x10408, 'M', '𐐰'), - (0x10409, 'M', '𐐱'), - (0x1040A, 'M', '𐐲'), - (0x1040B, 'M', '𐐳'), - (0x1040C, 'M', '𐐴'), - (0x1040D, 'M', '𐐵'), - (0x1040E, 'M', '𐐶'), - (0x1040F, 'M', '𐐷'), - (0x10410, 'M', '𐐸'), - (0x10411, 'M', '𐐹'), - (0x10412, 'M', '𐐺'), - (0x10413, 'M', '𐐻'), - (0x10414, 'M', '𐐼'), - (0x10415, 'M', '𐐽'), - (0x10416, 'M', '𐐾'), - (0x10417, 'M', '𐐿'), - (0x10418, 'M', '𐑀'), - (0x10419, 'M', '𐑁'), - (0x1041A, 'M', '𐑂'), - (0x1041B, 'M', '𐑃'), - (0x1041C, 'M', '𐑄'), - (0x1041D, 'M', '𐑅'), - (0x1041E, 'M', '𐑆'), - (0x1041F, 'M', '𐑇'), - (0x10420, 'M', '𐑈'), - (0x10421, 'M', '𐑉'), - (0x10422, 'M', '𐑊'), - (0x10423, 'M', '𐑋'), - (0x10424, 'M', '𐑌'), - (0x10425, 'M', '𐑍'), - (0x10426, 'M', '𐑎'), - (0x10427, 'M', '𐑏'), - (0x10428, 'V'), - (0x1049E, 'X'), - (0x104A0, 'V'), - (0x104AA, 'X'), - (0x104B0, 'M', '𐓘'), - (0x104B1, 'M', '𐓙'), - (0x104B2, 'M', '𐓚'), - (0x104B3, 'M', '𐓛'), - (0x104B4, 'M', '𐓜'), - (0x104B5, 'M', '𐓝'), - ] - -def _seg_54() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x104B6, 'M', '𐓞'), - (0x104B7, 'M', '𐓟'), - (0x104B8, 'M', '𐓠'), - (0x104B9, 'M', '𐓡'), - (0x104BA, 'M', '𐓢'), - (0x104BB, 'M', '𐓣'), - (0x104BC, 'M', '𐓤'), - (0x104BD, 'M', '𐓥'), - (0x104BE, 'M', '𐓦'), - (0x104BF, 'M', '𐓧'), - (0x104C0, 'M', '𐓨'), - (0x104C1, 'M', '𐓩'), - (0x104C2, 'M', '𐓪'), - (0x104C3, 'M', '𐓫'), - (0x104C4, 'M', '𐓬'), - (0x104C5, 'M', '𐓭'), - (0x104C6, 'M', '𐓮'), - (0x104C7, 'M', '𐓯'), - (0x104C8, 'M', '𐓰'), - (0x104C9, 'M', '𐓱'), - (0x104CA, 'M', '𐓲'), - (0x104CB, 'M', '𐓳'), - (0x104CC, 'M', '𐓴'), - (0x104CD, 'M', '𐓵'), - (0x104CE, 'M', '𐓶'), - (0x104CF, 'M', '𐓷'), - (0x104D0, 'M', '𐓸'), - (0x104D1, 'M', '𐓹'), - (0x104D2, 'M', '𐓺'), - (0x104D3, 'M', '𐓻'), - (0x104D4, 'X'), - (0x104D8, 'V'), - (0x104FC, 'X'), - (0x10500, 'V'), - (0x10528, 'X'), - (0x10530, 'V'), - (0x10564, 'X'), - (0x1056F, 'V'), - (0x10570, 'M', '𐖗'), - (0x10571, 'M', '𐖘'), - (0x10572, 'M', '𐖙'), - (0x10573, 'M', '𐖚'), - (0x10574, 'M', '𐖛'), - (0x10575, 'M', '𐖜'), - (0x10576, 'M', '𐖝'), - (0x10577, 'M', '𐖞'), - (0x10578, 'M', '𐖟'), - (0x10579, 'M', '𐖠'), - (0x1057A, 'M', '𐖡'), - (0x1057B, 'X'), - (0x1057C, 'M', '𐖣'), - (0x1057D, 'M', '𐖤'), - (0x1057E, 'M', '𐖥'), - (0x1057F, 'M', '𐖦'), - (0x10580, 'M', '𐖧'), - (0x10581, 'M', '𐖨'), - (0x10582, 'M', '𐖩'), - (0x10583, 'M', '𐖪'), - (0x10584, 'M', '𐖫'), - (0x10585, 'M', '𐖬'), - (0x10586, 'M', '𐖭'), - (0x10587, 'M', '𐖮'), - (0x10588, 'M', '𐖯'), - (0x10589, 'M', '𐖰'), - (0x1058A, 'M', '𐖱'), - (0x1058B, 'X'), - (0x1058C, 'M', '𐖳'), - (0x1058D, 'M', '𐖴'), - (0x1058E, 'M', '𐖵'), - (0x1058F, 'M', '𐖶'), - (0x10590, 'M', '𐖷'), - (0x10591, 'M', '𐖸'), - (0x10592, 'M', '𐖹'), - (0x10593, 'X'), - (0x10594, 'M', '𐖻'), - (0x10595, 'M', '𐖼'), - (0x10596, 'X'), - (0x10597, 'V'), - (0x105A2, 'X'), - (0x105A3, 'V'), - (0x105B2, 'X'), - (0x105B3, 'V'), - (0x105BA, 'X'), - (0x105BB, 'V'), - (0x105BD, 'X'), - (0x10600, 'V'), - (0x10737, 'X'), - (0x10740, 'V'), - (0x10756, 'X'), - (0x10760, 'V'), - (0x10768, 'X'), - (0x10780, 'V'), - (0x10781, 'M', 'ː'), - (0x10782, 'M', 'ˑ'), - (0x10783, 'M', 'æ'), - (0x10784, 'M', 'ʙ'), - (0x10785, 'M', 'ɓ'), - (0x10786, 'X'), - (0x10787, 'M', 'ʣ'), - (0x10788, 'M', 'ꭦ'), - ] - -def _seg_55() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x10789, 'M', 'ʥ'), - (0x1078A, 'M', 'ʤ'), - (0x1078B, 'M', 'ɖ'), - (0x1078C, 'M', 'ɗ'), - (0x1078D, 'M', 'ᶑ'), - (0x1078E, 'M', 'ɘ'), - (0x1078F, 'M', 'ɞ'), - (0x10790, 'M', 'ʩ'), - (0x10791, 'M', 'ɤ'), - (0x10792, 'M', 'ɢ'), - (0x10793, 'M', 'ɠ'), - (0x10794, 'M', 'ʛ'), - (0x10795, 'M', 'ħ'), - (0x10796, 'M', 'ʜ'), - (0x10797, 'M', 'ɧ'), - (0x10798, 'M', 'ʄ'), - (0x10799, 'M', 'ʪ'), - (0x1079A, 'M', 'ʫ'), - (0x1079B, 'M', 'ɬ'), - (0x1079C, 'M', '𝼄'), - (0x1079D, 'M', 'ꞎ'), - (0x1079E, 'M', 'ɮ'), - (0x1079F, 'M', '𝼅'), - (0x107A0, 'M', 'ʎ'), - (0x107A1, 'M', '𝼆'), - (0x107A2, 'M', 'ø'), - (0x107A3, 'M', 'ɶ'), - (0x107A4, 'M', 'ɷ'), - (0x107A5, 'M', 'q'), - (0x107A6, 'M', 'ɺ'), - (0x107A7, 'M', '𝼈'), - (0x107A8, 'M', 'ɽ'), - (0x107A9, 'M', 'ɾ'), - (0x107AA, 'M', 'ʀ'), - (0x107AB, 'M', 'ʨ'), - (0x107AC, 'M', 'ʦ'), - (0x107AD, 'M', 'ꭧ'), - (0x107AE, 'M', 'ʧ'), - (0x107AF, 'M', 'ʈ'), - (0x107B0, 'M', 'ⱱ'), - (0x107B1, 'X'), - (0x107B2, 'M', 'ʏ'), - (0x107B3, 'M', 'ʡ'), - (0x107B4, 'M', 'ʢ'), - (0x107B5, 'M', 'ʘ'), - (0x107B6, 'M', 'ǀ'), - (0x107B7, 'M', 'ǁ'), - (0x107B8, 'M', 'ǂ'), - (0x107B9, 'M', '𝼊'), - (0x107BA, 'M', '𝼞'), - (0x107BB, 'X'), - (0x10800, 'V'), - (0x10806, 'X'), - (0x10808, 'V'), - (0x10809, 'X'), - (0x1080A, 'V'), - (0x10836, 'X'), - (0x10837, 'V'), - (0x10839, 'X'), - (0x1083C, 'V'), - (0x1083D, 'X'), - (0x1083F, 'V'), - (0x10856, 'X'), - (0x10857, 'V'), - (0x1089F, 'X'), - (0x108A7, 'V'), - (0x108B0, 'X'), - (0x108E0, 'V'), - (0x108F3, 'X'), - (0x108F4, 'V'), - (0x108F6, 'X'), - (0x108FB, 'V'), - (0x1091C, 'X'), - (0x1091F, 'V'), - (0x1093A, 'X'), - (0x1093F, 'V'), - (0x10940, 'X'), - (0x10980, 'V'), - (0x109B8, 'X'), - (0x109BC, 'V'), - (0x109D0, 'X'), - (0x109D2, 'V'), - (0x10A04, 'X'), - (0x10A05, 'V'), - (0x10A07, 'X'), - (0x10A0C, 'V'), - (0x10A14, 'X'), - (0x10A15, 'V'), - (0x10A18, 'X'), - (0x10A19, 'V'), - (0x10A36, 'X'), - (0x10A38, 'V'), - (0x10A3B, 'X'), - (0x10A3F, 'V'), - (0x10A49, 'X'), - (0x10A50, 'V'), - (0x10A59, 'X'), - (0x10A60, 'V'), - (0x10AA0, 'X'), - (0x10AC0, 'V'), - ] - -def _seg_56() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x10AE7, 'X'), - (0x10AEB, 'V'), - (0x10AF7, 'X'), - (0x10B00, 'V'), - (0x10B36, 'X'), - (0x10B39, 'V'), - (0x10B56, 'X'), - (0x10B58, 'V'), - (0x10B73, 'X'), - (0x10B78, 'V'), - (0x10B92, 'X'), - (0x10B99, 'V'), - (0x10B9D, 'X'), - (0x10BA9, 'V'), - (0x10BB0, 'X'), - (0x10C00, 'V'), - (0x10C49, 'X'), - (0x10C80, 'M', '𐳀'), - (0x10C81, 'M', '𐳁'), - (0x10C82, 'M', '𐳂'), - (0x10C83, 'M', '𐳃'), - (0x10C84, 'M', '𐳄'), - (0x10C85, 'M', '𐳅'), - (0x10C86, 'M', '𐳆'), - (0x10C87, 'M', '𐳇'), - (0x10C88, 'M', '𐳈'), - (0x10C89, 'M', '𐳉'), - (0x10C8A, 'M', '𐳊'), - (0x10C8B, 'M', '𐳋'), - (0x10C8C, 'M', '𐳌'), - (0x10C8D, 'M', '𐳍'), - (0x10C8E, 'M', '𐳎'), - (0x10C8F, 'M', '𐳏'), - (0x10C90, 'M', '𐳐'), - (0x10C91, 'M', '𐳑'), - (0x10C92, 'M', '𐳒'), - (0x10C93, 'M', '𐳓'), - (0x10C94, 'M', '𐳔'), - (0x10C95, 'M', '𐳕'), - (0x10C96, 'M', '𐳖'), - (0x10C97, 'M', '𐳗'), - (0x10C98, 'M', '𐳘'), - (0x10C99, 'M', '𐳙'), - (0x10C9A, 'M', '𐳚'), - (0x10C9B, 'M', '𐳛'), - (0x10C9C, 'M', '𐳜'), - (0x10C9D, 'M', '𐳝'), - (0x10C9E, 'M', '𐳞'), - (0x10C9F, 'M', '𐳟'), - (0x10CA0, 'M', '𐳠'), - (0x10CA1, 'M', '𐳡'), - (0x10CA2, 'M', '𐳢'), - (0x10CA3, 'M', '𐳣'), - (0x10CA4, 'M', '𐳤'), - (0x10CA5, 'M', '𐳥'), - (0x10CA6, 'M', '𐳦'), - (0x10CA7, 'M', '𐳧'), - (0x10CA8, 'M', '𐳨'), - (0x10CA9, 'M', '𐳩'), - (0x10CAA, 'M', '𐳪'), - (0x10CAB, 'M', '𐳫'), - (0x10CAC, 'M', '𐳬'), - (0x10CAD, 'M', '𐳭'), - (0x10CAE, 'M', '𐳮'), - (0x10CAF, 'M', '𐳯'), - (0x10CB0, 'M', '𐳰'), - (0x10CB1, 'M', '𐳱'), - (0x10CB2, 'M', '𐳲'), - (0x10CB3, 'X'), - (0x10CC0, 'V'), - (0x10CF3, 'X'), - (0x10CFA, 'V'), - (0x10D28, 'X'), - (0x10D30, 'V'), - (0x10D3A, 'X'), - (0x10E60, 'V'), - (0x10E7F, 'X'), - (0x10E80, 'V'), - (0x10EAA, 'X'), - (0x10EAB, 'V'), - (0x10EAE, 'X'), - (0x10EB0, 'V'), - (0x10EB2, 'X'), - (0x10EFD, 'V'), - (0x10F28, 'X'), - (0x10F30, 'V'), - (0x10F5A, 'X'), - (0x10F70, 'V'), - (0x10F8A, 'X'), - (0x10FB0, 'V'), - (0x10FCC, 'X'), - (0x10FE0, 'V'), - (0x10FF7, 'X'), - (0x11000, 'V'), - (0x1104E, 'X'), - (0x11052, 'V'), - (0x11076, 'X'), - (0x1107F, 'V'), - (0x110BD, 'X'), - (0x110BE, 'V'), - ] - -def _seg_57() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x110C3, 'X'), - (0x110D0, 'V'), - (0x110E9, 'X'), - (0x110F0, 'V'), - (0x110FA, 'X'), - (0x11100, 'V'), - (0x11135, 'X'), - (0x11136, 'V'), - (0x11148, 'X'), - (0x11150, 'V'), - (0x11177, 'X'), - (0x11180, 'V'), - (0x111E0, 'X'), - (0x111E1, 'V'), - (0x111F5, 'X'), - (0x11200, 'V'), - (0x11212, 'X'), - (0x11213, 'V'), - (0x11242, 'X'), - (0x11280, 'V'), - (0x11287, 'X'), - (0x11288, 'V'), - (0x11289, 'X'), - (0x1128A, 'V'), - (0x1128E, 'X'), - (0x1128F, 'V'), - (0x1129E, 'X'), - (0x1129F, 'V'), - (0x112AA, 'X'), - (0x112B0, 'V'), - (0x112EB, 'X'), - (0x112F0, 'V'), - (0x112FA, 'X'), - (0x11300, 'V'), - (0x11304, 'X'), - (0x11305, 'V'), - (0x1130D, 'X'), - (0x1130F, 'V'), - (0x11311, 'X'), - (0x11313, 'V'), - (0x11329, 'X'), - (0x1132A, 'V'), - (0x11331, 'X'), - (0x11332, 'V'), - (0x11334, 'X'), - (0x11335, 'V'), - (0x1133A, 'X'), - (0x1133B, 'V'), - (0x11345, 'X'), - (0x11347, 'V'), - (0x11349, 'X'), - (0x1134B, 'V'), - (0x1134E, 'X'), - (0x11350, 'V'), - (0x11351, 'X'), - (0x11357, 'V'), - (0x11358, 'X'), - (0x1135D, 'V'), - (0x11364, 'X'), - (0x11366, 'V'), - (0x1136D, 'X'), - (0x11370, 'V'), - (0x11375, 'X'), - (0x11400, 'V'), - (0x1145C, 'X'), - (0x1145D, 'V'), - (0x11462, 'X'), - (0x11480, 'V'), - (0x114C8, 'X'), - (0x114D0, 'V'), - (0x114DA, 'X'), - (0x11580, 'V'), - (0x115B6, 'X'), - (0x115B8, 'V'), - (0x115DE, 'X'), - (0x11600, 'V'), - (0x11645, 'X'), - (0x11650, 'V'), - (0x1165A, 'X'), - (0x11660, 'V'), - (0x1166D, 'X'), - (0x11680, 'V'), - (0x116BA, 'X'), - (0x116C0, 'V'), - (0x116CA, 'X'), - (0x11700, 'V'), - (0x1171B, 'X'), - (0x1171D, 'V'), - (0x1172C, 'X'), - (0x11730, 'V'), - (0x11747, 'X'), - (0x11800, 'V'), - (0x1183C, 'X'), - (0x118A0, 'M', '𑣀'), - (0x118A1, 'M', '𑣁'), - (0x118A2, 'M', '𑣂'), - (0x118A3, 'M', '𑣃'), - (0x118A4, 'M', '𑣄'), - (0x118A5, 'M', '𑣅'), - (0x118A6, 'M', '𑣆'), - ] - -def _seg_58() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x118A7, 'M', '𑣇'), - (0x118A8, 'M', '𑣈'), - (0x118A9, 'M', '𑣉'), - (0x118AA, 'M', '𑣊'), - (0x118AB, 'M', '𑣋'), - (0x118AC, 'M', '𑣌'), - (0x118AD, 'M', '𑣍'), - (0x118AE, 'M', '𑣎'), - (0x118AF, 'M', '𑣏'), - (0x118B0, 'M', '𑣐'), - (0x118B1, 'M', '𑣑'), - (0x118B2, 'M', '𑣒'), - (0x118B3, 'M', '𑣓'), - (0x118B4, 'M', '𑣔'), - (0x118B5, 'M', '𑣕'), - (0x118B6, 'M', '𑣖'), - (0x118B7, 'M', '𑣗'), - (0x118B8, 'M', '𑣘'), - (0x118B9, 'M', '𑣙'), - (0x118BA, 'M', '𑣚'), - (0x118BB, 'M', '𑣛'), - (0x118BC, 'M', '𑣜'), - (0x118BD, 'M', '𑣝'), - (0x118BE, 'M', '𑣞'), - (0x118BF, 'M', '𑣟'), - (0x118C0, 'V'), - (0x118F3, 'X'), - (0x118FF, 'V'), - (0x11907, 'X'), - (0x11909, 'V'), - (0x1190A, 'X'), - (0x1190C, 'V'), - (0x11914, 'X'), - (0x11915, 'V'), - (0x11917, 'X'), - (0x11918, 'V'), - (0x11936, 'X'), - (0x11937, 'V'), - (0x11939, 'X'), - (0x1193B, 'V'), - (0x11947, 'X'), - (0x11950, 'V'), - (0x1195A, 'X'), - (0x119A0, 'V'), - (0x119A8, 'X'), - (0x119AA, 'V'), - (0x119D8, 'X'), - (0x119DA, 'V'), - (0x119E5, 'X'), - (0x11A00, 'V'), - (0x11A48, 'X'), - (0x11A50, 'V'), - (0x11AA3, 'X'), - (0x11AB0, 'V'), - (0x11AF9, 'X'), - (0x11B00, 'V'), - (0x11B0A, 'X'), - (0x11C00, 'V'), - (0x11C09, 'X'), - (0x11C0A, 'V'), - (0x11C37, 'X'), - (0x11C38, 'V'), - (0x11C46, 'X'), - (0x11C50, 'V'), - (0x11C6D, 'X'), - (0x11C70, 'V'), - (0x11C90, 'X'), - (0x11C92, 'V'), - (0x11CA8, 'X'), - (0x11CA9, 'V'), - (0x11CB7, 'X'), - (0x11D00, 'V'), - (0x11D07, 'X'), - (0x11D08, 'V'), - (0x11D0A, 'X'), - (0x11D0B, 'V'), - (0x11D37, 'X'), - (0x11D3A, 'V'), - (0x11D3B, 'X'), - (0x11D3C, 'V'), - (0x11D3E, 'X'), - (0x11D3F, 'V'), - (0x11D48, 'X'), - (0x11D50, 'V'), - (0x11D5A, 'X'), - (0x11D60, 'V'), - (0x11D66, 'X'), - (0x11D67, 'V'), - (0x11D69, 'X'), - (0x11D6A, 'V'), - (0x11D8F, 'X'), - (0x11D90, 'V'), - (0x11D92, 'X'), - (0x11D93, 'V'), - (0x11D99, 'X'), - (0x11DA0, 'V'), - (0x11DAA, 'X'), - (0x11EE0, 'V'), - (0x11EF9, 'X'), - (0x11F00, 'V'), - ] - -def _seg_59() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x11F11, 'X'), - (0x11F12, 'V'), - (0x11F3B, 'X'), - (0x11F3E, 'V'), - (0x11F5A, 'X'), - (0x11FB0, 'V'), - (0x11FB1, 'X'), - (0x11FC0, 'V'), - (0x11FF2, 'X'), - (0x11FFF, 'V'), - (0x1239A, 'X'), - (0x12400, 'V'), - (0x1246F, 'X'), - (0x12470, 'V'), - (0x12475, 'X'), - (0x12480, 'V'), - (0x12544, 'X'), - (0x12F90, 'V'), - (0x12FF3, 'X'), - (0x13000, 'V'), - (0x13430, 'X'), - (0x13440, 'V'), - (0x13456, 'X'), - (0x14400, 'V'), - (0x14647, 'X'), - (0x16800, 'V'), - (0x16A39, 'X'), - (0x16A40, 'V'), - (0x16A5F, 'X'), - (0x16A60, 'V'), - (0x16A6A, 'X'), - (0x16A6E, 'V'), - (0x16ABF, 'X'), - (0x16AC0, 'V'), - (0x16ACA, 'X'), - (0x16AD0, 'V'), - (0x16AEE, 'X'), - (0x16AF0, 'V'), - (0x16AF6, 'X'), - (0x16B00, 'V'), - (0x16B46, 'X'), - (0x16B50, 'V'), - (0x16B5A, 'X'), - (0x16B5B, 'V'), - (0x16B62, 'X'), - (0x16B63, 'V'), - (0x16B78, 'X'), - (0x16B7D, 'V'), - (0x16B90, 'X'), - (0x16E40, 'M', '𖹠'), - (0x16E41, 'M', '𖹡'), - (0x16E42, 'M', '𖹢'), - (0x16E43, 'M', '𖹣'), - (0x16E44, 'M', '𖹤'), - (0x16E45, 'M', '𖹥'), - (0x16E46, 'M', '𖹦'), - (0x16E47, 'M', '𖹧'), - (0x16E48, 'M', '𖹨'), - (0x16E49, 'M', '𖹩'), - (0x16E4A, 'M', '𖹪'), - (0x16E4B, 'M', '𖹫'), - (0x16E4C, 'M', '𖹬'), - (0x16E4D, 'M', '𖹭'), - (0x16E4E, 'M', '𖹮'), - (0x16E4F, 'M', '𖹯'), - (0x16E50, 'M', '𖹰'), - (0x16E51, 'M', '𖹱'), - (0x16E52, 'M', '𖹲'), - (0x16E53, 'M', '𖹳'), - (0x16E54, 'M', '𖹴'), - (0x16E55, 'M', '𖹵'), - (0x16E56, 'M', '𖹶'), - (0x16E57, 'M', '𖹷'), - (0x16E58, 'M', '𖹸'), - (0x16E59, 'M', '𖹹'), - (0x16E5A, 'M', '𖹺'), - (0x16E5B, 'M', '𖹻'), - (0x16E5C, 'M', '𖹼'), - (0x16E5D, 'M', '𖹽'), - (0x16E5E, 'M', '𖹾'), - (0x16E5F, 'M', '𖹿'), - (0x16E60, 'V'), - (0x16E9B, 'X'), - (0x16F00, 'V'), - (0x16F4B, 'X'), - (0x16F4F, 'V'), - (0x16F88, 'X'), - (0x16F8F, 'V'), - (0x16FA0, 'X'), - (0x16FE0, 'V'), - (0x16FE5, 'X'), - (0x16FF0, 'V'), - (0x16FF2, 'X'), - (0x17000, 'V'), - (0x187F8, 'X'), - (0x18800, 'V'), - (0x18CD6, 'X'), - (0x18D00, 'V'), - (0x18D09, 'X'), - (0x1AFF0, 'V'), - ] - -def _seg_60() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x1AFF4, 'X'), - (0x1AFF5, 'V'), - (0x1AFFC, 'X'), - (0x1AFFD, 'V'), - (0x1AFFF, 'X'), - (0x1B000, 'V'), - (0x1B123, 'X'), - (0x1B132, 'V'), - (0x1B133, 'X'), - (0x1B150, 'V'), - (0x1B153, 'X'), - (0x1B155, 'V'), - (0x1B156, 'X'), - (0x1B164, 'V'), - (0x1B168, 'X'), - (0x1B170, 'V'), - (0x1B2FC, 'X'), - (0x1BC00, 'V'), - (0x1BC6B, 'X'), - (0x1BC70, 'V'), - (0x1BC7D, 'X'), - (0x1BC80, 'V'), - (0x1BC89, 'X'), - (0x1BC90, 'V'), - (0x1BC9A, 'X'), - (0x1BC9C, 'V'), - (0x1BCA0, 'I'), - (0x1BCA4, 'X'), - (0x1CF00, 'V'), - (0x1CF2E, 'X'), - (0x1CF30, 'V'), - (0x1CF47, 'X'), - (0x1CF50, 'V'), - (0x1CFC4, 'X'), - (0x1D000, 'V'), - (0x1D0F6, 'X'), - (0x1D100, 'V'), - (0x1D127, 'X'), - (0x1D129, 'V'), - (0x1D15E, 'M', '𝅗𝅥'), - (0x1D15F, 'M', '𝅘𝅥'), - (0x1D160, 'M', '𝅘𝅥𝅮'), - (0x1D161, 'M', '𝅘𝅥𝅯'), - (0x1D162, 'M', '𝅘𝅥𝅰'), - (0x1D163, 'M', '𝅘𝅥𝅱'), - (0x1D164, 'M', '𝅘𝅥𝅲'), - (0x1D165, 'V'), - (0x1D173, 'X'), - (0x1D17B, 'V'), - (0x1D1BB, 'M', '𝆹𝅥'), - (0x1D1BC, 'M', '𝆺𝅥'), - (0x1D1BD, 'M', '𝆹𝅥𝅮'), - (0x1D1BE, 'M', '𝆺𝅥𝅮'), - (0x1D1BF, 'M', '𝆹𝅥𝅯'), - (0x1D1C0, 'M', '𝆺𝅥𝅯'), - (0x1D1C1, 'V'), - (0x1D1EB, 'X'), - (0x1D200, 'V'), - (0x1D246, 'X'), - (0x1D2C0, 'V'), - (0x1D2D4, 'X'), - (0x1D2E0, 'V'), - (0x1D2F4, 'X'), - (0x1D300, 'V'), - (0x1D357, 'X'), - (0x1D360, 'V'), - (0x1D379, 'X'), - (0x1D400, 'M', 'a'), - (0x1D401, 'M', 'b'), - (0x1D402, 'M', 'c'), - (0x1D403, 'M', 'd'), - (0x1D404, 'M', 'e'), - (0x1D405, 'M', 'f'), - (0x1D406, 'M', 'g'), - (0x1D407, 'M', 'h'), - (0x1D408, 'M', 'i'), - (0x1D409, 'M', 'j'), - (0x1D40A, 'M', 'k'), - (0x1D40B, 'M', 'l'), - (0x1D40C, 'M', 'm'), - (0x1D40D, 'M', 'n'), - (0x1D40E, 'M', 'o'), - (0x1D40F, 'M', 'p'), - (0x1D410, 'M', 'q'), - (0x1D411, 'M', 'r'), - (0x1D412, 'M', 's'), - (0x1D413, 'M', 't'), - (0x1D414, 'M', 'u'), - (0x1D415, 'M', 'v'), - (0x1D416, 'M', 'w'), - (0x1D417, 'M', 'x'), - (0x1D418, 'M', 'y'), - (0x1D419, 'M', 'z'), - (0x1D41A, 'M', 'a'), - (0x1D41B, 'M', 'b'), - (0x1D41C, 'M', 'c'), - (0x1D41D, 'M', 'd'), - (0x1D41E, 'M', 'e'), - (0x1D41F, 'M', 'f'), - (0x1D420, 'M', 'g'), - ] - -def _seg_61() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x1D421, 'M', 'h'), - (0x1D422, 'M', 'i'), - (0x1D423, 'M', 'j'), - (0x1D424, 'M', 'k'), - (0x1D425, 'M', 'l'), - (0x1D426, 'M', 'm'), - (0x1D427, 'M', 'n'), - (0x1D428, 'M', 'o'), - (0x1D429, 'M', 'p'), - (0x1D42A, 'M', 'q'), - (0x1D42B, 'M', 'r'), - (0x1D42C, 'M', 's'), - (0x1D42D, 'M', 't'), - (0x1D42E, 'M', 'u'), - (0x1D42F, 'M', 'v'), - (0x1D430, 'M', 'w'), - (0x1D431, 'M', 'x'), - (0x1D432, 'M', 'y'), - (0x1D433, 'M', 'z'), - (0x1D434, 'M', 'a'), - (0x1D435, 'M', 'b'), - (0x1D436, 'M', 'c'), - (0x1D437, 'M', 'd'), - (0x1D438, 'M', 'e'), - (0x1D439, 'M', 'f'), - (0x1D43A, 'M', 'g'), - (0x1D43B, 'M', 'h'), - (0x1D43C, 'M', 'i'), - (0x1D43D, 'M', 'j'), - (0x1D43E, 'M', 'k'), - (0x1D43F, 'M', 'l'), - (0x1D440, 'M', 'm'), - (0x1D441, 'M', 'n'), - (0x1D442, 'M', 'o'), - (0x1D443, 'M', 'p'), - (0x1D444, 'M', 'q'), - (0x1D445, 'M', 'r'), - (0x1D446, 'M', 's'), - (0x1D447, 'M', 't'), - (0x1D448, 'M', 'u'), - (0x1D449, 'M', 'v'), - (0x1D44A, 'M', 'w'), - (0x1D44B, 'M', 'x'), - (0x1D44C, 'M', 'y'), - (0x1D44D, 'M', 'z'), - (0x1D44E, 'M', 'a'), - (0x1D44F, 'M', 'b'), - (0x1D450, 'M', 'c'), - (0x1D451, 'M', 'd'), - (0x1D452, 'M', 'e'), - (0x1D453, 'M', 'f'), - (0x1D454, 'M', 'g'), - (0x1D455, 'X'), - (0x1D456, 'M', 'i'), - (0x1D457, 'M', 'j'), - (0x1D458, 'M', 'k'), - (0x1D459, 'M', 'l'), - (0x1D45A, 'M', 'm'), - (0x1D45B, 'M', 'n'), - (0x1D45C, 'M', 'o'), - (0x1D45D, 'M', 'p'), - (0x1D45E, 'M', 'q'), - (0x1D45F, 'M', 'r'), - (0x1D460, 'M', 's'), - (0x1D461, 'M', 't'), - (0x1D462, 'M', 'u'), - (0x1D463, 'M', 'v'), - (0x1D464, 'M', 'w'), - (0x1D465, 'M', 'x'), - (0x1D466, 'M', 'y'), - (0x1D467, 'M', 'z'), - (0x1D468, 'M', 'a'), - (0x1D469, 'M', 'b'), - (0x1D46A, 'M', 'c'), - (0x1D46B, 'M', 'd'), - (0x1D46C, 'M', 'e'), - (0x1D46D, 'M', 'f'), - (0x1D46E, 'M', 'g'), - (0x1D46F, 'M', 'h'), - (0x1D470, 'M', 'i'), - (0x1D471, 'M', 'j'), - (0x1D472, 'M', 'k'), - (0x1D473, 'M', 'l'), - (0x1D474, 'M', 'm'), - (0x1D475, 'M', 'n'), - (0x1D476, 'M', 'o'), - (0x1D477, 'M', 'p'), - (0x1D478, 'M', 'q'), - (0x1D479, 'M', 'r'), - (0x1D47A, 'M', 's'), - (0x1D47B, 'M', 't'), - (0x1D47C, 'M', 'u'), - (0x1D47D, 'M', 'v'), - (0x1D47E, 'M', 'w'), - (0x1D47F, 'M', 'x'), - (0x1D480, 'M', 'y'), - (0x1D481, 'M', 'z'), - (0x1D482, 'M', 'a'), - (0x1D483, 'M', 'b'), - (0x1D484, 'M', 'c'), - ] - -def _seg_62() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x1D485, 'M', 'd'), - (0x1D486, 'M', 'e'), - (0x1D487, 'M', 'f'), - (0x1D488, 'M', 'g'), - (0x1D489, 'M', 'h'), - (0x1D48A, 'M', 'i'), - (0x1D48B, 'M', 'j'), - (0x1D48C, 'M', 'k'), - (0x1D48D, 'M', 'l'), - (0x1D48E, 'M', 'm'), - (0x1D48F, 'M', 'n'), - (0x1D490, 'M', 'o'), - (0x1D491, 'M', 'p'), - (0x1D492, 'M', 'q'), - (0x1D493, 'M', 'r'), - (0x1D494, 'M', 's'), - (0x1D495, 'M', 't'), - (0x1D496, 'M', 'u'), - (0x1D497, 'M', 'v'), - (0x1D498, 'M', 'w'), - (0x1D499, 'M', 'x'), - (0x1D49A, 'M', 'y'), - (0x1D49B, 'M', 'z'), - (0x1D49C, 'M', 'a'), - (0x1D49D, 'X'), - (0x1D49E, 'M', 'c'), - (0x1D49F, 'M', 'd'), - (0x1D4A0, 'X'), - (0x1D4A2, 'M', 'g'), - (0x1D4A3, 'X'), - (0x1D4A5, 'M', 'j'), - (0x1D4A6, 'M', 'k'), - (0x1D4A7, 'X'), - (0x1D4A9, 'M', 'n'), - (0x1D4AA, 'M', 'o'), - (0x1D4AB, 'M', 'p'), - (0x1D4AC, 'M', 'q'), - (0x1D4AD, 'X'), - (0x1D4AE, 'M', 's'), - (0x1D4AF, 'M', 't'), - (0x1D4B0, 'M', 'u'), - (0x1D4B1, 'M', 'v'), - (0x1D4B2, 'M', 'w'), - (0x1D4B3, 'M', 'x'), - (0x1D4B4, 'M', 'y'), - (0x1D4B5, 'M', 'z'), - (0x1D4B6, 'M', 'a'), - (0x1D4B7, 'M', 'b'), - (0x1D4B8, 'M', 'c'), - (0x1D4B9, 'M', 'd'), - (0x1D4BA, 'X'), - (0x1D4BB, 'M', 'f'), - (0x1D4BC, 'X'), - (0x1D4BD, 'M', 'h'), - (0x1D4BE, 'M', 'i'), - (0x1D4BF, 'M', 'j'), - (0x1D4C0, 'M', 'k'), - (0x1D4C1, 'M', 'l'), - (0x1D4C2, 'M', 'm'), - (0x1D4C3, 'M', 'n'), - (0x1D4C4, 'X'), - (0x1D4C5, 'M', 'p'), - (0x1D4C6, 'M', 'q'), - (0x1D4C7, 'M', 'r'), - (0x1D4C8, 'M', 's'), - (0x1D4C9, 'M', 't'), - (0x1D4CA, 'M', 'u'), - (0x1D4CB, 'M', 'v'), - (0x1D4CC, 'M', 'w'), - (0x1D4CD, 'M', 'x'), - (0x1D4CE, 'M', 'y'), - (0x1D4CF, 'M', 'z'), - (0x1D4D0, 'M', 'a'), - (0x1D4D1, 'M', 'b'), - (0x1D4D2, 'M', 'c'), - (0x1D4D3, 'M', 'd'), - (0x1D4D4, 'M', 'e'), - (0x1D4D5, 'M', 'f'), - (0x1D4D6, 'M', 'g'), - (0x1D4D7, 'M', 'h'), - (0x1D4D8, 'M', 'i'), - (0x1D4D9, 'M', 'j'), - (0x1D4DA, 'M', 'k'), - (0x1D4DB, 'M', 'l'), - (0x1D4DC, 'M', 'm'), - (0x1D4DD, 'M', 'n'), - (0x1D4DE, 'M', 'o'), - (0x1D4DF, 'M', 'p'), - (0x1D4E0, 'M', 'q'), - (0x1D4E1, 'M', 'r'), - (0x1D4E2, 'M', 's'), - (0x1D4E3, 'M', 't'), - (0x1D4E4, 'M', 'u'), - (0x1D4E5, 'M', 'v'), - (0x1D4E6, 'M', 'w'), - (0x1D4E7, 'M', 'x'), - (0x1D4E8, 'M', 'y'), - (0x1D4E9, 'M', 'z'), - (0x1D4EA, 'M', 'a'), - (0x1D4EB, 'M', 'b'), - ] - -def _seg_63() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x1D4EC, 'M', 'c'), - (0x1D4ED, 'M', 'd'), - (0x1D4EE, 'M', 'e'), - (0x1D4EF, 'M', 'f'), - (0x1D4F0, 'M', 'g'), - (0x1D4F1, 'M', 'h'), - (0x1D4F2, 'M', 'i'), - (0x1D4F3, 'M', 'j'), - (0x1D4F4, 'M', 'k'), - (0x1D4F5, 'M', 'l'), - (0x1D4F6, 'M', 'm'), - (0x1D4F7, 'M', 'n'), - (0x1D4F8, 'M', 'o'), - (0x1D4F9, 'M', 'p'), - (0x1D4FA, 'M', 'q'), - (0x1D4FB, 'M', 'r'), - (0x1D4FC, 'M', 's'), - (0x1D4FD, 'M', 't'), - (0x1D4FE, 'M', 'u'), - (0x1D4FF, 'M', 'v'), - (0x1D500, 'M', 'w'), - (0x1D501, 'M', 'x'), - (0x1D502, 'M', 'y'), - (0x1D503, 'M', 'z'), - (0x1D504, 'M', 'a'), - (0x1D505, 'M', 'b'), - (0x1D506, 'X'), - (0x1D507, 'M', 'd'), - (0x1D508, 'M', 'e'), - (0x1D509, 'M', 'f'), - (0x1D50A, 'M', 'g'), - (0x1D50B, 'X'), - (0x1D50D, 'M', 'j'), - (0x1D50E, 'M', 'k'), - (0x1D50F, 'M', 'l'), - (0x1D510, 'M', 'm'), - (0x1D511, 'M', 'n'), - (0x1D512, 'M', 'o'), - (0x1D513, 'M', 'p'), - (0x1D514, 'M', 'q'), - (0x1D515, 'X'), - (0x1D516, 'M', 's'), - (0x1D517, 'M', 't'), - (0x1D518, 'M', 'u'), - (0x1D519, 'M', 'v'), - (0x1D51A, 'M', 'w'), - (0x1D51B, 'M', 'x'), - (0x1D51C, 'M', 'y'), - (0x1D51D, 'X'), - (0x1D51E, 'M', 'a'), - (0x1D51F, 'M', 'b'), - (0x1D520, 'M', 'c'), - (0x1D521, 'M', 'd'), - (0x1D522, 'M', 'e'), - (0x1D523, 'M', 'f'), - (0x1D524, 'M', 'g'), - (0x1D525, 'M', 'h'), - (0x1D526, 'M', 'i'), - (0x1D527, 'M', 'j'), - (0x1D528, 'M', 'k'), - (0x1D529, 'M', 'l'), - (0x1D52A, 'M', 'm'), - (0x1D52B, 'M', 'n'), - (0x1D52C, 'M', 'o'), - (0x1D52D, 'M', 'p'), - (0x1D52E, 'M', 'q'), - (0x1D52F, 'M', 'r'), - (0x1D530, 'M', 's'), - (0x1D531, 'M', 't'), - (0x1D532, 'M', 'u'), - (0x1D533, 'M', 'v'), - (0x1D534, 'M', 'w'), - (0x1D535, 'M', 'x'), - (0x1D536, 'M', 'y'), - (0x1D537, 'M', 'z'), - (0x1D538, 'M', 'a'), - (0x1D539, 'M', 'b'), - (0x1D53A, 'X'), - (0x1D53B, 'M', 'd'), - (0x1D53C, 'M', 'e'), - (0x1D53D, 'M', 'f'), - (0x1D53E, 'M', 'g'), - (0x1D53F, 'X'), - (0x1D540, 'M', 'i'), - (0x1D541, 'M', 'j'), - (0x1D542, 'M', 'k'), - (0x1D543, 'M', 'l'), - (0x1D544, 'M', 'm'), - (0x1D545, 'X'), - (0x1D546, 'M', 'o'), - (0x1D547, 'X'), - (0x1D54A, 'M', 's'), - (0x1D54B, 'M', 't'), - (0x1D54C, 'M', 'u'), - (0x1D54D, 'M', 'v'), - (0x1D54E, 'M', 'w'), - (0x1D54F, 'M', 'x'), - (0x1D550, 'M', 'y'), - (0x1D551, 'X'), - (0x1D552, 'M', 'a'), - ] - -def _seg_64() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x1D553, 'M', 'b'), - (0x1D554, 'M', 'c'), - (0x1D555, 'M', 'd'), - (0x1D556, 'M', 'e'), - (0x1D557, 'M', 'f'), - (0x1D558, 'M', 'g'), - (0x1D559, 'M', 'h'), - (0x1D55A, 'M', 'i'), - (0x1D55B, 'M', 'j'), - (0x1D55C, 'M', 'k'), - (0x1D55D, 'M', 'l'), - (0x1D55E, 'M', 'm'), - (0x1D55F, 'M', 'n'), - (0x1D560, 'M', 'o'), - (0x1D561, 'M', 'p'), - (0x1D562, 'M', 'q'), - (0x1D563, 'M', 'r'), - (0x1D564, 'M', 's'), - (0x1D565, 'M', 't'), - (0x1D566, 'M', 'u'), - (0x1D567, 'M', 'v'), - (0x1D568, 'M', 'w'), - (0x1D569, 'M', 'x'), - (0x1D56A, 'M', 'y'), - (0x1D56B, 'M', 'z'), - (0x1D56C, 'M', 'a'), - (0x1D56D, 'M', 'b'), - (0x1D56E, 'M', 'c'), - (0x1D56F, 'M', 'd'), - (0x1D570, 'M', 'e'), - (0x1D571, 'M', 'f'), - (0x1D572, 'M', 'g'), - (0x1D573, 'M', 'h'), - (0x1D574, 'M', 'i'), - (0x1D575, 'M', 'j'), - (0x1D576, 'M', 'k'), - (0x1D577, 'M', 'l'), - (0x1D578, 'M', 'm'), - (0x1D579, 'M', 'n'), - (0x1D57A, 'M', 'o'), - (0x1D57B, 'M', 'p'), - (0x1D57C, 'M', 'q'), - (0x1D57D, 'M', 'r'), - (0x1D57E, 'M', 's'), - (0x1D57F, 'M', 't'), - (0x1D580, 'M', 'u'), - (0x1D581, 'M', 'v'), - (0x1D582, 'M', 'w'), - (0x1D583, 'M', 'x'), - (0x1D584, 'M', 'y'), - (0x1D585, 'M', 'z'), - (0x1D586, 'M', 'a'), - (0x1D587, 'M', 'b'), - (0x1D588, 'M', 'c'), - (0x1D589, 'M', 'd'), - (0x1D58A, 'M', 'e'), - (0x1D58B, 'M', 'f'), - (0x1D58C, 'M', 'g'), - (0x1D58D, 'M', 'h'), - (0x1D58E, 'M', 'i'), - (0x1D58F, 'M', 'j'), - (0x1D590, 'M', 'k'), - (0x1D591, 'M', 'l'), - (0x1D592, 'M', 'm'), - (0x1D593, 'M', 'n'), - (0x1D594, 'M', 'o'), - (0x1D595, 'M', 'p'), - (0x1D596, 'M', 'q'), - (0x1D597, 'M', 'r'), - (0x1D598, 'M', 's'), - (0x1D599, 'M', 't'), - (0x1D59A, 'M', 'u'), - (0x1D59B, 'M', 'v'), - (0x1D59C, 'M', 'w'), - (0x1D59D, 'M', 'x'), - (0x1D59E, 'M', 'y'), - (0x1D59F, 'M', 'z'), - (0x1D5A0, 'M', 'a'), - (0x1D5A1, 'M', 'b'), - (0x1D5A2, 'M', 'c'), - (0x1D5A3, 'M', 'd'), - (0x1D5A4, 'M', 'e'), - (0x1D5A5, 'M', 'f'), - (0x1D5A6, 'M', 'g'), - (0x1D5A7, 'M', 'h'), - (0x1D5A8, 'M', 'i'), - (0x1D5A9, 'M', 'j'), - (0x1D5AA, 'M', 'k'), - (0x1D5AB, 'M', 'l'), - (0x1D5AC, 'M', 'm'), - (0x1D5AD, 'M', 'n'), - (0x1D5AE, 'M', 'o'), - (0x1D5AF, 'M', 'p'), - (0x1D5B0, 'M', 'q'), - (0x1D5B1, 'M', 'r'), - (0x1D5B2, 'M', 's'), - (0x1D5B3, 'M', 't'), - (0x1D5B4, 'M', 'u'), - (0x1D5B5, 'M', 'v'), - (0x1D5B6, 'M', 'w'), - ] - -def _seg_65() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x1D5B7, 'M', 'x'), - (0x1D5B8, 'M', 'y'), - (0x1D5B9, 'M', 'z'), - (0x1D5BA, 'M', 'a'), - (0x1D5BB, 'M', 'b'), - (0x1D5BC, 'M', 'c'), - (0x1D5BD, 'M', 'd'), - (0x1D5BE, 'M', 'e'), - (0x1D5BF, 'M', 'f'), - (0x1D5C0, 'M', 'g'), - (0x1D5C1, 'M', 'h'), - (0x1D5C2, 'M', 'i'), - (0x1D5C3, 'M', 'j'), - (0x1D5C4, 'M', 'k'), - (0x1D5C5, 'M', 'l'), - (0x1D5C6, 'M', 'm'), - (0x1D5C7, 'M', 'n'), - (0x1D5C8, 'M', 'o'), - (0x1D5C9, 'M', 'p'), - (0x1D5CA, 'M', 'q'), - (0x1D5CB, 'M', 'r'), - (0x1D5CC, 'M', 's'), - (0x1D5CD, 'M', 't'), - (0x1D5CE, 'M', 'u'), - (0x1D5CF, 'M', 'v'), - (0x1D5D0, 'M', 'w'), - (0x1D5D1, 'M', 'x'), - (0x1D5D2, 'M', 'y'), - (0x1D5D3, 'M', 'z'), - (0x1D5D4, 'M', 'a'), - (0x1D5D5, 'M', 'b'), - (0x1D5D6, 'M', 'c'), - (0x1D5D7, 'M', 'd'), - (0x1D5D8, 'M', 'e'), - (0x1D5D9, 'M', 'f'), - (0x1D5DA, 'M', 'g'), - (0x1D5DB, 'M', 'h'), - (0x1D5DC, 'M', 'i'), - (0x1D5DD, 'M', 'j'), - (0x1D5DE, 'M', 'k'), - (0x1D5DF, 'M', 'l'), - (0x1D5E0, 'M', 'm'), - (0x1D5E1, 'M', 'n'), - (0x1D5E2, 'M', 'o'), - (0x1D5E3, 'M', 'p'), - (0x1D5E4, 'M', 'q'), - (0x1D5E5, 'M', 'r'), - (0x1D5E6, 'M', 's'), - (0x1D5E7, 'M', 't'), - (0x1D5E8, 'M', 'u'), - (0x1D5E9, 'M', 'v'), - (0x1D5EA, 'M', 'w'), - (0x1D5EB, 'M', 'x'), - (0x1D5EC, 'M', 'y'), - (0x1D5ED, 'M', 'z'), - (0x1D5EE, 'M', 'a'), - (0x1D5EF, 'M', 'b'), - (0x1D5F0, 'M', 'c'), - (0x1D5F1, 'M', 'd'), - (0x1D5F2, 'M', 'e'), - (0x1D5F3, 'M', 'f'), - (0x1D5F4, 'M', 'g'), - (0x1D5F5, 'M', 'h'), - (0x1D5F6, 'M', 'i'), - (0x1D5F7, 'M', 'j'), - (0x1D5F8, 'M', 'k'), - (0x1D5F9, 'M', 'l'), - (0x1D5FA, 'M', 'm'), - (0x1D5FB, 'M', 'n'), - (0x1D5FC, 'M', 'o'), - (0x1D5FD, 'M', 'p'), - (0x1D5FE, 'M', 'q'), - (0x1D5FF, 'M', 'r'), - (0x1D600, 'M', 's'), - (0x1D601, 'M', 't'), - (0x1D602, 'M', 'u'), - (0x1D603, 'M', 'v'), - (0x1D604, 'M', 'w'), - (0x1D605, 'M', 'x'), - (0x1D606, 'M', 'y'), - (0x1D607, 'M', 'z'), - (0x1D608, 'M', 'a'), - (0x1D609, 'M', 'b'), - (0x1D60A, 'M', 'c'), - (0x1D60B, 'M', 'd'), - (0x1D60C, 'M', 'e'), - (0x1D60D, 'M', 'f'), - (0x1D60E, 'M', 'g'), - (0x1D60F, 'M', 'h'), - (0x1D610, 'M', 'i'), - (0x1D611, 'M', 'j'), - (0x1D612, 'M', 'k'), - (0x1D613, 'M', 'l'), - (0x1D614, 'M', 'm'), - (0x1D615, 'M', 'n'), - (0x1D616, 'M', 'o'), - (0x1D617, 'M', 'p'), - (0x1D618, 'M', 'q'), - (0x1D619, 'M', 'r'), - (0x1D61A, 'M', 's'), - ] - -def _seg_66() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x1D61B, 'M', 't'), - (0x1D61C, 'M', 'u'), - (0x1D61D, 'M', 'v'), - (0x1D61E, 'M', 'w'), - (0x1D61F, 'M', 'x'), - (0x1D620, 'M', 'y'), - (0x1D621, 'M', 'z'), - (0x1D622, 'M', 'a'), - (0x1D623, 'M', 'b'), - (0x1D624, 'M', 'c'), - (0x1D625, 'M', 'd'), - (0x1D626, 'M', 'e'), - (0x1D627, 'M', 'f'), - (0x1D628, 'M', 'g'), - (0x1D629, 'M', 'h'), - (0x1D62A, 'M', 'i'), - (0x1D62B, 'M', 'j'), - (0x1D62C, 'M', 'k'), - (0x1D62D, 'M', 'l'), - (0x1D62E, 'M', 'm'), - (0x1D62F, 'M', 'n'), - (0x1D630, 'M', 'o'), - (0x1D631, 'M', 'p'), - (0x1D632, 'M', 'q'), - (0x1D633, 'M', 'r'), - (0x1D634, 'M', 's'), - (0x1D635, 'M', 't'), - (0x1D636, 'M', 'u'), - (0x1D637, 'M', 'v'), - (0x1D638, 'M', 'w'), - (0x1D639, 'M', 'x'), - (0x1D63A, 'M', 'y'), - (0x1D63B, 'M', 'z'), - (0x1D63C, 'M', 'a'), - (0x1D63D, 'M', 'b'), - (0x1D63E, 'M', 'c'), - (0x1D63F, 'M', 'd'), - (0x1D640, 'M', 'e'), - (0x1D641, 'M', 'f'), - (0x1D642, 'M', 'g'), - (0x1D643, 'M', 'h'), - (0x1D644, 'M', 'i'), - (0x1D645, 'M', 'j'), - (0x1D646, 'M', 'k'), - (0x1D647, 'M', 'l'), - (0x1D648, 'M', 'm'), - (0x1D649, 'M', 'n'), - (0x1D64A, 'M', 'o'), - (0x1D64B, 'M', 'p'), - (0x1D64C, 'M', 'q'), - (0x1D64D, 'M', 'r'), - (0x1D64E, 'M', 's'), - (0x1D64F, 'M', 't'), - (0x1D650, 'M', 'u'), - (0x1D651, 'M', 'v'), - (0x1D652, 'M', 'w'), - (0x1D653, 'M', 'x'), - (0x1D654, 'M', 'y'), - (0x1D655, 'M', 'z'), - (0x1D656, 'M', 'a'), - (0x1D657, 'M', 'b'), - (0x1D658, 'M', 'c'), - (0x1D659, 'M', 'd'), - (0x1D65A, 'M', 'e'), - (0x1D65B, 'M', 'f'), - (0x1D65C, 'M', 'g'), - (0x1D65D, 'M', 'h'), - (0x1D65E, 'M', 'i'), - (0x1D65F, 'M', 'j'), - (0x1D660, 'M', 'k'), - (0x1D661, 'M', 'l'), - (0x1D662, 'M', 'm'), - (0x1D663, 'M', 'n'), - (0x1D664, 'M', 'o'), - (0x1D665, 'M', 'p'), - (0x1D666, 'M', 'q'), - (0x1D667, 'M', 'r'), - (0x1D668, 'M', 's'), - (0x1D669, 'M', 't'), - (0x1D66A, 'M', 'u'), - (0x1D66B, 'M', 'v'), - (0x1D66C, 'M', 'w'), - (0x1D66D, 'M', 'x'), - (0x1D66E, 'M', 'y'), - (0x1D66F, 'M', 'z'), - (0x1D670, 'M', 'a'), - (0x1D671, 'M', 'b'), - (0x1D672, 'M', 'c'), - (0x1D673, 'M', 'd'), - (0x1D674, 'M', 'e'), - (0x1D675, 'M', 'f'), - (0x1D676, 'M', 'g'), - (0x1D677, 'M', 'h'), - (0x1D678, 'M', 'i'), - (0x1D679, 'M', 'j'), - (0x1D67A, 'M', 'k'), - (0x1D67B, 'M', 'l'), - (0x1D67C, 'M', 'm'), - (0x1D67D, 'M', 'n'), - (0x1D67E, 'M', 'o'), - ] - -def _seg_67() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x1D67F, 'M', 'p'), - (0x1D680, 'M', 'q'), - (0x1D681, 'M', 'r'), - (0x1D682, 'M', 's'), - (0x1D683, 'M', 't'), - (0x1D684, 'M', 'u'), - (0x1D685, 'M', 'v'), - (0x1D686, 'M', 'w'), - (0x1D687, 'M', 'x'), - (0x1D688, 'M', 'y'), - (0x1D689, 'M', 'z'), - (0x1D68A, 'M', 'a'), - (0x1D68B, 'M', 'b'), - (0x1D68C, 'M', 'c'), - (0x1D68D, 'M', 'd'), - (0x1D68E, 'M', 'e'), - (0x1D68F, 'M', 'f'), - (0x1D690, 'M', 'g'), - (0x1D691, 'M', 'h'), - (0x1D692, 'M', 'i'), - (0x1D693, 'M', 'j'), - (0x1D694, 'M', 'k'), - (0x1D695, 'M', 'l'), - (0x1D696, 'M', 'm'), - (0x1D697, 'M', 'n'), - (0x1D698, 'M', 'o'), - (0x1D699, 'M', 'p'), - (0x1D69A, 'M', 'q'), - (0x1D69B, 'M', 'r'), - (0x1D69C, 'M', 's'), - (0x1D69D, 'M', 't'), - (0x1D69E, 'M', 'u'), - (0x1D69F, 'M', 'v'), - (0x1D6A0, 'M', 'w'), - (0x1D6A1, 'M', 'x'), - (0x1D6A2, 'M', 'y'), - (0x1D6A3, 'M', 'z'), - (0x1D6A4, 'M', 'ı'), - (0x1D6A5, 'M', 'ȷ'), - (0x1D6A6, 'X'), - (0x1D6A8, 'M', 'α'), - (0x1D6A9, 'M', 'β'), - (0x1D6AA, 'M', 'γ'), - (0x1D6AB, 'M', 'δ'), - (0x1D6AC, 'M', 'ε'), - (0x1D6AD, 'M', 'ζ'), - (0x1D6AE, 'M', 'η'), - (0x1D6AF, 'M', 'θ'), - (0x1D6B0, 'M', 'ι'), - (0x1D6B1, 'M', 'κ'), - (0x1D6B2, 'M', 'λ'), - (0x1D6B3, 'M', 'μ'), - (0x1D6B4, 'M', 'ν'), - (0x1D6B5, 'M', 'ξ'), - (0x1D6B6, 'M', 'ο'), - (0x1D6B7, 'M', 'π'), - (0x1D6B8, 'M', 'ρ'), - (0x1D6B9, 'M', 'θ'), - (0x1D6BA, 'M', 'σ'), - (0x1D6BB, 'M', 'τ'), - (0x1D6BC, 'M', 'υ'), - (0x1D6BD, 'M', 'φ'), - (0x1D6BE, 'M', 'χ'), - (0x1D6BF, 'M', 'ψ'), - (0x1D6C0, 'M', 'ω'), - (0x1D6C1, 'M', '∇'), - (0x1D6C2, 'M', 'α'), - (0x1D6C3, 'M', 'β'), - (0x1D6C4, 'M', 'γ'), - (0x1D6C5, 'M', 'δ'), - (0x1D6C6, 'M', 'ε'), - (0x1D6C7, 'M', 'ζ'), - (0x1D6C8, 'M', 'η'), - (0x1D6C9, 'M', 'θ'), - (0x1D6CA, 'M', 'ι'), - (0x1D6CB, 'M', 'κ'), - (0x1D6CC, 'M', 'λ'), - (0x1D6CD, 'M', 'μ'), - (0x1D6CE, 'M', 'ν'), - (0x1D6CF, 'M', 'ξ'), - (0x1D6D0, 'M', 'ο'), - (0x1D6D1, 'M', 'π'), - (0x1D6D2, 'M', 'ρ'), - (0x1D6D3, 'M', 'σ'), - (0x1D6D5, 'M', 'τ'), - (0x1D6D6, 'M', 'υ'), - (0x1D6D7, 'M', 'φ'), - (0x1D6D8, 'M', 'χ'), - (0x1D6D9, 'M', 'ψ'), - (0x1D6DA, 'M', 'ω'), - (0x1D6DB, 'M', '∂'), - (0x1D6DC, 'M', 'ε'), - (0x1D6DD, 'M', 'θ'), - (0x1D6DE, 'M', 'κ'), - (0x1D6DF, 'M', 'φ'), - (0x1D6E0, 'M', 'ρ'), - (0x1D6E1, 'M', 'π'), - (0x1D6E2, 'M', 'α'), - (0x1D6E3, 'M', 'β'), - (0x1D6E4, 'M', 'γ'), - ] - -def _seg_68() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x1D6E5, 'M', 'δ'), - (0x1D6E6, 'M', 'ε'), - (0x1D6E7, 'M', 'ζ'), - (0x1D6E8, 'M', 'η'), - (0x1D6E9, 'M', 'θ'), - (0x1D6EA, 'M', 'ι'), - (0x1D6EB, 'M', 'κ'), - (0x1D6EC, 'M', 'λ'), - (0x1D6ED, 'M', 'μ'), - (0x1D6EE, 'M', 'ν'), - (0x1D6EF, 'M', 'ξ'), - (0x1D6F0, 'M', 'ο'), - (0x1D6F1, 'M', 'π'), - (0x1D6F2, 'M', 'ρ'), - (0x1D6F3, 'M', 'θ'), - (0x1D6F4, 'M', 'σ'), - (0x1D6F5, 'M', 'τ'), - (0x1D6F6, 'M', 'υ'), - (0x1D6F7, 'M', 'φ'), - (0x1D6F8, 'M', 'χ'), - (0x1D6F9, 'M', 'ψ'), - (0x1D6FA, 'M', 'ω'), - (0x1D6FB, 'M', '∇'), - (0x1D6FC, 'M', 'α'), - (0x1D6FD, 'M', 'β'), - (0x1D6FE, 'M', 'γ'), - (0x1D6FF, 'M', 'δ'), - (0x1D700, 'M', 'ε'), - (0x1D701, 'M', 'ζ'), - (0x1D702, 'M', 'η'), - (0x1D703, 'M', 'θ'), - (0x1D704, 'M', 'ι'), - (0x1D705, 'M', 'κ'), - (0x1D706, 'M', 'λ'), - (0x1D707, 'M', 'μ'), - (0x1D708, 'M', 'ν'), - (0x1D709, 'M', 'ξ'), - (0x1D70A, 'M', 'ο'), - (0x1D70B, 'M', 'π'), - (0x1D70C, 'M', 'ρ'), - (0x1D70D, 'M', 'σ'), - (0x1D70F, 'M', 'τ'), - (0x1D710, 'M', 'υ'), - (0x1D711, 'M', 'φ'), - (0x1D712, 'M', 'χ'), - (0x1D713, 'M', 'ψ'), - (0x1D714, 'M', 'ω'), - (0x1D715, 'M', '∂'), - (0x1D716, 'M', 'ε'), - (0x1D717, 'M', 'θ'), - (0x1D718, 'M', 'κ'), - (0x1D719, 'M', 'φ'), - (0x1D71A, 'M', 'ρ'), - (0x1D71B, 'M', 'π'), - (0x1D71C, 'M', 'α'), - (0x1D71D, 'M', 'β'), - (0x1D71E, 'M', 'γ'), - (0x1D71F, 'M', 'δ'), - (0x1D720, 'M', 'ε'), - (0x1D721, 'M', 'ζ'), - (0x1D722, 'M', 'η'), - (0x1D723, 'M', 'θ'), - (0x1D724, 'M', 'ι'), - (0x1D725, 'M', 'κ'), - (0x1D726, 'M', 'λ'), - (0x1D727, 'M', 'μ'), - (0x1D728, 'M', 'ν'), - (0x1D729, 'M', 'ξ'), - (0x1D72A, 'M', 'ο'), - (0x1D72B, 'M', 'π'), - (0x1D72C, 'M', 'ρ'), - (0x1D72D, 'M', 'θ'), - (0x1D72E, 'M', 'σ'), - (0x1D72F, 'M', 'τ'), - (0x1D730, 'M', 'υ'), - (0x1D731, 'M', 'φ'), - (0x1D732, 'M', 'χ'), - (0x1D733, 'M', 'ψ'), - (0x1D734, 'M', 'ω'), - (0x1D735, 'M', '∇'), - (0x1D736, 'M', 'α'), - (0x1D737, 'M', 'β'), - (0x1D738, 'M', 'γ'), - (0x1D739, 'M', 'δ'), - (0x1D73A, 'M', 'ε'), - (0x1D73B, 'M', 'ζ'), - (0x1D73C, 'M', 'η'), - (0x1D73D, 'M', 'θ'), - (0x1D73E, 'M', 'ι'), - (0x1D73F, 'M', 'κ'), - (0x1D740, 'M', 'λ'), - (0x1D741, 'M', 'μ'), - (0x1D742, 'M', 'ν'), - (0x1D743, 'M', 'ξ'), - (0x1D744, 'M', 'ο'), - (0x1D745, 'M', 'π'), - (0x1D746, 'M', 'ρ'), - (0x1D747, 'M', 'σ'), - (0x1D749, 'M', 'τ'), - (0x1D74A, 'M', 'υ'), - ] - -def _seg_69() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x1D74B, 'M', 'φ'), - (0x1D74C, 'M', 'χ'), - (0x1D74D, 'M', 'ψ'), - (0x1D74E, 'M', 'ω'), - (0x1D74F, 'M', '∂'), - (0x1D750, 'M', 'ε'), - (0x1D751, 'M', 'θ'), - (0x1D752, 'M', 'κ'), - (0x1D753, 'M', 'φ'), - (0x1D754, 'M', 'ρ'), - (0x1D755, 'M', 'π'), - (0x1D756, 'M', 'α'), - (0x1D757, 'M', 'β'), - (0x1D758, 'M', 'γ'), - (0x1D759, 'M', 'δ'), - (0x1D75A, 'M', 'ε'), - (0x1D75B, 'M', 'ζ'), - (0x1D75C, 'M', 'η'), - (0x1D75D, 'M', 'θ'), - (0x1D75E, 'M', 'ι'), - (0x1D75F, 'M', 'κ'), - (0x1D760, 'M', 'λ'), - (0x1D761, 'M', 'μ'), - (0x1D762, 'M', 'ν'), - (0x1D763, 'M', 'ξ'), - (0x1D764, 'M', 'ο'), - (0x1D765, 'M', 'π'), - (0x1D766, 'M', 'ρ'), - (0x1D767, 'M', 'θ'), - (0x1D768, 'M', 'σ'), - (0x1D769, 'M', 'τ'), - (0x1D76A, 'M', 'υ'), - (0x1D76B, 'M', 'φ'), - (0x1D76C, 'M', 'χ'), - (0x1D76D, 'M', 'ψ'), - (0x1D76E, 'M', 'ω'), - (0x1D76F, 'M', '∇'), - (0x1D770, 'M', 'α'), - (0x1D771, 'M', 'β'), - (0x1D772, 'M', 'γ'), - (0x1D773, 'M', 'δ'), - (0x1D774, 'M', 'ε'), - (0x1D775, 'M', 'ζ'), - (0x1D776, 'M', 'η'), - (0x1D777, 'M', 'θ'), - (0x1D778, 'M', 'ι'), - (0x1D779, 'M', 'κ'), - (0x1D77A, 'M', 'λ'), - (0x1D77B, 'M', 'μ'), - (0x1D77C, 'M', 'ν'), - (0x1D77D, 'M', 'ξ'), - (0x1D77E, 'M', 'ο'), - (0x1D77F, 'M', 'π'), - (0x1D780, 'M', 'ρ'), - (0x1D781, 'M', 'σ'), - (0x1D783, 'M', 'τ'), - (0x1D784, 'M', 'υ'), - (0x1D785, 'M', 'φ'), - (0x1D786, 'M', 'χ'), - (0x1D787, 'M', 'ψ'), - (0x1D788, 'M', 'ω'), - (0x1D789, 'M', '∂'), - (0x1D78A, 'M', 'ε'), - (0x1D78B, 'M', 'θ'), - (0x1D78C, 'M', 'κ'), - (0x1D78D, 'M', 'φ'), - (0x1D78E, 'M', 'ρ'), - (0x1D78F, 'M', 'π'), - (0x1D790, 'M', 'α'), - (0x1D791, 'M', 'β'), - (0x1D792, 'M', 'γ'), - (0x1D793, 'M', 'δ'), - (0x1D794, 'M', 'ε'), - (0x1D795, 'M', 'ζ'), - (0x1D796, 'M', 'η'), - (0x1D797, 'M', 'θ'), - (0x1D798, 'M', 'ι'), - (0x1D799, 'M', 'κ'), - (0x1D79A, 'M', 'λ'), - (0x1D79B, 'M', 'μ'), - (0x1D79C, 'M', 'ν'), - (0x1D79D, 'M', 'ξ'), - (0x1D79E, 'M', 'ο'), - (0x1D79F, 'M', 'π'), - (0x1D7A0, 'M', 'ρ'), - (0x1D7A1, 'M', 'θ'), - (0x1D7A2, 'M', 'σ'), - (0x1D7A3, 'M', 'τ'), - (0x1D7A4, 'M', 'υ'), - (0x1D7A5, 'M', 'φ'), - (0x1D7A6, 'M', 'χ'), - (0x1D7A7, 'M', 'ψ'), - (0x1D7A8, 'M', 'ω'), - (0x1D7A9, 'M', '∇'), - (0x1D7AA, 'M', 'α'), - (0x1D7AB, 'M', 'β'), - (0x1D7AC, 'M', 'γ'), - (0x1D7AD, 'M', 'δ'), - (0x1D7AE, 'M', 'ε'), - (0x1D7AF, 'M', 'ζ'), - ] - -def _seg_70() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x1D7B0, 'M', 'η'), - (0x1D7B1, 'M', 'θ'), - (0x1D7B2, 'M', 'ι'), - (0x1D7B3, 'M', 'κ'), - (0x1D7B4, 'M', 'λ'), - (0x1D7B5, 'M', 'μ'), - (0x1D7B6, 'M', 'ν'), - (0x1D7B7, 'M', 'ξ'), - (0x1D7B8, 'M', 'ο'), - (0x1D7B9, 'M', 'π'), - (0x1D7BA, 'M', 'ρ'), - (0x1D7BB, 'M', 'σ'), - (0x1D7BD, 'M', 'τ'), - (0x1D7BE, 'M', 'υ'), - (0x1D7BF, 'M', 'φ'), - (0x1D7C0, 'M', 'χ'), - (0x1D7C1, 'M', 'ψ'), - (0x1D7C2, 'M', 'ω'), - (0x1D7C3, 'M', '∂'), - (0x1D7C4, 'M', 'ε'), - (0x1D7C5, 'M', 'θ'), - (0x1D7C6, 'M', 'κ'), - (0x1D7C7, 'M', 'φ'), - (0x1D7C8, 'M', 'ρ'), - (0x1D7C9, 'M', 'π'), - (0x1D7CA, 'M', 'ϝ'), - (0x1D7CC, 'X'), - (0x1D7CE, 'M', '0'), - (0x1D7CF, 'M', '1'), - (0x1D7D0, 'M', '2'), - (0x1D7D1, 'M', '3'), - (0x1D7D2, 'M', '4'), - (0x1D7D3, 'M', '5'), - (0x1D7D4, 'M', '6'), - (0x1D7D5, 'M', '7'), - (0x1D7D6, 'M', '8'), - (0x1D7D7, 'M', '9'), - (0x1D7D8, 'M', '0'), - (0x1D7D9, 'M', '1'), - (0x1D7DA, 'M', '2'), - (0x1D7DB, 'M', '3'), - (0x1D7DC, 'M', '4'), - (0x1D7DD, 'M', '5'), - (0x1D7DE, 'M', '6'), - (0x1D7DF, 'M', '7'), - (0x1D7E0, 'M', '8'), - (0x1D7E1, 'M', '9'), - (0x1D7E2, 'M', '0'), - (0x1D7E3, 'M', '1'), - (0x1D7E4, 'M', '2'), - (0x1D7E5, 'M', '3'), - (0x1D7E6, 'M', '4'), - (0x1D7E7, 'M', '5'), - (0x1D7E8, 'M', '6'), - (0x1D7E9, 'M', '7'), - (0x1D7EA, 'M', '8'), - (0x1D7EB, 'M', '9'), - (0x1D7EC, 'M', '0'), - (0x1D7ED, 'M', '1'), - (0x1D7EE, 'M', '2'), - (0x1D7EF, 'M', '3'), - (0x1D7F0, 'M', '4'), - (0x1D7F1, 'M', '5'), - (0x1D7F2, 'M', '6'), - (0x1D7F3, 'M', '7'), - (0x1D7F4, 'M', '8'), - (0x1D7F5, 'M', '9'), - (0x1D7F6, 'M', '0'), - (0x1D7F7, 'M', '1'), - (0x1D7F8, 'M', '2'), - (0x1D7F9, 'M', '3'), - (0x1D7FA, 'M', '4'), - (0x1D7FB, 'M', '5'), - (0x1D7FC, 'M', '6'), - (0x1D7FD, 'M', '7'), - (0x1D7FE, 'M', '8'), - (0x1D7FF, 'M', '9'), - (0x1D800, 'V'), - (0x1DA8C, 'X'), - (0x1DA9B, 'V'), - (0x1DAA0, 'X'), - (0x1DAA1, 'V'), - (0x1DAB0, 'X'), - (0x1DF00, 'V'), - (0x1DF1F, 'X'), - (0x1DF25, 'V'), - (0x1DF2B, 'X'), - (0x1E000, 'V'), - (0x1E007, 'X'), - (0x1E008, 'V'), - (0x1E019, 'X'), - (0x1E01B, 'V'), - (0x1E022, 'X'), - (0x1E023, 'V'), - (0x1E025, 'X'), - (0x1E026, 'V'), - (0x1E02B, 'X'), - (0x1E030, 'M', 'а'), - (0x1E031, 'M', 'б'), - (0x1E032, 'M', 'в'), - ] - -def _seg_71() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x1E033, 'M', 'г'), - (0x1E034, 'M', 'д'), - (0x1E035, 'M', 'е'), - (0x1E036, 'M', 'ж'), - (0x1E037, 'M', 'з'), - (0x1E038, 'M', 'и'), - (0x1E039, 'M', 'к'), - (0x1E03A, 'M', 'л'), - (0x1E03B, 'M', 'м'), - (0x1E03C, 'M', 'о'), - (0x1E03D, 'M', 'п'), - (0x1E03E, 'M', 'р'), - (0x1E03F, 'M', 'с'), - (0x1E040, 'M', 'т'), - (0x1E041, 'M', 'у'), - (0x1E042, 'M', 'ф'), - (0x1E043, 'M', 'х'), - (0x1E044, 'M', 'ц'), - (0x1E045, 'M', 'ч'), - (0x1E046, 'M', 'ш'), - (0x1E047, 'M', 'ы'), - (0x1E048, 'M', 'э'), - (0x1E049, 'M', 'ю'), - (0x1E04A, 'M', 'ꚉ'), - (0x1E04B, 'M', 'ә'), - (0x1E04C, 'M', 'і'), - (0x1E04D, 'M', 'ј'), - (0x1E04E, 'M', 'ө'), - (0x1E04F, 'M', 'ү'), - (0x1E050, 'M', 'ӏ'), - (0x1E051, 'M', 'а'), - (0x1E052, 'M', 'б'), - (0x1E053, 'M', 'в'), - (0x1E054, 'M', 'г'), - (0x1E055, 'M', 'д'), - (0x1E056, 'M', 'е'), - (0x1E057, 'M', 'ж'), - (0x1E058, 'M', 'з'), - (0x1E059, 'M', 'и'), - (0x1E05A, 'M', 'к'), - (0x1E05B, 'M', 'л'), - (0x1E05C, 'M', 'о'), - (0x1E05D, 'M', 'п'), - (0x1E05E, 'M', 'с'), - (0x1E05F, 'M', 'у'), - (0x1E060, 'M', 'ф'), - (0x1E061, 'M', 'х'), - (0x1E062, 'M', 'ц'), - (0x1E063, 'M', 'ч'), - (0x1E064, 'M', 'ш'), - (0x1E065, 'M', 'ъ'), - (0x1E066, 'M', 'ы'), - (0x1E067, 'M', 'ґ'), - (0x1E068, 'M', 'і'), - (0x1E069, 'M', 'ѕ'), - (0x1E06A, 'M', 'џ'), - (0x1E06B, 'M', 'ҫ'), - (0x1E06C, 'M', 'ꙑ'), - (0x1E06D, 'M', 'ұ'), - (0x1E06E, 'X'), - (0x1E08F, 'V'), - (0x1E090, 'X'), - (0x1E100, 'V'), - (0x1E12D, 'X'), - (0x1E130, 'V'), - (0x1E13E, 'X'), - (0x1E140, 'V'), - (0x1E14A, 'X'), - (0x1E14E, 'V'), - (0x1E150, 'X'), - (0x1E290, 'V'), - (0x1E2AF, 'X'), - (0x1E2C0, 'V'), - (0x1E2FA, 'X'), - (0x1E2FF, 'V'), - (0x1E300, 'X'), - (0x1E4D0, 'V'), - (0x1E4FA, 'X'), - (0x1E7E0, 'V'), - (0x1E7E7, 'X'), - (0x1E7E8, 'V'), - (0x1E7EC, 'X'), - (0x1E7ED, 'V'), - (0x1E7EF, 'X'), - (0x1E7F0, 'V'), - (0x1E7FF, 'X'), - (0x1E800, 'V'), - (0x1E8C5, 'X'), - (0x1E8C7, 'V'), - (0x1E8D7, 'X'), - (0x1E900, 'M', '𞤢'), - (0x1E901, 'M', '𞤣'), - (0x1E902, 'M', '𞤤'), - (0x1E903, 'M', '𞤥'), - (0x1E904, 'M', '𞤦'), - (0x1E905, 'M', '𞤧'), - (0x1E906, 'M', '𞤨'), - (0x1E907, 'M', '𞤩'), - (0x1E908, 'M', '𞤪'), - (0x1E909, 'M', '𞤫'), - ] - -def _seg_72() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x1E90A, 'M', '𞤬'), - (0x1E90B, 'M', '𞤭'), - (0x1E90C, 'M', '𞤮'), - (0x1E90D, 'M', '𞤯'), - (0x1E90E, 'M', '𞤰'), - (0x1E90F, 'M', '𞤱'), - (0x1E910, 'M', '𞤲'), - (0x1E911, 'M', '𞤳'), - (0x1E912, 'M', '𞤴'), - (0x1E913, 'M', '𞤵'), - (0x1E914, 'M', '𞤶'), - (0x1E915, 'M', '𞤷'), - (0x1E916, 'M', '𞤸'), - (0x1E917, 'M', '𞤹'), - (0x1E918, 'M', '𞤺'), - (0x1E919, 'M', '𞤻'), - (0x1E91A, 'M', '𞤼'), - (0x1E91B, 'M', '𞤽'), - (0x1E91C, 'M', '𞤾'), - (0x1E91D, 'M', '𞤿'), - (0x1E91E, 'M', '𞥀'), - (0x1E91F, 'M', '𞥁'), - (0x1E920, 'M', '𞥂'), - (0x1E921, 'M', '𞥃'), - (0x1E922, 'V'), - (0x1E94C, 'X'), - (0x1E950, 'V'), - (0x1E95A, 'X'), - (0x1E95E, 'V'), - (0x1E960, 'X'), - (0x1EC71, 'V'), - (0x1ECB5, 'X'), - (0x1ED01, 'V'), - (0x1ED3E, 'X'), - (0x1EE00, 'M', 'ا'), - (0x1EE01, 'M', 'ب'), - (0x1EE02, 'M', 'ج'), - (0x1EE03, 'M', 'د'), - (0x1EE04, 'X'), - (0x1EE05, 'M', 'و'), - (0x1EE06, 'M', 'ز'), - (0x1EE07, 'M', 'ح'), - (0x1EE08, 'M', 'ط'), - (0x1EE09, 'M', 'ي'), - (0x1EE0A, 'M', 'ك'), - (0x1EE0B, 'M', 'ل'), - (0x1EE0C, 'M', 'م'), - (0x1EE0D, 'M', 'ن'), - (0x1EE0E, 'M', 'س'), - (0x1EE0F, 'M', 'ع'), - (0x1EE10, 'M', 'ف'), - (0x1EE11, 'M', 'ص'), - (0x1EE12, 'M', 'ق'), - (0x1EE13, 'M', 'ر'), - (0x1EE14, 'M', 'ش'), - (0x1EE15, 'M', 'ت'), - (0x1EE16, 'M', 'ث'), - (0x1EE17, 'M', 'خ'), - (0x1EE18, 'M', 'ذ'), - (0x1EE19, 'M', 'ض'), - (0x1EE1A, 'M', 'ظ'), - (0x1EE1B, 'M', 'غ'), - (0x1EE1C, 'M', 'ٮ'), - (0x1EE1D, 'M', 'ں'), - (0x1EE1E, 'M', 'ڡ'), - (0x1EE1F, 'M', 'ٯ'), - (0x1EE20, 'X'), - (0x1EE21, 'M', 'ب'), - (0x1EE22, 'M', 'ج'), - (0x1EE23, 'X'), - (0x1EE24, 'M', 'ه'), - (0x1EE25, 'X'), - (0x1EE27, 'M', 'ح'), - (0x1EE28, 'X'), - (0x1EE29, 'M', 'ي'), - (0x1EE2A, 'M', 'ك'), - (0x1EE2B, 'M', 'ل'), - (0x1EE2C, 'M', 'م'), - (0x1EE2D, 'M', 'ن'), - (0x1EE2E, 'M', 'س'), - (0x1EE2F, 'M', 'ع'), - (0x1EE30, 'M', 'ف'), - (0x1EE31, 'M', 'ص'), - (0x1EE32, 'M', 'ق'), - (0x1EE33, 'X'), - (0x1EE34, 'M', 'ش'), - (0x1EE35, 'M', 'ت'), - (0x1EE36, 'M', 'ث'), - (0x1EE37, 'M', 'خ'), - (0x1EE38, 'X'), - (0x1EE39, 'M', 'ض'), - (0x1EE3A, 'X'), - (0x1EE3B, 'M', 'غ'), - (0x1EE3C, 'X'), - (0x1EE42, 'M', 'ج'), - (0x1EE43, 'X'), - (0x1EE47, 'M', 'ح'), - (0x1EE48, 'X'), - (0x1EE49, 'M', 'ي'), - (0x1EE4A, 'X'), - ] - -def _seg_73() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x1EE4B, 'M', 'ل'), - (0x1EE4C, 'X'), - (0x1EE4D, 'M', 'ن'), - (0x1EE4E, 'M', 'س'), - (0x1EE4F, 'M', 'ع'), - (0x1EE50, 'X'), - (0x1EE51, 'M', 'ص'), - (0x1EE52, 'M', 'ق'), - (0x1EE53, 'X'), - (0x1EE54, 'M', 'ش'), - (0x1EE55, 'X'), - (0x1EE57, 'M', 'خ'), - (0x1EE58, 'X'), - (0x1EE59, 'M', 'ض'), - (0x1EE5A, 'X'), - (0x1EE5B, 'M', 'غ'), - (0x1EE5C, 'X'), - (0x1EE5D, 'M', 'ں'), - (0x1EE5E, 'X'), - (0x1EE5F, 'M', 'ٯ'), - (0x1EE60, 'X'), - (0x1EE61, 'M', 'ب'), - (0x1EE62, 'M', 'ج'), - (0x1EE63, 'X'), - (0x1EE64, 'M', 'ه'), - (0x1EE65, 'X'), - (0x1EE67, 'M', 'ح'), - (0x1EE68, 'M', 'ط'), - (0x1EE69, 'M', 'ي'), - (0x1EE6A, 'M', 'ك'), - (0x1EE6B, 'X'), - (0x1EE6C, 'M', 'م'), - (0x1EE6D, 'M', 'ن'), - (0x1EE6E, 'M', 'س'), - (0x1EE6F, 'M', 'ع'), - (0x1EE70, 'M', 'ف'), - (0x1EE71, 'M', 'ص'), - (0x1EE72, 'M', 'ق'), - (0x1EE73, 'X'), - (0x1EE74, 'M', 'ش'), - (0x1EE75, 'M', 'ت'), - (0x1EE76, 'M', 'ث'), - (0x1EE77, 'M', 'خ'), - (0x1EE78, 'X'), - (0x1EE79, 'M', 'ض'), - (0x1EE7A, 'M', 'ظ'), - (0x1EE7B, 'M', 'غ'), - (0x1EE7C, 'M', 'ٮ'), - (0x1EE7D, 'X'), - (0x1EE7E, 'M', 'ڡ'), - (0x1EE7F, 'X'), - (0x1EE80, 'M', 'ا'), - (0x1EE81, 'M', 'ب'), - (0x1EE82, 'M', 'ج'), - (0x1EE83, 'M', 'د'), - (0x1EE84, 'M', 'ه'), - (0x1EE85, 'M', 'و'), - (0x1EE86, 'M', 'ز'), - (0x1EE87, 'M', 'ح'), - (0x1EE88, 'M', 'ط'), - (0x1EE89, 'M', 'ي'), - (0x1EE8A, 'X'), - (0x1EE8B, 'M', 'ل'), - (0x1EE8C, 'M', 'م'), - (0x1EE8D, 'M', 'ن'), - (0x1EE8E, 'M', 'س'), - (0x1EE8F, 'M', 'ع'), - (0x1EE90, 'M', 'ف'), - (0x1EE91, 'M', 'ص'), - (0x1EE92, 'M', 'ق'), - (0x1EE93, 'M', 'ر'), - (0x1EE94, 'M', 'ش'), - (0x1EE95, 'M', 'ت'), - (0x1EE96, 'M', 'ث'), - (0x1EE97, 'M', 'خ'), - (0x1EE98, 'M', 'ذ'), - (0x1EE99, 'M', 'ض'), - (0x1EE9A, 'M', 'ظ'), - (0x1EE9B, 'M', 'غ'), - (0x1EE9C, 'X'), - (0x1EEA1, 'M', 'ب'), - (0x1EEA2, 'M', 'ج'), - (0x1EEA3, 'M', 'د'), - (0x1EEA4, 'X'), - (0x1EEA5, 'M', 'و'), - (0x1EEA6, 'M', 'ز'), - (0x1EEA7, 'M', 'ح'), - (0x1EEA8, 'M', 'ط'), - (0x1EEA9, 'M', 'ي'), - (0x1EEAA, 'X'), - (0x1EEAB, 'M', 'ل'), - (0x1EEAC, 'M', 'م'), - (0x1EEAD, 'M', 'ن'), - (0x1EEAE, 'M', 'س'), - (0x1EEAF, 'M', 'ع'), - (0x1EEB0, 'M', 'ف'), - (0x1EEB1, 'M', 'ص'), - (0x1EEB2, 'M', 'ق'), - (0x1EEB3, 'M', 'ر'), - (0x1EEB4, 'M', 'ش'), - ] - -def _seg_74() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x1EEB5, 'M', 'ت'), - (0x1EEB6, 'M', 'ث'), - (0x1EEB7, 'M', 'خ'), - (0x1EEB8, 'M', 'ذ'), - (0x1EEB9, 'M', 'ض'), - (0x1EEBA, 'M', 'ظ'), - (0x1EEBB, 'M', 'غ'), - (0x1EEBC, 'X'), - (0x1EEF0, 'V'), - (0x1EEF2, 'X'), - (0x1F000, 'V'), - (0x1F02C, 'X'), - (0x1F030, 'V'), - (0x1F094, 'X'), - (0x1F0A0, 'V'), - (0x1F0AF, 'X'), - (0x1F0B1, 'V'), - (0x1F0C0, 'X'), - (0x1F0C1, 'V'), - (0x1F0D0, 'X'), - (0x1F0D1, 'V'), - (0x1F0F6, 'X'), - (0x1F101, '3', '0,'), - (0x1F102, '3', '1,'), - (0x1F103, '3', '2,'), - (0x1F104, '3', '3,'), - (0x1F105, '3', '4,'), - (0x1F106, '3', '5,'), - (0x1F107, '3', '6,'), - (0x1F108, '3', '7,'), - (0x1F109, '3', '8,'), - (0x1F10A, '3', '9,'), - (0x1F10B, 'V'), - (0x1F110, '3', '(a)'), - (0x1F111, '3', '(b)'), - (0x1F112, '3', '(c)'), - (0x1F113, '3', '(d)'), - (0x1F114, '3', '(e)'), - (0x1F115, '3', '(f)'), - (0x1F116, '3', '(g)'), - (0x1F117, '3', '(h)'), - (0x1F118, '3', '(i)'), - (0x1F119, '3', '(j)'), - (0x1F11A, '3', '(k)'), - (0x1F11B, '3', '(l)'), - (0x1F11C, '3', '(m)'), - (0x1F11D, '3', '(n)'), - (0x1F11E, '3', '(o)'), - (0x1F11F, '3', '(p)'), - (0x1F120, '3', '(q)'), - (0x1F121, '3', '(r)'), - (0x1F122, '3', '(s)'), - (0x1F123, '3', '(t)'), - (0x1F124, '3', '(u)'), - (0x1F125, '3', '(v)'), - (0x1F126, '3', '(w)'), - (0x1F127, '3', '(x)'), - (0x1F128, '3', '(y)'), - (0x1F129, '3', '(z)'), - (0x1F12A, 'M', '〔s〕'), - (0x1F12B, 'M', 'c'), - (0x1F12C, 'M', 'r'), - (0x1F12D, 'M', 'cd'), - (0x1F12E, 'M', 'wz'), - (0x1F12F, 'V'), - (0x1F130, 'M', 'a'), - (0x1F131, 'M', 'b'), - (0x1F132, 'M', 'c'), - (0x1F133, 'M', 'd'), - (0x1F134, 'M', 'e'), - (0x1F135, 'M', 'f'), - (0x1F136, 'M', 'g'), - (0x1F137, 'M', 'h'), - (0x1F138, 'M', 'i'), - (0x1F139, 'M', 'j'), - (0x1F13A, 'M', 'k'), - (0x1F13B, 'M', 'l'), - (0x1F13C, 'M', 'm'), - (0x1F13D, 'M', 'n'), - (0x1F13E, 'M', 'o'), - (0x1F13F, 'M', 'p'), - (0x1F140, 'M', 'q'), - (0x1F141, 'M', 'r'), - (0x1F142, 'M', 's'), - (0x1F143, 'M', 't'), - (0x1F144, 'M', 'u'), - (0x1F145, 'M', 'v'), - (0x1F146, 'M', 'w'), - (0x1F147, 'M', 'x'), - (0x1F148, 'M', 'y'), - (0x1F149, 'M', 'z'), - (0x1F14A, 'M', 'hv'), - (0x1F14B, 'M', 'mv'), - (0x1F14C, 'M', 'sd'), - (0x1F14D, 'M', 'ss'), - (0x1F14E, 'M', 'ppv'), - (0x1F14F, 'M', 'wc'), - (0x1F150, 'V'), - (0x1F16A, 'M', 'mc'), - (0x1F16B, 'M', 'md'), - ] - -def _seg_75() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x1F16C, 'M', 'mr'), - (0x1F16D, 'V'), - (0x1F190, 'M', 'dj'), - (0x1F191, 'V'), - (0x1F1AE, 'X'), - (0x1F1E6, 'V'), - (0x1F200, 'M', 'ほか'), - (0x1F201, 'M', 'ココ'), - (0x1F202, 'M', 'サ'), - (0x1F203, 'X'), - (0x1F210, 'M', '手'), - (0x1F211, 'M', '字'), - (0x1F212, 'M', '双'), - (0x1F213, 'M', 'デ'), - (0x1F214, 'M', '二'), - (0x1F215, 'M', '多'), - (0x1F216, 'M', '解'), - (0x1F217, 'M', '天'), - (0x1F218, 'M', '交'), - (0x1F219, 'M', '映'), - (0x1F21A, 'M', '無'), - (0x1F21B, 'M', '料'), - (0x1F21C, 'M', '前'), - (0x1F21D, 'M', '後'), - (0x1F21E, 'M', '再'), - (0x1F21F, 'M', '新'), - (0x1F220, 'M', '初'), - (0x1F221, 'M', '終'), - (0x1F222, 'M', '生'), - (0x1F223, 'M', '販'), - (0x1F224, 'M', '声'), - (0x1F225, 'M', '吹'), - (0x1F226, 'M', '演'), - (0x1F227, 'M', '投'), - (0x1F228, 'M', '捕'), - (0x1F229, 'M', '一'), - (0x1F22A, 'M', '三'), - (0x1F22B, 'M', '遊'), - (0x1F22C, 'M', '左'), - (0x1F22D, 'M', '中'), - (0x1F22E, 'M', '右'), - (0x1F22F, 'M', '指'), - (0x1F230, 'M', '走'), - (0x1F231, 'M', '打'), - (0x1F232, 'M', '禁'), - (0x1F233, 'M', '空'), - (0x1F234, 'M', '合'), - (0x1F235, 'M', '満'), - (0x1F236, 'M', '有'), - (0x1F237, 'M', '月'), - (0x1F238, 'M', '申'), - (0x1F239, 'M', '割'), - (0x1F23A, 'M', '営'), - (0x1F23B, 'M', '配'), - (0x1F23C, 'X'), - (0x1F240, 'M', '〔本〕'), - (0x1F241, 'M', '〔三〕'), - (0x1F242, 'M', '〔二〕'), - (0x1F243, 'M', '〔安〕'), - (0x1F244, 'M', '〔点〕'), - (0x1F245, 'M', '〔打〕'), - (0x1F246, 'M', '〔盗〕'), - (0x1F247, 'M', '〔勝〕'), - (0x1F248, 'M', '〔敗〕'), - (0x1F249, 'X'), - (0x1F250, 'M', '得'), - (0x1F251, 'M', '可'), - (0x1F252, 'X'), - (0x1F260, 'V'), - (0x1F266, 'X'), - (0x1F300, 'V'), - (0x1F6D8, 'X'), - (0x1F6DC, 'V'), - (0x1F6ED, 'X'), - (0x1F6F0, 'V'), - (0x1F6FD, 'X'), - (0x1F700, 'V'), - (0x1F777, 'X'), - (0x1F77B, 'V'), - (0x1F7DA, 'X'), - (0x1F7E0, 'V'), - (0x1F7EC, 'X'), - (0x1F7F0, 'V'), - (0x1F7F1, 'X'), - (0x1F800, 'V'), - (0x1F80C, 'X'), - (0x1F810, 'V'), - (0x1F848, 'X'), - (0x1F850, 'V'), - (0x1F85A, 'X'), - (0x1F860, 'V'), - (0x1F888, 'X'), - (0x1F890, 'V'), - (0x1F8AE, 'X'), - (0x1F8B0, 'V'), - (0x1F8B2, 'X'), - (0x1F900, 'V'), - (0x1FA54, 'X'), - (0x1FA60, 'V'), - (0x1FA6E, 'X'), - ] - -def _seg_76() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x1FA70, 'V'), - (0x1FA7D, 'X'), - (0x1FA80, 'V'), - (0x1FA89, 'X'), - (0x1FA90, 'V'), - (0x1FABE, 'X'), - (0x1FABF, 'V'), - (0x1FAC6, 'X'), - (0x1FACE, 'V'), - (0x1FADC, 'X'), - (0x1FAE0, 'V'), - (0x1FAE9, 'X'), - (0x1FAF0, 'V'), - (0x1FAF9, 'X'), - (0x1FB00, 'V'), - (0x1FB93, 'X'), - (0x1FB94, 'V'), - (0x1FBCB, 'X'), - (0x1FBF0, 'M', '0'), - (0x1FBF1, 'M', '1'), - (0x1FBF2, 'M', '2'), - (0x1FBF3, 'M', '3'), - (0x1FBF4, 'M', '4'), - (0x1FBF5, 'M', '5'), - (0x1FBF6, 'M', '6'), - (0x1FBF7, 'M', '7'), - (0x1FBF8, 'M', '8'), - (0x1FBF9, 'M', '9'), - (0x1FBFA, 'X'), - (0x20000, 'V'), - (0x2A6E0, 'X'), - (0x2A700, 'V'), - (0x2B73A, 'X'), - (0x2B740, 'V'), - (0x2B81E, 'X'), - (0x2B820, 'V'), - (0x2CEA2, 'X'), - (0x2CEB0, 'V'), - (0x2EBE1, 'X'), - (0x2F800, 'M', '丽'), - (0x2F801, 'M', '丸'), - (0x2F802, 'M', '乁'), - (0x2F803, 'M', '𠄢'), - (0x2F804, 'M', '你'), - (0x2F805, 'M', '侮'), - (0x2F806, 'M', '侻'), - (0x2F807, 'M', '倂'), - (0x2F808, 'M', '偺'), - (0x2F809, 'M', '備'), - (0x2F80A, 'M', '僧'), - (0x2F80B, 'M', '像'), - (0x2F80C, 'M', '㒞'), - (0x2F80D, 'M', '𠘺'), - (0x2F80E, 'M', '免'), - (0x2F80F, 'M', '兔'), - (0x2F810, 'M', '兤'), - (0x2F811, 'M', '具'), - (0x2F812, 'M', '𠔜'), - (0x2F813, 'M', '㒹'), - (0x2F814, 'M', '內'), - (0x2F815, 'M', '再'), - (0x2F816, 'M', '𠕋'), - (0x2F817, 'M', '冗'), - (0x2F818, 'M', '冤'), - (0x2F819, 'M', '仌'), - (0x2F81A, 'M', '冬'), - (0x2F81B, 'M', '况'), - (0x2F81C, 'M', '𩇟'), - (0x2F81D, 'M', '凵'), - (0x2F81E, 'M', '刃'), - (0x2F81F, 'M', '㓟'), - (0x2F820, 'M', '刻'), - (0x2F821, 'M', '剆'), - (0x2F822, 'M', '割'), - (0x2F823, 'M', '剷'), - (0x2F824, 'M', '㔕'), - (0x2F825, 'M', '勇'), - (0x2F826, 'M', '勉'), - (0x2F827, 'M', '勤'), - (0x2F828, 'M', '勺'), - (0x2F829, 'M', '包'), - (0x2F82A, 'M', '匆'), - (0x2F82B, 'M', '北'), - (0x2F82C, 'M', '卉'), - (0x2F82D, 'M', '卑'), - (0x2F82E, 'M', '博'), - (0x2F82F, 'M', '即'), - (0x2F830, 'M', '卽'), - (0x2F831, 'M', '卿'), - (0x2F834, 'M', '𠨬'), - (0x2F835, 'M', '灰'), - (0x2F836, 'M', '及'), - (0x2F837, 'M', '叟'), - (0x2F838, 'M', '𠭣'), - (0x2F839, 'M', '叫'), - (0x2F83A, 'M', '叱'), - (0x2F83B, 'M', '吆'), - (0x2F83C, 'M', '咞'), - (0x2F83D, 'M', '吸'), - (0x2F83E, 'M', '呈'), - ] - -def _seg_77() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x2F83F, 'M', '周'), - (0x2F840, 'M', '咢'), - (0x2F841, 'M', '哶'), - (0x2F842, 'M', '唐'), - (0x2F843, 'M', '啓'), - (0x2F844, 'M', '啣'), - (0x2F845, 'M', '善'), - (0x2F847, 'M', '喙'), - (0x2F848, 'M', '喫'), - (0x2F849, 'M', '喳'), - (0x2F84A, 'M', '嗂'), - (0x2F84B, 'M', '圖'), - (0x2F84C, 'M', '嘆'), - (0x2F84D, 'M', '圗'), - (0x2F84E, 'M', '噑'), - (0x2F84F, 'M', '噴'), - (0x2F850, 'M', '切'), - (0x2F851, 'M', '壮'), - (0x2F852, 'M', '城'), - (0x2F853, 'M', '埴'), - (0x2F854, 'M', '堍'), - (0x2F855, 'M', '型'), - (0x2F856, 'M', '堲'), - (0x2F857, 'M', '報'), - (0x2F858, 'M', '墬'), - (0x2F859, 'M', '𡓤'), - (0x2F85A, 'M', '売'), - (0x2F85B, 'M', '壷'), - (0x2F85C, 'M', '夆'), - (0x2F85D, 'M', '多'), - (0x2F85E, 'M', '夢'), - (0x2F85F, 'M', '奢'), - (0x2F860, 'M', '𡚨'), - (0x2F861, 'M', '𡛪'), - (0x2F862, 'M', '姬'), - (0x2F863, 'M', '娛'), - (0x2F864, 'M', '娧'), - (0x2F865, 'M', '姘'), - (0x2F866, 'M', '婦'), - (0x2F867, 'M', '㛮'), - (0x2F868, 'X'), - (0x2F869, 'M', '嬈'), - (0x2F86A, 'M', '嬾'), - (0x2F86C, 'M', '𡧈'), - (0x2F86D, 'M', '寃'), - (0x2F86E, 'M', '寘'), - (0x2F86F, 'M', '寧'), - (0x2F870, 'M', '寳'), - (0x2F871, 'M', '𡬘'), - (0x2F872, 'M', '寿'), - (0x2F873, 'M', '将'), - (0x2F874, 'X'), - (0x2F875, 'M', '尢'), - (0x2F876, 'M', '㞁'), - (0x2F877, 'M', '屠'), - (0x2F878, 'M', '屮'), - (0x2F879, 'M', '峀'), - (0x2F87A, 'M', '岍'), - (0x2F87B, 'M', '𡷤'), - (0x2F87C, 'M', '嵃'), - (0x2F87D, 'M', '𡷦'), - (0x2F87E, 'M', '嵮'), - (0x2F87F, 'M', '嵫'), - (0x2F880, 'M', '嵼'), - (0x2F881, 'M', '巡'), - (0x2F882, 'M', '巢'), - (0x2F883, 'M', '㠯'), - (0x2F884, 'M', '巽'), - (0x2F885, 'M', '帨'), - (0x2F886, 'M', '帽'), - (0x2F887, 'M', '幩'), - (0x2F888, 'M', '㡢'), - (0x2F889, 'M', '𢆃'), - (0x2F88A, 'M', '㡼'), - (0x2F88B, 'M', '庰'), - (0x2F88C, 'M', '庳'), - (0x2F88D, 'M', '庶'), - (0x2F88E, 'M', '廊'), - (0x2F88F, 'M', '𪎒'), - (0x2F890, 'M', '廾'), - (0x2F891, 'M', '𢌱'), - (0x2F893, 'M', '舁'), - (0x2F894, 'M', '弢'), - (0x2F896, 'M', '㣇'), - (0x2F897, 'M', '𣊸'), - (0x2F898, 'M', '𦇚'), - (0x2F899, 'M', '形'), - (0x2F89A, 'M', '彫'), - (0x2F89B, 'M', '㣣'), - (0x2F89C, 'M', '徚'), - (0x2F89D, 'M', '忍'), - (0x2F89E, 'M', '志'), - (0x2F89F, 'M', '忹'), - (0x2F8A0, 'M', '悁'), - (0x2F8A1, 'M', '㤺'), - (0x2F8A2, 'M', '㤜'), - (0x2F8A3, 'M', '悔'), - (0x2F8A4, 'M', '𢛔'), - (0x2F8A5, 'M', '惇'), - (0x2F8A6, 'M', '慈'), - ] - -def _seg_78() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x2F8A7, 'M', '慌'), - (0x2F8A8, 'M', '慎'), - (0x2F8A9, 'M', '慌'), - (0x2F8AA, 'M', '慺'), - (0x2F8AB, 'M', '憎'), - (0x2F8AC, 'M', '憲'), - (0x2F8AD, 'M', '憤'), - (0x2F8AE, 'M', '憯'), - (0x2F8AF, 'M', '懞'), - (0x2F8B0, 'M', '懲'), - (0x2F8B1, 'M', '懶'), - (0x2F8B2, 'M', '成'), - (0x2F8B3, 'M', '戛'), - (0x2F8B4, 'M', '扝'), - (0x2F8B5, 'M', '抱'), - (0x2F8B6, 'M', '拔'), - (0x2F8B7, 'M', '捐'), - (0x2F8B8, 'M', '𢬌'), - (0x2F8B9, 'M', '挽'), - (0x2F8BA, 'M', '拼'), - (0x2F8BB, 'M', '捨'), - (0x2F8BC, 'M', '掃'), - (0x2F8BD, 'M', '揤'), - (0x2F8BE, 'M', '𢯱'), - (0x2F8BF, 'M', '搢'), - (0x2F8C0, 'M', '揅'), - (0x2F8C1, 'M', '掩'), - (0x2F8C2, 'M', '㨮'), - (0x2F8C3, 'M', '摩'), - (0x2F8C4, 'M', '摾'), - (0x2F8C5, 'M', '撝'), - (0x2F8C6, 'M', '摷'), - (0x2F8C7, 'M', '㩬'), - (0x2F8C8, 'M', '敏'), - (0x2F8C9, 'M', '敬'), - (0x2F8CA, 'M', '𣀊'), - (0x2F8CB, 'M', '旣'), - (0x2F8CC, 'M', '書'), - (0x2F8CD, 'M', '晉'), - (0x2F8CE, 'M', '㬙'), - (0x2F8CF, 'M', '暑'), - (0x2F8D0, 'M', '㬈'), - (0x2F8D1, 'M', '㫤'), - (0x2F8D2, 'M', '冒'), - (0x2F8D3, 'M', '冕'), - (0x2F8D4, 'M', '最'), - (0x2F8D5, 'M', '暜'), - (0x2F8D6, 'M', '肭'), - (0x2F8D7, 'M', '䏙'), - (0x2F8D8, 'M', '朗'), - (0x2F8D9, 'M', '望'), - (0x2F8DA, 'M', '朡'), - (0x2F8DB, 'M', '杞'), - (0x2F8DC, 'M', '杓'), - (0x2F8DD, 'M', '𣏃'), - (0x2F8DE, 'M', '㭉'), - (0x2F8DF, 'M', '柺'), - (0x2F8E0, 'M', '枅'), - (0x2F8E1, 'M', '桒'), - (0x2F8E2, 'M', '梅'), - (0x2F8E3, 'M', '𣑭'), - (0x2F8E4, 'M', '梎'), - (0x2F8E5, 'M', '栟'), - (0x2F8E6, 'M', '椔'), - (0x2F8E7, 'M', '㮝'), - (0x2F8E8, 'M', '楂'), - (0x2F8E9, 'M', '榣'), - (0x2F8EA, 'M', '槪'), - (0x2F8EB, 'M', '檨'), - (0x2F8EC, 'M', '𣚣'), - (0x2F8ED, 'M', '櫛'), - (0x2F8EE, 'M', '㰘'), - (0x2F8EF, 'M', '次'), - (0x2F8F0, 'M', '𣢧'), - (0x2F8F1, 'M', '歔'), - (0x2F8F2, 'M', '㱎'), - (0x2F8F3, 'M', '歲'), - (0x2F8F4, 'M', '殟'), - (0x2F8F5, 'M', '殺'), - (0x2F8F6, 'M', '殻'), - (0x2F8F7, 'M', '𣪍'), - (0x2F8F8, 'M', '𡴋'), - (0x2F8F9, 'M', '𣫺'), - (0x2F8FA, 'M', '汎'), - (0x2F8FB, 'M', '𣲼'), - (0x2F8FC, 'M', '沿'), - (0x2F8FD, 'M', '泍'), - (0x2F8FE, 'M', '汧'), - (0x2F8FF, 'M', '洖'), - (0x2F900, 'M', '派'), - (0x2F901, 'M', '海'), - (0x2F902, 'M', '流'), - (0x2F903, 'M', '浩'), - (0x2F904, 'M', '浸'), - (0x2F905, 'M', '涅'), - (0x2F906, 'M', '𣴞'), - (0x2F907, 'M', '洴'), - (0x2F908, 'M', '港'), - (0x2F909, 'M', '湮'), - (0x2F90A, 'M', '㴳'), - ] - -def _seg_79() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x2F90B, 'M', '滋'), - (0x2F90C, 'M', '滇'), - (0x2F90D, 'M', '𣻑'), - (0x2F90E, 'M', '淹'), - (0x2F90F, 'M', '潮'), - (0x2F910, 'M', '𣽞'), - (0x2F911, 'M', '𣾎'), - (0x2F912, 'M', '濆'), - (0x2F913, 'M', '瀹'), - (0x2F914, 'M', '瀞'), - (0x2F915, 'M', '瀛'), - (0x2F916, 'M', '㶖'), - (0x2F917, 'M', '灊'), - (0x2F918, 'M', '災'), - (0x2F919, 'M', '灷'), - (0x2F91A, 'M', '炭'), - (0x2F91B, 'M', '𠔥'), - (0x2F91C, 'M', '煅'), - (0x2F91D, 'M', '𤉣'), - (0x2F91E, 'M', '熜'), - (0x2F91F, 'X'), - (0x2F920, 'M', '爨'), - (0x2F921, 'M', '爵'), - (0x2F922, 'M', '牐'), - (0x2F923, 'M', '𤘈'), - (0x2F924, 'M', '犀'), - (0x2F925, 'M', '犕'), - (0x2F926, 'M', '𤜵'), - (0x2F927, 'M', '𤠔'), - (0x2F928, 'M', '獺'), - (0x2F929, 'M', '王'), - (0x2F92A, 'M', '㺬'), - (0x2F92B, 'M', '玥'), - (0x2F92C, 'M', '㺸'), - (0x2F92E, 'M', '瑇'), - (0x2F92F, 'M', '瑜'), - (0x2F930, 'M', '瑱'), - (0x2F931, 'M', '璅'), - (0x2F932, 'M', '瓊'), - (0x2F933, 'M', '㼛'), - (0x2F934, 'M', '甤'), - (0x2F935, 'M', '𤰶'), - (0x2F936, 'M', '甾'), - (0x2F937, 'M', '𤲒'), - (0x2F938, 'M', '異'), - (0x2F939, 'M', '𢆟'), - (0x2F93A, 'M', '瘐'), - (0x2F93B, 'M', '𤾡'), - (0x2F93C, 'M', '𤾸'), - (0x2F93D, 'M', '𥁄'), - (0x2F93E, 'M', '㿼'), - (0x2F93F, 'M', '䀈'), - (0x2F940, 'M', '直'), - (0x2F941, 'M', '𥃳'), - (0x2F942, 'M', '𥃲'), - (0x2F943, 'M', '𥄙'), - (0x2F944, 'M', '𥄳'), - (0x2F945, 'M', '眞'), - (0x2F946, 'M', '真'), - (0x2F948, 'M', '睊'), - (0x2F949, 'M', '䀹'), - (0x2F94A, 'M', '瞋'), - (0x2F94B, 'M', '䁆'), - (0x2F94C, 'M', '䂖'), - (0x2F94D, 'M', '𥐝'), - (0x2F94E, 'M', '硎'), - (0x2F94F, 'M', '碌'), - (0x2F950, 'M', '磌'), - (0x2F951, 'M', '䃣'), - (0x2F952, 'M', '𥘦'), - (0x2F953, 'M', '祖'), - (0x2F954, 'M', '𥚚'), - (0x2F955, 'M', '𥛅'), - (0x2F956, 'M', '福'), - (0x2F957, 'M', '秫'), - (0x2F958, 'M', '䄯'), - (0x2F959, 'M', '穀'), - (0x2F95A, 'M', '穊'), - (0x2F95B, 'M', '穏'), - (0x2F95C, 'M', '𥥼'), - (0x2F95D, 'M', '𥪧'), - (0x2F95F, 'X'), - (0x2F960, 'M', '䈂'), - (0x2F961, 'M', '𥮫'), - (0x2F962, 'M', '篆'), - (0x2F963, 'M', '築'), - (0x2F964, 'M', '䈧'), - (0x2F965, 'M', '𥲀'), - (0x2F966, 'M', '糒'), - (0x2F967, 'M', '䊠'), - (0x2F968, 'M', '糨'), - (0x2F969, 'M', '糣'), - (0x2F96A, 'M', '紀'), - (0x2F96B, 'M', '𥾆'), - (0x2F96C, 'M', '絣'), - (0x2F96D, 'M', '䌁'), - (0x2F96E, 'M', '緇'), - (0x2F96F, 'M', '縂'), - (0x2F970, 'M', '繅'), - (0x2F971, 'M', '䌴'), - ] - -def _seg_80() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x2F972, 'M', '𦈨'), - (0x2F973, 'M', '𦉇'), - (0x2F974, 'M', '䍙'), - (0x2F975, 'M', '𦋙'), - (0x2F976, 'M', '罺'), - (0x2F977, 'M', '𦌾'), - (0x2F978, 'M', '羕'), - (0x2F979, 'M', '翺'), - (0x2F97A, 'M', '者'), - (0x2F97B, 'M', '𦓚'), - (0x2F97C, 'M', '𦔣'), - (0x2F97D, 'M', '聠'), - (0x2F97E, 'M', '𦖨'), - (0x2F97F, 'M', '聰'), - (0x2F980, 'M', '𣍟'), - (0x2F981, 'M', '䏕'), - (0x2F982, 'M', '育'), - (0x2F983, 'M', '脃'), - (0x2F984, 'M', '䐋'), - (0x2F985, 'M', '脾'), - (0x2F986, 'M', '媵'), - (0x2F987, 'M', '𦞧'), - (0x2F988, 'M', '𦞵'), - (0x2F989, 'M', '𣎓'), - (0x2F98A, 'M', '𣎜'), - (0x2F98B, 'M', '舁'), - (0x2F98C, 'M', '舄'), - (0x2F98D, 'M', '辞'), - (0x2F98E, 'M', '䑫'), - (0x2F98F, 'M', '芑'), - (0x2F990, 'M', '芋'), - (0x2F991, 'M', '芝'), - (0x2F992, 'M', '劳'), - (0x2F993, 'M', '花'), - (0x2F994, 'M', '芳'), - (0x2F995, 'M', '芽'), - (0x2F996, 'M', '苦'), - (0x2F997, 'M', '𦬼'), - (0x2F998, 'M', '若'), - (0x2F999, 'M', '茝'), - (0x2F99A, 'M', '荣'), - (0x2F99B, 'M', '莭'), - (0x2F99C, 'M', '茣'), - (0x2F99D, 'M', '莽'), - (0x2F99E, 'M', '菧'), - (0x2F99F, 'M', '著'), - (0x2F9A0, 'M', '荓'), - (0x2F9A1, 'M', '菊'), - (0x2F9A2, 'M', '菌'), - (0x2F9A3, 'M', '菜'), - (0x2F9A4, 'M', '𦰶'), - (0x2F9A5, 'M', '𦵫'), - (0x2F9A6, 'M', '𦳕'), - (0x2F9A7, 'M', '䔫'), - (0x2F9A8, 'M', '蓱'), - (0x2F9A9, 'M', '蓳'), - (0x2F9AA, 'M', '蔖'), - (0x2F9AB, 'M', '𧏊'), - (0x2F9AC, 'M', '蕤'), - (0x2F9AD, 'M', '𦼬'), - (0x2F9AE, 'M', '䕝'), - (0x2F9AF, 'M', '䕡'), - (0x2F9B0, 'M', '𦾱'), - (0x2F9B1, 'M', '𧃒'), - (0x2F9B2, 'M', '䕫'), - (0x2F9B3, 'M', '虐'), - (0x2F9B4, 'M', '虜'), - (0x2F9B5, 'M', '虧'), - (0x2F9B6, 'M', '虩'), - (0x2F9B7, 'M', '蚩'), - (0x2F9B8, 'M', '蚈'), - (0x2F9B9, 'M', '蜎'), - (0x2F9BA, 'M', '蛢'), - (0x2F9BB, 'M', '蝹'), - (0x2F9BC, 'M', '蜨'), - (0x2F9BD, 'M', '蝫'), - (0x2F9BE, 'M', '螆'), - (0x2F9BF, 'X'), - (0x2F9C0, 'M', '蟡'), - (0x2F9C1, 'M', '蠁'), - (0x2F9C2, 'M', '䗹'), - (0x2F9C3, 'M', '衠'), - (0x2F9C4, 'M', '衣'), - (0x2F9C5, 'M', '𧙧'), - (0x2F9C6, 'M', '裗'), - (0x2F9C7, 'M', '裞'), - (0x2F9C8, 'M', '䘵'), - (0x2F9C9, 'M', '裺'), - (0x2F9CA, 'M', '㒻'), - (0x2F9CB, 'M', '𧢮'), - (0x2F9CC, 'M', '𧥦'), - (0x2F9CD, 'M', '䚾'), - (0x2F9CE, 'M', '䛇'), - (0x2F9CF, 'M', '誠'), - (0x2F9D0, 'M', '諭'), - (0x2F9D1, 'M', '變'), - (0x2F9D2, 'M', '豕'), - (0x2F9D3, 'M', '𧲨'), - (0x2F9D4, 'M', '貫'), - (0x2F9D5, 'M', '賁'), - ] - -def _seg_81() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x2F9D6, 'M', '贛'), - (0x2F9D7, 'M', '起'), - (0x2F9D8, 'M', '𧼯'), - (0x2F9D9, 'M', '𠠄'), - (0x2F9DA, 'M', '跋'), - (0x2F9DB, 'M', '趼'), - (0x2F9DC, 'M', '跰'), - (0x2F9DD, 'M', '𠣞'), - (0x2F9DE, 'M', '軔'), - (0x2F9DF, 'M', '輸'), - (0x2F9E0, 'M', '𨗒'), - (0x2F9E1, 'M', '𨗭'), - (0x2F9E2, 'M', '邔'), - (0x2F9E3, 'M', '郱'), - (0x2F9E4, 'M', '鄑'), - (0x2F9E5, 'M', '𨜮'), - (0x2F9E6, 'M', '鄛'), - (0x2F9E7, 'M', '鈸'), - (0x2F9E8, 'M', '鋗'), - (0x2F9E9, 'M', '鋘'), - (0x2F9EA, 'M', '鉼'), - (0x2F9EB, 'M', '鏹'), - (0x2F9EC, 'M', '鐕'), - (0x2F9ED, 'M', '𨯺'), - (0x2F9EE, 'M', '開'), - (0x2F9EF, 'M', '䦕'), - (0x2F9F0, 'M', '閷'), - (0x2F9F1, 'M', '𨵷'), - (0x2F9F2, 'M', '䧦'), - (0x2F9F3, 'M', '雃'), - (0x2F9F4, 'M', '嶲'), - (0x2F9F5, 'M', '霣'), - (0x2F9F6, 'M', '𩅅'), - (0x2F9F7, 'M', '𩈚'), - (0x2F9F8, 'M', '䩮'), - (0x2F9F9, 'M', '䩶'), - (0x2F9FA, 'M', '韠'), - (0x2F9FB, 'M', '𩐊'), - (0x2F9FC, 'M', '䪲'), - (0x2F9FD, 'M', '𩒖'), - (0x2F9FE, 'M', '頋'), - (0x2FA00, 'M', '頩'), - (0x2FA01, 'M', '𩖶'), - (0x2FA02, 'M', '飢'), - (0x2FA03, 'M', '䬳'), - (0x2FA04, 'M', '餩'), - (0x2FA05, 'M', '馧'), - (0x2FA06, 'M', '駂'), - (0x2FA07, 'M', '駾'), - (0x2FA08, 'M', '䯎'), - (0x2FA09, 'M', '𩬰'), - (0x2FA0A, 'M', '鬒'), - (0x2FA0B, 'M', '鱀'), - (0x2FA0C, 'M', '鳽'), - (0x2FA0D, 'M', '䳎'), - (0x2FA0E, 'M', '䳭'), - (0x2FA0F, 'M', '鵧'), - (0x2FA10, 'M', '𪃎'), - (0x2FA11, 'M', '䳸'), - (0x2FA12, 'M', '𪄅'), - (0x2FA13, 'M', '𪈎'), - (0x2FA14, 'M', '𪊑'), - (0x2FA15, 'M', '麻'), - (0x2FA16, 'M', '䵖'), - (0x2FA17, 'M', '黹'), - (0x2FA18, 'M', '黾'), - (0x2FA19, 'M', '鼅'), - (0x2FA1A, 'M', '鼏'), - (0x2FA1B, 'M', '鼖'), - (0x2FA1C, 'M', '鼻'), - (0x2FA1D, 'M', '𪘀'), - (0x2FA1E, 'X'), - (0x30000, 'V'), - (0x3134B, 'X'), - (0x31350, 'V'), - (0x323B0, 'X'), - (0xE0100, 'I'), - (0xE01F0, 'X'), - ] - -uts46data = tuple( - _seg_0() - + _seg_1() - + _seg_2() - + _seg_3() - + _seg_4() - + _seg_5() - + _seg_6() - + _seg_7() - + _seg_8() - + _seg_9() - + _seg_10() - + _seg_11() - + _seg_12() - + _seg_13() - + _seg_14() - + _seg_15() - + _seg_16() - + _seg_17() - + _seg_18() - + _seg_19() - + _seg_20() - + _seg_21() - + _seg_22() - + _seg_23() - + _seg_24() - + _seg_25() - + _seg_26() - + _seg_27() - + _seg_28() - + _seg_29() - + _seg_30() - + _seg_31() - + _seg_32() - + _seg_33() - + _seg_34() - + _seg_35() - + _seg_36() - + _seg_37() - + _seg_38() - + _seg_39() - + _seg_40() - + _seg_41() - + _seg_42() - + _seg_43() - + _seg_44() - + _seg_45() - + _seg_46() - + _seg_47() - + _seg_48() - + _seg_49() - + _seg_50() - + _seg_51() - + _seg_52() - + _seg_53() - + _seg_54() - + _seg_55() - + _seg_56() - + _seg_57() - + _seg_58() - + _seg_59() - + _seg_60() - + _seg_61() - + _seg_62() - + _seg_63() - + _seg_64() - + _seg_65() - + _seg_66() - + _seg_67() - + _seg_68() - + _seg_69() - + _seg_70() - + _seg_71() - + _seg_72() - + _seg_73() - + _seg_74() - + _seg_75() - + _seg_76() - + _seg_77() - + _seg_78() - + _seg_79() - + _seg_80() - + _seg_81() -) # type: Tuple[Union[Tuple[int, str], Tuple[int, str, str]], ...] diff --git a/spaces/declare-lab/tango/diffusers/src/diffusers/pipelines/versatile_diffusion/__init__.py b/spaces/declare-lab/tango/diffusers/src/diffusers/pipelines/versatile_diffusion/__init__.py deleted file mode 100644 index abf9dcff59dbc922dcc7063a1e73560679a23696..0000000000000000000000000000000000000000 --- a/spaces/declare-lab/tango/diffusers/src/diffusers/pipelines/versatile_diffusion/__init__.py +++ /dev/null @@ -1,24 +0,0 @@ -from ...utils import ( - OptionalDependencyNotAvailable, - is_torch_available, - is_transformers_available, - is_transformers_version, -) - - -try: - if not (is_transformers_available() and is_torch_available() and is_transformers_version(">=", "4.25.0")): - raise OptionalDependencyNotAvailable() -except OptionalDependencyNotAvailable: - from ...utils.dummy_torch_and_transformers_objects import ( - VersatileDiffusionDualGuidedPipeline, - VersatileDiffusionImageVariationPipeline, - VersatileDiffusionPipeline, - VersatileDiffusionTextToImagePipeline, - ) -else: - from .modeling_text_unet import UNetFlatConditionModel - from .pipeline_versatile_diffusion import VersatileDiffusionPipeline - from .pipeline_versatile_diffusion_dual_guided import VersatileDiffusionDualGuidedPipeline - from .pipeline_versatile_diffusion_image_variation import VersatileDiffusionImageVariationPipeline - from .pipeline_versatile_diffusion_text_to_image import VersatileDiffusionTextToImagePipeline diff --git a/spaces/declare-lab/tango/diffusers/src/diffusers/schedulers/README.md b/spaces/declare-lab/tango/diffusers/src/diffusers/schedulers/README.md deleted file mode 100644 index 31ad27793e34783faabc222adf98691fb396a0d8..0000000000000000000000000000000000000000 --- a/spaces/declare-lab/tango/diffusers/src/diffusers/schedulers/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# Schedulers - -For more information on the schedulers, please refer to the [docs](https://huggingface.co/docs/diffusers/api/schedulers/overview). \ No newline at end of file diff --git a/spaces/deepskyreal/ai-mixer-hotchpotch/sad_talker/src/face3d/models/arcface_torch/configs/ms1mv3_r2060.py b/spaces/deepskyreal/ai-mixer-hotchpotch/sad_talker/src/face3d/models/arcface_torch/configs/ms1mv3_r2060.py deleted file mode 100644 index 23ad81e082c4b6390b67b164d0ceb84bb0635684..0000000000000000000000000000000000000000 --- a/spaces/deepskyreal/ai-mixer-hotchpotch/sad_talker/src/face3d/models/arcface_torch/configs/ms1mv3_r2060.py +++ /dev/null @@ -1,26 +0,0 @@ -from easydict import EasyDict as edict - -# make training faster -# our RAM is 256G -# mount -t tmpfs -o size=140G tmpfs /train_tmp - -config = edict() -config.loss = "arcface" -config.network = "r2060" -config.resume = False -config.output = None -config.embedding_size = 512 -config.sample_rate = 1.0 -config.fp16 = True -config.momentum = 0.9 -config.weight_decay = 5e-4 -config.batch_size = 64 -config.lr = 0.1 # batch size is 512 - -config.rec = "/train_tmp/ms1m-retinaface-t1" -config.num_classes = 93431 -config.num_image = 5179510 -config.num_epoch = 25 -config.warmup_epoch = -1 -config.decay_epoch = [10, 16, 22] -config.val_targets = ["lfw", "cfp_fp", "agedb_30"] diff --git a/spaces/deepwisdom/MetaGPT/tests/metagpt/actions/test_write_docstring.py b/spaces/deepwisdom/MetaGPT/tests/metagpt/actions/test_write_docstring.py deleted file mode 100644 index 82d96e1a67f36254159c4fa4ca135a250088f3a9..0000000000000000000000000000000000000000 --- a/spaces/deepwisdom/MetaGPT/tests/metagpt/actions/test_write_docstring.py +++ /dev/null @@ -1,32 +0,0 @@ -import pytest - -from metagpt.actions.write_docstring import WriteDocstring - -code = ''' -def add_numbers(a: int, b: int): - return a + b - - -class Person: - def __init__(self, name: str, age: int): - self.name = name - self.age = age - - def greet(self): - return f"Hello, my name is {self.name} and I am {self.age} years old." -''' - - -@pytest.mark.asyncio -@pytest.mark.parametrize( - ("style", "part"), - [ - ("google", "Args:"), - ("numpy", "Parameters"), - ("sphinx", ":param name:"), - ], - ids=["google", "numpy", "sphinx"] -) -async def test_write_docstring(style: str, part: str): - ret = await WriteDocstring().run(code, style=style) - assert part in ret diff --git a/spaces/deepwisdom/MetaGPT/tests/metagpt/utils/__init__.py b/spaces/deepwisdom/MetaGPT/tests/metagpt/utils/__init__.py deleted file mode 100644 index 583942d31eee92261b22930fde15f8a151d49141..0000000000000000000000000000000000000000 --- a/spaces/deepwisdom/MetaGPT/tests/metagpt/utils/__init__.py +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -""" -@Time : 2023/4/29 16:01 -@Author : alexanderwu -@File : __init__.py -""" diff --git a/spaces/derek-thomas/dataset-creator-reddit-bestofredditorupdates/utilities/readme_update.py b/spaces/derek-thomas/dataset-creator-reddit-bestofredditorupdates/utilities/readme_update.py deleted file mode 100644 index 490c98248996fb585ca6ab46f798501cd973f612..0000000000000000000000000000000000000000 --- a/spaces/derek-thomas/dataset-creator-reddit-bestofredditorupdates/utilities/readme_update.py +++ /dev/null @@ -1,59 +0,0 @@ -import os -from datetime import datetime - -import pytz -from datasets.download.download_config import DownloadConfig -from datasets.utils.file_utils import cached_path -from datasets.utils.hub import hf_hub_url - -frequency = os.environ.get("FREQUENCY", '').lower() - - -def get_readme_path(dataset_name): - readme_path = hf_hub_url(dataset_name, "README.md") - return cached_path(readme_path, download_config=DownloadConfig()) - - -def update_readme(dataset_name, subreddit, latest_date, new_rows): - path = get_readme_path(dataset_name=dataset_name) - latest_hour = datetime.now(pytz.utc).replace(minute=0, second=0, microsecond=0) - latest_hour_str = latest_hour.strftime('%Y-%m-%d %H:00:00 %Z%z') - - readme_text = f""" -## Dataset Overview -The goal is to have an open dataset of [r/{subreddit}](https://www.reddit.com/r/{subreddit}/) submissions. Im leveraging PRAW and the reddit API to get downloads. - -There is a limit of 1000 in an API call and limited search functionality, so this is run {frequency} to get new submissions. - -## Creation Details -This dataset was created by [derek-thomas/dataset-creator-reddit-{subreddit}](https://huggingface.co/spaces/derek-thomas/dataset-creator-reddit-{subreddit}) - -## Update Frequency -The dataset is updated {frequency} with the most recent update being `{latest_hour_str}` where we added **{new_rows} new rows**. - -## Licensing -[Reddit Licensing terms](https://www.redditinc.com/policies/data-api-terms) as accessed on October 25: -> The Content created with or submitted to our Services by Users (“User Content”) is owned by Users and not by Reddit. Subject to your complete and ongoing compliance with the Data API Terms, Reddit grants you a non-exclusive, non-transferable, non-sublicensable, and revocable license to copy and display the User Content using the Data API solely as necessary to develop, deploy, distribute, and run your App to your App Users. You may not modify the User Content except to format it for such display. You will comply with any requirements or restrictions imposed on usage of User Content by their respective owners, which may include "all rights reserved" notices, Creative Commons licenses, or other terms and conditions that may be agreed upon between you and the owners. Except as expressly permitted by this section, no other rights or licenses are granted or implied, including any right to use User Content for other purposes, such as for training a machine learning or AI model, without the express permission of rightsholders in the applicable User Content - -My take is that you can't use this data for *training* without getting permission. - -## Opt-out -To opt-out of this dataset please make a request in the community tab -""" - - append_readme(path=path, readme_text=readme_text) - - -def append_readme(path, readme_text): - generated_below_marker = "--- Generated Part of README Below ---" - with open(path, "r") as file: - content = file.read() - - if generated_below_marker in content: - index = content.index(generated_below_marker) + len(generated_below_marker) - content = content[:index] + "\n\n" + readme_text - else: - content += "\n\n" + generated_below_marker + "\n\n" + readme_text + "\n" - - with open(path, "w") as file: - file.write(content) diff --git a/spaces/diacanFperku/AutoGPT/Forsk Atoll 2.8.0 Crack [UPDATED].md b/spaces/diacanFperku/AutoGPT/Forsk Atoll 2.8.0 Crack [UPDATED].md deleted file mode 100644 index d19415eda47d9fac3b2650472203b34290a17dab..0000000000000000000000000000000000000000 --- a/spaces/diacanFperku/AutoGPT/Forsk Atoll 2.8.0 Crack [UPDATED].md +++ /dev/null @@ -1,10 +0,0 @@ -

      Forsk Atoll 2.8.0 Crack


      Downloadhttps://gohhs.com/2uFSUV



      -
      -sk atoll 2.8.0 is a new, improved, modern and powerful control module for borehole pumps. -The device provides control of pressure and temperature in the water supply system, as well as protection against dry running and improper operation of the pump. -Main characteristics -The pressure control device is designed to control the pressure in the water supply. -The device allows you to maintain a constant water pressure in automatic mode, as well as adjust it if necessary. 8a78ff9644
      -
      -
      -

      diff --git a/spaces/diacanFperku/AutoGPT/Jasc Paint Shop Pro 704 And Animation Shop 304Portable 16 WORK.md b/spaces/diacanFperku/AutoGPT/Jasc Paint Shop Pro 704 And Animation Shop 304Portable 16 WORK.md deleted file mode 100644 index 2520ad6179a63eb235112fb13b5cfd3f2f3ad7d7..0000000000000000000000000000000000000000 --- a/spaces/diacanFperku/AutoGPT/Jasc Paint Shop Pro 704 And Animation Shop 304Portable 16 WORK.md +++ /dev/null @@ -1,6 +0,0 @@ -
      -

      Output keygen for paint shop pro 7.04 or any other ai, ps3, ps4, dota 2, wow, chess, ai, and all other ai you might need for the game. there is no software keygen for you to download, no cracked software, and no hack tool. i just made a little ai.

      -

      https://coub.com/stories/3121951-jasc-paint-shop-pro-704-and-animation-shop-304portable-16-paljam https://coub.com/stories/3129165-dvd-moviefactory-pro-7-top-keygen-crack-. /3121951-jasc-paint-shop-pro-704-and-animation-shop-304portable-16-paljam https://maps.google.co.zm/urlsa=t&url=Jasc Paint Shop Pro 704 And Animation Shop 304Portable 16 bd86983c93 raizbi. https://coub.com/stories/3129165-dvd-moviefactory-pro-7-top-keygen-crack-. /3121951-jasc-paint-shop-pro-704-and-animation-shop-304portable-16-paljam https://maps.google.co.zm/urlsa=t&url=Jasc Paint Shop Pro 704 And Animation Shop 304Portable 16 bd86983c93 raizbi. https://coub.com/stories/3129165-dvd-moviefactory-pro-7-top-keygen-crack-. /3121951-jasc-paint-shop-pro-704-and-animation-shop-304portable-16-paljam https://maps.google.co.zm/urlsa=t&url=Jasc Paint Shop Pro 704 And Animation Shop 304Portable 16 bd86983c93 raizbi. https://coub.com/stories/3129165-dvd-moviefactory-pro-7-top-keygen-crack-. /3121951-jasc-paint-shop-pro-704-and-animation-shop-304portable-16-paljam https://maps.google.co.zm/urlsa=t&url=Jasc Paint Shop Pro 704 And Animation Shop 304Portable 16 bd86983c93 raizbi. https://coub.com/stories/3129165-dvd-moviefactory-pro-7-top-keygen-crack-. /3121951-jasc-paint-shop-pro-704-and-animation-shop-304portable-16-paljam https://coub.com/stories/3121951-jasc-paint-shop-pro-704-and-animation-shop-304portable-16-paljam

      -

      Jasc Paint Shop Pro 704 And Animation Shop 304Portable 16


      Download »»» https://gohhs.com/2uFUXP



      899543212b
      -
      -
      \ No newline at end of file diff --git a/spaces/diacanFperku/AutoGPT/Mark Studio 2 Crack 3instmank.md b/spaces/diacanFperku/AutoGPT/Mark Studio 2 Crack 3instmank.md deleted file mode 100644 index 293c3107667528c5bcd238644686203c97ac4fc7..0000000000000000000000000000000000000000 --- a/spaces/diacanFperku/AutoGPT/Mark Studio 2 Crack 3instmank.md +++ /dev/null @@ -1,120 +0,0 @@ -
      -

      Mark Studio 2 Crack 3instmank: How to Get the Best Bass Amp Emulation for Your Computer

      - -

      If you are looking for a way to get the amazing sound of Markbass amplifiers and cabinets on your computer, you might be interested in Mark Studio 2 Crack 3instmank. This is a software plugin that emulates six Markbass heads, nine Markbass cabinets and a pedalboard, giving you access to a wide range of tones and effects. You can use Mark Studio 2 Crack 3instmank as a standalone program or as a VST plugin in your favorite DAW.

      - -

      What is Mark Studio 2 Crack 3instmank?

      - -

      Mark Studio 2 Crack 3instmank is a cracked version of Mark Studio 2, a bass amp emulation software developed by Overloud. Mark Studio 2 is based on the real models of Markbass amplifiers and cabinets, which are known for their high-quality sound and versatility. Markbass is one of the leading brands in the bass amp market, used by many professional bassists around the world.

      -

      Mark Studio 2 Crack 3instmank


      Download Filehttps://gohhs.com/2uFU85



      - -

      Mark Studio 2 Crack 3instmank allows you to download and install the full version of Mark Studio 2 without paying for it. You can also bypass the activation code and use the software without any limitations. However, using Mark Studio 2 Crack 3instmank is illegal and risky, as it may contain viruses, malware or spyware that can harm your computer or compromise your personal data. Moreover, you will not get any updates or support from Overloud if you use Mark Studio 2 Crack 3instmank.

      - -

      What are the features of Mark Studio 2?

      - -

      Mark Studio 2 is a powerful and flexible bass amp emulation software that offers you many features to shape your sound and enhance your recordings. Some of the main features are:

      - -
        -
      • Six top-class Markbass amp models: TA501, R500, Classic 300, TTE500, Little Mark Tube and MoMark.
      • -
      • Nine Markbass cabinets: STD 151HR (rear-ported 1x15"), STD 152HR (rear-ported 2x15"), STD 104HR (rear-ported 1x15"), STD 104HF (front-ported 4x10"), STD 106HF (front-ported 6x10"), Classic 108 (sealed 8x10"), Traveler 121H (front-ported 1x12"), New York 804 (front-ported 4") and New York 122 (front-ported 2x12").
      • -
      • Full pedalboard including: octave, envelope filter, bass chorus, distortion and compressor.
      • -
      • Choice of six microphones, plus a preset combination of two front microphones.
      • -
      • Ultra-flexible signal path that makes it easy to balance the Direct (plugin) input, Line Out (amp direct Out) and Mic Output levels.
      • -
      • Ultra Bass frequency control that adds extra-deep sound with one mouse click.
      • -
      • Tons of factory presets designed by top engineers and Markbass artists.
      • -
      • Full MIDI support.
      • -
      • Very low CPU usage.
      • -
      • No additional latency.
      • -
      • Any parameter can be automated in the plugin version.
      • -
      - -

      How to use Mark Studio 2?

      - -

      To use Mark Studio 2, you need to have a computer that meets the minimum system requirements:

      - -
        -
      • Windows XP / Vista / Windows7 / Windows8 / Windows10
      • -
      • Pentium IV or Athlon processor with at least 1.5 GHz
      • -
      • 512 MB RAM
      • -
      • Screen resolution: at least 1024 x768
      • -
      • VST or RTAS host application
      • -
      - -

      You also need to have an audio interface that supports ASIO drivers or CoreAudio drivers.

      - -

      To install Mark Studio 2, you need to download the installer from Overloud's website and follow the instructions. You will also need to enter your activation code that you received when you purchased the software. If you use Mark Studio 2 Crack -3instmank, you can skip this step and run the software without activation.

      - -

      To use Mark Studio 2 as a standalone program, you need to launch it from your desktop or start menu. You can then select your audio device settings and start playing with the presets or creating your own sounds. You can also record your performance using -the built-in recorder or export it as a WAV file.

      - -

      To use Mark Studio 2 as a VST plugin, you need to launch your DAW and load Mark Studio 2 as an insert effect on your bass track. You can then adjust the input and output levels and tweak the parameters of the plugin. You can also automate any parameter using -your DAW's automation features.

      - -

      Why should you use Mark Studio 2?

      - -

      If you are a bass player who wants to get the best sound possible from your computer, you should consider using Mark Studio -2. This software will give you access to a wide range of tones and effects that will suit any genre or style of music. You can also experiment with different combinations of amps, cabinets and pedals to find your signature sound. Moreover, you can enhance -your recordings with realistic mic simulations and flexible signal routing options.

      -

      - -

      Mark Studio -2 is also very easy to use and intuitive. You can quickly browse through the presets or create your own sounds with simple mouse clicks. You can also save your settings as user presets for future use. The software has a very low CPU usage and no additional latency, -so you can enjoy a smooth and responsive playing experience.

      - -

      Mark Studio -2 is also very affordable compared to buying real Markbass amplifiers and cabinets. You can get all the benefits of these high-quality products without spending a fortune or carrying heavy equipment around. You can also update your software for free whenever -Overloud releases new versions or improvements.

      - -

      Conclusion

      - -

      In conclusion, Mark Studio -2 is a great bass amp emulation software that will help you get the best sound possible from your computer. It emulates six Markbass heads, nine Markbass cabinets and a pedalboard, giving you access to a wide range of tones and effects. It also offers realistic mic simulations, -flexible signal routing options, low CPU usage and no additional latency. It is easy to use and affordable compared to buying real Markbass products.

      - -

      If you want to try Mark Studio -2 for yourself, you can download a free trial version from Overloud's website. However, if you want to use the full version without any limitations or risks, you should buy it from Overloud's website or authorized dealers. Do not use Mark Studio -2 Crack -3instmank or any other cracked version of this software, as they are illegal and unsafe.

      -

      How to download and install Mark Studio 2 Crack 3instmank?

      - -

      If you want to download and install Mark Studio 2 Crack 3instmank, you need to follow these steps:

      - -
        -
      1. Go to one of the websites that offer Mark Studio 2 Crack 3instmank, such as 4download.net, crack4windows.com, reddit.com, trello.com or soundcloud.com.
      2. -
      3. Find the link that says "Download Mark Studio 2 Crack 3instmank" or something similar and click on it.
      4. -
      5. Wait for the download to finish and save the file on your computer.
      6. -
      7. Extract the file using a program like WinRAR or 7-Zip.
      8. -
      9. Run the installer and follow the instructions on the screen.
      10. -
      11. Launch Mark Studio 2 Crack 3instmank and enjoy using it.
      12. -
      - -

      However, we do not recommend you to download and install Mark Studio 2 Crack 3instmank, as it is illegal and unsafe. You may face legal consequences if you use pirated software, as well as expose your computer to viruses, malware or spyware that can damage your system or steal your personal information. Moreover, you will not get any updates or support from Overloud if you use Mark Studio 2 Crack -3instmank.

      - -

      What are the alternatives to Mark Studio 2 Crack 3instmank?

      - -

      If you are looking for a legal and safe way to get Mark Studio 2, you have two options:

      - -
        -
      • Buy Mark Studio 2 from Overloud's website or authorized dealers. This is the best option if you want to get the full version of Mark Studio 2 without any limitations or risks. You will also get free updates and support from Overloud, as well as access to other products and discounts. The price of Mark Studio 2 is $129, which is very reasonable compared to buying real Markbass amplifiers and cabinets.
      • -
      • Download a free trial version of Mark Studio 2 from Overloud's website. This is a good option if you want to try Mark Studio 2 before buying it. You can use the trial version for 14 days without any restrictions. You can also compare it with other bass amp emulation software and see which one suits your needs better. However, after the trial period expires, you will need to buy Mark Studio -2 or uninstall it from your computer.
      • -
      - -

      Conclusion

      - -

      In conclusion, Mark Studio -2 Crack -3instmank is a cracked version of Mark Studio -2, a bass amp emulation software that emulates six Markbass heads, nine Markbass cabinets and a pedalboard. It allows you to download and install the full version of Mark Studio -2 without paying for it or activating it. However, using Mark Studio -2 Crack -3instmank is illegal and risky, as it may contain viruses, malware or spyware that can harm your computer or compromise your personal data. Moreover, you will not get any updates or support from Overloud if you use Mark Studio -2 Crack -3instmank.

      - -

      If you want to use Mark Studio -2 legally and safely, you should buy it from Overloud's website or authorized dealers, or download a free trial version from Overloud's website. This way, you will get all the benefits of this high-quality bass amp emulation software without any limitations or risks. You will also support Overloud's work and help them create more amazing products for bass players.

      3cee63e6c2
      -
      -
      \ No newline at end of file diff --git a/spaces/diagaiwei/ir_chinese_medqa/colbert/infra/config/config.py b/spaces/diagaiwei/ir_chinese_medqa/colbert/infra/config/config.py deleted file mode 100644 index 61dab1d0ee4e66850b5834b7ed861b420168f1d3..0000000000000000000000000000000000000000 --- a/spaces/diagaiwei/ir_chinese_medqa/colbert/infra/config/config.py +++ /dev/null @@ -1,15 +0,0 @@ -from dataclasses import dataclass - -from .base_config import BaseConfig -from .settings import * - - -@dataclass -class RunConfig(BaseConfig, RunSettings): - pass - - -@dataclass -class ColBERTConfig(RunSettings, ResourceSettings, DocSettings, QuerySettings, TrainingSettings, - IndexingSettings, SearchSettings, BaseConfig): - pass diff --git a/spaces/digitalxingtong/Azuma-Bert-VITS2/text/symbols.py b/spaces/digitalxingtong/Azuma-Bert-VITS2/text/symbols.py deleted file mode 100644 index 9dfae4e633829f20c4fd767b1c7a9198911ed801..0000000000000000000000000000000000000000 --- a/spaces/digitalxingtong/Azuma-Bert-VITS2/text/symbols.py +++ /dev/null @@ -1,51 +0,0 @@ -punctuation = ['!', '?', '…', ",", ".", "'", '-'] -pu_symbols = punctuation + ["SP", "UNK"] -pad = '_' - -# chinese -zh_symbols = ['E', 'En', 'a', 'ai', 'an', 'ang', 'ao', 'b', 'c', 'ch', 'd', 'e', 'ei', 'en', 'eng', 'er', 'f', 'g', 'h', - 'i', 'i0', 'ia', 'ian', 'iang', 'iao', 'ie', 'in', 'ing', 'iong', 'ir', 'iu', 'j', 'k', 'l', 'm', 'n', 'o', - 'ong', - 'ou', 'p', 'q', 'r', 's', 'sh', 't', 'u', 'ua', 'uai', 'uan', 'uang', 'ui', 'un', 'uo', 'v', 'van', 've', 'vn', - 'w', 'x', 'y', 'z', 'zh', - "AA", "EE", "OO"] -num_zh_tones = 6 - -# japanese -ja_symbols = ['I', 'N', 'U', 'a', 'b', 'by', 'ch', 'cl', 'd', 'dy', 'e', 'f', 'g', 'gy', 'h', 'hy', 'i', 'j', 'k', 'ky', - 'm', 'my', 'n', 'ny', 'o', 'p', 'py', 'r', 'ry', 's', 'sh', 't', 'ts', 'u', 'V', 'w', 'y', 'z'] -num_ja_tones = 1 - -# English -en_symbols = ['aa', 'ae', 'ah', 'ao', 'aw', 'ay', 'b', 'ch', 'd', 'dh', 'eh', 'er', 'ey', 'f', 'g', 'hh', 'ih', 'iy', - 'jh', 'k', 'l', 'm', 'n', 'ng', 'ow', 'oy', 'p', 'r', 's', - 'sh', 't', 'th', 'uh', 'uw', 'V', 'w', 'y', 'z', 'zh'] -num_en_tones = 4 - -# combine all symbols -normal_symbols = sorted(set(zh_symbols + ja_symbols + en_symbols)) -symbols = [pad] + normal_symbols + pu_symbols -sil_phonemes_ids = [symbols.index(i) for i in pu_symbols] - -# combine all tones -num_tones = num_zh_tones + num_ja_tones + num_en_tones - -# language maps -language_id_map = { - 'ZH': 0, - "JA": 1, - "EN": 2 -} -num_languages = len(language_id_map.keys()) - -language_tone_start_map = { - 'ZH': 0, - "JA": num_zh_tones, - "EN": num_zh_tones + num_ja_tones -} - -if __name__ == '__main__': - a = set(zh_symbols) - b = set(en_symbols) - print(sorted(a&b)) - diff --git a/spaces/digitalxingtong/Eileen-Bert-Vits2/text/english_bert_mock.py b/spaces/digitalxingtong/Eileen-Bert-Vits2/text/english_bert_mock.py deleted file mode 100644 index 3b894ced5b6d619a18d6bdd7d7606ba9e6532050..0000000000000000000000000000000000000000 --- a/spaces/digitalxingtong/Eileen-Bert-Vits2/text/english_bert_mock.py +++ /dev/null @@ -1,5 +0,0 @@ -import torch - - -def get_bert_feature(norm_text, word2ph): - return torch.zeros(1024, sum(word2ph)) diff --git a/spaces/dimaseo/dalle-mini/html2canvas.js b/spaces/dimaseo/dalle-mini/html2canvas.js deleted file mode 100644 index dd1606d8698aae0ed4877058d6a218fda3a515cd..0000000000000000000000000000000000000000 --- a/spaces/dimaseo/dalle-mini/html2canvas.js +++ /dev/null @@ -1,7756 +0,0 @@ -/*! - * html2canvas 1.4.1 - * Copyright (c) 2022 Niklas von Hertzen - * Released under MIT License - */ -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : - typeof define === 'function' && define.amd ? define(factory) : - (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.html2canvas = factory()); -}(this, (function () { 'use strict'; - - /*! ***************************************************************************** - Copyright (c) Microsoft Corporation. - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH - REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, - INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM - LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - PERFORMANCE OF THIS SOFTWARE. - ***************************************************************************** */ - /* global Reflect, Promise */ - - var extendStatics = function(d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - - function __extends(d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - } - - var __assign = function() { - __assign = Object.assign || function __assign(t) { - for (var s, i = 1, n = arguments.length; i < n; i++) { - s = arguments[i]; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; - } - return t; - }; - return __assign.apply(this, arguments); - }; - - function __awaiter(thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); - } - - function __generator(thisArg, body) { - var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; - return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; - function verb(n) { return function (v) { return step([n, v]); }; } - function step(op) { - if (f) throw new TypeError("Generator is already executing."); - while (_) try { - if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; - if (y = 0, t) op = [op[0] & 2, t.value]; - switch (op[0]) { - case 0: case 1: t = op; break; - case 4: _.label++; return { value: op[1], done: false }; - case 5: _.label++; y = op[1]; op = [0]; continue; - case 7: op = _.ops.pop(); _.trys.pop(); continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } - if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } - if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } - if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } - if (t[2]) _.ops.pop(); - _.trys.pop(); continue; - } - op = body.call(thisArg, _); - } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } - if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; - } - } - - function __spreadArray(to, from, pack) { - if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { - if (ar || !(i in from)) { - if (!ar) ar = Array.prototype.slice.call(from, 0, i); - ar[i] = from[i]; - } - } - return to.concat(ar || from); - } - - var Bounds = /** @class */ (function () { - function Bounds(left, top, width, height) { - this.left = left; - this.top = top; - this.width = width; - this.height = height; - } - Bounds.prototype.add = function (x, y, w, h) { - return new Bounds(this.left + x, this.top + y, this.width + w, this.height + h); - }; - Bounds.fromClientRect = function (context, clientRect) { - return new Bounds(clientRect.left + context.windowBounds.left, clientRect.top + context.windowBounds.top, clientRect.width, clientRect.height); - }; - Bounds.fromDOMRectList = function (context, domRectList) { - var domRect = Array.from(domRectList).find(function (rect) { return rect.width !== 0; }); - return domRect - ? new Bounds(domRect.left + context.windowBounds.left, domRect.top + context.windowBounds.top, domRect.width, domRect.height) - : Bounds.EMPTY; - }; - Bounds.EMPTY = new Bounds(0, 0, 0, 0); - return Bounds; - }()); - var parseBounds = function (context, node) { - return Bounds.fromClientRect(context, node.getBoundingClientRect()); - }; - var parseDocumentSize = function (document) { - var body = document.body; - var documentElement = document.documentElement; - if (!body || !documentElement) { - throw new Error("Unable to get document size"); - } - var width = Math.max(Math.max(body.scrollWidth, documentElement.scrollWidth), Math.max(body.offsetWidth, documentElement.offsetWidth), Math.max(body.clientWidth, documentElement.clientWidth)); - var height = Math.max(Math.max(body.scrollHeight, documentElement.scrollHeight), Math.max(body.offsetHeight, documentElement.offsetHeight), Math.max(body.clientHeight, documentElement.clientHeight)); - return new Bounds(0, 0, width, height); - }; - - /* - * css-line-break 2.1.0 - * Copyright (c) 2022 Niklas von Hertzen - * Released under MIT License - */ - var toCodePoints$1 = function (str) { - var codePoints = []; - var i = 0; - var length = str.length; - while (i < length) { - var value = str.charCodeAt(i++); - if (value >= 0xd800 && value <= 0xdbff && i < length) { - var extra = str.charCodeAt(i++); - if ((extra & 0xfc00) === 0xdc00) { - codePoints.push(((value & 0x3ff) << 10) + (extra & 0x3ff) + 0x10000); - } - else { - codePoints.push(value); - i--; - } - } - else { - codePoints.push(value); - } - } - return codePoints; - }; - var fromCodePoint$1 = function () { - var codePoints = []; - for (var _i = 0; _i < arguments.length; _i++) { - codePoints[_i] = arguments[_i]; - } - if (String.fromCodePoint) { - return String.fromCodePoint.apply(String, codePoints); - } - var length = codePoints.length; - if (!length) { - return ''; - } - var codeUnits = []; - var index = -1; - var result = ''; - while (++index < length) { - var codePoint = codePoints[index]; - if (codePoint <= 0xffff) { - codeUnits.push(codePoint); - } - else { - codePoint -= 0x10000; - codeUnits.push((codePoint >> 10) + 0xd800, (codePoint % 0x400) + 0xdc00); - } - if (index + 1 === length || codeUnits.length > 0x4000) { - result += String.fromCharCode.apply(String, codeUnits); - codeUnits.length = 0; - } - } - return result; - }; - var chars$2 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; - // Use a lookup table to find the index. - var lookup$2 = typeof Uint8Array === 'undefined' ? [] : new Uint8Array(256); - for (var i$2 = 0; i$2 < chars$2.length; i$2++) { - lookup$2[chars$2.charCodeAt(i$2)] = i$2; - } - - /* - * utrie 1.0.2 - * Copyright (c) 2022 Niklas von Hertzen - * Released under MIT License - */ - var chars$1$1 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; - // Use a lookup table to find the index. - var lookup$1$1 = typeof Uint8Array === 'undefined' ? [] : new Uint8Array(256); - for (var i$1$1 = 0; i$1$1 < chars$1$1.length; i$1$1++) { - lookup$1$1[chars$1$1.charCodeAt(i$1$1)] = i$1$1; - } - var decode$1 = function (base64) { - var bufferLength = base64.length * 0.75, len = base64.length, i, p = 0, encoded1, encoded2, encoded3, encoded4; - if (base64[base64.length - 1] === '=') { - bufferLength--; - if (base64[base64.length - 2] === '=') { - bufferLength--; - } - } - var buffer = typeof ArrayBuffer !== 'undefined' && - typeof Uint8Array !== 'undefined' && - typeof Uint8Array.prototype.slice !== 'undefined' - ? new ArrayBuffer(bufferLength) - : new Array(bufferLength); - var bytes = Array.isArray(buffer) ? buffer : new Uint8Array(buffer); - for (i = 0; i < len; i += 4) { - encoded1 = lookup$1$1[base64.charCodeAt(i)]; - encoded2 = lookup$1$1[base64.charCodeAt(i + 1)]; - encoded3 = lookup$1$1[base64.charCodeAt(i + 2)]; - encoded4 = lookup$1$1[base64.charCodeAt(i + 3)]; - bytes[p++] = (encoded1 << 2) | (encoded2 >> 4); - bytes[p++] = ((encoded2 & 15) << 4) | (encoded3 >> 2); - bytes[p++] = ((encoded3 & 3) << 6) | (encoded4 & 63); - } - return buffer; - }; - var polyUint16Array$1 = function (buffer) { - var length = buffer.length; - var bytes = []; - for (var i = 0; i < length; i += 2) { - bytes.push((buffer[i + 1] << 8) | buffer[i]); - } - return bytes; - }; - var polyUint32Array$1 = function (buffer) { - var length = buffer.length; - var bytes = []; - for (var i = 0; i < length; i += 4) { - bytes.push((buffer[i + 3] << 24) | (buffer[i + 2] << 16) | (buffer[i + 1] << 8) | buffer[i]); - } - return bytes; - }; - - /** Shift size for getting the index-2 table offset. */ - var UTRIE2_SHIFT_2$1 = 5; - /** Shift size for getting the index-1 table offset. */ - var UTRIE2_SHIFT_1$1 = 6 + 5; - /** - * Shift size for shifting left the index array values. - * Increases possible data size with 16-bit index values at the cost - * of compactability. - * This requires data blocks to be aligned by UTRIE2_DATA_GRANULARITY. - */ - var UTRIE2_INDEX_SHIFT$1 = 2; - /** - * Difference between the two shift sizes, - * for getting an index-1 offset from an index-2 offset. 6=11-5 - */ - var UTRIE2_SHIFT_1_2$1 = UTRIE2_SHIFT_1$1 - UTRIE2_SHIFT_2$1; - /** - * The part of the index-2 table for U+D800..U+DBFF stores values for - * lead surrogate code _units_ not code _points_. - * Values for lead surrogate code _points_ are indexed with this portion of the table. - * Length=32=0x20=0x400>>UTRIE2_SHIFT_2. (There are 1024=0x400 lead surrogates.) - */ - var UTRIE2_LSCP_INDEX_2_OFFSET$1 = 0x10000 >> UTRIE2_SHIFT_2$1; - /** Number of entries in a data block. 32=0x20 */ - var UTRIE2_DATA_BLOCK_LENGTH$1 = 1 << UTRIE2_SHIFT_2$1; - /** Mask for getting the lower bits for the in-data-block offset. */ - var UTRIE2_DATA_MASK$1 = UTRIE2_DATA_BLOCK_LENGTH$1 - 1; - var UTRIE2_LSCP_INDEX_2_LENGTH$1 = 0x400 >> UTRIE2_SHIFT_2$1; - /** Count the lengths of both BMP pieces. 2080=0x820 */ - var UTRIE2_INDEX_2_BMP_LENGTH$1 = UTRIE2_LSCP_INDEX_2_OFFSET$1 + UTRIE2_LSCP_INDEX_2_LENGTH$1; - /** - * The 2-byte UTF-8 version of the index-2 table follows at offset 2080=0x820. - * Length 32=0x20 for lead bytes C0..DF, regardless of UTRIE2_SHIFT_2. - */ - var UTRIE2_UTF8_2B_INDEX_2_OFFSET$1 = UTRIE2_INDEX_2_BMP_LENGTH$1; - var UTRIE2_UTF8_2B_INDEX_2_LENGTH$1 = 0x800 >> 6; /* U+0800 is the first code point after 2-byte UTF-8 */ - /** - * The index-1 table, only used for supplementary code points, at offset 2112=0x840. - * Variable length, for code points up to highStart, where the last single-value range starts. - * Maximum length 512=0x200=0x100000>>UTRIE2_SHIFT_1. - * (For 0x100000 supplementary code points U+10000..U+10ffff.) - * - * The part of the index-2 table for supplementary code points starts - * after this index-1 table. - * - * Both the index-1 table and the following part of the index-2 table - * are omitted completely if there is only BMP data. - */ - var UTRIE2_INDEX_1_OFFSET$1 = UTRIE2_UTF8_2B_INDEX_2_OFFSET$1 + UTRIE2_UTF8_2B_INDEX_2_LENGTH$1; - /** - * Number of index-1 entries for the BMP. 32=0x20 - * This part of the index-1 table is omitted from the serialized form. - */ - var UTRIE2_OMITTED_BMP_INDEX_1_LENGTH$1 = 0x10000 >> UTRIE2_SHIFT_1$1; - /** Number of entries in an index-2 block. 64=0x40 */ - var UTRIE2_INDEX_2_BLOCK_LENGTH$1 = 1 << UTRIE2_SHIFT_1_2$1; - /** Mask for getting the lower bits for the in-index-2-block offset. */ - var UTRIE2_INDEX_2_MASK$1 = UTRIE2_INDEX_2_BLOCK_LENGTH$1 - 1; - var slice16$1 = function (view, start, end) { - if (view.slice) { - return view.slice(start, end); - } - return new Uint16Array(Array.prototype.slice.call(view, start, end)); - }; - var slice32$1 = function (view, start, end) { - if (view.slice) { - return view.slice(start, end); - } - return new Uint32Array(Array.prototype.slice.call(view, start, end)); - }; - var createTrieFromBase64$1 = function (base64, _byteLength) { - var buffer = decode$1(base64); - var view32 = Array.isArray(buffer) ? polyUint32Array$1(buffer) : new Uint32Array(buffer); - var view16 = Array.isArray(buffer) ? polyUint16Array$1(buffer) : new Uint16Array(buffer); - var headerLength = 24; - var index = slice16$1(view16, headerLength / 2, view32[4] / 2); - var data = view32[5] === 2 - ? slice16$1(view16, (headerLength + view32[4]) / 2) - : slice32$1(view32, Math.ceil((headerLength + view32[4]) / 4)); - return new Trie$1(view32[0], view32[1], view32[2], view32[3], index, data); - }; - var Trie$1 = /** @class */ (function () { - function Trie(initialValue, errorValue, highStart, highValueIndex, index, data) { - this.initialValue = initialValue; - this.errorValue = errorValue; - this.highStart = highStart; - this.highValueIndex = highValueIndex; - this.index = index; - this.data = data; - } - /** - * Get the value for a code point as stored in the Trie. - * - * @param codePoint the code point - * @return the value - */ - Trie.prototype.get = function (codePoint) { - var ix; - if (codePoint >= 0) { - if (codePoint < 0x0d800 || (codePoint > 0x0dbff && codePoint <= 0x0ffff)) { - // Ordinary BMP code point, excluding leading surrogates. - // BMP uses a single level lookup. BMP index starts at offset 0 in the Trie2 index. - // 16 bit data is stored in the index array itself. - ix = this.index[codePoint >> UTRIE2_SHIFT_2$1]; - ix = (ix << UTRIE2_INDEX_SHIFT$1) + (codePoint & UTRIE2_DATA_MASK$1); - return this.data[ix]; - } - if (codePoint <= 0xffff) { - // Lead Surrogate Code Point. A Separate index section is stored for - // lead surrogate code units and code points. - // The main index has the code unit data. - // For this function, we need the code point data. - // Note: this expression could be refactored for slightly improved efficiency, but - // surrogate code points will be so rare in practice that it's not worth it. - ix = this.index[UTRIE2_LSCP_INDEX_2_OFFSET$1 + ((codePoint - 0xd800) >> UTRIE2_SHIFT_2$1)]; - ix = (ix << UTRIE2_INDEX_SHIFT$1) + (codePoint & UTRIE2_DATA_MASK$1); - return this.data[ix]; - } - if (codePoint < this.highStart) { - // Supplemental code point, use two-level lookup. - ix = UTRIE2_INDEX_1_OFFSET$1 - UTRIE2_OMITTED_BMP_INDEX_1_LENGTH$1 + (codePoint >> UTRIE2_SHIFT_1$1); - ix = this.index[ix]; - ix += (codePoint >> UTRIE2_SHIFT_2$1) & UTRIE2_INDEX_2_MASK$1; - ix = this.index[ix]; - ix = (ix << UTRIE2_INDEX_SHIFT$1) + (codePoint & UTRIE2_DATA_MASK$1); - return this.data[ix]; - } - if (codePoint <= 0x10ffff) { - return this.data[this.highValueIndex]; - } - } - // Fall through. The code point is outside of the legal range of 0..0x10ffff. - return this.errorValue; - }; - return Trie; - }()); - - /* - * base64-arraybuffer 1.0.2 - * Copyright (c) 2022 Niklas von Hertzen - * Released under MIT License - */ - var chars$3 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; - // Use a lookup table to find the index. - var lookup$3 = typeof Uint8Array === 'undefined' ? [] : new Uint8Array(256); - for (var i$3 = 0; i$3 < chars$3.length; i$3++) { - lookup$3[chars$3.charCodeAt(i$3)] = i$3; - } - - var base64$1 = 'KwAAAAAAAAAACA4AUD0AADAgAAACAAAAAAAIABAAGABAAEgAUABYAGAAaABgAGgAYgBqA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bSBtIG0gbSBiwHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAdgAGAALAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAdbB2MHLAcsBywHLAcsBywHLAc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QhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIcAh3CHoIMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIgggwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAALAcsBywHLAcsBywHLAcsBywHLAcsB4oILAcsB44I0gaWCJ4Ipgh1AHUAqgiyCHUAdQB1AHUAdQB1AHUAdQB1AHUAtwh8AXUAvwh1AMUIyQjRCNkI4AjoCHUAdQB1AO4I9gj+CAYJDgkTCS0HGwkjCYIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiAAIAAAAFAAYABgAGIAXwBgAHEAdQBFAJUAogCyAKAAYABgAEIA4ABGANMA4QDxAMEBDwE1AFwBLAE6AQEBUQF4QkhCmEKoQrhCgAHIQsAB0MLAAcABwAHAAeDC6ABoAHDCwMMAAcABwAHAAdDDGMMAAcAB6MM4wwjDWMNow3jDaABoAGgAaABoAGgAaABoAGgAaABoAGgAaABoAGgAaABoAGgAaABoAEjDqABWw6bDqABpg6gAaABoAHcDvwOPA+gAaABfA/8DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DpcPAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcAB9cPKwkyCToJMAB1AHUAdQBCCUoJTQl1AFUJ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QB1AHUAdQB1AHUAdQB1AHUAdQB1AHUA+wMVBGcMMAAwAHwBbwx1AHcMfwyHDI8MMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAYABgAJcMMAAwADAAdQB1AJ8MlQClDDAAMACtDCwHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsB7UMLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AA0EMAC9DDAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAsBywHLAcsBywHLAcsBywHLQcwAMEMyAwsBywHLAcsBywHLAcsBywHLAcsBywHzAwwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAHUAdQB1ANQM2QzhDDAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMABgAGAAYABgAGAAYABgAOkMYADxDGAA+AwADQYNYABhCWAAYAAODTAAMAAwADAAFg1gAGAAHg37AzAAMAAwADAAYABgACYNYAAsDTQNPA1gAEMNPg1LDWAAYABgAGAAYABgAGAAYABgAGAAUg1aDYsGVglhDV0NcQBnDW0NdQ15DWAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAlQCBDZUAiA2PDZcNMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAnw2nDTAAMAAwADAAMAAwAHUArw23DTAAMAAwADAAM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AQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQADQAEAB4ABAAEAB4ABAAEABMABAArACsAKwArACsAKwArACsAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAKwArACsAKwBWAFYAVgBWAB4AHgArACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AGgAaABoAGAAYAB4AHgAEAAQABAAEAAQABAAEAAQABAAEAAQAEwAEACsAEwATAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABLAEsASwBLAEsASwBLAEsASwBLABoAGQAZAB4AUABQAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQABMAUAAEAAQABAAEAAQABAAEAB4AHgAEAAQABAAEAAQABABQAFAABAAEAB4ABAAEAAQABABQAFAASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUAAeAB4AUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAFAABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQAUABQAB4AHgAYABMAUAArACsABAAbABsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAFAABAAEAAQABAAEAFAABAAEAAQAUAAEAAQABAAEAAQAKwArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAArACsAHgArAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAB4ABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAUAAEAAQABAAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQAFAABAAEAA0ADQBLAEsASwBLAEsASwBLAEsASwBLAB4AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAArAFAAUABQAFAAUABQAFAAUAArACsAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUAArACsAKwBQAFAAUABQACsAKwAEAFAABAAEAAQABAAEAAQABAArACsABAAEACsAKwAEAAQABABQACsAKwArACsAKwArACsAKwAEACsAKwArACsAUABQACsAUABQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLAFAAUAAaABoAUABQAFAAUABQAEwAHgAbAFAAHgAEACsAKwAEAAQABAArAFAAUABQAFAAUABQACsAKwArACsAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQACsAUABQACsAUABQACsAKwAEACsABAAEAAQABAAEACsAKwArACsABAAEACsAKwAEAAQABAArACsAKwAEACsAKwArACsAKwArACsAUABQAFAAUAArAFAAKwArACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLAAQABABQAFAAUAAEAB4AKwArACsAKwArACsAKwArACsAKwAEAAQABAArAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQACsAUABQAFAAUABQACsAKwAEAFAABAAEAAQABAAEAAQABAAEACsABAAEAAQAKwAEAAQABAArACsAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLAB4AGwArACsAKwArACsAKwArAFAABAAEAAQABAAEAAQAKwAEAAQABAArAFAAUABQAFAAUABQAFAAUAArACsAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAArACsABAAEACsAKwAEAAQABAArACsAKwArACsAKwArAAQABAAEACsAKwArACsAUABQACsAUABQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLAB4AUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArAAQAUAArAFAAUABQAFAAUABQACsAKwArAFAAUABQACsAUABQAFAAUAArACsAKwBQAFAAKwBQACsAUABQACsAKwArAFAAUAArACsAKwBQAFAAUAArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArAAQABAAEAAQABAArACsAKwAEAAQABAArAAQABAAEAAQAKwArAFAAKwArACsAKwArACsABAArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAUABQAFAAHgAeAB4AHgAeAB4AGwAeACsAKwArACsAKwAEAAQABAAEAAQAUABQAFAAUABQAFAAUABQACsAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAUAAEAAQABAAEAAQABAAEACsABAAEAAQAKwAEAAQABAAEACsAKwArACsAKwArACsABAAEACsAUABQAFAAKwArACsAKwArAFAAUAAEAAQAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAKwAOAFAAUABQAFAAUABQAFAAHgBQAAQABAAEAA4AUABQAFAAUABQAFAAUABQACsAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAKwArAAQAUAAEAAQABAAEAAQABAAEACsABAAEAAQAKwAEAAQABAAEACsAKwArACsAKwArACsABAAEACsAKwArACsAKwArACsAUAArAFAAUAAEAAQAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwBQAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAFAABAAEAAQABAAEAAQABAArAAQABAAEACsABAAEAAQABABQAB4AKwArACsAKwBQAFAAUAAEAFAAUABQAFAAUABQAFAAUABQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLAFAAUABQAFAAUABQAFAAUABQABoAUABQAFAAUABQAFAAKwAEAAQABAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQACsAUAArACsAUABQAFAAUABQAFAAUAArACsAKwAEACsAKwArACsABAAEAAQABAAEAAQAKwAEACsABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArAAQABAAeACsAKwArACsAKwArACsAKwArACsAKwArAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAAqAFwAXAAqACoAKgAqACoAKgAqACsAKwArACsAGwBcAFwAXABcAFwAXABcACoAKgAqACoAKgAqACoAKgAeAEsASwBLAEsASwBLAEsASwBLAEsADQANACsAKwArACsAKwBcAFwAKwBcACsAXABcAFwAXABcACsAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACsAXAArAFwAXABcAFwAXABcAFwAXABcAFwAKgBcAFwAKgAqACoAKgAqACoAKgAqACoAXAArACsAXABcAFwAXABcACsAXAArACoAKgAqACoAKgAqACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwBcAFwAXABcAFAADgAOAA4ADgAeAA4ADgAJAA4ADgANAAkAEwATABMAEwATAAkAHgATAB4AHgAeAAQABAAeAB4AHgAeAB4AHgBLAEsASwBLAEsASwBLAEsASwBLAFAAUABQAFAAUABQAFAAUABQAFAADQAEAB4ABAAeAAQAFgARABYAEQAEAAQAUABQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQADQAEAAQABAAEAAQADQAEAAQAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABAArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArAA0ADQAeAB4AHgAeAB4AHgAEAB4AHgAeAB4AHgAeACsAHgAeAA4ADgANAA4AHgAeAB4AHgAeAAkACQArACsAKwArACsAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgBcAEsASwBLAEsASwBLAEsASwBLAEsADQANAB4AHgAeAB4AXABcAFwAXABcAFwAKgAqACoAKgBcAFwAXABcACoAKgAqAFwAKgAqACoAXABcACoAKgAqACoAKgAqACoAXABcAFwAKgAqACoAKgBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACoAKgAqACoAKgAqACoAKgAqACoAKgAqAFwAKgBLAEsASwBLAEsASwBLAEsASwBLACoAKgAqACoAKgAqAFAAUABQAFAAUABQACsAUAArACsAKwArACsAUAArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgBQAFAAUABQAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUAArACsAUABQAFAAUABQAFAAUAArAFAAKwBQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAKwArAFAAUABQAFAAUABQAFAAKwBQACsAUABQAFAAUAArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsABAAEAAQAHgANAB4AHgAeAB4AHgAeAB4AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUAArACsADQBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAANAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAWABEAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAA0ADQANAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAAQABAAEACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAANAA0AKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUAArAAQABAArACsAKwArACsAKwArACsAKwArACsAKwBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqAA0ADQAVAFwADQAeAA0AGwBcACoAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwAeAB4AEwATAA0ADQAOAB4AEwATAB4ABAAEAAQACQArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUAAEAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQAUAArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAArACsAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAHgArACsAKwATABMASwBLAEsASwBLAEsASwBLAEsASwBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAArACsAXABcAFwAXABcACsAKwArACsAKwArACsAKwArACsAKwBcAFwAXABcAFwAXABcAFwAXABcAFwAXAArACsAKwArAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAXAArACsAKwAqACoAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAArACsAHgAeAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACoAKgAqACoAKgAqACoAKgAqACoAKwAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKwArAAQASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwArACsAKwArACoAKgAqACoAKgAqACoAXAAqACoAKgAqACoAKgArACsABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsABAAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABABQAFAAUABQAFAAUABQACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwANAA0AHgANAA0ADQANAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAEAAQABAAEAAQAHgAeAB4AHgAeAB4AHgAeAB4AKwArACsABAAEAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABQAFAASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwAeAB4AHgAeAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArAA0ADQANAA0ADQBLAEsASwBLAEsASwBLAEsASwBLACsAKwArAFAAUABQAEsASwBLAEsASwBLAEsASwBLAEsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAA0ADQBQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUAAeAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArAAQABAAEAB4ABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAAQAUABQAFAAUABQAFAABABQAF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QAFAAUABQAAQABAAeAA0ADQANAA0ADQArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAB4AHgAeAB4AHgAeAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAHgAeAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAeAB4AUABQAFAAUABQAFAAUABQAFAAUABQAAQAUABQAFAABABQAFAAUABQAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAeAB4AHgAeAAQAKwArACsAUABQAFAAUABQAFAAHgAeABoAHgArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAADgAOABMAEwArACsAKwArACsAKwArACsABAAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwANAA0ASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArACsAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAFAAUAAeAB4AHgBQAA4AUABQAAQAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAA0ADQBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwArACsAKwArACsAKwArAB4AWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYACsAKwArAAQAHgAeAB4AHgAeAB4ADQANAA0AHgAeAB4AHgArAFAASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArAB4AHgBcAFwAXABcAFwAKgBcAFwAXABcAFwAXABcAFwAXABcAEsASwBLAEsASwBLAEsASwBLAEsAXABcAFwAXABcACsAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwArAFAAUABQAAQAUABQAFAAUABQAFAAUABQAAQABAArACsASwBLAEsASwBLAEsASwBLAEsASwArACsAHgANAA0ADQBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAKgAqACoAXAAqACoAKgBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAAqAFwAKgAqACoAXABcACoAKgBcAFwAXABcAFwAKgAqAFwAKgBcACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFwAXABcACoAKgBQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAA0ADQBQAFAAUAAEAAQAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUAArACsAUABQAFAAUABQAFAAKwArAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQADQAEAAQAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAVABVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBUAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVACsAKwArACsAKwArACsAKwArACsAKwArAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAKwArACsAKwBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAKwArACsAKwAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAKwArACsAKwArAFYABABWAFYAVgBWAFYAVgBWAFYAVgBWAB4AVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgArAFYAVgBWAFYAVgArAFYAKwBWAFYAKwBWAFYAKwBWAFYAVgBWAFYAVgBWAFYAVgBWAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAEQAWAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUAAaAB4AKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAGAARABEAGAAYABMAEwAWABEAFAArACsAKwArACsAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACUAJQAlACUAJQAWABEAFgARABYAEQAWABEAFgARABYAEQAlACUAFgARACUAJQAlACUAJQAlACUAEQAlABEAKwAVABUAEwATACUAFgARABYAEQAWABEAJQAlACUAJQAlACUAJQAlACsAJQAbABoAJQArACsAKwArAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAcAKwATACUAJQAbABoAJQAlABYAEQAlACUAEQAlABEAJQBXAFcAVwBXAFcAVwBXAFcAVwBXABUAFQAlACUAJQATACUAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXABYAJQARACUAJQAlAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwAWACUAEQAlABYAEQARABYAEQARABUAVwBRAFEAUQBRAFEAUQBRAFEAUQBRAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAEcARwArACsAVwBXAFcAVwBXAFcAKwArAFcAVwBXAFcAVwBXACsAKwBXAFcAVwBXAFcAVwArACsAVwBXAFcAKwArACsAGgAbACUAJQAlABsAGwArAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwAEAAQABAAQAB0AKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsADQANAA0AKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAB4AHgAeAB4AHgAeAB4AHgAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAAQAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAA0AUABQAFAAUAArACsAKwArAFAAUABQAFAAUABQAFAAUAANAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwAeACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAKwArAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUAArACsAKwBQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwANAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAB4AUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUAArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAA0AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAUABQAFAAUABQAAQABAAEACsABAAEACsAKwArACsAKwAEAAQABAAEAFAAUABQAFAAKwBQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAQABAAEACsAKwArACsABABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAA0ADQANAA0ADQANAA0ADQAeACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAFAAUABQAFAAUABQAFAAUAAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAArACsAKwArAFAAUABQAFAAUAANAA0ADQANAA0ADQAUACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsADQANAA0ADQANAA0ADQBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAAQABAAEAAQAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUAArAAQABAANACsAKwBQAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAB4AHgAeAB4AHgArACsAKwArACsAKwAEAAQABAAEAAQABAAEAA0ADQAeAB4AHgAeAB4AKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABAAeAB4AHgANAA0ADQANACsAKwArACsAKwArACsAKwArACsAKwAeACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwArACsAKwArAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsASwBLAEsASwBLAEsASwBLAEsASwANAA0ADQANAFAABAAEAFAAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAeAA4AUAArACsAKwArACsAKwArACsAKwAEAFAAUABQAFAADQANAB4ADQAEAAQABAAEAB4ABAAEAEsASwBLAEsASwBLAEsASwBLAEsAUAAOAFAADQANAA0AKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAANAA0AHgANAA0AHgAEACsAUABQAFAAUABQAFAAUAArAFAAKwBQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAA0AKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsABAAEAAQABAArAFAAUABQAFAAUABQAFAAUAArACsAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQACsAUABQAFAAUABQACsABAAEAFAABAAEAAQABAAEAAQABAArACsABAAEACsAKwAEAAQABAArACsAUAArACsAKwArACsAKwAEACsAKwArACsAKwBQAFAAUABQAFAABAAEACsAKwAEAAQABAAEAAQABAAEACsAKwArAAQABAAEAAQABAArACsAKwArACsAKwArACsAKwArACsABAAEAAQABAAEAAQABABQAFAAUABQAA0ADQANAA0AHgBLAEsASwBLAEsASwBLAEsASwBLAA0ADQArAB4ABABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAAQABAAEAFAAUAAeAFAAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAArACsABAAEAAQABAAEAAQABAAEAAQADgANAA0AEwATAB4AHgAeAA0ADQANAA0ADQANAA0ADQANAA0ADQANAA0ADQANAFAAUABQAFAABAAEACsAKwAEAA0ADQAeAFAAKwArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAFAAKwArACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAKwArACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwBcAFwADQANAA0AKgBQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAeACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAKwArAFAAKwArAFAAUABQAFAAUABQAFAAUAArAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQAKwAEAAQAKwArAAQABAAEAAQAUAAEAFAABAAEAA0ADQANACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAArACsABAAEAAQABAAEAAQABABQAA4AUAAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAFAABAAEAAQABAAOAB4ADQANAA0ADQAOAB4ABAArACsAKwArACsAKwArACsAUAAEAAQABAAEAAQABAAEAAQABAAEAAQAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAA0ADQANAFAADgAOAA4ADQANACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEACsABAAEAAQABAAEAAQABAAEAFAADQANAA0ADQANACsAKwArACsAKwArACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwAOABMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQACsAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAArACsAKwAEACsABAAEACsABAAEAAQABAAEAAQABABQAAQAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAKwBQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQAKwAEAAQAKwAEAAQABAAEAAQAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAaABoAGgAaAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwArACsAKwArAA0AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsADQANAA0ADQANACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAASABIAEgAQwBDAEMAUABQAFAAUABDAFAAUABQAEgAQwBIAEMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAASABDAEMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwAJAAkACQAJAAkACQAJABYAEQArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABIAEMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwANAA0AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAQABAAEAAQABAANACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAA0ADQANAB4AHgAeAB4AHgAeAFAAUABQAFAADQAeACsAKwArACsAKwArACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwArAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAANAA0AHgAeACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwAEAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwArACsAKwAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAARwBHABUARwAJACsAKwArACsAKwArACsAKwArACsAKwAEAAQAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACsAKwArACsAKwArACsAKwBXAFcAVwBXAFcAVwBXAFcAVwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUQBRAFEAKwArACsAKwArACsAKwArACsAKwArACsAKwBRAFEAUQBRACsAKwArACsAKwArACsAKwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUAArACsAHgAEAAQADQAEAAQABAAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwArAB4AHgAeAB4AHgAeAB4AKwArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAAQABAAEAAQABAAeAB4AHgAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAB4AHgAEAAQABAAEAAQABAAEAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQAHgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwBQAFAAKwArAFAAKwArAFAAUAArACsAUABQAFAAUAArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAUAArAFAAUABQAFAAUABQAFAAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwBQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAHgAeAFAAUABQAFAAUAArAFAAKwArACsAUABQAFAAUABQAFAAUAArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAeACsAKwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAeAB4AHgAeAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAeAB4AHgAeAB4AHgAeAB4ABAAeAB4AHgAeAB4AHgAeAB4AHgAeAAQAHgAeAA0ADQANAA0AHgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAAQABAAEAAQAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAAQABAAEAAQABAAEAAQAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArAAQABAAEAAQABAAEAAQAKwAEAAQAKwAEAAQABAAEAAQAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwAEAAQABAAEAAQABAAEAFAAUABQAFAAUABQAFAAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwBQAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArABsAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwArAB4AHgAeAB4ABAAEAAQABAAEAAQABABQACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArABYAFgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAGgBQAFAAUAAaAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAKwBQACsAKwBQACsAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAKwBQACsAUAArACsAKwArACsAKwBQACsAKwArACsAUAArAFAAKwBQACsAUABQAFAAKwBQAFAAKwBQACsAKwBQACsAUAArAFAAKwBQACsAUAArAFAAUAArAFAAKwArAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQAFAAUAArAFAAUABQAFAAKwBQACsAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAUABQAFAAKwBQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8AJQAlACUAHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHgAeAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB4AHgAeACUAJQAlAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAJQAlACUAJQAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeAB4AJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlAB4AHgAlACUAJQAlACUAHgAlACUAJQAlACUAIAAgACAAJQAlACAAJQAlACAAIAAgACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACEAIQAhACEAIQAlACUAIAAgACUAJQAgACAAIAAgACAAIAAgACAAIAAgACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAJQAlACUAIAAlACUAJQAlACAAIAAgACUAIAAgACAAJQAlACUAJQAlACUAJQAgACUAIAAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAHgAlAB4AJQAeACUAJQAlACUAJQAgACUAJQAlACUAHgAlAB4AHgAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAlACUAJQAl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JQAlACUAJQAlACUAJQAgACAAIAAgACAAIAAgACAAIAAgACUAJQAgACAAIAAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAgACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAIAAlACAAIAAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAgACAAIAAlACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAJQAlAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAKwArAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwAlACUAJQAlACUAJQAlACUAJQAlACUAVwBXACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAKwAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAA=='; - - var LETTER_NUMBER_MODIFIER = 50; - // Non-tailorable Line Breaking Classes - var BK = 1; // Cause a line break (after) - var CR$1 = 2; // Cause a line break (after), except between CR and LF - var LF$1 = 3; // Cause a line break (after) - var CM = 4; // Prohibit a line break between the character and the preceding character - var NL = 5; // Cause a line break (after) - var WJ = 7; // Prohibit line breaks before and after - var ZW = 8; // Provide a break opportunity - var GL = 9; // Prohibit line breaks before and after - var SP = 10; // Enable indirect line breaks - var ZWJ$1 = 11; // Prohibit line breaks within joiner sequences - // Break Opportunities - var B2 = 12; // Provide a line break opportunity before and after the character - var BA = 13; // Generally provide a line break opportunity after the character - var BB = 14; // Generally provide a line break opportunity before the character - var HY = 15; // Provide a line break opportunity after the character, except in numeric context - var CB = 16; // Provide a line break opportunity contingent on additional information - // Characters Prohibiting Certain Breaks - var CL = 17; // Prohibit line breaks before - var CP = 18; // Prohibit line breaks before - var EX = 19; // Prohibit line breaks before - var IN = 20; // Allow only indirect line breaks between pairs - var NS = 21; // Allow only indirect line breaks before - var OP = 22; // Prohibit line breaks after - var QU = 23; // Act like they are both opening and closing - // Numeric Context - var IS = 24; // Prevent breaks after any and before numeric - var NU = 25; // Form numeric expressions for line breaking purposes - var PO = 26; // Do not break following a numeric expression - var PR = 27; // Do not break in front of a numeric expression - var SY = 28; // Prevent a break before; and allow a break after - // Other Characters - var AI = 29; // Act like AL when the resolvedEAW is N; otherwise; act as ID - var AL = 30; // Are alphabetic characters or symbols that are used with alphabetic characters - var CJ = 31; // Treat as NS or ID for strict or normal breaking. - var EB = 32; // Do not break from following Emoji Modifier - var EM = 33; // Do not break from preceding Emoji Base - var H2 = 34; // Form Korean syllable blocks - var H3 = 35; // Form Korean syllable blocks - var HL = 36; // Do not break around a following hyphen; otherwise act as Alphabetic - var ID = 37; // Break before or after; except in some numeric context - var JL = 38; // Form Korean syllable blocks - var JV = 39; // Form Korean syllable blocks - var JT = 40; // Form Korean syllable blocks - var RI$1 = 41; // Keep pairs together. For pairs; break before and after other classes - var SA = 42; // Provide a line break opportunity contingent on additional, language-specific context analysis - var XX = 43; // Have as yet unknown line breaking behavior or unassigned code positions - var ea_OP = [0x2329, 0xff08]; - var BREAK_MANDATORY = '!'; - var BREAK_NOT_ALLOWED$1 = '×'; - var BREAK_ALLOWED$1 = '÷'; - var UnicodeTrie$1 = createTrieFromBase64$1(base64$1); - var ALPHABETICS = [AL, HL]; - var HARD_LINE_BREAKS = [BK, CR$1, LF$1, NL]; - var SPACE$1 = [SP, ZW]; - var PREFIX_POSTFIX = [PR, PO]; - var LINE_BREAKS = HARD_LINE_BREAKS.concat(SPACE$1); - var KOREAN_SYLLABLE_BLOCK = [JL, JV, JT, H2, H3]; - var HYPHEN = [HY, BA]; - var codePointsToCharacterClasses = function (codePoints, lineBreak) { - if (lineBreak === void 0) { lineBreak = 'strict'; } - var types = []; - var indices = []; - var categories = []; - codePoints.forEach(function (codePoint, index) { - var classType = UnicodeTrie$1.get(codePoint); - if (classType > LETTER_NUMBER_MODIFIER) { - categories.push(true); - classType -= LETTER_NUMBER_MODIFIER; - } - else { - categories.push(false); - } - if (['normal', 'auto', 'loose'].indexOf(lineBreak) !== -1) { - // U+2010, – U+2013, 〜 U+301C, ゠ U+30A0 - if ([0x2010, 0x2013, 0x301c, 0x30a0].indexOf(codePoint) !== -1) { - indices.push(index); - return types.push(CB); - } - } - if (classType === CM || classType === ZWJ$1) { - // LB10 Treat any remaining combining mark or ZWJ as AL. - if (index === 0) { - indices.push(index); - return types.push(AL); - } - // LB9 Do not break a combining character sequence; treat it as if it has the line breaking class of - // the base character in all of the following rules. Treat ZWJ as if it were CM. - var prev = types[index - 1]; - if (LINE_BREAKS.indexOf(prev) === -1) { - indices.push(indices[index - 1]); - return types.push(prev); - } - indices.push(index); - return types.push(AL); - } - indices.push(index); - if (classType === CJ) { - return types.push(lineBreak === 'strict' ? NS : ID); - } - if (classType === SA) { - return types.push(AL); - } - if (classType === AI) { - return types.push(AL); - } - // For supplementary characters, a useful default is to treat characters in the range 10000..1FFFD as AL - // and characters in the ranges 20000..2FFFD and 30000..3FFFD as ID, until the implementation can be revised - // to take into account the actual line breaking properties for these characters. - if (classType === XX) { - if ((codePoint >= 0x20000 && codePoint <= 0x2fffd) || (codePoint >= 0x30000 && codePoint <= 0x3fffd)) { - return types.push(ID); - } - else { - return types.push(AL); - } - } - types.push(classType); - }); - return [indices, types, categories]; - }; - var isAdjacentWithSpaceIgnored = function (a, b, currentIndex, classTypes) { - var current = classTypes[currentIndex]; - if (Array.isArray(a) ? a.indexOf(current) !== -1 : a === current) { - var i = currentIndex; - while (i <= classTypes.length) { - i++; - var next = classTypes[i]; - if (next === b) { - return true; - } - if (next !== SP) { - break; - } - } - } - if (current === SP) { - var i = currentIndex; - while (i > 0) { - i--; - var prev = classTypes[i]; - if (Array.isArray(a) ? a.indexOf(prev) !== -1 : a === prev) { - var n = currentIndex; - while (n <= classTypes.length) { - n++; - var next = classTypes[n]; - if (next === b) { - return true; - } - if (next !== SP) { - break; - } - } - } - if (prev !== SP) { - break; - } - } - } - return false; - }; - var previousNonSpaceClassType = function (currentIndex, classTypes) { - var i = currentIndex; - while (i >= 0) { - var type = classTypes[i]; - if (type === SP) { - i--; - } - else { - return type; - } - } - return 0; - }; - var _lineBreakAtIndex = function (codePoints, classTypes, indicies, index, forbiddenBreaks) { - if (indicies[index] === 0) { - return BREAK_NOT_ALLOWED$1; - } - var currentIndex = index - 1; - if (Array.isArray(forbiddenBreaks) && forbiddenBreaks[currentIndex] === true) { - return BREAK_NOT_ALLOWED$1; - } - var beforeIndex = currentIndex - 1; - var afterIndex = currentIndex + 1; - var current = classTypes[currentIndex]; - // LB4 Always break after hard line breaks. - // LB5 Treat CR followed by LF, as well as CR, LF, and NL as hard line breaks. - var before = beforeIndex >= 0 ? classTypes[beforeIndex] : 0; - var next = classTypes[afterIndex]; - if (current === CR$1 && next === LF$1) { - return BREAK_NOT_ALLOWED$1; - } - if (HARD_LINE_BREAKS.indexOf(current) !== -1) { - return BREAK_MANDATORY; - } - // LB6 Do not break before hard line breaks. - if (HARD_LINE_BREAKS.indexOf(next) !== -1) { - return BREAK_NOT_ALLOWED$1; - } - // LB7 Do not break before spaces or zero width space. - if (SPACE$1.indexOf(next) !== -1) { - return BREAK_NOT_ALLOWED$1; - } - // LB8 Break before any character following a zero-width space, even if one or more spaces intervene. - if (previousNonSpaceClassType(currentIndex, classTypes) === ZW) { - return BREAK_ALLOWED$1; - } - // LB8a Do not break after a zero width joiner. - if (UnicodeTrie$1.get(codePoints[currentIndex]) === ZWJ$1) { - return BREAK_NOT_ALLOWED$1; - } - // zwj emojis - if ((current === EB || current === EM) && UnicodeTrie$1.get(codePoints[afterIndex]) === ZWJ$1) { - return BREAK_NOT_ALLOWED$1; - } - // LB11 Do not break before or after Word joiner and related characters. - if (current === WJ || next === WJ) { - return BREAK_NOT_ALLOWED$1; - } - // LB12 Do not break after NBSP and related characters. - if (current === GL) { - return BREAK_NOT_ALLOWED$1; - } - // LB12a Do not break before NBSP and related characters, except after spaces and hyphens. - if ([SP, BA, HY].indexOf(current) === -1 && next === GL) { - return BREAK_NOT_ALLOWED$1; - } - // LB13 Do not break before ‘]’ or ‘!’ or ‘;’ or ‘/’, even after spaces. - if ([CL, CP, EX, IS, SY].indexOf(next) !== -1) { - return BREAK_NOT_ALLOWED$1; - } - // LB14 Do not break after ‘[’, even after spaces. - if (previousNonSpaceClassType(currentIndex, classTypes) === OP) { - return BREAK_NOT_ALLOWED$1; - } - // LB15 Do not break within ‘”[’, even with intervening spaces. - if (isAdjacentWithSpaceIgnored(QU, OP, currentIndex, classTypes)) { - return BREAK_NOT_ALLOWED$1; - } - // LB16 Do not break between closing punctuation and a nonstarter (lb=NS), even with intervening spaces. - if (isAdjacentWithSpaceIgnored([CL, CP], NS, currentIndex, classTypes)) { - return BREAK_NOT_ALLOWED$1; - } - // LB17 Do not break within ‘——’, even with intervening spaces. - if (isAdjacentWithSpaceIgnored(B2, B2, currentIndex, classTypes)) { - return BREAK_NOT_ALLOWED$1; - } - // LB18 Break after spaces. - if (current === SP) { - return BREAK_ALLOWED$1; - } - // LB19 Do not break before or after quotation marks, such as ‘ ” ’. - if (current === QU || next === QU) { - return BREAK_NOT_ALLOWED$1; - } - // LB20 Break before and after unresolved CB. - if (next === CB || current === CB) { - return BREAK_ALLOWED$1; - } - // LB21 Do not break before hyphen-minus, other hyphens, fixed-width spaces, small kana, and other non-starters, or after acute accents. - if ([BA, HY, NS].indexOf(next) !== -1 || current === BB) { - return BREAK_NOT_ALLOWED$1; - } - // LB21a Don't break after Hebrew + Hyphen. - if (before === HL && HYPHEN.indexOf(current) !== -1) { - return BREAK_NOT_ALLOWED$1; - } - // LB21b Don’t break between Solidus and Hebrew letters. - if (current === SY && next === HL) { - return BREAK_NOT_ALLOWED$1; - } - // LB22 Do not break before ellipsis. - if (next === IN) { - return BREAK_NOT_ALLOWED$1; - } - // LB23 Do not break between digits and letters. - if ((ALPHABETICS.indexOf(next) !== -1 && current === NU) || (ALPHABETICS.indexOf(current) !== -1 && next === NU)) { - return BREAK_NOT_ALLOWED$1; - } - // LB23a Do not break between numeric prefixes and ideographs, or between ideographs and numeric postfixes. - if ((current === PR && [ID, EB, EM].indexOf(next) !== -1) || - ([ID, EB, EM].indexOf(current) !== -1 && next === PO)) { - return BREAK_NOT_ALLOWED$1; - } - // LB24 Do not break between numeric prefix/postfix and letters, or between letters and prefix/postfix. - if ((ALPHABETICS.indexOf(current) !== -1 && PREFIX_POSTFIX.indexOf(next) !== -1) || - (PREFIX_POSTFIX.indexOf(current) !== -1 && ALPHABETICS.indexOf(next) !== -1)) { - return BREAK_NOT_ALLOWED$1; - } - // LB25 Do not break between the following pairs of classes relevant to numbers: - if ( - // (PR | PO) × ( OP | HY )? NU - ([PR, PO].indexOf(current) !== -1 && - (next === NU || ([OP, HY].indexOf(next) !== -1 && classTypes[afterIndex + 1] === NU))) || - // ( OP | HY ) × NU - ([OP, HY].indexOf(current) !== -1 && next === NU) || - // NU × (NU | SY | IS) - (current === NU && [NU, SY, IS].indexOf(next) !== -1)) { - return BREAK_NOT_ALLOWED$1; - } - // NU (NU | SY | IS)* × (NU | SY | IS | CL | CP) - if ([NU, SY, IS, CL, CP].indexOf(next) !== -1) { - var prevIndex = currentIndex; - while (prevIndex >= 0) { - var type = classTypes[prevIndex]; - if (type === NU) { - return BREAK_NOT_ALLOWED$1; - } - else if ([SY, IS].indexOf(type) !== -1) { - prevIndex--; - } - else { - break; - } - } - } - // NU (NU | SY | IS)* (CL | CP)? × (PO | PR)) - if ([PR, PO].indexOf(next) !== -1) { - var prevIndex = [CL, CP].indexOf(current) !== -1 ? beforeIndex : currentIndex; - while (prevIndex >= 0) { - var type = classTypes[prevIndex]; - if (type === NU) { - return BREAK_NOT_ALLOWED$1; - } - else if ([SY, IS].indexOf(type) !== -1) { - prevIndex--; - } - else { - break; - } - } - } - // LB26 Do not break a Korean syllable. - if ((JL === current && [JL, JV, H2, H3].indexOf(next) !== -1) || - ([JV, H2].indexOf(current) !== -1 && [JV, JT].indexOf(next) !== -1) || - ([JT, H3].indexOf(current) !== -1 && next === JT)) { - return BREAK_NOT_ALLOWED$1; - } - // LB27 Treat a Korean Syllable Block the same as ID. - if ((KOREAN_SYLLABLE_BLOCK.indexOf(current) !== -1 && [IN, PO].indexOf(next) !== -1) || - (KOREAN_SYLLABLE_BLOCK.indexOf(next) !== -1 && current === PR)) { - return BREAK_NOT_ALLOWED$1; - } - // LB28 Do not break between alphabetics (“at”). - if (ALPHABETICS.indexOf(current) !== -1 && ALPHABETICS.indexOf(next) !== -1) { - return BREAK_NOT_ALLOWED$1; - } - // LB29 Do not break between numeric punctuation and alphabetics (“e.g.”). - if (current === IS && ALPHABETICS.indexOf(next) !== -1) { - return BREAK_NOT_ALLOWED$1; - } - // LB30 Do not break between letters, numbers, or ordinary symbols and opening or closing parentheses. - if ((ALPHABETICS.concat(NU).indexOf(current) !== -1 && - next === OP && - ea_OP.indexOf(codePoints[afterIndex]) === -1) || - (ALPHABETICS.concat(NU).indexOf(next) !== -1 && current === CP)) { - return BREAK_NOT_ALLOWED$1; - } - // LB30a Break between two regional indicator symbols if and only if there are an even number of regional - // indicators preceding the position of the break. - if (current === RI$1 && next === RI$1) { - var i = indicies[currentIndex]; - var count = 1; - while (i > 0) { - i--; - if (classTypes[i] === RI$1) { - count++; - } - else { - break; - } - } - if (count % 2 !== 0) { - return BREAK_NOT_ALLOWED$1; - } - } - // LB30b Do not break between an emoji base and an emoji modifier. - if (current === EB && next === EM) { - return BREAK_NOT_ALLOWED$1; - } - return BREAK_ALLOWED$1; - }; - var cssFormattedClasses = function (codePoints, options) { - if (!options) { - options = { lineBreak: 'normal', wordBreak: 'normal' }; - } - var _a = codePointsToCharacterClasses(codePoints, options.lineBreak), indicies = _a[0], classTypes = _a[1], isLetterNumber = _a[2]; - if (options.wordBreak === 'break-all' || options.wordBreak === 'break-word') { - classTypes = classTypes.map(function (type) { return ([NU, AL, SA].indexOf(type) !== -1 ? ID : type); }); - } - var forbiddenBreakpoints = options.wordBreak === 'keep-all' - ? isLetterNumber.map(function (letterNumber, i) { - return letterNumber && codePoints[i] >= 0x4e00 && codePoints[i] <= 0x9fff; - }) - : undefined; - return [indicies, classTypes, forbiddenBreakpoints]; - }; - var Break = /** @class */ (function () { - function Break(codePoints, lineBreak, start, end) { - this.codePoints = codePoints; - this.required = lineBreak === BREAK_MANDATORY; - this.start = start; - this.end = end; - } - Break.prototype.slice = function () { - return fromCodePoint$1.apply(void 0, this.codePoints.slice(this.start, this.end)); - }; - return Break; - }()); - var LineBreaker = function (str, options) { - var codePoints = toCodePoints$1(str); - var _a = cssFormattedClasses(codePoints, options), indicies = _a[0], classTypes = _a[1], forbiddenBreakpoints = _a[2]; - var length = codePoints.length; - var lastEnd = 0; - var nextIndex = 0; - return { - next: function () { - if (nextIndex >= length) { - return { done: true, value: null }; - } - var lineBreak = BREAK_NOT_ALLOWED$1; - while (nextIndex < length && - (lineBreak = _lineBreakAtIndex(codePoints, classTypes, indicies, ++nextIndex, forbiddenBreakpoints)) === - BREAK_NOT_ALLOWED$1) { } - if (lineBreak !== BREAK_NOT_ALLOWED$1 || nextIndex === length) { - var value = new Break(codePoints, lineBreak, lastEnd, nextIndex); - lastEnd = nextIndex; - return { value: value, done: false }; - } - return { done: true, value: null }; - }, - }; - }; - - // https://www.w3.org/TR/css-syntax-3 - var FLAG_UNRESTRICTED = 1 << 0; - var FLAG_ID = 1 << 1; - var FLAG_INTEGER = 1 << 2; - var FLAG_NUMBER = 1 << 3; - var LINE_FEED = 0x000a; - var SOLIDUS = 0x002f; - var REVERSE_SOLIDUS = 0x005c; - var CHARACTER_TABULATION = 0x0009; - var SPACE = 0x0020; - var QUOTATION_MARK = 0x0022; - var EQUALS_SIGN = 0x003d; - var NUMBER_SIGN = 0x0023; - var DOLLAR_SIGN = 0x0024; - var PERCENTAGE_SIGN = 0x0025; - var APOSTROPHE = 0x0027; - var LEFT_PARENTHESIS = 0x0028; - var RIGHT_PARENTHESIS = 0x0029; - var LOW_LINE = 0x005f; - var HYPHEN_MINUS = 0x002d; - var EXCLAMATION_MARK = 0x0021; - var LESS_THAN_SIGN = 0x003c; - var GREATER_THAN_SIGN = 0x003e; - var COMMERCIAL_AT = 0x0040; - var LEFT_SQUARE_BRACKET = 0x005b; - var RIGHT_SQUARE_BRACKET = 0x005d; - var CIRCUMFLEX_ACCENT = 0x003d; - var LEFT_CURLY_BRACKET = 0x007b; - var QUESTION_MARK = 0x003f; - var RIGHT_CURLY_BRACKET = 0x007d; - var VERTICAL_LINE = 0x007c; - var TILDE = 0x007e; - var CONTROL = 0x0080; - var REPLACEMENT_CHARACTER = 0xfffd; - var ASTERISK = 0x002a; - var PLUS_SIGN = 0x002b; - var COMMA = 0x002c; - var COLON = 0x003a; - var SEMICOLON = 0x003b; - var FULL_STOP = 0x002e; - var NULL = 0x0000; - var BACKSPACE = 0x0008; - var LINE_TABULATION = 0x000b; - var SHIFT_OUT = 0x000e; - var INFORMATION_SEPARATOR_ONE = 0x001f; - var DELETE = 0x007f; - var EOF = -1; - var ZERO = 0x0030; - var a = 0x0061; - var e = 0x0065; - var f = 0x0066; - var u = 0x0075; - var z = 0x007a; - var A = 0x0041; - var E = 0x0045; - var F = 0x0046; - var U = 0x0055; - var Z = 0x005a; - var isDigit = function (codePoint) { return codePoint >= ZERO && codePoint <= 0x0039; }; - var isSurrogateCodePoint = function (codePoint) { return codePoint >= 0xd800 && codePoint <= 0xdfff; }; - var isHex = function (codePoint) { - return isDigit(codePoint) || (codePoint >= A && codePoint <= F) || (codePoint >= a && codePoint <= f); - }; - var isLowerCaseLetter = function (codePoint) { return codePoint >= a && codePoint <= z; }; - var isUpperCaseLetter = function (codePoint) { return codePoint >= A && codePoint <= Z; }; - var isLetter = function (codePoint) { return isLowerCaseLetter(codePoint) || isUpperCaseLetter(codePoint); }; - var isNonASCIICodePoint = function (codePoint) { return codePoint >= CONTROL; }; - var isWhiteSpace = function (codePoint) { - return codePoint === LINE_FEED || codePoint === CHARACTER_TABULATION || codePoint === SPACE; - }; - var isNameStartCodePoint = function (codePoint) { - return isLetter(codePoint) || isNonASCIICodePoint(codePoint) || codePoint === LOW_LINE; - }; - var isNameCodePoint = function (codePoint) { - return isNameStartCodePoint(codePoint) || isDigit(codePoint) || codePoint === HYPHEN_MINUS; - }; - var isNonPrintableCodePoint = function (codePoint) { - return ((codePoint >= NULL && codePoint <= BACKSPACE) || - codePoint === LINE_TABULATION || - (codePoint >= SHIFT_OUT && codePoint <= INFORMATION_SEPARATOR_ONE) || - codePoint === DELETE); - }; - var isValidEscape = function (c1, c2) { - if (c1 !== REVERSE_SOLIDUS) { - return false; - } - return c2 !== LINE_FEED; - }; - var isIdentifierStart = function (c1, c2, c3) { - if (c1 === HYPHEN_MINUS) { - return isNameStartCodePoint(c2) || isValidEscape(c2, c3); - } - else if (isNameStartCodePoint(c1)) { - return true; - } - else if (c1 === REVERSE_SOLIDUS && isValidEscape(c1, c2)) { - return true; - } - return false; - }; - var isNumberStart = function (c1, c2, c3) { - if (c1 === PLUS_SIGN || c1 === HYPHEN_MINUS) { - if (isDigit(c2)) { - return true; - } - return c2 === FULL_STOP && isDigit(c3); - } - if (c1 === FULL_STOP) { - return isDigit(c2); - } - return isDigit(c1); - }; - var stringToNumber = function (codePoints) { - var c = 0; - var sign = 1; - if (codePoints[c] === PLUS_SIGN || codePoints[c] === HYPHEN_MINUS) { - if (codePoints[c] === HYPHEN_MINUS) { - sign = -1; - } - c++; - } - var integers = []; - while (isDigit(codePoints[c])) { - integers.push(codePoints[c++]); - } - var int = integers.length ? parseInt(fromCodePoint$1.apply(void 0, integers), 10) : 0; - if (codePoints[c] === FULL_STOP) { - c++; - } - var fraction = []; - while (isDigit(codePoints[c])) { - fraction.push(codePoints[c++]); - } - var fracd = fraction.length; - var frac = fracd ? parseInt(fromCodePoint$1.apply(void 0, fraction), 10) : 0; - if (codePoints[c] === E || codePoints[c] === e) { - c++; - } - var expsign = 1; - if (codePoints[c] === PLUS_SIGN || codePoints[c] === HYPHEN_MINUS) { - if (codePoints[c] === HYPHEN_MINUS) { - expsign = -1; - } - c++; - } - var exponent = []; - while (isDigit(codePoints[c])) { - exponent.push(codePoints[c++]); - } - var exp = exponent.length ? parseInt(fromCodePoint$1.apply(void 0, exponent), 10) : 0; - return sign * (int + frac * Math.pow(10, -fracd)) * Math.pow(10, expsign * exp); - }; - var LEFT_PARENTHESIS_TOKEN = { - type: 2 /* LEFT_PARENTHESIS_TOKEN */ - }; - var RIGHT_PARENTHESIS_TOKEN = { - type: 3 /* RIGHT_PARENTHESIS_TOKEN */ - }; - var COMMA_TOKEN = { type: 4 /* COMMA_TOKEN */ }; - var SUFFIX_MATCH_TOKEN = { type: 13 /* SUFFIX_MATCH_TOKEN */ }; - var PREFIX_MATCH_TOKEN = { type: 8 /* PREFIX_MATCH_TOKEN */ }; - var COLUMN_TOKEN = { type: 21 /* COLUMN_TOKEN */ }; - var DASH_MATCH_TOKEN = { type: 9 /* DASH_MATCH_TOKEN */ }; - var INCLUDE_MATCH_TOKEN = { type: 10 /* INCLUDE_MATCH_TOKEN */ }; - var LEFT_CURLY_BRACKET_TOKEN = { - type: 11 /* LEFT_CURLY_BRACKET_TOKEN */ - }; - var RIGHT_CURLY_BRACKET_TOKEN = { - type: 12 /* RIGHT_CURLY_BRACKET_TOKEN */ - }; - var SUBSTRING_MATCH_TOKEN = { type: 14 /* SUBSTRING_MATCH_TOKEN */ }; - var BAD_URL_TOKEN = { type: 23 /* BAD_URL_TOKEN */ }; - var BAD_STRING_TOKEN = { type: 1 /* BAD_STRING_TOKEN */ }; - var CDO_TOKEN = { type: 25 /* CDO_TOKEN */ }; - var CDC_TOKEN = { type: 24 /* CDC_TOKEN */ }; - var COLON_TOKEN = { type: 26 /* COLON_TOKEN */ }; - var SEMICOLON_TOKEN = { type: 27 /* SEMICOLON_TOKEN */ }; - var LEFT_SQUARE_BRACKET_TOKEN = { - type: 28 /* LEFT_SQUARE_BRACKET_TOKEN */ - }; - var RIGHT_SQUARE_BRACKET_TOKEN = { - type: 29 /* RIGHT_SQUARE_BRACKET_TOKEN */ - }; - var WHITESPACE_TOKEN = { type: 31 /* WHITESPACE_TOKEN */ }; - var EOF_TOKEN = { type: 32 /* EOF_TOKEN */ }; - var Tokenizer = /** @class */ (function () { - function Tokenizer() { - this._value = []; - } - Tokenizer.prototype.write = function (chunk) { - this._value = this._value.concat(toCodePoints$1(chunk)); - }; - Tokenizer.prototype.read = function () { - var tokens = []; - var token = this.consumeToken(); - while (token !== EOF_TOKEN) { - tokens.push(token); - token = this.consumeToken(); - } - return tokens; - }; - Tokenizer.prototype.consumeToken = function () { - var codePoint = this.consumeCodePoint(); - switch (codePoint) { - case QUOTATION_MARK: - return this.consumeStringToken(QUOTATION_MARK); - case NUMBER_SIGN: - var c1 = this.peekCodePoint(0); - var c2 = this.peekCodePoint(1); - var c3 = this.peekCodePoint(2); - if (isNameCodePoint(c1) || isValidEscape(c2, c3)) { - var flags = isIdentifierStart(c1, c2, c3) ? FLAG_ID : FLAG_UNRESTRICTED; - var value = this.consumeName(); - return { type: 5 /* HASH_TOKEN */, value: value, flags: flags }; - } - break; - case DOLLAR_SIGN: - if (this.peekCodePoint(0) === EQUALS_SIGN) { - this.consumeCodePoint(); - return SUFFIX_MATCH_TOKEN; - } - break; - case APOSTROPHE: - return this.consumeStringToken(APOSTROPHE); - case LEFT_PARENTHESIS: - return LEFT_PARENTHESIS_TOKEN; - case RIGHT_PARENTHESIS: - return RIGHT_PARENTHESIS_TOKEN; - case ASTERISK: - if (this.peekCodePoint(0) === EQUALS_SIGN) { - this.consumeCodePoint(); - return SUBSTRING_MATCH_TOKEN; - } - break; - case PLUS_SIGN: - if (isNumberStart(codePoint, this.peekCodePoint(0), this.peekCodePoint(1))) { - this.reconsumeCodePoint(codePoint); - return this.consumeNumericToken(); - } - break; - case COMMA: - return COMMA_TOKEN; - case HYPHEN_MINUS: - var e1 = codePoint; - var e2 = this.peekCodePoint(0); - var e3 = this.peekCodePoint(1); - if (isNumberStart(e1, e2, e3)) { - this.reconsumeCodePoint(codePoint); - return this.consumeNumericToken(); - } - if (isIdentifierStart(e1, e2, e3)) { - this.reconsumeCodePoint(codePoint); - return this.consumeIdentLikeToken(); - } - if (e2 === HYPHEN_MINUS && e3 === GREATER_THAN_SIGN) { - this.consumeCodePoint(); - this.consumeCodePoint(); - return CDC_TOKEN; - } - break; - case FULL_STOP: - if (isNumberStart(codePoint, this.peekCodePoint(0), this.peekCodePoint(1))) { - this.reconsumeCodePoint(codePoint); - return this.consumeNumericToken(); - } - break; - case SOLIDUS: - if (this.peekCodePoint(0) === ASTERISK) { - this.consumeCodePoint(); - while (true) { - var c = this.consumeCodePoint(); - if (c === ASTERISK) { - c = this.consumeCodePoint(); - if (c === SOLIDUS) { - return this.consumeToken(); - } - } - if (c === EOF) { - return this.consumeToken(); - } - } - } - break; - case COLON: - return COLON_TOKEN; - case SEMICOLON: - return SEMICOLON_TOKEN; - case LESS_THAN_SIGN: - if (this.peekCodePoint(0) === EXCLAMATION_MARK && - this.peekCodePoint(1) === HYPHEN_MINUS && - this.peekCodePoint(2) === HYPHEN_MINUS) { - this.consumeCodePoint(); - this.consumeCodePoint(); - return CDO_TOKEN; - } - break; - case COMMERCIAL_AT: - var a1 = this.peekCodePoint(0); - var a2 = this.peekCodePoint(1); - var a3 = this.peekCodePoint(2); - if (isIdentifierStart(a1, a2, a3)) { - var value = this.consumeName(); - return { type: 7 /* AT_KEYWORD_TOKEN */, value: value }; - } - break; - case LEFT_SQUARE_BRACKET: - return LEFT_SQUARE_BRACKET_TOKEN; - case REVERSE_SOLIDUS: - if (isValidEscape(codePoint, this.peekCodePoint(0))) { - this.reconsumeCodePoint(codePoint); - return this.consumeIdentLikeToken(); - } - break; - case RIGHT_SQUARE_BRACKET: - return RIGHT_SQUARE_BRACKET_TOKEN; - case CIRCUMFLEX_ACCENT: - if (this.peekCodePoint(0) === EQUALS_SIGN) { - this.consumeCodePoint(); - return PREFIX_MATCH_TOKEN; - } - break; - case LEFT_CURLY_BRACKET: - return LEFT_CURLY_BRACKET_TOKEN; - case RIGHT_CURLY_BRACKET: - return RIGHT_CURLY_BRACKET_TOKEN; - case u: - case U: - var u1 = this.peekCodePoint(0); - var u2 = this.peekCodePoint(1); - if (u1 === PLUS_SIGN && (isHex(u2) || u2 === QUESTION_MARK)) { - this.consumeCodePoint(); - this.consumeUnicodeRangeToken(); - } - this.reconsumeCodePoint(codePoint); - return this.consumeIdentLikeToken(); - case VERTICAL_LINE: - if (this.peekCodePoint(0) === EQUALS_SIGN) { - this.consumeCodePoint(); - return DASH_MATCH_TOKEN; - } - if (this.peekCodePoint(0) === VERTICAL_LINE) { - this.consumeCodePoint(); - return COLUMN_TOKEN; - } - break; - case TILDE: - if (this.peekCodePoint(0) === EQUALS_SIGN) { - this.consumeCodePoint(); - return INCLUDE_MATCH_TOKEN; - } - break; - case EOF: - return EOF_TOKEN; - } - if (isWhiteSpace(codePoint)) { - this.consumeWhiteSpace(); - return WHITESPACE_TOKEN; - } - if (isDigit(codePoint)) { - this.reconsumeCodePoint(codePoint); - return this.consumeNumericToken(); - } - if (isNameStartCodePoint(codePoint)) { - this.reconsumeCodePoint(codePoint); - return this.consumeIdentLikeToken(); - } - return { type: 6 /* DELIM_TOKEN */, value: fromCodePoint$1(codePoint) }; - }; - Tokenizer.prototype.consumeCodePoint = function () { - var value = this._value.shift(); - return typeof value === 'undefined' ? -1 : value; - }; - Tokenizer.prototype.reconsumeCodePoint = function (codePoint) { - this._value.unshift(codePoint); - }; - Tokenizer.prototype.peekCodePoint = function (delta) { - if (delta >= this._value.length) { - return -1; - } - return this._value[delta]; - }; - Tokenizer.prototype.consumeUnicodeRangeToken = function () { - var digits = []; - var codePoint = this.consumeCodePoint(); - while (isHex(codePoint) && digits.length < 6) { - digits.push(codePoint); - codePoint = this.consumeCodePoint(); - } - var questionMarks = false; - while (codePoint === QUESTION_MARK && digits.length < 6) { - digits.push(codePoint); - codePoint = this.consumeCodePoint(); - questionMarks = true; - } - if (questionMarks) { - var start_1 = parseInt(fromCodePoint$1.apply(void 0, digits.map(function (digit) { return (digit === QUESTION_MARK ? ZERO : digit); })), 16); - var end = parseInt(fromCodePoint$1.apply(void 0, digits.map(function (digit) { return (digit === QUESTION_MARK ? F : digit); })), 16); - return { type: 30 /* UNICODE_RANGE_TOKEN */, start: start_1, end: end }; - } - var start = parseInt(fromCodePoint$1.apply(void 0, digits), 16); - if (this.peekCodePoint(0) === HYPHEN_MINUS && isHex(this.peekCodePoint(1))) { - this.consumeCodePoint(); - codePoint = this.consumeCodePoint(); - var endDigits = []; - while (isHex(codePoint) && endDigits.length < 6) { - endDigits.push(codePoint); - codePoint = this.consumeCodePoint(); - } - var end = parseInt(fromCodePoint$1.apply(void 0, endDigits), 16); - return { type: 30 /* UNICODE_RANGE_TOKEN */, start: start, end: end }; - } - else { - return { type: 30 /* UNICODE_RANGE_TOKEN */, start: start, end: start }; - } - }; - Tokenizer.prototype.consumeIdentLikeToken = function () { - var value = this.consumeName(); - if (value.toLowerCase() === 'url' && this.peekCodePoint(0) === LEFT_PARENTHESIS) { - this.consumeCodePoint(); - return this.consumeUrlToken(); - } - else if (this.peekCodePoint(0) === LEFT_PARENTHESIS) { - this.consumeCodePoint(); - return { type: 19 /* FUNCTION_TOKEN */, value: value }; - } - return { type: 20 /* IDENT_TOKEN */, value: value }; - }; - Tokenizer.prototype.consumeUrlToken = function () { - var value = []; - this.consumeWhiteSpace(); - if (this.peekCodePoint(0) === EOF) { - return { type: 22 /* URL_TOKEN */, value: '' }; - } - var next = this.peekCodePoint(0); - if (next === APOSTROPHE || next === QUOTATION_MARK) { - var stringToken = this.consumeStringToken(this.consumeCodePoint()); - if (stringToken.type === 0 /* STRING_TOKEN */) { - this.consumeWhiteSpace(); - if (this.peekCodePoint(0) === EOF || this.peekCodePoint(0) === RIGHT_PARENTHESIS) { - this.consumeCodePoint(); - return { type: 22 /* URL_TOKEN */, value: stringToken.value }; - } - } - this.consumeBadUrlRemnants(); - return BAD_URL_TOKEN; - } - while (true) { - var codePoint = this.consumeCodePoint(); - if (codePoint === EOF || codePoint === RIGHT_PARENTHESIS) { - return { type: 22 /* URL_TOKEN */, value: fromCodePoint$1.apply(void 0, value) }; - } - else if (isWhiteSpace(codePoint)) { - this.consumeWhiteSpace(); - if (this.peekCodePoint(0) === EOF || this.peekCodePoint(0) === RIGHT_PARENTHESIS) { - this.consumeCodePoint(); - return { type: 22 /* URL_TOKEN */, value: fromCodePoint$1.apply(void 0, value) }; - } - this.consumeBadUrlRemnants(); - return BAD_URL_TOKEN; - } - else if (codePoint === QUOTATION_MARK || - codePoint === APOSTROPHE || - codePoint === LEFT_PARENTHESIS || - isNonPrintableCodePoint(codePoint)) { - this.consumeBadUrlRemnants(); - return BAD_URL_TOKEN; - } - else if (codePoint === REVERSE_SOLIDUS) { - if (isValidEscape(codePoint, this.peekCodePoint(0))) { - value.push(this.consumeEscapedCodePoint()); - } - else { - this.consumeBadUrlRemnants(); - return BAD_URL_TOKEN; - } - } - else { - value.push(codePoint); - } - } - }; - Tokenizer.prototype.consumeWhiteSpace = function () { - while (isWhiteSpace(this.peekCodePoint(0))) { - this.consumeCodePoint(); - } - }; - Tokenizer.prototype.consumeBadUrlRemnants = function () { - while (true) { - var codePoint = this.consumeCodePoint(); - if (codePoint === RIGHT_PARENTHESIS || codePoint === EOF) { - return; - } - if (isValidEscape(codePoint, this.peekCodePoint(0))) { - this.consumeEscapedCodePoint(); - } - } - }; - Tokenizer.prototype.consumeStringSlice = function (count) { - var SLICE_STACK_SIZE = 50000; - var value = ''; - while (count > 0) { - var amount = Math.min(SLICE_STACK_SIZE, count); - value += fromCodePoint$1.apply(void 0, this._value.splice(0, amount)); - count -= amount; - } - this._value.shift(); - return value; - }; - Tokenizer.prototype.consumeStringToken = function (endingCodePoint) { - var value = ''; - var i = 0; - do { - var codePoint = this._value[i]; - if (codePoint === EOF || codePoint === undefined || codePoint === endingCodePoint) { - value += this.consumeStringSlice(i); - return { type: 0 /* STRING_TOKEN */, value: value }; - } - if (codePoint === LINE_FEED) { - this._value.splice(0, i); - return BAD_STRING_TOKEN; - } - if (codePoint === REVERSE_SOLIDUS) { - var next = this._value[i + 1]; - if (next !== EOF && next !== undefined) { - if (next === LINE_FEED) { - value += this.consumeStringSlice(i); - i = -1; - this._value.shift(); - } - else if (isValidEscape(codePoint, next)) { - value += this.consumeStringSlice(i); - value += fromCodePoint$1(this.consumeEscapedCodePoint()); - i = -1; - } - } - } - i++; - } while (true); - }; - Tokenizer.prototype.consumeNumber = function () { - var repr = []; - var type = FLAG_INTEGER; - var c1 = this.peekCodePoint(0); - if (c1 === PLUS_SIGN || c1 === HYPHEN_MINUS) { - repr.push(this.consumeCodePoint()); - } - while (isDigit(this.peekCodePoint(0))) { - repr.push(this.consumeCodePoint()); - } - c1 = this.peekCodePoint(0); - var c2 = this.peekCodePoint(1); - if (c1 === FULL_STOP && isDigit(c2)) { - repr.push(this.consumeCodePoint(), this.consumeCodePoint()); - type = FLAG_NUMBER; - while (isDigit(this.peekCodePoint(0))) { - repr.push(this.consumeCodePoint()); - } - } - c1 = this.peekCodePoint(0); - c2 = this.peekCodePoint(1); - var c3 = this.peekCodePoint(2); - if ((c1 === E || c1 === e) && (((c2 === PLUS_SIGN || c2 === HYPHEN_MINUS) && isDigit(c3)) || isDigit(c2))) { - repr.push(this.consumeCodePoint(), this.consumeCodePoint()); - type = FLAG_NUMBER; - while (isDigit(this.peekCodePoint(0))) { - repr.push(this.consumeCodePoint()); - } - } - return [stringToNumber(repr), type]; - }; - Tokenizer.prototype.consumeNumericToken = function () { - var _a = this.consumeNumber(), number = _a[0], flags = _a[1]; - var c1 = this.peekCodePoint(0); - var c2 = this.peekCodePoint(1); - var c3 = this.peekCodePoint(2); - if (isIdentifierStart(c1, c2, c3)) { - var unit = this.consumeName(); - return { type: 15 /* DIMENSION_TOKEN */, number: number, flags: flags, unit: unit }; - } - if (c1 === PERCENTAGE_SIGN) { - this.consumeCodePoint(); - return { type: 16 /* PERCENTAGE_TOKEN */, number: number, flags: flags }; - } - return { type: 17 /* NUMBER_TOKEN */, number: number, flags: flags }; - }; - Tokenizer.prototype.consumeEscapedCodePoint = function () { - var codePoint = this.consumeCodePoint(); - if (isHex(codePoint)) { - var hex = fromCodePoint$1(codePoint); - while (isHex(this.peekCodePoint(0)) && hex.length < 6) { - hex += fromCodePoint$1(this.consumeCodePoint()); - } - if (isWhiteSpace(this.peekCodePoint(0))) { - this.consumeCodePoint(); - } - var hexCodePoint = parseInt(hex, 16); - if (hexCodePoint === 0 || isSurrogateCodePoint(hexCodePoint) || hexCodePoint > 0x10ffff) { - return REPLACEMENT_CHARACTER; - } - return hexCodePoint; - } - if (codePoint === EOF) { - return REPLACEMENT_CHARACTER; - } - return codePoint; - }; - Tokenizer.prototype.consumeName = function () { - var result = ''; - while (true) { - var codePoint = this.consumeCodePoint(); - if (isNameCodePoint(codePoint)) { - result += fromCodePoint$1(codePoint); - } - else if (isValidEscape(codePoint, this.peekCodePoint(0))) { - result += fromCodePoint$1(this.consumeEscapedCodePoint()); - } - else { - this.reconsumeCodePoint(codePoint); - return result; - } - } - }; - return Tokenizer; - }()); - - var Parser = /** @class */ (function () { - function Parser(tokens) { - this._tokens = tokens; - } - Parser.create = function (value) { - var tokenizer = new Tokenizer(); - tokenizer.write(value); - return new Parser(tokenizer.read()); - }; - Parser.parseValue = function (value) { - return Parser.create(value).parseComponentValue(); - }; - Parser.parseValues = function (value) { - return Parser.create(value).parseComponentValues(); - }; - Parser.prototype.parseComponentValue = function () { - var token = this.consumeToken(); - while (token.type === 31 /* WHITESPACE_TOKEN */) { - token = this.consumeToken(); - } - if (token.type === 32 /* EOF_TOKEN */) { - throw new SyntaxError("Error parsing CSS component value, unexpected EOF"); - } - this.reconsumeToken(token); - var value = this.consumeComponentValue(); - do { - token = this.consumeToken(); - } while (token.type === 31 /* WHITESPACE_TOKEN */); - if (token.type === 32 /* EOF_TOKEN */) { - return value; - } - throw new SyntaxError("Error parsing CSS component value, multiple values found when expecting only one"); - }; - Parser.prototype.parseComponentValues = function () { - var values = []; - while (true) { - var value = this.consumeComponentValue(); - if (value.type === 32 /* EOF_TOKEN */) { - return values; - } - values.push(value); - values.push(); - } - }; - Parser.prototype.consumeComponentValue = function () { - var token = this.consumeToken(); - switch (token.type) { - case 11 /* LEFT_CURLY_BRACKET_TOKEN */: - case 28 /* LEFT_SQUARE_BRACKET_TOKEN */: - case 2 /* LEFT_PARENTHESIS_TOKEN */: - return this.consumeSimpleBlock(token.type); - case 19 /* FUNCTION_TOKEN */: - return this.consumeFunction(token); - } - return token; - }; - Parser.prototype.consumeSimpleBlock = function (type) { - var block = { type: type, values: [] }; - var token = this.consumeToken(); - while (true) { - if (token.type === 32 /* EOF_TOKEN */ || isEndingTokenFor(token, type)) { - return block; - } - this.reconsumeToken(token); - block.values.push(this.consumeComponentValue()); - token = this.consumeToken(); - } - }; - Parser.prototype.consumeFunction = function (functionToken) { - var cssFunction = { - name: functionToken.value, - values: [], - type: 18 /* FUNCTION */ - }; - while (true) { - var token = this.consumeToken(); - if (token.type === 32 /* EOF_TOKEN */ || token.type === 3 /* RIGHT_PARENTHESIS_TOKEN */) { - return cssFunction; - } - this.reconsumeToken(token); - cssFunction.values.push(this.consumeComponentValue()); - } - }; - Parser.prototype.consumeToken = function () { - var token = this._tokens.shift(); - return typeof token === 'undefined' ? EOF_TOKEN : token; - }; - Parser.prototype.reconsumeToken = function (token) { - this._tokens.unshift(token); - }; - return Parser; - }()); - var isDimensionToken = function (token) { return token.type === 15 /* DIMENSION_TOKEN */; }; - var isNumberToken = function (token) { return token.type === 17 /* NUMBER_TOKEN */; }; - var isIdentToken = function (token) { return token.type === 20 /* IDENT_TOKEN */; }; - var isStringToken = function (token) { return token.type === 0 /* STRING_TOKEN */; }; - var isIdentWithValue = function (token, value) { - return isIdentToken(token) && token.value === value; - }; - var nonWhiteSpace = function (token) { return token.type !== 31 /* WHITESPACE_TOKEN */; }; - var nonFunctionArgSeparator = function (token) { - return token.type !== 31 /* WHITESPACE_TOKEN */ && token.type !== 4 /* COMMA_TOKEN */; - }; - var parseFunctionArgs = function (tokens) { - var args = []; - var arg = []; - tokens.forEach(function (token) { - if (token.type === 4 /* COMMA_TOKEN */) { - if (arg.length === 0) { - throw new Error("Error parsing function args, zero tokens for arg"); - } - args.push(arg); - arg = []; - return; - } - if (token.type !== 31 /* WHITESPACE_TOKEN */) { - arg.push(token); - } - }); - if (arg.length) { - args.push(arg); - } - return args; - }; - var isEndingTokenFor = function (token, type) { - if (type === 11 /* LEFT_CURLY_BRACKET_TOKEN */ && token.type === 12 /* RIGHT_CURLY_BRACKET_TOKEN */) { - return true; - } - if (type === 28 /* LEFT_SQUARE_BRACKET_TOKEN */ && token.type === 29 /* RIGHT_SQUARE_BRACKET_TOKEN */) { - return true; - } - return type === 2 /* LEFT_PARENTHESIS_TOKEN */ && token.type === 3 /* RIGHT_PARENTHESIS_TOKEN */; - }; - - var isLength = function (token) { - return token.type === 17 /* NUMBER_TOKEN */ || token.type === 15 /* DIMENSION_TOKEN */; - }; - - var isLengthPercentage = function (token) { - return token.type === 16 /* PERCENTAGE_TOKEN */ || isLength(token); - }; - var parseLengthPercentageTuple = function (tokens) { - return tokens.length > 1 ? [tokens[0], tokens[1]] : [tokens[0]]; - }; - var ZERO_LENGTH = { - type: 17 /* NUMBER_TOKEN */, - number: 0, - flags: FLAG_INTEGER - }; - var FIFTY_PERCENT = { - type: 16 /* PERCENTAGE_TOKEN */, - number: 50, - flags: FLAG_INTEGER - }; - var HUNDRED_PERCENT = { - type: 16 /* PERCENTAGE_TOKEN */, - number: 100, - flags: FLAG_INTEGER - }; - var getAbsoluteValueForTuple = function (tuple, width, height) { - var x = tuple[0], y = tuple[1]; - return [getAbsoluteValue(x, width), getAbsoluteValue(typeof y !== 'undefined' ? y : x, height)]; - }; - var getAbsoluteValue = function (token, parent) { - if (token.type === 16 /* PERCENTAGE_TOKEN */) { - return (token.number / 100) * parent; - } - if (isDimensionToken(token)) { - switch (token.unit) { - case 'rem': - case 'em': - return 16 * token.number; // TODO use correct font-size - case 'px': - default: - return token.number; - } - } - return token.number; - }; - - var DEG = 'deg'; - var GRAD = 'grad'; - var RAD = 'rad'; - var TURN = 'turn'; - var angle = { - name: 'angle', - parse: function (_context, value) { - if (value.type === 15 /* DIMENSION_TOKEN */) { - switch (value.unit) { - case DEG: - return (Math.PI * value.number) / 180; - case GRAD: - return (Math.PI / 200) * value.number; - case RAD: - return value.number; - case TURN: - return Math.PI * 2 * value.number; - } - } - throw new Error("Unsupported angle type"); - } - }; - var isAngle = function (value) { - if (value.type === 15 /* DIMENSION_TOKEN */) { - if (value.unit === DEG || value.unit === GRAD || value.unit === RAD || value.unit === TURN) { - return true; - } - } - return false; - }; - var parseNamedSide = function (tokens) { - var sideOrCorner = tokens - .filter(isIdentToken) - .map(function (ident) { return ident.value; }) - .join(' '); - switch (sideOrCorner) { - case 'to bottom right': - case 'to right bottom': - case 'left top': - case 'top left': - return [ZERO_LENGTH, ZERO_LENGTH]; - case 'to top': - case 'bottom': - return deg(0); - case 'to bottom left': - case 'to left bottom': - case 'right top': - case 'top right': - return [ZERO_LENGTH, HUNDRED_PERCENT]; - case 'to right': - case 'left': - return deg(90); - case 'to top left': - case 'to left top': - case 'right bottom': - case 'bottom right': - return [HUNDRED_PERCENT, HUNDRED_PERCENT]; - case 'to bottom': - case 'top': - return deg(180); - case 'to top right': - case 'to right top': - case 'left bottom': - case 'bottom left': - return [HUNDRED_PERCENT, ZERO_LENGTH]; - case 'to left': - case 'right': - return deg(270); - } - return 0; - }; - var deg = function (deg) { return (Math.PI * deg) / 180; }; - - var color$1 = { - name: 'color', - parse: function (context, value) { - if (value.type === 18 /* FUNCTION */) { - var colorFunction = SUPPORTED_COLOR_FUNCTIONS[value.name]; - if (typeof colorFunction === 'undefined') { - throw new Error("Attempting to parse an unsupported color function \"" + value.name + "\""); - } - return colorFunction(context, value.values); - } - if (value.type === 5 /* HASH_TOKEN */) { - if (value.value.length === 3) { - var r = value.value.substring(0, 1); - var g = value.value.substring(1, 2); - var b = value.value.substring(2, 3); - return pack(parseInt(r + r, 16), parseInt(g + g, 16), parseInt(b + b, 16), 1); - } - if (value.value.length === 4) { - var r = value.value.substring(0, 1); - var g = value.value.substring(1, 2); - var b = value.value.substring(2, 3); - var a = value.value.substring(3, 4); - return pack(parseInt(r + r, 16), parseInt(g + g, 16), parseInt(b + b, 16), parseInt(a + a, 16) / 255); - } - if (value.value.length === 6) { - var r = value.value.substring(0, 2); - var g = value.value.substring(2, 4); - var b = value.value.substring(4, 6); - return pack(parseInt(r, 16), parseInt(g, 16), parseInt(b, 16), 1); - } - if (value.value.length === 8) { - var r = value.value.substring(0, 2); - var g = value.value.substring(2, 4); - var b = value.value.substring(4, 6); - var a = value.value.substring(6, 8); - return pack(parseInt(r, 16), parseInt(g, 16), parseInt(b, 16), parseInt(a, 16) / 255); - } - } - if (value.type === 20 /* IDENT_TOKEN */) { - var namedColor = COLORS[value.value.toUpperCase()]; - if (typeof namedColor !== 'undefined') { - return namedColor; - } - } - return COLORS.TRANSPARENT; - } - }; - var isTransparent = function (color) { return (0xff & color) === 0; }; - var asString = function (color) { - var alpha = 0xff & color; - var blue = 0xff & (color >> 8); - var green = 0xff & (color >> 16); - var red = 0xff & (color >> 24); - return alpha < 255 ? "rgba(" + red + "," + green + "," + blue + "," + alpha / 255 + ")" : "rgb(" + red + "," + green + "," + blue + ")"; - }; - var pack = function (r, g, b, a) { - return ((r << 24) | (g << 16) | (b << 8) | (Math.round(a * 255) << 0)) >>> 0; - }; - var getTokenColorValue = function (token, i) { - if (token.type === 17 /* NUMBER_TOKEN */) { - return token.number; - } - if (token.type === 16 /* PERCENTAGE_TOKEN */) { - var max = i === 3 ? 1 : 255; - return i === 3 ? (token.number / 100) * max : Math.round((token.number / 100) * max); - } - return 0; - }; - var rgb = function (_context, args) { - var tokens = args.filter(nonFunctionArgSeparator); - if (tokens.length === 3) { - var _a = tokens.map(getTokenColorValue), r = _a[0], g = _a[1], b = _a[2]; - return pack(r, g, b, 1); - } - if (tokens.length === 4) { - var _b = tokens.map(getTokenColorValue), r = _b[0], g = _b[1], b = _b[2], a = _b[3]; - return pack(r, g, b, a); - } - return 0; - }; - function hue2rgb(t1, t2, hue) { - if (hue < 0) { - hue += 1; - } - if (hue >= 1) { - hue -= 1; - } - if (hue < 1 / 6) { - return (t2 - t1) * hue * 6 + t1; - } - else if (hue < 1 / 2) { - return t2; - } - else if (hue < 2 / 3) { - return (t2 - t1) * 6 * (2 / 3 - hue) + t1; - } - else { - return t1; - } - } - var hsl = function (context, args) { - var tokens = args.filter(nonFunctionArgSeparator); - var hue = tokens[0], saturation = tokens[1], lightness = tokens[2], alpha = tokens[3]; - var h = (hue.type === 17 /* NUMBER_TOKEN */ ? deg(hue.number) : angle.parse(context, hue)) / (Math.PI * 2); - var s = isLengthPercentage(saturation) ? saturation.number / 100 : 0; - var l = isLengthPercentage(lightness) ? lightness.number / 100 : 0; - var a = typeof alpha !== 'undefined' && isLengthPercentage(alpha) ? getAbsoluteValue(alpha, 1) : 1; - if (s === 0) { - return pack(l * 255, l * 255, l * 255, 1); - } - var t2 = l <= 0.5 ? l * (s + 1) : l + s - l * s; - var t1 = l * 2 - t2; - var r = hue2rgb(t1, t2, h + 1 / 3); - var g = hue2rgb(t1, t2, h); - var b = hue2rgb(t1, t2, h - 1 / 3); - return pack(r * 255, g * 255, b * 255, a); - }; - var SUPPORTED_COLOR_FUNCTIONS = { - hsl: hsl, - hsla: hsl, - rgb: rgb, - rgba: rgb - }; - var parseColor = function (context, value) { - return color$1.parse(context, Parser.create(value).parseComponentValue()); - }; - var COLORS = { - ALICEBLUE: 0xf0f8ffff, - ANTIQUEWHITE: 0xfaebd7ff, - AQUA: 0x00ffffff, - AQUAMARINE: 0x7fffd4ff, - AZURE: 0xf0ffffff, - BEIGE: 0xf5f5dcff, - BISQUE: 0xffe4c4ff, - BLACK: 0x000000ff, - BLANCHEDALMOND: 0xffebcdff, - BLUE: 0x0000ffff, - BLUEVIOLET: 0x8a2be2ff, - BROWN: 0xa52a2aff, - BURLYWOOD: 0xdeb887ff, - CADETBLUE: 0x5f9ea0ff, - CHARTREUSE: 0x7fff00ff, - CHOCOLATE: 0xd2691eff, - CORAL: 0xff7f50ff, - CORNFLOWERBLUE: 0x6495edff, - CORNSILK: 0xfff8dcff, - CRIMSON: 0xdc143cff, - CYAN: 0x00ffffff, - DARKBLUE: 0x00008bff, - DARKCYAN: 0x008b8bff, - DARKGOLDENROD: 0xb886bbff, - DARKGRAY: 0xa9a9a9ff, - DARKGREEN: 0x006400ff, - DARKGREY: 0xa9a9a9ff, - DARKKHAKI: 0xbdb76bff, - DARKMAGENTA: 0x8b008bff, - DARKOLIVEGREEN: 0x556b2fff, - DARKORANGE: 0xff8c00ff, - DARKORCHID: 0x9932ccff, - DARKRED: 0x8b0000ff, - DARKSALMON: 0xe9967aff, - DARKSEAGREEN: 0x8fbc8fff, - DARKSLATEBLUE: 0x483d8bff, - DARKSLATEGRAY: 0x2f4f4fff, - DARKSLATEGREY: 0x2f4f4fff, - DARKTURQUOISE: 0x00ced1ff, - DARKVIOLET: 0x9400d3ff, - DEEPPINK: 0xff1493ff, - DEEPSKYBLUE: 0x00bfffff, - DIMGRAY: 0x696969ff, - DIMGREY: 0x696969ff, - DODGERBLUE: 0x1e90ffff, - FIREBRICK: 0xb22222ff, - FLORALWHITE: 0xfffaf0ff, - FORESTGREEN: 0x228b22ff, - FUCHSIA: 0xff00ffff, - GAINSBORO: 0xdcdcdcff, - GHOSTWHITE: 0xf8f8ffff, - GOLD: 0xffd700ff, - GOLDENROD: 0xdaa520ff, - GRAY: 0x808080ff, - GREEN: 0x008000ff, - GREENYELLOW: 0xadff2fff, - GREY: 0x808080ff, - HONEYDEW: 0xf0fff0ff, - HOTPINK: 0xff69b4ff, - INDIANRED: 0xcd5c5cff, - INDIGO: 0x4b0082ff, - IVORY: 0xfffff0ff, - KHAKI: 0xf0e68cff, - LAVENDER: 0xe6e6faff, - LAVENDERBLUSH: 0xfff0f5ff, - LAWNGREEN: 0x7cfc00ff, - LEMONCHIFFON: 0xfffacdff, - LIGHTBLUE: 0xadd8e6ff, - LIGHTCORAL: 0xf08080ff, - LIGHTCYAN: 0xe0ffffff, - LIGHTGOLDENRODYELLOW: 0xfafad2ff, - LIGHTGRAY: 0xd3d3d3ff, - LIGHTGREEN: 0x90ee90ff, - LIGHTGREY: 0xd3d3d3ff, - LIGHTPINK: 0xffb6c1ff, - LIGHTSALMON: 0xffa07aff, - LIGHTSEAGREEN: 0x20b2aaff, - LIGHTSKYBLUE: 0x87cefaff, - LIGHTSLATEGRAY: 0x778899ff, - LIGHTSLATEGREY: 0x778899ff, - LIGHTSTEELBLUE: 0xb0c4deff, - LIGHTYELLOW: 0xffffe0ff, - LIME: 0x00ff00ff, - LIMEGREEN: 0x32cd32ff, - LINEN: 0xfaf0e6ff, - MAGENTA: 0xff00ffff, - MAROON: 0x800000ff, - MEDIUMAQUAMARINE: 0x66cdaaff, - MEDIUMBLUE: 0x0000cdff, - MEDIUMORCHID: 0xba55d3ff, - MEDIUMPURPLE: 0x9370dbff, - MEDIUMSEAGREEN: 0x3cb371ff, - MEDIUMSLATEBLUE: 0x7b68eeff, - MEDIUMSPRINGGREEN: 0x00fa9aff, - MEDIUMTURQUOISE: 0x48d1ccff, - MEDIUMVIOLETRED: 0xc71585ff, - MIDNIGHTBLUE: 0x191970ff, - MINTCREAM: 0xf5fffaff, - MISTYROSE: 0xffe4e1ff, - MOCCASIN: 0xffe4b5ff, - NAVAJOWHITE: 0xffdeadff, - NAVY: 0x000080ff, - OLDLACE: 0xfdf5e6ff, - OLIVE: 0x808000ff, - OLIVEDRAB: 0x6b8e23ff, - ORANGE: 0xffa500ff, - ORANGERED: 0xff4500ff, - ORCHID: 0xda70d6ff, - PALEGOLDENROD: 0xeee8aaff, - PALEGREEN: 0x98fb98ff, - PALETURQUOISE: 0xafeeeeff, - PALEVIOLETRED: 0xdb7093ff, - PAPAYAWHIP: 0xffefd5ff, - PEACHPUFF: 0xffdab9ff, - PERU: 0xcd853fff, - PINK: 0xffc0cbff, - PLUM: 0xdda0ddff, - POWDERBLUE: 0xb0e0e6ff, - PURPLE: 0x800080ff, - REBECCAPURPLE: 0x663399ff, - RED: 0xff0000ff, - ROSYBROWN: 0xbc8f8fff, - ROYALBLUE: 0x4169e1ff, - SADDLEBROWN: 0x8b4513ff, - SALMON: 0xfa8072ff, - SANDYBROWN: 0xf4a460ff, - SEAGREEN: 0x2e8b57ff, - SEASHELL: 0xfff5eeff, - SIENNA: 0xa0522dff, - SILVER: 0xc0c0c0ff, - SKYBLUE: 0x87ceebff, - SLATEBLUE: 0x6a5acdff, - SLATEGRAY: 0x708090ff, - SLATEGREY: 0x708090ff, - SNOW: 0xfffafaff, - SPRINGGREEN: 0x00ff7fff, - STEELBLUE: 0x4682b4ff, - TAN: 0xd2b48cff, - TEAL: 0x008080ff, - THISTLE: 0xd8bfd8ff, - TOMATO: 0xff6347ff, - TRANSPARENT: 0x00000000, - TURQUOISE: 0x40e0d0ff, - VIOLET: 0xee82eeff, - WHEAT: 0xf5deb3ff, - WHITE: 0xffffffff, - WHITESMOKE: 0xf5f5f5ff, - YELLOW: 0xffff00ff, - YELLOWGREEN: 0x9acd32ff - }; - - var backgroundClip = { - name: 'background-clip', - initialValue: 'border-box', - prefix: false, - type: 1 /* LIST */, - parse: function (_context, tokens) { - return tokens.map(function (token) { - if (isIdentToken(token)) { - switch (token.value) { - case 'padding-box': - return 1 /* PADDING_BOX */; - case 'content-box': - return 2 /* CONTENT_BOX */; - } - } - return 0 /* BORDER_BOX */; - }); - } - }; - - var backgroundColor = { - name: "background-color", - initialValue: 'transparent', - prefix: false, - type: 3 /* TYPE_VALUE */, - format: 'color' - }; - - var parseColorStop = function (context, args) { - var color = color$1.parse(context, args[0]); - var stop = args[1]; - return stop && isLengthPercentage(stop) ? { color: color, stop: stop } : { color: color, stop: null }; - }; - var processColorStops = function (stops, lineLength) { - var first = stops[0]; - var last = stops[stops.length - 1]; - if (first.stop === null) { - first.stop = ZERO_LENGTH; - } - if (last.stop === null) { - last.stop = HUNDRED_PERCENT; - } - var processStops = []; - var previous = 0; - for (var i = 0; i < stops.length; i++) { - var stop_1 = stops[i].stop; - if (stop_1 !== null) { - var absoluteValue = getAbsoluteValue(stop_1, lineLength); - if (absoluteValue > previous) { - processStops.push(absoluteValue); - } - else { - processStops.push(previous); - } - previous = absoluteValue; - } - else { - processStops.push(null); - } - } - var gapBegin = null; - for (var i = 0; i < processStops.length; i++) { - var stop_2 = processStops[i]; - if (stop_2 === null) { - if (gapBegin === null) { - gapBegin = i; - } - } - else if (gapBegin !== null) { - var gapLength = i - gapBegin; - var beforeGap = processStops[gapBegin - 1]; - var gapValue = (stop_2 - beforeGap) / (gapLength + 1); - for (var g = 1; g <= gapLength; g++) { - processStops[gapBegin + g - 1] = gapValue * g; - } - gapBegin = null; - } - } - return stops.map(function (_a, i) { - var color = _a.color; - return { color: color, stop: Math.max(Math.min(1, processStops[i] / lineLength), 0) }; - }); - }; - var getAngleFromCorner = function (corner, width, height) { - var centerX = width / 2; - var centerY = height / 2; - var x = getAbsoluteValue(corner[0], width) - centerX; - var y = centerY - getAbsoluteValue(corner[1], height); - return (Math.atan2(y, x) + Math.PI * 2) % (Math.PI * 2); - }; - var calculateGradientDirection = function (angle, width, height) { - var radian = typeof angle === 'number' ? angle : getAngleFromCorner(angle, width, height); - var lineLength = Math.abs(width * Math.sin(radian)) + Math.abs(height * Math.cos(radian)); - var halfWidth = width / 2; - var halfHeight = height / 2; - var halfLineLength = lineLength / 2; - var yDiff = Math.sin(radian - Math.PI / 2) * halfLineLength; - var xDiff = Math.cos(radian - Math.PI / 2) * halfLineLength; - return [lineLength, halfWidth - xDiff, halfWidth + xDiff, halfHeight - yDiff, halfHeight + yDiff]; - }; - var distance = function (a, b) { return Math.sqrt(a * a + b * b); }; - var findCorner = function (width, height, x, y, closest) { - var corners = [ - [0, 0], - [0, height], - [width, 0], - [width, height] - ]; - return corners.reduce(function (stat, corner) { - var cx = corner[0], cy = corner[1]; - var d = distance(x - cx, y - cy); - if (closest ? d < stat.optimumDistance : d > stat.optimumDistance) { - return { - optimumCorner: corner, - optimumDistance: d - }; - } - return stat; - }, { - optimumDistance: closest ? Infinity : -Infinity, - optimumCorner: null - }).optimumCorner; - }; - var calculateRadius = function (gradient, x, y, width, height) { - var rx = 0; - var ry = 0; - switch (gradient.size) { - case 0 /* CLOSEST_SIDE */: - // The ending shape is sized so that that it exactly meets the side of the gradient box closest to the gradient’s center. - // If the shape is an ellipse, it exactly meets the closest side in each dimension. - if (gradient.shape === 0 /* CIRCLE */) { - rx = ry = Math.min(Math.abs(x), Math.abs(x - width), Math.abs(y), Math.abs(y - height)); - } - else if (gradient.shape === 1 /* ELLIPSE */) { - rx = Math.min(Math.abs(x), Math.abs(x - width)); - ry = Math.min(Math.abs(y), Math.abs(y - height)); - } - break; - case 2 /* CLOSEST_CORNER */: - // The ending shape is sized so that that it passes through the corner of the gradient box closest to the gradient’s center. - // If the shape is an ellipse, the ending shape is given the same aspect-ratio it would have if closest-side were specified. - if (gradient.shape === 0 /* CIRCLE */) { - rx = ry = Math.min(distance(x, y), distance(x, y - height), distance(x - width, y), distance(x - width, y - height)); - } - else if (gradient.shape === 1 /* ELLIPSE */) { - // Compute the ratio ry/rx (which is to be the same as for "closest-side") - var c = Math.min(Math.abs(y), Math.abs(y - height)) / Math.min(Math.abs(x), Math.abs(x - width)); - var _a = findCorner(width, height, x, y, true), cx = _a[0], cy = _a[1]; - rx = distance(cx - x, (cy - y) / c); - ry = c * rx; - } - break; - case 1 /* FARTHEST_SIDE */: - // Same as closest-side, except the ending shape is sized based on the farthest side(s) - if (gradient.shape === 0 /* CIRCLE */) { - rx = ry = Math.max(Math.abs(x), Math.abs(x - width), Math.abs(y), Math.abs(y - height)); - } - else if (gradient.shape === 1 /* ELLIPSE */) { - rx = Math.max(Math.abs(x), Math.abs(x - width)); - ry = Math.max(Math.abs(y), Math.abs(y - height)); - } - break; - case 3 /* FARTHEST_CORNER */: - // Same as closest-corner, except the ending shape is sized based on the farthest corner. - // If the shape is an ellipse, the ending shape is given the same aspect ratio it would have if farthest-side were specified. - if (gradient.shape === 0 /* CIRCLE */) { - rx = ry = Math.max(distance(x, y), distance(x, y - height), distance(x - width, y), distance(x - width, y - height)); - } - else if (gradient.shape === 1 /* ELLIPSE */) { - // Compute the ratio ry/rx (which is to be the same as for "farthest-side") - var c = Math.max(Math.abs(y), Math.abs(y - height)) / Math.max(Math.abs(x), Math.abs(x - width)); - var _b = findCorner(width, height, x, y, false), cx = _b[0], cy = _b[1]; - rx = distance(cx - x, (cy - y) / c); - ry = c * rx; - } - break; - } - if (Array.isArray(gradient.size)) { - rx = getAbsoluteValue(gradient.size[0], width); - ry = gradient.size.length === 2 ? getAbsoluteValue(gradient.size[1], height) : rx; - } - return [rx, ry]; - }; - - var linearGradient = function (context, tokens) { - var angle$1 = deg(180); - var stops = []; - parseFunctionArgs(tokens).forEach(function (arg, i) { - if (i === 0) { - var firstToken = arg[0]; - if (firstToken.type === 20 /* IDENT_TOKEN */ && firstToken.value === 'to') { - angle$1 = parseNamedSide(arg); - return; - } - else if (isAngle(firstToken)) { - angle$1 = angle.parse(context, firstToken); - return; - } - } - var colorStop = parseColorStop(context, arg); - stops.push(colorStop); - }); - return { angle: angle$1, stops: stops, type: 1 /* LINEAR_GRADIENT */ }; - }; - - var prefixLinearGradient = function (context, tokens) { - var angle$1 = deg(180); - var stops = []; - parseFunctionArgs(tokens).forEach(function (arg, i) { - if (i === 0) { - var firstToken = arg[0]; - if (firstToken.type === 20 /* IDENT_TOKEN */ && - ['top', 'left', 'right', 'bottom'].indexOf(firstToken.value) !== -1) { - angle$1 = parseNamedSide(arg); - return; - } - else if (isAngle(firstToken)) { - angle$1 = (angle.parse(context, firstToken) + deg(270)) % deg(360); - return; - } - } - var colorStop = parseColorStop(context, arg); - stops.push(colorStop); - }); - return { - angle: angle$1, - stops: stops, - type: 1 /* LINEAR_GRADIENT */ - }; - }; - - var webkitGradient = function (context, tokens) { - var angle = deg(180); - var stops = []; - var type = 1 /* LINEAR_GRADIENT */; - var shape = 0 /* CIRCLE */; - var size = 3 /* FARTHEST_CORNER */; - var position = []; - parseFunctionArgs(tokens).forEach(function (arg, i) { - var firstToken = arg[0]; - if (i === 0) { - if (isIdentToken(firstToken) && firstToken.value === 'linear') { - type = 1 /* LINEAR_GRADIENT */; - return; - } - else if (isIdentToken(firstToken) && firstToken.value === 'radial') { - type = 2 /* RADIAL_GRADIENT */; - return; - } - } - if (firstToken.type === 18 /* FUNCTION */) { - if (firstToken.name === 'from') { - var color = color$1.parse(context, firstToken.values[0]); - stops.push({ stop: ZERO_LENGTH, color: color }); - } - else if (firstToken.name === 'to') { - var color = color$1.parse(context, firstToken.values[0]); - stops.push({ stop: HUNDRED_PERCENT, color: color }); - } - else if (firstToken.name === 'color-stop') { - var values = firstToken.values.filter(nonFunctionArgSeparator); - if (values.length === 2) { - var color = color$1.parse(context, values[1]); - var stop_1 = values[0]; - if (isNumberToken(stop_1)) { - stops.push({ - stop: { type: 16 /* PERCENTAGE_TOKEN */, number: stop_1.number * 100, flags: stop_1.flags }, - color: color - }); - } - } - } - } - }); - return type === 1 /* LINEAR_GRADIENT */ - ? { - angle: (angle + deg(180)) % deg(360), - stops: stops, - type: type - } - : { size: size, shape: shape, stops: stops, position: position, type: type }; - }; - - var CLOSEST_SIDE = 'closest-side'; - var FARTHEST_SIDE = 'farthest-side'; - var CLOSEST_CORNER = 'closest-corner'; - var FARTHEST_CORNER = 'farthest-corner'; - var CIRCLE = 'circle'; - var ELLIPSE = 'ellipse'; - var COVER = 'cover'; - var CONTAIN = 'contain'; - var radialGradient = function (context, tokens) { - var shape = 0 /* CIRCLE */; - var size = 3 /* FARTHEST_CORNER */; - var stops = []; - var position = []; - parseFunctionArgs(tokens).forEach(function (arg, i) { - var isColorStop = true; - if (i === 0) { - var isAtPosition_1 = false; - isColorStop = arg.reduce(function (acc, token) { - if (isAtPosition_1) { - if (isIdentToken(token)) { - switch (token.value) { - case 'center': - position.push(FIFTY_PERCENT); - return acc; - case 'top': - case 'left': - position.push(ZERO_LENGTH); - return acc; - case 'right': - case 'bottom': - position.push(HUNDRED_PERCENT); - return acc; - } - } - else if (isLengthPercentage(token) || isLength(token)) { - position.push(token); - } - } - else if (isIdentToken(token)) { - switch (token.value) { - case CIRCLE: - shape = 0 /* CIRCLE */; - return false; - case ELLIPSE: - shape = 1 /* ELLIPSE */; - return false; - case 'at': - isAtPosition_1 = true; - return false; - case CLOSEST_SIDE: - size = 0 /* CLOSEST_SIDE */; - return false; - case COVER: - case FARTHEST_SIDE: - size = 1 /* FARTHEST_SIDE */; - return false; - case CONTAIN: - case CLOSEST_CORNER: - size = 2 /* CLOSEST_CORNER */; - return false; - case FARTHEST_CORNER: - size = 3 /* FARTHEST_CORNER */; - return false; - } - } - else if (isLength(token) || isLengthPercentage(token)) { - if (!Array.isArray(size)) { - size = []; - } - size.push(token); - return false; - } - return acc; - }, isColorStop); - } - if (isColorStop) { - var colorStop = parseColorStop(context, arg); - stops.push(colorStop); - } - }); - return { size: size, shape: shape, stops: stops, position: position, type: 2 /* RADIAL_GRADIENT */ }; - }; - - var prefixRadialGradient = function (context, tokens) { - var shape = 0 /* CIRCLE */; - var size = 3 /* FARTHEST_CORNER */; - var stops = []; - var position = []; - parseFunctionArgs(tokens).forEach(function (arg, i) { - var isColorStop = true; - if (i === 0) { - isColorStop = arg.reduce(function (acc, token) { - if (isIdentToken(token)) { - switch (token.value) { - case 'center': - position.push(FIFTY_PERCENT); - return false; - case 'top': - case 'left': - position.push(ZERO_LENGTH); - return false; - case 'right': - case 'bottom': - position.push(HUNDRED_PERCENT); - return false; - } - } - else if (isLengthPercentage(token) || isLength(token)) { - position.push(token); - return false; - } - return acc; - }, isColorStop); - } - else if (i === 1) { - isColorStop = arg.reduce(function (acc, token) { - if (isIdentToken(token)) { - switch (token.value) { - case CIRCLE: - shape = 0 /* CIRCLE */; - return false; - case ELLIPSE: - shape = 1 /* ELLIPSE */; - return false; - case CONTAIN: - case CLOSEST_SIDE: - size = 0 /* CLOSEST_SIDE */; - return false; - case FARTHEST_SIDE: - size = 1 /* FARTHEST_SIDE */; - return false; - case CLOSEST_CORNER: - size = 2 /* CLOSEST_CORNER */; - return false; - case COVER: - case FARTHEST_CORNER: - size = 3 /* FARTHEST_CORNER */; - return false; - } - } - else if (isLength(token) || isLengthPercentage(token)) { - if (!Array.isArray(size)) { - size = []; - } - size.push(token); - return false; - } - return acc; - }, isColorStop); - } - if (isColorStop) { - var colorStop = parseColorStop(context, arg); - stops.push(colorStop); - } - }); - return { size: size, shape: shape, stops: stops, position: position, type: 2 /* RADIAL_GRADIENT */ }; - }; - - var isLinearGradient = function (background) { - return background.type === 1 /* LINEAR_GRADIENT */; - }; - var isRadialGradient = function (background) { - return background.type === 2 /* RADIAL_GRADIENT */; - }; - var image = { - name: 'image', - parse: function (context, value) { - if (value.type === 22 /* URL_TOKEN */) { - var image_1 = { url: value.value, type: 0 /* URL */ }; - context.cache.addImage(value.value); - return image_1; - } - if (value.type === 18 /* FUNCTION */) { - var imageFunction = SUPPORTED_IMAGE_FUNCTIONS[value.name]; - if (typeof imageFunction === 'undefined') { - throw new Error("Attempting to parse an unsupported image function \"" + value.name + "\""); - } - return imageFunction(context, value.values); - } - throw new Error("Unsupported image type " + value.type); - } - }; - function isSupportedImage(value) { - return (!(value.type === 20 /* IDENT_TOKEN */ && value.value === 'none') && - (value.type !== 18 /* FUNCTION */ || !!SUPPORTED_IMAGE_FUNCTIONS[value.name])); - } - var SUPPORTED_IMAGE_FUNCTIONS = { - 'linear-gradient': linearGradient, - '-moz-linear-gradient': prefixLinearGradient, - '-ms-linear-gradient': prefixLinearGradient, - '-o-linear-gradient': prefixLinearGradient, - '-webkit-linear-gradient': prefixLinearGradient, - 'radial-gradient': radialGradient, - '-moz-radial-gradient': prefixRadialGradient, - '-ms-radial-gradient': prefixRadialGradient, - '-o-radial-gradient': prefixRadialGradient, - '-webkit-radial-gradient': prefixRadialGradient, - '-webkit-gradient': webkitGradient - }; - - var backgroundImage = { - name: 'background-image', - initialValue: 'none', - type: 1 /* LIST */, - prefix: false, - parse: function (context, tokens) { - if (tokens.length === 0) { - return []; - } - var first = tokens[0]; - if (first.type === 20 /* IDENT_TOKEN */ && first.value === 'none') { - return []; - } - return tokens - .filter(function (value) { return nonFunctionArgSeparator(value) && isSupportedImage(value); }) - .map(function (value) { return image.parse(context, value); }); - } - }; - - var backgroundOrigin = { - name: 'background-origin', - initialValue: 'border-box', - prefix: false, - type: 1 /* LIST */, - parse: function (_context, tokens) { - return tokens.map(function (token) { - if (isIdentToken(token)) { - switch (token.value) { - case 'padding-box': - return 1 /* PADDING_BOX */; - case 'content-box': - return 2 /* CONTENT_BOX */; - } - } - return 0 /* BORDER_BOX */; - }); - } - }; - - var backgroundPosition = { - name: 'background-position', - initialValue: '0% 0%', - type: 1 /* LIST */, - prefix: false, - parse: function (_context, tokens) { - return parseFunctionArgs(tokens) - .map(function (values) { return values.filter(isLengthPercentage); }) - .map(parseLengthPercentageTuple); - } - }; - - var backgroundRepeat = { - name: 'background-repeat', - initialValue: 'repeat', - prefix: false, - type: 1 /* LIST */, - parse: function (_context, tokens) { - return parseFunctionArgs(tokens) - .map(function (values) { - return values - .filter(isIdentToken) - .map(function (token) { return token.value; }) - .join(' '); - }) - .map(parseBackgroundRepeat); - } - }; - var parseBackgroundRepeat = function (value) { - switch (value) { - case 'no-repeat': - return 1 /* NO_REPEAT */; - case 'repeat-x': - case 'repeat no-repeat': - return 2 /* REPEAT_X */; - case 'repeat-y': - case 'no-repeat repeat': - return 3 /* REPEAT_Y */; - case 'repeat': - default: - return 0 /* REPEAT */; - } - }; - - var BACKGROUND_SIZE; - (function (BACKGROUND_SIZE) { - BACKGROUND_SIZE["AUTO"] = "auto"; - BACKGROUND_SIZE["CONTAIN"] = "contain"; - BACKGROUND_SIZE["COVER"] = "cover"; - })(BACKGROUND_SIZE || (BACKGROUND_SIZE = {})); - var backgroundSize = { - name: 'background-size', - initialValue: '0', - prefix: false, - type: 1 /* LIST */, - parse: function (_context, tokens) { - return parseFunctionArgs(tokens).map(function (values) { return values.filter(isBackgroundSizeInfoToken); }); - } - }; - var isBackgroundSizeInfoToken = function (value) { - return isIdentToken(value) || isLengthPercentage(value); - }; - - var borderColorForSide = function (side) { return ({ - name: "border-" + side + "-color", - initialValue: 'transparent', - prefix: false, - type: 3 /* TYPE_VALUE */, - format: 'color' - }); }; - var borderTopColor = borderColorForSide('top'); - var borderRightColor = borderColorForSide('right'); - var borderBottomColor = borderColorForSide('bottom'); - var borderLeftColor = borderColorForSide('left'); - - var borderRadiusForSide = function (side) { return ({ - name: "border-radius-" + side, - initialValue: '0 0', - prefix: false, - type: 1 /* LIST */, - parse: function (_context, tokens) { - return parseLengthPercentageTuple(tokens.filter(isLengthPercentage)); - } - }); }; - var borderTopLeftRadius = borderRadiusForSide('top-left'); - var borderTopRightRadius = borderRadiusForSide('top-right'); - var borderBottomRightRadius = borderRadiusForSide('bottom-right'); - var borderBottomLeftRadius = borderRadiusForSide('bottom-left'); - - var borderStyleForSide = function (side) { return ({ - name: "border-" + side + "-style", - initialValue: 'solid', - prefix: false, - type: 2 /* IDENT_VALUE */, - parse: function (_context, style) { - switch (style) { - case 'none': - return 0 /* NONE */; - case 'dashed': - return 2 /* DASHED */; - case 'dotted': - return 3 /* DOTTED */; - case 'double': - return 4 /* DOUBLE */; - } - return 1 /* SOLID */; - } - }); }; - var borderTopStyle = borderStyleForSide('top'); - var borderRightStyle = borderStyleForSide('right'); - var borderBottomStyle = borderStyleForSide('bottom'); - var borderLeftStyle = borderStyleForSide('left'); - - var borderWidthForSide = function (side) { return ({ - name: "border-" + side + "-width", - initialValue: '0', - type: 0 /* VALUE */, - prefix: false, - parse: function (_context, token) { - if (isDimensionToken(token)) { - return token.number; - } - return 0; - } - }); }; - var borderTopWidth = borderWidthForSide('top'); - var borderRightWidth = borderWidthForSide('right'); - var borderBottomWidth = borderWidthForSide('bottom'); - var borderLeftWidth = borderWidthForSide('left'); - - var color = { - name: "color", - initialValue: 'transparent', - prefix: false, - type: 3 /* TYPE_VALUE */, - format: 'color' - }; - - var direction = { - name: 'direction', - initialValue: 'ltr', - prefix: false, - type: 2 /* IDENT_VALUE */, - parse: function (_context, direction) { - switch (direction) { - case 'rtl': - return 1 /* RTL */; - case 'ltr': - default: - return 0 /* LTR */; - } - } - }; - - var display = { - name: 'display', - initialValue: 'inline-block', - prefix: false, - type: 1 /* LIST */, - parse: function (_context, tokens) { - return tokens.filter(isIdentToken).reduce(function (bit, token) { - return bit | parseDisplayValue(token.value); - }, 0 /* NONE */); - } - }; - var parseDisplayValue = function (display) { - switch (display) { - case 'block': - case '-webkit-box': - return 2 /* BLOCK */; - case 'inline': - return 4 /* INLINE */; - case 'run-in': - return 8 /* RUN_IN */; - case 'flow': - return 16 /* FLOW */; - case 'flow-root': - return 32 /* FLOW_ROOT */; - case 'table': - return 64 /* TABLE */; - case 'flex': - case '-webkit-flex': - return 128 /* FLEX */; - case 'grid': - case '-ms-grid': - return 256 /* GRID */; - case 'ruby': - return 512 /* RUBY */; - case 'subgrid': - return 1024 /* SUBGRID */; - case 'list-item': - return 2048 /* LIST_ITEM */; - case 'table-row-group': - return 4096 /* TABLE_ROW_GROUP */; - case 'table-header-group': - return 8192 /* TABLE_HEADER_GROUP */; - case 'table-footer-group': - return 16384 /* TABLE_FOOTER_GROUP */; - case 'table-row': - return 32768 /* TABLE_ROW */; - case 'table-cell': - return 65536 /* TABLE_CELL */; - case 'table-column-group': - return 131072 /* TABLE_COLUMN_GROUP */; - case 'table-column': - return 262144 /* TABLE_COLUMN */; - case 'table-caption': - return 524288 /* TABLE_CAPTION */; - case 'ruby-base': - return 1048576 /* RUBY_BASE */; - case 'ruby-text': - return 2097152 /* RUBY_TEXT */; - case 'ruby-base-container': - return 4194304 /* RUBY_BASE_CONTAINER */; - case 'ruby-text-container': - return 8388608 /* RUBY_TEXT_CONTAINER */; - case 'contents': - return 16777216 /* CONTENTS */; - case 'inline-block': - return 33554432 /* INLINE_BLOCK */; - case 'inline-list-item': - return 67108864 /* INLINE_LIST_ITEM */; - case 'inline-table': - return 134217728 /* INLINE_TABLE */; - case 'inline-flex': - return 268435456 /* INLINE_FLEX */; - case 'inline-grid': - return 536870912 /* INLINE_GRID */; - } - return 0 /* NONE */; - }; - - var float = { - name: 'float', - initialValue: 'none', - prefix: false, - type: 2 /* IDENT_VALUE */, - parse: function (_context, float) { - switch (float) { - case 'left': - return 1 /* LEFT */; - case 'right': - return 2 /* RIGHT */; - case 'inline-start': - return 3 /* INLINE_START */; - case 'inline-end': - return 4 /* INLINE_END */; - } - return 0 /* NONE */; - } - }; - - var letterSpacing = { - name: 'letter-spacing', - initialValue: '0', - prefix: false, - type: 0 /* VALUE */, - parse: function (_context, token) { - if (token.type === 20 /* IDENT_TOKEN */ && token.value === 'normal') { - return 0; - } - if (token.type === 17 /* NUMBER_TOKEN */) { - return token.number; - } - if (token.type === 15 /* DIMENSION_TOKEN */) { - return token.number; - } - return 0; - } - }; - - var LINE_BREAK; - (function (LINE_BREAK) { - LINE_BREAK["NORMAL"] = "normal"; - LINE_BREAK["STRICT"] = "strict"; - })(LINE_BREAK || (LINE_BREAK = {})); - var lineBreak = { - name: 'line-break', - initialValue: 'normal', - prefix: false, - type: 2 /* IDENT_VALUE */, - parse: function (_context, lineBreak) { - switch (lineBreak) { - case 'strict': - return LINE_BREAK.STRICT; - case 'normal': - default: - return LINE_BREAK.NORMAL; - } - } - }; - - var lineHeight = { - name: 'line-height', - initialValue: 'normal', - prefix: false, - type: 4 /* TOKEN_VALUE */ - }; - var computeLineHeight = function (token, fontSize) { - if (isIdentToken(token) && token.value === 'normal') { - return 1.2 * fontSize; - } - else if (token.type === 17 /* NUMBER_TOKEN */) { - return fontSize * token.number; - } - else if (isLengthPercentage(token)) { - return getAbsoluteValue(token, fontSize); - } - return fontSize; - }; - - var listStyleImage = { - name: 'list-style-image', - initialValue: 'none', - type: 0 /* VALUE */, - prefix: false, - parse: function (context, token) { - if (token.type === 20 /* IDENT_TOKEN */ && token.value === 'none') { - return null; - } - return image.parse(context, token); - } - }; - - var listStylePosition = { - name: 'list-style-position', - initialValue: 'outside', - prefix: false, - type: 2 /* IDENT_VALUE */, - parse: function (_context, position) { - switch (position) { - case 'inside': - return 0 /* INSIDE */; - case 'outside': - default: - return 1 /* OUTSIDE */; - } - } - }; - - var listStyleType = { - name: 'list-style-type', - initialValue: 'none', - prefix: false, - type: 2 /* IDENT_VALUE */, - parse: function (_context, type) { - switch (type) { - case 'disc': - return 0 /* DISC */; - case 'circle': - return 1 /* CIRCLE */; - case 'square': - return 2 /* SQUARE */; - case 'decimal': - return 3 /* DECIMAL */; - case 'cjk-decimal': - return 4 /* CJK_DECIMAL */; - case 'decimal-leading-zero': - return 5 /* DECIMAL_LEADING_ZERO */; - case 'lower-roman': - return 6 /* LOWER_ROMAN */; - case 'upper-roman': - return 7 /* UPPER_ROMAN */; - case 'lower-greek': - return 8 /* LOWER_GREEK */; - case 'lower-alpha': - return 9 /* LOWER_ALPHA */; - case 'upper-alpha': - return 10 /* UPPER_ALPHA */; - case 'arabic-indic': - return 11 /* ARABIC_INDIC */; - case 'armenian': - return 12 /* ARMENIAN */; - case 'bengali': - return 13 /* BENGALI */; - case 'cambodian': - return 14 /* CAMBODIAN */; - case 'cjk-earthly-branch': - return 15 /* CJK_EARTHLY_BRANCH */; - case 'cjk-heavenly-stem': - return 16 /* CJK_HEAVENLY_STEM */; - case 'cjk-ideographic': - return 17 /* CJK_IDEOGRAPHIC */; - case 'devanagari': - return 18 /* DEVANAGARI */; - case 'ethiopic-numeric': - return 19 /* ETHIOPIC_NUMERIC */; - case 'georgian': - return 20 /* GEORGIAN */; - case 'gujarati': - return 21 /* GUJARATI */; - case 'gurmukhi': - return 22 /* GURMUKHI */; - case 'hebrew': - return 22 /* HEBREW */; - case 'hiragana': - return 23 /* HIRAGANA */; - case 'hiragana-iroha': - return 24 /* HIRAGANA_IROHA */; - case 'japanese-formal': - return 25 /* JAPANESE_FORMAL */; - case 'japanese-informal': - return 26 /* JAPANESE_INFORMAL */; - case 'kannada': - return 27 /* KANNADA */; - case 'katakana': - return 28 /* KATAKANA */; - case 'katakana-iroha': - return 29 /* KATAKANA_IROHA */; - case 'khmer': - return 30 /* KHMER */; - case 'korean-hangul-formal': - return 31 /* KOREAN_HANGUL_FORMAL */; - case 'korean-hanja-formal': - return 32 /* KOREAN_HANJA_FORMAL */; - case 'korean-hanja-informal': - return 33 /* KOREAN_HANJA_INFORMAL */; - case 'lao': - return 34 /* LAO */; - case 'lower-armenian': - return 35 /* LOWER_ARMENIAN */; - case 'malayalam': - return 36 /* MALAYALAM */; - case 'mongolian': - return 37 /* MONGOLIAN */; - case 'myanmar': - return 38 /* MYANMAR */; - case 'oriya': - return 39 /* ORIYA */; - case 'persian': - return 40 /* PERSIAN */; - case 'simp-chinese-formal': - return 41 /* SIMP_CHINESE_FORMAL */; - case 'simp-chinese-informal': - return 42 /* SIMP_CHINESE_INFORMAL */; - case 'tamil': - return 43 /* TAMIL */; - case 'telugu': - return 44 /* TELUGU */; - case 'thai': - return 45 /* THAI */; - case 'tibetan': - return 46 /* TIBETAN */; - case 'trad-chinese-formal': - return 47 /* TRAD_CHINESE_FORMAL */; - case 'trad-chinese-informal': - return 48 /* TRAD_CHINESE_INFORMAL */; - case 'upper-armenian': - return 49 /* UPPER_ARMENIAN */; - case 'disclosure-open': - return 50 /* DISCLOSURE_OPEN */; - case 'disclosure-closed': - return 51 /* DISCLOSURE_CLOSED */; - case 'none': - default: - return -1 /* NONE */; - } - } - }; - - var marginForSide = function (side) { return ({ - name: "margin-" + side, - initialValue: '0', - prefix: false, - type: 4 /* TOKEN_VALUE */ - }); }; - var marginTop = marginForSide('top'); - var marginRight = marginForSide('right'); - var marginBottom = marginForSide('bottom'); - var marginLeft = marginForSide('left'); - - var overflow = { - name: 'overflow', - initialValue: 'visible', - prefix: false, - type: 1 /* LIST */, - parse: function (_context, tokens) { - return tokens.filter(isIdentToken).map(function (overflow) { - switch (overflow.value) { - case 'hidden': - return 1 /* HIDDEN */; - case 'scroll': - return 2 /* SCROLL */; - case 'clip': - return 3 /* CLIP */; - case 'auto': - return 4 /* AUTO */; - case 'visible': - default: - return 0 /* VISIBLE */; - } - }); - } - }; - - var overflowWrap = { - name: 'overflow-wrap', - initialValue: 'normal', - prefix: false, - type: 2 /* IDENT_VALUE */, - parse: function (_context, overflow) { - switch (overflow) { - case 'break-word': - return "break-word" /* BREAK_WORD */; - case 'normal': - default: - return "normal" /* NORMAL */; - } - } - }; - - var paddingForSide = function (side) { return ({ - name: "padding-" + side, - initialValue: '0', - prefix: false, - type: 3 /* TYPE_VALUE */, - format: 'length-percentage' - }); }; - var paddingTop = paddingForSide('top'); - var paddingRight = paddingForSide('right'); - var paddingBottom = paddingForSide('bottom'); - var paddingLeft = paddingForSide('left'); - - var textAlign = { - name: 'text-align', - initialValue: 'left', - prefix: false, - type: 2 /* IDENT_VALUE */, - parse: function (_context, textAlign) { - switch (textAlign) { - case 'right': - return 2 /* RIGHT */; - case 'center': - case 'justify': - return 1 /* CENTER */; - case 'left': - default: - return 0 /* LEFT */; - } - } - }; - - var position = { - name: 'position', - initialValue: 'static', - prefix: false, - type: 2 /* IDENT_VALUE */, - parse: function (_context, position) { - switch (position) { - case 'relative': - return 1 /* RELATIVE */; - case 'absolute': - return 2 /* ABSOLUTE */; - case 'fixed': - return 3 /* FIXED */; - case 'sticky': - return 4 /* STICKY */; - } - return 0 /* STATIC */; - } - }; - - var textShadow = { - name: 'text-shadow', - initialValue: 'none', - type: 1 /* LIST */, - prefix: false, - parse: function (context, tokens) { - if (tokens.length === 1 && isIdentWithValue(tokens[0], 'none')) { - return []; - } - return parseFunctionArgs(tokens).map(function (values) { - var shadow = { - color: COLORS.TRANSPARENT, - offsetX: ZERO_LENGTH, - offsetY: ZERO_LENGTH, - blur: ZERO_LENGTH - }; - var c = 0; - for (var i = 0; i < values.length; i++) { - var token = values[i]; - if (isLength(token)) { - if (c === 0) { - shadow.offsetX = token; - } - else if (c === 1) { - shadow.offsetY = token; - } - else { - shadow.blur = token; - } - c++; - } - else { - shadow.color = color$1.parse(context, token); - } - } - return shadow; - }); - } - }; - - var textTransform = { - name: 'text-transform', - initialValue: 'none', - prefix: false, - type: 2 /* IDENT_VALUE */, - parse: function (_context, textTransform) { - switch (textTransform) { - case 'uppercase': - return 2 /* UPPERCASE */; - case 'lowercase': - return 1 /* LOWERCASE */; - case 'capitalize': - return 3 /* CAPITALIZE */; - } - return 0 /* NONE */; - } - }; - - var transform$1 = { - name: 'transform', - initialValue: 'none', - prefix: true, - type: 0 /* VALUE */, - parse: function (_context, token) { - if (token.type === 20 /* IDENT_TOKEN */ && token.value === 'none') { - return null; - } - if (token.type === 18 /* FUNCTION */) { - var transformFunction = SUPPORTED_TRANSFORM_FUNCTIONS[token.name]; - if (typeof transformFunction === 'undefined') { - throw new Error("Attempting to parse an unsupported transform function \"" + token.name + "\""); - } - return transformFunction(token.values); - } - return null; - } - }; - var matrix = function (args) { - var values = args.filter(function (arg) { return arg.type === 17 /* NUMBER_TOKEN */; }).map(function (arg) { return arg.number; }); - return values.length === 6 ? values : null; - }; - // doesn't support 3D transforms at the moment - var matrix3d = function (args) { - var values = args.filter(function (arg) { return arg.type === 17 /* NUMBER_TOKEN */; }).map(function (arg) { return arg.number; }); - var a1 = values[0], b1 = values[1]; values[2]; values[3]; var a2 = values[4], b2 = values[5]; values[6]; values[7]; values[8]; values[9]; values[10]; values[11]; var a4 = values[12], b4 = values[13]; values[14]; values[15]; - return values.length === 16 ? [a1, b1, a2, b2, a4, b4] : null; - }; - var SUPPORTED_TRANSFORM_FUNCTIONS = { - matrix: matrix, - matrix3d: matrix3d - }; - - var DEFAULT_VALUE = { - type: 16 /* PERCENTAGE_TOKEN */, - number: 50, - flags: FLAG_INTEGER - }; - var DEFAULT = [DEFAULT_VALUE, DEFAULT_VALUE]; - var transformOrigin = { - name: 'transform-origin', - initialValue: '50% 50%', - prefix: true, - type: 1 /* LIST */, - parse: function (_context, tokens) { - var origins = tokens.filter(isLengthPercentage); - if (origins.length !== 2) { - return DEFAULT; - } - return [origins[0], origins[1]]; - } - }; - - var visibility = { - name: 'visible', - initialValue: 'none', - prefix: false, - type: 2 /* IDENT_VALUE */, - parse: function (_context, visibility) { - switch (visibility) { - case 'hidden': - return 1 /* HIDDEN */; - case 'collapse': - return 2 /* COLLAPSE */; - case 'visible': - default: - return 0 /* VISIBLE */; - } - } - }; - - var WORD_BREAK; - (function (WORD_BREAK) { - WORD_BREAK["NORMAL"] = "normal"; - WORD_BREAK["BREAK_ALL"] = "break-all"; - WORD_BREAK["KEEP_ALL"] = "keep-all"; - })(WORD_BREAK || (WORD_BREAK = {})); - var wordBreak = { - name: 'word-break', - initialValue: 'normal', - prefix: false, - type: 2 /* IDENT_VALUE */, - parse: function (_context, wordBreak) { - switch (wordBreak) { - case 'break-all': - return WORD_BREAK.BREAK_ALL; - case 'keep-all': - return WORD_BREAK.KEEP_ALL; - case 'normal': - default: - return WORD_BREAK.NORMAL; - } - } - }; - - var zIndex = { - name: 'z-index', - initialValue: 'auto', - prefix: false, - type: 0 /* VALUE */, - parse: function (_context, token) { - if (token.type === 20 /* IDENT_TOKEN */) { - return { auto: true, order: 0 }; - } - if (isNumberToken(token)) { - return { auto: false, order: token.number }; - } - throw new Error("Invalid z-index number parsed"); - } - }; - - var time = { - name: 'time', - parse: function (_context, value) { - if (value.type === 15 /* DIMENSION_TOKEN */) { - switch (value.unit.toLowerCase()) { - case 's': - return 1000 * value.number; - case 'ms': - return value.number; - } - } - throw new Error("Unsupported time type"); - } - }; - - var opacity = { - name: 'opacity', - initialValue: '1', - type: 0 /* VALUE */, - prefix: false, - parse: function (_context, token) { - if (isNumberToken(token)) { - return token.number; - } - return 1; - } - }; - - var textDecorationColor = { - name: "text-decoration-color", - initialValue: 'transparent', - prefix: false, - type: 3 /* TYPE_VALUE */, - format: 'color' - }; - - var textDecorationLine = { - name: 'text-decoration-line', - initialValue: 'none', - prefix: false, - type: 1 /* LIST */, - parse: function (_context, tokens) { - return tokens - .filter(isIdentToken) - .map(function (token) { - switch (token.value) { - case 'underline': - return 1 /* UNDERLINE */; - case 'overline': - return 2 /* OVERLINE */; - case 'line-through': - return 3 /* LINE_THROUGH */; - case 'none': - return 4 /* BLINK */; - } - return 0 /* NONE */; - }) - .filter(function (line) { return line !== 0 /* NONE */; }); - } - }; - - var fontFamily = { - name: "font-family", - initialValue: '', - prefix: false, - type: 1 /* LIST */, - parse: function (_context, tokens) { - var accumulator = []; - var results = []; - tokens.forEach(function (token) { - switch (token.type) { - case 20 /* IDENT_TOKEN */: - case 0 /* STRING_TOKEN */: - accumulator.push(token.value); - break; - case 17 /* NUMBER_TOKEN */: - accumulator.push(token.number.toString()); - break; - case 4 /* COMMA_TOKEN */: - results.push(accumulator.join(' ')); - accumulator.length = 0; - break; - } - }); - if (accumulator.length) { - results.push(accumulator.join(' ')); - } - return results.map(function (result) { return (result.indexOf(' ') === -1 ? result : "'" + result + "'"); }); - } - }; - - var fontSize = { - name: "font-size", - initialValue: '0', - prefix: false, - type: 3 /* TYPE_VALUE */, - format: 'length' - }; - - var fontWeight = { - name: 'font-weight', - initialValue: 'normal', - type: 0 /* VALUE */, - prefix: false, - parse: function (_context, token) { - if (isNumberToken(token)) { - return token.number; - } - if (isIdentToken(token)) { - switch (token.value) { - case 'bold': - return 700; - case 'normal': - default: - return 400; - } - } - return 400; - } - }; - - var fontVariant = { - name: 'font-variant', - initialValue: 'none', - type: 1 /* LIST */, - prefix: false, - parse: function (_context, tokens) { - return tokens.filter(isIdentToken).map(function (token) { return token.value; }); - } - }; - - var fontStyle = { - name: 'font-style', - initialValue: 'normal', - prefix: false, - type: 2 /* IDENT_VALUE */, - parse: function (_context, overflow) { - switch (overflow) { - case 'oblique': - return "oblique" /* OBLIQUE */; - case 'italic': - return "italic" /* ITALIC */; - case 'normal': - default: - return "normal" /* NORMAL */; - } - } - }; - - var contains = function (bit, value) { return (bit & value) !== 0; }; - - var content = { - name: 'content', - initialValue: 'none', - type: 1 /* LIST */, - prefix: false, - parse: function (_context, tokens) { - if (tokens.length === 0) { - return []; - } - var first = tokens[0]; - if (first.type === 20 /* IDENT_TOKEN */ && first.value === 'none') { - return []; - } - return tokens; - } - }; - - var counterIncrement = { - name: 'counter-increment', - initialValue: 'none', - prefix: true, - type: 1 /* LIST */, - parse: function (_context, tokens) { - if (tokens.length === 0) { - return null; - } - var first = tokens[0]; - if (first.type === 20 /* IDENT_TOKEN */ && first.value === 'none') { - return null; - } - var increments = []; - var filtered = tokens.filter(nonWhiteSpace); - for (var i = 0; i < filtered.length; i++) { - var counter = filtered[i]; - var next = filtered[i + 1]; - if (counter.type === 20 /* IDENT_TOKEN */) { - var increment = next && isNumberToken(next) ? next.number : 1; - increments.push({ counter: counter.value, increment: increment }); - } - } - return increments; - } - }; - - var counterReset = { - name: 'counter-reset', - initialValue: 'none', - prefix: true, - type: 1 /* LIST */, - parse: function (_context, tokens) { - if (tokens.length === 0) { - return []; - } - var resets = []; - var filtered = tokens.filter(nonWhiteSpace); - for (var i = 0; i < filtered.length; i++) { - var counter = filtered[i]; - var next = filtered[i + 1]; - if (isIdentToken(counter) && counter.value !== 'none') { - var reset = next && isNumberToken(next) ? next.number : 0; - resets.push({ counter: counter.value, reset: reset }); - } - } - return resets; - } - }; - - var duration = { - name: 'duration', - initialValue: '0s', - prefix: false, - type: 1 /* LIST */, - parse: function (context, tokens) { - return tokens.filter(isDimensionToken).map(function (token) { return time.parse(context, token); }); - } - }; - - var quotes = { - name: 'quotes', - initialValue: 'none', - prefix: true, - type: 1 /* LIST */, - parse: function (_context, tokens) { - if (tokens.length === 0) { - return null; - } - var first = tokens[0]; - if (first.type === 20 /* IDENT_TOKEN */ && first.value === 'none') { - return null; - } - var quotes = []; - var filtered = tokens.filter(isStringToken); - if (filtered.length % 2 !== 0) { - return null; - } - for (var i = 0; i < filtered.length; i += 2) { - var open_1 = filtered[i].value; - var close_1 = filtered[i + 1].value; - quotes.push({ open: open_1, close: close_1 }); - } - return quotes; - } - }; - var getQuote = function (quotes, depth, open) { - if (!quotes) { - return ''; - } - var quote = quotes[Math.min(depth, quotes.length - 1)]; - if (!quote) { - return ''; - } - return open ? quote.open : quote.close; - }; - - var paintOrder = { - name: 'paint-order', - initialValue: 'normal', - prefix: false, - type: 1 /* LIST */, - parse: function (_context, tokens) { - var DEFAULT_VALUE = [0 /* FILL */, 1 /* STROKE */, 2 /* MARKERS */]; - var layers = []; - tokens.filter(isIdentToken).forEach(function (token) { - switch (token.value) { - case 'stroke': - layers.push(1 /* STROKE */); - break; - case 'fill': - layers.push(0 /* FILL */); - break; - case 'markers': - layers.push(2 /* MARKERS */); - break; - } - }); - DEFAULT_VALUE.forEach(function (value) { - if (layers.indexOf(value) === -1) { - layers.push(value); - } - }); - return layers; - } - }; - - var webkitTextStrokeColor = { - name: "-webkit-text-stroke-color", - initialValue: 'currentcolor', - prefix: false, - type: 3 /* TYPE_VALUE */, - format: 'color' - }; - - var webkitTextStrokeWidth = { - name: "-webkit-text-stroke-width", - initialValue: '0', - type: 0 /* VALUE */, - prefix: false, - parse: function (_context, token) { - if (isDimensionToken(token)) { - return token.number; - } - return 0; - } - }; - - var CSSParsedDeclaration = /** @class */ (function () { - function CSSParsedDeclaration(context, declaration) { - var _a, _b; - this.animationDuration = parse(context, duration, declaration.animationDuration); - this.backgroundClip = parse(context, backgroundClip, declaration.backgroundClip); - this.backgroundColor = parse(context, backgroundColor, declaration.backgroundColor); - this.backgroundImage = parse(context, backgroundImage, declaration.backgroundImage); - this.backgroundOrigin = parse(context, backgroundOrigin, declaration.backgroundOrigin); - this.backgroundPosition = parse(context, backgroundPosition, declaration.backgroundPosition); - this.backgroundRepeat = parse(context, backgroundRepeat, declaration.backgroundRepeat); - this.backgroundSize = parse(context, backgroundSize, declaration.backgroundSize); - this.borderTopColor = parse(context, borderTopColor, declaration.borderTopColor); - this.borderRightColor = parse(context, borderRightColor, declaration.borderRightColor); - this.borderBottomColor = parse(context, borderBottomColor, declaration.borderBottomColor); - this.borderLeftColor = parse(context, borderLeftColor, declaration.borderLeftColor); - this.borderTopLeftRadius = parse(context, borderTopLeftRadius, declaration.borderTopLeftRadius); - this.borderTopRightRadius = parse(context, borderTopRightRadius, declaration.borderTopRightRadius); - this.borderBottomRightRadius = parse(context, borderBottomRightRadius, declaration.borderBottomRightRadius); - this.borderBottomLeftRadius = parse(context, borderBottomLeftRadius, declaration.borderBottomLeftRadius); - this.borderTopStyle = parse(context, borderTopStyle, declaration.borderTopStyle); - this.borderRightStyle = parse(context, borderRightStyle, declaration.borderRightStyle); - this.borderBottomStyle = parse(context, borderBottomStyle, declaration.borderBottomStyle); - this.borderLeftStyle = parse(context, borderLeftStyle, declaration.borderLeftStyle); - this.borderTopWidth = parse(context, borderTopWidth, declaration.borderTopWidth); - this.borderRightWidth = parse(context, borderRightWidth, declaration.borderRightWidth); - this.borderBottomWidth = parse(context, borderBottomWidth, declaration.borderBottomWidth); - this.borderLeftWidth = parse(context, borderLeftWidth, declaration.borderLeftWidth); - this.color = parse(context, color, declaration.color); - this.direction = parse(context, direction, declaration.direction); - this.display = parse(context, display, declaration.display); - this.float = parse(context, float, declaration.cssFloat); - this.fontFamily = parse(context, fontFamily, declaration.fontFamily); - this.fontSize = parse(context, fontSize, declaration.fontSize); - this.fontStyle = parse(context, fontStyle, declaration.fontStyle); - this.fontVariant = parse(context, fontVariant, declaration.fontVariant); - this.fontWeight = parse(context, fontWeight, declaration.fontWeight); - this.letterSpacing = parse(context, letterSpacing, declaration.letterSpacing); - this.lineBreak = parse(context, lineBreak, declaration.lineBreak); - this.lineHeight = parse(context, lineHeight, declaration.lineHeight); - this.listStyleImage = parse(context, listStyleImage, declaration.listStyleImage); - this.listStylePosition = parse(context, listStylePosition, declaration.listStylePosition); - this.listStyleType = parse(context, listStyleType, declaration.listStyleType); - this.marginTop = parse(context, marginTop, declaration.marginTop); - this.marginRight = parse(context, marginRight, declaration.marginRight); - this.marginBottom = parse(context, marginBottom, declaration.marginBottom); - this.marginLeft = parse(context, marginLeft, declaration.marginLeft); - this.opacity = parse(context, opacity, declaration.opacity); - var overflowTuple = parse(context, overflow, declaration.overflow); - this.overflowX = overflowTuple[0]; - this.overflowY = overflowTuple[overflowTuple.length > 1 ? 1 : 0]; - this.overflowWrap = parse(context, overflowWrap, declaration.overflowWrap); - this.paddingTop = parse(context, paddingTop, declaration.paddingTop); - this.paddingRight = parse(context, paddingRight, declaration.paddingRight); - this.paddingBottom = parse(context, paddingBottom, declaration.paddingBottom); - this.paddingLeft = parse(context, paddingLeft, declaration.paddingLeft); - this.paintOrder = parse(context, paintOrder, declaration.paintOrder); - this.position = parse(context, position, declaration.position); - this.textAlign = parse(context, textAlign, declaration.textAlign); - this.textDecorationColor = parse(context, textDecorationColor, (_a = declaration.textDecorationColor) !== null && _a !== void 0 ? _a : declaration.color); - this.textDecorationLine = parse(context, textDecorationLine, (_b = declaration.textDecorationLine) !== null && _b !== void 0 ? _b : declaration.textDecoration); - this.textShadow = parse(context, textShadow, declaration.textShadow); - this.textTransform = parse(context, textTransform, declaration.textTransform); - this.transform = parse(context, transform$1, declaration.transform); - this.transformOrigin = parse(context, transformOrigin, declaration.transformOrigin); - this.visibility = parse(context, visibility, declaration.visibility); - this.webkitTextStrokeColor = parse(context, webkitTextStrokeColor, declaration.webkitTextStrokeColor); - this.webkitTextStrokeWidth = parse(context, webkitTextStrokeWidth, declaration.webkitTextStrokeWidth); - this.wordBreak = parse(context, wordBreak, declaration.wordBreak); - this.zIndex = parse(context, zIndex, declaration.zIndex); - } - CSSParsedDeclaration.prototype.isVisible = function () { - return this.display > 0 && this.opacity > 0 && this.visibility === 0 /* VISIBLE */; - }; - CSSParsedDeclaration.prototype.isTransparent = function () { - return isTransparent(this.backgroundColor); - }; - CSSParsedDeclaration.prototype.isTransformed = function () { - return this.transform !== null; - }; - CSSParsedDeclaration.prototype.isPositioned = function () { - return this.position !== 0 /* STATIC */; - }; - CSSParsedDeclaration.prototype.isPositionedWithZIndex = function () { - return this.isPositioned() && !this.zIndex.auto; - }; - CSSParsedDeclaration.prototype.isFloating = function () { - return this.float !== 0 /* NONE */; - }; - CSSParsedDeclaration.prototype.isInlineLevel = function () { - return (contains(this.display, 4 /* INLINE */) || - contains(this.display, 33554432 /* INLINE_BLOCK */) || - contains(this.display, 268435456 /* INLINE_FLEX */) || - contains(this.display, 536870912 /* INLINE_GRID */) || - contains(this.display, 67108864 /* INLINE_LIST_ITEM */) || - contains(this.display, 134217728 /* INLINE_TABLE */)); - }; - return CSSParsedDeclaration; - }()); - var CSSParsedPseudoDeclaration = /** @class */ (function () { - function CSSParsedPseudoDeclaration(context, declaration) { - this.content = parse(context, content, declaration.content); - this.quotes = parse(context, quotes, declaration.quotes); - } - return CSSParsedPseudoDeclaration; - }()); - var CSSParsedCounterDeclaration = /** @class */ (function () { - function CSSParsedCounterDeclaration(context, declaration) { - this.counterIncrement = parse(context, counterIncrement, declaration.counterIncrement); - this.counterReset = parse(context, counterReset, declaration.counterReset); - } - return CSSParsedCounterDeclaration; - }()); - // eslint-disable-next-line @typescript-eslint/no-explicit-any - var parse = function (context, descriptor, style) { - var tokenizer = new Tokenizer(); - var value = style !== null && typeof style !== 'undefined' ? style.toString() : descriptor.initialValue; - tokenizer.write(value); - var parser = new Parser(tokenizer.read()); - switch (descriptor.type) { - case 2 /* IDENT_VALUE */: - var token = parser.parseComponentValue(); - return descriptor.parse(context, isIdentToken(token) ? token.value : descriptor.initialValue); - case 0 /* VALUE */: - return descriptor.parse(context, parser.parseComponentValue()); - case 1 /* LIST */: - return descriptor.parse(context, parser.parseComponentValues()); - case 4 /* TOKEN_VALUE */: - return parser.parseComponentValue(); - case 3 /* TYPE_VALUE */: - switch (descriptor.format) { - case 'angle': - return angle.parse(context, parser.parseComponentValue()); - case 'color': - return color$1.parse(context, parser.parseComponentValue()); - case 'image': - return image.parse(context, parser.parseComponentValue()); - case 'length': - var length_1 = parser.parseComponentValue(); - return isLength(length_1) ? length_1 : ZERO_LENGTH; - case 'length-percentage': - var value_1 = parser.parseComponentValue(); - return isLengthPercentage(value_1) ? value_1 : ZERO_LENGTH; - case 'time': - return time.parse(context, parser.parseComponentValue()); - } - break; - } - }; - - var elementDebuggerAttribute = 'data-html2canvas-debug'; - var getElementDebugType = function (element) { - var attribute = element.getAttribute(elementDebuggerAttribute); - switch (attribute) { - case 'all': - return 1 /* ALL */; - case 'clone': - return 2 /* CLONE */; - case 'parse': - return 3 /* PARSE */; - case 'render': - return 4 /* RENDER */; - default: - return 0 /* NONE */; - } - }; - var isDebugging = function (element, type) { - var elementType = getElementDebugType(element); - return elementType === 1 /* ALL */ || type === elementType; - }; - - var ElementContainer = /** @class */ (function () { - function ElementContainer(context, element) { - this.context = context; - this.textNodes = []; - this.elements = []; - this.flags = 0; - if (isDebugging(element, 3 /* PARSE */)) { - debugger; - } - this.styles = new CSSParsedDeclaration(context, window.getComputedStyle(element, null)); - if (isHTMLElementNode(element)) { - if (this.styles.animationDuration.some(function (duration) { return duration > 0; })) { - element.style.animationDuration = '0s'; - } - if (this.styles.transform !== null) { - // getBoundingClientRect takes transforms into account - element.style.transform = 'none'; - } - } - this.bounds = parseBounds(this.context, element); - if (isDebugging(element, 4 /* RENDER */)) { - this.flags |= 16 /* DEBUG_RENDER */; - } - } - return ElementContainer; - }()); - - /* - * text-segmentation 1.0.3 - * Copyright (c) 2022 Niklas von Hertzen - * Released under MIT License - */ - var base64 = 'AAAAAAAAAAAAEA4AGBkAAFAaAAACAAAAAAAIABAAGAAwADgACAAQAAgAEAAIABAACAAQAAgAEAAIABAACAAQAAgAEAAIABAAQABIAEQATAAIABAACAAQAAgAEAAIABAAVABcAAgAEAAIABAACAAQAGAAaABwAHgAgACIAI4AlgAIABAAmwCjAKgAsAC2AL4AvQDFAMoA0gBPAVYBWgEIAAgACACMANoAYgFkAWwBdAF8AX0BhQGNAZUBlgGeAaMBlQGWAasBswF8AbsBwwF0AcsBYwHTAQgA2wG/AOMBdAF8AekB8QF0AfkB+wHiAHQBfAEIAAMC5gQIAAsCEgIIAAgAFgIeAggAIgIpAggAMQI5AkACygEIAAgASAJQAlgCYAIIAAgACAAKBQoFCgUTBRMFGQUrBSsFCAAIAAgACAAIAAgACAAIAAgACABdAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABoAmgCrwGvAQgAbgJ2AggAHgEIAAgACADnAXsCCAAIAAgAgwIIAAgACAAIAAgACACKAggAkQKZAggAPADJAAgAoQKkAqwCsgK6AsICCADJAggA0AIIAAgACAAIANYC3gIIAAgACAAIAAgACABAAOYCCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAkASoB+QIEAAgACAA8AEMCCABCBQgACABJBVAFCAAIAAgACAAIAAgACAAIAAgACABTBVoFCAAIAFoFCABfBWUFCAAIAAgACAAIAAgAbQUIAAgACAAIAAgACABzBXsFfQWFBYoFigWKBZEFigWKBYoFmAWfBaYFrgWxBbkFCAAIAAgACAAIAAgACAAIAAgACAAIAMEFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAMgFCADQBQgACAAIAAgACAAIAAgACAAIAAgACAAIAO4CCAAIAAgAiQAIAAgACABAAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAD0AggACAD8AggACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIANYFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAC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1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFIQUoBSwFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABtAwgACAAIAAgACAAIAAgACA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wADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAdQMIAAgACAAIAAgACAAIAMkACAAIAAgAfQMIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACFA4kDCAAIAAgACAAIAOcBCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAIcDCAAIAAgACAAIAAgACAAIAAgACAAIAJEDCAAIAAgACADFAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABgBAgAZgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAbAQCBXIECAAIAHkECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABAAJwEQACjBKoEsgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAC6BMIECAAIAAgACAAIAAgACABmBAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAxwQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAGYECAAIAAgAzgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBd0FXwUIAOIF6gXxBYoF3gT5BQAGCAaKBYoFigWKBYoFigWKBYoFigWKBYoFigX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AAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAA='; - - /* - * utrie 1.0.2 - * Copyright (c) 2022 Niklas von Hertzen - * Released under MIT License - */ - var chars$1 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; - // Use a lookup table to find the index. - var lookup$1 = typeof Uint8Array === 'undefined' ? [] : new Uint8Array(256); - for (var i$1 = 0; i$1 < chars$1.length; i$1++) { - lookup$1[chars$1.charCodeAt(i$1)] = i$1; - } - var decode = function (base64) { - var bufferLength = base64.length * 0.75, len = base64.length, i, p = 0, encoded1, encoded2, encoded3, encoded4; - if (base64[base64.length - 1] === '=') { - bufferLength--; - if (base64[base64.length - 2] === '=') { - bufferLength--; - } - } - var buffer = typeof ArrayBuffer !== 'undefined' && - typeof Uint8Array !== 'undefined' && - typeof Uint8Array.prototype.slice !== 'undefined' - ? new ArrayBuffer(bufferLength) - : new Array(bufferLength); - var bytes = Array.isArray(buffer) ? buffer : new Uint8Array(buffer); - for (i = 0; i < len; i += 4) { - encoded1 = lookup$1[base64.charCodeAt(i)]; - encoded2 = lookup$1[base64.charCodeAt(i + 1)]; - encoded3 = lookup$1[base64.charCodeAt(i + 2)]; - encoded4 = lookup$1[base64.charCodeAt(i + 3)]; - bytes[p++] = (encoded1 << 2) | (encoded2 >> 4); - bytes[p++] = ((encoded2 & 15) << 4) | (encoded3 >> 2); - bytes[p++] = ((encoded3 & 3) << 6) | (encoded4 & 63); - } - return buffer; - }; - var polyUint16Array = function (buffer) { - var length = buffer.length; - var bytes = []; - for (var i = 0; i < length; i += 2) { - bytes.push((buffer[i + 1] << 8) | buffer[i]); - } - return bytes; - }; - var polyUint32Array = function (buffer) { - var length = buffer.length; - var bytes = []; - for (var i = 0; i < length; i += 4) { - bytes.push((buffer[i + 3] << 24) | (buffer[i + 2] << 16) | (buffer[i + 1] << 8) | buffer[i]); - } - return bytes; - }; - - /** Shift size for getting the index-2 table offset. */ - var UTRIE2_SHIFT_2 = 5; - /** Shift size for getting the index-1 table offset. */ - var UTRIE2_SHIFT_1 = 6 + 5; - /** - * Shift size for shifting left the index array values. - * Increases possible data size with 16-bit index values at the cost - * of compactability. - * This requires data blocks to be aligned by UTRIE2_DATA_GRANULARITY. - */ - var UTRIE2_INDEX_SHIFT = 2; - /** - * Difference between the two shift sizes, - * for getting an index-1 offset from an index-2 offset. 6=11-5 - */ - var UTRIE2_SHIFT_1_2 = UTRIE2_SHIFT_1 - UTRIE2_SHIFT_2; - /** - * The part of the index-2 table for U+D800..U+DBFF stores values for - * lead surrogate code _units_ not code _points_. - * Values for lead surrogate code _points_ are indexed with this portion of the table. - * Length=32=0x20=0x400>>UTRIE2_SHIFT_2. (There are 1024=0x400 lead surrogates.) - */ - var UTRIE2_LSCP_INDEX_2_OFFSET = 0x10000 >> UTRIE2_SHIFT_2; - /** Number of entries in a data block. 32=0x20 */ - var UTRIE2_DATA_BLOCK_LENGTH = 1 << UTRIE2_SHIFT_2; - /** Mask for getting the lower bits for the in-data-block offset. */ - var UTRIE2_DATA_MASK = UTRIE2_DATA_BLOCK_LENGTH - 1; - var UTRIE2_LSCP_INDEX_2_LENGTH = 0x400 >> UTRIE2_SHIFT_2; - /** Count the lengths of both BMP pieces. 2080=0x820 */ - var UTRIE2_INDEX_2_BMP_LENGTH = UTRIE2_LSCP_INDEX_2_OFFSET + UTRIE2_LSCP_INDEX_2_LENGTH; - /** - * The 2-byte UTF-8 version of the index-2 table follows at offset 2080=0x820. - * Length 32=0x20 for lead bytes C0..DF, regardless of UTRIE2_SHIFT_2. - */ - var UTRIE2_UTF8_2B_INDEX_2_OFFSET = UTRIE2_INDEX_2_BMP_LENGTH; - var UTRIE2_UTF8_2B_INDEX_2_LENGTH = 0x800 >> 6; /* U+0800 is the first code point after 2-byte UTF-8 */ - /** - * The index-1 table, only used for supplementary code points, at offset 2112=0x840. - * Variable length, for code points up to highStart, where the last single-value range starts. - * Maximum length 512=0x200=0x100000>>UTRIE2_SHIFT_1. - * (For 0x100000 supplementary code points U+10000..U+10ffff.) - * - * The part of the index-2 table for supplementary code points starts - * after this index-1 table. - * - * Both the index-1 table and the following part of the index-2 table - * are omitted completely if there is only BMP data. - */ - var UTRIE2_INDEX_1_OFFSET = UTRIE2_UTF8_2B_INDEX_2_OFFSET + UTRIE2_UTF8_2B_INDEX_2_LENGTH; - /** - * Number of index-1 entries for the BMP. 32=0x20 - * This part of the index-1 table is omitted from the serialized form. - */ - var UTRIE2_OMITTED_BMP_INDEX_1_LENGTH = 0x10000 >> UTRIE2_SHIFT_1; - /** Number of entries in an index-2 block. 64=0x40 */ - var UTRIE2_INDEX_2_BLOCK_LENGTH = 1 << UTRIE2_SHIFT_1_2; - /** Mask for getting the lower bits for the in-index-2-block offset. */ - var UTRIE2_INDEX_2_MASK = UTRIE2_INDEX_2_BLOCK_LENGTH - 1; - var slice16 = function (view, start, end) { - if (view.slice) { - return view.slice(start, end); - } - return new Uint16Array(Array.prototype.slice.call(view, start, end)); - }; - var slice32 = function (view, start, end) { - if (view.slice) { - return view.slice(start, end); - } - return new Uint32Array(Array.prototype.slice.call(view, start, end)); - }; - var createTrieFromBase64 = function (base64, _byteLength) { - var buffer = decode(base64); - var view32 = Array.isArray(buffer) ? polyUint32Array(buffer) : new Uint32Array(buffer); - var view16 = Array.isArray(buffer) ? polyUint16Array(buffer) : new Uint16Array(buffer); - var headerLength = 24; - var index = slice16(view16, headerLength / 2, view32[4] / 2); - var data = view32[5] === 2 - ? slice16(view16, (headerLength + view32[4]) / 2) - : slice32(view32, Math.ceil((headerLength + view32[4]) / 4)); - return new Trie(view32[0], view32[1], view32[2], view32[3], index, data); - }; - var Trie = /** @class */ (function () { - function Trie(initialValue, errorValue, highStart, highValueIndex, index, data) { - this.initialValue = initialValue; - this.errorValue = errorValue; - this.highStart = highStart; - this.highValueIndex = highValueIndex; - this.index = index; - this.data = data; - } - /** - * Get the value for a code point as stored in the Trie. - * - * @param codePoint the code point - * @return the value - */ - Trie.prototype.get = function (codePoint) { - var ix; - if (codePoint >= 0) { - if (codePoint < 0x0d800 || (codePoint > 0x0dbff && codePoint <= 0x0ffff)) { - // Ordinary BMP code point, excluding leading surrogates. - // BMP uses a single level lookup. BMP index starts at offset 0 in the Trie2 index. - // 16 bit data is stored in the index array itself. - ix = this.index[codePoint >> UTRIE2_SHIFT_2]; - ix = (ix << UTRIE2_INDEX_SHIFT) + (codePoint & UTRIE2_DATA_MASK); - return this.data[ix]; - } - if (codePoint <= 0xffff) { - // Lead Surrogate Code Point. A Separate index section is stored for - // lead surrogate code units and code points. - // The main index has the code unit data. - // For this function, we need the code point data. - // Note: this expression could be refactored for slightly improved efficiency, but - // surrogate code points will be so rare in practice that it's not worth it. - ix = this.index[UTRIE2_LSCP_INDEX_2_OFFSET + ((codePoint - 0xd800) >> UTRIE2_SHIFT_2)]; - ix = (ix << UTRIE2_INDEX_SHIFT) + (codePoint & UTRIE2_DATA_MASK); - return this.data[ix]; - } - if (codePoint < this.highStart) { - // Supplemental code point, use two-level lookup. - ix = UTRIE2_INDEX_1_OFFSET - UTRIE2_OMITTED_BMP_INDEX_1_LENGTH + (codePoint >> UTRIE2_SHIFT_1); - ix = this.index[ix]; - ix += (codePoint >> UTRIE2_SHIFT_2) & UTRIE2_INDEX_2_MASK; - ix = this.index[ix]; - ix = (ix << UTRIE2_INDEX_SHIFT) + (codePoint & UTRIE2_DATA_MASK); - return this.data[ix]; - } - if (codePoint <= 0x10ffff) { - return this.data[this.highValueIndex]; - } - } - // Fall through. The code point is outside of the legal range of 0..0x10ffff. - return this.errorValue; - }; - return Trie; - }()); - - /* - * base64-arraybuffer 1.0.2 - * Copyright (c) 2022 Niklas von Hertzen - * Released under MIT License - */ - var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; - // Use a lookup table to find the index. - var lookup = typeof Uint8Array === 'undefined' ? [] : new Uint8Array(256); - for (var i = 0; i < chars.length; i++) { - lookup[chars.charCodeAt(i)] = i; - } - - var Prepend = 1; - var CR = 2; - var LF = 3; - var Control = 4; - var Extend = 5; - var SpacingMark = 7; - var L = 8; - var V = 9; - var T = 10; - var LV = 11; - var LVT = 12; - var ZWJ = 13; - var Extended_Pictographic = 14; - var RI = 15; - var toCodePoints = function (str) { - var codePoints = []; - var i = 0; - var length = str.length; - while (i < length) { - var value = str.charCodeAt(i++); - if (value >= 0xd800 && value <= 0xdbff && i < length) { - var extra = str.charCodeAt(i++); - if ((extra & 0xfc00) === 0xdc00) { - codePoints.push(((value & 0x3ff) << 10) + (extra & 0x3ff) + 0x10000); - } - else { - codePoints.push(value); - i--; - } - } - else { - codePoints.push(value); - } - } - return codePoints; - }; - var fromCodePoint = function () { - var codePoints = []; - for (var _i = 0; _i < arguments.length; _i++) { - codePoints[_i] = arguments[_i]; - } - if (String.fromCodePoint) { - return String.fromCodePoint.apply(String, codePoints); - } - var length = codePoints.length; - if (!length) { - return ''; - } - var codeUnits = []; - var index = -1; - var result = ''; - while (++index < length) { - var codePoint = codePoints[index]; - if (codePoint <= 0xffff) { - codeUnits.push(codePoint); - } - else { - codePoint -= 0x10000; - codeUnits.push((codePoint >> 10) + 0xd800, (codePoint % 0x400) + 0xdc00); - } - if (index + 1 === length || codeUnits.length > 0x4000) { - result += String.fromCharCode.apply(String, codeUnits); - codeUnits.length = 0; - } - } - return result; - }; - var UnicodeTrie = createTrieFromBase64(base64); - var BREAK_NOT_ALLOWED = '×'; - var BREAK_ALLOWED = '÷'; - var codePointToClass = function (codePoint) { return UnicodeTrie.get(codePoint); }; - var _graphemeBreakAtIndex = function (_codePoints, classTypes, index) { - var prevIndex = index - 2; - var prev = classTypes[prevIndex]; - var current = classTypes[index - 1]; - var next = classTypes[index]; - // GB3 Do not break between a CR and LF - if (current === CR && next === LF) { - return BREAK_NOT_ALLOWED; - } - // GB4 Otherwise, break before and after controls. - if (current === CR || current === LF || current === Control) { - return BREAK_ALLOWED; - } - // GB5 - if (next === CR || next === LF || next === Control) { - return BREAK_ALLOWED; - } - // Do not break Hangul syllable sequences. - // GB6 - if (current === L && [L, V, LV, LVT].indexOf(next) !== -1) { - return BREAK_NOT_ALLOWED; - } - // GB7 - if ((current === LV || current === V) && (next === V || next === T)) { - return BREAK_NOT_ALLOWED; - } - // GB8 - if ((current === LVT || current === T) && next === T) { - return BREAK_NOT_ALLOWED; - } - // GB9 Do not break before extending characters or ZWJ. - if (next === ZWJ || next === Extend) { - return BREAK_NOT_ALLOWED; - } - // Do not break before SpacingMarks, or after Prepend characters. - // GB9a - if (next === SpacingMark) { - return BREAK_NOT_ALLOWED; - } - // GB9a - if (current === Prepend) { - return BREAK_NOT_ALLOWED; - } - // GB11 Do not break within emoji modifier sequences or emoji zwj sequences. - if (current === ZWJ && next === Extended_Pictographic) { - while (prev === Extend) { - prev = classTypes[--prevIndex]; - } - if (prev === Extended_Pictographic) { - return BREAK_NOT_ALLOWED; - } - } - // GB12 Do not break within emoji flag sequences. - // That is, do not break between regional indicator (RI) symbols - // if there is an odd number of RI characters before the break point. - if (current === RI && next === RI) { - var countRI = 0; - while (prev === RI) { - countRI++; - prev = classTypes[--prevIndex]; - } - if (countRI % 2 === 0) { - return BREAK_NOT_ALLOWED; - } - } - return BREAK_ALLOWED; - }; - var GraphemeBreaker = function (str) { - var codePoints = toCodePoints(str); - var length = codePoints.length; - var index = 0; - var lastEnd = 0; - var classTypes = codePoints.map(codePointToClass); - return { - next: function () { - if (index >= length) { - return { done: true, value: null }; - } - var graphemeBreak = BREAK_NOT_ALLOWED; - while (index < length && - (graphemeBreak = _graphemeBreakAtIndex(codePoints, classTypes, ++index)) === BREAK_NOT_ALLOWED) { } - if (graphemeBreak !== BREAK_NOT_ALLOWED || index === length) { - var value = fromCodePoint.apply(null, codePoints.slice(lastEnd, index)); - lastEnd = index; - return { value: value, done: false }; - } - return { done: true, value: null }; - }, - }; - }; - var splitGraphemes = function (str) { - var breaker = GraphemeBreaker(str); - var graphemes = []; - var bk; - while (!(bk = breaker.next()).done) { - if (bk.value) { - graphemes.push(bk.value.slice()); - } - } - return graphemes; - }; - - var testRangeBounds = function (document) { - var TEST_HEIGHT = 123; - if (document.createRange) { - var range = document.createRange(); - if (range.getBoundingClientRect) { - var testElement = document.createElement('boundtest'); - testElement.style.height = TEST_HEIGHT + "px"; - testElement.style.display = 'block'; - document.body.appendChild(testElement); - range.selectNode(testElement); - var rangeBounds = range.getBoundingClientRect(); - var rangeHeight = Math.round(rangeBounds.height); - document.body.removeChild(testElement); - if (rangeHeight === TEST_HEIGHT) { - return true; - } - } - } - return false; - }; - var testIOSLineBreak = function (document) { - var testElement = document.createElement('boundtest'); - testElement.style.width = '50px'; - testElement.style.display = 'block'; - testElement.style.fontSize = '12px'; - testElement.style.letterSpacing = '0px'; - testElement.style.wordSpacing = '0px'; - document.body.appendChild(testElement); - var range = document.createRange(); - testElement.innerHTML = typeof ''.repeat === 'function' ? '👨'.repeat(10) : ''; - var node = testElement.firstChild; - var textList = toCodePoints$1(node.data).map(function (i) { return fromCodePoint$1(i); }); - var offset = 0; - var prev = {}; - // ios 13 does not handle range getBoundingClientRect line changes correctly #2177 - var supports = textList.every(function (text, i) { - range.setStart(node, offset); - range.setEnd(node, offset + text.length); - var rect = range.getBoundingClientRect(); - offset += text.length; - var boundAhead = rect.x > prev.x || rect.y > prev.y; - prev = rect; - if (i === 0) { - return true; - } - return boundAhead; - }); - document.body.removeChild(testElement); - return supports; - }; - var testCORS = function () { return typeof new Image().crossOrigin !== 'undefined'; }; - var testResponseType = function () { return typeof new XMLHttpRequest().responseType === 'string'; }; - var testSVG = function (document) { - var img = new Image(); - var canvas = document.createElement('canvas'); - var ctx = canvas.getContext('2d'); - if (!ctx) { - return false; - } - img.src = "data:image/svg+xml,"; - try { - ctx.drawImage(img, 0, 0); - canvas.toDataURL(); - } - catch (e) { - return false; - } - return true; - }; - var isGreenPixel = function (data) { - return data[0] === 0 && data[1] === 255 && data[2] === 0 && data[3] === 255; - }; - var testForeignObject = function (document) { - var canvas = document.createElement('canvas'); - var size = 100; - canvas.width = size; - canvas.height = size; - var ctx = canvas.getContext('2d'); - if (!ctx) { - return Promise.reject(false); - } - ctx.fillStyle = 'rgb(0, 255, 0)'; - ctx.fillRect(0, 0, size, size); - var img = new Image(); - var greenImageSrc = canvas.toDataURL(); - img.src = greenImageSrc; - var svg = createForeignObjectSVG(size, size, 0, 0, img); - ctx.fillStyle = 'red'; - ctx.fillRect(0, 0, size, size); - return loadSerializedSVG$1(svg) - .then(function (img) { - ctx.drawImage(img, 0, 0); - var data = ctx.getImageData(0, 0, size, size).data; - ctx.fillStyle = 'red'; - ctx.fillRect(0, 0, size, size); - var node = document.createElement('div'); - node.style.backgroundImage = "url(" + greenImageSrc + ")"; - node.style.height = size + "px"; - // Firefox 55 does not render inline tags - return isGreenPixel(data) - ? loadSerializedSVG$1(createForeignObjectSVG(size, size, 0, 0, node)) - : Promise.reject(false); - }) - .then(function (img) { - ctx.drawImage(img, 0, 0); - // Edge does not render background-images - return isGreenPixel(ctx.getImageData(0, 0, size, size).data); - }) - .catch(function () { return false; }); - }; - var createForeignObjectSVG = function (width, height, x, y, node) { - var xmlns = 'http://www.w3.org/2000/svg'; - var svg = document.createElementNS(xmlns, 'svg'); - var foreignObject = document.createElementNS(xmlns, 'foreignObject'); - svg.setAttributeNS(null, 'width', width.toString()); - svg.setAttributeNS(null, 'height', height.toString()); - foreignObject.setAttributeNS(null, 'width', '100%'); - foreignObject.setAttributeNS(null, 'height', '100%'); - foreignObject.setAttributeNS(null, 'x', x.toString()); - foreignObject.setAttributeNS(null, 'y', y.toString()); - foreignObject.setAttributeNS(null, 'externalResourcesRequired', 'true'); - svg.appendChild(foreignObject); - foreignObject.appendChild(node); - return svg; - }; - var loadSerializedSVG$1 = function (svg) { - return new Promise(function (resolve, reject) { - var img = new Image(); - img.onload = function () { return resolve(img); }; - img.onerror = reject; - img.src = "data:image/svg+xml;charset=utf-8," + encodeURIComponent(new XMLSerializer().serializeToString(svg)); - }); - }; - var FEATURES = { - get SUPPORT_RANGE_BOUNDS() { - var value = testRangeBounds(document); - Object.defineProperty(FEATURES, 'SUPPORT_RANGE_BOUNDS', { value: value }); - return value; - }, - get SUPPORT_WORD_BREAKING() { - var value = FEATURES.SUPPORT_RANGE_BOUNDS && testIOSLineBreak(document); - Object.defineProperty(FEATURES, 'SUPPORT_WORD_BREAKING', { value: value }); - return value; - }, - get SUPPORT_SVG_DRAWING() { - var value = testSVG(document); - Object.defineProperty(FEATURES, 'SUPPORT_SVG_DRAWING', { value: value }); - return value; - }, - get SUPPORT_FOREIGNOBJECT_DRAWING() { - var value = typeof Array.from === 'function' && typeof window.fetch === 'function' - ? testForeignObject(document) - : Promise.resolve(false); - Object.defineProperty(FEATURES, 'SUPPORT_FOREIGNOBJECT_DRAWING', { value: value }); - return value; - }, - get SUPPORT_CORS_IMAGES() { - var value = testCORS(); - Object.defineProperty(FEATURES, 'SUPPORT_CORS_IMAGES', { value: value }); - return value; - }, - get SUPPORT_RESPONSE_TYPE() { - var value = testResponseType(); - Object.defineProperty(FEATURES, 'SUPPORT_RESPONSE_TYPE', { value: value }); - return value; - }, - get SUPPORT_CORS_XHR() { - var value = 'withCredentials' in new XMLHttpRequest(); - Object.defineProperty(FEATURES, 'SUPPORT_CORS_XHR', { value: value }); - return value; - }, - get SUPPORT_NATIVE_TEXT_SEGMENTATION() { - // eslint-disable-next-line @typescript-eslint/no-explicit-any - var value = !!(typeof Intl !== 'undefined' && Intl.Segmenter); - Object.defineProperty(FEATURES, 'SUPPORT_NATIVE_TEXT_SEGMENTATION', { value: value }); - return value; - } - }; - - var TextBounds = /** @class */ (function () { - function TextBounds(text, bounds) { - this.text = text; - this.bounds = bounds; - } - return TextBounds; - }()); - var parseTextBounds = function (context, value, styles, node) { - var textList = breakText(value, styles); - var textBounds = []; - var offset = 0; - textList.forEach(function (text) { - if (styles.textDecorationLine.length || text.trim().length > 0) { - if (FEATURES.SUPPORT_RANGE_BOUNDS) { - var clientRects = createRange(node, offset, text.length).getClientRects(); - if (clientRects.length > 1) { - var subSegments = segmentGraphemes(text); - var subOffset_1 = 0; - subSegments.forEach(function (subSegment) { - textBounds.push(new TextBounds(subSegment, Bounds.fromDOMRectList(context, createRange(node, subOffset_1 + offset, subSegment.length).getClientRects()))); - subOffset_1 += subSegment.length; - }); - } - else { - textBounds.push(new TextBounds(text, Bounds.fromDOMRectList(context, clientRects))); - } - } - else { - var replacementNode = node.splitText(text.length); - textBounds.push(new TextBounds(text, getWrapperBounds(context, node))); - node = replacementNode; - } - } - else if (!FEATURES.SUPPORT_RANGE_BOUNDS) { - node = node.splitText(text.length); - } - offset += text.length; - }); - return textBounds; - }; - var getWrapperBounds = function (context, node) { - var ownerDocument = node.ownerDocument; - if (ownerDocument) { - var wrapper = ownerDocument.createElement('html2canvaswrapper'); - wrapper.appendChild(node.cloneNode(true)); - var parentNode = node.parentNode; - if (parentNode) { - parentNode.replaceChild(wrapper, node); - var bounds = parseBounds(context, wrapper); - if (wrapper.firstChild) { - parentNode.replaceChild(wrapper.firstChild, wrapper); - } - return bounds; - } - } - return Bounds.EMPTY; - }; - var createRange = function (node, offset, length) { - var ownerDocument = node.ownerDocument; - if (!ownerDocument) { - throw new Error('Node has no owner document'); - } - var range = ownerDocument.createRange(); - range.setStart(node, offset); - range.setEnd(node, offset + length); - return range; - }; - var segmentGraphemes = function (value) { - if (FEATURES.SUPPORT_NATIVE_TEXT_SEGMENTATION) { - // eslint-disable-next-line @typescript-eslint/no-explicit-any - var segmenter = new Intl.Segmenter(void 0, { granularity: 'grapheme' }); - // eslint-disable-next-line @typescript-eslint/no-explicit-any - return Array.from(segmenter.segment(value)).map(function (segment) { return segment.segment; }); - } - return splitGraphemes(value); - }; - var segmentWords = function (value, styles) { - if (FEATURES.SUPPORT_NATIVE_TEXT_SEGMENTATION) { - // eslint-disable-next-line @typescript-eslint/no-explicit-any - var segmenter = new Intl.Segmenter(void 0, { - granularity: 'word' - }); - // eslint-disable-next-line @typescript-eslint/no-explicit-any - return Array.from(segmenter.segment(value)).map(function (segment) { return segment.segment; }); - } - return breakWords(value, styles); - }; - var breakText = function (value, styles) { - return styles.letterSpacing !== 0 ? segmentGraphemes(value) : segmentWords(value, styles); - }; - // https://drafts.csswg.org/css-text/#word-separator - var wordSeparators = [0x0020, 0x00a0, 0x1361, 0x10100, 0x10101, 0x1039, 0x1091]; - var breakWords = function (str, styles) { - var breaker = LineBreaker(str, { - lineBreak: styles.lineBreak, - wordBreak: styles.overflowWrap === "break-word" /* BREAK_WORD */ ? 'break-word' : styles.wordBreak - }); - var words = []; - var bk; - var _loop_1 = function () { - if (bk.value) { - var value = bk.value.slice(); - var codePoints = toCodePoints$1(value); - var word_1 = ''; - codePoints.forEach(function (codePoint) { - if (wordSeparators.indexOf(codePoint) === -1) { - word_1 += fromCodePoint$1(codePoint); - } - else { - if (word_1.length) { - words.push(word_1); - } - words.push(fromCodePoint$1(codePoint)); - word_1 = ''; - } - }); - if (word_1.length) { - words.push(word_1); - } - } - }; - while (!(bk = breaker.next()).done) { - _loop_1(); - } - return words; - }; - - var TextContainer = /** @class */ (function () { - function TextContainer(context, node, styles) { - this.text = transform(node.data, styles.textTransform); - this.textBounds = parseTextBounds(context, this.text, styles, node); - } - return TextContainer; - }()); - var transform = function (text, transform) { - switch (transform) { - case 1 /* LOWERCASE */: - return text.toLowerCase(); - case 3 /* CAPITALIZE */: - return text.replace(CAPITALIZE, capitalize); - case 2 /* UPPERCASE */: - return text.toUpperCase(); - default: - return text; - } - }; - var CAPITALIZE = /(^|\s|:|-|\(|\))([a-z])/g; - var capitalize = function (m, p1, p2) { - if (m.length > 0) { - return p1 + p2.toUpperCase(); - } - return m; - }; - - var ImageElementContainer = /** @class */ (function (_super) { - __extends(ImageElementContainer, _super); - function ImageElementContainer(context, img) { - var _this = _super.call(this, context, img) || this; - _this.src = img.currentSrc || img.src; - _this.intrinsicWidth = img.naturalWidth; - _this.intrinsicHeight = img.naturalHeight; - _this.context.cache.addImage(_this.src); - return _this; - } - return ImageElementContainer; - }(ElementContainer)); - - var CanvasElementContainer = /** @class */ (function (_super) { - __extends(CanvasElementContainer, _super); - function CanvasElementContainer(context, canvas) { - var _this = _super.call(this, context, canvas) || this; - _this.canvas = canvas; - _this.intrinsicWidth = canvas.width; - _this.intrinsicHeight = canvas.height; - return _this; - } - return CanvasElementContainer; - }(ElementContainer)); - - var SVGElementContainer = /** @class */ (function (_super) { - __extends(SVGElementContainer, _super); - function SVGElementContainer(context, img) { - var _this = _super.call(this, context, img) || this; - var s = new XMLSerializer(); - var bounds = parseBounds(context, img); - img.setAttribute('width', bounds.width + "px"); - img.setAttribute('height', bounds.height + "px"); - _this.svg = "data:image/svg+xml," + encodeURIComponent(s.serializeToString(img)); - _this.intrinsicWidth = img.width.baseVal.value; - _this.intrinsicHeight = img.height.baseVal.value; - _this.context.cache.addImage(_this.svg); - return _this; - } - return SVGElementContainer; - }(ElementContainer)); - - var LIElementContainer = /** @class */ (function (_super) { - __extends(LIElementContainer, _super); - function LIElementContainer(context, element) { - var _this = _super.call(this, context, element) || this; - _this.value = element.value; - return _this; - } - return LIElementContainer; - }(ElementContainer)); - - var OLElementContainer = /** @class */ (function (_super) { - __extends(OLElementContainer, _super); - function OLElementContainer(context, element) { - var _this = _super.call(this, context, element) || this; - _this.start = element.start; - _this.reversed = typeof element.reversed === 'boolean' && element.reversed === true; - return _this; - } - return OLElementContainer; - }(ElementContainer)); - - var CHECKBOX_BORDER_RADIUS = [ - { - type: 15 /* DIMENSION_TOKEN */, - flags: 0, - unit: 'px', - number: 3 - } - ]; - var RADIO_BORDER_RADIUS = [ - { - type: 16 /* PERCENTAGE_TOKEN */, - flags: 0, - number: 50 - } - ]; - var reformatInputBounds = function (bounds) { - if (bounds.width > bounds.height) { - return new Bounds(bounds.left + (bounds.width - bounds.height) / 2, bounds.top, bounds.height, bounds.height); - } - else if (bounds.width < bounds.height) { - return new Bounds(bounds.left, bounds.top + (bounds.height - bounds.width) / 2, bounds.width, bounds.width); - } - return bounds; - }; - var getInputValue = function (node) { - var value = node.type === PASSWORD ? new Array(node.value.length + 1).join('\u2022') : node.value; - return value.length === 0 ? node.placeholder || '' : value; - }; - var CHECKBOX = 'checkbox'; - var RADIO = 'radio'; - var PASSWORD = 'password'; - var INPUT_COLOR = 0x2a2a2aff; - var InputElementContainer = /** @class */ (function (_super) { - __extends(InputElementContainer, _super); - function InputElementContainer(context, input) { - var _this = _super.call(this, context, input) || this; - _this.type = input.type.toLowerCase(); - _this.checked = input.checked; - _this.value = getInputValue(input); - if (_this.type === CHECKBOX || _this.type === RADIO) { - _this.styles.backgroundColor = 0xdededeff; - _this.styles.borderTopColor = - _this.styles.borderRightColor = - _this.styles.borderBottomColor = - _this.styles.borderLeftColor = - 0xa5a5a5ff; - _this.styles.borderTopWidth = - _this.styles.borderRightWidth = - _this.styles.borderBottomWidth = - _this.styles.borderLeftWidth = - 1; - _this.styles.borderTopStyle = - _this.styles.borderRightStyle = - _this.styles.borderBottomStyle = - _this.styles.borderLeftStyle = - 1 /* SOLID */; - _this.styles.backgroundClip = [0 /* BORDER_BOX */]; - _this.styles.backgroundOrigin = [0 /* BORDER_BOX */]; - _this.bounds = reformatInputBounds(_this.bounds); - } - switch (_this.type) { - case CHECKBOX: - _this.styles.borderTopRightRadius = - _this.styles.borderTopLeftRadius = - _this.styles.borderBottomRightRadius = - _this.styles.borderBottomLeftRadius = - CHECKBOX_BORDER_RADIUS; - break; - case RADIO: - _this.styles.borderTopRightRadius = - _this.styles.borderTopLeftRadius = - _this.styles.borderBottomRightRadius = - _this.styles.borderBottomLeftRadius = - RADIO_BORDER_RADIUS; - break; - } - return _this; - } - return InputElementContainer; - }(ElementContainer)); - - var SelectElementContainer = /** @class */ (function (_super) { - __extends(SelectElementContainer, _super); - function SelectElementContainer(context, element) { - var _this = _super.call(this, context, element) || this; - var option = element.options[element.selectedIndex || 0]; - _this.value = option ? option.text || '' : ''; - return _this; - } - return SelectElementContainer; - }(ElementContainer)); - - var TextareaElementContainer = /** @class */ (function (_super) { - __extends(TextareaElementContainer, _super); - function TextareaElementContainer(context, element) { - var _this = _super.call(this, context, element) || this; - _this.value = element.value; - return _this; - } - return TextareaElementContainer; - }(ElementContainer)); - - var IFrameElementContainer = /** @class */ (function (_super) { - __extends(IFrameElementContainer, _super); - function IFrameElementContainer(context, iframe) { - var _this = _super.call(this, context, iframe) || this; - _this.src = iframe.src; - _this.width = parseInt(iframe.width, 10) || 0; - _this.height = parseInt(iframe.height, 10) || 0; - _this.backgroundColor = _this.styles.backgroundColor; - try { - if (iframe.contentWindow && - iframe.contentWindow.document && - iframe.contentWindow.document.documentElement) { - _this.tree = parseTree(context, iframe.contentWindow.document.documentElement); - // http://www.w3.org/TR/css3-background/#special-backgrounds - var documentBackgroundColor = iframe.contentWindow.document.documentElement - ? parseColor(context, getComputedStyle(iframe.contentWindow.document.documentElement).backgroundColor) - : COLORS.TRANSPARENT; - var bodyBackgroundColor = iframe.contentWindow.document.body - ? parseColor(context, getComputedStyle(iframe.contentWindow.document.body).backgroundColor) - : COLORS.TRANSPARENT; - _this.backgroundColor = isTransparent(documentBackgroundColor) - ? isTransparent(bodyBackgroundColor) - ? _this.styles.backgroundColor - : bodyBackgroundColor - : documentBackgroundColor; - } - } - catch (e) { } - return _this; - } - return IFrameElementContainer; - }(ElementContainer)); - - var LIST_OWNERS = ['OL', 'UL', 'MENU']; - var parseNodeTree = function (context, node, parent, root) { - for (var childNode = node.firstChild, nextNode = void 0; childNode; childNode = nextNode) { - nextNode = childNode.nextSibling; - if (isTextNode(childNode) && childNode.data.trim().length > 0) { - parent.textNodes.push(new TextContainer(context, childNode, parent.styles)); - } - else if (isElementNode(childNode)) { - if (isSlotElement(childNode) && childNode.assignedNodes) { - childNode.assignedNodes().forEach(function (childNode) { return parseNodeTree(context, childNode, parent, root); }); - } - else { - var container = createContainer(context, childNode); - if (container.styles.isVisible()) { - if (createsRealStackingContext(childNode, container, root)) { - container.flags |= 4 /* CREATES_REAL_STACKING_CONTEXT */; - } - else if (createsStackingContext(container.styles)) { - container.flags |= 2 /* CREATES_STACKING_CONTEXT */; - } - if (LIST_OWNERS.indexOf(childNode.tagName) !== -1) { - container.flags |= 8 /* IS_LIST_OWNER */; - } - parent.elements.push(container); - childNode.slot; - if (childNode.shadowRoot) { - parseNodeTree(context, childNode.shadowRoot, container, root); - } - else if (!isTextareaElement(childNode) && - !isSVGElement(childNode) && - !isSelectElement(childNode)) { - parseNodeTree(context, childNode, container, root); - } - } - } - } - } - }; - var createContainer = function (context, element) { - if (isImageElement(element)) { - return new ImageElementContainer(context, element); - } - if (isCanvasElement(element)) { - return new CanvasElementContainer(context, element); - } - if (isSVGElement(element)) { - return new SVGElementContainer(context, element); - } - if (isLIElement(element)) { - return new LIElementContainer(context, element); - } - if (isOLElement(element)) { - return new OLElementContainer(context, element); - } - if (isInputElement(element)) { - return new InputElementContainer(context, element); - } - if (isSelectElement(element)) { - return new SelectElementContainer(context, element); - } - if (isTextareaElement(element)) { - return new TextareaElementContainer(context, element); - } - if (isIFrameElement(element)) { - return new IFrameElementContainer(context, element); - } - return new ElementContainer(context, element); - }; - var parseTree = function (context, element) { - var container = createContainer(context, element); - container.flags |= 4 /* CREATES_REAL_STACKING_CONTEXT */; - parseNodeTree(context, element, container, container); - return container; - }; - var createsRealStackingContext = function (node, container, root) { - return (container.styles.isPositionedWithZIndex() || - container.styles.opacity < 1 || - container.styles.isTransformed() || - (isBodyElement(node) && root.styles.isTransparent())); - }; - var createsStackingContext = function (styles) { return styles.isPositioned() || styles.isFloating(); }; - var isTextNode = function (node) { return node.nodeType === Node.TEXT_NODE; }; - var isElementNode = function (node) { return node.nodeType === Node.ELEMENT_NODE; }; - var isHTMLElementNode = function (node) { - return isElementNode(node) && typeof node.style !== 'undefined' && !isSVGElementNode(node); - }; - var isSVGElementNode = function (element) { - return typeof element.className === 'object'; - }; - var isLIElement = function (node) { return node.tagName === 'LI'; }; - var isOLElement = function (node) { return node.tagName === 'OL'; }; - var isInputElement = function (node) { return node.tagName === 'INPUT'; }; - var isHTMLElement = function (node) { return node.tagName === 'HTML'; }; - var isSVGElement = function (node) { return node.tagName === 'svg'; }; - var isBodyElement = function (node) { return node.tagName === 'BODY'; }; - var isCanvasElement = function (node) { return node.tagName === 'CANVAS'; }; - var isVideoElement = function (node) { return node.tagName === 'VIDEO'; }; - var isImageElement = function (node) { return node.tagName === 'IMG'; }; - var isIFrameElement = function (node) { return node.tagName === 'IFRAME'; }; - var isStyleElement = function (node) { return node.tagName === 'STYLE'; }; - var isScriptElement = function (node) { return node.tagName === 'SCRIPT'; }; - var isTextareaElement = function (node) { return node.tagName === 'TEXTAREA'; }; - var isSelectElement = function (node) { return node.tagName === 'SELECT'; }; - var isSlotElement = function (node) { return node.tagName === 'SLOT'; }; - // https://html.spec.whatwg.org/multipage/custom-elements.html#valid-custom-element-name - var isCustomElement = function (node) { return node.tagName.indexOf('-') > 0; }; - - var CounterState = /** @class */ (function () { - function CounterState() { - this.counters = {}; - } - CounterState.prototype.getCounterValue = function (name) { - var counter = this.counters[name]; - if (counter && counter.length) { - return counter[counter.length - 1]; - } - return 1; - }; - CounterState.prototype.getCounterValues = function (name) { - var counter = this.counters[name]; - return counter ? counter : []; - }; - CounterState.prototype.pop = function (counters) { - var _this = this; - counters.forEach(function (counter) { return _this.counters[counter].pop(); }); - }; - CounterState.prototype.parse = function (style) { - var _this = this; - var counterIncrement = style.counterIncrement; - var counterReset = style.counterReset; - var canReset = true; - if (counterIncrement !== null) { - counterIncrement.forEach(function (entry) { - var counter = _this.counters[entry.counter]; - if (counter && entry.increment !== 0) { - canReset = false; - if (!counter.length) { - counter.push(1); - } - counter[Math.max(0, counter.length - 1)] += entry.increment; - } - }); - } - var counterNames = []; - if (canReset) { - counterReset.forEach(function (entry) { - var counter = _this.counters[entry.counter]; - counterNames.push(entry.counter); - if (!counter) { - counter = _this.counters[entry.counter] = []; - } - counter.push(entry.reset); - }); - } - return counterNames; - }; - return CounterState; - }()); - var ROMAN_UPPER = { - integers: [1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1], - values: ['M', 'CM', 'D', 'CD', 'C', 'XC', 'L', 'XL', 'X', 'IX', 'V', 'IV', 'I'] - }; - var ARMENIAN = { - integers: [ - 9000, 8000, 7000, 6000, 5000, 4000, 3000, 2000, 1000, 900, 800, 700, 600, 500, 400, 300, 200, 100, 90, 80, 70, - 60, 50, 40, 30, 20, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1 - ], - values: [ - 'Ք', - 'Փ', - 'Ւ', - 'Ց', - 'Ր', - 'Տ', - 'Վ', - 'Ս', - 'Ռ', - 'Ջ', - 'Պ', - 'Չ', - 'Ո', - 'Շ', - 'Ն', - 'Յ', - 'Մ', - 'Ճ', - 'Ղ', - 'Ձ', - 'Հ', - 'Կ', - 'Ծ', - 'Խ', - 'Լ', - 'Ի', - 'Ժ', - 'Թ', - 'Ը', - 'Է', - 'Զ', - 'Ե', - 'Դ', - 'Գ', - 'Բ', - 'Ա' - ] - }; - var HEBREW = { - integers: [ - 10000, 9000, 8000, 7000, 6000, 5000, 4000, 3000, 2000, 1000, 400, 300, 200, 100, 90, 80, 70, 60, 50, 40, 30, 20, - 19, 18, 17, 16, 15, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1 - ], - values: [ - 'י׳', - 'ט׳', - 'ח׳', - 'ז׳', - 'ו׳', - 'ה׳', - 'ד׳', - 'ג׳', - 'ב׳', - 'א׳', - 'ת', - 'ש', - 'ר', - 'ק', - 'צ', - 'פ', - 'ע', - 'ס', - 'נ', - 'מ', - 'ל', - 'כ', - 'יט', - 'יח', - 'יז', - 'טז', - 'טו', - 'י', - 'ט', - 'ח', - 'ז', - 'ו', - 'ה', - 'ד', - 'ג', - 'ב', - 'א' - ] - }; - var GEORGIAN = { - integers: [ - 10000, 9000, 8000, 7000, 6000, 5000, 4000, 3000, 2000, 1000, 900, 800, 700, 600, 500, 400, 300, 200, 100, 90, - 80, 70, 60, 50, 40, 30, 20, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1 - ], - values: [ - 'ჵ', - 'ჰ', - 'ჯ', - 'ჴ', - 'ხ', - 'ჭ', - 'წ', - 'ძ', - 'ც', - 'ჩ', - 'შ', - 'ყ', - 'ღ', - 'ქ', - 'ფ', - 'ჳ', - 'ტ', - 'ს', - 'რ', - 'ჟ', - 'პ', - 'ო', - 'ჲ', - 'ნ', - 'მ', - 'ლ', - 'კ', - 'ი', - 'თ', - 'ჱ', - 'ზ', - 'ვ', - 'ე', - 'დ', - 'გ', - 'ბ', - 'ა' - ] - }; - var createAdditiveCounter = function (value, min, max, symbols, fallback, suffix) { - if (value < min || value > max) { - return createCounterText(value, fallback, suffix.length > 0); - } - return (symbols.integers.reduce(function (string, integer, index) { - while (value >= integer) { - value -= integer; - string += symbols.values[index]; - } - return string; - }, '') + suffix); - }; - var createCounterStyleWithSymbolResolver = function (value, codePointRangeLength, isNumeric, resolver) { - var string = ''; - do { - if (!isNumeric) { - value--; - } - string = resolver(value) + string; - value /= codePointRangeLength; - } while (value * codePointRangeLength >= codePointRangeLength); - return string; - }; - var createCounterStyleFromRange = function (value, codePointRangeStart, codePointRangeEnd, isNumeric, suffix) { - var codePointRangeLength = codePointRangeEnd - codePointRangeStart + 1; - return ((value < 0 ? '-' : '') + - (createCounterStyleWithSymbolResolver(Math.abs(value), codePointRangeLength, isNumeric, function (codePoint) { - return fromCodePoint$1(Math.floor(codePoint % codePointRangeLength) + codePointRangeStart); - }) + - suffix)); - }; - var createCounterStyleFromSymbols = function (value, symbols, suffix) { - if (suffix === void 0) { suffix = '. '; } - var codePointRangeLength = symbols.length; - return (createCounterStyleWithSymbolResolver(Math.abs(value), codePointRangeLength, false, function (codePoint) { return symbols[Math.floor(codePoint % codePointRangeLength)]; }) + suffix); - }; - var CJK_ZEROS = 1 << 0; - var CJK_TEN_COEFFICIENTS = 1 << 1; - var CJK_TEN_HIGH_COEFFICIENTS = 1 << 2; - var CJK_HUNDRED_COEFFICIENTS = 1 << 3; - var createCJKCounter = function (value, numbers, multipliers, negativeSign, suffix, flags) { - if (value < -9999 || value > 9999) { - return createCounterText(value, 4 /* CJK_DECIMAL */, suffix.length > 0); - } - var tmp = Math.abs(value); - var string = suffix; - if (tmp === 0) { - return numbers[0] + string; - } - for (var digit = 0; tmp > 0 && digit <= 4; digit++) { - var coefficient = tmp % 10; - if (coefficient === 0 && contains(flags, CJK_ZEROS) && string !== '') { - string = numbers[coefficient] + string; - } - else if (coefficient > 1 || - (coefficient === 1 && digit === 0) || - (coefficient === 1 && digit === 1 && contains(flags, CJK_TEN_COEFFICIENTS)) || - (coefficient === 1 && digit === 1 && contains(flags, CJK_TEN_HIGH_COEFFICIENTS) && value > 100) || - (coefficient === 1 && digit > 1 && contains(flags, CJK_HUNDRED_COEFFICIENTS))) { - string = numbers[coefficient] + (digit > 0 ? multipliers[digit - 1] : '') + string; - } - else if (coefficient === 1 && digit > 0) { - string = multipliers[digit - 1] + string; - } - tmp = Math.floor(tmp / 10); - } - return (value < 0 ? negativeSign : '') + string; - }; - var CHINESE_INFORMAL_MULTIPLIERS = '十百千萬'; - var CHINESE_FORMAL_MULTIPLIERS = '拾佰仟萬'; - var JAPANESE_NEGATIVE = 'マイナス'; - var KOREAN_NEGATIVE = '마이너스'; - var createCounterText = function (value, type, appendSuffix) { - var defaultSuffix = appendSuffix ? '. ' : ''; - var cjkSuffix = appendSuffix ? '、' : ''; - var koreanSuffix = appendSuffix ? ', ' : ''; - var spaceSuffix = appendSuffix ? ' ' : ''; - switch (type) { - case 0 /* DISC */: - return '•' + spaceSuffix; - case 1 /* CIRCLE */: - return '◦' + spaceSuffix; - case 2 /* SQUARE */: - return '◾' + spaceSuffix; - case 5 /* DECIMAL_LEADING_ZERO */: - var string = createCounterStyleFromRange(value, 48, 57, true, defaultSuffix); - return string.length < 4 ? "0" + string : string; - case 4 /* CJK_DECIMAL */: - return createCounterStyleFromSymbols(value, '〇一二三四五六七八九', cjkSuffix); - case 6 /* LOWER_ROMAN */: - return createAdditiveCounter(value, 1, 3999, ROMAN_UPPER, 3 /* DECIMAL */, defaultSuffix).toLowerCase(); - case 7 /* UPPER_ROMAN */: - return createAdditiveCounter(value, 1, 3999, ROMAN_UPPER, 3 /* DECIMAL */, defaultSuffix); - case 8 /* LOWER_GREEK */: - return createCounterStyleFromRange(value, 945, 969, false, defaultSuffix); - case 9 /* LOWER_ALPHA */: - return createCounterStyleFromRange(value, 97, 122, false, defaultSuffix); - case 10 /* UPPER_ALPHA */: - return createCounterStyleFromRange(value, 65, 90, false, defaultSuffix); - case 11 /* ARABIC_INDIC */: - return createCounterStyleFromRange(value, 1632, 1641, true, defaultSuffix); - case 12 /* ARMENIAN */: - case 49 /* UPPER_ARMENIAN */: - return createAdditiveCounter(value, 1, 9999, ARMENIAN, 3 /* DECIMAL */, defaultSuffix); - case 35 /* LOWER_ARMENIAN */: - return createAdditiveCounter(value, 1, 9999, ARMENIAN, 3 /* DECIMAL */, defaultSuffix).toLowerCase(); - case 13 /* BENGALI */: - return createCounterStyleFromRange(value, 2534, 2543, true, defaultSuffix); - case 14 /* CAMBODIAN */: - case 30 /* KHMER */: - return createCounterStyleFromRange(value, 6112, 6121, true, defaultSuffix); - case 15 /* CJK_EARTHLY_BRANCH */: - return createCounterStyleFromSymbols(value, '子丑寅卯辰巳午未申酉戌亥', cjkSuffix); - case 16 /* CJK_HEAVENLY_STEM */: - return createCounterStyleFromSymbols(value, '甲乙丙丁戊己庚辛壬癸', cjkSuffix); - case 17 /* CJK_IDEOGRAPHIC */: - case 48 /* TRAD_CHINESE_INFORMAL */: - return createCJKCounter(value, '零一二三四五六七八九', CHINESE_INFORMAL_MULTIPLIERS, '負', cjkSuffix, CJK_TEN_COEFFICIENTS | CJK_TEN_HIGH_COEFFICIENTS | CJK_HUNDRED_COEFFICIENTS); - case 47 /* TRAD_CHINESE_FORMAL */: - return createCJKCounter(value, '零壹貳參肆伍陸柒捌玖', CHINESE_FORMAL_MULTIPLIERS, '負', cjkSuffix, CJK_ZEROS | CJK_TEN_COEFFICIENTS | CJK_TEN_HIGH_COEFFICIENTS | CJK_HUNDRED_COEFFICIENTS); - case 42 /* SIMP_CHINESE_INFORMAL */: - return createCJKCounter(value, '零一二三四五六七八九', CHINESE_INFORMAL_MULTIPLIERS, '负', cjkSuffix, CJK_TEN_COEFFICIENTS | CJK_TEN_HIGH_COEFFICIENTS | CJK_HUNDRED_COEFFICIENTS); - case 41 /* SIMP_CHINESE_FORMAL */: - return createCJKCounter(value, '零壹贰叁肆伍陆柒捌玖', CHINESE_FORMAL_MULTIPLIERS, '负', cjkSuffix, CJK_ZEROS | CJK_TEN_COEFFICIENTS | CJK_TEN_HIGH_COEFFICIENTS | CJK_HUNDRED_COEFFICIENTS); - case 26 /* JAPANESE_INFORMAL */: - return createCJKCounter(value, '〇一二三四五六七八九', '十百千万', JAPANESE_NEGATIVE, cjkSuffix, 0); - case 25 /* JAPANESE_FORMAL */: - return createCJKCounter(value, '零壱弐参四伍六七八九', '拾百千万', JAPANESE_NEGATIVE, cjkSuffix, CJK_ZEROS | CJK_TEN_COEFFICIENTS | CJK_TEN_HIGH_COEFFICIENTS); - case 31 /* KOREAN_HANGUL_FORMAL */: - return createCJKCounter(value, '영일이삼사오육칠팔구', '십백천만', KOREAN_NEGATIVE, koreanSuffix, CJK_ZEROS | CJK_TEN_COEFFICIENTS | CJK_TEN_HIGH_COEFFICIENTS); - case 33 /* KOREAN_HANJA_INFORMAL */: - return createCJKCounter(value, '零一二三四五六七八九', '十百千萬', KOREAN_NEGATIVE, koreanSuffix, 0); - case 32 /* KOREAN_HANJA_FORMAL */: - return createCJKCounter(value, '零壹貳參四五六七八九', '拾百千', KOREAN_NEGATIVE, koreanSuffix, CJK_ZEROS | CJK_TEN_COEFFICIENTS | CJK_TEN_HIGH_COEFFICIENTS); - case 18 /* DEVANAGARI */: - return createCounterStyleFromRange(value, 0x966, 0x96f, true, defaultSuffix); - case 20 /* GEORGIAN */: - return createAdditiveCounter(value, 1, 19999, GEORGIAN, 3 /* DECIMAL */, defaultSuffix); - case 21 /* GUJARATI */: - return createCounterStyleFromRange(value, 0xae6, 0xaef, true, defaultSuffix); - case 22 /* GURMUKHI */: - return createCounterStyleFromRange(value, 0xa66, 0xa6f, true, defaultSuffix); - case 22 /* HEBREW */: - return createAdditiveCounter(value, 1, 10999, HEBREW, 3 /* DECIMAL */, defaultSuffix); - case 23 /* HIRAGANA */: - return createCounterStyleFromSymbols(value, 'あいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもやゆよらりるれろわゐゑをん'); - case 24 /* HIRAGANA_IROHA */: - return createCounterStyleFromSymbols(value, 'いろはにほへとちりぬるをわかよたれそつねならむうゐのおくやまけふこえてあさきゆめみしゑひもせす'); - case 27 /* KANNADA */: - return createCounterStyleFromRange(value, 0xce6, 0xcef, true, defaultSuffix); - case 28 /* KATAKANA */: - return createCounterStyleFromSymbols(value, 'アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヰヱヲン', cjkSuffix); - case 29 /* KATAKANA_IROHA */: - return createCounterStyleFromSymbols(value, 'イロハニホヘトチリヌルヲワカヨタレソツネナラムウヰノオクヤマケフコエテアサキユメミシヱヒモセス', cjkSuffix); - case 34 /* LAO */: - return createCounterStyleFromRange(value, 0xed0, 0xed9, true, defaultSuffix); - case 37 /* MONGOLIAN */: - return createCounterStyleFromRange(value, 0x1810, 0x1819, true, defaultSuffix); - case 38 /* MYANMAR */: - return createCounterStyleFromRange(value, 0x1040, 0x1049, true, defaultSuffix); - case 39 /* ORIYA */: - return createCounterStyleFromRange(value, 0xb66, 0xb6f, true, defaultSuffix); - case 40 /* PERSIAN */: - return createCounterStyleFromRange(value, 0x6f0, 0x6f9, true, defaultSuffix); - case 43 /* TAMIL */: - return createCounterStyleFromRange(value, 0xbe6, 0xbef, true, defaultSuffix); - case 44 /* TELUGU */: - return createCounterStyleFromRange(value, 0xc66, 0xc6f, true, defaultSuffix); - case 45 /* THAI */: - return createCounterStyleFromRange(value, 0xe50, 0xe59, true, defaultSuffix); - case 46 /* TIBETAN */: - return createCounterStyleFromRange(value, 0xf20, 0xf29, true, defaultSuffix); - case 3 /* DECIMAL */: - default: - return createCounterStyleFromRange(value, 48, 57, true, defaultSuffix); - } - }; - - var IGNORE_ATTRIBUTE = 'data-html2canvas-ignore'; - var DocumentCloner = /** @class */ (function () { - function DocumentCloner(context, element, options) { - this.context = context; - this.options = options; - this.scrolledElements = []; - this.referenceElement = element; - this.counters = new CounterState(); - this.quoteDepth = 0; - if (!element.ownerDocument) { - throw new Error('Cloned element does not have an owner document'); - } - this.documentElement = this.cloneNode(element.ownerDocument.documentElement, false); - } - DocumentCloner.prototype.toIFrame = function (ownerDocument, windowSize) { - var _this = this; - var iframe = createIFrameContainer(ownerDocument, windowSize); - if (!iframe.contentWindow) { - return Promise.reject("Unable to find iframe window"); - } - var scrollX = ownerDocument.defaultView.pageXOffset; - var scrollY = ownerDocument.defaultView.pageYOffset; - var cloneWindow = iframe.contentWindow; - var documentClone = cloneWindow.document; - /* Chrome doesn't detect relative background-images assigned in inline - -

      Toy World

      -
      - -

      >>0?(r=q+(l<<2)|0,(r|0)!=(o|0)):0){f[m>>2]=o+(~((o+-4-r|0)>>>2)<<2);s=n;t=k;v=j}else{s=n;t=k;v=j}else{Ci(g,l-p|0);p=f[h>>2]|0;s=p;t=p;v=f[i>>2]|0}p=v-t|0;l=p>>2;f[c>>2]=0;j=c+4|0;f[j>>2]=0;k=c+8|0;f[k>>2]=0;if(l|0){if((p|0)<0)aq(c);p=((l+-1|0)>>>5)+1|0;n=ln(p<<2)|0;f[c>>2]=n;f[k>>2]=p;f[j>>2]=l;j=l>>>5;sj(n|0,0,j<<2|0)|0;p=l&31;l=n+(j<<2)|0;if(p|0)f[l>>2]=f[l>>2]&~(-1>>>(32-p|0))}p=a+20|0;l=0;j=s;s=t;t=v;while(1){if(l>>>0>2>>>0){w=0;x=0;y=l;z=s;A=j}else{B=25;break}while(1){v=x>>>5;n=1<<(x&31);do if(!(f[(f[c>>2]|0)+(v<<2)>>2]&n)){k=f[A+(x<<2)>>2]|0;if((f[k+8>>2]|0)!=(f[k+4>>2]|0)){r=0;o=1;m=A;q=k;while(1){k=f[(f[q+4>>2]|0)+(r<<2)>>2]|0;C=0;D=m;while(1){E=f[D+(x<<2)>>2]|0;if((C|0)>=(Ra[f[(f[E>>2]|0)+24>>2]&127](E,k)|0)){F=o;break}E=f[(f[h>>2]|0)+(x<<2)>>2]|0;G=Sa[f[(f[E>>2]|0)+28>>2]&31](E,k,C)|0;if((G|0)!=(x|0)?(E=f[(f[p>>2]|0)+(G<<2)>>2]|0,(1<<(E&31)&f[(f[c>>2]|0)+(E>>>5<<2)>>2]|0)==0):0){F=0;break}C=C+1|0;D=f[h>>2]|0}r=r+1|0;m=f[h>>2]|0;q=f[m+(x<<2)>>2]|0;if(r>>>0>=(f[q+8>>2]|0)-(f[q+4>>2]|0)>>2>>>0)break;else o=F}o=m;if(F)H=o;else{I=w;J=y;K=o;break}}else H=z;f[(f[g>>2]|0)+(y<<2)>>2]=x;o=(f[c>>2]|0)+(v<<2)|0;f[o>>2]=f[o>>2]|n;I=1;J=y+1|0;K=H}else{I=w;J=y;K=z}while(0);x=x+1|0;L=f[i>>2]|0;M=L-K>>2;A=K;if(x>>>0>=M>>>0)break;else{w=I;y=J;z=K}}if(J>>>0>>0&(I^1)){N=0;break}else{l=J;j=A;s=K;t=L}}if((B|0)==25){f[d>>2]=0;B=d+4|0;f[B>>2]=0;f[d+8>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|y;W=1;X=U+1|0}else{W=T;X=U}}else{W=T;X=U}S=S+1|0;if((S|0)>=(l|0))break;else{T=W;U=X}}if(W|(X|0)>=(l|0))R=X;else{O=0;break a}}bg(f[(f[h>>2]|0)+(A<<2)>>2]|0,d);P=f[h>>2]|0;Q=f[i>>2]|0}a=a+1|0;if(a>>>0>=Q-P>>2>>>0){O=1;break}else{L=P;K=P;J=Q}}}while(0);Q=f[e>>2]|0;if(Q|0)Oq(Q);Q=f[d>>2]|0;if(Q|0){d=f[B>>2]|0;if((d|0)!=(Q|0))f[B>>2]=d+(~((d+-4-Q|0)>>>2)<<2);Oq(Q)}N=O}O=f[c>>2]|0;if(!O){u=b;return N|0}Oq(O);u=b;return N|0}function yc(a){a=a|0;var b=0,c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0;if(!a)return;b=a+-8|0;c=f[4788]|0;d=f[a+-4>>2]|0;a=d&-8;e=b+a|0;do if(!(d&1)){g=f[b>>2]|0;if(!(d&3))return;h=b+(0-g)|0;i=g+a|0;if(h>>>0>>0)return;if((f[4789]|0)==(h|0)){j=e+4|0;k=f[j>>2]|0;if((k&3|0)!=3){l=h;m=i;n=h;break}f[4786]=i;f[j>>2]=k&-2;f[h+4>>2]=i|1;f[h+i>>2]=i;return}k=g>>>3;if(g>>>0<256){g=f[h+8>>2]|0;j=f[h+12>>2]|0;if((j|0)==(g|0)){f[4784]=f[4784]&~(1<>2]=j;f[j+8>>2]=g;l=h;m=i;n=h;break}}g=f[h+24>>2]|0;j=f[h+12>>2]|0;do if((j|0)==(h|0)){k=h+16|0;o=k+4|0;p=f[o>>2]|0;if(!p){q=f[k>>2]|0;if(!q){r=0;break}else{s=q;t=k}}else{s=p;t=o}while(1){o=s+20|0;p=f[o>>2]|0;if(p|0){s=p;t=o;continue}o=s+16|0;p=f[o>>2]|0;if(!p)break;else{s=p;t=o}}f[t>>2]=0;r=s}else{o=f[h+8>>2]|0;f[o+12>>2]=j;f[j+8>>2]=o;r=j}while(0);if(g){j=f[h+28>>2]|0;o=19440+(j<<2)|0;if((f[o>>2]|0)==(h|0)){f[o>>2]=r;if(!r){f[4785]=f[4785]&~(1<>2]|0)!=(h|0)&1)<<2)>>2]=r;if(!r){l=h;m=i;n=h;break}}f[r+24>>2]=g;j=h+16|0;o=f[j>>2]|0;if(o|0){f[r+16>>2]=o;f[o+24>>2]=r}o=f[j+4>>2]|0;if(o){f[r+20>>2]=o;f[o+24>>2]=r;l=h;m=i;n=h}else{l=h;m=i;n=h}}else{l=h;m=i;n=h}}else{l=b;m=a;n=b}while(0);if(n>>>0>=e>>>0)return;b=e+4|0;a=f[b>>2]|0;if(!(a&1))return;if(!(a&2)){if((f[4790]|0)==(e|0)){r=(f[4787]|0)+m|0;f[4787]=r;f[4790]=l;f[l+4>>2]=r|1;if((l|0)!=(f[4789]|0))return;f[4789]=0;f[4786]=0;return}if((f[4789]|0)==(e|0)){r=(f[4786]|0)+m|0;f[4786]=r;f[4789]=n;f[l+4>>2]=r|1;f[n+r>>2]=r;return}r=(a&-8)+m|0;s=a>>>3;do if(a>>>0<256){t=f[e+8>>2]|0;c=f[e+12>>2]|0;if((c|0)==(t|0)){f[4784]=f[4784]&~(1<>2]=c;f[c+8>>2]=t;break}}else{t=f[e+24>>2]|0;c=f[e+12>>2]|0;do if((c|0)==(e|0)){d=e+16|0;o=d+4|0;j=f[o>>2]|0;if(!j){p=f[d>>2]|0;if(!p){u=0;break}else{v=p;w=d}}else{v=j;w=o}while(1){o=v+20|0;j=f[o>>2]|0;if(j|0){v=j;w=o;continue}o=v+16|0;j=f[o>>2]|0;if(!j)break;else{v=j;w=o}}f[w>>2]=0;u=v}else{o=f[e+8>>2]|0;f[o+12>>2]=c;f[c+8>>2]=o;u=c}while(0);if(t|0){c=f[e+28>>2]|0;h=19440+(c<<2)|0;if((f[h>>2]|0)==(e|0)){f[h>>2]=u;if(!u){f[4785]=f[4785]&~(1<>2]|0)!=(e|0)&1)<<2)>>2]=u;if(!u)break}f[u+24>>2]=t;c=e+16|0;h=f[c>>2]|0;if(h|0){f[u+16>>2]=h;f[h+24>>2]=u}h=f[c+4>>2]|0;if(h|0){f[u+20>>2]=h;f[h+24>>2]=u}}}while(0);f[l+4>>2]=r|1;f[n+r>>2]=r;if((l|0)==(f[4789]|0)){f[4786]=r;return}else x=r}else{f[b>>2]=a&-2;f[l+4>>2]=m|1;f[n+m>>2]=m;x=m}m=x>>>3;if(x>>>0<256){n=19176+(m<<1<<2)|0;a=f[4784]|0;b=1<>2]|0;z=b}f[z>>2]=l;f[y+12>>2]=l;f[l+8>>2]=y;f[l+12>>2]=n;return}n=x>>>8;if(n)if(x>>>0>16777215)A=31;else{y=(n+1048320|0)>>>16&8;z=n<>>16&4;b=z<>>16&2;a=14-(n|y|z)+(b<>>15)|0;A=x>>>(a+7|0)&1|a<<1}else A=0;a=19440+(A<<2)|0;f[l+28>>2]=A;f[l+20>>2]=0;f[l+16>>2]=0;z=f[4785]|0;b=1<>>1)|0);n=f[a>>2]|0;while(1){if((f[n+4>>2]&-8|0)==(x|0)){B=73;break}C=n+16+(y>>>31<<2)|0;m=f[C>>2]|0;if(!m){B=72;break}else{y=y<<1;n=m}}if((B|0)==72){f[C>>2]=l;f[l+24>>2]=n;f[l+12>>2]=l;f[l+8>>2]=l;break}else if((B|0)==73){y=n+8|0;t=f[y>>2]|0;f[t+12>>2]=l;f[y>>2]=l;f[l+8>>2]=t;f[l+12>>2]=n;f[l+24>>2]=0;break}}else{f[4785]=z|b;f[a>>2]=l;f[l+24>>2]=a;f[l+12>>2]=l;f[l+8>>2]=l}while(0);l=(f[4792]|0)+-1|0;f[4792]=l;if(!l)D=19592;else return;while(1){l=f[D>>2]|0;if(!l)break;else D=l+8|0}f[4792]=-1;return}function zc(a){a=a|0;var c=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,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|0)+4>>2];if((A|0)>0|(A|0)==0&y>>>0>0){B=A;C=y;D=z}else{f[g>>2]=f[z+4>>2];f[e>>2]=f[g>>2];Me(z,e,h,p)|0;x=f[l>>2]|0;t=x+16|0;B=f[t+4>>2]|0;C=f[t>>2]|0;D=x}b[h>>0]=f[s+(q*12|0)+8>>2];if(!((B|0)>0|(B|0)==0&C>>>0>0)){f[g>>2]=f[D+4>>2];f[e>>2]=f[g>>2];Me(D,e,h,n)|0}s=q+1|0;if(s>>>0>=j>>>0)break;q=s;r=f[i>>2]|0}u=c;return 1}if(a>>>0<65536){if(!k){u=c;return 1}r=h+2|0;q=h+2|0;n=h+2|0;D=0;C=m;while(1){B=f[C+96>>2]|0;p=f[l>>2]|0;d[h>>1]=f[B+(D*12|0)>>2];z=p+16|0;y=f[z>>2]|0;A=f[z+4>>2]|0;if((A|0)>0|(A|0)==0&y>>>0>0){E=A;F=y;G=p}else{f[g>>2]=f[p+4>>2];f[e>>2]=f[g>>2];Me(p,e,h,n)|0;p=f[l>>2]|0;y=p+16|0;E=f[y+4>>2]|0;F=f[y>>2]|0;G=p}d[h>>1]=f[B+(D*12|0)+4>>2];if((E|0)>0|(E|0)==0&F>>>0>0){H=E;I=F;J=G}else{f[g>>2]=f[G+4>>2];f[e>>2]=f[g>>2];Me(G,e,h,q)|0;p=f[l>>2]|0;y=p+16|0;H=f[y+4>>2]|0;I=f[y>>2]|0;J=p}d[h>>1]=f[B+(D*12|0)+8>>2];if(!((H|0)>0|(H|0)==0&I>>>0>0)){f[g>>2]=f[J+4>>2];f[e>>2]=f[g>>2];Me(J,e,h,r)|0}B=D+1|0;if(B>>>0>=j>>>0)break;D=B;C=f[i>>2]|0}u=c;return 1}C=(k|0)!=0;if(a>>>0<2097152){if(C){K=0;L=m}else{u=c;return 1}while(1){a=f[L+96>>2]|0;ci(f[a+(K*12|0)>>2]|0,f[l>>2]|0)|0;ci(f[a+(K*12|0)+4>>2]|0,f[l>>2]|0)|0;ci(f[a+(K*12|0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-H);C=$($(n[j>>2])-D);D=$($(n[j+4>>2])-F);F=$($(n[j+8>>2])-H);H=$($($($(E*E)+$(0.0))+$(G*G))+$(I*I));if(H>$(0.0)){K=$($($($($(E*C)+$(0.0))+$(G*D))+$(I*F))/H);M=$(C-$(E*K));E=$(D-$(G*K));G=$(F-$(I*K));N=K;O=$(L($($($(G*G)+$($(E*E)+$($(M*M)+$(0.0))))/H)))}else{N=$(0.0);O=$(0.0)}H=$(x-v);x=$(y-w);y=$($(H*N)+v);v=$(H*O);H=$($(x*N)+w);w=$(x*O);O=$(y-w);x=$(H+v);N=$(y+w);w=$(H-v);j=X(f[r>>2]|0,e)|0;v=$(f[d+(j<<2)>>2]|0);H=$(f[d+(j+1<<2)>>2]|0);y=$(v-O);M=$(H-x);E=$(v-N);v=$(H-w);j=$($($(y*y)+$(0.0))+$(M*M))<$($($(E*E)+$(0.0))+$(v*v));d=a+56|0;e=a+60|0;r=f[e>>2]|0;k=f[a+64>>2]|0;l=(r|0)==(k<<5|0);if(j){do if(l)if((r+1|0)<0)aq(d);else{j=k<<6;B=r+32&-32;vi(d,r>>>0<1073741823?(j>>>0>>0?B:j):2147483647);P=f[e>>2]|0;break}else P=r;while(0);f[e>>2]=P+1;j=(f[d>>2]|0)+(P>>>5<<2)|0;f[j>>2]=f[j>>2]|1<<(P&31);Q=O;R=x}else{do if(l)if((r+1|0)<0)aq(d);else{P=k<<6;j=r+32&-32;vi(d,r>>>0<1073741823?(P>>>0>>0?j:P):2147483647);S=f[e>>2]|0;break}else S=r;while(0);f[e>>2]=S+1;e=(f[d>>2]|0)+(S>>>5<<2)|0;f[e>>2]=f[e>>2]&~(1<<(S&31));Q=N;R=w}S=~~+J(+(+Q+.5));e=f[a+48>>2]|0;f[e>>2]=S;S=~~+J(+(+R+.5));f[e+4>>2]=S;u=g;return}function Bc(a,c,d,e){a=a|0;c=c|0;d=d|0;e=e|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,o=0,p=0,q=0,r=0,s=0,t=Oa,v=Oa,w=Oa,x=Oa,y=0,z=0,A=0,B=Oa,C=Oa,D=Oa,E=Oa,F=Oa,G=Oa,H=Oa,I=Oa,K=Oa,M=Oa,N=Oa,O=0,P=Oa,Q=Oa,R=0;g=u;u=u+48|0;h=g+40|0;i=g+36|0;j=g+24|0;k=g+12|0;l=g;m=a+28|0;o=f[c>>2]|0;c=o+1|0;do if((o|0)!=-1){p=((c>>>0)%3|0|0)==0?o+-2|0:c;if(!((o>>>0)%3|0)){q=o+2|0;r=p;break}else{q=o+-1|0;r=p;break}}else{q=-1;r=-1}while(0);o=f[(f[m>>2]|0)+28>>2]|0;m=f[o+(r<<2)>>2]|0;r=f[o+(q<<2)>>2]|0;q=f[a+32>>2]|0;o=f[q>>2]|0;c=(f[q+4>>2]|0)-o>>2;if(c>>>0<=m>>>0)aq(q);p=o;o=f[p+(m<<2)>>2]|0;if(c>>>0<=r>>>0)aq(q);q=f[p+(r<<2)>>2]|0;r=(o|0)<(e|0);if(!(r&(q|0)<(e|0))){do if(r)s=o;else{if((e|0)>0){s=e+-1|0;break}p=a+52|0;if((f[p>>2]|0)<=0){u=g;return}c=f[a+48>>2]|0;m=0;do{f[c+(m<<2)>>2]=0;m=m+1|0}while((m|0)<(f[p>>2]|0));u=g;return}while(0);r=a+52|0;p=f[r>>2]|0;m=X(p,s)|0;if((p|0)<=0){u=g;return}p=f[a+48>>2]|0;s=0;do{f[p+(s<<2)>>2]=f[d+(s+m<<2)>>2];s=s+1|0}while((s|0)<(f[r>>2]|0));u=g;return}r=a+52|0;s=f[r>>2]|0;m=X(s,o)|0;t=$(f[d+(m<<2)>>2]|0);v=$(f[d+(m+1<<2)>>2]|0);m=X(s,q)|0;w=$(f[d+(m<<2)>>2]|0);x=$(f[d+(m+1<<2)>>2]|0);if(!(w!=t|x!=v)){m=f[a+48>>2]|0;f[m>>2]=~~w;f[m+4>>2]=~~x;u=g;return}m=a+44|0;s=f[(f[m>>2]|0)+(e<<2)>>2]|0;f[j>>2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(G-v);j=$($($(x*x)+$(0.0))+$(K*K))<$($($(D*D)+$(0.0))+$(t*t));d=a+56|0;e=a+60|0;r=f[e>>2]|0;k=f[a+64>>2]|0;l=(r|0)==(k<<5|0);if(j){do if(l)if((r+1|0)<0)aq(d);else{j=k<<6;A=r+32&-32;vi(d,r>>>0<1073741823?(j>>>0>>0?A:j):2147483647);O=f[e>>2]|0;break}else O=r;while(0);f[e>>2]=O+1;j=(f[d>>2]|0)+(O>>>5<<2)|0;f[j>>2]=f[j>>2]|1<<(O&31);P=N;Q=w}else{do if(l)if((r+1|0)<0)aq(d);else{O=k<<6;j=r+32&-32;vi(d,r>>>0<1073741823?(O>>>0>>0?j:O):2147483647);R=f[e>>2]|0;break}else R=r;while(0);f[e>>2]=R+1;e=(f[d>>2]|0)+(R>>>5<<2)|0;f[e>>2]=f[e>>2]&~(1<<(R&31));P=M;Q=v}R=~~+J(+(+P+.5));e=f[a+48>>2]|0;f[e>>2]=R;R=~~+J(+(+Q+.5));f[e+4>>2]=R;u=g;return}function Cc(a,c,d,e){a=a|0;c=c|0;d=d|0;e=e|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,o=0,p=0,q=0,r=0,s=0,t=0,v=Oa,w=Oa,x=Oa,y=Oa,z=0,A=0,B=0,C=Oa,D=Oa,E=Oa,F=Oa,G=Oa,H=Oa,I=Oa,K=Oa,M=Oa,N=Oa,O=Oa,P=0,Q=Oa,R=Oa,S=0;g=u;u=u+48|0;h=g+40|0;i=g+36|0;j=g+24|0;k=g+12|0;l=g;m=a+48|0;o=f[c>>2]|0;c=o+1|0;if((o|0)!=-1){p=((c>>>0)%3|0|0)==0?o+-2|0:c;c=o+(((o>>>0)%3|0|0)==0?2:-1)|0;if((p|0)==-1)q=-1;else q=f[(f[f[m>>2]>>2]|0)+(p<<2)>>2]|0;if((c|0)==-1){r=-1;s=q}else{r=f[(f[f[m>>2]>>2]|0)+(c<<2)>>2]|0;s=q}}else{r=-1;s=-1}q=f[a+52>>2]|0;c=f[q>>2]|0;m=(f[q+4>>2]|0)-c>>2;if(m>>>0<=s>>>0)aq(q);p=c;c=f[p+(s<<2)>>2]|0;if(m>>>0<=r>>>0)aq(q);q=f[p+(r<<2)>>2]|0;r=(c|0)<(e|0);if(!(r&(q|0)<(e|0))){do if(r)t=c;else{if((e|0)>0){t=e+-1|0;break}p=a+72|0;if((f[p>>2]|0)<=0){u=g;return}m=f[a+68>>2]|0;s=0;do{f[m+(s<<2)>>2]=0;s=s+1|0}while((s|0)<(f[p>>2]|0));u=g;return}while(0);r=a+72|0;p=f[r>>2]|0;s=X(p,t)|0;if((p|0)<=0){u=g;return}p=f[a+68>>2]|0;t=0;do{f[p+(t<<2)>>2]=f[d+(t+s<<2)>>2];t=t+1|0}while((t|0)<(f[r>>2]|0));u=g;return}r=a+72|0;t=f[r>>2]|0;s=X(t,c)|0;v=$(f[d+(s<<2)>>2]|0);w=$(f[d+(s+1<<2)>>2]|0);s=X(t,q)|0;x=$(f[d+(s<<2)>>2]|0);y=$(f[d+(s+1<<2)>>2]|0);if(!(x!=v|y!=w)){s=f[a+68>>2]|0;f[s>>2]=~~x;f[s+4>>2]=~~y;u=g;return}s=a+64|0;t=f[(f[s>>2]|0)+(e<<2)>>2]|0;f[j>>2]=0;f[j+4>>2]=0;f[j+8>>2]=0;p=a+60|0;m=f[p>>2]|0;if(!(b[m+84>>0]|0))z=f[(f[m+68>>2]|0)+(t<<2)>>2]|0;else z=t;f[i>>2]=z;z=b[m+24>>0]|0;f[h>>2]=f[i>>2];mb(m,h,z,j)|0;z=f[(f[s>>2]|0)+(c<<2)>>2]|0;f[k>>2]=0;f[k+4>>2]=0;f[k+8>>2]=0;c=f[p>>2]|0;if(!(b[c+84>>0]|0))A=f[(f[c+68>>2]|0)+(z<<2)>>2]|0;else A=z;f[i>>2]=A;A=b[c+24>>0]|0;f[h>>2]=f[i>>2];mb(c,h,A,k)|0;A=f[(f[s>>2]|0)+(q<<2)>>2]|0;f[l>>2]=0;f[l+4>>2]=0;f[l+8>>2]=0;q=f[p>>2]|0;if(!(b[q+84>>0]|0))B=f[(f[q+68>>2]|0)+(A<<2)>>2]|0;else B=A;f[i>>2]=B;B=b[q+24>>0]|0;f[h>>2]=f[i>>2];mb(q,h,B,l)|0;C=$(n[l>>2]);D=$(n[k>>2]);E=$(C-D);C=$(n[l+4>>2]);F=$(n[k+4>>2]);G=$(C-F);C=$(n[l+8>>2]);H=$(n[k+8>>2]);I=$(C-H);C=$($(n[j>>2])-D);D=$($(n[j+4>>2])-F);F=$($(n[j+8>>2])-H);H=$($($($(E*E)+$(0.0))+$(G*G))+$(I*I));if(H>$(0.0)){K=$($($($($(E*C)+$(0.0))+$(G*D))+$(I*F))/H);M=$(C-$(E*K));E=$(D-$(G*K));G=$(F-$(I*K));N=K;O=$(L($($($(G*G)+$($(E*E)+$($(M*M)+$(0.0))))/H)))}else{N=$(0.0);O=$(0.0)}H=$(x-v);x=$(y-w);y=$($(H*N)+v);v=$(H*O);H=$($(x*N)+w);w=$(x*O);O=$(y-w);x=$(H+v);N=$(y+w);w=$(H-v);j=X(f[r>>2]|0,e)|0;v=$(f[d+(j<<2)>>2]|0);H=$(f[d+(j+1<<2)>>2]|0);y=$(v-O);M=$(H-x);E=$(v-N);v=$(H-w);j=$($($(y*y)+$(0.0))+$(M*M))<$($($(E*E)+$(0.0))+$(v*v));d=a+76|0;e=a+80|0;r=f[e>>2]|0;k=f[a+84>>2]|0;l=(r|0)==(k<<5|0);if(j){do if(l)if((r+1|0)<0)aq(d);else{j=k<<6;B=r+32&-32;vi(d,r>>>0<1073741823?(j>>>0>>0?B:j):2147483647);P=f[e>>2]|0;break}else P=r;while(0);f[e>>2]=P+1;j=(f[d>>2]|0)+(P>>>5<<2)|0;f[j>>2]=f[j>>2]|1<<(P&31);Q=O;R=x}else{do if(l)if((r+1|0)<0)aq(d);else{P=k<<6;j=r+32&-32;vi(d,r>>>0<1073741823?(P>>>0>>0?j:P):2147483647);S=f[e>>2]|0;break}else S=r;while(0);f[e>>2]=S+1;e=(f[d>>2]|0)+(S>>>5<<2)|0;f[e>>2]=f[e>>2]&~(1<<(S&31));Q=N;R=w}S=~~+J(+(+Q+.5));e=f[a+68>>2]|0;f[e>>2]=S;S=~~+J(+(+R+.5));f[e+4>>2]=S;u=g;return}function Dc(a,c,d,e){a=a|0;c=c|0;d=d|0;e=e|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,o=0,p=0,q=0,r=0,s=0,t=Oa,v=Oa,w=Oa,x=Oa,y=0,z=0,A=0,B=Oa,C=Oa,D=Oa,E=Oa,F=Oa,G=Oa,H=Oa,I=Oa,K=Oa,M=Oa,N=Oa,O=0,P=Oa,Q=Oa,R=0;g=u;u=u+48|0;h=g+40|0;i=g+36|0;j=g+24|0;k=g+12|0;l=g;m=a+48|0;o=f[c>>2]|0;c=o+1|0;do if((o|0)!=-1){p=((c>>>0)%3|0|0)==0?o+-2|0:c;if(!((o>>>0)%3|0)){q=o+2|0;r=p;break}else{q=o+-1|0;r=p;break}}else{q=-1;r=-1}while(0);o=f[(f[m>>2]|0)+28>>2]|0;m=f[o+(r<<2)>>2]|0;r=f[o+(q<<2)>>2]|0;q=f[a+52>>2]|0;o=f[q>>2]|0;c=(f[q+4>>2]|0)-o>>2;if(c>>>0<=m>>>0)aq(q);p=o;o=f[p+(m<<2)>>2]|0;if(c>>>0<=r>>>0)aq(q);q=f[p+(r<<2)>>2]|0;r=(o|0)<(e|0);if(!(r&(q|0)<(e|0))){do if(r)s=o;else{if((e|0)>0){s=e+-1|0;break}p=a+72|0;if((f[p>>2]|0)<=0){u=g;return}c=f[a+68>>2]|0;m=0;do{f[c+(m<<2)>>2]=0;m=m+1|0}while((m|0)<(f[p>>2]|0));u=g;return}while(0);r=a+72|0;p=f[r>>2]|0;m=X(p,s)|0;if((p|0)<=0){u=g;return}p=f[a+68>>2]|0;s=0;do{f[p+(s<<2)>>2]=f[d+(s+m<<2)>>2];s=s+1|0}while((s|0)<(f[r>>2]|0));u=g;return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L($($($(F*F)+$($(D*D)+$($(K*K)+$(0.0))))/G)))}else{M=$(0.0);N=$(0.0)}G=$(w-t);w=$(x-v);x=$($(G*M)+t);t=$(G*N);G=$($(w*M)+v);v=$(w*N);N=$(x-v);w=$(G+t);M=$(x+v);v=$(G-t);j=X(f[r>>2]|0,e)|0;t=$(f[d+(j<<2)>>2]|0);G=$(f[d+(j+1<<2)>>2]|0);x=$(t-N);K=$(G-w);D=$(t-M);t=$(G-v);j=$($($(x*x)+$(0.0))+$(K*K))<$($($(D*D)+$(0.0))+$(t*t));d=a+76|0;e=a+80|0;r=f[e>>2]|0;k=f[a+84>>2]|0;l=(r|0)==(k<<5|0);if(j){do if(l)if((r+1|0)<0)aq(d);else{j=k<<6;A=r+32&-32;vi(d,r>>>0<1073741823?(j>>>0>>0?A:j):2147483647);O=f[e>>2]|0;break}else O=r;while(0);f[e>>2]=O+1;j=(f[d>>2]|0)+(O>>>5<<2)|0;f[j>>2]=f[j>>2]|1<<(O&31);P=N;Q=w}else{do if(l)if((r+1|0)<0)aq(d);else{O=k<<6;j=r+32&-32;vi(d,r>>>0<1073741823?(O>>>0>>0?j:O):2147483647);R=f[e>>2]|0;break}else R=r;while(0);f[e>>2]=R+1;e=(f[d>>2]|0)+(R>>>5<<2)|0;f[e>>2]=f[e>>2]&~(1<<(R&31));P=M;Q=v}R=~~+J(+(+P+.5));e=f[a+68>>2]|0;f[e>>2]=R;R=~~+J(+(+Q+.5));f[e+4>>2]=R;u=g;return}function Ec(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,i=0,j=0,k=0,l=0,m=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=Oa,F=Oa,G=Oa,H=0,I=0,J=0,K=0;d=b[c+11>>0]|0;e=d<<24>>24<0;g=e?f[c>>2]|0:c;i=e?f[c+4>>2]|0:d&255;if(i>>>0>3){d=g;e=i;j=i;while(1){k=X(h[d>>0]|h[d+1>>0]<<8|h[d+2>>0]<<16|h[d+3>>0]<<24,1540483477)|0;e=(X(k>>>24^k,1540483477)|0)^(X(e,1540483477)|0);j=j+-4|0;if(j>>>0<=3)break;else d=d+4|0}d=i+-4|0;j=d&-4;l=d-j|0;m=g+(j+4)|0;o=e}else{l=i;m=g;o=i}switch(l|0){case 3:{p=h[m+2>>0]<<16^o;q=6;break}case 2:{p=o;q=6;break}case 1:{r=o;q=7;break}default:s=o}if((q|0)==6){r=h[m+1>>0]<<8^p;q=7}if((q|0)==7)s=X(r^h[m>>0],1540483477)|0;m=X(s>>>13^s,1540483477)|0;s=m>>>15^m;m=a+4|0;r=f[m>>2]|0;p=(r|0)==0;a:do if(!p){o=r+-1|0;l=(o&r|0)==0;if(!l)if(s>>>0>>0)t=s;else t=(s>>>0)%(r>>>0)|0;else t=s&o;e=f[(f[a>>2]|0)+(t<<2)>>2]|0;if((e|0)!=0?(j=f[e>>2]|0,(j|0)!=0):0){e=(i|0)==0;if(l){if(e){l=j;while(1){d=f[l+4>>2]|0;if(!((d|0)==(s|0)|(d&o|0)==(t|0))){u=t;break a}d=b[l+8+11>>0]|0;if(!((d<<24>>24<0?f[l+12>>2]|0:d&255)|0)){v=l;break}l=f[l>>2]|0;if(!l){u=t;break a}}w=v+20|0;return w|0}else x=j;b:while(1){l=f[x+4>>2]|0;if(!((l|0)==(s|0)|(l&o|0)==(t|0))){u=t;break a}l=x+8|0;d=b[l+11>>0]|0;k=d<<24>>24<0;y=d&255;do if(((k?f[x+12>>2]|0:y)|0)==(i|0)){d=f[l>>2]|0;if(k)if(!(Vk(d,g,i)|0)){v=x;q=63;break b}else break;if((b[g>>0]|0)==(d&255)<<24>>24){d=l;z=y;A=g;do{z=z+-1|0;d=d+1|0;if(!z){v=x;q=63;break b}A=A+1|0}while((b[d>>0]|0)==(b[A>>0]|0))}}while(0);x=f[x>>2]|0;if(!x){u=t;break a}}if((q|0)==63){w=v+20|0;return w|0}}if(e){o=j;while(1){y=f[o+4>>2]|0;if((y|0)!=(s|0)){if(y>>>0>>0)B=y;else B=(y>>>0)%(r>>>0)|0;if((B|0)!=(t|0)){u=t;break a}}y=b[o+8+11>>0]|0;if(!((y<<24>>24<0?f[o+12>>2]|0:y&255)|0)){v=o;break}o=f[o>>2]|0;if(!o){u=t;break a}}w=v+20|0;return w|0}else C=j;c:while(1){o=f[C+4>>2]|0;if((o|0)!=(s|0)){if(o>>>0>>0)D=o;else D=(o>>>0)%(r>>>0)|0;if((D|0)!=(t|0)){u=t;break a}}o=C+8|0;e=b[o+11>>0]|0;y=e<<24>>24<0;l=e&255;do if(((y?f[C+12>>2]|0:l)|0)==(i|0)){e=f[o>>2]|0;if(y)if(!(Vk(e,g,i)|0)){v=C;q=63;break c}else break;if((b[g>>0]|0)==(e&255)<<24>>24){e=o;k=l;A=g;do{k=k+-1|0;e=e+1|0;if(!k){v=C;q=63;break c}A=A+1|0}while((b[e>>0]|0)==(b[A>>0]|0))}}while(0);C=f[C>>2]|0;if(!C){u=t;break a}}if((q|0)==63){w=v+20|0;return w|0}}else u=t}else u=0;while(0);t=ln(24)|0;pj(t+8|0,c);f[t+20>>2]=0;f[t+4>>2]=s;f[t>>2]=0;c=a+12|0;E=$(((f[c>>2]|0)+1|0)>>>0);F=$(r>>>0);G=$(n[a+16>>2]);do if(p|$(G*F)>>0<3|(r+-1&r|0)!=0)&1;g=~~$(W($(E/G)))>>>0;ei(a,C>>>0>>0?g:C);C=f[m>>2]|0;g=C+-1|0;if(!(g&C)){H=C;I=g&s;break}if(s>>>0>>0){H=C;I=s}else{H=C;I=(s>>>0)%(C>>>0)|0}}else{H=r;I=u}while(0);u=(f[a>>2]|0)+(I<<2)|0;I=f[u>>2]|0;if(!I){r=a+8|0;f[t>>2]=f[r>>2];f[r>>2]=t;f[u>>2]=r;r=f[t>>2]|0;if(r|0){u=f[r+4>>2]|0;r=H+-1|0;if(r&H)if(u>>>0>>0)J=u;else J=(u>>>0)%(H>>>0)|0;else J=u&r;K=(f[a>>2]|0)+(J<<2)|0;q=61}}else{f[t>>2]=f[I>>2];K=I;q=61}if((q|0)==61)f[K>>2]=t;f[c>>2]=(f[c>>2]|0)+1;v=t;w=v+20|0;return w|0}function Fc(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;var g=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0.0,q=0.0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0.0,G=0.0,H=0,J=0,K=0,L=0,M=0,N=0,O=0.0,P=0,Q=0.0,R=0.0,S=0,T=0.0,U=0,V=0,W=0,X=0.0,Y=0,Z=0,_=0,$=0,aa=0,ba=0,ca=0.0,da=0,ea=0.0;g=a+4|0;i=f[g>>2]|0;j=a+100|0;if(i>>>0<(f[j>>2]|0)>>>0){f[g>>2]=i+1;k=h[i>>0]|0;l=0}else{k=Si(a)|0;l=0}a:while(1){switch(k|0){case 46:{m=8;break a;break}case 48:break;default:{n=0;o=0;p=1.0;q=0.0;r=0;s=k;t=l;u=0;v=0;w=0;x=0;break a}}i=f[g>>2]|0;if(i>>>0<(f[j>>2]|0)>>>0){f[g>>2]=i+1;k=h[i>>0]|0;l=1;continue}else{k=Si(a)|0;l=1;continue}}if((m|0)==8){k=f[g>>2]|0;if(k>>>0<(f[j>>2]|0)>>>0){f[g>>2]=k+1;y=h[k>>0]|0}else y=Si(a)|0;if((y|0)==48){k=0;i=0;while(1){z=f[g>>2]|0;if(z>>>0<(f[j>>2]|0)>>>0){f[g>>2]=z+1;A=h[z>>0]|0}else A=Si(a)|0;z=Vn(k|0,i|0,-1,-1)|0;B=I;if((A|0)==48){k=z;i=B}else{n=1;o=0;p=1.0;q=0.0;r=0;s=A;t=1;u=0;v=0;w=z;x=B;break}}}else{n=1;o=0;p=1.0;q=0.0;r=0;s=y;t=l;u=0;v=0;w=0;x=0}}while(1){l=s+-48|0;y=s|32;if(l>>>0>=10){A=(s|0)==46;if(!(A|(y+-97|0)>>>0<6)){C=s;break}if(A)if(!n){D=1;E=o;F=p;G=q;H=r;J=t;K=v;L=u;M=v;N=u}else{C=46;break}else m=20}else m=20;if((m|0)==20){m=0;A=(s|0)>57?y+-87|0:l;do if(!((u|0)<0|(u|0)==0&v>>>0<8))if((u|0)<0|(u|0)==0&v>>>0<14){O=p*.0625;P=o;Q=O;R=q+O*+(A|0);S=r;break}else{l=(o|0)!=0|(A|0)==0;P=l?o:1;Q=p;R=l?q:q+p*.5;S=r;break}else{P=o;Q=p;R=q;S=A+(r<<4)|0}while(0);A=Vn(v|0,u|0,1,0)|0;D=n;E=P;F=Q;G=R;H=S;J=1;K=w;L=x;M=A;N=I}A=f[g>>2]|0;if(A>>>0<(f[j>>2]|0)>>>0){f[g>>2]=A+1;n=D;o=E;p=F;q=G;r=H;s=h[A>>0]|0;t=J;u=N;v=M;w=K;x=L;continue}else{n=D;o=E;p=F;q=G;r=H;s=Si(a)|0;t=J;u=N;v=M;w=K;x=L;continue}}do if(!t){L=(f[j>>2]|0)==0;if(!L)f[g>>2]=(f[g>>2]|0)+-1;if(e){if(!L)f[g>>2]=(f[g>>2]|0)+-1;if(!((n|0)==0|L))f[g>>2]=(f[g>>2]|0)+-1}else Ym(a,0);T=+(d|0)*0.0}else{L=(n|0)==0;K=L?v:w;M=L?u:x;if((u|0)<0|(u|0)==0&v>>>0<8){L=r;N=v;J=u;while(1){s=L<<4;H=N;N=Vn(N|0,J|0,1,0)|0;if(!((J|0)<0|(J|0)==0&H>>>0<7)){U=s;break}else{L=s;J=I}}}else U=r;if((C|32|0)==112){J=Re(a,e)|0;L=I;if((J|0)==0&(L|0)==-2147483648){if(!e){Ym(a,0);T=0.0;break}if(!(f[j>>2]|0)){V=0;W=0}else{f[g>>2]=(f[g>>2]|0)+-1;V=0;W=0}}else{V=J;W=L}}else if(!(f[j>>2]|0)){V=0;W=0}else{f[g>>2]=(f[g>>2]|0)+-1;V=0;W=0}L=Tn(K|0,M|0,2)|0;J=Vn(L|0,I|0,-32,-1)|0;L=Vn(J|0,I|0,V|0,W|0)|0;J=I;if(!U){T=+(d|0)*0.0;break}N=0-c|0;s=((N|0)<0)<<31>>31;if((J|0)>(s|0)|(J|0)==(s|0)&L>>>0>N>>>0){N=Vq()|0;f[N>>2]=34;T=+(d|0)*1797693134862315708145274.0e284*1797693134862315708145274.0e284;break}N=c+-106|0;s=((N|0)<0)<<31>>31;if((J|0)<(s|0)|(J|0)==(s|0)&L>>>0>>0){N=Vq()|0;f[N>>2]=34;T=+(d|0)*2.2250738585072014e-308*2.2250738585072014e-308;break}if((U|0)>-1){G=q;N=U;s=L;H=J;while(1){E=!(G>=.5);o=N<<1|(E^1)&1;F=G+(E?G:G+-1.0);E=Vn(s|0,H|0,-1,-1)|0;D=I;if((o|0)>-1){G=F;N=o;s=E;H=D}else{X=F;Y=o;Z=E;_=D;break}}}else{X=q;Y=U;Z=L;_=J}H=((b|0)<0)<<31>>31;s=Xn(32,0,c|0,((c|0)<0)<<31>>31|0)|0;N=Vn(s|0,I|0,Z|0,_|0)|0;s=I;if((s|0)<(H|0)|(s|0)==(H|0)&N>>>0>>0)if((N|0)>0){$=N;m=59}else{aa=0;ba=84;m=61}else{$=b;m=59}if((m|0)==59)if(($|0)<53){aa=$;ba=84-$|0;m=61}else{ca=0.0;da=$;ea=+(d|0)}if((m|0)==61){G=+(d|0);ca=+rq(+bk(1.0,ba),G);da=aa;ea=G}N=(Y&1|0)==0&(X!=0.0&(da|0)<32);G=(N?0.0:X)*ea+(ca+ea*+((Y+(N&1)|0)>>>0))-ca;if(!(G!=0.0)){N=Vq()|0;f[N>>2]=34}T=+sq(G,Z)}while(0);return +T}function Gc(a,c,d,e){a=a|0;c=c|0;d=d|0;e=e|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=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|0)/3|0)*12|0)+(((y|0)%3|0)<<2)>>2]|0;D=f[n>>2]|0;if((f[D+(A<<2)>>2]|0)==(f[D+(C<<2)>>2]|0)){E=t+1|0;if(z)F=-1;else F=((E>>>0)%3|0|0)==0?t+-2|0:E;do if(!B)if(!((y>>>0)%3|0)){G=y+2|0;break}else{G=y+-1|0;break}else G=-1;while(0);if((F|0)==-1)H=-1;else H=f[(f[o>>2]|0)+(((F|0)/3|0)*12|0)+(((F|0)%3|0)<<2)>>2]|0;if((G|0)==-1)I=-1;else I=f[(f[o>>2]|0)+(((G|0)/3|0)*12|0)+(((G|0)%3|0)<<2)>>2]|0;if((f[D+(H<<2)>>2]|0)==(f[D+(I<<2)>>2]|0))break}}else{if(z)J=-1;else J=f[(f[o>>2]|0)+(((t|0)/3|0)*12|0)+(((t|0)%3|0)<<2)>>2]|0;B=(y|0)==-1;if(B)K=-1;else K=f[(f[o>>2]|0)+(((y|0)/3|0)*12|0)+(((y|0)%3|0)<<2)>>2]|0;if((J|0)==(K|0)){E=t+1|0;if(z)L=-1;else L=((E>>>0)%3|0|0)==0?t+-2|0:E;do if(!B)if(!((y>>>0)%3|0)){M=y+2|0;break}else{M=y+-1|0;break}else M=-1;while(0);if((L|0)==-1)N=-1;else N=f[(f[o>>2]|0)+(((L|0)/3|0)*12|0)+(((L|0)%3|0)<<2)>>2]|0;if((M|0)==-1)O=-1;else O=f[(f[o>>2]|0)+(((M|0)/3|0)*12|0)+(((M|0)%3|0)<<2)>>2]|0;if((N|0)==(O|0))break}}b[p>>0]=0;y=f[a>>2]|0;B=y+(q>>>5<<2)|0;f[B>>2]=f[B>>2]|1<<(q&31);B=y+(s>>>5<<2)|0;f[B>>2]=f[B>>2]|1<<(s&31);B=((v>>>0)%3|0|0)==0?q+-2|0:v;if((B|0)==-1)P=-1;else P=f[(f[r>>2]|0)+(B<<2)>>2]|0;B=(f[k>>2]|0)+(P>>>5<<2)|0;f[B>>2]=f[B>>2]|1<<(P&31);B=(((q>>>0)%3|0|0)==0?2:-1)+q|0;if((B|0)==-1)Q=-1;else Q=f[(f[r>>2]|0)+(B<<2)>>2]|0;B=(f[k>>2]|0)+(Q>>>5<<2)|0;f[B>>2]=f[B>>2]|1<<(Q&31);B=s+1|0;y=((B>>>0)%3|0|0)==0?s+-2|0:B;if((y|0)==-1)R=-1;else R=f[(f[r>>2]|0)+(y<<2)>>2]|0;y=(f[k>>2]|0)+(R>>>5<<2)|0;f[y>>2]=f[y>>2]|1<<(R&31);y=(((s>>>0)%3|0|0)==0?2:-1)+s|0;if((y|0)==-1)S=-1;else S=f[(f[r>>2]|0)+(y<<2)>>2]|0;y=(f[k>>2]|0)+(S>>>5<<2)|0;f[y>>2]=f[y>>2]|1<<(S&31)}}while(0);q=q+1|0}while(q>>>0<(f[r+4>>2]|0)-(f[r>>2]|0)>>2>>>0)}if((c|0)!=0&(e|0)!=0){Qc(a,c,e);j=1;u=g;return j|0}else{md(a,0,0);j=1;u=g;return j|0}return 0}function Hc(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0;d=u;u=u+32|0;e=d+12|0;g=d+8|0;h=d+4|0;i=d;j=a+8|0;a:do if(f[j>>2]|0?(k=f[a>>2]|0,l=a+4|0,f[a>>2]=l,f[(f[l>>2]|0)+8>>2]=0,f[l>>2]=0,f[j>>2]=0,m=f[k+4>>2]|0,n=(m|0)==0?k:m,n|0):0){m=a+4|0;k=n;n=f[b>>2]|0;while(1){if((n|0)==(f[c>>2]|0))break;o=k+16|0;f[o>>2]=f[n+16>>2];if((k|0)!=(n|0)){f[h>>2]=f[n+20>>2];f[i>>2]=n+24;f[g>>2]=f[h>>2];f[e>>2]=f[i>>2];Oc(k+20|0,g,e)}p=k+8|0;q=f[p>>2]|0;do if(q){r=f[q>>2]|0;if((r|0)==(k|0)){f[q>>2]=0;s=f[q+4>>2]|0;if(!s){t=q;break}else v=s;while(1){s=f[v>>2]|0;if(s|0){v=s;continue}s=f[v+4>>2]|0;if(!s)break;else v=s}t=v;break}else{f[q+4>>2]=0;if(!r){t=q;break}else w=r;while(1){s=f[w>>2]|0;if(s|0){w=s;continue}s=f[w+4>>2]|0;if(!s)break;else w=s}t=w;break}}else t=0;while(0);q=f[l>>2]|0;do if(q){r=f[o>>2]|0;s=q;while(1){if((r|0)<(f[s+16>>2]|0)){x=f[s>>2]|0;if(!x){y=22;break}else z=x}else{A=s+4|0;x=f[A>>2]|0;if(!x){y=25;break}else z=x}s=z}if((y|0)==22){y=0;B=s;C=s;break}else if((y|0)==25){y=0;B=s;C=A;break}}else{B=l;C=l}while(0);f[k>>2]=0;f[k+4>>2]=0;f[p>>2]=B;f[C>>2]=k;q=f[f[a>>2]>>2]|0;if(!q)D=k;else{f[a>>2]=q;D=f[C>>2]|0}Oe(f[m>>2]|0,D);f[j>>2]=(f[j>>2]|0)+1;q=f[n+4>>2]|0;if(!q){o=n+8|0;r=f[o>>2]|0;if((f[r>>2]|0)==(n|0))E=r;else{r=o;do{o=f[r>>2]|0;r=o+8|0;x=f[r>>2]|0}while((f[x>>2]|0)!=(o|0));E=x}}else{r=q;while(1){p=f[r>>2]|0;if(!p)break;else r=p}E=r}f[b>>2]=E;if(!t)break a;else{k=t;n=E}}n=f[k+8>>2]|0;if(!n)F=k;else{m=n;while(1){n=f[m+8>>2]|0;if(!n)break;else m=n}F=m}Oj(a,F)}while(0);F=f[b>>2]|0;E=f[c>>2]|0;if((F|0)==(E|0)){u=d;return}c=a+4|0;t=a+4|0;D=F;while(1){Kg(e,a,D+16|0);F=f[c>>2]|0;do if(F){C=f[e>>2]|0;B=f[C+16>>2]|0;A=F;while(1){if((B|0)<(f[A+16>>2]|0)){z=f[A>>2]|0;if(!z){y=43;break}else G=z}else{H=A+4|0;z=f[H>>2]|0;if(!z){y=46;break}else G=z}A=G}if((y|0)==43){y=0;I=A;J=A;K=C;break}else if((y|0)==46){y=0;I=A;J=H;K=C;break}}else{I=c;J=c;K=f[e>>2]|0}while(0);f[K>>2]=0;f[K+4>>2]=0;f[K+8>>2]=I;f[J>>2]=K;F=f[f[a>>2]>>2]|0;if(!F)L=K;else{f[a>>2]=F;L=f[J>>2]|0}Oe(f[t>>2]|0,L);f[j>>2]=(f[j>>2]|0)+1;F=f[D+4>>2]|0;if(!F){m=D+8|0;B=f[m>>2]|0;if((f[B>>2]|0)==(D|0))M=B;else{B=m;do{m=f[B>>2]|0;B=m+8|0;r=f[B>>2]|0}while((f[r>>2]|0)!=(m|0));M=r}}else{B=F;while(1){r=f[B>>2]|0;if(!r)break;else B=r}M=B}f[b>>2]=M;if((M|0)==(E|0))break;else D=M}u=d;return}function Ic(a,b,c,d,e,g){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;g=g|0;var h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,Y=0,Z=0,_=0,$=0,aa=0,ba=0,ca=0,da=0,ea=0,fa=0,ga=0,ha=0,ia=0,ja=0;g=u;u=u+32|0;d=g+16|0;h=g+8|0;i=g;j=f[a+28>>2]|0;k=f[a+32>>2]|0;l=e>>>0>1073741823?-1:e<<2;m=Lq(l)|0;sj(m|0,0,l|0)|0;n=Lq(l)|0;sj(n|0,0,l|0)|0;l=a+36|0;o=f[l>>2]|0;p=f[o+4>>2]|0;q=f[o>>2]|0;r=p-q|0;a:do if((r|0)>4){s=r>>2;t=(e|0)>0;v=a+8|0;w=h+4|0;x=i+4|0;y=d+4|0;z=m+4|0;A=h+4|0;B=i+4|0;C=d+4|0;D=j+12|0;E=e<<2;F=s+-1|0;if(p-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2]|0;I=f[o>>2]|0;f[I+(C<<2)>>2]=(H|0)<(J|0)?J:H;K=I}C=C+1|0}while((C|0)<(f[g>>2]|0));L=K}else L=f[o>>2]|0;C=(f[D+(E<<2)>>2]|0)-(f[L+(E<<2)>>2]|0)|0;I=B+(E<<2)|0;f[I>>2]=C;if((C|0)>=(f[q>>2]|0)){if((C|0)>(f[s>>2]|0)){M=C-(f[r>>2]|0)|0;N=42}}else{M=(f[r>>2]|0)+C|0;N=42}if((N|0)==42){N=0;f[I>>2]=M}E=E+1|0;A=f[g>>2]|0;if((E|0)>=(A|0))break;else y=L}}}else N=16}else N=16;if((N|0)==16?(N=0,y=b+(z<<2)|0,A=c+(z<<2)|0,E=f[g>>2]|0,(E|0)>0):0){B=0;D=b+((X(x+-2|0,e)|0)<<2)|0;I=E;while(1){if((I|0)>0){E=0;do{C=f[D+(E<<2)>>2]|0;H=f[n>>2]|0;if((C|0)>(H|0)){J=f[o>>2]|0;f[J+(E<<2)>>2]=H;O=J}else{J=f[p>>2]|0;H=f[o>>2]|0;f[H+(E<<2)>>2]=(C|0)<(J|0)?J:C;O=H}E=E+1|0}while((E|0)<(f[g>>2]|0));P=O}else P=f[o>>2]|0;E=(f[y+(B<<2)>>2]|0)-(f[P+(B<<2)>>2]|0)|0;H=A+(B<<2)|0;f[H>>2]=E;if((E|0)>=(f[q>>2]|0)){if((E|0)>(f[s>>2]|0)){Q=E-(f[r>>2]|0)|0;N=29}}else{Q=(f[r>>2]|0)+E|0;N=29}if((N|0)==29){N=0;f[H>>2]=Q}B=B+1|0;I=f[g>>2]|0;if((B|0)>=(I|0))break;else D=P}}if((x|0)<=2)break a}aq(i)}while(0);if((e|0)>0)sj(h|0,0,e<<2|0)|0;e=f[g>>2]|0;if((e|0)<=0){Mq(h);return 1}i=a+16|0;P=a+32|0;Q=a+12|0;O=a+28|0;L=a+20|0;M=a+24|0;a=0;K=h;G=e;while(1){if((G|0)>0){e=0;do{F=f[K+(e<<2)>>2]|0;d=f[i>>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f[J+(I<<2)>>2]|0;if(t)sj(m|0,0,F|0)|0;if((G|0)!=-1){s=f[j>>2]|0;L=0;M=G;while(1){if(((f[s+(M>>>5<<2)>>2]&1<<(M&31)|0)==0?(N=f[(f[(f[D>>2]|0)+12>>2]|0)+(M<<2)>>2]|0,(N|0)!=-1):0)?(O=f[E>>2]|0,P=f[k>>2]|0,Q=f[P+(f[O+(N<<2)>>2]<<2)>>2]|0,R=N+1|0,S=f[P+(f[O+((((R>>>0)%3|0|0)==0?N+-2|0:R)<<2)>>2]<<2)>>2]|0,R=f[P+(f[O+((((N>>>0)%3|0|0)==0?2:-1)+N<<2)>>2]<<2)>>2]|0,(Q|0)<(I|0)&(S|0)<(I|0)&(R|0)<(I|0)):0){N=X(Q,e)|0;Q=X(S,e)|0;S=X(R,e)|0;if(t){R=0;do{f[n+(R<<2)>>2]=(f[b+(R+S<<2)>>2]|0)+(f[b+(R+Q<<2)>>2]|0)-(f[b+(R+N<<2)>>2]|0);R=R+1|0}while((R|0)!=(e|0));if(t){R=0;do{N=m+(R<<2)|0;f[N>>2]=(f[N>>2]|0)+(f[n+(R<<2)>>2]|0);R=R+1|0}while((R|0)!=(e|0))}}T=L+1|0}else T=L;R=(((M>>>0)%3|0|0)==0?2:-1)+M|0;do if(((R|0)!=-1?(f[s+(R>>>5<<2)>>2]&1<<(R&31)|0)==0:0)?(N=f[(f[(f[D>>2]|0)+12>>2]|0)+(R<<2)>>2]|0,(N|0)!=-1):0)if(!((N>>>0)%3|0)){U=N+2|0;break}else{U=N+-1|0;break}else U=-1;while(0);M=(U|0)==(G|0)?-1:U;if((M|0)==-1)break;else L=T}L=X(I,e)|0;if(!T){V=L;W=28}else{if(t){M=0;do{G=m+(M<<2)|0;f[G>>2]=(f[G>>2]|0)/(T|0)|0;M=M+1|0}while((M|0)!=(e|0))}M=b+(L<<2)|0;G=c+(L<<2)|0;s=f[M+4>>2]|0;R=f[m>>2]|0;N=f[z>>2]|0;f[h>>2]=f[M>>2];f[A>>2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>2]|0;H=f[o>>2]|0;f[H+(D<<2)>>2]=(G|0)<(I|0)?I:G;J=H}D=D+1|0}while((D|0)<(f[g>>2]|0));K=J}else K=f[o>>2]|0;D=(f[E+(F<<2)>>2]|0)-(f[K+(F<<2)>>2]|0)|0;H=B+(F<<2)|0;f[H>>2]=D;if((D|0)>=(f[q>>2]|0)){if((D|0)>(f[s>>2]|0)){L=D-(f[r>>2]|0)|0;M=39}}else{L=(f[r>>2]|0)+D|0;M=39}if((M|0)==39){M=0;f[H>>2]=L}F=F+1|0;C=f[g>>2]|0;if((F|0)>=(C|0))break;else z=K}}}else M=13;if((M|0)==13?(M=0,z=b+(A<<2)|0,C=c+(A<<2)|0,F=f[g>>2]|0,(F|0)>0):0){B=0;E=b+((X(y+-2|0,e)|0)<<2)|0;H=F;while(1){if((H|0)>0){F=0;do{D=f[E+(F<<2)>>2]|0;G=f[n>>2]|0;if((D|0)>(G|0)){I=f[o>>2]|0;f[I+(F<<2)>>2]=G;N=I}else{I=f[p>>2]|0;G=f[o>>2]|0;f[G+(F<<2)>>2]=(D|0)<(I|0)?I:D;N=G}F=F+1|0}while((F|0)<(f[g>>2]|0));O=N}else O=f[o>>2]|0;F=(f[z+(B<<2)>>2]|0)-(f[O+(B<<2)>>2]|0)|0;G=C+(B<<2)|0;f[G>>2]=F;if((F|0)>=(f[q>>2]|0)){if((F|0)>(f[s>>2]|0)){P=F-(f[r>>2]|0)|0;M=26}}else{P=(f[r>>2]|0)+F|0;M=26}if((M|0)==26){M=0;f[G>>2]=P}B=B+1|0;H=f[g>>2]|0;if((B|0)>=(H|0))break;else E=O}}if((y|0)<=2)break a}aq(i)}while(0);if((e|0)>0)sj(h|0,0,e<<2|0)|0;e=f[g>>2]|0;if((e|0)<=0){Mq(h);return 1}i=a+16|0;O=a+32|0;P=a+12|0;N=a+28|0;K=a+20|0;L=a+24|0;a=0;J=h;d=e;while(1){if((d|0)>0){e=0;do{l=f[J+(e<<2)>>2]|0;j=f[i>>2]|0;if((l|0)>(j|0)){k=f[O>>2]|0;f[k+(e<<2)>>2]=j;Q=k}else{k=f[P>>2]|0;j=f[O>>2]|0;f[j+(e<<2)>>2]=(l|0)<(k|0)?k:l;Q=j}e=e+1|0}while((e|0)<(f[g>>2]|0));R=Q}else R=f[O>>2]|0;e=(f[b+(a<<2)>>2]|0)-(f[R+(a<<2)>>2]|0)|0;j=c+(a<<2)|0;f[j>>2]=e;if((e|0)>=(f[N>>2]|0)){if((e|0)>(f[L>>2]|0)){S=e-(f[K>>2]|0)|0;M=53}}else{S=(f[K>>2]|0)+e|0;M=53}if((M|0)==53){M=0;f[j>>2]=S}a=a+1|0;d=f[g>>2]|0;if((a|0)>=(d|0))break;else J=R}Mq(h);return 1}function Mc(a,c,d,e,g){a=a|0;c=c|0;d=d|0;e=e|0;g=g|0;var h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,J=0;h=u;u=u+48|0;i=h+28|0;j=h+24|0;k=h;l=h+12|0;m=h+40|0;if((c|0)<0){n=0;u=h;return n|0}if(!c){n=1;u=h;return n|0}o=(d|0)>1;p=o?d:1;f[k>>2]=0;d=k+4|0;f[d>>2]=0;f[k+8>>2]=0;gk(k,c);q=k+8|0;if(o){o=0;r=0;while(1){s=1;t=f[a+(r<<2)>>2]|0;do{v=f[a+(s+r<<2)>>2]|0;t=t>>>0>>0?v:t;s=s+1|0}while((s|0)!=(p|0));s=(_(t|0)|0)^31;v=t>>>0>o>>>0?t:o;w=(t|0)==0?1:s+1|0;f[i>>2]=w;s=f[d>>2]|0;if(s>>>0<(f[q>>2]|0)>>>0){f[s>>2]=w;f[d>>2]=s+4}else Ri(k,i);r=r+p|0;if((r|0)>=(c|0)){x=v;break}else o=v}}else{o=0;r=0;while(1){v=f[a+(o<<2)>>2]|0;s=(_(v|0)|0)^31;w=v>>>0>r>>>0?v:r;y=(v|0)==0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B>>0]|0;F=F+1|0;B=B+1|0}while((F|0)<(o|0));b[w+22>>0]=0;w=(Jh(e,i)|0)==0;if((b[i+11>>0]|0)<0)Oq(f[i>>2]|0);if(!w){f[i>>2]=0;f[i+4>>2]=0;f[i+8>>2]=0;w=ln(32)|0;f[i>>2]=w;f[i+8>>2]=-2147483616;f[i+4>>2]=22;F=w;B=15964;o=F+22|0;do{b[F>>0]=b[B>>0]|0;F=F+1|0;B=B+1|0}while((F|0)<(o|0));b[w+22>>0]=0;w=Mk(e,i)|0;if((b[i+11>>0]|0)<0)Oq(f[i>>2]|0);H=w}else G=32}else G=32;if((G|0)==32)H=z>>>0<18&((A|0)>(r|0)|(A|0)==(r|0)&v>>>0>=C>>>0)&1;b[m>>0]=H;C=g+16|0;v=f[C+4>>2]|0;if(!((v|0)>0|(v|0)==0&(f[C>>2]|0)>>>0>0)){f[j>>2]=f[g+4>>2];f[i>>2]=f[j>>2];Me(g,i,m,m+1|0)|0}switch(H|0){case 0:{J=td(a,c,p,k,g)|0;break}case 1:{J=Tc(a,c,x,l,e,g)|0;break}default:J=0}g=f[k>>2]|0;if(g|0){k=f[d>>2]|0;if((k|0)!=(g|0))f[d>>2]=k+(~((k+-4-g|0)>>>2)<<2);Oq(g)}n=J;u=h;return n|0}function Nc(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0;if((b|0)<0)return;c=a+12|0;d=f[c>>2]|0;e=f[a+8>>2]|0;g=e;h=d;if(d-e>>2>>>0<=b>>>0)return;e=g+(b<<2)|0;d=f[(f[e>>2]|0)+56>>2]|0;i=f[(f[g+(b<<2)>>2]|0)+60>>2]|0;g=e+4|0;if((g|0)!=(h|0)){j=g;g=e;do{k=f[j>>2]|0;f[j>>2]=0;l=f[g>>2]|0;f[g>>2]=k;if(l|0){k=l+88|0;m=f[k>>2]|0;f[k>>2]=0;if(m|0){k=f[m+8>>2]|0;if(k|0){n=m+12|0;if((f[n>>2]|0)!=(k|0))f[n>>2]=k;Oq(k)}Oq(m)}m=f[l+68>>2]|0;if(m|0){k=l+72|0;n=f[k>>2]|0;if((n|0)!=(m|0))f[k>>2]=n+(~((n+-4-m|0)>>>2)<<2);Oq(m)}m=l+64|0;n=f[m>>2]|0;f[m>>2]=0;if(n|0){m=f[n>>2]|0;if(m|0){k=n+4|0;if((f[k>>2]|0)!=(m|0))f[k>>2]=m;Oq(m)}Oq(n)}Oq(l)}j=j+4|0;g=g+4|0}while((j|0)!=(h|0));j=f[c>>2]|0;if((j|0)!=(g|0)){o=g;p=j;q=24}}else{o=e;p=h;q=24}if((q|0)==24){q=p;do{p=q+-4|0;f[c>>2]=p;h=f[p>>2]|0;f[p>>2]=0;if(h|0){p=h+88|0;e=f[p>>2]|0;f[p>>2]=0;if(e|0){p=f[e+8>>2]|0;if(p|0){j=e+12|0;if((f[j>>2]|0)!=(p|0))f[j>>2]=p;Oq(p)}Oq(e)}e=f[h+68>>2]|0;if(e|0){p=h+72|0;j=f[p>>2]|0;if((j|0)!=(e|0))f[p>>2]=j+(~((j+-4-e|0)>>>2)<<2);Oq(e)}e=h+64|0;j=f[e>>2]|0;f[e>>2]=0;if(j|0){e=f[j>>2]|0;if(e|0){p=j+4|0;if((f[p>>2]|0)!=(e|0))f[p>>2]=e;Oq(e)}Oq(j)}Oq(h)}q=f[c>>2]|0}while((q|0)!=(o|0))}o=f[a+4>>2]|0;a:do if(o|0){q=o+44|0;c=f[q>>2]|0;h=f[o+40>>2]|0;while(1){if((h|0)==(c|0))break a;r=h+4|0;if((f[(f[h>>2]|0)+40>>2]|0)==(i|0))break;else h=r}if((r|0)!=(c|0)){j=r;e=h;do{p=f[j>>2]|0;f[j>>2]=0;g=f[e>>2]|0;f[e>>2]=p;if(g|0){bj(g);Oq(g)}j=j+4|0;e=e+4|0}while((j|0)!=(c|0));j=f[q>>2]|0;if((j|0)==(e|0))break;else{s=e;t=j}}else{s=h;t=c}j=t;do{g=j+-4|0;f[q>>2]=g;p=f[g>>2]|0;f[g>>2]=0;if(p|0){bj(p);Oq(p)}j=f[q>>2]|0}while((j|0)!=(s|0))}while(0);b:do if((d|0)<5){s=f[a+20+(d*12|0)>>2]|0;t=a+20+(d*12|0)+4|0;r=f[t>>2]|0;i=r;c:do if((s|0)==(r|0))u=s;else{o=s;while(1){if((f[o>>2]|0)==(b|0)){u=o;break c}o=o+4|0;if((o|0)==(r|0))break b}}while(0);if((u|0)!=(r|0)){s=u+4|0;o=i-s|0;j=o>>2;if(!j)v=r;else{im(u|0,s|0,o|0)|0;v=f[t>>2]|0}o=u+(j<<2)|0;if((v|0)!=(o|0))f[t>>2]=v+(~((v+-4-o|0)>>>2)<<2)}}while(0);v=f[a+24>>2]|0;u=f[a+20>>2]|0;d=u;if((v|0)!=(u|0)){o=v-u>>2;u=0;do{v=d+(u<<2)|0;j=f[v>>2]|0;if((j|0)>(b|0))f[v>>2]=j+-1;u=u+1|0}while(u>>>0>>0)}o=f[a+36>>2]|0;u=f[a+32>>2]|0;d=u;if((o|0)!=(u|0)){j=o-u>>2;u=0;do{o=d+(u<<2)|0;v=f[o>>2]|0;if((v|0)>(b|0))f[o>>2]=v+-1;u=u+1|0}while(u>>>0>>0)}j=f[a+48>>2]|0;u=f[a+44>>2]|0;d=u;if((j|0)!=(u|0)){v=j-u>>2;u=0;do{j=d+(u<<2)|0;o=f[j>>2]|0;if((o|0)>(b|0))f[j>>2]=o+-1;u=u+1|0}while(u>>>0>>0)}v=f[a+60>>2]|0;u=f[a+56>>2]|0;d=u;if((v|0)!=(u|0)){o=v-u>>2;u=0;do{v=d+(u<<2)|0;j=f[v>>2]|0;if((j|0)>(b|0))f[v>>2]=j+-1;u=u+1|0}while(u>>>0>>0)}o=f[a+72>>2]|0;u=f[a+68>>2]|0;a=u;if((o|0)==(u|0))return;d=o-u>>2;u=0;do{o=a+(u<<2)|0;j=f[o>>2]|0;if((j|0)>(b|0))f[o>>2]=j+-1;u=u+1|0}while(u>>>0>>0);return}function Oc(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0;e=a+8|0;a:do if(f[e>>2]|0?(g=f[a>>2]|0,h=a+4|0,f[a>>2]=h,f[(f[h>>2]|0)+8>>2]=0,f[h>>2]=0,f[e>>2]=0,i=f[g+4>>2]|0,j=(i|0)==0?g:i,j|0):0){i=a+4|0;g=j;j=f[c>>2]|0;while(1){if((j|0)==(f[d>>2]|0))break;k=g+16|0;am(k,j+16|0)|0;am(g+28|0,j+28|0)|0;l=g+8|0;m=f[l>>2]|0;do if(m){n=f[m>>2]|0;if((n|0)==(g|0)){f[m>>2]=0;o=f[m+4>>2]|0;if(!o){p=m;break}else q=o;while(1){o=f[q>>2]|0;if(o|0){q=o;continue}o=f[q+4>>2]|0;if(!o)break;else q=o}p=q;break}else{f[m+4>>2]=0;if(!n){p=m;break}else r=n;while(1){o=f[r>>2]|0;if(o|0){r=o;continue}o=f[r+4>>2]|0;if(!o)break;else r=o}p=r;break}}else p=0;while(0);m=f[h>>2]|0;do if(m){n=b[k+11>>0]|0;o=n<<24>>24<0;s=o?f[g+20>>2]|0:n&255;n=o?f[k>>2]|0:k;o=m;while(1){t=o+16|0;u=b[t+11>>0]|0;v=u<<24>>24<0;w=v?f[o+20>>2]|0:u&255;u=w>>>0>>0?w:s;if((u|0)!=0?(x=Vk(n,v?f[t>>2]|0:t,u)|0,(x|0)!=0):0)if((x|0)<0)y=22;else y=24;else if(s>>>0>>0)y=22;else y=24;if((y|0)==22){y=0;w=f[o>>2]|0;if(!w){y=23;break}else z=w}else if((y|0)==24){y=0;A=o+4|0;w=f[A>>2]|0;if(!w){y=26;break}else z=w}o=z}if((y|0)==23){y=0;B=o;C=o;break}else if((y|0)==26){y=0;B=A;C=o;break}}else{B=h;C=h}while(0);f[g>>2]=0;f[g+4>>2]=0;f[l>>2]=C;f[B>>2]=g;m=f[f[a>>2]>>2]|0;if(!m)D=g;else{f[a>>2]=m;D=f[B>>2]|0}Oe(f[i>>2]|0,D);f[e>>2]=(f[e>>2]|0)+1;m=f[j+4>>2]|0;if(!m){k=j+8|0;s=f[k>>2]|0;if((f[s>>2]|0)==(j|0))E=s;else{s=k;do{k=f[s>>2]|0;s=k+8|0;n=f[s>>2]|0}while((f[n>>2]|0)!=(k|0));E=n}}else{s=m;while(1){l=f[s>>2]|0;if(!l)break;else s=l}E=s}f[c>>2]=E;if(!p)break a;else{g=p;j=E}}j=f[g+8>>2]|0;if(!j)F=g;else{i=j;while(1){j=f[i+8>>2]|0;if(!j)break;else i=j}F=i}Ej(a,F)}while(0);F=f[c>>2]|0;E=f[d>>2]|0;if((F|0)==(E|0))return;else G=F;while(1){bf(a,G+16|0)|0;F=f[G+4>>2]|0;if(!F){d=G+8|0;p=f[d>>2]|0;if((f[p>>2]|0)==(G|0))H=p;else{p=d;do{d=f[p>>2]|0;p=d+8|0;e=f[p>>2]|0}while((f[e>>2]|0)!=(d|0));H=e}}else{p=F;while(1){i=f[p>>2]|0;if(!i)break;else p=i}H=p}f[c>>2]=H;if((H|0)==(E|0))break;else G=H}return}function Pc(a){a=a|0;var b=0,c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0;b=u;u=u+32|0;c=b+4|0;d=b;e=a+16|0;g=f[e>>2]|0;if(g>>>0>112){f[e>>2]=g+-113;g=a+4|0;e=f[g>>2]|0;h=f[e>>2]|0;i=e+4|0;f[g>>2]=i;e=a+8|0;j=f[e>>2]|0;k=a+12|0;l=f[k>>2]|0;m=l;do if((j|0)==(l|0)){n=f[a>>2]|0;o=n;if(i>>>0>n>>>0){p=i;q=((p-o>>2)+1|0)/-2|0;r=i+(q<<2)|0;s=j-p|0;p=s>>2;if(!p)t=i;else{im(r|0,i|0,s|0)|0;t=f[g>>2]|0}s=r+(p<<2)|0;f[e>>2]=s;f[g>>2]=t+(q<<2);v=s;break}s=m-o>>1;o=(s|0)==0?1:s;if(o>>>0>1073741823){s=ra(8)|0;Oo(s,16035);f[s>>2]=7256;va(s|0,1112,110)}s=ln(o<<2)|0;q=s;p=s+(o>>>2<<2)|0;r=p;w=s+(o<<2)|0;if((i|0)==(j|0)){x=r;y=n}else{n=p;p=r;o=i;do{f[n>>2]=f[o>>2];n=p+4|0;p=n;o=o+4|0}while((o|0)!=(j|0));x=p;y=f[a>>2]|0}f[a>>2]=q;f[g>>2]=r;f[e>>2]=x;f[k>>2]=w;if(!y)v=x;else{Oq(y);v=f[e>>2]|0}}else v=j;while(0);f[v>>2]=h;f[e>>2]=(f[e>>2]|0)+4;u=b;return}e=a+8|0;h=f[e>>2]|0;v=a+4|0;j=h-(f[v>>2]|0)|0;y=a+12|0;x=f[y>>2]|0;k=x-(f[a>>2]|0)|0;if(j>>>0>=k>>>0){g=k>>1;k=(g|0)==0?1:g;f[c+12>>2]=0;f[c+16>>2]=a+12;if(k>>>0>1073741823){g=ra(8)|0;Oo(g,16035);f[g>>2]=7256;va(g|0,1112,110)}g=ln(k<<2)|0;f[c>>2]=g;i=g+(j>>2<<2)|0;j=c+8|0;f[j>>2]=i;m=c+4|0;f[m>>2]=i;i=c+12|0;f[i>>2]=g+(k<<2);k=ln(4068)|0;f[d>>2]=k;Ag(c,d);d=f[e>>2]|0;while(1){z=f[v>>2]|0;if((d|0)==(z|0))break;k=d+-4|0;ug(c,k);d=k}k=z;z=f[a>>2]|0;f[a>>2]=f[c>>2];f[c>>2]=z;f[v>>2]=f[m>>2];f[m>>2]=k;m=f[e>>2]|0;f[e>>2]=f[j>>2];f[j>>2]=m;g=f[y>>2]|0;f[y>>2]=f[i>>2];f[i>>2]=g;g=m;if((d|0)!=(g|0))f[j>>2]=g+(~((g+-4-k|0)>>>2)<<2);if(z|0)Oq(z);u=b;return}if((x|0)!=(h|0)){h=ln(4068)|0;f[c>>2]=h;Ag(a,c);u=b;return}h=ln(4068)|0;f[c>>2]=h;ug(a,c);c=f[v>>2]|0;h=f[c>>2]|0;x=c+4|0;f[v>>2]=x;c=f[e>>2]|0;z=f[y>>2]|0;k=z;do if((c|0)==(z|0)){g=f[a>>2]|0;j=g;if(x>>>0>g>>>0){d=x;m=((d-j>>2)+1|0)/-2|0;i=x+(m<<2)|0;t=c-d|0;d=t>>2;if(!d)A=x;else{im(i|0,x|0,t|0)|0;A=f[v>>2]|0}t=i+(d<<2)|0;f[e>>2]=t;f[v>>2]=A+(m<<2);B=t;break}t=k-j>>1;j=(t|0)==0?1:t;if(j>>>0>1073741823){t=ra(8)|0;Oo(t,16035);f[t>>2]=7256;va(t|0,1112,110)}t=ln(j<<2)|0;m=t;d=t+(j>>>2<<2)|0;i=d;l=t+(j<<2)|0;if((x|0)==(c|0)){C=i;D=g}else{g=d;d=i;j=x;do{f[g>>2]=f[j>>2];g=d+4|0;d=g;j=j+4|0}while((j|0)!=(c|0));C=d;D=f[a>>2]|0}f[a>>2]=m;f[v>>2]=i;f[e>>2]=C;f[y>>2]=l;if(!D)B=C;else{Oq(D);B=f[e>>2]|0}}else B=c;while(0);f[B>>2]=h;f[e>>2]=(f[e>>2]|0)+4;u=b;return}function Qc(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0;e=u;u=u+16|0;g=e+8|0;h=e+4|0;i=e;j=a+64|0;k=f[j>>2]|0;if((f[k+28>>2]|0)==(f[k+24>>2]|0)){u=e;return}l=c+96|0;c=a+52|0;m=d+84|0;n=d+68|0;d=a+56|0;o=a+60|0;p=a+12|0;q=a+28|0;r=a+40|0;s=a+44|0;t=a+48|0;v=0;w=0;x=k;while(1){k=f[(f[x+24>>2]|0)+(w<<2)>>2]|0;if((k|0)==-1){y=v;z=x}else{A=v+1|0;B=f[(f[l>>2]|0)+(((k|0)/3|0)*12|0)+(((k|0)%3|0)<<2)>>2]|0;if(!(b[m>>0]|0))C=f[(f[n>>2]|0)+(B<<2)>>2]|0;else C=B;f[g>>2]=C;B=f[d>>2]|0;if(B>>>0<(f[o>>2]|0)>>>0){f[B>>2]=C;f[d>>2]=B+4}else Ri(c,g);f[g>>2]=k;f[h>>2]=0;a:do if(!(f[(f[p>>2]|0)+(w>>>5<<2)>>2]&1<<(w&31)))D=k;else{B=k+1|0;E=((B>>>0)%3|0|0)==0?k+-2|0:B;if(((E|0)!=-1?(f[(f[a>>2]|0)+(E>>>5<<2)>>2]&1<<(E&31)|0)==0:0)?(B=f[(f[(f[j>>2]|0)+12>>2]|0)+(E<<2)>>2]|0,E=B+1|0,(B|0)!=-1):0){F=((E>>>0)%3|0|0)==0?B+-2|0:E;f[h>>2]=F;if((F|0)==-1){D=k;break}else G=F;while(1){f[g>>2]=G;F=G+1|0;E=((F>>>0)%3|0|0)==0?G+-2|0:F;if((E|0)==-1)break;if(f[(f[a>>2]|0)+(E>>>5<<2)>>2]&1<<(E&31)|0)break;F=f[(f[(f[j>>2]|0)+12>>2]|0)+(E<<2)>>2]|0;E=F+1|0;if((F|0)==-1)break;B=((E>>>0)%3|0|0)==0?F+-2|0:E;f[h>>2]=B;if((B|0)==-1){D=G;break a}else G=B}f[h>>2]=-1;D=G;break}f[h>>2]=-1;D=k}while(0);f[(f[q>>2]|0)+(D<<2)>>2]=v;k=f[s>>2]|0;if((k|0)==(f[t>>2]|0))Ri(r,g);else{f[k>>2]=f[g>>2];f[s>>2]=k+4}k=f[j>>2]|0;B=f[g>>2]|0;b:do if(((B|0)!=-1?(E=(((B>>>0)%3|0|0)==0?2:-1)+B|0,(E|0)!=-1):0)?(F=f[(f[k+12>>2]|0)+(E<<2)>>2]|0,(F|0)!=-1):0){E=F+(((F>>>0)%3|0|0)==0?2:-1)|0;f[h>>2]=E;if((E|0)!=-1&(E|0)!=(B|0)){F=A;H=v;I=E;while(1){E=I+1|0;J=((E>>>0)%3|0|0)==0?I+-2|0:E;do if(f[(f[a>>2]|0)+(J>>>5<<2)>>2]&1<<(J&31)){E=F+1|0;K=f[(f[l>>2]|0)+(((I|0)/3|0)*12|0)+(((I|0)%3|0)<<2)>>2]|0;if(!(b[m>>0]|0))L=f[(f[n>>2]|0)+(K<<2)>>2]|0;else L=K;f[i>>2]=L;K=f[d>>2]|0;if(K>>>0<(f[o>>2]|0)>>>0){f[K>>2]=L;f[d>>2]=K+4}else Ri(c,i);K=f[s>>2]|0;if((K|0)==(f[t>>2]|0)){Ri(r,h);M=E;N=F;break}else{f[K>>2]=f[h>>2];f[s>>2]=K+4;M=E;N=F;break}}else{M=F;N=H}while(0);f[(f[q>>2]|0)+(f[h>>2]<<2)>>2]=N;O=f[j>>2]|0;J=f[h>>2]|0;if((J|0)==-1)break;E=(((J>>>0)%3|0|0)==0?2:-1)+J|0;if((E|0)==-1)break;J=f[(f[O+12>>2]|0)+(E<<2)>>2]|0;if((J|0)==-1)break;I=J+(((J>>>0)%3|0|0)==0?2:-1)|0;f[h>>2]=I;if(!((I|0)!=-1?(I|0)!=(f[g>>2]|0):0)){P=M;Q=O;break b}else{F=M;H=N}}f[h>>2]=-1;P=M;Q=O}else{P=A;Q=k}}else R=28;while(0);if((R|0)==28){R=0;f[h>>2]=-1;P=A;Q=k}y=P;z=Q}w=w+1|0;if(w>>>0>=(f[z+28>>2]|0)-(f[z+24>>2]|0)>>2>>>0)break;else{v=y;x=z}}u=e;return}function Rc(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,i=0,j=0.0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,D=0,E=0,F=0;switch(c|0){case 0:{e=-149;g=24;i=4;break}case 1:{e=-1074;g=53;i=4;break}case 2:{e=-1074;g=53;i=4;break}default:j=0.0}a:do if((i|0)==4){c=a+4|0;k=a+100|0;do{l=f[c>>2]|0;if(l>>>0<(f[k>>2]|0)>>>0){f[c>>2]=l+1;m=h[l>>0]|0}else m=Si(a)|0}while((eq(m)|0)!=0);b:do switch(m|0){case 43:case 45:{l=1-(((m|0)==45&1)<<1)|0;n=f[c>>2]|0;if(n>>>0<(f[k>>2]|0)>>>0){f[c>>2]=n+1;o=h[n>>0]|0;p=l;break b}else{o=Si(a)|0;p=l;break b}break}default:{o=m;p=1}}while(0);l=0;n=o;while(1){if((n|32|0)!=(b[18546+l>>0]|0)){q=l;r=n;break}do if(l>>>0<7){s=f[c>>2]|0;if(s>>>0<(f[k>>2]|0)>>>0){f[c>>2]=s+1;t=h[s>>0]|0;break}else{t=Si(a)|0;break}}else t=n;while(0);s=l+1|0;if(s>>>0<8){l=s;n=t}else{q=s;r=t;break}}c:do switch(q|0){case 8:break;case 3:{i=23;break}default:{n=(d|0)!=0;if(n&q>>>0>3)if((q|0)==8)break c;else{i=23;break c}d:do if(!q){l=0;s=r;while(1){if((s|32|0)!=(b[18555+l>>0]|0)){u=l;v=s;break d}do if(l>>>0<2){w=f[c>>2]|0;if(w>>>0<(f[k>>2]|0)>>>0){f[c>>2]=w+1;x=h[w>>0]|0;break}else{x=Si(a)|0;break}}else x=s;while(0);w=l+1|0;if(w>>>0<3){l=w;s=x}else{u=w;v=x;break}}}else{u=q;v=r}while(0);switch(u|0){case 3:{s=f[c>>2]|0;if(s>>>0<(f[k>>2]|0)>>>0){f[c>>2]=s+1;y=h[s>>0]|0}else y=Si(a)|0;if((y|0)==40)z=1;else{if(!(f[k>>2]|0)){j=B;break a}f[c>>2]=(f[c>>2]|0)+-1;j=B;break a}while(1){s=f[c>>2]|0;if(s>>>0<(f[k>>2]|0)>>>0){f[c>>2]=s+1;A=h[s>>0]|0}else A=Si(a)|0;if(!((A+-48|0)>>>0<10|(A+-65|0)>>>0<26)?!((A|0)==95|(A+-97|0)>>>0<26):0)break;z=z+1|0}if((A|0)==41){j=B;break a}s=(f[k>>2]|0)==0;if(!s)f[c>>2]=(f[c>>2]|0)+-1;if(!n){l=Vq()|0;f[l>>2]=22;Ym(a,0);j=0.0;break a}if(!z){j=B;break a}else D=z;while(1){D=D+-1|0;if(!s)f[c>>2]=(f[c>>2]|0)+-1;if(!D){j=B;break a}}break}case 0:{if((v|0)==48){s=f[c>>2]|0;if(s>>>0<(f[k>>2]|0)>>>0){f[c>>2]=s+1;E=h[s>>0]|0}else E=Si(a)|0;if((E|32|0)==120){j=+Fc(a,g,e,p,d);break a}if(!(f[k>>2]|0))F=48;else{f[c>>2]=(f[c>>2]|0)+-1;F=48}}else F=v;j=+nb(a,F,g,e,p,d);break a;break}default:{if(f[k>>2]|0)f[c>>2]=(f[c>>2]|0)+-1;s=Vq()|0;f[s>>2]=22;Ym(a,0);j=0.0;break a}}}}while(0);if((i|0)==23){s=(f[k>>2]|0)==0;if(!s)f[c>>2]=(f[c>>2]|0)+-1;if((d|0)!=0&q>>>0>3){n=q;do{if(!s)f[c>>2]=(f[c>>2]|0)+-1;n=n+-1|0}while(n>>>0>3)}}j=+$($(p|0)*$(C))}while(0);return +j}function Sc(a,c,d,e){a=a|0;c=c|0;d=d|0;e=e|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0;g=u;u=u+16|0;h=g;f[h>>2]=0;f[h+4>>2]=0;f[h+8>>2]=0;i=ln(16)|0;f[h>>2]=i;f[h+8>>2]=-2147483632;f[h+4>>2]=15;j=i;k=14479;l=j+15|0;do{b[j>>0]=b[k>>0]|0;j=j+1|0;k=k+1|0}while((j|0)<(l|0));b[i+15>>0]=0;i=Hk(c,h,-1)|0;if((b[h+11>>0]|0)<0)Oq(f[h>>2]|0);switch(i|0){case 0:{m=ln(52)|0;j=m;l=j+52|0;do{f[j>>2]=0;j=j+4|0}while((j|0)<(l|0));Zn(m);n=4044;o=m;break}case -1:{if((mi(c)|0)==10){m=ln(52)|0;j=m;l=j+52|0;do{f[j>>2]=0;j=j+4|0}while((j|0)<(l|0));Zn(m);n=4044;o=m}else p=6;break}default:p=6}a:do if((p|0)==6){m=d+8|0;q=d+12|0;r=f[q>>2]|0;s=f[m>>2]|0;b:do if((r-s|0)>0){t=h+8|0;v=h+4|0;w=c+16|0;x=h+11|0;y=0;z=s;A=r;c:while(1){B=f[(f[z+(y<<2)>>2]|0)+28>>2]|0;switch(B|0){case 9:{p=12;break}case 6:case 5:case 4:case 2:{C=z;D=A;break}default:{if((B|2|0)!=3)break c;if((B|0)==9)p=12;else{C=z;D=A}}}if((p|0)==12){p=0;f[h>>2]=0;f[h+4>>2]=0;f[h+8>>2]=0;B=ln(32)|0;f[h>>2]=B;f[t>>2]=-2147483616;f[v>>2]=17;j=B;k=14495;l=j+17|0;do{b[j>>0]=b[k>>0]|0;j=j+1|0;k=k+1|0}while((j|0)<(l|0));b[B+17>>0]=0;E=f[w>>2]|0;if(E){F=w;G=E;d:while(1){E=G;while(1){if((f[E+16>>2]|0)>=0)break;H=f[E+4>>2]|0;if(!H){I=F;break d}else E=H}G=f[E>>2]|0;if(!G){I=E;break}else F=E}if(((I|0)!=(w|0)?(f[I+16>>2]|0)<=0:0)?(F=I+20|0,(Jh(F,h)|0)!=0):0)J=Hk(F,h,-1)|0;else p=21}else p=21;if((p|0)==21){p=0;J=Hk(c,h,-1)|0}if((b[x>>0]|0)<0)Oq(f[h>>2]|0);if((J|0)<1)break;C=f[m>>2]|0;D=f[q>>2]|0}y=y+1|0;if((y|0)>=(D-C>>2|0))break b;else{z=C;A=D}}if((i|0)!=1){A=ln(52)|0;j=A;l=j+52|0;do{f[j>>2]=0;j=j+4|0}while((j|0)<(l|0));Zn(A);n=4044;o=A;break a}f[h>>2]=0;f[h+4>>2]=0;f[h+8>>2]=0;z=ln(32)|0;f[h>>2]=z;f[h+8>>2]=-2147483616;f[h+4>>2]=24;j=z;k=14513;l=j+24|0;do{b[j>>0]=b[k>>0]|0;j=j+1|0;k=k+1|0}while((j|0)<(l|0));b[z+24>>0]=0;f[a>>2]=-1;pj(a+4|0,h);if((b[h+11>>0]|0)<0)Oq(f[h>>2]|0);u=g;return}while(0);q=ln(52)|0;j=q;l=j+52|0;do{f[j>>2]=0;j=j+4|0}while((j|0)<(l|0));Zn(q);n=3988;o=q}while(0);f[o>>2]=n;ip(o,d);Md(a,o,c,e);Va[f[(f[o>>2]|0)+4>>2]&127](o);u=g;return}function Tc(a,c,d,e,g,h){a=a|0;c=c|0;d=d|0;e=e|0;g=g|0;h=h|0;var i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0;i=u;u=u+32|0;j=i+4|0;k=i;l=i+16|0;m=(_(e|0)|0)^31;if((e|0)>0)if(m>>>0>17){n=0;u=i;return n|0}else o=m+1|0;else o=1;do if(g){m=ln(48)|0;f[j>>2]=m;f[j+8>>2]=-2147483600;f[j+4>>2]=33;e=m;p=15987;q=e+33|0;do{b[e>>0]=b[p>>0]|0;e=e+1|0;p=p+1|0}while((e|0)<(q|0));b[m+33>>0]=0;r=(Jh(g,j)|0)==0;if((b[j+11>>0]|0)<0)Oq(f[j>>2]|0);if(!r){r=ln(48)|0;f[j>>2]=r;f[j+8>>2]=-2147483600;f[j+4>>2]=33;e=r;p=15987;q=e+33|0;do{b[e>>0]=b[p>>0]|0;e=e+1|0;p=p+1|0}while((e|0)<(q|0));b[r+33>>0]=0;p=Mk(g,j)|0;if((b[j+11>>0]|0)<0)Oq(f[j>>2]|0);if((p|0)<4){s=o+-2|0;break}if((p|0)<6){s=o+-1|0;break}if((p|0)>9){s=o+2|0;break}else{s=o+((p|0)>7&1)|0;break}}else s=o}else s=o;while(0);o=(s|0)>1?s:1;s=(o|0)<18?o:18;b[l>>0]=s;o=h+16|0;g=f[o+4>>2]|0;if(!((g|0)>0|(g|0)==0&(f[o>>2]|0)>>>0>0)){f[k>>2]=f[h+4>>2];f[j>>2]=f[k>>2];Me(h,j,l,l+1|0)|0}do switch(s&31){case 1:case 0:{n=ue(a,c,d,h)|0;u=i;return n|0}case 2:{n=te(a,c,d,h)|0;u=i;return n|0}case 3:{n=se(a,c,d,h)|0;u=i;return n|0}case 4:{n=re(a,c,d,h)|0;u=i;return n|0}case 5:{n=qe(a,c,d,h)|0;u=i;return n|0}case 6:{n=pe(a,c,d,h)|0;u=i;return n|0}case 7:{n=oe(a,c,d,h)|0;u=i;return n|0}case 8:{n=ne(a,c,d,h)|0;u=i;return n|0}case 9:{n=me(a,c,d,h)|0;u=i;return n|0}case 10:{n=le(a,c,d,h)|0;u=i;return n|0}case 11:{n=ke(a,c,d,h)|0;u=i;return n|0}case 12:{n=ie(a,c,d,h)|0;u=i;return n|0}case 13:{n=he(a,c,d,h)|0;u=i;return n|0}case 14:{n=ge(a,c,d,h)|0;u=i;return n|0}case 15:{n=fe(a,c,d,h)|0;u=i;return n|0}case 16:{n=ee(a,c,d,h)|0;u=i;return n|0}case 17:{n=de(a,c,d,h)|0;u=i;return n|0}case 18:{n=ce(a,c,d,h)|0;u=i;return n|0}default:{n=0;u=i;return n|0}}while(0);return 0}function Uc(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0.0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0.0,F=0.0,G=0.0;e=u;u=u+16|0;g=e;h=e+4|0;if((c|0)>0){i=0;j=0;k=0;l=0;while(1){m=b+(j<<3)|0;n=f[m>>2]|0;o=f[m+4>>2]|0;m=Vn(n|0,o|0,k|0,l|0)|0;p=I;q=(n|0)==0&(o|0)==0?i:j;j=j+1|0;if((j|0)==(c|0)){r=q;s=p;t=m;break}else{i=q;k=m;l=p}}}else{r=0;s=0;t=0}l=r+1|0;f[a+12>>2]=l;k=a+4|0;i=f[k>>2]|0;c=f[a>>2]|0;j=i-c>>3;p=c;c=i;if(l>>>0<=j>>>0){if(l>>>0>>0?(i=p+(l<<3)|0,(i|0)!=(c|0)):0)f[k>>2]=c+(~((c+-8-i|0)>>>3)<<3)}else wh(a,l-j|0);v=+(t>>>0)+4294967296.0*+(s>>>0);s=(r|0)<0;if(!s){t=f[a>>2]|0;j=0;i=0;do{c=b+(i<<3)|0;k=f[c>>2]|0;p=f[c+4>>2]|0;c=~~((+(k>>>0)+4294967296.0*+(p>>>0))/v*1048576.0+.5)>>>0;m=((k|0)!=0|(p|0)!=0)&(c|0)==0?1:c;f[t+(i<<3)>>2]=m;j=m+j|0;i=i+1|0}while((i|0)!=(l|0));if((j|0)==1048576){if(s){w=0;u=e;return w|0}}else{x=j;y=12}}else{x=0;y=12}if((y|0)==12){f[h>>2]=0;j=h+4|0;f[j>>2]=0;f[h+8>>2]=0;do if(l)if(l>>>0>1073741823)aq(h);else{i=l<<2;t=ln(i)|0;f[h>>2]=t;m=t+(l<<2)|0;f[h+8>>2]=m;sj(t|0,0,i|0)|0;f[j>>2]=m;z=t;A=m;break}else{z=0;A=0}while(0);if(!s?(f[z>>2]=0,r|0):0){m=1;do{f[z+(m<<2)>>2]=m;m=m+1|0}while((m|0)!=(l|0))}f[g>>2]=a;xb(z,A,g);a:do if((x|0)<1048576){g=(f[a>>2]|0)+(f[(f[j>>2]|0)+-4>>2]<<3)|0;f[g>>2]=1048576-x+(f[g>>2]|0);B=0}else{g=f[h>>2]|0;if((r|0)<=0){A=(x|0)>1048576;while(1)if(!A){B=0;break a}}A=f[a>>2]|0;z=x+-1048576|0;m=x;while(1){v=1048576.0/+(m|0);t=r;i=z;c=m;while(1){p=A+(f[g+(t<<2)>>2]<<3)|0;k=f[p>>2]|0;if(k>>>0<2){y=28;break}q=k-~~+J(+(v*+(k>>>0)))|0;o=(q|0)==0?1:q;q=(o|0)<(k|0)?o:k+-1|0;o=(q|0)>(i|0)?i:q;f[p>>2]=k-o;k=c-o|0;p=i-o|0;if((k|0)==1048576){C=p;D=1048576;break}if((t|0)>1){t=t+-1|0;i=p;c=k}else{C=p;D=k;break}}if((y|0)==28){y=0;if((t|0)==(r|0)){B=1;break a}else{C=i;D=c}}if((C|0)>0){z=C;m=D}else{B=0;break}}}while(0);D=f[h>>2]|0;if(D|0){h=f[j>>2]|0;if((h|0)!=(D|0))f[j>>2]=h+(~((h+-4-D|0)>>>2)<<2);Oq(D)}if((B|0)!=0|s){w=0;u=e;return w|0}}B=f[a>>2]|0;D=0;h=0;do{f[B+(D<<3)+4>>2]=h;h=(f[B+(D<<3)>>2]|0)+h|0;D=D+1|0}while((D|0)!=(l|0));if((h|0)!=1048576){w=0;u=e;return w|0}if(s)E=0.0;else{s=f[a>>2]|0;h=0;v=0.0;while(1){D=f[s+(h<<3)>>2]|0;if(!D)F=v;else{B=b+(h<<3)|0;G=+((f[B>>2]|0)>>>0)+4294967296.0*+((f[B+4>>2]|0)>>>0);F=v+ +Zg(+(D>>>0)*9.5367431640625e-07)*G}h=h+1|0;if((h|0)==(l|0)){E=F;break}else v=F}}F=+W(+-E);l=+K(F)>=1.0?(F>0.0?~~+Y(+J(F/4294967296.0),4294967295.0)>>>0:~~+W((F-+(~~F>>>0))/4294967296.0)>>>0):0;h=a+16|0;f[h>>2]=~~F>>>0;f[h+4>>2]=l;w=Le(a,d)|0;u=e;return w|0}function Vc(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0.0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0.0,F=0.0,G=0.0;e=u;u=u+16|0;g=e;h=e+4|0;if((c|0)>0){i=0;j=0;k=0;l=0;while(1){m=b+(j<<3)|0;n=f[m>>2]|0;o=f[m+4>>2]|0;m=Vn(n|0,o|0,k|0,l|0)|0;p=I;q=(n|0)==0&(o|0)==0?i:j;j=j+1|0;if((j|0)==(c|0)){r=q;s=p;t=m;break}else{i=q;k=m;l=p}}}else{r=0;s=0;t=0}l=r+1|0;f[a+12>>2]=l;k=a+4|0;i=f[k>>2]|0;c=f[a>>2]|0;j=i-c>>3;p=c;c=i;if(l>>>0<=j>>>0){if(l>>>0>>0?(i=p+(l<<3)|0,(i|0)!=(c|0)):0)f[k>>2]=c+(~((c+-8-i|0)>>>3)<<3)}else wh(a,l-j|0);v=+(t>>>0)+4294967296.0*+(s>>>0);s=(r|0)<0;if(!s){t=f[a>>2]|0;j=0;i=0;do{c=b+(i<<3)|0;k=f[c>>2]|0;p=f[c+4>>2]|0;c=~~((+(k>>>0)+4294967296.0*+(p>>>0))/v*1048576.0+.5)>>>0;m=((k|0)!=0|(p|0)!=0)&(c|0)==0?1:c;f[t+(i<<3)>>2]=m;j=m+j|0;i=i+1|0}while((i|0)!=(l|0));if((j|0)==1048576){if(s){w=0;u=e;return w|0}}else{x=j;y=12}}else{x=0;y=12}if((y|0)==12){f[h>>2]=0;j=h+4|0;f[j>>2]=0;f[h+8>>2]=0;do if(l)if(l>>>0>1073741823)aq(h);else{i=l<<2;t=ln(i)|0;f[h>>2]=t;m=t+(l<<2)|0;f[h+8>>2]=m;sj(t|0,0,i|0)|0;f[j>>2]=m;z=t;A=m;break}else{z=0;A=0}while(0);if(!s?(f[z>>2]=0,r|0):0){m=1;do{f[z+(m<<2)>>2]=m;m=m+1|0}while((m|0)!=(l|0))}f[g>>2]=a;yb(z,A,g);a:do if((x|0)<1048576){g=(f[a>>2]|0)+(f[(f[j>>2]|0)+-4>>2]<<3)|0;f[g>>2]=1048576-x+(f[g>>2]|0);B=0}else{g=f[h>>2]|0;if((r|0)<=0){A=(x|0)>1048576;while(1)if(!A){B=0;break a}}A=f[a>>2]|0;z=x+-1048576|0;m=x;while(1){v=1048576.0/+(m|0);t=r;i=z;c=m;while(1){p=A+(f[g+(t<<2)>>2]<<3)|0;k=f[p>>2]|0;if(k>>>0<2){y=28;break}q=k-~~+J(+(v*+(k>>>0)))|0;o=(q|0)==0?1:q;q=(o|0)<(k|0)?o:k+-1|0;o=(q|0)>(i|0)?i:q;f[p>>2]=k-o;k=c-o|0;p=i-o|0;if((k|0)==1048576){C=p;D=1048576;break}if((t|0)>1){t=t+-1|0;i=p;c=k}else{C=p;D=k;break}}if((y|0)==28){y=0;if((t|0)==(r|0)){B=1;break a}else{C=i;D=c}}if((C|0)>0){z=C;m=D}else{B=0;break}}}while(0);D=f[h>>2]|0;if(D|0){h=f[j>>2]|0;if((h|0)!=(D|0))f[j>>2]=h+(~((h+-4-D|0)>>>2)<<2);Oq(D)}if((B|0)!=0|s){w=0;u=e;return w|0}}B=f[a>>2]|0;D=0;h=0;do{f[B+(D<<3)+4>>2]=h;h=(f[B+(D<<3)>>2]|0)+h|0;D=D+1|0}while((D|0)!=(l|0));if((h|0)!=1048576){w=0;u=e;return w|0}if(s)E=0.0;else{s=f[a>>2]|0;h=0;v=0.0;while(1){D=f[s+(h<<3)>>2]|0;if(!D)F=v;else{B=b+(h<<3)|0;G=+((f[B>>2]|0)>>>0)+4294967296.0*+((f[B+4>>2]|0)>>>0);F=v+ +Zg(+(D>>>0)*9.5367431640625e-07)*G}h=h+1|0;if((h|0)==(l|0)){E=F;break}else v=F}}F=+W(+-E);l=+K(F)>=1.0?(F>0.0?~~+Y(+J(F/4294967296.0),4294967295.0)>>>0:~~+W((F-+(~~F>>>0))/4294967296.0)>>>0):0;h=a+16|0;f[h>>2]=~~F>>>0;f[h+4>>2]=l;w=Le(a,d)|0;u=e;return w|0}function Wc(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0.0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0.0,F=0.0,G=0.0;e=u;u=u+16|0;g=e;h=e+4|0;if((c|0)>0){i=0;j=0;k=0;l=0;while(1){m=b+(j<<3)|0;n=f[m>>2]|0;o=f[m+4>>2]|0;m=Vn(n|0,o|0,k|0,l|0)|0;p=I;q=(n|0)==0&(o|0)==0?i:j;j=j+1|0;if((j|0)==(c|0)){r=q;s=p;t=m;break}else{i=q;k=m;l=p}}}else{r=0;s=0;t=0}l=r+1|0;f[a+12>>2]=l;k=a+4|0;i=f[k>>2]|0;c=f[a>>2]|0;j=i-c>>3;p=c;c=i;if(l>>>0<=j>>>0){if(l>>>0>>0?(i=p+(l<<3)|0,(i|0)!=(c|0)):0)f[k>>2]=c+(~((c+-8-i|0)>>>3)<<3)}else wh(a,l-j|0);v=+(t>>>0)+4294967296.0*+(s>>>0);s=(r|0)<0;if(!s){t=f[a>>2]|0;j=0;i=0;do{c=b+(i<<3)|0;k=f[c>>2]|0;p=f[c+4>>2]|0;c=~~((+(k>>>0)+4294967296.0*+(p>>>0))/v*1048576.0+.5)>>>0;m=((k|0)!=0|(p|0)!=0)&(c|0)==0?1:c;f[t+(i<<3)>>2]=m;j=m+j|0;i=i+1|0}while((i|0)!=(l|0));if((j|0)==1048576){if(s){w=0;u=e;return w|0}}else{x=j;y=12}}else{x=0;y=12}if((y|0)==12){f[h>>2]=0;j=h+4|0;f[j>>2]=0;f[h+8>>2]=0;do if(l)if(l>>>0>1073741823)aq(h);else{i=l<<2;t=ln(i)|0;f[h>>2]=t;m=t+(l<<2)|0;f[h+8>>2]=m;sj(t|0,0,i|0)|0;f[j>>2]=m;z=t;A=m;break}else{z=0;A=0}while(0);if(!s?(f[z>>2]=0,r|0):0){m=1;do{f[z+(m<<2)>>2]=m;m=m+1|0}while((m|0)!=(l|0))}f[g>>2]=a;zb(z,A,g);a:do if((x|0)<1048576){g=(f[a>>2]|0)+(f[(f[j>>2]|0)+-4>>2]<<3)|0;f[g>>2]=1048576-x+(f[g>>2]|0);B=0}else{g=f[h>>2]|0;if((r|0)<=0){A=(x|0)>1048576;while(1)if(!A){B=0;break a}}A=f[a>>2]|0;z=x+-1048576|0;m=x;while(1){v=1048576.0/+(m|0);t=r;i=z;c=m;while(1){p=A+(f[g+(t<<2)>>2]<<3)|0;k=f[p>>2]|0;if(k>>>0<2){y=28;break}q=k-~~+J(+(v*+(k>>>0)))|0;o=(q|0)==0?1:q;q=(o|0)<(k|0)?o:k+-1|0;o=(q|0)>(i|0)?i:q;f[p>>2]=k-o;k=c-o|0;p=i-o|0;if((k|0)==1048576){C=p;D=1048576;break}if((t|0)>1){t=t+-1|0;i=p;c=k}else{C=p;D=k;break}}if((y|0)==28){y=0;if((t|0)==(r|0)){B=1;break a}else{C=i;D=c}}if((C|0)>0){z=C;m=D}else{B=0;break}}}while(0);D=f[h>>2]|0;if(D|0){h=f[j>>2]|0;if((h|0)!=(D|0))f[j>>2]=h+(~((h+-4-D|0)>>>2)<<2);Oq(D)}if((B|0)!=0|s){w=0;u=e;return w|0}}B=f[a>>2]|0;D=0;h=0;do{f[B+(D<<3)+4>>2]=h;h=(f[B+(D<<3)>>2]|0)+h|0;D=D+1|0}while((D|0)!=(l|0));if((h|0)!=1048576){w=0;u=e;return w|0}if(s)E=0.0;else{s=f[a>>2]|0;h=0;v=0.0;while(1){D=f[s+(h<<3)>>2]|0;if(!D)F=v;else{B=b+(h<<3)|0;G=+((f[B>>2]|0)>>>0)+4294967296.0*+((f[B+4>>2]|0)>>>0);F=v+ +Zg(+(D>>>0)*9.5367431640625e-07)*G}h=h+1|0;if((h|0)==(l|0)){E=F;break}else v=F}}F=+W(+-E);l=+K(F)>=1.0?(F>0.0?~~+Y(+J(F/4294967296.0),4294967295.0)>>>0:~~+W((F-+(~~F>>>0))/4294967296.0)>>>0):0;h=a+16|0;f[h>>2]=~~F>>>0;f[h+4>>2]=l;w=Le(a,d)|0;u=e;return w|0}function Xc(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0.0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0.0,F=0.0,G=0.0;e=u;u=u+16|0;g=e;h=e+4|0;if((c|0)>0){i=0;j=0;k=0;l=0;while(1){m=b+(j<<3)|0;n=f[m>>2]|0;o=f[m+4>>2]|0;m=Vn(n|0,o|0,k|0,l|0)|0;p=I;q=(n|0)==0&(o|0)==0?i:j;j=j+1|0;if((j|0)==(c|0)){r=q;s=p;t=m;break}else{i=q;k=m;l=p}}}else{r=0;s=0;t=0}l=r+1|0;f[a+12>>2]=l;k=a+4|0;i=f[k>>2]|0;c=f[a>>2]|0;j=i-c>>3;p=c;c=i;if(l>>>0<=j>>>0){if(l>>>0>>0?(i=p+(l<<3)|0,(i|0)!=(c|0)):0)f[k>>2]=c+(~((c+-8-i|0)>>>3)<<3)}else wh(a,l-j|0);v=+(t>>>0)+4294967296.0*+(s>>>0);s=(r|0)<0;if(!s){t=f[a>>2]|0;j=0;i=0;do{c=b+(i<<3)|0;k=f[c>>2]|0;p=f[c+4>>2]|0;c=~~((+(k>>>0)+4294967296.0*+(p>>>0))/v*1048576.0+.5)>>>0;m=((k|0)!=0|(p|0)!=0)&(c|0)==0?1:c;f[t+(i<<3)>>2]=m;j=m+j|0;i=i+1|0}while((i|0)!=(l|0));if((j|0)==1048576){if(s){w=0;u=e;return w|0}}else{x=j;y=12}}else{x=0;y=12}if((y|0)==12){f[h>>2]=0;j=h+4|0;f[j>>2]=0;f[h+8>>2]=0;do if(l)if(l>>>0>1073741823)aq(h);else{i=l<<2;t=ln(i)|0;f[h>>2]=t;m=t+(l<<2)|0;f[h+8>>2]=m;sj(t|0,0,i|0)|0;f[j>>2]=m;z=t;A=m;break}else{z=0;A=0}while(0);if(!s?(f[z>>2]=0,r|0):0){m=1;do{f[z+(m<<2)>>2]=m;m=m+1|0}while((m|0)!=(l|0))}f[g>>2]=a;Ab(z,A,g);a:do if((x|0)<1048576){g=(f[a>>2]|0)+(f[(f[j>>2]|0)+-4>>2]<<3)|0;f[g>>2]=1048576-x+(f[g>>2]|0);B=0}else{g=f[h>>2]|0;if((r|0)<=0){A=(x|0)>1048576;while(1)if(!A){B=0;break a}}A=f[a>>2]|0;z=x+-1048576|0;m=x;while(1){v=1048576.0/+(m|0);t=r;i=z;c=m;while(1){p=A+(f[g+(t<<2)>>2]<<3)|0;k=f[p>>2]|0;if(k>>>0<2){y=28;break}q=k-~~+J(+(v*+(k>>>0)))|0;o=(q|0)==0?1:q;q=(o|0)<(k|0)?o:k+-1|0;o=(q|0)>(i|0)?i:q;f[p>>2]=k-o;k=c-o|0;p=i-o|0;if((k|0)==1048576){C=p;D=1048576;break}if((t|0)>1){t=t+-1|0;i=p;c=k}else{C=p;D=k;break}}if((y|0)==28){y=0;if((t|0)==(r|0)){B=1;break a}else{C=i;D=c}}if((C|0)>0){z=C;m=D}else{B=0;break}}}while(0);D=f[h>>2]|0;if(D|0){h=f[j>>2]|0;if((h|0)!=(D|0))f[j>>2]=h+(~((h+-4-D|0)>>>2)<<2);Oq(D)}if((B|0)!=0|s){w=0;u=e;return w|0}}B=f[a>>2]|0;D=0;h=0;do{f[B+(D<<3)+4>>2]=h;h=(f[B+(D<<3)>>2]|0)+h|0;D=D+1|0}while((D|0)!=(l|0));if((h|0)!=1048576){w=0;u=e;return w|0}if(s)E=0.0;else{s=f[a>>2]|0;h=0;v=0.0;while(1){D=f[s+(h<<3)>>2]|0;if(!D)F=v;else{B=b+(h<<3)|0;G=+((f[B>>2]|0)>>>0)+4294967296.0*+((f[B+4>>2]|0)>>>0);F=v+ +Zg(+(D>>>0)*9.5367431640625e-07)*G}h=h+1|0;if((h|0)==(l|0)){E=F;break}else v=F}}F=+W(+-E);l=+K(F)>=1.0?(F>0.0?~~+Y(+J(F/4294967296.0),4294967295.0)>>>0:~~+W((F-+(~~F>>>0))/4294967296.0)>>>0):0;h=a+16|0;f[h>>2]=~~F>>>0;f[h+4>>2]=l;w=Le(a,d)|0;u=e;return w|0}function Yc(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0.0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0.0,F=0.0,G=0.0;e=u;u=u+16|0;g=e;h=e+4|0;if((c|0)>0){i=0;j=0;k=0;l=0;while(1){m=b+(j<<3)|0;n=f[m>>2]|0;o=f[m+4>>2]|0;m=Vn(n|0,o|0,k|0,l|0)|0;p=I;q=(n|0)==0&(o|0)==0?i:j;j=j+1|0;if((j|0)==(c|0)){r=q;s=p;t=m;break}else{i=q;k=m;l=p}}}else{r=0;s=0;t=0}l=r+1|0;f[a+12>>2]=l;k=a+4|0;i=f[k>>2]|0;c=f[a>>2]|0;j=i-c>>3;p=c;c=i;if(l>>>0<=j>>>0){if(l>>>0>>0?(i=p+(l<<3)|0,(i|0)!=(c|0)):0)f[k>>2]=c+(~((c+-8-i|0)>>>3)<<3)}else wh(a,l-j|0);v=+(t>>>0)+4294967296.0*+(s>>>0);s=(r|0)<0;if(!s){t=f[a>>2]|0;j=0;i=0;do{c=b+(i<<3)|0;k=f[c>>2]|0;p=f[c+4>>2]|0;c=~~((+(k>>>0)+4294967296.0*+(p>>>0))/v*1048576.0+.5)>>>0;m=((k|0)!=0|(p|0)!=0)&(c|0)==0?1:c;f[t+(i<<3)>>2]=m;j=m+j|0;i=i+1|0}while((i|0)!=(l|0));if((j|0)==1048576){if(s){w=0;u=e;return w|0}}else{x=j;y=12}}else{x=0;y=12}if((y|0)==12){f[h>>2]=0;j=h+4|0;f[j>>2]=0;f[h+8>>2]=0;do if(l)if(l>>>0>1073741823)aq(h);else{i=l<<2;t=ln(i)|0;f[h>>2]=t;m=t+(l<<2)|0;f[h+8>>2]=m;sj(t|0,0,i|0)|0;f[j>>2]=m;z=t;A=m;break}else{z=0;A=0}while(0);if(!s?(f[z>>2]=0,r|0):0){m=1;do{f[z+(m<<2)>>2]=m;m=m+1|0}while((m|0)!=(l|0))}f[g>>2]=a;Fb(z,A,g);a:do if((x|0)<1048576){g=(f[a>>2]|0)+(f[(f[j>>2]|0)+-4>>2]<<3)|0;f[g>>2]=1048576-x+(f[g>>2]|0);B=0}else{g=f[h>>2]|0;if((r|0)<=0){A=(x|0)>1048576;while(1)if(!A){B=0;break a}}A=f[a>>2]|0;z=x+-1048576|0;m=x;while(1){v=1048576.0/+(m|0);t=r;i=z;c=m;while(1){p=A+(f[g+(t<<2)>>2]<<3)|0;k=f[p>>2]|0;if(k>>>0<2){y=28;break}q=k-~~+J(+(v*+(k>>>0)))|0;o=(q|0)==0?1:q;q=(o|0)<(k|0)?o:k+-1|0;o=(q|0)>(i|0)?i:q;f[p>>2]=k-o;k=c-o|0;p=i-o|0;if((k|0)==1048576){C=p;D=1048576;break}if((t|0)>1){t=t+-1|0;i=p;c=k}else{C=p;D=k;break}}if((y|0)==28){y=0;if((t|0)==(r|0)){B=1;break a}else{C=i;D=c}}if((C|0)>0){z=C;m=D}else{B=0;break}}}while(0);D=f[h>>2]|0;if(D|0){h=f[j>>2]|0;if((h|0)!=(D|0))f[j>>2]=h+(~((h+-4-D|0)>>>2)<<2);Oq(D)}if((B|0)!=0|s){w=0;u=e;return w|0}}B=f[a>>2]|0;D=0;h=0;do{f[B+(D<<3)+4>>2]=h;h=(f[B+(D<<3)>>2]|0)+h|0;D=D+1|0}while((D|0)!=(l|0));if((h|0)!=1048576){w=0;u=e;return w|0}if(s)E=0.0;else{s=f[a>>2]|0;h=0;v=0.0;while(1){D=f[s+(h<<3)>>2]|0;if(!D)F=v;else{B=b+(h<<3)|0;G=+((f[B>>2]|0)>>>0)+4294967296.0*+((f[B+4>>2]|0)>>>0);F=v+ +Zg(+(D>>>0)*9.5367431640625e-07)*G}h=h+1|0;if((h|0)==(l|0)){E=F;break}else v=F}}F=+W(+-E);l=+K(F)>=1.0?(F>0.0?~~+Y(+J(F/4294967296.0),4294967295.0)>>>0:~~+W((F-+(~~F>>>0))/4294967296.0)>>>0):0;h=a+16|0;f[h>>2]=~~F>>>0;f[h+4>>2]=l;w=Le(a,d)|0;u=e;return w|0}function Zc(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0.0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0.0,F=0.0,G=0.0;e=u;u=u+16|0;g=e;h=e+4|0;if((c|0)>0){i=0;j=0;k=0;l=0;while(1){m=b+(j<<3)|0;n=f[m>>2]|0;o=f[m+4>>2]|0;m=Vn(n|0,o|0,k|0,l|0)|0;p=I;q=(n|0)==0&(o|0)==0?i:j;j=j+1|0;if((j|0)==(c|0)){r=q;s=p;t=m;break}else{i=q;k=m;l=p}}}else{r=0;s=0;t=0}l=r+1|0;f[a+12>>2]=l;k=a+4|0;i=f[k>>2]|0;c=f[a>>2]|0;j=i-c>>3;p=c;c=i;if(l>>>0<=j>>>0){if(l>>>0>>0?(i=p+(l<<3)|0,(i|0)!=(c|0)):0)f[k>>2]=c+(~((c+-8-i|0)>>>3)<<3)}else wh(a,l-j|0);v=+(t>>>0)+4294967296.0*+(s>>>0);s=(r|0)<0;if(!s){t=f[a>>2]|0;j=0;i=0;do{c=b+(i<<3)|0;k=f[c>>2]|0;p=f[c+4>>2]|0;c=~~((+(k>>>0)+4294967296.0*+(p>>>0))/v*524288.0+.5)>>>0;m=((k|0)!=0|(p|0)!=0)&(c|0)==0?1:c;f[t+(i<<3)>>2]=m;j=m+j|0;i=i+1|0}while((i|0)!=(l|0));if((j|0)==524288){if(s){w=0;u=e;return w|0}}else{x=j;y=12}}else{x=0;y=12}if((y|0)==12){f[h>>2]=0;j=h+4|0;f[j>>2]=0;f[h+8>>2]=0;do if(l)if(l>>>0>1073741823)aq(h);else{i=l<<2;t=ln(i)|0;f[h>>2]=t;m=t+(l<<2)|0;f[h+8>>2]=m;sj(t|0,0,i|0)|0;f[j>>2]=m;z=t;A=m;break}else{z=0;A=0}while(0);if(!s?(f[z>>2]=0,r|0):0){m=1;do{f[z+(m<<2)>>2]=m;m=m+1|0}while((m|0)!=(l|0))}f[g>>2]=a;Bb(z,A,g);a:do if((x|0)<524288){g=(f[a>>2]|0)+(f[(f[j>>2]|0)+-4>>2]<<3)|0;f[g>>2]=524288-x+(f[g>>2]|0);B=0}else{g=f[h>>2]|0;if((r|0)<=0){A=(x|0)>524288;while(1)if(!A){B=0;break a}}A=f[a>>2]|0;z=x+-524288|0;m=x;while(1){v=524288.0/+(m|0);t=r;i=z;c=m;while(1){p=A+(f[g+(t<<2)>>2]<<3)|0;k=f[p>>2]|0;if(k>>>0<2){y=28;break}q=k-~~+J(+(v*+(k>>>0)))|0;o=(q|0)==0?1:q;q=(o|0)<(k|0)?o:k+-1|0;o=(q|0)>(i|0)?i:q;f[p>>2]=k-o;k=c-o|0;p=i-o|0;if((k|0)==524288){C=p;D=524288;break}if((t|0)>1){t=t+-1|0;i=p;c=k}else{C=p;D=k;break}}if((y|0)==28){y=0;if((t|0)==(r|0)){B=1;break a}else{C=i;D=c}}if((C|0)>0){z=C;m=D}else{B=0;break}}}while(0);D=f[h>>2]|0;if(D|0){h=f[j>>2]|0;if((h|0)!=(D|0))f[j>>2]=h+(~((h+-4-D|0)>>>2)<<2);Oq(D)}if((B|0)!=0|s){w=0;u=e;return w|0}}B=f[a>>2]|0;D=0;h=0;do{f[B+(D<<3)+4>>2]=h;h=(f[B+(D<<3)>>2]|0)+h|0;D=D+1|0}while((D|0)!=(l|0));if((h|0)!=524288){w=0;u=e;return w|0}if(s)E=0.0;else{s=f[a>>2]|0;h=0;v=0.0;while(1){D=f[s+(h<<3)>>2]|0;if(!D)F=v;else{B=b+(h<<3)|0;G=+((f[B>>2]|0)>>>0)+4294967296.0*+((f[B+4>>2]|0)>>>0);F=v+ +Zg(+(D>>>0)*1.9073486328125e-06)*G}h=h+1|0;if((h|0)==(l|0)){E=F;break}else v=F}}F=+W(+-E);l=+K(F)>=1.0?(F>0.0?~~+Y(+J(F/4294967296.0),4294967295.0)>>>0:~~+W((F-+(~~F>>>0))/4294967296.0)>>>0):0;h=a+16|0;f[h>>2]=~~F>>>0;f[h+4>>2]=l;w=Le(a,d)|0;u=e;return w|0}function _c(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0.0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0.0,F=0.0,G=0.0;e=u;u=u+16|0;g=e;h=e+4|0;if((c|0)>0){i=0;j=0;k=0;l=0;while(1){m=b+(j<<3)|0;n=f[m>>2]|0;o=f[m+4>>2]|0;m=Vn(n|0,o|0,k|0,l|0)|0;p=I;q=(n|0)==0&(o|0)==0?i:j;j=j+1|0;if((j|0)==(c|0)){r=q;s=p;t=m;break}else{i=q;k=m;l=p}}}else{r=0;s=0;t=0}l=r+1|0;f[a+12>>2]=l;k=a+4|0;i=f[k>>2]|0;c=f[a>>2]|0;j=i-c>>3;p=c;c=i;if(l>>>0<=j>>>0){if(l>>>0>>0?(i=p+(l<<3)|0,(i|0)!=(c|0)):0)f[k>>2]=c+(~((c+-8-i|0)>>>3)<<3)}else wh(a,l-j|0);v=+(t>>>0)+4294967296.0*+(s>>>0);s=(r|0)<0;if(!s){t=f[a>>2]|0;j=0;i=0;do{c=b+(i<<3)|0;k=f[c>>2]|0;p=f[c+4>>2]|0;c=~~((+(k>>>0)+4294967296.0*+(p>>>0))/v*262144.0+.5)>>>0;m=((k|0)!=0|(p|0)!=0)&(c|0)==0?1:c;f[t+(i<<3)>>2]=m;j=m+j|0;i=i+1|0}while((i|0)!=(l|0));if((j|0)==262144){if(s){w=0;u=e;return w|0}}else{x=j;y=12}}else{x=0;y=12}if((y|0)==12){f[h>>2]=0;j=h+4|0;f[j>>2]=0;f[h+8>>2]=0;do if(l)if(l>>>0>1073741823)aq(h);else{i=l<<2;t=ln(i)|0;f[h>>2]=t;m=t+(l<<2)|0;f[h+8>>2]=m;sj(t|0,0,i|0)|0;f[j>>2]=m;z=t;A=m;break}else{z=0;A=0}while(0);if(!s?(f[z>>2]=0,r|0):0){m=1;do{f[z+(m<<2)>>2]=m;m=m+1|0}while((m|0)!=(l|0))}f[g>>2]=a;Cb(z,A,g);a:do if((x|0)<262144){g=(f[a>>2]|0)+(f[(f[j>>2]|0)+-4>>2]<<3)|0;f[g>>2]=262144-x+(f[g>>2]|0);B=0}else{g=f[h>>2]|0;if((r|0)<=0){A=(x|0)>262144;while(1)if(!A){B=0;break a}}A=f[a>>2]|0;z=x+-262144|0;m=x;while(1){v=262144.0/+(m|0);t=r;i=z;c=m;while(1){p=A+(f[g+(t<<2)>>2]<<3)|0;k=f[p>>2]|0;if(k>>>0<2){y=28;break}q=k-~~+J(+(v*+(k>>>0)))|0;o=(q|0)==0?1:q;q=(o|0)<(k|0)?o:k+-1|0;o=(q|0)>(i|0)?i:q;f[p>>2]=k-o;k=c-o|0;p=i-o|0;if((k|0)==262144){C=p;D=262144;break}if((t|0)>1){t=t+-1|0;i=p;c=k}else{C=p;D=k;break}}if((y|0)==28){y=0;if((t|0)==(r|0)){B=1;break a}else{C=i;D=c}}if((C|0)>0){z=C;m=D}else{B=0;break}}}while(0);D=f[h>>2]|0;if(D|0){h=f[j>>2]|0;if((h|0)!=(D|0))f[j>>2]=h+(~((h+-4-D|0)>>>2)<<2);Oq(D)}if((B|0)!=0|s){w=0;u=e;return w|0}}B=f[a>>2]|0;D=0;h=0;do{f[B+(D<<3)+4>>2]=h;h=(f[B+(D<<3)>>2]|0)+h|0;D=D+1|0}while((D|0)!=(l|0));if((h|0)!=262144){w=0;u=e;return w|0}if(s)E=0.0;else{s=f[a>>2]|0;h=0;v=0.0;while(1){D=f[s+(h<<3)>>2]|0;if(!D)F=v;else{B=b+(h<<3)|0;G=+((f[B>>2]|0)>>>0)+4294967296.0*+((f[B+4>>2]|0)>>>0);F=v+ +Zg(+(D>>>0)*3.814697265625e-06)*G}h=h+1|0;if((h|0)==(l|0)){E=F;break}else v=F}}F=+W(+-E);l=+K(F)>=1.0?(F>0.0?~~+Y(+J(F/4294967296.0),4294967295.0)>>>0:~~+W((F-+(~~F>>>0))/4294967296.0)>>>0):0;h=a+16|0;f[h>>2]=~~F>>>0;f[h+4>>2]=l;w=Le(a,d)|0;u=e;return w|0}function $c(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0.0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0.0,F=0.0,G=0.0;e=u;u=u+16|0;g=e;h=e+4|0;if((c|0)>0){i=0;j=0;k=0;l=0;while(1){m=b+(j<<3)|0;n=f[m>>2]|0;o=f[m+4>>2]|0;m=Vn(n|0,o|0,k|0,l|0)|0;p=I;q=(n|0)==0&(o|0)==0?i:j;j=j+1|0;if((j|0)==(c|0)){r=q;s=p;t=m;break}else{i=q;k=m;l=p}}}else{r=0;s=0;t=0}l=r+1|0;f[a+12>>2]=l;k=a+4|0;i=f[k>>2]|0;c=f[a>>2]|0;j=i-c>>3;p=c;c=i;if(l>>>0<=j>>>0){if(l>>>0>>0?(i=p+(l<<3)|0,(i|0)!=(c|0)):0)f[k>>2]=c+(~((c+-8-i|0)>>>3)<<3)}else wh(a,l-j|0);v=+(t>>>0)+4294967296.0*+(s>>>0);s=(r|0)<0;if(!s){t=f[a>>2]|0;j=0;i=0;do{c=b+(i<<3)|0;k=f[c>>2]|0;p=f[c+4>>2]|0;c=~~((+(k>>>0)+4294967296.0*+(p>>>0))/v*65536.0+.5)>>>0;m=((k|0)!=0|(p|0)!=0)&(c|0)==0?1:c;f[t+(i<<3)>>2]=m;j=m+j|0;i=i+1|0}while((i|0)!=(l|0));if((j|0)==65536){if(s){w=0;u=e;return w|0}}else{x=j;y=12}}else{x=0;y=12}if((y|0)==12){f[h>>2]=0;j=h+4|0;f[j>>2]=0;f[h+8>>2]=0;do if(l)if(l>>>0>1073741823)aq(h);else{i=l<<2;t=ln(i)|0;f[h>>2]=t;m=t+(l<<2)|0;f[h+8>>2]=m;sj(t|0,0,i|0)|0;f[j>>2]=m;z=t;A=m;break}else{z=0;A=0}while(0);if(!s?(f[z>>2]=0,r|0):0){m=1;do{f[z+(m<<2)>>2]=m;m=m+1|0}while((m|0)!=(l|0))}f[g>>2]=a;Db(z,A,g);a:do if((x|0)<65536){g=(f[a>>2]|0)+(f[(f[j>>2]|0)+-4>>2]<<3)|0;f[g>>2]=65536-x+(f[g>>2]|0);B=0}else{g=f[h>>2]|0;if((r|0)<=0){A=(x|0)>65536;while(1)if(!A){B=0;break a}}A=f[a>>2]|0;z=x+-65536|0;m=x;while(1){v=65536.0/+(m|0);t=r;i=z;c=m;while(1){p=A+(f[g+(t<<2)>>2]<<3)|0;k=f[p>>2]|0;if(k>>>0<2){y=28;break}q=k-~~+J(+(v*+(k>>>0)))|0;o=(q|0)==0?1:q;q=(o|0)<(k|0)?o:k+-1|0;o=(q|0)>(i|0)?i:q;f[p>>2]=k-o;k=c-o|0;p=i-o|0;if((k|0)==65536){C=p;D=65536;break}if((t|0)>1){t=t+-1|0;i=p;c=k}else{C=p;D=k;break}}if((y|0)==28){y=0;if((t|0)==(r|0)){B=1;break a}else{C=i;D=c}}if((C|0)>0){z=C;m=D}else{B=0;break}}}while(0);D=f[h>>2]|0;if(D|0){h=f[j>>2]|0;if((h|0)!=(D|0))f[j>>2]=h+(~((h+-4-D|0)>>>2)<<2);Oq(D)}if((B|0)!=0|s){w=0;u=e;return w|0}}B=f[a>>2]|0;D=0;h=0;do{f[B+(D<<3)+4>>2]=h;h=(f[B+(D<<3)>>2]|0)+h|0;D=D+1|0}while((D|0)!=(l|0));if((h|0)!=65536){w=0;u=e;return w|0}if(s)E=0.0;else{s=f[a>>2]|0;h=0;v=0.0;while(1){D=f[s+(h<<3)>>2]|0;if(!D)F=v;else{B=b+(h<<3)|0;G=+((f[B>>2]|0)>>>0)+4294967296.0*+((f[B+4>>2]|0)>>>0);F=v+ +Zg(+(D>>>0)*.0000152587890625)*G}h=h+1|0;if((h|0)==(l|0)){E=F;break}else v=F}}F=+W(+-E);l=+K(F)>=1.0?(F>0.0?~~+Y(+J(F/4294967296.0),4294967295.0)>>>0:~~+W((F-+(~~F>>>0))/4294967296.0)>>>0):0;h=a+16|0;f[h>>2]=~~F>>>0;f[h+4>>2]=l;w=Le(a,d)|0;u=e;return w|0}function ad(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0.0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0.0,F=0.0,G=0.0;e=u;u=u+16|0;g=e;h=e+4|0;if((c|0)>0){i=0;j=0;k=0;l=0;while(1){m=b+(j<<3)|0;n=f[m>>2]|0;o=f[m+4>>2]|0;m=Vn(n|0,o|0,k|0,l|0)|0;p=I;q=(n|0)==0&(o|0)==0?i:j;j=j+1|0;if((j|0)==(c|0)){r=q;s=p;t=m;break}else{i=q;k=m;l=p}}}else{r=0;s=0;t=0}l=r+1|0;f[a+12>>2]=l;k=a+4|0;i=f[k>>2]|0;c=f[a>>2]|0;j=i-c>>3;p=c;c=i;if(l>>>0<=j>>>0){if(l>>>0>>0?(i=p+(l<<3)|0,(i|0)!=(c|0)):0)f[k>>2]=c+(~((c+-8-i|0)>>>3)<<3)}else wh(a,l-j|0);v=+(t>>>0)+4294967296.0*+(s>>>0);s=(r|0)<0;if(!s){t=f[a>>2]|0;j=0;i=0;do{c=b+(i<<3)|0;k=f[c>>2]|0;p=f[c+4>>2]|0;c=~~((+(k>>>0)+4294967296.0*+(p>>>0))/v*32768.0+.5)>>>0;m=((k|0)!=0|(p|0)!=0)&(c|0)==0?1:c;f[t+(i<<3)>>2]=m;j=m+j|0;i=i+1|0}while((i|0)!=(l|0));if((j|0)==32768){if(s){w=0;u=e;return w|0}}else{x=j;y=12}}else{x=0;y=12}if((y|0)==12){f[h>>2]=0;j=h+4|0;f[j>>2]=0;f[h+8>>2]=0;do if(l)if(l>>>0>1073741823)aq(h);else{i=l<<2;t=ln(i)|0;f[h>>2]=t;m=t+(l<<2)|0;f[h+8>>2]=m;sj(t|0,0,i|0)|0;f[j>>2]=m;z=t;A=m;break}else{z=0;A=0}while(0);if(!s?(f[z>>2]=0,r|0):0){m=1;do{f[z+(m<<2)>>2]=m;m=m+1|0}while((m|0)!=(l|0))}f[g>>2]=a;Eb(z,A,g);a:do if((x|0)<32768){g=(f[a>>2]|0)+(f[(f[j>>2]|0)+-4>>2]<<3)|0;f[g>>2]=32768-x+(f[g>>2]|0);B=0}else{g=f[h>>2]|0;if((r|0)<=0){A=(x|0)>32768;while(1)if(!A){B=0;break a}}A=f[a>>2]|0;z=x+-32768|0;m=x;while(1){v=32768.0/+(m|0);t=r;i=z;c=m;while(1){p=A+(f[g+(t<<2)>>2]<<3)|0;k=f[p>>2]|0;if(k>>>0<2){y=28;break}q=k-~~+J(+(v*+(k>>>0)))|0;o=(q|0)==0?1:q;q=(o|0)<(k|0)?o:k+-1|0;o=(q|0)>(i|0)?i:q;f[p>>2]=k-o;k=c-o|0;p=i-o|0;if((k|0)==32768){C=p;D=32768;break}if((t|0)>1){t=t+-1|0;i=p;c=k}else{C=p;D=k;break}}if((y|0)==28){y=0;if((t|0)==(r|0)){B=1;break a}else{C=i;D=c}}if((C|0)>0){z=C;m=D}else{B=0;break}}}while(0);D=f[h>>2]|0;if(D|0){h=f[j>>2]|0;if((h|0)!=(D|0))f[j>>2]=h+(~((h+-4-D|0)>>>2)<<2);Oq(D)}if((B|0)!=0|s){w=0;u=e;return w|0}}B=f[a>>2]|0;D=0;h=0;do{f[B+(D<<3)+4>>2]=h;h=(f[B+(D<<3)>>2]|0)+h|0;D=D+1|0}while((D|0)!=(l|0));if((h|0)!=32768){w=0;u=e;return w|0}if(s)E=0.0;else{s=f[a>>2]|0;h=0;v=0.0;while(1){D=f[s+(h<<3)>>2]|0;if(!D)F=v;else{B=b+(h<<3)|0;G=+((f[B>>2]|0)>>>0)+4294967296.0*+((f[B+4>>2]|0)>>>0);F=v+ +Zg(+(D>>>0)*.000030517578125)*G}h=h+1|0;if((h|0)==(l|0)){E=F;break}else v=F}}F=+W(+-E);l=+K(F)>=1.0?(F>0.0?~~+Y(+J(F/4294967296.0),4294967295.0)>>>0:~~+W((F-+(~~F>>>0))/4294967296.0)>>>0):0;h=a+16|0;f[h>>2]=~~F>>>0;f[h+4>>2]=l;w=Le(a,d)|0;u=e;return w|0}function bd(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0.0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0.0,F=0.0,G=0.0;e=u;u=u+16|0;g=e;h=e+4|0;if((c|0)>0){i=0;j=0;k=0;l=0;while(1){m=b+(j<<3)|0;n=f[m>>2]|0;o=f[m+4>>2]|0;m=Vn(n|0,o|0,k|0,l|0)|0;p=I;q=(n|0)==0&(o|0)==0?i:j;j=j+1|0;if((j|0)==(c|0)){r=q;s=p;t=m;break}else{i=q;k=m;l=p}}}else{r=0;s=0;t=0}l=r+1|0;f[a+12>>2]=l;k=a+4|0;i=f[k>>2]|0;c=f[a>>2]|0;j=i-c>>3;p=c;c=i;if(l>>>0<=j>>>0){if(l>>>0>>0?(i=p+(l<<3)|0,(i|0)!=(c|0)):0)f[k>>2]=c+(~((c+-8-i|0)>>>3)<<3)}else wh(a,l-j|0);v=+(t>>>0)+4294967296.0*+(s>>>0);s=(r|0)<0;if(!s){t=f[a>>2]|0;j=0;i=0;do{c=b+(i<<3)|0;k=f[c>>2]|0;p=f[c+4>>2]|0;c=~~((+(k>>>0)+4294967296.0*+(p>>>0))/v*8192.0+.5)>>>0;m=((k|0)!=0|(p|0)!=0)&(c|0)==0?1:c;f[t+(i<<3)>>2]=m;j=m+j|0;i=i+1|0}while((i|0)!=(l|0));if((j|0)==8192){if(s){w=0;u=e;return w|0}}else{x=j;y=12}}else{x=0;y=12}if((y|0)==12){f[h>>2]=0;j=h+4|0;f[j>>2]=0;f[h+8>>2]=0;do if(l)if(l>>>0>1073741823)aq(h);else{i=l<<2;t=ln(i)|0;f[h>>2]=t;m=t+(l<<2)|0;f[h+8>>2]=m;sj(t|0,0,i|0)|0;f[j>>2]=m;z=t;A=m;break}else{z=0;A=0}while(0);if(!s?(f[z>>2]=0,r|0):0){m=1;do{f[z+(m<<2)>>2]=m;m=m+1|0}while((m|0)!=(l|0))}f[g>>2]=a;Gb(z,A,g);a:do if((x|0)<8192){g=(f[a>>2]|0)+(f[(f[j>>2]|0)+-4>>2]<<3)|0;f[g>>2]=8192-x+(f[g>>2]|0);B=0}else{g=f[h>>2]|0;if((r|0)<=0){A=(x|0)>8192;while(1)if(!A){B=0;break a}}A=f[a>>2]|0;z=x+-8192|0;m=x;while(1){v=8192.0/+(m|0);t=r;i=z;c=m;while(1){p=A+(f[g+(t<<2)>>2]<<3)|0;k=f[p>>2]|0;if(k>>>0<2){y=28;break}q=k-~~+J(+(v*+(k>>>0)))|0;o=(q|0)==0?1:q;q=(o|0)<(k|0)?o:k+-1|0;o=(q|0)>(i|0)?i:q;f[p>>2]=k-o;k=c-o|0;p=i-o|0;if((k|0)==8192){C=p;D=8192;break}if((t|0)>1){t=t+-1|0;i=p;c=k}else{C=p;D=k;break}}if((y|0)==28){y=0;if((t|0)==(r|0)){B=1;break a}else{C=i;D=c}}if((C|0)>0){z=C;m=D}else{B=0;break}}}while(0);D=f[h>>2]|0;if(D|0){h=f[j>>2]|0;if((h|0)!=(D|0))f[j>>2]=h+(~((h+-4-D|0)>>>2)<<2);Oq(D)}if((B|0)!=0|s){w=0;u=e;return w|0}}B=f[a>>2]|0;D=0;h=0;do{f[B+(D<<3)+4>>2]=h;h=(f[B+(D<<3)>>2]|0)+h|0;D=D+1|0}while((D|0)!=(l|0));if((h|0)!=8192){w=0;u=e;return w|0}if(s)E=0.0;else{s=f[a>>2]|0;h=0;v=0.0;while(1){D=f[s+(h<<3)>>2]|0;if(!D)F=v;else{B=b+(h<<3)|0;G=+((f[B>>2]|0)>>>0)+4294967296.0*+((f[B+4>>2]|0)>>>0);F=v+ +Zg(+(D>>>0)*.0001220703125)*G}h=h+1|0;if((h|0)==(l|0)){E=F;break}else v=F}}F=+W(+-E);l=+K(F)>=1.0?(F>0.0?~~+Y(+J(F/4294967296.0),4294967295.0)>>>0:~~+W((F-+(~~F>>>0))/4294967296.0)>>>0):0;h=a+16|0;f[h>>2]=~~F>>>0;f[h+4>>2]=l;w=Le(a,d)|0;u=e;return w|0}function cd(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0.0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0.0,F=0.0,G=0.0;e=u;u=u+16|0;g=e;h=e+4|0;if((c|0)>0){i=0;j=0;k=0;l=0;while(1){m=b+(j<<3)|0;n=f[m>>2]|0;o=f[m+4>>2]|0;m=Vn(n|0,o|0,k|0,l|0)|0;p=I;q=(n|0)==0&(o|0)==0?i:j;j=j+1|0;if((j|0)==(c|0)){r=q;s=p;t=m;break}else{i=q;k=m;l=p}}}else{r=0;s=0;t=0}l=r+1|0;f[a+12>>2]=l;k=a+4|0;i=f[k>>2]|0;c=f[a>>2]|0;j=i-c>>3;p=c;c=i;if(l>>>0<=j>>>0){if(l>>>0>>0?(i=p+(l<<3)|0,(i|0)!=(c|0)):0)f[k>>2]=c+(~((c+-8-i|0)>>>3)<<3)}else wh(a,l-j|0);v=+(t>>>0)+4294967296.0*+(s>>>0);s=(r|0)<0;if(!s){t=f[a>>2]|0;j=0;i=0;do{c=b+(i<<3)|0;k=f[c>>2]|0;p=f[c+4>>2]|0;c=~~((+(k>>>0)+4294967296.0*+(p>>>0))/v*4096.0+.5)>>>0;m=((k|0)!=0|(p|0)!=0)&(c|0)==0?1:c;f[t+(i<<3)>>2]=m;j=m+j|0;i=i+1|0}while((i|0)!=(l|0));if((j|0)==4096){if(s){w=0;u=e;return w|0}}else{x=j;y=12}}else{x=0;y=12}if((y|0)==12){f[h>>2]=0;j=h+4|0;f[j>>2]=0;f[h+8>>2]=0;do if(l)if(l>>>0>1073741823)aq(h);else{i=l<<2;t=ln(i)|0;f[h>>2]=t;m=t+(l<<2)|0;f[h+8>>2]=m;sj(t|0,0,i|0)|0;f[j>>2]=m;z=t;A=m;break}else{z=0;A=0}while(0);if(!s?(f[z>>2]=0,r|0):0){m=1;do{f[z+(m<<2)>>2]=m;m=m+1|0}while((m|0)!=(l|0))}f[g>>2]=a;Hb(z,A,g);a:do if((x|0)<4096){g=(f[a>>2]|0)+(f[(f[j>>2]|0)+-4>>2]<<3)|0;f[g>>2]=4096-x+(f[g>>2]|0);B=0}else{g=f[h>>2]|0;if((r|0)<=0){A=(x|0)>4096;while(1)if(!A){B=0;break a}}A=f[a>>2]|0;z=x+-4096|0;m=x;while(1){v=4096.0/+(m|0);t=r;i=z;c=m;while(1){p=A+(f[g+(t<<2)>>2]<<3)|0;k=f[p>>2]|0;if(k>>>0<2){y=28;break}q=k-~~+J(+(v*+(k>>>0)))|0;o=(q|0)==0?1:q;q=(o|0)<(k|0)?o:k+-1|0;o=(q|0)>(i|0)?i:q;f[p>>2]=k-o;k=c-o|0;p=i-o|0;if((k|0)==4096){C=p;D=4096;break}if((t|0)>1){t=t+-1|0;i=p;c=k}else{C=p;D=k;break}}if((y|0)==28){y=0;if((t|0)==(r|0)){B=1;break a}else{C=i;D=c}}if((C|0)>0){z=C;m=D}else{B=0;break}}}while(0);D=f[h>>2]|0;if(D|0){h=f[j>>2]|0;if((h|0)!=(D|0))f[j>>2]=h+(~((h+-4-D|0)>>>2)<<2);Oq(D)}if((B|0)!=0|s){w=0;u=e;return w|0}}B=f[a>>2]|0;D=0;h=0;do{f[B+(D<<3)+4>>2]=h;h=(f[B+(D<<3)>>2]|0)+h|0;D=D+1|0}while((D|0)!=(l|0));if((h|0)!=4096){w=0;u=e;return w|0}if(s)E=0.0;else{s=f[a>>2]|0;h=0;v=0.0;while(1){D=f[s+(h<<3)>>2]|0;if(!D)F=v;else{B=b+(h<<3)|0;G=+((f[B>>2]|0)>>>0)+4294967296.0*+((f[B+4>>2]|0)>>>0);F=v+ +Zg(+(D>>>0)*.000244140625)*G}h=h+1|0;if((h|0)==(l|0)){E=F;break}else v=F}}F=+W(+-E);l=+K(F)>=1.0?(F>0.0?~~+Y(+J(F/4294967296.0),4294967295.0)>>>0:~~+W((F-+(~~F>>>0))/4294967296.0)>>>0):0;h=a+16|0;f[h>>2]=~~F>>>0;f[h+4>>2]=l;w=Le(a,d)|0;u=e;return w|0}function dd(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0.0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0.0,F=0.0,G=0.0;e=u;u=u+16|0;g=e;h=e+4|0;if((c|0)>0){i=0;j=0;k=0;l=0;while(1){m=b+(j<<3)|0;n=f[m>>2]|0;o=f[m+4>>2]|0;m=Vn(n|0,o|0,k|0,l|0)|0;p=I;q=(n|0)==0&(o|0)==0?i:j;j=j+1|0;if((j|0)==(c|0)){r=q;s=p;t=m;break}else{i=q;k=m;l=p}}}else{r=0;s=0;t=0}l=r+1|0;f[a+12>>2]=l;k=a+4|0;i=f[k>>2]|0;c=f[a>>2]|0;j=i-c>>3;p=c;c=i;if(l>>>0<=j>>>0){if(l>>>0>>0?(i=p+(l<<3)|0,(i|0)!=(c|0)):0)f[k>>2]=c+(~((c+-8-i|0)>>>3)<<3)}else wh(a,l-j|0);v=+(t>>>0)+4294967296.0*+(s>>>0);s=(r|0)<0;if(!s){t=f[a>>2]|0;j=0;i=0;do{c=b+(i<<3)|0;k=f[c>>2]|0;p=f[c+4>>2]|0;c=~~((+(k>>>0)+4294967296.0*+(p>>>0))/v*4096.0+.5)>>>0;m=((k|0)!=0|(p|0)!=0)&(c|0)==0?1:c;f[t+(i<<3)>>2]=m;j=m+j|0;i=i+1|0}while((i|0)!=(l|0));if((j|0)==4096){if(s){w=0;u=e;return w|0}}else{x=j;y=12}}else{x=0;y=12}if((y|0)==12){f[h>>2]=0;j=h+4|0;f[j>>2]=0;f[h+8>>2]=0;do if(l)if(l>>>0>1073741823)aq(h);else{i=l<<2;t=ln(i)|0;f[h>>2]=t;m=t+(l<<2)|0;f[h+8>>2]=m;sj(t|0,0,i|0)|0;f[j>>2]=m;z=t;A=m;break}else{z=0;A=0}while(0);if(!s?(f[z>>2]=0,r|0):0){m=1;do{f[z+(m<<2)>>2]=m;m=m+1|0}while((m|0)!=(l|0))}f[g>>2]=a;Ib(z,A,g);a:do if((x|0)<4096){g=(f[a>>2]|0)+(f[(f[j>>2]|0)+-4>>2]<<3)|0;f[g>>2]=4096-x+(f[g>>2]|0);B=0}else{g=f[h>>2]|0;if((r|0)<=0){A=(x|0)>4096;while(1)if(!A){B=0;break a}}A=f[a>>2]|0;z=x+-4096|0;m=x;while(1){v=4096.0/+(m|0);t=r;i=z;c=m;while(1){p=A+(f[g+(t<<2)>>2]<<3)|0;k=f[p>>2]|0;if(k>>>0<2){y=28;break}q=k-~~+J(+(v*+(k>>>0)))|0;o=(q|0)==0?1:q;q=(o|0)<(k|0)?o:k+-1|0;o=(q|0)>(i|0)?i:q;f[p>>2]=k-o;k=c-o|0;p=i-o|0;if((k|0)==4096){C=p;D=4096;break}if((t|0)>1){t=t+-1|0;i=p;c=k}else{C=p;D=k;break}}if((y|0)==28){y=0;if((t|0)==(r|0)){B=1;break a}else{C=i;D=c}}if((C|0)>0){z=C;m=D}else{B=0;break}}}while(0);D=f[h>>2]|0;if(D|0){h=f[j>>2]|0;if((h|0)!=(D|0))f[j>>2]=h+(~((h+-4-D|0)>>>2)<<2);Oq(D)}if((B|0)!=0|s){w=0;u=e;return w|0}}B=f[a>>2]|0;D=0;h=0;do{f[B+(D<<3)+4>>2]=h;h=(f[B+(D<<3)>>2]|0)+h|0;D=D+1|0}while((D|0)!=(l|0));if((h|0)!=4096){w=0;u=e;return w|0}if(s)E=0.0;else{s=f[a>>2]|0;h=0;v=0.0;while(1){D=f[s+(h<<3)>>2]|0;if(!D)F=v;else{B=b+(h<<3)|0;G=+((f[B>>2]|0)>>>0)+4294967296.0*+((f[B+4>>2]|0)>>>0);F=v+ +Zg(+(D>>>0)*.000244140625)*G}h=h+1|0;if((h|0)==(l|0)){E=F;break}else v=F}}F=+W(+-E);l=+K(F)>=1.0?(F>0.0?~~+Y(+J(F/4294967296.0),4294967295.0)>>>0:~~+W((F-+(~~F>>>0))/4294967296.0)>>>0):0;h=a+16|0;f[h>>2]=~~F>>>0;f[h+4>>2]=l;w=Le(a,d)|0;u=e;return w|0}function ed(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0.0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0.0,F=0.0,G=0.0;e=u;u=u+16|0;g=e;h=e+4|0;if((c|0)>0){i=0;j=0;k=0;l=0;while(1){m=b+(j<<3)|0;n=f[m>>2]|0;o=f[m+4>>2]|0;m=Vn(n|0,o|0,k|0,l|0)|0;p=I;q=(n|0)==0&(o|0)==0?i:j;j=j+1|0;if((j|0)==(c|0)){r=q;s=p;t=m;break}else{i=q;k=m;l=p}}}else{r=0;s=0;t=0}l=r+1|0;f[a+12>>2]=l;k=a+4|0;i=f[k>>2]|0;c=f[a>>2]|0;j=i-c>>3;p=c;c=i;if(l>>>0<=j>>>0){if(l>>>0>>0?(i=p+(l<<3)|0,(i|0)!=(c|0)):0)f[k>>2]=c+(~((c+-8-i|0)>>>3)<<3)}else wh(a,l-j|0);v=+(t>>>0)+4294967296.0*+(s>>>0);s=(r|0)<0;if(!s){t=f[a>>2]|0;j=0;i=0;do{c=b+(i<<3)|0;k=f[c>>2]|0;p=f[c+4>>2]|0;c=~~((+(k>>>0)+4294967296.0*+(p>>>0))/v*4096.0+.5)>>>0;m=((k|0)!=0|(p|0)!=0)&(c|0)==0?1:c;f[t+(i<<3)>>2]=m;j=m+j|0;i=i+1|0}while((i|0)!=(l|0));if((j|0)==4096){if(s){w=0;u=e;return w|0}}else{x=j;y=12}}else{x=0;y=12}if((y|0)==12){f[h>>2]=0;j=h+4|0;f[j>>2]=0;f[h+8>>2]=0;do if(l)if(l>>>0>1073741823)aq(h);else{i=l<<2;t=ln(i)|0;f[h>>2]=t;m=t+(l<<2)|0;f[h+8>>2]=m;sj(t|0,0,i|0)|0;f[j>>2]=m;z=t;A=m;break}else{z=0;A=0}while(0);if(!s?(f[z>>2]=0,r|0):0){m=1;do{f[z+(m<<2)>>2]=m;m=m+1|0}while((m|0)!=(l|0))}f[g>>2]=a;Jb(z,A,g);a:do if((x|0)<4096){g=(f[a>>2]|0)+(f[(f[j>>2]|0)+-4>>2]<<3)|0;f[g>>2]=4096-x+(f[g>>2]|0);B=0}else{g=f[h>>2]|0;if((r|0)<=0){A=(x|0)>4096;while(1)if(!A){B=0;break a}}A=f[a>>2]|0;z=x+-4096|0;m=x;while(1){v=4096.0/+(m|0);t=r;i=z;c=m;while(1){p=A+(f[g+(t<<2)>>2]<<3)|0;k=f[p>>2]|0;if(k>>>0<2){y=28;break}q=k-~~+J(+(v*+(k>>>0)))|0;o=(q|0)==0?1:q;q=(o|0)<(k|0)?o:k+-1|0;o=(q|0)>(i|0)?i:q;f[p>>2]=k-o;k=c-o|0;p=i-o|0;if((k|0)==4096){C=p;D=4096;break}if((t|0)>1){t=t+-1|0;i=p;c=k}else{C=p;D=k;break}}if((y|0)==28){y=0;if((t|0)==(r|0)){B=1;break a}else{C=i;D=c}}if((C|0)>0){z=C;m=D}else{B=0;break}}}while(0);D=f[h>>2]|0;if(D|0){h=f[j>>2]|0;if((h|0)!=(D|0))f[j>>2]=h+(~((h+-4-D|0)>>>2)<<2);Oq(D)}if((B|0)!=0|s){w=0;u=e;return w|0}}B=f[a>>2]|0;D=0;h=0;do{f[B+(D<<3)+4>>2]=h;h=(f[B+(D<<3)>>2]|0)+h|0;D=D+1|0}while((D|0)!=(l|0));if((h|0)!=4096){w=0;u=e;return w|0}if(s)E=0.0;else{s=f[a>>2]|0;h=0;v=0.0;while(1){D=f[s+(h<<3)>>2]|0;if(!D)F=v;else{B=b+(h<<3)|0;G=+((f[B>>2]|0)>>>0)+4294967296.0*+((f[B+4>>2]|0)>>>0);F=v+ +Zg(+(D>>>0)*.000244140625)*G}h=h+1|0;if((h|0)==(l|0)){E=F;break}else v=F}}F=+W(+-E);l=+K(F)>=1.0?(F>0.0?~~+Y(+J(F/4294967296.0),4294967295.0)>>>0:~~+W((F-+(~~F>>>0))/4294967296.0)>>>0):0;h=a+16|0;f[h>>2]=~~F>>>0;f[h+4>>2]=l;w=Le(a,d)|0;u=e;return w|0}function fd(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0.0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0.0,F=0.0,G=0.0;e=u;u=u+16|0;g=e;h=e+4|0;if((c|0)>0){i=0;j=0;k=0;l=0;while(1){m=b+(j<<3)|0;n=f[m>>2]|0;o=f[m+4>>2]|0;m=Vn(n|0,o|0,k|0,l|0)|0;p=I;q=(n|0)==0&(o|0)==0?i:j;j=j+1|0;if((j|0)==(c|0)){r=q;s=p;t=m;break}else{i=q;k=m;l=p}}}else{r=0;s=0;t=0}l=r+1|0;f[a+12>>2]=l;k=a+4|0;i=f[k>>2]|0;c=f[a>>2]|0;j=i-c>>3;p=c;c=i;if(l>>>0<=j>>>0){if(l>>>0>>0?(i=p+(l<<3)|0,(i|0)!=(c|0)):0)f[k>>2]=c+(~((c+-8-i|0)>>>3)<<3)}else wh(a,l-j|0);v=+(t>>>0)+4294967296.0*+(s>>>0);s=(r|0)<0;if(!s){t=f[a>>2]|0;j=0;i=0;do{c=b+(i<<3)|0;k=f[c>>2]|0;p=f[c+4>>2]|0;c=~~((+(k>>>0)+4294967296.0*+(p>>>0))/v*4096.0+.5)>>>0;m=((k|0)!=0|(p|0)!=0)&(c|0)==0?1:c;f[t+(i<<3)>>2]=m;j=m+j|0;i=i+1|0}while((i|0)!=(l|0));if((j|0)==4096){if(s){w=0;u=e;return w|0}}else{x=j;y=12}}else{x=0;y=12}if((y|0)==12){f[h>>2]=0;j=h+4|0;f[j>>2]=0;f[h+8>>2]=0;do if(l)if(l>>>0>1073741823)aq(h);else{i=l<<2;t=ln(i)|0;f[h>>2]=t;m=t+(l<<2)|0;f[h+8>>2]=m;sj(t|0,0,i|0)|0;f[j>>2]=m;z=t;A=m;break}else{z=0;A=0}while(0);if(!s?(f[z>>2]=0,r|0):0){m=1;do{f[z+(m<<2)>>2]=m;m=m+1|0}while((m|0)!=(l|0))}f[g>>2]=a;Kb(z,A,g);a:do if((x|0)<4096){g=(f[a>>2]|0)+(f[(f[j>>2]|0)+-4>>2]<<3)|0;f[g>>2]=4096-x+(f[g>>2]|0);B=0}else{g=f[h>>2]|0;if((r|0)<=0){A=(x|0)>4096;while(1)if(!A){B=0;break a}}A=f[a>>2]|0;z=x+-4096|0;m=x;while(1){v=4096.0/+(m|0);t=r;i=z;c=m;while(1){p=A+(f[g+(t<<2)>>2]<<3)|0;k=f[p>>2]|0;if(k>>>0<2){y=28;break}q=k-~~+J(+(v*+(k>>>0)))|0;o=(q|0)==0?1:q;q=(o|0)<(k|0)?o:k+-1|0;o=(q|0)>(i|0)?i:q;f[p>>2]=k-o;k=c-o|0;p=i-o|0;if((k|0)==4096){C=p;D=4096;break}if((t|0)>1){t=t+-1|0;i=p;c=k}else{C=p;D=k;break}}if((y|0)==28){y=0;if((t|0)==(r|0)){B=1;break a}else{C=i;D=c}}if((C|0)>0){z=C;m=D}else{B=0;break}}}while(0);D=f[h>>2]|0;if(D|0){h=f[j>>2]|0;if((h|0)!=(D|0))f[j>>2]=h+(~((h+-4-D|0)>>>2)<<2);Oq(D)}if((B|0)!=0|s){w=0;u=e;return w|0}}B=f[a>>2]|0;D=0;h=0;do{f[B+(D<<3)+4>>2]=h;h=(f[B+(D<<3)>>2]|0)+h|0;D=D+1|0}while((D|0)!=(l|0));if((h|0)!=4096){w=0;u=e;return w|0}if(s)E=0.0;else{s=f[a>>2]|0;h=0;v=0.0;while(1){D=f[s+(h<<3)>>2]|0;if(!D)F=v;else{B=b+(h<<3)|0;G=+((f[B>>2]|0)>>>0)+4294967296.0*+((f[B+4>>2]|0)>>>0);F=v+ +Zg(+(D>>>0)*.000244140625)*G}h=h+1|0;if((h|0)==(l|0)){E=F;break}else v=F}}F=+W(+-E);l=+K(F)>=1.0?(F>0.0?~~+Y(+J(F/4294967296.0),4294967295.0)>>>0:~~+W((F-+(~~F>>>0))/4294967296.0)>>>0):0;h=a+16|0;f[h>>2]=~~F>>>0;f[h+4>>2]=l;w=Le(a,d)|0;u=e;return w|0}function gd(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0.0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0.0,F=0.0,G=0.0;e=u;u=u+16|0;g=e;h=e+4|0;if((c|0)>0){i=0;j=0;k=0;l=0;while(1){m=b+(j<<3)|0;n=f[m>>2]|0;o=f[m+4>>2]|0;m=Vn(n|0,o|0,k|0,l|0)|0;p=I;q=(n|0)==0&(o|0)==0?i:j;j=j+1|0;if((j|0)==(c|0)){r=q;s=p;t=m;break}else{i=q;k=m;l=p}}}else{r=0;s=0;t=0}l=r+1|0;f[a+12>>2]=l;k=a+4|0;i=f[k>>2]|0;c=f[a>>2]|0;j=i-c>>3;p=c;c=i;if(l>>>0<=j>>>0){if(l>>>0>>0?(i=p+(l<<3)|0,(i|0)!=(c|0)):0)f[k>>2]=c+(~((c+-8-i|0)>>>3)<<3)}else wh(a,l-j|0);v=+(t>>>0)+4294967296.0*+(s>>>0);s=(r|0)<0;if(!s){t=f[a>>2]|0;j=0;i=0;do{c=b+(i<<3)|0;k=f[c>>2]|0;p=f[c+4>>2]|0;c=~~((+(k>>>0)+4294967296.0*+(p>>>0))/v*4096.0+.5)>>>0;m=((k|0)!=0|(p|0)!=0)&(c|0)==0?1:c;f[t+(i<<3)>>2]=m;j=m+j|0;i=i+1|0}while((i|0)!=(l|0));if((j|0)==4096){if(s){w=0;u=e;return w|0}}else{x=j;y=12}}else{x=0;y=12}if((y|0)==12){f[h>>2]=0;j=h+4|0;f[j>>2]=0;f[h+8>>2]=0;do if(l)if(l>>>0>1073741823)aq(h);else{i=l<<2;t=ln(i)|0;f[h>>2]=t;m=t+(l<<2)|0;f[h+8>>2]=m;sj(t|0,0,i|0)|0;f[j>>2]=m;z=t;A=m;break}else{z=0;A=0}while(0);if(!s?(f[z>>2]=0,r|0):0){m=1;do{f[z+(m<<2)>>2]=m;m=m+1|0}while((m|0)!=(l|0))}f[g>>2]=a;Lb(z,A,g);a:do if((x|0)<4096){g=(f[a>>2]|0)+(f[(f[j>>2]|0)+-4>>2]<<3)|0;f[g>>2]=4096-x+(f[g>>2]|0);B=0}else{g=f[h>>2]|0;if((r|0)<=0){A=(x|0)>4096;while(1)if(!A){B=0;break a}}A=f[a>>2]|0;z=x+-4096|0;m=x;while(1){v=4096.0/+(m|0);t=r;i=z;c=m;while(1){p=A+(f[g+(t<<2)>>2]<<3)|0;k=f[p>>2]|0;if(k>>>0<2){y=28;break}q=k-~~+J(+(v*+(k>>>0)))|0;o=(q|0)==0?1:q;q=(o|0)<(k|0)?o:k+-1|0;o=(q|0)>(i|0)?i:q;f[p>>2]=k-o;k=c-o|0;p=i-o|0;if((k|0)==4096){C=p;D=4096;break}if((t|0)>1){t=t+-1|0;i=p;c=k}else{C=p;D=k;break}}if((y|0)==28){y=0;if((t|0)==(r|0)){B=1;break a}else{C=i;D=c}}if((C|0)>0){z=C;m=D}else{B=0;break}}}while(0);D=f[h>>2]|0;if(D|0){h=f[j>>2]|0;if((h|0)!=(D|0))f[j>>2]=h+(~((h+-4-D|0)>>>2)<<2);Oq(D)}if((B|0)!=0|s){w=0;u=e;return w|0}}B=f[a>>2]|0;D=0;h=0;do{f[B+(D<<3)+4>>2]=h;h=(f[B+(D<<3)>>2]|0)+h|0;D=D+1|0}while((D|0)!=(l|0));if((h|0)!=4096){w=0;u=e;return w|0}if(s)E=0.0;else{s=f[a>>2]|0;h=0;v=0.0;while(1){D=f[s+(h<<3)>>2]|0;if(!D)F=v;else{B=b+(h<<3)|0;G=+((f[B>>2]|0)>>>0)+4294967296.0*+((f[B+4>>2]|0)>>>0);F=v+ +Zg(+(D>>>0)*.000244140625)*G}h=h+1|0;if((h|0)==(l|0)){E=F;break}else v=F}}F=+W(+-E);l=+K(F)>=1.0?(F>0.0?~~+Y(+J(F/4294967296.0),4294967295.0)>>>0:~~+W((F-+(~~F>>>0))/4294967296.0)>>>0):0;h=a+16|0;f[h>>2]=~~F>>>0;f[h+4>>2]=l;w=Le(a,d)|0;u=e;return w|0}function hd(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0.0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0.0,F=0.0,G=0.0;e=u;u=u+16|0;g=e;h=e+4|0;if((c|0)>0){i=0;j=0;k=0;l=0;while(1){m=b+(j<<3)|0;n=f[m>>2]|0;o=f[m+4>>2]|0;m=Vn(n|0,o|0,k|0,l|0)|0;p=I;q=(n|0)==0&(o|0)==0?i:j;j=j+1|0;if((j|0)==(c|0)){r=q;s=p;t=m;break}else{i=q;k=m;l=p}}}else{r=0;s=0;t=0}l=r+1|0;f[a+12>>2]=l;k=a+4|0;i=f[k>>2]|0;c=f[a>>2]|0;j=i-c>>3;p=c;c=i;if(l>>>0<=j>>>0){if(l>>>0>>0?(i=p+(l<<3)|0,(i|0)!=(c|0)):0)f[k>>2]=c+(~((c+-8-i|0)>>>3)<<3)}else wh(a,l-j|0);v=+(t>>>0)+4294967296.0*+(s>>>0);s=(r|0)<0;if(!s){t=f[a>>2]|0;j=0;i=0;do{c=b+(i<<3)|0;k=f[c>>2]|0;p=f[c+4>>2]|0;c=~~((+(k>>>0)+4294967296.0*+(p>>>0))/v*4096.0+.5)>>>0;m=((k|0)!=0|(p|0)!=0)&(c|0)==0?1:c;f[t+(i<<3)>>2]=m;j=m+j|0;i=i+1|0}while((i|0)!=(l|0));if((j|0)==4096){if(s){w=0;u=e;return w|0}}else{x=j;y=12}}else{x=0;y=12}if((y|0)==12){f[h>>2]=0;j=h+4|0;f[j>>2]=0;f[h+8>>2]=0;do if(l)if(l>>>0>1073741823)aq(h);else{i=l<<2;t=ln(i)|0;f[h>>2]=t;m=t+(l<<2)|0;f[h+8>>2]=m;sj(t|0,0,i|0)|0;f[j>>2]=m;z=t;A=m;break}else{z=0;A=0}while(0);if(!s?(f[z>>2]=0,r|0):0){m=1;do{f[z+(m<<2)>>2]=m;m=m+1|0}while((m|0)!=(l|0))}f[g>>2]=a;Mb(z,A,g);a:do if((x|0)<4096){g=(f[a>>2]|0)+(f[(f[j>>2]|0)+-4>>2]<<3)|0;f[g>>2]=4096-x+(f[g>>2]|0);B=0}else{g=f[h>>2]|0;if((r|0)<=0){A=(x|0)>4096;while(1)if(!A){B=0;break a}}A=f[a>>2]|0;z=x+-4096|0;m=x;while(1){v=4096.0/+(m|0);t=r;i=z;c=m;while(1){p=A+(f[g+(t<<2)>>2]<<3)|0;k=f[p>>2]|0;if(k>>>0<2){y=28;break}q=k-~~+J(+(v*+(k>>>0)))|0;o=(q|0)==0?1:q;q=(o|0)<(k|0)?o:k+-1|0;o=(q|0)>(i|0)?i:q;f[p>>2]=k-o;k=c-o|0;p=i-o|0;if((k|0)==4096){C=p;D=4096;break}if((t|0)>1){t=t+-1|0;i=p;c=k}else{C=p;D=k;break}}if((y|0)==28){y=0;if((t|0)==(r|0)){B=1;break a}else{C=i;D=c}}if((C|0)>0){z=C;m=D}else{B=0;break}}}while(0);D=f[h>>2]|0;if(D|0){h=f[j>>2]|0;if((h|0)!=(D|0))f[j>>2]=h+(~((h+-4-D|0)>>>2)<<2);Oq(D)}if((B|0)!=0|s){w=0;u=e;return w|0}}B=f[a>>2]|0;D=0;h=0;do{f[B+(D<<3)+4>>2]=h;h=(f[B+(D<<3)>>2]|0)+h|0;D=D+1|0}while((D|0)!=(l|0));if((h|0)!=4096){w=0;u=e;return w|0}if(s)E=0.0;else{s=f[a>>2]|0;h=0;v=0.0;while(1){D=f[s+(h<<3)>>2]|0;if(!D)F=v;else{B=b+(h<<3)|0;G=+((f[B>>2]|0)>>>0)+4294967296.0*+((f[B+4>>2]|0)>>>0);F=v+ +Zg(+(D>>>0)*.000244140625)*G}h=h+1|0;if((h|0)==(l|0)){E=F;break}else v=F}}F=+W(+-E);l=+K(F)>=1.0?(F>0.0?~~+Y(+J(F/4294967296.0),4294967295.0)>>>0:~~+W((F-+(~~F>>>0))/4294967296.0)>>>0):0;h=a+16|0;f[h>>2]=~~F>>>0;f[h+4>>2]=l;w=Le(a,d)|0;u=e;return w|0}function id(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0.0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0.0,F=0.0,G=0.0;e=u;u=u+16|0;g=e;h=e+4|0;if((c|0)>0){i=0;j=0;k=0;l=0;while(1){m=b+(j<<3)|0;n=f[m>>2]|0;o=f[m+4>>2]|0;m=Vn(n|0,o|0,k|0,l|0)|0;p=I;q=(n|0)==0&(o|0)==0?i:j;j=j+1|0;if((j|0)==(c|0)){r=q;s=p;t=m;break}else{i=q;k=m;l=p}}}else{r=0;s=0;t=0}l=r+1|0;f[a+12>>2]=l;k=a+4|0;i=f[k>>2]|0;c=f[a>>2]|0;j=i-c>>3;p=c;c=i;if(l>>>0<=j>>>0){if(l>>>0>>0?(i=p+(l<<3)|0,(i|0)!=(c|0)):0)f[k>>2]=c+(~((c+-8-i|0)>>>3)<<3)}else wh(a,l-j|0);v=+(t>>>0)+4294967296.0*+(s>>>0);s=(r|0)<0;if(!s){t=f[a>>2]|0;j=0;i=0;do{c=b+(i<<3)|0;k=f[c>>2]|0;p=f[c+4>>2]|0;c=~~((+(k>>>0)+4294967296.0*+(p>>>0))/v*4096.0+.5)>>>0;m=((k|0)!=0|(p|0)!=0)&(c|0)==0?1:c;f[t+(i<<3)>>2]=m;j=m+j|0;i=i+1|0}while((i|0)!=(l|0));if((j|0)==4096){if(s){w=0;u=e;return w|0}}else{x=j;y=12}}else{x=0;y=12}if((y|0)==12){f[h>>2]=0;j=h+4|0;f[j>>2]=0;f[h+8>>2]=0;do if(l)if(l>>>0>1073741823)aq(h);else{i=l<<2;t=ln(i)|0;f[h>>2]=t;m=t+(l<<2)|0;f[h+8>>2]=m;sj(t|0,0,i|0)|0;f[j>>2]=m;z=t;A=m;break}else{z=0;A=0}while(0);if(!s?(f[z>>2]=0,r|0):0){m=1;do{f[z+(m<<2)>>2]=m;m=m+1|0}while((m|0)!=(l|0))}f[g>>2]=a;Nb(z,A,g);a:do if((x|0)<4096){g=(f[a>>2]|0)+(f[(f[j>>2]|0)+-4>>2]<<3)|0;f[g>>2]=4096-x+(f[g>>2]|0);B=0}else{g=f[h>>2]|0;if((r|0)<=0){A=(x|0)>4096;while(1)if(!A){B=0;break a}}A=f[a>>2]|0;z=x+-4096|0;m=x;while(1){v=4096.0/+(m|0);t=r;i=z;c=m;while(1){p=A+(f[g+(t<<2)>>2]<<3)|0;k=f[p>>2]|0;if(k>>>0<2){y=28;break}q=k-~~+J(+(v*+(k>>>0)))|0;o=(q|0)==0?1:q;q=(o|0)<(k|0)?o:k+-1|0;o=(q|0)>(i|0)?i:q;f[p>>2]=k-o;k=c-o|0;p=i-o|0;if((k|0)==4096){C=p;D=4096;break}if((t|0)>1){t=t+-1|0;i=p;c=k}else{C=p;D=k;break}}if((y|0)==28){y=0;if((t|0)==(r|0)){B=1;break a}else{C=i;D=c}}if((C|0)>0){z=C;m=D}else{B=0;break}}}while(0);D=f[h>>2]|0;if(D|0){h=f[j>>2]|0;if((h|0)!=(D|0))f[j>>2]=h+(~((h+-4-D|0)>>>2)<<2);Oq(D)}if((B|0)!=0|s){w=0;u=e;return w|0}}B=f[a>>2]|0;D=0;h=0;do{f[B+(D<<3)+4>>2]=h;h=(f[B+(D<<3)>>2]|0)+h|0;D=D+1|0}while((D|0)!=(l|0));if((h|0)!=4096){w=0;u=e;return w|0}if(s)E=0.0;else{s=f[a>>2]|0;h=0;v=0.0;while(1){D=f[s+(h<<3)>>2]|0;if(!D)F=v;else{B=b+(h<<3)|0;G=+((f[B>>2]|0)>>>0)+4294967296.0*+((f[B+4>>2]|0)>>>0);F=v+ +Zg(+(D>>>0)*.000244140625)*G}h=h+1|0;if((h|0)==(l|0)){E=F;break}else v=F}}F=+W(+-E);l=+K(F)>=1.0?(F>0.0?~~+Y(+J(F/4294967296.0),4294967295.0)>>>0:~~+W((F-+(~~F>>>0))/4294967296.0)>>>0):0;h=a+16|0;f[h>>2]=~~F>>>0;f[h+4>>2]=l;w=Le(a,d)|0;u=e;return w|0}function jd(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0.0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0.0,F=0.0,G=0.0;e=u;u=u+16|0;g=e;h=e+4|0;if((c|0)>0){i=0;j=0;k=0;l=0;while(1){m=b+(j<<3)|0;n=f[m>>2]|0;o=f[m+4>>2]|0;m=Vn(n|0,o|0,k|0,l|0)|0;p=I;q=(n|0)==0&(o|0)==0?i:j;j=j+1|0;if((j|0)==(c|0)){r=q;s=p;t=m;break}else{i=q;k=m;l=p}}}else{r=0;s=0;t=0}l=r+1|0;f[a+12>>2]=l;k=a+4|0;i=f[k>>2]|0;c=f[a>>2]|0;j=i-c>>3;p=c;c=i;if(l>>>0<=j>>>0){if(l>>>0>>0?(i=p+(l<<3)|0,(i|0)!=(c|0)):0)f[k>>2]=c+(~((c+-8-i|0)>>>3)<<3)}else wh(a,l-j|0);v=+(t>>>0)+4294967296.0*+(s>>>0);s=(r|0)<0;if(!s){t=f[a>>2]|0;j=0;i=0;do{c=b+(i<<3)|0;k=f[c>>2]|0;p=f[c+4>>2]|0;c=~~((+(k>>>0)+4294967296.0*+(p>>>0))/v*4096.0+.5)>>>0;m=((k|0)!=0|(p|0)!=0)&(c|0)==0?1:c;f[t+(i<<3)>>2]=m;j=m+j|0;i=i+1|0}while((i|0)!=(l|0));if((j|0)==4096){if(s){w=0;u=e;return w|0}}else{x=j;y=12}}else{x=0;y=12}if((y|0)==12){f[h>>2]=0;j=h+4|0;f[j>>2]=0;f[h+8>>2]=0;do if(l)if(l>>>0>1073741823)aq(h);else{i=l<<2;t=ln(i)|0;f[h>>2]=t;m=t+(l<<2)|0;f[h+8>>2]=m;sj(t|0,0,i|0)|0;f[j>>2]=m;z=t;A=m;break}else{z=0;A=0}while(0);if(!s?(f[z>>2]=0,r|0):0){m=1;do{f[z+(m<<2)>>2]=m;m=m+1|0}while((m|0)!=(l|0))}f[g>>2]=a;Ob(z,A,g);a:do if((x|0)<4096){g=(f[a>>2]|0)+(f[(f[j>>2]|0)+-4>>2]<<3)|0;f[g>>2]=4096-x+(f[g>>2]|0);B=0}else{g=f[h>>2]|0;if((r|0)<=0){A=(x|0)>4096;while(1)if(!A){B=0;break a}}A=f[a>>2]|0;z=x+-4096|0;m=x;while(1){v=4096.0/+(m|0);t=r;i=z;c=m;while(1){p=A+(f[g+(t<<2)>>2]<<3)|0;k=f[p>>2]|0;if(k>>>0<2){y=28;break}q=k-~~+J(+(v*+(k>>>0)))|0;o=(q|0)==0?1:q;q=(o|0)<(k|0)?o:k+-1|0;o=(q|0)>(i|0)?i:q;f[p>>2]=k-o;k=c-o|0;p=i-o|0;if((k|0)==4096){C=p;D=4096;break}if((t|0)>1){t=t+-1|0;i=p;c=k}else{C=p;D=k;break}}if((y|0)==28){y=0;if((t|0)==(r|0)){B=1;break a}else{C=i;D=c}}if((C|0)>0){z=C;m=D}else{B=0;break}}}while(0);D=f[h>>2]|0;if(D|0){h=f[j>>2]|0;if((h|0)!=(D|0))f[j>>2]=h+(~((h+-4-D|0)>>>2)<<2);Oq(D)}if((B|0)!=0|s){w=0;u=e;return w|0}}B=f[a>>2]|0;D=0;h=0;do{f[B+(D<<3)+4>>2]=h;h=(f[B+(D<<3)>>2]|0)+h|0;D=D+1|0}while((D|0)!=(l|0));if((h|0)!=4096){w=0;u=e;return w|0}if(s)E=0.0;else{s=f[a>>2]|0;h=0;v=0.0;while(1){D=f[s+(h<<3)>>2]|0;if(!D)F=v;else{B=b+(h<<3)|0;G=+((f[B>>2]|0)>>>0)+4294967296.0*+((f[B+4>>2]|0)>>>0);F=v+ +Zg(+(D>>>0)*.000244140625)*G}h=h+1|0;if((h|0)==(l|0)){E=F;break}else v=F}}F=+W(+-E);l=+K(F)>=1.0?(F>0.0?~~+Y(+J(F/4294967296.0),4294967295.0)>>>0:~~+W((F-+(~~F>>>0))/4294967296.0)>>>0):0;h=a+16|0;f[h>>2]=~~F>>>0;f[h+4>>2]=l;w=Le(a,d)|0;u=e;return w|0}function kd(a,b,c,d,e,g){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;g=g|0;var h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=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=d+20|0;h=d+24|0;i=d+8|0;j=f[a>>2]|0;k=j+8|0;l=j;j=f[l>>2]|0;m=f[l+4>>2]|0;l=Vn(j|0,m|0,f[k>>2]|0,f[k+4>>2]|0)|0;k=I;n=Vn(l|0,k|0,(l|0)==0&(k|0)==0&1|0,0)|0;k=~~((+(j>>>0)+4294967296.0*+(m>>>0))/(+(n>>>0)+4294967296.0*+(I>>>0))*256.0+.5)>>>0;n=k>>>0<255?k:255;k=n+((n|0)==0&1)&255;b[h>>0]=k;n=a+12|0;m=a+16|0;j=((f[m>>2]|0)-(f[n>>2]|0)<<1)+64|0;f[i>>2]=0;l=i+4|0;f[l>>2]=0;f[i+8>>2]=0;if(!j)o=0;else{if((j|0)<0)aq(i);p=ln(j)|0;f[l>>2]=p;f[i>>2]=p;f[i+8>>2]=p+j;q=j;j=p;do{b[j>>0]=0;j=(f[l>>2]|0)+1|0;f[l>>2]=j;q=q+-1|0}while((q|0)!=0);o=f[i>>2]|0}q=a+28|0;j=(f[q>>2]|0)+-1|0;a:do if((j|0)>-1){p=a+24|0;r=j;s=4096;t=0;v=k;while(1){w=(f[p>>2]&1<>>0>>0){y=t;z=s}else{b[o+t>>0]=s;y=t+1|0;z=s>>>8}un(f[4092+(x<<3)>>2]|0,0,z|0,0)|0;A=z+(w?0:0-v&255)+(X((z+I|0)>>>(f[4092+(x<<3)+4>>2]|0),256-x|0)|0)|0;x=r+-1|0;if((x|0)<=-1){B=A;C=y;break a}r=x;s=A;t=y;v=b[h>>0]|0}}else{B=4096;C=0}while(0);y=f[m>>2]|0;if((f[n>>2]|0)==(y|0)){D=B;E=C}else{z=B;B=C;C=y;while(1){C=C+-4|0;y=f[C>>2]|0;k=31;j=z;v=B;while(1){t=b[h>>0]|0;s=(1<>>0>>0){F=v;G=j}else{b[o+v>>0]=j;F=v+1|0;G=j>>>8}un(f[4092+(r<<3)>>2]|0,0,G|0,0)|0;j=G+(s?0:0-t&255)+(X((G+I|0)>>>(f[4092+(r<<3)+4>>2]|0),256-r|0)|0)|0;if((k|0)<=0)break;else{k=k+-1|0;v=F}}if((f[n>>2]|0)==(C|0)){D=j;E=F;break}else{z=j;B=F}}}F=D+-4096|0;do if(F>>>0>=64){if(F>>>0<16384){B=o+E|0;z=D+12288|0;b[B>>0]=z;H=2;J=z>>>8;K=B+1|0;L=25;break}if(F>>>0<4194304){B=o+E|0;z=D+8384512|0;b[B>>0]=z;b[B+1>>0]=z>>>8;H=3;J=z>>>16;K=B+2|0;L=25}else M=E}else{H=1;J=F;K=o+E|0;L=25}while(0);if((L|0)==25){b[K>>0]=J;M=H+E|0}E=c+16|0;H=E;J=f[H+4>>2]|0;if(!((J|0)>0|(J|0)==0&(f[H>>2]|0)>>>0>0)){f[g>>2]=f[c+4>>2];f[e>>2]=f[g>>2];Me(c,e,h,h+1|0)|0}ci(M,c)|0;h=f[i>>2]|0;H=E;E=f[H+4>>2]|0;if(!((E|0)>0|(E|0)==0&(f[H>>2]|0)>>>0>0)){f[g>>2]=f[c+4>>2];f[e>>2]=f[g>>2];Me(c,e,h,h+M|0)|0}M=e;f[M>>2]=0;f[M+4>>2]=0;qf(a,2,e);e=f[a+12>>2]|0;M=f[m>>2]|0;if((M|0)!=(e|0))f[m>>2]=M+(~((M+-4-e|0)>>>2)<<2);f[a+24>>2]=0;f[q>>2]=0;q=f[i>>2]|0;if(!q){u=d;return}if((f[l>>2]|0)!=(q|0))f[l>>2]=q;Oq(q);u=d;return}function md(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0;c=u;u=u+16|0;b=c+8|0;d=c+4|0;e=c;g=a+64|0;h=f[g>>2]|0;if((f[h+28>>2]|0)==(f[h+24>>2]|0)){u=c;return}i=a+52|0;j=a+56|0;k=a+60|0;l=a+12|0;m=a+28|0;n=a+40|0;o=a+44|0;p=a+48|0;q=0;r=0;s=h;while(1){h=f[(f[s+24>>2]|0)+(r<<2)>>2]|0;if((h|0)==-1){t=q;v=s}else{w=q+1|0;f[b>>2]=q;x=f[j>>2]|0;if((x|0)==(f[k>>2]|0))Ri(i,b);else{f[x>>2]=q;f[j>>2]=x+4}f[d>>2]=h;f[e>>2]=0;a:do if(!(f[(f[l>>2]|0)+(r>>>5<<2)>>2]&1<<(r&31)))y=h;else{x=h+1|0;z=((x>>>0)%3|0|0)==0?h+-2|0:x;if(((z|0)!=-1?(f[(f[a>>2]|0)+(z>>>5<<2)>>2]&1<<(z&31)|0)==0:0)?(x=f[(f[(f[g>>2]|0)+12>>2]|0)+(z<<2)>>2]|0,z=x+1|0,(x|0)!=-1):0){A=((z>>>0)%3|0|0)==0?x+-2|0:z;f[e>>2]=A;if((A|0)==-1){y=h;break}else B=A;while(1){f[d>>2]=B;A=B+1|0;z=((A>>>0)%3|0|0)==0?B+-2|0:A;if((z|0)==-1)break;if(f[(f[a>>2]|0)+(z>>>5<<2)>>2]&1<<(z&31)|0)break;A=f[(f[(f[g>>2]|0)+12>>2]|0)+(z<<2)>>2]|0;z=A+1|0;if((A|0)==-1)break;x=((z>>>0)%3|0|0)==0?A+-2|0:z;f[e>>2]=x;if((x|0)==-1){y=B;break a}else B=x}f[e>>2]=-1;y=B;break}f[e>>2]=-1;y=h}while(0);f[(f[m>>2]|0)+(y<<2)>>2]=f[b>>2];h=f[o>>2]|0;if((h|0)==(f[p>>2]|0))Ri(n,d);else{f[h>>2]=f[d>>2];f[o>>2]=h+4}h=f[g>>2]|0;x=f[d>>2]|0;b:do if(((x|0)!=-1?(z=(((x>>>0)%3|0|0)==0?2:-1)+x|0,(z|0)!=-1):0)?(A=f[(f[h+12>>2]|0)+(z<<2)>>2]|0,(A|0)!=-1):0){z=A+(((A>>>0)%3|0|0)==0?2:-1)|0;f[e>>2]=z;if((z|0)!=-1&(z|0)!=(x|0)){A=w;C=z;while(1){z=C+1|0;D=((z>>>0)%3|0|0)==0?C+-2|0:z;do if(f[(f[a>>2]|0)+(D>>>5<<2)>>2]&1<<(D&31)){z=A+1|0;f[b>>2]=A;E=f[j>>2]|0;if((E|0)==(f[k>>2]|0))Ri(i,b);else{f[E>>2]=A;f[j>>2]=E+4}E=f[o>>2]|0;if((E|0)==(f[p>>2]|0)){Ri(n,e);F=z;break}else{f[E>>2]=f[e>>2];f[o>>2]=E+4;F=z;break}}else F=A;while(0);f[(f[m>>2]|0)+(f[e>>2]<<2)>>2]=f[b>>2];G=f[g>>2]|0;D=f[e>>2]|0;if((D|0)==-1)break;z=(((D>>>0)%3|0|0)==0?2:-1)+D|0;if((z|0)==-1)break;D=f[(f[G+12>>2]|0)+(z<<2)>>2]|0;if((D|0)==-1)break;C=D+(((D>>>0)%3|0|0)==0?2:-1)|0;f[e>>2]=C;if(!((C|0)!=-1?(C|0)!=(f[d>>2]|0):0)){H=F;I=G;break b}else A=F}f[e>>2]=-1;H=F;I=G}else{H=w;I=h}}else J=26;while(0);if((J|0)==26){J=0;f[e>>2]=-1;H=w;I=h}t=H;v=I}r=r+1|0;if(r>>>0>=(f[v+28>>2]|0)-(f[v+24>>2]|0)>>2>>>0)break;else{q=t;s=v}}u=c;return}function nd(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0;c=u;u=u+16|0;d=c+8|0;e=c+4|0;g=c;h=a+124|0;f[h>>2]=(f[h>>2]|0)+1;h=a+88|0;i=a+120|0;j=f[i>>2]|0;k=j+1|0;do if((j|0)!=-1){l=((k>>>0)%3|0|0)==0?j+-2|0:k;if(!((j>>>0)%3|0)){m=j+2|0;n=l;break}else{m=j+-1|0;n=l;break}}else{m=-1;n=-1}while(0);k=a+104|0;l=a+92|0;o=f[l>>2]|0;p=o+(n<<2)|0;q=f[k>>2]|0;r=q+(f[p>>2]<<2)|0;s=f[r>>2]|0;switch(b|0){case 1:case 0:{f[r>>2]=s+-1;r=q+(f[o+(m<<2)>>2]<<2)|0;f[r>>2]=(f[r>>2]|0)+-1;if((b|0)==1){if((m|0)!=-1?(r=f[(f[(f[h>>2]|0)+12>>2]|0)+(m<<2)>>2]|0,(r|0)!=-1):0){t=a+64|0;v=1;w=r;while(1){r=f[t>>2]|0;x=f[(f[r>>2]|0)+36>>2]|0;f[e>>2]=(w>>>0)/3|0;f[d>>2]=f[e>>2];if(Ra[x&127](r,d)|0){y=v;break}r=w+1|0;x=((r>>>0)%3|0|0)==0?w+-2|0:r;if((x|0)==-1){z=12;break}w=f[(f[(f[h>>2]|0)+12>>2]|0)+(x<<2)>>2]|0;x=v+1|0;if((w|0)==-1){y=x;break}else v=x}if((z|0)==12)y=v+1|0;A=y;B=f[k>>2]|0;C=f[l>>2]|0}else{A=1;B=q;C=o}f[B+(f[C+(f[i>>2]<<2)>>2]<<2)>>2]=A;A=a+108|0;i=f[A>>2]|0;C=i-B>>2;B=i;if((n|0)!=-1?(i=f[(f[(f[h>>2]|0)+12>>2]|0)+(n<<2)>>2]|0,(i|0)!=-1):0){n=a+64|0;y=1;v=i;while(1){i=f[n>>2]|0;w=f[(f[i>>2]|0)+36>>2]|0;f[g>>2]=(v>>>0)/3|0;f[d>>2]=f[g>>2];if(Ra[w&127](i,d)|0){D=y;break}i=v+1|0;f[(f[l>>2]|0)+((((i>>>0)%3|0|0)==0?v+-2|0:i)<<2)>>2]=C;i=(((v>>>0)%3|0|0)==0?2:-1)+v|0;if((i|0)==-1){z=20;break}v=f[(f[(f[h>>2]|0)+12>>2]|0)+(i<<2)>>2]|0;i=y+1|0;if((v|0)==-1){D=i;break}else y=i}if((z|0)==20)D=y+1|0;E=D;F=f[A>>2]|0}else{E=1;F=B}f[d>>2]=E;if(F>>>0<(f[a+112>>2]|0)>>>0){f[F>>2]=E;f[A>>2]=F+4}else Ri(k,d)}break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2]=1544;f[c+4>>2]=d;h=c+8|0;f[h>>2]=f[e>>2];f[h+4>>2]=f[e+4>>2];f[h+8>>2]=f[e+8>>2];f[h+12>>2]=f[e+12>>2];f[h+16>>2]=f[e+16>>2];f[h+20>>2]=f[e+20>>2];fk(c+32|0,e+24|0);h=c+44|0;f[h>>2]=f[g>>2];f[h+4>>2]=f[g+4>>2];f[h+8>>2]=f[g+8>>2];f[h+12>>2]=f[g+12>>2];f[c>>2]=2132;i=c;f[a>>2]=i;return}case 4:{c=ln(168)|0;Ti(c,d,e,g);i=c;f[a>>2]=i;return}case 3:{c=ln(88)|0;f[c>>2]=1544;f[c+4>>2]=d;h=c+8|0;f[h>>2]=f[e>>2];f[h+4>>2]=f[e+4>>2];f[h+8>>2]=f[e+8>>2];f[h+12>>2]=f[e+12>>2];f[h+16>>2]=f[e+16>>2];f[h+20>>2]=f[e+20>>2];fk(c+32|0,e+24|0);h=c+44|0;f[h>>2]=f[g>>2];f[h+4>>2]=f[g+4>>2];f[h+8>>2]=f[g+8>>2];f[h+12>>2]=f[g+12>>2];f[c>>2]=2188;h=c+60|0;f[h>>2]=0;f[h+4>>2]=0;f[h+8>>2]=0;f[h+12>>2]=0;f[h+16>>2]=0;f[h+20>>2]=0;f[h+24>>2]=0;i=c;f[a>>2]=i;return}case 5:{c=ln(104)|0;f[c>>2]=1544;f[c+4>>2]=d;h=c+8|0;f[h>>2]=f[e>>2];f[h+4>>2]=f[e+4>>2];f[h+8>>2]=f[e+8>>2];f[h+12>>2]=f[e+12>>2];f[h+16>>2]=f[e+16>>2];f[h+20>>2]=f[e+20>>2];fk(c+32|0,e+24|0);h=c+44|0;f[h>>2]=f[g>>2];f[h+4>>2]=f[g+4>>2];f[h+8>>2]=f[g+8>>2];f[h+12>>2]=f[g+12>>2];f[c>>2]=2244;f[c+60>>2]=0;f[c+64>>2]=0;f[c+76>>2]=0;f[c+80>>2]=0;f[c+84>>2]=0;h=c+88|0;f[h>>2]=f[g>>2];f[h+4>>2]=f[g+4>>2];f[h+8>>2]=f[g+8>>2];f[h+12>>2]=f[g+12>>2];i=c;f[a>>2]=i;return}case 6:{c=ln(140)|0;f[c>>2]=1544;f[c+4>>2]=d;d=c+8|0;f[d>>2]=f[e>>2];f[d+4>>2]=f[e+4>>2];f[d+8>>2]=f[e+8>>2];f[d+12>>2]=f[e+12>>2];f[d+16>>2]=f[e+16>>2];f[d+20>>2]=f[e+20>>2];fk(c+32|0,e+24|0);e=c+44|0;f[e>>2]=f[g>>2];f[e+4>>2]=f[g+4>>2];f[e+8>>2]=f[g+8>>2];f[e+12>>2]=f[g+12>>2];f[c>>2]=2300;f[c+64>>2]=0;f[c+68>>2]=0;e=c+72|0;f[e>>2]=f[g>>2];f[e+4>>2]=f[g+4>>2];f[e+8>>2]=f[g+8>>2];f[e+12>>2]=f[g+12>>2];f[c+60>>2]=2356;f[c+88>>2]=1;g=c+92|0;f[g>>2]=-1;f[g+4>>2]=-1;f[g+8>>2]=-1;f[g+12>>2]=-1;wn(c+108|0);i=c;f[a>>2]=i;return}default:{i=0;f[a>>2]=i;return}}}function qd(a,b,c,d,e,g,h){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;g=g|0;h=h|0;var i=0;switch(c|0){case 1:{c=ln(60)|0;f[c>>2]=1544;f[c+4>>2]=d;h=c+8|0;f[h>>2]=f[e>>2];f[h+4>>2]=f[e+4>>2];f[h+8>>2]=f[e+8>>2];f[h+12>>2]=f[e+12>>2];f[h+16>>2]=f[e+16>>2];f[h+20>>2]=f[e+20>>2];fk(c+32|0,e+24|0);h=c+44|0;f[h>>2]=f[g>>2];f[h+4>>2]=f[g+4>>2];f[h+8>>2]=f[g+8>>2];f[h+12>>2]=f[g+12>>2];f[c>>2]=1656;i=c;f[a>>2]=i;return}case 2:{c=ln(60)|0;f[c>>2]=1544;f[c+4>>2]=d;h=c+8|0;f[h>>2]=f[e>>2];f[h+4>>2]=f[e+4>>2];f[h+8>>2]=f[e+8>>2];f[h+12>>2]=f[e+12>>2];f[h+16>>2]=f[e+16>>2];f[h+20>>2]=f[e+20>>2];fk(c+32|0,e+24|0);h=c+44|0;f[h>>2]=f[g>>2];f[h+4>>2]=f[g+4>>2];f[h+8>>2]=f[g+8>>2];f[h+12>>2]=f[g+12>>2];f[c>>2]=1712;i=c;f[a>>2]=i;return}case 4:{c=ln(168)|0;Ui(c,d,e,g);i=c;f[a>>2]=i;return}case 3:{c=ln(88)|0;f[c>>2]=1544;f[c+4>>2]=d;h=c+8|0;f[h>>2]=f[e>>2];f[h+4>>2]=f[e+4>>2];f[h+8>>2]=f[e+8>>2];f[h+12>>2]=f[e+12>>2];f[h+16>>2]=f[e+16>>2];f[h+20>>2]=f[e+20>>2];fk(c+32|0,e+24|0);h=c+44|0;f[h>>2]=f[g>>2];f[h+4>>2]=f[g+4>>2];f[h+8>>2]=f[g+8>>2];f[h+12>>2]=f[g+12>>2];f[c>>2]=1768;h=c+60|0;f[h>>2]=0;f[h+4>>2]=0;f[h+8>>2]=0;f[h+12>>2]=0;f[h+16>>2]=0;f[h+20>>2]=0;f[h+24>>2]=0;i=c;f[a>>2]=i;return}case 5:{c=ln(104)|0;f[c>>2]=1544;f[c+4>>2]=d;h=c+8|0;f[h>>2]=f[e>>2];f[h+4>>2]=f[e+4>>2];f[h+8>>2]=f[e+8>>2];f[h+12>>2]=f[e+12>>2];f[h+16>>2]=f[e+16>>2];f[h+20>>2]=f[e+20>>2];fk(c+32|0,e+24|0);h=c+44|0;f[h>>2]=f[g>>2];f[h+4>>2]=f[g+4>>2];f[h+8>>2]=f[g+8>>2];f[h+12>>2]=f[g+12>>2];f[c>>2]=1824;f[c+60>>2]=0;f[c+64>>2]=0;f[c+76>>2]=0;f[c+80>>2]=0;f[c+84>>2]=0;h=c+88|0;f[h>>2]=f[g>>2];f[h+4>>2]=f[g+4>>2];f[h+8>>2]=f[g+8>>2];f[h+12>>2]=f[g+12>>2];i=c;f[a>>2]=i;return}case 6:{c=ln(140)|0;f[c>>2]=1544;f[c+4>>2]=d;d=c+8|0;f[d>>2]=f[e>>2];f[d+4>>2]=f[e+4>>2];f[d+8>>2]=f[e+8>>2];f[d+12>>2]=f[e+12>>2];f[d+16>>2]=f[e+16>>2];f[d+20>>2]=f[e+20>>2];fk(c+32|0,e+24|0);e=c+44|0;f[e>>2]=f[g>>2];f[e+4>>2]=f[g+4>>2];f[e+8>>2]=f[g+8>>2];f[e+12>>2]=f[g+12>>2];f[c>>2]=1880;f[c+64>>2]=0;f[c+68>>2]=0;e=c+72|0;f[e>>2]=f[g>>2];f[e+4>>2]=f[g+4>>2];f[e+8>>2]=f[g+8>>2];f[e+12>>2]=f[g+12>>2];f[c+60>>2]=1936;f[c+88>>2]=1;g=c+92|0;f[g>>2]=-1;f[g+4>>2]=-1;f[g+8>>2]=-1;f[g+12>>2]=-1;wn(c+108|0);i=c;f[a>>2]=i;return}default:{i=0;f[a>>2]=i;return}}}function rd(a,b){a=a|0;b=b|0;var c=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0;c=a+4|0;if(!b){e=f[a>>2]|0;f[a>>2]=0;if(e|0)Oq(e);f[c>>2]=0;return}if(b>>>0>1073741823){e=ra(8)|0;Oo(e,16035);f[e>>2]=7256;va(e|0,1112,110)}e=ln(b<<2)|0;g=f[a>>2]|0;f[a>>2]=e;if(g|0)Oq(g);f[c>>2]=b;c=0;do{f[(f[a>>2]|0)+(c<<2)>>2]=0;c=c+1|0}while((c|0)!=(b|0));c=a+8|0;g=f[c>>2]|0;if(!g)return;e=f[g+4>>2]|0;h=b+-1|0;i=(h&b|0)==0;if(!i)if(e>>>0>>0)j=e;else j=(e>>>0)%(b>>>0)|0;else j=e&h;f[(f[a>>2]|0)+(j<<2)>>2]=c;c=f[g>>2]|0;if(!c)return;else{k=j;l=g;m=c;n=g}a:while(1){g=l;c=m;j=n;b:while(1){c:do if(i){e=c;while(1){o=f[e+4>>2]&h;if((o|0)==(k|0)){p=e;break c}q=(f[a>>2]|0)+(o<<2)|0;if(!(f[q>>2]|0)){r=e;s=o;t=q;break b}q=e+8|0;u=q+2|0;v=e+12|0;w=q+6|0;x=f[e>>2]|0;d:do if(!x)y=e;else{z=d[q>>1]|0;A=e;B=x;while(1){C=B+8|0;if(z<<16>>16!=(d[C>>1]|0)){y=A;break d}if((d[u>>1]|0)!=(d[C+2>>1]|0)){y=A;break d}if((d[v>>1]|0)!=(d[B+12>>1]|0)){y=A;break d}if((d[w>>1]|0)!=(d[C+6>>1]|0)){y=A;break d}C=f[B>>2]|0;if(!C){y=B;break}else{D=B;B=C;A=D}}}while(0);f[j>>2]=f[y>>2];f[y>>2]=f[f[(f[a>>2]|0)+(o<<2)>>2]>>2];f[f[(f[a>>2]|0)+(o<<2)>>2]>>2]=e;e=f[g>>2]|0;if(!e){E=43;break a}}}else{e=c;while(1){w=f[e+4>>2]|0;if(w>>>0>>0)F=w;else F=(w>>>0)%(b>>>0)|0;if((F|0)==(k|0)){p=e;break c}w=(f[a>>2]|0)+(F<<2)|0;if(!(f[w>>2]|0)){r=e;s=F;t=w;break b}w=e+8|0;v=w+2|0;u=e+12|0;x=w+6|0;q=f[e>>2]|0;e:do if(!q)G=e;else{A=d[w>>1]|0;B=e;z=q;while(1){D=z+8|0;if(A<<16>>16!=(d[D>>1]|0)){G=B;break e}if((d[v>>1]|0)!=(d[D+2>>1]|0)){G=B;break e}if((d[u>>1]|0)!=(d[z+12>>1]|0)){G=B;break e}if((d[x>>1]|0)!=(d[D+6>>1]|0)){G=B;break e}D=f[z>>2]|0;if(!D){G=z;break}else{C=z;z=D;B=C}}}while(0);f[j>>2]=f[G>>2];f[G>>2]=f[f[(f[a>>2]|0)+(F<<2)>>2]>>2];f[f[(f[a>>2]|0)+(F<<2)>>2]>>2]=e;e=f[g>>2]|0;if(!e){E=43;break a}}}while(0);c=f[p>>2]|0;if(!c){E=43;break a}else{g=p;j=p}}f[t>>2]=j;m=f[r>>2]|0;if(!m){E=43;break}else{k=s;l=r;n=r}}if((E|0)==43)return}function sd(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0;d=a+4|0;if(!c){e=f[a>>2]|0;f[a>>2]=0;if(e|0)Oq(e);f[d>>2]=0;return}if(c>>>0>1073741823){e=ra(8)|0;Oo(e,16035);f[e>>2]=7256;va(e|0,1112,110)}e=ln(c<<2)|0;g=f[a>>2]|0;f[a>>2]=e;if(g|0)Oq(g);f[d>>2]=c;d=0;do{f[(f[a>>2]|0)+(d<<2)>>2]=0;d=d+1|0}while((d|0)!=(c|0));d=a+8|0;g=f[d>>2]|0;if(!g)return;e=f[g+4>>2]|0;h=c+-1|0;i=(h&c|0)==0;if(!i)if(e>>>0>>0)j=e;else j=(e>>>0)%(c>>>0)|0;else j=e&h;f[(f[a>>2]|0)+(j<<2)>>2]=d;d=f[g>>2]|0;if(!d)return;else{k=j;l=g;m=d;n=g}a:while(1){g=l;d=m;j=n;b:while(1){c:do if(i){e=d;while(1){o=f[e+4>>2]&h;if((o|0)==(k|0)){p=e;break c}q=(f[a>>2]|0)+(o<<2)|0;if(!(f[q>>2]|0)){r=e;s=o;t=q;break b}q=e+8|0;u=q+1|0;v=q+2|0;w=q+3|0;x=f[e>>2]|0;d:do if(!x)y=e;else{z=b[q>>0]|0;A=e;B=x;while(1){C=B+8|0;if(z<<24>>24!=(b[C>>0]|0)){y=A;break d}if((b[u>>0]|0)!=(b[C+1>>0]|0)){y=A;break d}if((b[v>>0]|0)!=(b[C+2>>0]|0)){y=A;break d}if((b[w>>0]|0)!=(b[C+3>>0]|0)){y=A;break d}C=f[B>>2]|0;if(!C){y=B;break}else{D=B;B=C;A=D}}}while(0);f[j>>2]=f[y>>2];f[y>>2]=f[f[(f[a>>2]|0)+(o<<2)>>2]>>2];f[f[(f[a>>2]|0)+(o<<2)>>2]>>2]=e;e=f[g>>2]|0;if(!e){E=43;break a}}}else{e=d;while(1){w=f[e+4>>2]|0;if(w>>>0>>0)F=w;else F=(w>>>0)%(c>>>0)|0;if((F|0)==(k|0)){p=e;break c}w=(f[a>>2]|0)+(F<<2)|0;if(!(f[w>>2]|0)){r=e;s=F;t=w;break b}w=e+8|0;v=w+1|0;u=w+2|0;x=w+3|0;q=f[e>>2]|0;e:do if(!q)G=e;else{A=b[w>>0]|0;B=e;z=q;while(1){D=z+8|0;if(A<<24>>24!=(b[D>>0]|0)){G=B;break e}if((b[v>>0]|0)!=(b[D+1>>0]|0)){G=B;break e}if((b[u>>0]|0)!=(b[D+2>>0]|0)){G=B;break e}if((b[x>>0]|0)!=(b[D+3>>0]|0)){G=B;break e}D=f[z>>2]|0;if(!D){G=z;break}else{C=z;z=D;B=C}}}while(0);f[j>>2]=f[G>>2];f[G>>2]=f[f[(f[a>>2]|0)+(F<<2)>>2]>>2];f[f[(f[a>>2]|0)+(F<<2)>>2]>>2]=e;e=f[g>>2]|0;if(!e){E=43;break a}}}while(0);d=f[p>>2]|0;if(!d){E=43;break a}else{g=p;j=p}}f[t>>2]=j;m=f[r>>2]|0;if(!m){E=43;break}else{k=s;l=r;n=r}}if((E|0)==43)return}function td(a,c,d,e,g){a=a|0;c=c|0;d=d|0;e=e|0;g=g|0;var i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,J=0,K=0,L=0,M=0,N=0;i=u;u=u+352|0;j=i+340|0;k=i+336|0;l=i+80|0;m=i+48|0;n=i;sj(l|0,0,256)|0;o=f[e+4>>2]|0;p=f[e>>2]|0;q=p;if((o|0)!=(p|0)){r=o-p>>2;p=0;do{o=l+(f[q+(p<<2)>>2]<<3)|0;s=o;t=Vn(f[s>>2]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H>>2]|0;do{L=K>>>3;M=K&7;N=(f[G>>2]|0)+L|0;b[N>>0]=(1<>0]|0);N=(f[G>>2]|0)+L|0;b[N>>0]=(F>>>J&1)<>0]|0);K=(f[H>>2]|0)+1|0;f[H>>2]=K;J=J+1|0}while((J|0)!=(E|0))}A=A+1|0}while((A|0)!=(d|0))}v=v-d|0}while((v|0)>-1)}_f(n,g);eg(m);v=f[m>>2]|0;d=m+4|0;o=g+16|0;r=f[o+4>>2]|0;if(!((r|0)>0|(r|0)==0&(f[o>>2]|0)>>>0>0)){o=(f[d>>2]|0)-v|0;f[k>>2]=f[l>>2];f[j>>2]=f[k>>2];Me(g,j,v,v+o|0)|0}o=f[n>>2]|0;if(o|0){v=n+4|0;n=f[v>>2]|0;if((n|0)!=(o|0))f[v>>2]=n+(~((n+-8-o|0)>>>3)<<3);Oq(o)}o=m+12|0;n=f[o>>2]|0;f[o>>2]=0;if(n|0)Oq(n);n=f[m>>2]|0;if(!n){u=i;return 1}if((f[d>>2]|0)!=(n|0))f[d>>2]=n;Oq(n);u=i;return 1}function ud(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0;c=a+4|0;if(!b){d=f[a>>2]|0;f[a>>2]=0;if(d|0)Oq(d);f[c>>2]=0;return}if(b>>>0>1073741823){d=ra(8)|0;Oo(d,16035);f[d>>2]=7256;va(d|0,1112,110)}d=ln(b<<2)|0;e=f[a>>2]|0;f[a>>2]=d;if(e|0)Oq(e);f[c>>2]=b;c=0;do{f[(f[a>>2]|0)+(c<<2)>>2]=0;c=c+1|0}while((c|0)!=(b|0));c=a+8|0;e=f[c>>2]|0;if(!e)return;d=f[e+4>>2]|0;g=b+-1|0;h=(g&b|0)==0;if(!h)if(d>>>0>>0)i=d;else i=(d>>>0)%(b>>>0)|0;else i=d&g;f[(f[a>>2]|0)+(i<<2)>>2]=c;c=f[e>>2]|0;if(!c)return;else{j=i;k=e;l=c;m=e}a:while(1){e=k;c=l;i=m;b:while(1){c:do if(h){d=c;while(1){n=f[d+4>>2]&g;if((n|0)==(j|0)){o=d;break c}p=(f[a>>2]|0)+(n<<2)|0;if(!(f[p>>2]|0)){q=d;r=n;s=p;break b}p=d+12|0;t=d+16|0;u=d+20|0;v=f[d>>2]|0;d:do if(!v)w=d;else{x=f[d+8>>2]|0;y=d;z=v;while(1){if((x|0)!=(f[z+8>>2]|0)){w=y;break d}if((f[p>>2]|0)!=(f[z+12>>2]|0)){w=y;break d}if((f[t>>2]|0)!=(f[z+16>>2]|0)){w=y;break d}if((f[u>>2]|0)!=(f[z+20>>2]|0)){w=y;break d}A=f[z>>2]|0;if(!A){w=z;break}else{B=z;z=A;y=B}}}while(0);f[i>>2]=f[w>>2];f[w>>2]=f[f[(f[a>>2]|0)+(n<<2)>>2]>>2];f[f[(f[a>>2]|0)+(n<<2)>>2]>>2]=d;d=f[e>>2]|0;if(!d){C=43;break a}}}else{d=c;while(1){u=f[d+4>>2]|0;if(u>>>0>>0)D=u;else D=(u>>>0)%(b>>>0)|0;if((D|0)==(j|0)){o=d;break c}u=(f[a>>2]|0)+(D<<2)|0;if(!(f[u>>2]|0)){q=d;r=D;s=u;break b}u=d+12|0;t=d+16|0;p=d+20|0;v=f[d>>2]|0;e:do if(!v)E=d;else{y=f[d+8>>2]|0;z=d;x=v;while(1){if((y|0)!=(f[x+8>>2]|0)){E=z;break e}if((f[u>>2]|0)!=(f[x+12>>2]|0)){E=z;break e}if((f[t>>2]|0)!=(f[x+16>>2]|0)){E=z;break e}if((f[p>>2]|0)!=(f[x+20>>2]|0)){E=z;break e}B=f[x>>2]|0;if(!B){E=x;break}else{A=x;x=B;z=A}}}while(0);f[i>>2]=f[E>>2];f[E>>2]=f[f[(f[a>>2]|0)+(D<<2)>>2]>>2];f[f[(f[a>>2]|0)+(D<<2)>>2]>>2]=d;d=f[e>>2]|0;if(!d){C=43;break a}}}while(0);c=f[o>>2]|0;if(!c){C=43;break a}else{e=o;i=o}}f[s>>2]=i;l=f[q>>2]|0;if(!l){C=43;break}else{j=r;k=q;m=q}}if((C|0)==43)return}function vd(a,b){a=a|0;b=b|0;var c=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0;c=a+4|0;if(!b){e=f[a>>2]|0;f[a>>2]=0;if(e|0)Oq(e);f[c>>2]=0;return}if(b>>>0>1073741823){e=ra(8)|0;Oo(e,16035);f[e>>2]=7256;va(e|0,1112,110)}e=ln(b<<2)|0;g=f[a>>2]|0;f[a>>2]=e;if(g|0)Oq(g);f[c>>2]=b;c=0;do{f[(f[a>>2]|0)+(c<<2)>>2]=0;c=c+1|0}while((c|0)!=(b|0));c=a+8|0;g=f[c>>2]|0;if(!g)return;e=f[g+4>>2]|0;h=b+-1|0;i=(h&b|0)==0;if(!i)if(e>>>0>>0)j=e;else j=(e>>>0)%(b>>>0)|0;else j=e&h;f[(f[a>>2]|0)+(j<<2)>>2]=c;c=f[g>>2]|0;if(!c)return;else{k=j;l=g;m=c;n=g}a:while(1){g=l;c=m;j=n;b:while(1){c:do if(i){e=c;while(1){o=f[e+4>>2]&h;if((o|0)==(k|0)){p=e;break c}q=(f[a>>2]|0)+(o<<2)|0;if(!(f[q>>2]|0)){r=e;s=o;t=q;break b}q=e+8|0;u=e+12|0;v=f[e>>2]|0;d:do if(!v)w=e;else{x=d[q>>1]|0;y=q+2|0;z=e;A=v;while(1){B=A+8|0;if(x<<16>>16!=(d[B>>1]|0)){w=z;break d}if((d[y>>1]|0)!=(d[B+2>>1]|0)){w=z;break d}if((d[u>>1]|0)!=(d[A+12>>1]|0)){w=z;break d}B=f[A>>2]|0;if(!B){w=A;break}else{C=A;A=B;z=C}}}while(0);f[j>>2]=f[w>>2];f[w>>2]=f[f[(f[a>>2]|0)+(o<<2)>>2]>>2];f[f[(f[a>>2]|0)+(o<<2)>>2]>>2]=e;e=f[g>>2]|0;if(!e){D=41;break a}}}else{e=c;while(1){u=f[e+4>>2]|0;if(u>>>0>>0)E=u;else E=(u>>>0)%(b>>>0)|0;if((E|0)==(k|0)){p=e;break c}u=(f[a>>2]|0)+(E<<2)|0;if(!(f[u>>2]|0)){r=e;s=E;t=u;break b}u=e+8|0;v=e+12|0;q=f[e>>2]|0;e:do if(!q)F=e;else{z=d[u>>1]|0;A=u+2|0;y=e;x=q;while(1){C=x+8|0;if(z<<16>>16!=(d[C>>1]|0)){F=y;break e}if((d[A>>1]|0)!=(d[C+2>>1]|0)){F=y;break e}if((d[v>>1]|0)!=(d[x+12>>1]|0)){F=y;break e}C=f[x>>2]|0;if(!C){F=x;break}else{B=x;x=C;y=B}}}while(0);f[j>>2]=f[F>>2];f[F>>2]=f[f[(f[a>>2]|0)+(E<<2)>>2]>>2];f[f[(f[a>>2]|0)+(E<<2)>>2]>>2]=e;e=f[g>>2]|0;if(!e){D=41;break a}}}while(0);c=f[p>>2]|0;if(!c){D=41;break a}else{g=p;j=p}}f[t>>2]=j;m=f[r>>2]|0;if(!m){D=41;break}else{k=s;l=r;n=r}}if((D|0)==41)return}function wd(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0;d=a+4|0;if(!c){e=f[a>>2]|0;f[a>>2]=0;if(e|0)Oq(e);f[d>>2]=0;return}if(c>>>0>1073741823){e=ra(8)|0;Oo(e,16035);f[e>>2]=7256;va(e|0,1112,110)}e=ln(c<<2)|0;g=f[a>>2]|0;f[a>>2]=e;if(g|0)Oq(g);f[d>>2]=c;d=0;do{f[(f[a>>2]|0)+(d<<2)>>2]=0;d=d+1|0}while((d|0)!=(c|0));d=a+8|0;g=f[d>>2]|0;if(!g)return;e=f[g+4>>2]|0;h=c+-1|0;i=(h&c|0)==0;if(!i)if(e>>>0>>0)j=e;else j=(e>>>0)%(c>>>0)|0;else j=e&h;f[(f[a>>2]|0)+(j<<2)>>2]=d;d=f[g>>2]|0;if(!d)return;else{k=j;l=g;m=d;n=g}a:while(1){g=l;d=m;j=n;b:while(1){c:do if(i){e=d;while(1){o=f[e+4>>2]&h;if((o|0)==(k|0)){p=e;break c}q=(f[a>>2]|0)+(o<<2)|0;if(!(f[q>>2]|0)){r=e;s=o;t=q;break b}q=e+8|0;u=q+1|0;v=q+2|0;w=f[e>>2]|0;d:do if(!w)x=e;else{y=b[q>>0]|0;z=e;A=w;while(1){B=A+8|0;if(y<<24>>24!=(b[B>>0]|0)){x=z;break d}if((b[u>>0]|0)!=(b[B+1>>0]|0)){x=z;break d}if((b[v>>0]|0)!=(b[B+2>>0]|0)){x=z;break d}B=f[A>>2]|0;if(!B){x=A;break}else{C=A;A=B;z=C}}}while(0);f[j>>2]=f[x>>2];f[x>>2]=f[f[(f[a>>2]|0)+(o<<2)>>2]>>2];f[f[(f[a>>2]|0)+(o<<2)>>2]>>2]=e;e=f[g>>2]|0;if(!e){D=41;break a}}}else{e=d;while(1){v=f[e+4>>2]|0;if(v>>>0>>0)E=v;else E=(v>>>0)%(c>>>0)|0;if((E|0)==(k|0)){p=e;break c}v=(f[a>>2]|0)+(E<<2)|0;if(!(f[v>>2]|0)){r=e;s=E;t=v;break b}v=e+8|0;u=v+1|0;w=v+2|0;q=f[e>>2]|0;e:do if(!q)F=e;else{z=b[v>>0]|0;A=e;y=q;while(1){C=y+8|0;if(z<<24>>24!=(b[C>>0]|0)){F=A;break e}if((b[u>>0]|0)!=(b[C+1>>0]|0)){F=A;break e}if((b[w>>0]|0)!=(b[C+2>>0]|0)){F=A;break e}C=f[y>>2]|0;if(!C){F=y;break}else{B=y;y=C;A=B}}}while(0);f[j>>2]=f[F>>2];f[F>>2]=f[f[(f[a>>2]|0)+(E<<2)>>2]>>2];f[f[(f[a>>2]|0)+(E<<2)>>2]>>2]=e;e=f[g>>2]|0;if(!e){D=41;break a}}}while(0);d=f[p>>2]|0;if(!d){D=41;break a}else{g=p;j=p}}f[t>>2]=j;m=f[r>>2]|0;if(!m){D=41;break}else{k=s;l=r;n=r}}if((D|0)==41)return}function xd(a,b){a=+a;b=+b;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,q=0,r=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0.0,V=0,W=0,X=0,Y=0,Z=0,_=0,$=0,aa=0,ba=0.0;p[s>>3]=a;c=f[s>>2]|0;d=f[s+4>>2]|0;p[s>>3]=b;e=f[s>>2]|0;g=f[s+4>>2]|0;h=Yn(c|0,d|0,52)|0;i=h&2047;h=Yn(e|0,g|0,52)|0;j=h&2047;h=d&-2147483648;k=Tn(e|0,g|0,1)|0;l=I;a:do if(!((k|0)==0&(l|0)==0)?(m=yo(b)|0,n=I&2147483647,!((i|0)==2047|(n>>>0>2146435072|(n|0)==2146435072&m>>>0>0))):0){m=Tn(c|0,d|0,1)|0;n=I;if(!(n>>>0>l>>>0|(n|0)==(l|0)&m>>>0>k>>>0))return +((m|0)==(k|0)&(n|0)==(l|0)?a*0.0:a);if(!i){n=Tn(c|0,d|0,12)|0;m=I;if((m|0)>-1|(m|0)==-1&n>>>0>4294967295){o=0;q=n;n=m;while(1){m=o+-1|0;q=Tn(q|0,n|0,1)|0;n=I;if(!((n|0)>-1|(n|0)==-1&q>>>0>4294967295)){r=m;break}else o=m}}else r=0;o=Tn(c|0,d|0,1-r|0)|0;t=r;u=o;v=I}else{t=i;u=c;v=d&1048575|1048576}if(!j){o=Tn(e|0,g|0,12)|0;q=I;if((q|0)>-1|(q|0)==-1&o>>>0>4294967295){n=0;m=o;o=q;while(1){q=n+-1|0;m=Tn(m|0,o|0,1)|0;o=I;if(!((o|0)>-1|(o|0)==-1&m>>>0>4294967295)){w=q;break}else n=q}}else w=0;n=Tn(e|0,g|0,1-w|0)|0;x=w;y=n;z=I}else{x=j;y=e;z=g&1048575|1048576}n=Xn(u|0,v|0,y|0,z|0)|0;m=I;o=(m|0)>-1|(m|0)==-1&n>>>0>4294967295;b:do if((t|0)>(x|0)){q=t;A=m;B=o;C=u;D=v;E=n;while(1){if(B)if((E|0)==0&(A|0)==0)break;else{F=E;G=A}else{F=C;G=D}H=Tn(F|0,G|0,1)|0;J=I;K=q+-1|0;L=Xn(H|0,J|0,y|0,z|0)|0;M=I;N=(M|0)>-1|(M|0)==-1&L>>>0>4294967295;if((K|0)>(x|0)){q=K;A=M;B=N;C=H;D=J;E=L}else{O=K;P=N;Q=L;R=M;S=H;T=J;break b}}U=a*0.0;break a}else{O=t;P=o;Q=n;R=m;S=u;T=v}while(0);if(P)if((Q|0)==0&(R|0)==0){U=a*0.0;break}else{V=R;W=Q}else{V=T;W=S}if(V>>>0<1048576|(V|0)==1048576&W>>>0<0){m=O;n=W;o=V;while(1){E=Tn(n|0,o|0,1)|0;D=I;C=m+-1|0;if(D>>>0<1048576|(D|0)==1048576&E>>>0<0){m=C;n=E;o=D}else{X=C;Y=E;Z=D;break}}}else{X=O;Y=W;Z=V}if((X|0)>0){o=Vn(Y|0,Z|0,0,-1048576)|0;n=I;m=Tn(X|0,0,52)|0;_=n|I;$=o|m}else{m=Yn(Y|0,Z|0,1-X|0)|0;_=I;$=m}f[s>>2]=$;f[s+4>>2]=_|h;U=+p[s>>3]}else aa=3;while(0);if((aa|0)==3){ba=a*b;U=ba/ba}return +U}function yd(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0;d=u;u=u+32|0;e=d+8|0;g=d;h=c+4|0;i=f[(f[h>>2]|0)+48>>2]|0;j=c+12|0;c=f[j>>2]|0;k=ln(32)|0;f[e>>2]=k;f[e+8>>2]=-2147483616;f[e+4>>2]=17;l=k;m=14495;n=l+17|0;do{b[l>>0]=b[m>>0]|0;l=l+1|0;m=m+1|0}while((l|0)<(n|0));b[k+17>>0]=0;k=i+16|0;m=f[k>>2]|0;if(m){l=k;n=m;a:while(1){m=n;while(1){if((f[m+16>>2]|0)>=(c|0))break;o=f[m+4>>2]|0;if(!o){p=l;break a}else m=o}n=f[m>>2]|0;if(!n){p=m;break}else l=m}if(((p|0)!=(k|0)?(c|0)>=(f[p+16>>2]|0):0)?(c=p+20|0,(Jh(c,e)|0)!=0):0)q=Hk(c,e,-1)|0;else r=10}else r=10;if((r|0)==10)q=Hk(i,e,-1)|0;if((b[e+11>>0]|0)<0)Oq(f[e>>2]|0);f[e>>2]=-1;f[e+4>>2]=-1;f[e+8>>2]=-1;f[e+12>>2]=-1;i=(_((1<>>0<=28){f[e>>2]=i+1;q=2<>2]=q+-1;i=q+-2|0;f[e+8>>2]=i;f[e+12>>2]=(i|0)/2|0}switch(Xi(f[j>>2]|0,f[h>>2]|0)|0){case 6:{i=f[j>>2]|0;q=f[h>>2]|0;c=f[(f[(f[q+4>>2]|0)+8>>2]|0)+(i<<2)>>2]|0;do if((Qa[f[(f[q>>2]|0)+8>>2]&127](q)|0)==1){Hf(g,q,6,i,e,514);p=f[g>>2]|0;if(!p){f[g>>2]=0;s=g;r=21;break}else{t=g;v=p;break}}else{s=g;r=21}while(0);if((r|0)==21){i=ln(24)|0;f[i+4>>2]=c;c=i+8|0;f[c>>2]=f[e>>2];f[c+4>>2]=f[e+4>>2];f[c+8>>2]=f[e+8>>2];f[c+12>>2]=f[e+12>>2];f[i>>2]=2560;c=i;f[g>>2]=c;t=s;v=c}f[a>>2]=v;f[t>>2]=0;u=d;return}case 0:{t=f[j>>2]|0;j=f[h>>2]|0;h=f[(f[(f[j+4>>2]|0)+8>>2]|0)+(t<<2)>>2]|0;do if((Qa[f[(f[j>>2]|0)+8>>2]&127](j)|0)==1){Hf(g,j,0,t,e,514);v=f[g>>2]|0;if(!v){f[g>>2]=0;w=g;r=28;break}else{x=g;y=v;break}}else{w=g;r=28}while(0);if((r|0)==28){r=ln(24)|0;f[r+4>>2]=h;h=r+8|0;f[h>>2]=f[e>>2];f[h+4>>2]=f[e+4>>2];f[h+8>>2]=f[e+8>>2];f[h+12>>2]=f[e+12>>2];f[r>>2]=2560;e=r;f[g>>2]=e;x=w;y=e}f[a>>2]=y;f[x>>2]=0;u=d;return}default:{f[a>>2]=0;u=d;return}}}function zd(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0;c=a+4|0;if(!b){d=f[a>>2]|0;f[a>>2]=0;if(d|0)Oq(d);f[c>>2]=0;return}if(b>>>0>1073741823){d=ra(8)|0;Oo(d,16035);f[d>>2]=7256;va(d|0,1112,110)}d=ln(b<<2)|0;e=f[a>>2]|0;f[a>>2]=d;if(e|0)Oq(e);f[c>>2]=b;c=0;do{f[(f[a>>2]|0)+(c<<2)>>2]=0;c=c+1|0}while((c|0)!=(b|0));c=a+8|0;e=f[c>>2]|0;if(!e)return;d=f[e+4>>2]|0;g=b+-1|0;h=(g&b|0)==0;if(!h)if(d>>>0>>0)i=d;else i=(d>>>0)%(b>>>0)|0;else i=d&g;f[(f[a>>2]|0)+(i<<2)>>2]=c;c=f[e>>2]|0;if(!c)return;else{j=i;k=e;l=c;m=e}a:while(1){e=k;c=l;i=m;b:while(1){c:do if(h){d=c;while(1){n=f[d+4>>2]&g;if((n|0)==(j|0)){o=d;break c}p=(f[a>>2]|0)+(n<<2)|0;if(!(f[p>>2]|0)){q=d;r=n;s=p;break b}p=d+12|0;t=d+16|0;u=f[d>>2]|0;d:do if(!u)v=d;else{w=f[d+8>>2]|0;x=d;y=u;while(1){if((w|0)!=(f[y+8>>2]|0)){v=x;break d}if((f[p>>2]|0)!=(f[y+12>>2]|0)){v=x;break d}if((f[t>>2]|0)!=(f[y+16>>2]|0)){v=x;break d}z=f[y>>2]|0;if(!z){v=y;break}else{A=y;y=z;x=A}}}while(0);f[i>>2]=f[v>>2];f[v>>2]=f[f[(f[a>>2]|0)+(n<<2)>>2]>>2];f[f[(f[a>>2]|0)+(n<<2)>>2]>>2]=d;d=f[e>>2]|0;if(!d){B=41;break a}}}else{d=c;while(1){t=f[d+4>>2]|0;if(t>>>0>>0)C=t;else C=(t>>>0)%(b>>>0)|0;if((C|0)==(j|0)){o=d;break c}t=(f[a>>2]|0)+(C<<2)|0;if(!(f[t>>2]|0)){q=d;r=C;s=t;break b}t=d+12|0;p=d+16|0;u=f[d>>2]|0;e:do if(!u)D=d;else{x=f[d+8>>2]|0;y=d;w=u;while(1){if((x|0)!=(f[w+8>>2]|0)){D=y;break e}if((f[t>>2]|0)!=(f[w+12>>2]|0)){D=y;break e}if((f[p>>2]|0)!=(f[w+16>>2]|0)){D=y;break e}A=f[w>>2]|0;if(!A){D=w;break}else{z=w;w=A;y=z}}}while(0);f[i>>2]=f[D>>2];f[D>>2]=f[f[(f[a>>2]|0)+(C<<2)>>2]>>2];f[f[(f[a>>2]|0)+(C<<2)>>2]>>2]=d;d=f[e>>2]|0;if(!d){B=41;break a}}}while(0);c=f[o>>2]|0;if(!c){B=41;break a}else{e=o;i=o}}f[s>>2]=i;l=f[q>>2]|0;if(!l){B=41;break}else{j=r;k=q;m=q}}if((B|0)==41)return}function Ad(a,b,c,d,e,g,h){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;g=g|0;h=h|0;var i=0,j=0;switch(c|0){case 1:{c=ln(40)|0;f[c+4>>2]=d;h=c+8|0;f[h>>2]=f[e>>2];f[h+4>>2]=f[e+4>>2];f[h+8>>2]=f[e+8>>2];f[h+12>>2]=f[e+12>>2];h=c+24|0;f[h>>2]=f[g>>2];f[h+4>>2]=f[g+4>>2];f[h+8>>2]=f[g+8>>2];f[h+12>>2]=f[g+12>>2];f[c>>2]=2980;i=c;f[a>>2]=i;return}case 2:{c=ln(40)|0;f[c+4>>2]=d;h=c+8|0;f[h>>2]=f[e>>2];f[h+4>>2]=f[e+4>>2];f[h+8>>2]=f[e+8>>2];f[h+12>>2]=f[e+12>>2];h=c+24|0;f[h>>2]=f[g>>2];f[h+4>>2]=f[g+4>>2];f[h+8>>2]=f[g+8>>2];f[h+12>>2]=f[g+12>>2];f[c>>2]=3036;i=c;f[a>>2]=i;return}case 4:{c=ln(152)|0;f[c+4>>2]=d;h=c+8|0;f[h>>2]=f[e>>2];f[h+4>>2]=f[e+4>>2];f[h+8>>2]=f[e+8>>2];f[h+12>>2]=f[e+12>>2];h=c+24|0;f[h>>2]=f[g>>2];f[h+4>>2]=f[g+4>>2];f[h+8>>2]=f[g+8>>2];f[h+12>>2]=f[g+12>>2];f[c>>2]=3092;h=c+96|0;b=c+40|0;j=b+52|0;do{f[b>>2]=0;b=b+4|0}while((b|0)<(j|0));Zm(h);f[c+136>>2]=0;f[c+140>>2]=0;f[c+144>>2]=0;i=c;f[a>>2]=i;return}case 3:{c=ln(68)|0;f[c+4>>2]=d;h=c+8|0;f[h>>2]=f[e>>2];f[h+4>>2]=f[e+4>>2];f[h+8>>2]=f[e+8>>2];f[h+12>>2]=f[e+12>>2];h=c+24|0;f[h>>2]=f[g>>2];f[h+4>>2]=f[g+4>>2];f[h+8>>2]=f[g+8>>2];f[h+12>>2]=f[g+12>>2];f[c>>2]=3148;h=c+40|0;f[h>>2]=0;f[h+4>>2]=0;f[h+8>>2]=0;f[h+12>>2]=0;f[h+16>>2]=0;f[h+20>>2]=0;f[h+24>>2]=0;i=c;f[a>>2]=i;return}case 5:{c=ln(84)|0;f[c+4>>2]=d;h=c+8|0;f[h>>2]=f[e>>2];f[h+4>>2]=f[e+4>>2];f[h+8>>2]=f[e+8>>2];f[h+12>>2]=f[e+12>>2];h=c+24|0;f[h>>2]=f[g>>2];f[h+4>>2]=f[g+4>>2];f[h+8>>2]=f[g+8>>2];f[h+12>>2]=f[g+12>>2];f[c>>2]=3204;f[c+40>>2]=0;f[c+44>>2]=0;f[c+56>>2]=0;f[c+60>>2]=0;f[c+64>>2]=0;h=c+68|0;f[h>>2]=f[g>>2];f[h+4>>2]=f[g+4>>2];f[h+8>>2]=f[g+8>>2];f[h+12>>2]=f[g+12>>2];i=c;f[a>>2]=i;return}case 6:{c=ln(120)|0;f[c+4>>2]=d;d=c+8|0;f[d>>2]=f[e>>2];f[d+4>>2]=f[e+4>>2];f[d+8>>2]=f[e+8>>2];f[d+12>>2]=f[e+12>>2];e=c+24|0;f[e>>2]=f[g>>2];f[e+4>>2]=f[g+4>>2];f[e+8>>2]=f[g+8>>2];f[e+12>>2]=f[g+12>>2];f[c>>2]=3260;f[c+44>>2]=0;f[c+48>>2]=0;e=c+52|0;f[e>>2]=f[g>>2];f[e+4>>2]=f[g+4>>2];f[e+8>>2]=f[g+8>>2];f[e+12>>2]=f[g+12>>2];f[c+40>>2]=3316;f[c+68>>2]=1;g=c+72|0;f[g>>2]=-1;f[g+4>>2]=-1;f[g+8>>2]=-1;f[g+12>>2]=-1;wn(c+88|0);i=c;f[a>>2]=i;return}default:{i=0;f[a>>2]=i;return}}}function Bd(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0;d=a+4|0;if(!c){e=f[a>>2]|0;f[a>>2]=0;if(e|0)Oq(e);f[d>>2]=0;return}if(c>>>0>1073741823){e=ra(8)|0;Oo(e,16035);f[e>>2]=7256;va(e|0,1112,110)}e=ln(c<<2)|0;g=f[a>>2]|0;f[a>>2]=e;if(g|0)Oq(g);f[d>>2]=c;d=0;do{f[(f[a>>2]|0)+(d<<2)>>2]=0;d=d+1|0}while((d|0)!=(c|0));d=a+8|0;g=f[d>>2]|0;if(!g)return;e=f[g+4>>2]|0;h=c+-1|0;i=(h&c|0)==0;if(!i)if(e>>>0>>0)j=e;else j=(e>>>0)%(c>>>0)|0;else j=e&h;f[(f[a>>2]|0)+(j<<2)>>2]=d;d=f[g>>2]|0;if(!d)return;else{k=j;l=g;m=d;n=g}a:while(1){g=l;d=m;j=n;b:while(1){o=d;while(1){e=f[o+4>>2]|0;if(!i)if(e>>>0>>0)p=e;else p=(e>>>0)%(c>>>0)|0;else p=e&h;if((p|0)==(k|0))break;q=(f[a>>2]|0)+(p<<2)|0;if(!(f[q>>2]|0))break b;e=f[o>>2]|0;c:do if(!e)r=o;else{s=o+8|0;t=b[s+11>>0]|0;u=t<<24>>24<0;v=t&255;t=u?f[o+12>>2]|0:v;w=(t|0)==0;if(u){u=o;x=e;while(1){y=x+8|0;z=b[y+11>>0]|0;A=z<<24>>24<0;if((t|0)!=((A?f[x+12>>2]|0:z&255)|0)){r=u;break c}if(!w?Vk(f[s>>2]|0,A?f[y>>2]|0:y,t)|0:0){r=u;break c}y=f[x>>2]|0;if(!y){r=x;break c}else{A=x;x=y;u=A}}}if(w){u=o;x=e;while(1){A=b[x+8+11>>0]|0;if((A<<24>>24<0?f[x+12>>2]|0:A&255)|0){r=u;break c}A=f[x>>2]|0;if(!A){r=x;break c}else{y=x;x=A;u=y}}}u=o;x=e;while(1){w=x+8|0;y=b[w+11>>0]|0;A=y<<24>>24<0;if((t|0)!=((A?f[x+12>>2]|0:y&255)|0)){r=u;break c}y=A?f[w>>2]|0:w;if((b[y>>0]|0)==(f[s>>2]&255)<<24>>24){B=s;C=v;D=y}else{r=u;break c}while(1){C=C+-1|0;B=B+1|0;if(!C)break;D=D+1|0;if((b[B>>0]|0)!=(b[D>>0]|0)){r=u;break c}}y=f[x>>2]|0;if(!y){r=x;break}else{w=x;x=y;u=w}}}while(0);f[j>>2]=f[r>>2];f[r>>2]=f[f[(f[a>>2]|0)+(p<<2)>>2]>>2];f[f[(f[a>>2]|0)+(p<<2)>>2]>>2]=o;e=f[g>>2]|0;if(!e){E=43;break a}else o=e}d=f[o>>2]|0;if(!d){E=43;break a}else{g=o;j=o}}f[q>>2]=j;m=f[o>>2]|0;if(!m){E=43;break}else{k=p;l=o;n=o}}if((E|0)==43)return}function Cd(a,b,c,d,e,g,h){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;g=g|0;h=h|0;var i=0,j=0;switch(c|0){case 1:{c=ln(40)|0;f[c+4>>2]=d;h=c+8|0;f[h>>2]=f[e>>2];f[h+4>>2]=f[e+4>>2];f[h+8>>2]=f[e+8>>2];f[h+12>>2]=f[e+12>>2];h=c+24|0;f[h>>2]=f[g>>2];f[h+4>>2]=f[g+4>>2];f[h+8>>2]=f[g+8>>2];f[h+12>>2]=f[g+12>>2];f[c>>2]=2616;i=c;f[a>>2]=i;return}case 2:{c=ln(40)|0;f[c+4>>2]=d;h=c+8|0;f[h>>2]=f[e>>2];f[h+4>>2]=f[e+4>>2];f[h+8>>2]=f[e+8>>2];f[h+12>>2]=f[e+12>>2];h=c+24|0;f[h>>2]=f[g>>2];f[h+4>>2]=f[g+4>>2];f[h+8>>2]=f[g+8>>2];f[h+12>>2]=f[g+12>>2];f[c>>2]=2672;i=c;f[a>>2]=i;return}case 4:{c=ln(152)|0;f[c+4>>2]=d;h=c+8|0;f[h>>2]=f[e>>2];f[h+4>>2]=f[e+4>>2];f[h+8>>2]=f[e+8>>2];f[h+12>>2]=f[e+12>>2];h=c+24|0;f[h>>2]=f[g>>2];f[h+4>>2]=f[g+4>>2];f[h+8>>2]=f[g+8>>2];f[h+12>>2]=f[g+12>>2];f[c>>2]=2728;h=c+96|0;b=c+40|0;j=b+52|0;do{f[b>>2]=0;b=b+4|0}while((b|0)<(j|0));Zm(h);f[c+136>>2]=0;f[c+140>>2]=0;f[c+144>>2]=0;i=c;f[a>>2]=i;return}case 3:{c=ln(68)|0;f[c+4>>2]=d;h=c+8|0;f[h>>2]=f[e>>2];f[h+4>>2]=f[e+4>>2];f[h+8>>2]=f[e+8>>2];f[h+12>>2]=f[e+12>>2];h=c+24|0;f[h>>2]=f[g>>2];f[h+4>>2]=f[g+4>>2];f[h+8>>2]=f[g+8>>2];f[h+12>>2]=f[g+12>>2];f[c>>2]=2784;h=c+40|0;f[h>>2]=0;f[h+4>>2]=0;f[h+8>>2]=0;f[h+12>>2]=0;f[h+16>>2]=0;f[h+20>>2]=0;f[h+24>>2]=0;i=c;f[a>>2]=i;return}case 5:{c=ln(84)|0;f[c+4>>2]=d;h=c+8|0;f[h>>2]=f[e>>2];f[h+4>>2]=f[e+4>>2];f[h+8>>2]=f[e+8>>2];f[h+12>>2]=f[e+12>>2];h=c+24|0;f[h>>2]=f[g>>2];f[h+4>>2]=f[g+4>>2];f[h+8>>2]=f[g+8>>2];f[h+12>>2]=f[g+12>>2];f[c>>2]=2840;f[c+40>>2]=0;f[c+44>>2]=0;f[c+56>>2]=0;f[c+60>>2]=0;f[c+64>>2]=0;h=c+68|0;f[h>>2]=f[g>>2];f[h+4>>2]=f[g+4>>2];f[h+8>>2]=f[g+8>>2];f[h+12>>2]=f[g+12>>2];i=c;f[a>>2]=i;return}case 6:{c=ln(120)|0;f[c+4>>2]=d;d=c+8|0;f[d>>2]=f[e>>2];f[d+4>>2]=f[e+4>>2];f[d+8>>2]=f[e+8>>2];f[d+12>>2]=f[e+12>>2];e=c+24|0;f[e>>2]=f[g>>2];f[e+4>>2]=f[g+4>>2];f[e+8>>2]=f[g+8>>2];f[e+12>>2]=f[g+12>>2];f[c>>2]=2896;f[c+44>>2]=0;f[c+48>>2]=0;e=c+52|0;f[e>>2]=f[g>>2];f[e+4>>2]=f[g+4>>2];f[e+8>>2]=f[g+8>>2];f[e+12>>2]=f[g+12>>2];f[c+40>>2]=2952;f[c+68>>2]=1;g=c+72|0;f[g>>2]=-1;f[g+4>>2]=-1;f[g+8>>2]=-1;f[g+12>>2]=-1;wn(c+88|0);i=c;f[a>>2]=i;return}default:{i=0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,16035);f[e>>2]=7256;va(e|0,1112,110)}e=ln(b<<2)|0;g=f[a>>2]|0;f[a>>2]=e;if(g|0)Oq(g);f[c>>2]=b;c=0;do{f[(f[a>>2]|0)+(c<<2)>>2]=0;c=c+1|0}while((c|0)!=(b|0));c=a+8|0;g=f[c>>2]|0;if(!g)return;e=f[g+4>>2]|0;h=b+-1|0;i=(h&b|0)==0;if(!i)if(e>>>0>>0)j=e;else j=(e>>>0)%(b>>>0)|0;else j=e&h;f[(f[a>>2]|0)+(j<<2)>>2]=c;c=f[g>>2]|0;if(!c)return;else{k=j;l=g;m=c;n=g}a:while(1){g=l;c=m;j=n;b:while(1){c:do if(i){e=c;while(1){o=f[e+4>>2]&h;if((o|0)==(k|0)){p=e;break c}q=(f[a>>2]|0)+(o<<2)|0;if(!(f[q>>2]|0)){r=e;s=o;t=q;break b}q=e+8|0;u=f[e>>2]|0;d:do if(!u)v=e;else{w=d[q>>1]|0;x=q+2|0;y=e;z=u;while(1){A=z+8|0;if(w<<16>>16!=(d[A>>1]|0)){v=y;break d}if((d[x>>1]|0)!=(d[A+2>>1]|0)){v=y;break d}A=f[z>>2]|0;if(!A){v=z;break}else{B=z;z=A;y=B}}}while(0);f[j>>2]=f[v>>2];f[v>>2]=f[f[(f[a>>2]|0)+(o<<2)>>2]>>2];f[f[(f[a>>2]|0)+(o<<2)>>2]>>2]=e;e=f[g>>2]|0;if(!e){C=39;break a}}}else{e=c;while(1){u=f[e+4>>2]|0;if(u>>>0>>0)D=u;else D=(u>>>0)%(b>>>0)|0;if((D|0)==(k|0)){p=e;break c}u=(f[a>>2]|0)+(D<<2)|0;if(!(f[u>>2]|0)){r=e;s=D;t=u;break b}u=e+8|0;q=f[e>>2]|0;e:do if(!q)E=e;else{y=d[u>>1]|0;z=u+2|0;x=e;w=q;while(1){B=w+8|0;if(y<<16>>16!=(d[B>>1]|0)){E=x;break e}if((d[z>>1]|0)!=(d[B+2>>1]|0)){E=x;break e}B=f[w>>2]|0;if(!B){E=w;break}else{A=w;w=B;x=A}}}while(0);f[j>>2]=f[E>>2];f[E>>2]=f[f[(f[a>>2]|0)+(D<<2)>>2]>>2];f[f[(f[a>>2]|0)+(D<<2)>>2]>>2]=e;e=f[g>>2]|0;if(!e){C=39;break a}}}while(0);c=f[p>>2]|0;if(!c){C=39;break a}else{g=p;j=p}}f[t>>2]=j;m=f[r>>2]|0;if(!m){C=39;break}else{k=s;l=r;n=r}}if((C|0)==39)return}function Gd(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0;d=a+4|0;if(!c){e=f[a>>2]|0;f[a>>2]=0;if(e|0)Oq(e);f[d>>2]=0;return}if(c>>>0>1073741823){e=ra(8)|0;Oo(e,16035);f[e>>2]=7256;va(e|0,1112,110)}e=ln(c<<2)|0;g=f[a>>2]|0;f[a>>2]=e;if(g|0)Oq(g);f[d>>2]=c;d=0;do{f[(f[a>>2]|0)+(d<<2)>>2]=0;d=d+1|0}while((d|0)!=(c|0));d=a+8|0;g=f[d>>2]|0;if(!g)return;e=f[g+4>>2]|0;h=c+-1|0;i=(h&c|0)==0;if(!i)if(e>>>0>>0)j=e;else j=(e>>>0)%(c>>>0)|0;else j=e&h;f[(f[a>>2]|0)+(j<<2)>>2]=d;d=f[g>>2]|0;if(!d)return;else{k=j;l=g;m=d;n=g}a:while(1){g=l;d=m;j=n;b:while(1){c:do if(i){e=d;while(1){o=f[e+4>>2]&h;if((o|0)==(k|0)){p=e;break c}q=(f[a>>2]|0)+(o<<2)|0;if(!(f[q>>2]|0)){r=e;s=o;t=q;break b}q=e+8|0;u=f[e>>2]|0;d:do if(!u)v=e;else{w=b[q>>0]|0;x=q+1|0;y=e;z=u;while(1){A=z+8|0;if(w<<24>>24!=(b[A>>0]|0)){v=y;break d}if((b[x>>0]|0)!=(b[A+1>>0]|0)){v=y;break d}A=f[z>>2]|0;if(!A){v=z;break}else{B=z;z=A;y=B}}}while(0);f[j>>2]=f[v>>2];f[v>>2]=f[f[(f[a>>2]|0)+(o<<2)>>2]>>2];f[f[(f[a>>2]|0)+(o<<2)>>2]>>2]=e;e=f[g>>2]|0;if(!e){C=39;break a}}}else{e=d;while(1){u=f[e+4>>2]|0;if(u>>>0>>0)D=u;else D=(u>>>0)%(c>>>0)|0;if((D|0)==(k|0)){p=e;break c}u=(f[a>>2]|0)+(D<<2)|0;if(!(f[u>>2]|0)){r=e;s=D;t=u;break b}u=e+8|0;q=f[e>>2]|0;e:do if(!q)E=e;else{y=b[u>>0]|0;z=u+1|0;x=e;w=q;while(1){B=w+8|0;if(y<<24>>24!=(b[B>>0]|0)){E=x;break e}if((b[z>>0]|0)!=(b[B+1>>0]|0)){E=x;break e}B=f[w>>2]|0;if(!B){E=w;break}else{A=w;w=B;x=A}}}while(0);f[j>>2]=f[E>>2];f[E>>2]=f[f[(f[a>>2]|0)+(D<<2)>>2]>>2];f[f[(f[a>>2]|0)+(D<<2)>>2]>>2]=e;e=f[g>>2]|0;if(!e){C=39;break a}}}while(0);d=f[p>>2]|0;if(!d){C=39;break a}else{g=p;j=p}}f[t>>2]=j;m=f[r>>2]|0;if(!m){C=39;break}else{k=s;l=r;n=r}}if((C|0)==39)return}function Hd(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0;c=u;u=u+48|0;d=c+32|0;e=c+28|0;g=c+16|0;h=c;i=a+16|0;j=f[i>>2]|0;if(j|0){k=f[b>>2]|0;l=i;m=j;a:while(1){j=m;while(1){if((f[j+16>>2]|0)>=(k|0))break;n=f[j+4>>2]|0;if(!n){o=l;break a}else j=n}m=f[j>>2]|0;if(!m){o=j;break}else l=j}if((o|0)!=(i|0)?(k|0)>=(f[o+16>>2]|0):0){p=o;q=p+20|0;u=c;return q|0}}lp(g);f[h>>2]=f[b>>2];b=h+4|0;f[h+8>>2]=0;o=h+12|0;f[o>>2]=0;k=h+8|0;f[b>>2]=k;l=f[g>>2]|0;m=g+4|0;if((l|0)!=(m|0)){n=k;r=l;while(1){l=r+16|0;f[e>>2]=n;f[d>>2]=f[e>>2];ph(b,d,l,l)|0;l=f[r+4>>2]|0;if(!l){s=r+8|0;t=f[s>>2]|0;if((f[t>>2]|0)==(r|0))v=t;else{t=s;do{s=f[t>>2]|0;t=s+8|0;w=f[t>>2]|0}while((f[w>>2]|0)!=(s|0));v=w}}else{t=l;while(1){j=f[t>>2]|0;if(!j)break;else t=j}v=t}if((v|0)==(m|0))break;else r=v}}v=a+12|0;r=f[i>>2]|0;do if(r){d=f[h>>2]|0;e=a+16|0;n=r;while(1){l=f[n+16>>2]|0;if((d|0)<(l|0)){j=f[n>>2]|0;if(!j){x=23;break}else{y=n;z=j}}else{if((l|0)>=(d|0)){x=27;break}A=n+4|0;l=f[A>>2]|0;if(!l){x=26;break}else{y=A;z=l}}e=y;n=z}if((x|0)==23){B=n;C=n;break}else if((x|0)==26){B=n;C=A;break}else if((x|0)==27){B=n;C=e;break}}else{B=i;C=i}while(0);i=f[C>>2]|0;if(!i){x=ln(32)|0;f[x+16>>2]=f[h>>2];A=x+20|0;f[A>>2]=f[b>>2];z=x+24|0;y=f[h+8>>2]|0;f[z>>2]=y;r=f[o>>2]|0;f[x+28>>2]=r;if(!r)f[A>>2]=z;else{f[y+8>>2]=z;f[b>>2]=k;f[k>>2]=0;f[o>>2]=0}f[x>>2]=0;f[x+4>>2]=0;f[x+8>>2]=B;f[C>>2]=x;B=f[f[v>>2]>>2]|0;if(!B)D=x;else{f[v>>2]=B;D=f[C>>2]|0}Oe(f[a+16>>2]|0,D);D=a+20|0;f[D>>2]=(f[D>>2]|0)+1;E=x}else E=i;Ej(h+4|0,f[k>>2]|0);Ej(g,f[m>>2]|0);p=E;q=p+20|0;u=c;return q|0}function Id(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0;d=b[c+11>>0]|0;e=d<<24>>24<0;g=e?f[c>>2]|0:c;i=e?f[c+4>>2]|0:d&255;if(i>>>0>3){d=g;c=i;e=i;while(1){j=X(h[d>>0]|h[d+1>>0]<<8|h[d+2>>0]<<16|h[d+3>>0]<<24,1540483477)|0;c=(X(j>>>24^j,1540483477)|0)^(X(c,1540483477)|0);e=e+-4|0;if(e>>>0<=3)break;else d=d+4|0}d=i+-4|0;e=d&-4;k=d-e|0;l=g+(e+4)|0;m=c}else{k=i;l=g;m=i}switch(k|0){case 3:{n=h[l+2>>0]<<16^m;o=6;break}case 2:{n=m;o=6;break}case 1:{p=m;o=7;break}default:q=m}if((o|0)==6){p=h[l+1>>0]<<8^n;o=7}if((o|0)==7)q=X(p^h[l>>0],1540483477)|0;l=X(q>>>13^q,1540483477)|0;q=l>>>15^l;l=f[a+4>>2]|0;if(!l){r=0;return r|0}p=l+-1|0;n=(p&l|0)==0;if(!n)if(q>>>0>>0)s=q;else s=(q>>>0)%(l>>>0)|0;else s=q&p;m=f[(f[a>>2]|0)+(s<<2)>>2]|0;if(!m){r=0;return r|0}a=f[m>>2]|0;if(!a){r=0;return r|0}m=(i|0)==0;if(n){n=a;a:while(1){k=f[n+4>>2]|0;c=(k|0)==(q|0);if(!(c|(k&p|0)==(s|0))){r=0;o=40;break}do if(c?(k=n+8|0,e=b[k+11>>0]|0,d=e<<24>>24<0,j=e&255,((d?f[n+12>>2]|0:j)|0)==(i|0)):0){e=f[k>>2]|0;t=d?e:k;if(d){if(m){r=n;o=40;break a}if(!(Vk(t,g,i)|0)){r=n;o=40;break a}else break}if(m){r=n;o=40;break a}if((b[g>>0]|0)==(e&255)<<24>>24){e=k;k=j;j=g;do{k=k+-1|0;e=e+1|0;if(!k){r=n;o=40;break a}j=j+1|0}while((b[e>>0]|0)==(b[j>>0]|0))}}while(0);n=f[n>>2]|0;if(!n){r=0;o=40;break}}if((o|0)==40)return r|0}else u=a;b:while(1){a=f[u+4>>2]|0;do if((a|0)==(q|0)){n=u+8|0;p=b[n+11>>0]|0;c=p<<24>>24<0;j=p&255;if(((c?f[u+12>>2]|0:j)|0)==(i|0)){p=f[n>>2]|0;e=c?p:n;if(c){if(m){r=u;o=40;break b}if(!(Vk(e,g,i)|0)){r=u;o=40;break b}else break}if(m){r=u;o=40;break b}if((b[g>>0]|0)==(p&255)<<24>>24){p=n;n=j;j=g;do{n=n+-1|0;p=p+1|0;if(!n){r=u;o=40;break b}j=j+1|0}while((b[p>>0]|0)==(b[j>>0]|0))}}}else{if(a>>>0>>0)v=a;else v=(a>>>0)%(l>>>0)|0;if((v|0)!=(s|0)){r=0;o=40;break b}}while(0);u=f[u>>2]|0;if(!u){r=0;o=40;break}}if((o|0)==40)return r|0;return 0}function Jd(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0;c=a+4|0;if(!b){d=f[a>>2]|0;f[a>>2]=0;if(d|0)Oq(d);f[c>>2]=0;return}if(b>>>0>1073741823){d=ra(8)|0;Oo(d,16035);f[d>>2]=7256;va(d|0,1112,110)}d=ln(b<<2)|0;e=f[a>>2]|0;f[a>>2]=d;if(e|0)Oq(e);f[c>>2]=b;c=0;do{f[(f[a>>2]|0)+(c<<2)>>2]=0;c=c+1|0}while((c|0)!=(b|0));c=a+8|0;e=f[c>>2]|0;if(!e)return;d=f[e+4>>2]|0;g=b+-1|0;h=(g&b|0)==0;if(!h)if(d>>>0>>0)i=d;else i=(d>>>0)%(b>>>0)|0;else i=d&g;f[(f[a>>2]|0)+(i<<2)>>2]=c;c=f[e>>2]|0;if(!c)return;else{j=i;k=e;l=c;m=e}a:while(1){e=k;c=l;i=m;b:while(1){c:do if(h){d=c;while(1){n=f[d+4>>2]&g;if((n|0)==(j|0)){o=d;break c}p=(f[a>>2]|0)+(n<<2)|0;if(!(f[p>>2]|0)){q=d;r=n;s=p;break b}p=d+12|0;t=f[d>>2]|0;d:do if(!t)u=d;else{v=f[d+8>>2]|0;w=d;x=t;while(1){if((v|0)!=(f[x+8>>2]|0)){u=w;break d}if((f[p>>2]|0)!=(f[x+12>>2]|0)){u=w;break d}y=f[x>>2]|0;if(!y){u=x;break}else{z=x;x=y;w=z}}}while(0);f[i>>2]=f[u>>2];f[u>>2]=f[f[(f[a>>2]|0)+(n<<2)>>2]>>2];f[f[(f[a>>2]|0)+(n<<2)>>2]>>2]=d;d=f[e>>2]|0;if(!d){A=39;break a}}}else{d=c;while(1){p=f[d+4>>2]|0;if(p>>>0>>0)B=p;else B=(p>>>0)%(b>>>0)|0;if((B|0)==(j|0)){o=d;break c}p=(f[a>>2]|0)+(B<<2)|0;if(!(f[p>>2]|0)){q=d;r=B;s=p;break b}p=d+12|0;t=f[d>>2]|0;e:do if(!t)C=d;else{w=f[d+8>>2]|0;x=d;v=t;while(1){if((w|0)!=(f[v+8>>2]|0)){C=x;break e}if((f[p>>2]|0)!=(f[v+12>>2]|0)){C=x;break e}z=f[v>>2]|0;if(!z){C=v;break}else{y=v;v=z;x=y}}}while(0);f[i>>2]=f[C>>2];f[C>>2]=f[f[(f[a>>2]|0)+(B<<2)>>2]>>2];f[f[(f[a>>2]|0)+(B<<2)>>2]>>2]=d;d=f[e>>2]|0;if(!d){A=39;break a}}}while(0);c=f[o>>2]|0;if(!c){A=39;break a}else{e=o;i=o}}f[s>>2]=i;l=f[q>>2]|0;if(!l){A=39;break}else{j=r;k=q;m=q}}if((A|0)==39)return}function Kd(a,c,d,e,g){a=a|0;c=c|0;d=d|0;e=e|0;g=g|0;var h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0;h=a+4|0;i=f[c>>2]|0;c=i;do if((i|0)!=(h|0)){j=i+16|0;k=b[j+11>>0]|0;l=k<<24>>24<0;m=l?f[i+20>>2]|0:k&255;k=b[g+11>>0]|0;n=k<<24>>24<0;o=n?f[g+4>>2]|0:k&255;k=m>>>0>>0;p=k?m:o;if((p|0)!=0?(q=Vk(n?f[g>>2]|0:g,l?f[j>>2]|0:j,p)|0,(q|0)!=0):0){if((q|0)<0)break}else r=4;if((r|0)==4?o>>>0>>0:0)break;q=o>>>0>>0?o:m;if((q|0)!=0?(m=Vk(l?f[j>>2]|0:j,n?f[g>>2]|0:g,q)|0,(m|0)!=0):0){if((m|0)>=0)r=37}else r=21;if((r|0)==21?!k:0)r=37;if((r|0)==37){f[d>>2]=c;f[e>>2]=c;s=e;return s|0}k=f[i+4>>2]|0;m=(k|0)==0;if(m){q=i+8|0;j=f[q>>2]|0;if((f[j>>2]|0)==(i|0))t=j;else{j=q;do{q=f[j>>2]|0;j=q+8|0;l=f[j>>2]|0}while((f[l>>2]|0)!=(q|0));t=l}}else{j=k;while(1){l=f[j>>2]|0;if(!l)break;else j=l}t=j}do if((t|0)!=(h|0)){k=t+16|0;l=b[k+11>>0]|0;q=l<<24>>24<0;p=q?f[t+20>>2]|0:l&255;l=p>>>0>>0?p:o;if((l|0)!=0?(u=Vk(n?f[g>>2]|0:g,q?f[k>>2]|0:k,l)|0,(u|0)!=0):0){if((u|0)<0)break}else r=31;if((r|0)==31?o>>>0

      -

      -

      Fast Diffusion - 490 Stable Diffusion models, but why? For your enjoyment!

      -

      -

      If a model is loaded each new image takes 20 seconds to generate!

      -

      -
      If you get ERROR it's because that model ran out of memory, try again, or wait a minute and try again, have fun!

      -
      - """) - with gr.Row(): - with gr.Column(scale=100): - #Model selection dropdown - model_name1 = gr.Dropdown(label="Select Model", choices=[m for m in models], type="index", value=current_model, interactive=True) - with gr.Row(): - with gr.Column(scale=100): - magic1=gr.Textbox(label="Your Prompt", lines=4) #Positive - #with gr.Column(scale=100): - #negative_prompt=gr.Textbox(label="Negative Prompt", lines=1) - gr.HTML("""""") - run=gr.Button("Generate Image") - with gr.Row(): - with gr.Column(style="width=800px"): - output1=gr.Image(label=(f"{current_model}")) - - - with gr.Row(): - with gr.Column(scale=50): - input_text=gr.Textbox(label="Use this box to extend an idea automagically, by typing some words and clicking Extend Idea",lines=2) - see_prompts=gr.Button("Extend Idea -> overwrite the contents of the `Your Prompt´ box above") - use_short=gr.Button("Copy the contents of this box to the `Your Prompt´ box above") - def short_prompt(inputs): - return(inputs) - - model_name1.change(set_model,inputs=model_name1,outputs=[output1]) - - run.click(send_it1, inputs=[magic1, model_name1], outputs=[output1]) - - use_short.click(short_prompt,inputs=[input_text],outputs=magic1) - - see_prompts.click(text_it1,inputs=[input_text],outputs=magic1) - -myface.queue(concurrency_count=200) -myface.launch(inline=True, show_api=False, max_threads=400) \ No newline at end of file diff --git a/spaces/ml-energy/leaderboard/tests/test_utils.py b/spaces/ml-energy/leaderboard/tests/test_utils.py deleted file mode 100644 index cb2fc7e268f8dd4dd6022b7c612967360570696f..0000000000000000000000000000000000000000 --- a/spaces/ml-energy/leaderboard/tests/test_utils.py +++ /dev/null @@ -1,122 +0,0 @@ -from __future__ import annotations - -from spitfight.utils import TokenGenerationBuffer - - -def test_basic1(): - buffer = TokenGenerationBuffer(stop_str="stop") - - buffer.append("hello") - assert buffer.pop() == "hello" - assert buffer.pop() == None - assert not buffer.matched_stop_str - - buffer.append("world") - assert buffer.pop() == "world" - assert not buffer.matched_stop_str - - buffer.append("stop") - assert buffer.pop() == None - assert buffer.matched_stop_str - assert buffer.pop() == None - assert buffer.matched_stop_str - assert buffer.pop() == None - assert buffer.matched_stop_str - assert buffer.pop() == None - assert buffer.matched_stop_str - -def test_basic2(): - buffer = TokenGenerationBuffer(stop_str="stop") - - buffer.append("hi") - assert buffer.pop() == "hi" - assert not buffer.matched_stop_str - - buffer.append("stole") - assert buffer.pop() == "stole" - assert not buffer.matched_stop_str - - buffer.append("sto") - assert buffer.pop() == None - assert not buffer.matched_stop_str - - buffer.append("ic") - assert buffer.pop() == "stoic" - assert not buffer.matched_stop_str - - buffer.append("st") - assert buffer.pop() == None - assert not buffer.matched_stop_str - - buffer.append("opper") - assert buffer.pop() == "stopper" - assert not buffer.matched_stop_str - - buffer.append("sto") - assert buffer.pop() == None - assert not buffer.matched_stop_str - - buffer.append("p") - assert buffer.pop() == None - assert buffer.matched_stop_str - -def test_falcon1(): - buffer = TokenGenerationBuffer(stop_str="\nUser") - - buffer.append("Hi") - assert buffer.pop() == "Hi" - assert not buffer.matched_stop_str - - buffer.append("!") - assert buffer.pop() == "!" - assert not buffer.matched_stop_str - - buffer.append("\n") - assert buffer.pop() == None - assert not buffer.matched_stop_str - - buffer.append("User") - assert buffer.pop() == None - assert buffer.matched_stop_str - -def test_falcon2(): - buffer = TokenGenerationBuffer(stop_str="\nUser") - - buffer.append("\n") - assert buffer.pop() == None - assert not buffer.matched_stop_str - - buffer.append("\n") - assert buffer.pop() == "\n" - assert not buffer.matched_stop_str - - buffer.append("\n") - assert buffer.pop() == "\n" - assert not buffer.matched_stop_str - - buffer.append("\n") - assert buffer.pop() == "\n" - assert not buffer.matched_stop_str - - buffer.append("User") - assert buffer.pop() == None - assert buffer.pop() == None - assert buffer.matched_stop_str - -def test_no_stop_str(): - buffer = TokenGenerationBuffer(stop_str=None) - - buffer.append("hello") - assert buffer.pop() == "hello" - assert buffer.pop() == None - assert not buffer.matched_stop_str - - buffer.append("world") - assert buffer.pop() == "world" - assert buffer.pop() == None - assert not buffer.matched_stop_str - - buffer.append("\n") - assert buffer.pop() == "\n" - assert buffer.pop() == None - assert not buffer.matched_stop_str diff --git a/spaces/mrneuralnet/P-DFD/trainer/exp_tester.py b/spaces/mrneuralnet/P-DFD/trainer/exp_tester.py deleted file mode 100644 index ee4f219f0ba60c6ded44e3b7c95eb7b21fc0be46..0000000000000000000000000000000000000000 --- a/spaces/mrneuralnet/P-DFD/trainer/exp_tester.py +++ /dev/null @@ -1,144 +0,0 @@ -import os -import sys -import yaml -import torch -import random - -from tqdm import tqdm -from pprint import pprint -from torch.utils import data - -from dataset import load_dataset -from loss import get_loss -from model import load_model -from model.common import freeze_weights -from trainer import AbstractTrainer -from trainer.utils import AccMeter, AUCMeter, AverageMeter, Logger, center_print - - -class ExpTester(AbstractTrainer): - def __init__(self, config, stage="Test"): - super(ExpTester, self).__init__(config, stage) - - if torch.cuda.is_available() and self.device is not None: - print(f"Using cuda device: {self.device}.") - self.gpu = True - self.model = self.model.to(self.device) - else: - print("Using cpu device.") - self.device = torch.device("cpu") - - def _initiated_settings(self, model_cfg=None, data_cfg=None, config_cfg=None): - self.gpu = False - self.device = config_cfg.get("device", None) - - def _train_settings(self, model_cfg=None, data_cfg=None, config_cfg=None): - # Not used. - raise NotImplementedError("The function is not intended to be used here.") - - def _test_settings(self, model_cfg=None, data_cfg=None, config_cfg=None): - # load test dataset - test_dataset = data_cfg["file"] - branch = data_cfg["test_branch"] - name = data_cfg["name"] - with open(test_dataset, "r") as f: - options = yaml.load(f, Loader=yaml.FullLoader) - test_options = options[branch] - self.test_set = load_dataset(name)(test_options) - # wrapped with data loader - self.test_batch_size = data_cfg["test_batch_size"] - self.test_loader = data.DataLoader(self.test_set, shuffle=False, - batch_size=self.test_batch_size) - self.run_id = config_cfg["id"] - self.ckpt_fold = config_cfg.get("ckpt_fold", "runs") - self.dir = os.path.join(self.ckpt_fold, self.model_name, self.run_id) - - # load model - self.num_classes = model_cfg["num_classes"] - self.model = load_model(self.model_name)(**model_cfg) - - # load loss - self.loss_criterion = get_loss(config_cfg.get("loss", None)) - - # redirect the std out stream - sys.stdout = Logger(os.path.join(self.dir, "test_result.txt")) - print('Run dir: {}'.format(self.dir)) - - center_print('Test configurations begins') - pprint(self.config) - pprint(test_options) - center_print('Test configurations ends') - - self.ckpt = config_cfg.get("ckpt", "best_model") - self._load_ckpt(best=True, train=False) - - def _save_ckpt(self, step, best=False): - # Not used. - raise NotImplementedError("The function is not intended to be used here.") - - def _load_ckpt(self, best=False, train=False): - load_dir = os.path.join(self.dir, self.ckpt + ".bin" if best else "latest_model.bin") - load_dict = torch.load(load_dir, map_location=self.device) - self.start_step = load_dict["step"] - self.best_step = load_dict["best_step"] - self.best_metric = load_dict.get("best_metric", None) - if self.best_metric is None: - self.best_metric = load_dict.get("best_acc") - self.eval_metric = load_dict.get("eval_metric", None) - if self.eval_metric is None: - self.eval_metric = load_dict.get("Acc") - self.model.load_state_dict(load_dict["model"]) - print(f"Loading checkpoint from {load_dir}, best step: {self.best_step}, " - f"best {self.eval_metric}: {round(self.best_metric.item(), 4)}.") - - def train(self): - # Not used. - raise NotImplementedError("The function is not intended to be used here.") - - def validate(self, epoch, step, timer, writer): - # Not used. - raise NotImplementedError("The function is not intended to be used here.") - - def test(self, display_images=False): - freeze_weights(self.model) - t_idx = random.randint(1, len(self.test_loader) + 1) - self.fixed_randomness() # for reproduction - - acc = AccMeter() - auc = AUCMeter() - logloss = AverageMeter() - test_generator = tqdm(enumerate(self.test_loader, 1)) - categories = self.test_loader.dataset.categories - for idx, test_data in test_generator: - self.model.eval() - I, Y = test_data - I = self.test_loader.dataset.load_item(I) - if self.gpu: - in_I, Y = self.to_device((I, Y)) - else: - in_I, Y = (I, Y) - Y_pre = self.model(in_I) - - # for BCE Setting: - if self.num_classes == 1: - Y_pre = Y_pre.squeeze() - loss = self.loss_criterion(Y_pre, Y.float()) - Y_pre = torch.sigmoid(Y_pre) - else: - loss = self.loss_criterion(Y_pre, Y) - - acc.update(Y_pre, Y, use_bce=self.num_classes == 1) - auc.update(Y_pre, Y, use_bce=self.num_classes == 1) - logloss.update(loss.item()) - - test_generator.set_description("Test %d/%d" % (idx, len(self.test_loader))) - if display_images and idx == t_idx: - # show images - images = I[:4] - pred = Y_pre[:4] - gt = Y[:4] - self.plot_figure(images, pred, gt, 2, categories) - - print("Test, FINAL LOSS %.4f, FINAL ACC %.4f, FINAL AUC %.4f" % - (logloss.avg, acc.mean_acc(), auc.mean_auc())) - auc.curve(self.dir) diff --git a/spaces/mrstuffandthings/Bark-Voice-Cloning/util/parseinput.py b/spaces/mrstuffandthings/Bark-Voice-Cloning/util/parseinput.py deleted file mode 100644 index f2102648cf169f0a52bb66755308fee5f81247e0..0000000000000000000000000000000000000000 --- a/spaces/mrstuffandthings/Bark-Voice-Cloning/util/parseinput.py +++ /dev/null @@ -1,129 +0,0 @@ -import re -import xml.etree.ElementTree as ET -from xml.sax import saxutils -#import nltk - -# Chunked generation originally from https://github.com/serp-ai/bark-with-voice-clone -def split_and_recombine_text(text, desired_length=100, max_length=150): - # return nltk.sent_tokenize(text) - - # from https://github.com/neonbjb/tortoise-tts - """Split text it into chunks of a desired length trying to keep sentences intact.""" - # normalize text, remove redundant whitespace and convert non-ascii quotes to ascii - text = re.sub(r"\n\n+", "\n", text) - text = re.sub(r"\s+", " ", text) - text = re.sub(r"[“”]", '"', text) - - rv = [] - in_quote = False - current = "" - split_pos = [] - pos = -1 - end_pos = len(text) - 1 - - def seek(delta): - nonlocal pos, in_quote, current - is_neg = delta < 0 - for _ in range(abs(delta)): - if is_neg: - pos -= 1 - current = current[:-1] - else: - pos += 1 - current += text[pos] - if text[pos] == '"': - in_quote = not in_quote - return text[pos] - - def peek(delta): - p = pos + delta - return text[p] if p < end_pos and p >= 0 else "" - - def commit(): - nonlocal rv, current, split_pos - rv.append(current) - current = "" - split_pos = [] - - while pos < end_pos: - c = seek(1) - # do we need to force a split? - if len(current) >= max_length: - if len(split_pos) > 0 and len(current) > (desired_length / 2): - # we have at least one sentence and we are over half the desired length, seek back to the last split - d = pos - split_pos[-1] - seek(-d) - else: - # no full sentences, seek back until we are not in the middle of a word and split there - while c not in "!?.,\n " and pos > 0 and len(current) > desired_length: - c = seek(-1) - commit() - # check for sentence boundaries - elif not in_quote and (c in "!?]\n" or (c == "." and peek(1) in "\n ")): - # seek forward if we have consecutive boundary markers but still within the max length - while ( - pos < len(text) - 1 and len(current) < max_length and peek(1) in "!?.]" - ): - c = seek(1) - split_pos.append(pos) - if len(current) >= desired_length: - commit() - # treat end of quote as a boundary if its followed by a space or newline - elif in_quote and peek(1) == '"' and peek(2) in "\n ": - seek(2) - split_pos.append(pos) - rv.append(current) - - # clean up, remove lines with only whitespace or punctuation - rv = [s.strip() for s in rv] - rv = [s for s in rv if len(s) > 0 and not re.match(r"^[\s\.,;:!?]*$", s)] - - return rv - -def is_ssml(value): - try: - ET.fromstring(value) - except ET.ParseError: - return False - return True - -def build_ssml(rawtext, selected_voice): - texts = rawtext.split("\n") - joinedparts = "" - for textpart in texts: - textpart = textpart.strip() - if len(textpart) < 1: - continue - joinedparts = joinedparts + f"\n{saxutils.escape(textpart)}" - ssml = f""" - - {joinedparts} - - """ - return ssml - -def create_clips_from_ssml(ssmlinput): - # Parse the XML - tree = ET.ElementTree(ET.fromstring(ssmlinput)) - root = tree.getroot() - - # Create an empty list - voice_list = [] - - # Loop through all voice tags - for voice in root.iter('{http://www.w3.org/2001/10/synthesis}voice'): - # Extract the voice name attribute and the content text - voice_name = voice.attrib['name'] - voice_content = voice.text.strip() if voice.text else '' - if(len(voice_content) > 0): - parts = split_and_recombine_text(voice_content) - for p in parts: - if(len(p) > 1): - # add to tuple list - voice_list.append((voice_name, p)) - return voice_list - diff --git a/spaces/mserras/somos-alpaca-es/README.md b/spaces/mserras/somos-alpaca-es/README.md deleted file mode 100644 index 9488e14415c39b7d4e22956140951ba6774542d5..0000000000000000000000000000000000000000 --- a/spaces/mserras/somos-alpaca-es/README.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -title: Hackathon SomosNLP Reto Datasets LLM Español -emoji: 🦙 🏷️ -colorFrom: purple -colorTo: red -sdk: docker -app_port: 6900 -fullWidth: true -tags: -- argilla -- somosnlp -duplicated_from: somosnlp/somos-alpaca-es ---- diff --git a/spaces/mshkdm/VToonify/vtoonify/train_vtoonify_t.py b/spaces/mshkdm/VToonify/vtoonify/train_vtoonify_t.py deleted file mode 100644 index 147d5f38a5b25822ab05f089173cd96c6aa22c12..0000000000000000000000000000000000000000 --- a/spaces/mshkdm/VToonify/vtoonify/train_vtoonify_t.py +++ /dev/null @@ -1,432 +0,0 @@ -import os -#os.environ['CUDA_VISIBLE_DEVICES'] = "0" -import argparse -import math -import random - -import numpy as np -import torch -from torch import nn, optim -from torch.nn import functional as F -from torch.utils import data -import torch.distributed as dist -from torchvision import transforms, utils -from tqdm import tqdm -from PIL import Image -from util import * -from model.stylegan import lpips -from model.stylegan.model import Generator, Downsample -from model.vtoonify import VToonify, ConditionalDiscriminator -from model.bisenet.model import BiSeNet -from model.simple_augment import random_apply_affine -from model.stylegan.distributed import ( - get_rank, - synchronize, - reduce_loss_dict, - reduce_sum, - get_world_size, -) - -# In the paper, --weight for each style is set as follows, -# cartoon: default -# caricature: default -# pixar: 1 1 1 1 1 1 1 1 1 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 -# comic: 0.5 0.5 0.5 0.5 0.5 0.5 0.5 1 1 1 1 1 1 1 1 1 1 1 -# arcane: 0.5 0.5 0.5 0.5 0.5 0.5 0.5 1 1 1 1 1 1 1 1 1 1 1 - -class TrainOptions(): - def __init__(self): - - self.parser = argparse.ArgumentParser(description="Train VToonify-T") - self.parser.add_argument("--iter", type=int, default=2000, help="total training iterations") - self.parser.add_argument("--batch", type=int, default=8, help="batch sizes for each gpus") - self.parser.add_argument("--lr", type=float, default=0.0001, help="learning rate") - self.parser.add_argument("--local_rank", type=int, default=0, help="local rank for distributed training") - self.parser.add_argument("--start_iter", type=int, default=0, help="start iteration") - self.parser.add_argument("--save_every", type=int, default=30000, help="interval of saving a checkpoint") - self.parser.add_argument("--save_begin", type=int, default=30000, help="when to start saving a checkpoint") - self.parser.add_argument("--log_every", type=int, default=200, help="interval of saving an intermediate image result") - - self.parser.add_argument("--adv_loss", type=float, default=0.01, help="the weight of adv loss") - self.parser.add_argument("--grec_loss", type=float, default=0.1, help="the weight of mse recontruction loss") - self.parser.add_argument("--perc_loss", type=float, default=0.01, help="the weight of perceptual loss") - self.parser.add_argument("--tmp_loss", type=float, default=1.0, help="the weight of temporal consistency loss") - - self.parser.add_argument("--encoder_path", type=str, default=None, help="path to the pretrained encoder model") - self.parser.add_argument("--direction_path", type=str, default='./checkpoint/directions.npy', help="path to the editing direction latents") - self.parser.add_argument("--stylegan_path", type=str, default='./checkpoint/stylegan2-ffhq-config-f.pt', help="path to the stylegan model") - self.parser.add_argument("--finetunegan_path", type=str, default='./checkpoint/cartoon/finetune-000600.pt', help="path to the finetuned stylegan model") - self.parser.add_argument("--weight", type=float, nargs=18, default=[1]*9+[0]*9, help="the weight for blending two models") - self.parser.add_argument("--faceparsing_path", type=str, default='./checkpoint/faceparsing.pth', help="path of the face parsing model") - self.parser.add_argument("--style_encoder_path", type=str, default='./checkpoint/encoder.pt', help="path of the style encoder") - - self.parser.add_argument("--name", type=str, default='vtoonify_t_cartoon', help="saved model name") - self.parser.add_argument("--pretrain", action="store_true", help="if true, only pretrain the encoder") - - def parse(self): - self.opt = self.parser.parse_args() - if self.opt.encoder_path is None: - self.opt.encoder_path = os.path.join('./checkpoint/', self.opt.name, 'pretrain.pt') - args = vars(self.opt) - if self.opt.local_rank == 0: - print('Load options') - for name, value in sorted(args.items()): - print('%s: %s' % (str(name), str(value))) - return self.opt - - -# pretrain E of vtoonify. -# We train E so that its the last-layer feature matches the original 8-th-layer input feature of G1 -# See Model initialization in Sec. 4.1.2 for the detail -def pretrain(args, generator, g_optim, g_ema, parsingpredictor, down, directions, basemodel, device): - pbar = range(args.iter) - - if get_rank() == 0: - pbar = tqdm(pbar, initial=args.start_iter, dynamic_ncols=True, smoothing=0.01) - - recon_loss = torch.tensor(0.0, device=device) - loss_dict = {} - - if args.distributed: - g_module = generator.module - else: - g_module = generator - - accum = 0.5 ** (32 / (10 * 1000)) - - requires_grad(g_module.encoder, True) - - for idx in pbar: - i = idx + args.start_iter - - if i > args.iter: - print("Done!") - break - - with torch.no_grad(): - # during pretraining, no geometric transformations are applied. - noise_sample = torch.randn(args.batch, 512).cuda() - ws_ = basemodel.style(noise_sample).unsqueeze(1).repeat(1,18,1) # random w - ws_[:, 3:7] += directions[torch.randint(0, directions.shape[0], (args.batch,)), 3:7] # w''=w'=w+n - img_gen, _ = basemodel([ws_], input_is_latent=True, truncation=0.5, truncation_latent=0) # image part of x' - img_gen = torch.clamp(img_gen, -1, 1).detach() - img_gen512 = down(img_gen.detach()) - img_gen256 = down(img_gen512.detach()) # image part of x'_down - mask512 = parsingpredictor(2*torch.clamp(img_gen512, -1, 1))[0] - real_input = torch.cat((img_gen256, down(mask512)/16.0), dim=1).detach() # x'_down - # f_G1^(8)(w'') - real_feat, real_skip = g_ema.generator([ws_], input_is_latent=True, return_feature_ind = 6, truncation=0.5, truncation_latent=0) - real_feat = real_feat.detach() - real_skip = real_skip.detach() - - # f_E^(last)(x'_down) - fake_feat, fake_skip = generator(real_input, style=None, return_feat=True) - - # L_E in Eq.(1) - recon_loss = F.mse_loss(fake_feat, real_feat) + F.mse_loss(fake_skip, real_skip) - - loss_dict["emse"] = recon_loss - - generator.zero_grad() - recon_loss.backward() - g_optim.step() - - accumulate(g_ema.encoder, g_module.encoder, accum) - - loss_reduced = reduce_loss_dict(loss_dict) - - emse_loss_val = loss_reduced["emse"].mean().item() - - if get_rank() == 0: - pbar.set_description( - ( - f"iter: {i:d}; emse: {emse_loss_val:.3f}" - ) - ) - - if ((i+1) >= args.save_begin and (i+1) % args.save_every == 0) or (i+1) == args.iter: - if (i+1) == args.iter: - savename = f"checkpoint/%s/pretrain.pt"%(args.name) - else: - savename = f"checkpoint/%s/pretrain-%05d.pt"%(args.name, i+1) - torch.save( - { - #"g": g_module.encoder.state_dict(), - "g_ema": g_ema.encoder.state_dict(), - }, - savename, - ) - - -# generate paired data and train vtoonify, see Sec. 4.1.2 for the detail -def train(args, generator, discriminator, g_optim, d_optim, g_ema, percept, parsingpredictor, down, pspencoder, directions, basemodel, device): - pbar = range(args.iter) - - if get_rank() == 0: - pbar = tqdm(pbar, initial=args.start_iter, smoothing=0.01, ncols=120, dynamic_ncols=False) - - d_loss = torch.tensor(0.0, device=device) - g_loss = torch.tensor(0.0, device=device) - grec_loss = torch.tensor(0.0, device=device) - gfeat_loss = torch.tensor(0.0, device=device) - temporal_loss = torch.tensor(0.0, device=device) - loss_dict = {} - - if args.distributed: - g_module = generator.module - d_module = discriminator.module - - else: - g_module = generator - d_module = discriminator - - accum = 0.5 ** (32 / (10 * 1000)) - - for idx in pbar: - i = idx + args.start_iter - - if i > args.iter: - print("Done!") - break - - ###### This part is for data generation. Generate pair (x, y, w'') as in Fig. 5 of the paper - with torch.no_grad(): - noise_sample = torch.randn(args.batch, 512).cuda() - wc = basemodel.style(noise_sample).unsqueeze(1).repeat(1,18,1) # random w - wc[:, 3:7] += directions[torch.randint(0, directions.shape[0], (args.batch,)), 3:7] # w'=w+n - wc = wc.detach() - xc, _ = basemodel([wc], input_is_latent=True, truncation=0.5, truncation_latent=0) - xc = torch.clamp(xc, -1, 1).detach() # x' - xl = pspencoder(F.adaptive_avg_pool2d(xc, 256)) - xl = basemodel.style(xl.reshape(xl.shape[0]*xl.shape[1], xl.shape[2])).reshape(xl.shape) # E_s(x'_down) - xl = torch.cat((wc[:,0:7]*0.5, xl[:,7:18]), dim=1).detach() # w'' = concatenate w' and E_s(x'_down) - xs, _ = g_ema.generator([xl], input_is_latent=True) - xs = torch.clamp(xs, -1, 1).detach() # y' - # during training, random geometric transformations are applied. - imgs, _ = random_apply_affine(torch.cat((xc.detach(),xs), dim=1), 0.2, None) - real_input1024 = imgs[:,0:3].detach() # image part of x - real_input512 = down(real_input1024).detach() - real_input256 = down(real_input512).detach() - mask512 = parsingpredictor(2*real_input512)[0] - mask256 = down(mask512).detach() - mask = F.adaptive_avg_pool2d(mask512, 1024).detach() # parsing part of x - real_output = imgs[:,3:].detach() # y - real_input = torch.cat((real_input256, mask256/16.0), dim=1) # x_down - # for log, sample a fixed input-output pair (x_down, y, w'') - if idx == 0 or i == 0: - samplein = real_input.clone().detach() - sampleout = real_output.clone().detach() - samplexl = xl.clone().detach() - - ###### This part is for training discriminator - - requires_grad(g_module.encoder, False) - requires_grad(g_module.fusion_out, False) - requires_grad(g_module.fusion_skip, False) - requires_grad(discriminator, True) - - fake_output = generator(real_input, xl) - fake_pred = discriminator(F.adaptive_avg_pool2d(fake_output, 256)) - real_pred = discriminator(F.adaptive_avg_pool2d(real_output, 256)) - - # L_adv in Eq.(3) - d_loss = d_logistic_loss(real_pred, fake_pred) * args.adv_loss - loss_dict["d"] = d_loss - - discriminator.zero_grad() - d_loss.backward() - d_optim.step() - - ###### This part is for training generator (encoder and fusion modules) - - requires_grad(g_module.encoder, True) - requires_grad(g_module.fusion_out, True) - requires_grad(g_module.fusion_skip, True) - requires_grad(discriminator, False) - - fake_output = generator(real_input, xl) - fake_pred = discriminator(F.adaptive_avg_pool2d(fake_output, 256)) - # L_adv in Eq.(3) - g_loss = g_nonsaturating_loss(fake_pred) * args.adv_loss - # L_rec in Eq.(2) - grec_loss = F.mse_loss(fake_output, real_output) * args.grec_loss - gfeat_loss = percept(F.adaptive_avg_pool2d(fake_output, 512), # 1024 will out of memory - F.adaptive_avg_pool2d(real_output, 512)).sum() * args.perc_loss # 256 will get blurry output - - loss_dict["g"] = g_loss - loss_dict["gr"] = grec_loss - loss_dict["gf"] = gfeat_loss - - w = random.randint(0,1024-896) - h = random.randint(0,1024-896) - crop_input = torch.cat((real_input1024[:,:,w:w+896,h:h+896], mask[:,:,w:w+896,h:h+896]/16.0), dim=1).detach() - crop_input = down(down(crop_input)) - crop_fake_output = fake_output[:,:,w:w+896,h:h+896] - fake_crop_output = generator(crop_input, xl) - # L_tmp in Eq.(4), gradually increase the weight of L_tmp - temporal_loss = ((fake_crop_output-crop_fake_output)**2).mean() * max(idx/(args.iter/2.0)-1, 0) * args.tmp_loss - loss_dict["tp"] = temporal_loss - - generator.zero_grad() - (g_loss + grec_loss + gfeat_loss + temporal_loss).backward() - g_optim.step() - - accumulate(g_ema.encoder, g_module.encoder, accum) - accumulate(g_ema.fusion_out, g_module.fusion_out, accum) - accumulate(g_ema.fusion_skip, g_module.fusion_skip, accum) - - loss_reduced = reduce_loss_dict(loss_dict) - - d_loss_val = loss_reduced["d"].mean().item() - g_loss_val = loss_reduced["g"].mean().item() - gr_loss_val = loss_reduced["gr"].mean().item() - gf_loss_val = loss_reduced["gf"].mean().item() - tmp_loss_val = loss_reduced["tp"].mean().item() - - if get_rank() == 0: - pbar.set_description( - ( - f"iter: {i:d}; advd: {d_loss_val:.3f}; advg: {g_loss_val:.3f}; mse: {gr_loss_val:.3f}; " - f"perc: {gf_loss_val:.3f}; tmp: {tmp_loss_val:.3f}" - ) - ) - - if i % args.log_every == 0 or (i+1) == args.iter: - with torch.no_grad(): - g_ema.eval() - sample = g_ema(samplein, samplexl) - sample = F.interpolate(torch.cat((sampleout, sample), dim=0), 256) - utils.save_image( - sample, - f"log/%s/%05d.jpg"%(args.name, i), - nrow=int(args.batch), - normalize=True, - range=(-1, 1), - ) - - if ((i+1) >= args.save_begin and (i+1) % args.save_every == 0) or (i+1) == args.iter: - if (i+1) == args.iter: - savename = f"checkpoint/%s/vtoonify.pt"%(args.name) - else: - savename = f"checkpoint/%s/vtoonify_%05d.pt"%(args.name, i+1) - torch.save( - { - #"g": g_module.state_dict(), - #"d": d_module.state_dict(), - "g_ema": g_ema.state_dict(), - }, - savename, - ) - - - -if __name__ == "__main__": - - device = "cuda" - parser = TrainOptions() - args = parser.parse() - if args.local_rank == 0: - print('*'*98) - if not os.path.exists("log/%s/"%(args.name)): - os.makedirs("log/%s/"%(args.name)) - if not os.path.exists("checkpoint/%s/"%(args.name)): - os.makedirs("checkpoint/%s/"%(args.name)) - - n_gpu = int(os.environ["WORLD_SIZE"]) if "WORLD_SIZE" in os.environ else 1 - args.distributed = n_gpu > 1 - - if args.distributed: - torch.cuda.set_device(args.local_rank) - torch.distributed.init_process_group(backend="nccl", init_method="env://") - synchronize() - - generator = VToonify(backbone = 'toonify').to(device) - generator.apply(weights_init) - g_ema = VToonify(backbone = 'toonify').to(device) - g_ema.eval() - - basemodel = Generator(1024, 512, 8, 2).to(device) # G0 - finetunemodel = Generator(1024, 512, 8, 2).to(device) - basemodel.load_state_dict(torch.load(args.stylegan_path, map_location=lambda storage, loc: storage)['g_ema']) - finetunemodel.load_state_dict(torch.load(args.finetunegan_path, map_location=lambda storage, loc: storage)['g_ema']) - fused_state_dict = blend_models(finetunemodel, basemodel, args.weight) # G1 - generator.generator.load_state_dict(fused_state_dict) # load G1 - g_ema.generator.load_state_dict(fused_state_dict) - requires_grad(basemodel, False) - requires_grad(generator.generator, False) - requires_grad(g_ema.generator, False) - - if not args.pretrain: - generator.encoder.load_state_dict(torch.load(args.encoder_path, map_location=lambda storage, loc: storage)["g_ema"]) - # we initialize the fusion modules to map f_G \otimes f_E to f_G. - for k in generator.fusion_out: - k.weight.data *= 0.01 - k.weight[:,0:k.weight.shape[0],1,1].data += torch.eye(k.weight.shape[0]).cuda() - for k in generator.fusion_skip: - k.weight.data *= 0.01 - k.weight[:,0:k.weight.shape[0],1,1].data += torch.eye(k.weight.shape[0]).cuda() - - accumulate(g_ema.encoder, generator.encoder, 0) - accumulate(g_ema.fusion_out, generator.fusion_out, 0) - accumulate(g_ema.fusion_skip, generator.fusion_skip, 0) - - g_parameters = list(generator.encoder.parameters()) - if not args.pretrain: - g_parameters = g_parameters + list(generator.fusion_out.parameters()) + list(generator.fusion_skip.parameters()) - - g_optim = optim.Adam( - g_parameters, - lr=args.lr, - betas=(0.9, 0.99), - ) - - if args.distributed: - generator = nn.parallel.DistributedDataParallel( - generator, - device_ids=[args.local_rank], - output_device=args.local_rank, - broadcast_buffers=False, - find_unused_parameters=True, - ) - - parsingpredictor = BiSeNet(n_classes=19) - parsingpredictor.load_state_dict(torch.load(args.faceparsing_path, map_location=lambda storage, loc: storage)) - parsingpredictor.to(device).eval() - requires_grad(parsingpredictor, False) - - # we apply gaussian blur to the images to avoid flickers caused during downsampling - down = Downsample(kernel=[1, 3, 3, 1], factor=2).to(device) - requires_grad(down, False) - - directions = torch.tensor(np.load(args.direction_path)).to(device) - - if not args.pretrain: - discriminator = ConditionalDiscriminator(256).to(device) - - d_optim = optim.Adam( - discriminator.parameters(), - lr=args.lr, - betas=(0.9, 0.99), - ) - - if args.distributed: - discriminator = nn.parallel.DistributedDataParallel( - discriminator, - device_ids=[args.local_rank], - output_device=args.local_rank, - broadcast_buffers=False, - find_unused_parameters=True, - ) - - percept = lpips.PerceptualLoss(model="net-lin", net="vgg", use_gpu=device.startswith("cuda"), gpu_ids=[args.local_rank]) - requires_grad(percept.model.net, False) - - pspencoder = load_psp_standalone(args.style_encoder_path, device) - - if args.local_rank == 0: - print('Load models and data successfully loaded!') - - if args.pretrain: - pretrain(args, generator, g_optim, g_ema, parsingpredictor, down, directions, basemodel, device) - else: - train(args, generator, discriminator, g_optim, d_optim, g_ema, percept, parsingpredictor, down, pspencoder, directions, basemodel, device) diff --git a/spaces/mshukor/UnIVAL/fairseq/examples/speech_recognition/models/vggtransformer.py b/spaces/mshukor/UnIVAL/fairseq/examples/speech_recognition/models/vggtransformer.py deleted file mode 100644 index bca0ae59a8cbe2b7c337e395021c883a61d101ee..0000000000000000000000000000000000000000 --- a/spaces/mshukor/UnIVAL/fairseq/examples/speech_recognition/models/vggtransformer.py +++ /dev/null @@ -1,1020 +0,0 @@ -# Copyright (c) Facebook, Inc. and its affiliates. -# -# This source code is licensed under the MIT license found in the -# LICENSE file in the root directory of this source tree. - -import argparse -import math -from collections.abc import Iterable - -import torch -import torch.nn as nn -from examples.speech_recognition.data.data_utils import lengths_to_encoder_padding_mask -from fairseq import utils -from fairseq.models import ( - FairseqEncoder, - FairseqEncoderDecoderModel, - FairseqEncoderModel, - FairseqIncrementalDecoder, - register_model, - register_model_architecture, -) -from fairseq.modules import ( - LinearizedConvolution, - TransformerDecoderLayer, - TransformerEncoderLayer, - VGGBlock, -) - - -@register_model("asr_vggtransformer") -class VGGTransformerModel(FairseqEncoderDecoderModel): - """ - Transformers with convolutional context for ASR - https://arxiv.org/abs/1904.11660 - """ - - def __init__(self, encoder, decoder): - super().__init__(encoder, decoder) - - @staticmethod - def add_args(parser): - """Add model-specific arguments to the parser.""" - parser.add_argument( - "--input-feat-per-channel", - type=int, - metavar="N", - help="encoder input dimension per input channel", - ) - parser.add_argument( - "--vggblock-enc-config", - type=str, - metavar="EXPR", - help=""" - an array of tuples each containing the configuration of one vggblock: - [(out_channels, - conv_kernel_size, - pooling_kernel_size, - num_conv_layers, - use_layer_norm), ...]) - """, - ) - parser.add_argument( - "--transformer-enc-config", - type=str, - metavar="EXPR", - help="""" - a tuple containing the configuration of the encoder transformer layers - configurations: - [(input_dim, - num_heads, - ffn_dim, - normalize_before, - dropout, - attention_dropout, - relu_dropout), ...]') - """, - ) - parser.add_argument( - "--enc-output-dim", - type=int, - metavar="N", - help=""" - encoder output dimension, can be None. If specified, projecting the - transformer output to the specified dimension""", - ) - parser.add_argument( - "--in-channels", - type=int, - metavar="N", - help="number of encoder input channels", - ) - parser.add_argument( - "--tgt-embed-dim", - type=int, - metavar="N", - help="embedding dimension of the decoder target tokens", - ) - parser.add_argument( - "--transformer-dec-config", - type=str, - metavar="EXPR", - help=""" - a tuple containing the configuration of the decoder transformer layers - configurations: - [(input_dim, - num_heads, - ffn_dim, - normalize_before, - dropout, - attention_dropout, - relu_dropout), ...] - """, - ) - parser.add_argument( - "--conv-dec-config", - type=str, - metavar="EXPR", - help=""" - an array of tuples for the decoder 1-D convolution config - [(out_channels, conv_kernel_size, use_layer_norm), ...]""", - ) - - @classmethod - def build_encoder(cls, args, task): - return VGGTransformerEncoder( - input_feat_per_channel=args.input_feat_per_channel, - vggblock_config=eval(args.vggblock_enc_config), - transformer_config=eval(args.transformer_enc_config), - encoder_output_dim=args.enc_output_dim, - in_channels=args.in_channels, - ) - - @classmethod - def build_decoder(cls, args, task): - return TransformerDecoder( - dictionary=task.target_dictionary, - embed_dim=args.tgt_embed_dim, - transformer_config=eval(args.transformer_dec_config), - conv_config=eval(args.conv_dec_config), - encoder_output_dim=args.enc_output_dim, - ) - - @classmethod - def build_model(cls, args, task): - """Build a new model instance.""" - # make sure that all args are properly defaulted - # (in case there are any new ones) - base_architecture(args) - - encoder = cls.build_encoder(args, task) - decoder = cls.build_decoder(args, task) - return cls(encoder, decoder) - - def get_normalized_probs(self, net_output, log_probs, sample=None): - # net_output['encoder_out'] is a (B, T, D) tensor - lprobs = super().get_normalized_probs(net_output, log_probs, sample) - lprobs.batch_first = True - return lprobs - - -DEFAULT_ENC_VGGBLOCK_CONFIG = ((32, 3, 2, 2, False),) * 2 -DEFAULT_ENC_TRANSFORMER_CONFIG = ((256, 4, 1024, True, 0.2, 0.2, 0.2),) * 2 -# 256: embedding dimension -# 4: number of heads -# 1024: FFN -# True: apply layerNorm before (dropout + resiaul) instead of after -# 0.2 (dropout): dropout after MultiheadAttention and second FC -# 0.2 (attention_dropout): dropout in MultiheadAttention -# 0.2 (relu_dropout): dropout after ReLu -DEFAULT_DEC_TRANSFORMER_CONFIG = ((256, 2, 1024, True, 0.2, 0.2, 0.2),) * 2 -DEFAULT_DEC_CONV_CONFIG = ((256, 3, True),) * 2 - - -# TODO: repace transformer encoder config from one liner -# to explicit args to get rid of this transformation -def prepare_transformer_encoder_params( - input_dim, - num_heads, - ffn_dim, - normalize_before, - dropout, - attention_dropout, - relu_dropout, -): - args = argparse.Namespace() - args.encoder_embed_dim = input_dim - args.encoder_attention_heads = num_heads - args.attention_dropout = attention_dropout - args.dropout = dropout - args.activation_dropout = relu_dropout - args.encoder_normalize_before = normalize_before - args.encoder_ffn_embed_dim = ffn_dim - return args - - -def prepare_transformer_decoder_params( - input_dim, - num_heads, - ffn_dim, - normalize_before, - dropout, - attention_dropout, - relu_dropout, -): - args = argparse.Namespace() - args.encoder_embed_dim = None - args.decoder_embed_dim = input_dim - args.decoder_attention_heads = num_heads - args.attention_dropout = attention_dropout - args.dropout = dropout - args.activation_dropout = relu_dropout - args.decoder_normalize_before = normalize_before - args.decoder_ffn_embed_dim = ffn_dim - return args - - -class VGGTransformerEncoder(FairseqEncoder): - """VGG + Transformer encoder""" - - def __init__( - self, - input_feat_per_channel, - vggblock_config=DEFAULT_ENC_VGGBLOCK_CONFIG, - transformer_config=DEFAULT_ENC_TRANSFORMER_CONFIG, - encoder_output_dim=512, - in_channels=1, - transformer_context=None, - transformer_sampling=None, - ): - """constructor for VGGTransformerEncoder - - Args: - - input_feat_per_channel: feature dim (not including stacked, - just base feature) - - in_channel: # input channels (e.g., if stack 8 feature vector - together, this is 8) - - vggblock_config: configuration of vggblock, see comments on - DEFAULT_ENC_VGGBLOCK_CONFIG - - transformer_config: configuration of transformer layer, see comments - on DEFAULT_ENC_TRANSFORMER_CONFIG - - encoder_output_dim: final transformer output embedding dimension - - transformer_context: (left, right) if set, self-attention will be focused - on (t-left, t+right) - - transformer_sampling: an iterable of int, must match with - len(transformer_config), transformer_sampling[i] indicates sampling - factor for i-th transformer layer, after multihead att and feedfoward - part - """ - super().__init__(None) - - self.num_vggblocks = 0 - if vggblock_config is not None: - if not isinstance(vggblock_config, Iterable): - raise ValueError("vggblock_config is not iterable") - self.num_vggblocks = len(vggblock_config) - - self.conv_layers = nn.ModuleList() - self.in_channels = in_channels - self.input_dim = input_feat_per_channel - self.pooling_kernel_sizes = [] - - if vggblock_config is not None: - for _, config in enumerate(vggblock_config): - ( - out_channels, - conv_kernel_size, - pooling_kernel_size, - num_conv_layers, - layer_norm, - ) = config - self.conv_layers.append( - VGGBlock( - in_channels, - out_channels, - conv_kernel_size, - pooling_kernel_size, - num_conv_layers, - input_dim=input_feat_per_channel, - layer_norm=layer_norm, - ) - ) - self.pooling_kernel_sizes.append(pooling_kernel_size) - in_channels = out_channels - input_feat_per_channel = self.conv_layers[-1].output_dim - - transformer_input_dim = self.infer_conv_output_dim( - self.in_channels, self.input_dim - ) - # transformer_input_dim is the output dimension of VGG part - - self.validate_transformer_config(transformer_config) - self.transformer_context = self.parse_transformer_context(transformer_context) - self.transformer_sampling = self.parse_transformer_sampling( - transformer_sampling, len(transformer_config) - ) - - self.transformer_layers = nn.ModuleList() - - if transformer_input_dim != transformer_config[0][0]: - self.transformer_layers.append( - Linear(transformer_input_dim, transformer_config[0][0]) - ) - self.transformer_layers.append( - TransformerEncoderLayer( - prepare_transformer_encoder_params(*transformer_config[0]) - ) - ) - - for i in range(1, len(transformer_config)): - if transformer_config[i - 1][0] != transformer_config[i][0]: - self.transformer_layers.append( - Linear(transformer_config[i - 1][0], transformer_config[i][0]) - ) - self.transformer_layers.append( - TransformerEncoderLayer( - prepare_transformer_encoder_params(*transformer_config[i]) - ) - ) - - self.encoder_output_dim = encoder_output_dim - self.transformer_layers.extend( - [ - Linear(transformer_config[-1][0], encoder_output_dim), - LayerNorm(encoder_output_dim), - ] - ) - - def forward(self, src_tokens, src_lengths, **kwargs): - """ - src_tokens: padded tensor (B, T, C * feat) - src_lengths: tensor of original lengths of input utterances (B,) - """ - bsz, max_seq_len, _ = src_tokens.size() - x = src_tokens.view(bsz, max_seq_len, self.in_channels, self.input_dim) - x = x.transpose(1, 2).contiguous() - # (B, C, T, feat) - - for layer_idx in range(len(self.conv_layers)): - x = self.conv_layers[layer_idx](x) - - bsz, _, output_seq_len, _ = x.size() - - # (B, C, T, feat) -> (B, T, C, feat) -> (T, B, C, feat) -> (T, B, C * feat) - x = x.transpose(1, 2).transpose(0, 1) - x = x.contiguous().view(output_seq_len, bsz, -1) - - input_lengths = src_lengths.clone() - for s in self.pooling_kernel_sizes: - input_lengths = (input_lengths.float() / s).ceil().long() - - encoder_padding_mask, _ = lengths_to_encoder_padding_mask( - input_lengths, batch_first=True - ) - if not encoder_padding_mask.any(): - encoder_padding_mask = None - - subsampling_factor = int(max_seq_len * 1.0 / output_seq_len + 0.5) - attn_mask = self.lengths_to_attn_mask(input_lengths, subsampling_factor) - - transformer_layer_idx = 0 - - for layer_idx in range(len(self.transformer_layers)): - - if isinstance(self.transformer_layers[layer_idx], TransformerEncoderLayer): - x = self.transformer_layers[layer_idx]( - x, encoder_padding_mask, attn_mask - ) - - if self.transformer_sampling[transformer_layer_idx] != 1: - sampling_factor = self.transformer_sampling[transformer_layer_idx] - x, encoder_padding_mask, attn_mask = self.slice( - x, encoder_padding_mask, attn_mask, sampling_factor - ) - - transformer_layer_idx += 1 - - else: - x = self.transformer_layers[layer_idx](x) - - # encoder_padding_maks is a (T x B) tensor, its [t, b] elements indicate - # whether encoder_output[t, b] is valid or not (valid=0, invalid=1) - - return { - "encoder_out": x, # (T, B, C) - "encoder_padding_mask": encoder_padding_mask.t() - if encoder_padding_mask is not None - else None, - # (B, T) --> (T, B) - } - - def infer_conv_output_dim(self, in_channels, input_dim): - sample_seq_len = 200 - sample_bsz = 10 - x = torch.randn(sample_bsz, in_channels, sample_seq_len, input_dim) - for i, _ in enumerate(self.conv_layers): - x = self.conv_layers[i](x) - x = x.transpose(1, 2) - mb, seq = x.size()[:2] - return x.contiguous().view(mb, seq, -1).size(-1) - - def validate_transformer_config(self, transformer_config): - for config in transformer_config: - input_dim, num_heads = config[:2] - if input_dim % num_heads != 0: - msg = ( - "ERROR in transformer config {}: ".format(config) - + "input dimension {} ".format(input_dim) - + "not dividable by number of heads {}".format(num_heads) - ) - raise ValueError(msg) - - def parse_transformer_context(self, transformer_context): - """ - transformer_context can be the following: - - None; indicates no context is used, i.e., - transformer can access full context - - a tuple/list of two int; indicates left and right context, - any number <0 indicates infinite context - * e.g., (5, 6) indicates that for query at x_t, transformer can - access [t-5, t+6] (inclusive) - * e.g., (-1, 6) indicates that for query at x_t, transformer can - access [0, t+6] (inclusive) - """ - if transformer_context is None: - return None - - if not isinstance(transformer_context, Iterable): - raise ValueError("transformer context must be Iterable if it is not None") - - if len(transformer_context) != 2: - raise ValueError("transformer context must have length 2") - - left_context = transformer_context[0] - if left_context < 0: - left_context = None - - right_context = transformer_context[1] - if right_context < 0: - right_context = None - - if left_context is None and right_context is None: - return None - - return (left_context, right_context) - - def parse_transformer_sampling(self, transformer_sampling, num_layers): - """ - parsing transformer sampling configuration - - Args: - - transformer_sampling, accepted input: - * None, indicating no sampling - * an Iterable with int (>0) as element - - num_layers, expected number of transformer layers, must match with - the length of transformer_sampling if it is not None - - Returns: - - A tuple with length num_layers - """ - if transformer_sampling is None: - return (1,) * num_layers - - if not isinstance(transformer_sampling, Iterable): - raise ValueError( - "transformer_sampling must be an iterable if it is not None" - ) - - if len(transformer_sampling) != num_layers: - raise ValueError( - "transformer_sampling {} does not match with the number " - "of layers {}".format(transformer_sampling, num_layers) - ) - - for layer, value in enumerate(transformer_sampling): - if not isinstance(value, int): - raise ValueError("Invalid value in transformer_sampling: ") - if value < 1: - raise ValueError( - "{} layer's subsampling is {}.".format(layer, value) - + " This is not allowed! " - ) - return transformer_sampling - - def slice(self, embedding, padding_mask, attn_mask, sampling_factor): - """ - embedding is a (T, B, D) tensor - padding_mask is a (B, T) tensor or None - attn_mask is a (T, T) tensor or None - """ - embedding = embedding[::sampling_factor, :, :] - if padding_mask is not None: - padding_mask = padding_mask[:, ::sampling_factor] - if attn_mask is not None: - attn_mask = attn_mask[::sampling_factor, ::sampling_factor] - - return embedding, padding_mask, attn_mask - - def lengths_to_attn_mask(self, input_lengths, subsampling_factor=1): - """ - create attention mask according to sequence lengths and transformer - context - - Args: - - input_lengths: (B, )-shape Int/Long tensor; input_lengths[b] is - the length of b-th sequence - - subsampling_factor: int - * Note that the left_context and right_context is specified in - the input frame-level while input to transformer may already - go through subsampling (e.g., the use of striding in vggblock) - we use subsampling_factor to scale the left/right context - - Return: - - a (T, T) binary tensor or None, where T is max(input_lengths) - * if self.transformer_context is None, None - * if left_context is None, - * attn_mask[t, t + right_context + 1:] = 1 - * others = 0 - * if right_context is None, - * attn_mask[t, 0:t - left_context] = 1 - * others = 0 - * elsif - * attn_mask[t, t - left_context: t + right_context + 1] = 0 - * others = 1 - """ - if self.transformer_context is None: - return None - - maxT = torch.max(input_lengths).item() - attn_mask = torch.zeros(maxT, maxT) - - left_context = self.transformer_context[0] - right_context = self.transformer_context[1] - if left_context is not None: - left_context = math.ceil(self.transformer_context[0] / subsampling_factor) - if right_context is not None: - right_context = math.ceil(self.transformer_context[1] / subsampling_factor) - - for t in range(maxT): - if left_context is not None: - st = 0 - en = max(st, t - left_context) - attn_mask[t, st:en] = 1 - if right_context is not None: - st = t + right_context + 1 - st = min(st, maxT - 1) - attn_mask[t, st:] = 1 - - return attn_mask.to(input_lengths.device) - - def reorder_encoder_out(self, encoder_out, new_order): - encoder_out["encoder_out"] = encoder_out["encoder_out"].index_select( - 1, new_order - ) - if encoder_out["encoder_padding_mask"] is not None: - encoder_out["encoder_padding_mask"] = encoder_out[ - "encoder_padding_mask" - ].index_select(1, new_order) - return encoder_out - - -class TransformerDecoder(FairseqIncrementalDecoder): - """ - Transformer decoder consisting of *args.decoder_layers* layers. Each layer - is a :class:`TransformerDecoderLayer`. - Args: - args (argparse.Namespace): parsed command-line arguments - dictionary (~fairseq.data.Dictionary): decoding dictionary - embed_tokens (torch.nn.Embedding): output embedding - no_encoder_attn (bool, optional): whether to attend to encoder outputs. - Default: ``False`` - left_pad (bool, optional): whether the input is left-padded. Default: - ``False`` - """ - - def __init__( - self, - dictionary, - embed_dim=512, - transformer_config=DEFAULT_ENC_TRANSFORMER_CONFIG, - conv_config=DEFAULT_DEC_CONV_CONFIG, - encoder_output_dim=512, - ): - - super().__init__(dictionary) - vocab_size = len(dictionary) - self.padding_idx = dictionary.pad() - self.embed_tokens = Embedding(vocab_size, embed_dim, self.padding_idx) - - self.conv_layers = nn.ModuleList() - for i in range(len(conv_config)): - out_channels, kernel_size, layer_norm = conv_config[i] - if i == 0: - conv_layer = LinearizedConv1d( - embed_dim, out_channels, kernel_size, padding=kernel_size - 1 - ) - else: - conv_layer = LinearizedConv1d( - conv_config[i - 1][0], - out_channels, - kernel_size, - padding=kernel_size - 1, - ) - self.conv_layers.append(conv_layer) - if layer_norm: - self.conv_layers.append(nn.LayerNorm(out_channels)) - self.conv_layers.append(nn.ReLU()) - - self.layers = nn.ModuleList() - if conv_config[-1][0] != transformer_config[0][0]: - self.layers.append(Linear(conv_config[-1][0], transformer_config[0][0])) - self.layers.append( - TransformerDecoderLayer( - prepare_transformer_decoder_params(*transformer_config[0]) - ) - ) - - for i in range(1, len(transformer_config)): - if transformer_config[i - 1][0] != transformer_config[i][0]: - self.layers.append( - Linear(transformer_config[i - 1][0], transformer_config[i][0]) - ) - self.layers.append( - TransformerDecoderLayer( - prepare_transformer_decoder_params(*transformer_config[i]) - ) - ) - self.fc_out = Linear(transformer_config[-1][0], vocab_size) - - def forward(self, prev_output_tokens, encoder_out=None, incremental_state=None): - """ - Args: - prev_output_tokens (LongTensor): previous decoder outputs of shape - `(batch, tgt_len)`, for input feeding/teacher forcing - encoder_out (Tensor, optional): output from the encoder, used for - encoder-side attention - incremental_state (dict): dictionary used for storing state during - :ref:`Incremental decoding` - Returns: - tuple: - - the last decoder layer's output of shape `(batch, tgt_len, - vocab)` - - the last decoder layer's attention weights of shape `(batch, - tgt_len, src_len)` - """ - target_padding_mask = ( - (prev_output_tokens == self.padding_idx).to(prev_output_tokens.device) - if incremental_state is None - else None - ) - - if incremental_state is not None: - prev_output_tokens = prev_output_tokens[:, -1:] - - # embed tokens - x = self.embed_tokens(prev_output_tokens) - - # B x T x C -> T x B x C - x = self._transpose_if_training(x, incremental_state) - - for layer in self.conv_layers: - if isinstance(layer, LinearizedConvolution): - x = layer(x, incremental_state) - else: - x = layer(x) - - # B x T x C -> T x B x C - x = self._transpose_if_inference(x, incremental_state) - - # decoder layers - for layer in self.layers: - if isinstance(layer, TransformerDecoderLayer): - x, *_ = layer( - x, - (encoder_out["encoder_out"] if encoder_out is not None else None), - ( - encoder_out["encoder_padding_mask"].t() - if encoder_out["encoder_padding_mask"] is not None - else None - ), - incremental_state, - self_attn_mask=( - self.buffered_future_mask(x) - if incremental_state is None - else None - ), - self_attn_padding_mask=( - target_padding_mask if incremental_state is None else None - ), - ) - else: - x = layer(x) - - # T x B x C -> B x T x C - x = x.transpose(0, 1) - - x = self.fc_out(x) - - return x, None - - def buffered_future_mask(self, tensor): - dim = tensor.size(0) - if ( - not hasattr(self, "_future_mask") - or self._future_mask is None - or self._future_mask.device != tensor.device - ): - self._future_mask = torch.triu( - utils.fill_with_neg_inf(tensor.new(dim, dim)), 1 - ) - if self._future_mask.size(0) < dim: - self._future_mask = torch.triu( - utils.fill_with_neg_inf(self._future_mask.resize_(dim, dim)), 1 - ) - return self._future_mask[:dim, :dim] - - def _transpose_if_training(self, x, incremental_state): - if incremental_state is None: - x = x.transpose(0, 1) - return x - - def _transpose_if_inference(self, x, incremental_state): - if incremental_state: - x = x.transpose(0, 1) - return x - - -@register_model("asr_vggtransformer_encoder") -class VGGTransformerEncoderModel(FairseqEncoderModel): - def __init__(self, encoder): - super().__init__(encoder) - - @staticmethod - def add_args(parser): - """Add model-specific arguments to the parser.""" - parser.add_argument( - "--input-feat-per-channel", - type=int, - metavar="N", - help="encoder input dimension per input channel", - ) - parser.add_argument( - "--vggblock-enc-config", - type=str, - metavar="EXPR", - help=""" - an array of tuples each containing the configuration of one vggblock - [(out_channels, conv_kernel_size, pooling_kernel_size,num_conv_layers), ...] - """, - ) - parser.add_argument( - "--transformer-enc-config", - type=str, - metavar="EXPR", - help=""" - a tuple containing the configuration of the Transformer layers - configurations: - [(input_dim, - num_heads, - ffn_dim, - normalize_before, - dropout, - attention_dropout, - relu_dropout), ]""", - ) - parser.add_argument( - "--enc-output-dim", - type=int, - metavar="N", - help="encoder output dimension, projecting the LSTM output", - ) - parser.add_argument( - "--in-channels", - type=int, - metavar="N", - help="number of encoder input channels", - ) - parser.add_argument( - "--transformer-context", - type=str, - metavar="EXPR", - help=""" - either None or a tuple of two ints, indicating left/right context a - transformer can have access to""", - ) - parser.add_argument( - "--transformer-sampling", - type=str, - metavar="EXPR", - help=""" - either None or a tuple of ints, indicating sampling factor in each layer""", - ) - - @classmethod - def build_model(cls, args, task): - """Build a new model instance.""" - base_architecture_enconly(args) - encoder = VGGTransformerEncoderOnly( - vocab_size=len(task.target_dictionary), - input_feat_per_channel=args.input_feat_per_channel, - vggblock_config=eval(args.vggblock_enc_config), - transformer_config=eval(args.transformer_enc_config), - encoder_output_dim=args.enc_output_dim, - in_channels=args.in_channels, - transformer_context=eval(args.transformer_context), - transformer_sampling=eval(args.transformer_sampling), - ) - return cls(encoder) - - def get_normalized_probs(self, net_output, log_probs, sample=None): - # net_output['encoder_out'] is a (T, B, D) tensor - lprobs = super().get_normalized_probs(net_output, log_probs, sample) - # lprobs is a (T, B, D) tensor - # we need to transoose to get (B, T, D) tensor - lprobs = lprobs.transpose(0, 1).contiguous() - lprobs.batch_first = True - return lprobs - - -class VGGTransformerEncoderOnly(VGGTransformerEncoder): - def __init__( - self, - vocab_size, - input_feat_per_channel, - vggblock_config=DEFAULT_ENC_VGGBLOCK_CONFIG, - transformer_config=DEFAULT_ENC_TRANSFORMER_CONFIG, - encoder_output_dim=512, - in_channels=1, - transformer_context=None, - transformer_sampling=None, - ): - super().__init__( - input_feat_per_channel=input_feat_per_channel, - vggblock_config=vggblock_config, - transformer_config=transformer_config, - encoder_output_dim=encoder_output_dim, - in_channels=in_channels, - transformer_context=transformer_context, - transformer_sampling=transformer_sampling, - ) - self.fc_out = Linear(self.encoder_output_dim, vocab_size) - - def forward(self, src_tokens, src_lengths, **kwargs): - """ - src_tokens: padded tensor (B, T, C * feat) - src_lengths: tensor of original lengths of input utterances (B,) - """ - - enc_out = super().forward(src_tokens, src_lengths) - x = self.fc_out(enc_out["encoder_out"]) - # x = F.log_softmax(x, dim=-1) - # Note: no need this line, because model.get_normalized_prob will call - # log_softmax - return { - "encoder_out": x, # (T, B, C) - "encoder_padding_mask": enc_out["encoder_padding_mask"], # (T, B) - } - - def max_positions(self): - """Maximum input length supported by the encoder.""" - return (1e6, 1e6) # an arbitrary large number - - -def Embedding(num_embeddings, embedding_dim, padding_idx): - m = nn.Embedding(num_embeddings, embedding_dim, padding_idx=padding_idx) - # nn.init.uniform_(m.weight, -0.1, 0.1) - # nn.init.constant_(m.weight[padding_idx], 0) - return m - - -def Linear(in_features, out_features, bias=True, dropout=0): - """Linear layer (input: N x T x C)""" - m = nn.Linear(in_features, out_features, bias=bias) - # m.weight.data.uniform_(-0.1, 0.1) - # if bias: - # m.bias.data.uniform_(-0.1, 0.1) - return m - - -def LinearizedConv1d(in_channels, out_channels, kernel_size, dropout=0, **kwargs): - """Weight-normalized Conv1d layer optimized for decoding""" - m = LinearizedConvolution(in_channels, out_channels, kernel_size, **kwargs) - std = math.sqrt((4 * (1.0 - dropout)) / (m.kernel_size[0] * in_channels)) - nn.init.normal_(m.weight, mean=0, std=std) - nn.init.constant_(m.bias, 0) - return nn.utils.weight_norm(m, dim=2) - - -def LayerNorm(embedding_dim): - m = nn.LayerNorm(embedding_dim) - return m - - -# seq2seq models -def base_architecture(args): - args.input_feat_per_channel = getattr(args, "input_feat_per_channel", 40) - args.vggblock_enc_config = getattr( - args, "vggblock_enc_config", DEFAULT_ENC_VGGBLOCK_CONFIG - ) - args.transformer_enc_config = getattr( - args, "transformer_enc_config", DEFAULT_ENC_TRANSFORMER_CONFIG - ) - args.enc_output_dim = getattr(args, "enc_output_dim", 512) - args.in_channels = getattr(args, "in_channels", 1) - args.tgt_embed_dim = getattr(args, "tgt_embed_dim", 128) - args.transformer_dec_config = getattr( - args, "transformer_dec_config", DEFAULT_ENC_TRANSFORMER_CONFIG - ) - args.conv_dec_config = getattr(args, "conv_dec_config", DEFAULT_DEC_CONV_CONFIG) - args.transformer_context = getattr(args, "transformer_context", "None") - - -@register_model_architecture("asr_vggtransformer", "vggtransformer_1") -def vggtransformer_1(args): - args.input_feat_per_channel = getattr(args, "input_feat_per_channel", 80) - args.vggblock_enc_config = getattr( - args, "vggblock_enc_config", "[(64, 3, 2, 2, True), (128, 3, 2, 2, True)]" - ) - args.transformer_enc_config = getattr( - args, - "transformer_enc_config", - "((1024, 16, 4096, True, 0.15, 0.15, 0.15),) * 14", - ) - args.enc_output_dim = getattr(args, "enc_output_dim", 1024) - args.tgt_embed_dim = getattr(args, "tgt_embed_dim", 128) - args.conv_dec_config = getattr(args, "conv_dec_config", "((256, 3, True),) * 4") - args.transformer_dec_config = getattr( - args, - "transformer_dec_config", - "((1024, 16, 4096, True, 0.15, 0.15, 0.15),) * 4", - ) - - -@register_model_architecture("asr_vggtransformer", "vggtransformer_2") -def vggtransformer_2(args): - args.input_feat_per_channel = getattr(args, "input_feat_per_channel", 80) - args.vggblock_enc_config = getattr( - args, "vggblock_enc_config", "[(64, 3, 2, 2, True), (128, 3, 2, 2, True)]" - ) - args.transformer_enc_config = getattr( - args, - "transformer_enc_config", - "((1024, 16, 4096, True, 0.15, 0.15, 0.15),) * 16", - ) - args.enc_output_dim = getattr(args, "enc_output_dim", 1024) - args.tgt_embed_dim = getattr(args, "tgt_embed_dim", 512) - args.conv_dec_config = getattr(args, "conv_dec_config", "((256, 3, True),) * 4") - args.transformer_dec_config = getattr( - args, - "transformer_dec_config", - "((1024, 16, 4096, True, 0.15, 0.15, 0.15),) * 6", - ) - - -@register_model_architecture("asr_vggtransformer", "vggtransformer_base") -def vggtransformer_base(args): - args.input_feat_per_channel = getattr(args, "input_feat_per_channel", 80) - args.vggblock_enc_config = getattr( - args, "vggblock_enc_config", "[(64, 3, 2, 2, True), (128, 3, 2, 2, True)]" - ) - args.transformer_enc_config = getattr( - args, "transformer_enc_config", "((512, 8, 2048, True, 0.15, 0.15, 0.15),) * 12" - ) - - args.enc_output_dim = getattr(args, "enc_output_dim", 512) - args.tgt_embed_dim = getattr(args, "tgt_embed_dim", 512) - args.conv_dec_config = getattr(args, "conv_dec_config", "((256, 3, True),) * 4") - args.transformer_dec_config = getattr( - args, "transformer_dec_config", "((512, 8, 2048, True, 0.15, 0.15, 0.15),) * 6" - ) - # Size estimations: - # Encoder: - # - vggblock param: 64*1*3*3 + 64*64*3*3 + 128*64*3*3 + 128*128*3 = 258K - # Transformer: - # - input dimension adapter: 2560 x 512 -> 1.31M - # - transformer_layers (x12) --> 37.74M - # * MultiheadAttention: 512*512*3 (in_proj) + 512*512 (out_proj) = 1.048M - # * FFN weight: 512*2048*2 = 2.097M - # - output dimension adapter: 512 x 512 -> 0.26 M - # Decoder: - # - LinearizedConv1d: 512 * 256 * 3 + 256 * 256 * 3 * 3 - # - transformer_layer: (x6) --> 25.16M - # * MultiheadAttention (self-attention): 512*512*3 + 512*512 = 1.048M - # * MultiheadAttention (encoder-attention): 512*512*3 + 512*512 = 1.048M - # * FFN: 512*2048*2 = 2.097M - # Final FC: - # - FC: 512*5000 = 256K (assuming vocab size 5K) - # In total: - # ~65 M - - -# CTC models -def base_architecture_enconly(args): - args.input_feat_per_channel = getattr(args, "input_feat_per_channel", 40) - args.vggblock_enc_config = getattr( - args, "vggblock_enc_config", "[(32, 3, 2, 2, True)] * 2" - ) - args.transformer_enc_config = getattr( - args, "transformer_enc_config", "((256, 4, 1024, True, 0.2, 0.2, 0.2),) * 2" - ) - args.enc_output_dim = getattr(args, "enc_output_dim", 512) - args.in_channels = getattr(args, "in_channels", 1) - args.transformer_context = getattr(args, "transformer_context", "None") - args.transformer_sampling = getattr(args, "transformer_sampling", "None") - - -@register_model_architecture("asr_vggtransformer_encoder", "vggtransformer_enc_1") -def vggtransformer_enc_1(args): - # vggtransformer_1 is the same as vggtransformer_enc_big, except the number - # of layers is increased to 16 - # keep it here for backward compatiablity purpose - args.input_feat_per_channel = getattr(args, "input_feat_per_channel", 80) - args.vggblock_enc_config = getattr( - args, "vggblock_enc_config", "[(64, 3, 2, 2, True), (128, 3, 2, 2, True)]" - ) - args.transformer_enc_config = getattr( - args, - "transformer_enc_config", - "((1024, 16, 4096, True, 0.15, 0.15, 0.15),) * 16", - ) - args.enc_output_dim = getattr(args, "enc_output_dim", 1024) diff --git a/spaces/mshukor/UnIVAL/fairseq/tests/gpu/test_binaries_gpu.py b/spaces/mshukor/UnIVAL/fairseq/tests/gpu/test_binaries_gpu.py deleted file mode 100644 index de8c2426134089035c6e0e5da223647bab6f3dba..0000000000000000000000000000000000000000 --- a/spaces/mshukor/UnIVAL/fairseq/tests/gpu/test_binaries_gpu.py +++ /dev/null @@ -1,449 +0,0 @@ -# Copyright (c) Facebook, Inc. and its affiliates. -# -# This source code is licensed under the MIT license found in the -# LICENSE file in the root directory of this source tree. - -import contextlib -import logging -import json -import os -import tempfile -import unittest -from io import StringIO - -import torch -from fairseq import options -from fairseq_cli import train -from tests.utils import ( - create_dummy_data, - generate_main, - preprocess_lm_data, - preprocess_translation_data, - train_translation_model, -) - - -@unittest.skipIf(not torch.cuda.is_available(), "test requires a GPU") -class TestTranslationGPU(unittest.TestCase): - def setUp(self): - logging.disable(logging.CRITICAL) - - def tearDown(self): - logging.disable(logging.NOTSET) - - def test_fp16_multigpu(self): - with contextlib.redirect_stdout(StringIO()): - with tempfile.TemporaryDirectory("test_fp16") as data_dir: - log = os.path.join(data_dir, "train.log") - create_dummy_data(data_dir) - preprocess_translation_data(data_dir) - train_translation_model( - data_dir, - "fconv_iwslt_de_en", - ["--fp16", "--log-file", log], - world_size=min(torch.cuda.device_count(), 2), - ) - generate_main(data_dir) - assert os.path.exists(log) - - @staticmethod - def parse_logs(logfile): - logs = [] - for ln in open(logfile, "r").readlines(): - try: - logs.append(json.loads(ln)) - except json.JSONDecodeError: - continue - return logs - - def test_resume_training_fsdp(self): - self._test_resume_training(["--ddp-backend", "fully_sharded"]) - - def test_resume_training_fsdp_sharded_state(self): - self._test_resume_training(["--ddp-backend", "fully_sharded", "--use-sharded-state"]) - - def test_resume_training_noc10d(self): - self._test_resume_training([]) - - def _test_resume_training(self, extra_clargs, arch="fconv_iwslt_de_en"): - flags = [ - "--fp16", - "--log-format", - "json", - "--max-update", - "10", - "--save-interval-updates", - "2", - "--log-interval", - "1", - ] + extra_clargs - world_size = min(torch.cuda.device_count(), 2) - with contextlib.redirect_stdout(StringIO()): - with tempfile.TemporaryDirectory("test_fp16") as data_dir: - log = os.path.join(data_dir, "train.log") - create_dummy_data(data_dir) - preprocess_translation_data(data_dir) - train_translation_model( - data_dir, arch, flags + ["--log-file", log], world_size=world_size, - ) - log2 = os.path.join(data_dir, "resume.log") - restore_file = os.path.join(data_dir, "checkpoint_1_2.pt") - train_translation_model( - data_dir, - arch, - flags + ["--log-file", log2, "--restore-file", restore_file], - world_size=world_size, - ) - - l1 = self.parse_logs(log) - l2 = self.parse_logs(log2) - assert int(l2[0]["num_updates"]) == 3, f"{l1}\n\n {l2}" - for k in [ - "train_loss", - "train_num_updates", - "train_ppl", - "train_gnorm", - ]: - from_scratch, resumed = l1[-1][k], l2[-1][k] - assert ( - from_scratch == resumed - ), f"difference at {k} {from_scratch} != {resumed}" - - def test_memory_efficient_fp16(self): - with contextlib.redirect_stdout(StringIO()): - with tempfile.TemporaryDirectory("test_memory_efficient_fp16") as data_dir: - create_dummy_data(data_dir) - preprocess_translation_data(data_dir) - train_translation_model( - data_dir, "fconv_iwslt_de_en", ["--memory-efficient-fp16"] - ) - generate_main(data_dir) - - def test_transformer_fp16(self): - with contextlib.redirect_stdout(StringIO()): - with tempfile.TemporaryDirectory("test_transformer") as data_dir: - create_dummy_data(data_dir) - preprocess_translation_data(data_dir) - train_translation_model( - data_dir, - "transformer_iwslt_de_en", - [ - "--encoder-layers", - "2", - "--decoder-layers", - "2", - "--encoder-embed-dim", - "64", - "--decoder-embed-dim", - "64", - "--fp16", - ], - run_validation=True, - ) - generate_main(data_dir) - - @unittest.skipIf(not torch.cuda.is_available(), "test requires a GPU") - def test_amp(self): - with contextlib.redirect_stdout(StringIO()): - with tempfile.TemporaryDirectory("test_amp") as data_dir: - create_dummy_data(data_dir) - preprocess_translation_data(data_dir) - train_translation_model(data_dir, "fconv_iwslt_de_en", ["--amp"]) - generate_main(data_dir) - - @unittest.skipIf(not torch.cuda.is_available(), "test requires a GPU") - def test_transformer_amp(self): - with contextlib.redirect_stdout(StringIO()): - with tempfile.TemporaryDirectory("test_transformer") as data_dir: - create_dummy_data(data_dir) - preprocess_translation_data(data_dir) - train_translation_model( - data_dir, - "transformer_iwslt_de_en", - [ - "--encoder-layers", - "2", - "--decoder-layers", - "2", - "--encoder-embed-dim", - "64", - "--decoder-embed-dim", - "64", - "--amp", - ], - run_validation=True, - ) - generate_main(data_dir) - - @unittest.skipIf(not torch.cuda.is_available(), "test requires a GPU") - def test_levenshtein_transformer(self): - with contextlib.redirect_stdout(StringIO()): - with tempfile.TemporaryDirectory( - "test_levenshtein_transformer" - ) as data_dir: - create_dummy_data(data_dir) - preprocess_translation_data(data_dir, ["--joined-dictionary"]) - train_translation_model( - data_dir, - "levenshtein_transformer", - [ - "--apply-bert-init", - "--early-exit", - "6,6,6", - "--criterion", - "nat_loss", - ], - task="translation_lev", - ) - gen_config = [ - "--task", - "translation_lev", - "--iter-decode-max-iter", - "9", - "--iter-decode-eos-penalty", - "0", - "--print-step", - ] - # non-ensemble generation - generate_main(data_dir, gen_config) - # ensemble generation - generate_main( - data_dir, - gen_config, - path=os.pathsep.join( - [ - os.path.join(data_dir, "checkpoint_last.pt"), - os.path.join(data_dir, "checkpoint_last.pt"), - ] - ), - ) - - def test_fsdp_checkpoint_generate(self): - with contextlib.redirect_stdout(StringIO()): - with tempfile.TemporaryDirectory("test_fsdp_sharded") as data_dir: - log = os.path.join(data_dir, "train.log") - create_dummy_data(data_dir) - preprocess_translation_data(data_dir) - world_size = min(torch.cuda.device_count(), 2) - train_translation_model( - data_dir, - "fconv_iwslt_de_en", - ["--log-file", log, "--ddp-backend", "fully_sharded"], - world_size=world_size, - ) - generate_main(data_dir) - assert os.path.exists(log) - - def test_fsdp_sharded_checkpoint_generate(self): - with contextlib.redirect_stdout(StringIO()): - with tempfile.TemporaryDirectory("test_fsdp_sharded") as data_dir: - log = os.path.join(data_dir, "train.log") - create_dummy_data(data_dir) - preprocess_translation_data(data_dir) - world_size = min(torch.cuda.device_count(), 2) - train_translation_model( - data_dir, - "fconv_iwslt_de_en", - ["--log-file", log, "--ddp-backend", "fully_sharded", "--use-sharded-state"], - world_size=world_size, - ) - generate_main(data_dir, ["--checkpoint-shard-count", str(world_size)]) - assert os.path.exists(log) - - -def _quantize_language_model(data_dir, arch, extra_flags=None, run_validation=False): - train_parser = options.get_training_parser() - train_args = options.parse_args_and_arch( - train_parser, - [ - "--task", - "language_modeling", - data_dir, - "--arch", - arch, - "--optimizer", - "adam", - "--lr", - "0.0001", - "--criterion", - "adaptive_loss", - "--adaptive-softmax-cutoff", - "5,10,15", - "--max-tokens", - "500", - "--tokens-per-sample", - "500", - "--save-dir", - data_dir, - "--max-epoch", - "1", - "--no-progress-bar", - "--distributed-world-size", - "1", - "--ddp-backend", - "no_c10d", - "--num-workers", - "0", - ] - + (extra_flags or []), - ) - train.main(train_args) - - # try scalar quantization - scalar_quant_train_parser = options.get_training_parser() - scalar_quant_train_args = options.parse_args_and_arch( - scalar_quant_train_parser, - [ - "--task", - "language_modeling", - data_dir, - "--arch", - arch, - "--optimizer", - "adam", - "--lr", - "0.0001", - "--criterion", - "adaptive_loss", - "--adaptive-softmax-cutoff", - "5,10,15", - "--max-tokens", - "500", - "--tokens-per-sample", - "500", - "--save-dir", - data_dir, - "--max-update", - "3", - "--no-progress-bar", - "--distributed-world-size", - "1", - "--ddp-backend", - "no_c10d", - "--num-workers", - "0", - "--quant-noise-scalar", - "0.5", - ] - + (extra_flags or []), - ) - train.main(scalar_quant_train_args) - - # try iterative PQ quantization - quantize_parser = options.get_training_parser() - quantize_args = options.parse_args_and_arch( - quantize_parser, - [ - "--task", - "language_modeling", - data_dir, - "--arch", - arch, - "--optimizer", - "adam", - "--lr", - "0.0001", - "--criterion", - "adaptive_loss", - "--adaptive-softmax-cutoff", - "5,10,15", - "--max-tokens", - "50", - "--tokens-per-sample", - "50", - "--max-update", - "6", - "--no-progress-bar", - "--distributed-world-size", - "1", - "--ddp-backend", - "no_c10d", - "--num-workers", - "0", - "--restore-file", - os.path.join(data_dir, "checkpoint_last.pt"), - "--reset-optimizer", - "--quantization-config-path", - os.path.join( - os.path.dirname(__file__), "transformer_quantization_config.yaml" - ), - ] - + (extra_flags or []), - ) - train.main(quantize_args) - - -@unittest.skipIf(not torch.cuda.is_available(), "test requires a GPU") -class TestQuantization(unittest.TestCase): - def setUp(self): - logging.disable(logging.CRITICAL) - - def tearDown(self): - logging.disable(logging.NOTSET) - - def test_quantization(self): - with contextlib.redirect_stdout(StringIO()): - with tempfile.TemporaryDirectory("test_quantization") as data_dir: - create_dummy_data(data_dir) - preprocess_lm_data(data_dir) - # tests both scalar and iterative PQ quantization - _quantize_language_model(data_dir, "transformer_lm") - - -@unittest.skipIf(not torch.cuda.is_available(), "test requires a GPU") -class TestOptimizersGPU(unittest.TestCase): - def setUp(self): - logging.disable(logging.CRITICAL) - - def tearDown(self): - logging.disable(logging.NOTSET) - - def test_flat_grads(self): - with contextlib.redirect_stdout(StringIO()): - with tempfile.TemporaryDirectory("test_flat_grads") as data_dir: - # Use just a bit of data and tiny model to keep this test runtime reasonable - create_dummy_data(data_dir, num_examples=10, maxlen=5) - preprocess_translation_data(data_dir) - with self.assertRaises(RuntimeError): - # adafactor isn't compatible with flat grads, which - # are used by default with --fp16 - train_translation_model( - data_dir, - "lstm", - [ - "--required-batch-size-multiple", - "1", - "--encoder-layers", - "1", - "--encoder-hidden-size", - "32", - "--decoder-layers", - "1", - "--optimizer", - "adafactor", - "--fp16", - ], - ) - # but it should pass once we set --fp16-no-flatten-grads - train_translation_model( - data_dir, - "lstm", - [ - "--required-batch-size-multiple", - "1", - "--encoder-layers", - "1", - "--encoder-hidden-size", - "32", - "--decoder-layers", - "1", - "--optimizer", - "adafactor", - "--fp16", - "--fp16-no-flatten-grads", - ], - ) - - -if __name__ == "__main__": - unittest.main() diff --git a/spaces/mthsk/sovits-models-misc/vdecoder/hifigan/env.py b/spaces/mthsk/sovits-models-misc/vdecoder/hifigan/env.py deleted file mode 100644 index 2bdbc95d4f7a8bad8fd4f5eef657e2b51d946056..0000000000000000000000000000000000000000 --- a/spaces/mthsk/sovits-models-misc/vdecoder/hifigan/env.py +++ /dev/null @@ -1,15 +0,0 @@ -import os -import shutil - - -class AttrDict(dict): - def __init__(self, *args, **kwargs): - super(AttrDict, self).__init__(*args, **kwargs) - self.__dict__ = self - - -def build_env(config, config_name, path): - t_path = os.path.join(path, config_name) - if config != t_path: - os.makedirs(path, exist_ok=True) - shutil.copyfile(config, os.path.join(path, config_name)) diff --git a/spaces/mygyasir/stablediffusionapi-epicrealism-epinikio/README.md b/spaces/mygyasir/stablediffusionapi-epicrealism-epinikio/README.md deleted file mode 100644 index 77ee2faf6addbbeb8191da4c0325a2c2bfd8d935..0000000000000000000000000000000000000000 --- a/spaces/mygyasir/stablediffusionapi-epicrealism-epinikio/README.md +++ /dev/null @@ -1,12 +0,0 @@ ---- -title: Stablediffusionapi Epicrealism Epinikio -emoji: 🌍 -colorFrom: indigo -colorTo: yellow -sdk: gradio -sdk_version: 3.40.1 -app_file: app.py -pinned: false ---- - -Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference diff --git a/spaces/myrad01/Inpaint-Anything/third_party/lama/bin/paper_runfiles/blur_tests.sh b/spaces/myrad01/Inpaint-Anything/third_party/lama/bin/paper_runfiles/blur_tests.sh deleted file mode 100644 index 8f204a4c643d08935e5561ed27a286536643958d..0000000000000000000000000000000000000000 --- a/spaces/myrad01/Inpaint-Anything/third_party/lama/bin/paper_runfiles/blur_tests.sh +++ /dev/null @@ -1,37 +0,0 @@ -##!/usr/bin/env bash -# -## !!! file set to make test_large_30k from the vanilla test_large: configs/test_large_30k.lst -# -## paths to data are valid for mml7 -#PLACES_ROOT="/data/inpainting/Places365" -#OUT_DIR="/data/inpainting/paper_data/Places365_val_test" -# -#source "$(dirname $0)/env.sh" -# -#for datadir in test_large_30k # val_large -#do -# for conf in random_thin_256 random_medium_256 random_thick_256 random_thin_512 random_medium_512 random_thick_512 -# do -# "$BINDIR/gen_mask_dataset.py" "$CONFIGDIR/data_gen/${conf}.yaml" \ -# "$PLACES_ROOT/$datadir" "$OUT_DIR/$datadir/$conf" --n-jobs 8 -# -# "$BINDIR/calc_dataset_stats.py" --samples-n 20 "$OUT_DIR/$datadir/$conf" "$OUT_DIR/$datadir/${conf}_stats" -# done -# -# for conf in segm_256 segm_512 -# do -# "$BINDIR/gen_mask_dataset.py" "$CONFIGDIR/data_gen/${conf}.yaml" \ -# "$PLACES_ROOT/$datadir" "$OUT_DIR/$datadir/$conf" --n-jobs 2 -# -# "$BINDIR/calc_dataset_stats.py" --samples-n 20 "$OUT_DIR/$datadir/$conf" "$OUT_DIR/$datadir/${conf}_stats" -# done -#done -# -#IN_DIR="/data/inpainting/paper_data/Places365_val_test/test_large_30k/random_medium_512" -#PRED_DIR="/data/inpainting/predictions/final/images/r.suvorov_2021-03-05_17-08-35_train_ablv2_work_resume_epoch37/random_medium_512" -#BLUR_OUT_DIR="/data/inpainting/predictions/final/blur/images" -# -#for b in 0.1 -# -#"$BINDIR/blur_predicts.py" "$BASEDIR/../../configs/eval2.yaml" "$CUR_IN_DIR" "$CUR_OUT_DIR" "$CUR_EVAL_DIR" -# diff --git a/spaces/nakas/MusicGenDemucs/audiocraft/models/encodec.py b/spaces/nakas/MusicGenDemucs/audiocraft/models/encodec.py deleted file mode 100644 index 69621a695887b0b41614c51cae020f6fd0af221d..0000000000000000000000000000000000000000 --- a/spaces/nakas/MusicGenDemucs/audiocraft/models/encodec.py +++ /dev/null @@ -1,302 +0,0 @@ -# Copyright (c) Meta Platforms, Inc. and affiliates. -# All rights reserved. -# -# This source code is licensed under the license found in the -# LICENSE file in the root directory of this source tree. - -from abc import ABC, abstractmethod -import typing as tp - -from einops import rearrange -import torch -from torch import nn - -from .. import quantization as qt - - -class CompressionModel(ABC, nn.Module): - - @abstractmethod - def forward(self, x: torch.Tensor) -> qt.QuantizedResult: - ... - - @abstractmethod - def encode(self, x: torch.Tensor) -> tp.Tuple[torch.Tensor, tp.Optional[torch.Tensor]]: - """See `EncodecModel.encode`""" - ... - - @abstractmethod - def decode(self, codes: torch.Tensor, scale: tp.Optional[torch.Tensor] = None): - """See `EncodecModel.decode`""" - ... - - @property - @abstractmethod - def channels(self) -> int: - ... - - @property - @abstractmethod - def frame_rate(self) -> int: - ... - - @property - @abstractmethod - def sample_rate(self) -> int: - ... - - @property - @abstractmethod - def cardinality(self) -> int: - ... - - @property - @abstractmethod - def num_codebooks(self) -> int: - ... - - @property - @abstractmethod - def total_codebooks(self) -> int: - ... - - @abstractmethod - def set_num_codebooks(self, n: int): - """Set the active number of codebooks used by the quantizer. - """ - ... - - -class EncodecModel(CompressionModel): - """Encodec model operating on the raw waveform. - - Args: - encoder (nn.Module): Encoder network. - decoder (nn.Module): Decoder network. - quantizer (qt.BaseQuantizer): Quantizer network. - frame_rate (int): Frame rate for the latent representation. - sample_rate (int): Audio sample rate. - channels (int): Number of audio channels. - causal (bool): Whether to use a causal version of the model. - renormalize (bool): Whether to renormalize the audio before running the model. - """ - # we need assignement to override the property in the abstract class, - # I couldn't find a better way... - frame_rate: int = 0 - sample_rate: int = 0 - channels: int = 0 - - def __init__(self, - encoder: nn.Module, - decoder: nn.Module, - quantizer: qt.BaseQuantizer, - frame_rate: int, - sample_rate: int, - channels: int, - causal: bool = False, - renormalize: bool = False): - super().__init__() - self.encoder = encoder - self.decoder = decoder - self.quantizer = quantizer - self.frame_rate = frame_rate - self.sample_rate = sample_rate - self.channels = channels - self.renormalize = renormalize - self.causal = causal - if self.causal: - # we force disabling here to avoid handling linear overlap of segments - # as supported in original EnCodec codebase. - assert not self.renormalize, 'Causal model does not support renormalize' - - @property - def total_codebooks(self): - """Total number of quantizer codebooks available. - """ - return self.quantizer.total_codebooks - - @property - def num_codebooks(self): - """Active number of codebooks used by the quantizer. - """ - return self.quantizer.num_codebooks - - def set_num_codebooks(self, n: int): - """Set the active number of codebooks used by the quantizer. - """ - self.quantizer.set_num_codebooks(n) - - @property - def cardinality(self): - """Cardinality of each codebook. - """ - return self.quantizer.bins - - def preprocess(self, x: torch.Tensor) -> tp.Tuple[torch.Tensor, tp.Optional[torch.Tensor]]: - scale: tp.Optional[torch.Tensor] - if self.renormalize: - mono = x.mean(dim=1, keepdim=True) - volume = mono.pow(2).mean(dim=2, keepdim=True).sqrt() - scale = 1e-8 + volume - x = x / scale - scale = scale.view(-1, 1) - else: - scale = None - return x, scale - - def postprocess(self, - x: torch.Tensor, - scale: tp.Optional[torch.Tensor] = None) -> torch.Tensor: - if scale is not None: - assert self.renormalize - x = x * scale.view(-1, 1, 1) - return x - - def forward(self, x: torch.Tensor) -> qt.QuantizedResult: - assert x.dim() == 3 - length = x.shape[-1] - x, scale = self.preprocess(x) - - emb = self.encoder(x) - q_res = self.quantizer(emb, self.frame_rate) - out = self.decoder(q_res.x) - - # remove extra padding added by the encoder and decoder - assert out.shape[-1] >= length, (out.shape[-1], length) - out = out[..., :length] - - q_res.x = self.postprocess(out, scale) - - return q_res - - def encode(self, x: torch.Tensor) -> tp.Tuple[torch.Tensor, tp.Optional[torch.Tensor]]: - """Encode the given input tensor to quantized representation along with scale parameter. - - Args: - x (torch.Tensor): Float tensor of shape [B, C, T] - - Returns: - codes, scale (tp.Tuple[torch.Tensor, torch.Tensor]): Tuple composed of: - codes a float tensor of shape [B, K, T] with K the number of codebooks used and T the timestep. - scale a float tensor containing the scale for audio renormalizealization. - """ - assert x.dim() == 3 - x, scale = self.preprocess(x) - emb = self.encoder(x) - codes = self.quantizer.encode(emb) - return codes, scale - - def decode(self, codes: torch.Tensor, scale: tp.Optional[torch.Tensor] = None): - """Decode the given codes to a reconstructed representation, using the scale to perform - audio denormalization if needed. - - Args: - codes (torch.Tensor): Int tensor of shape [B, K, T] - scale (tp.Optional[torch.Tensor]): Float tensor containing the scale value. - - Returns: - out (torch.Tensor): Float tensor of shape [B, C, T], the reconstructed audio. - """ - emb = self.quantizer.decode(codes) - out = self.decoder(emb) - out = self.postprocess(out, scale) - # out contains extra padding added by the encoder and decoder - return out - - -class FlattenedCompressionModel(CompressionModel): - """Wraps a CompressionModel and flatten its codebooks, e.g. - instead of returning [B, K, T], return [B, S, T * (K // S)] with - S the number of codebooks per step, and `K // S` the number of 'virtual steps' - for each real time step. - - Args: - model (CompressionModel): compression model to wrap. - codebooks_per_step (int): number of codebooks to keep per step, - this must divide the number of codebooks provided by the wrapped model. - extend_cardinality (bool): if True, and for instance if codebooks_per_step = 1, - if each codebook has a cardinality N, then the first codebook will - use the range [0, N - 1], and the second [N, 2 N - 1] etc. - On decoding, this can lead to potentially invalid sequences. - Any invalid entry will be silently remapped to the proper range - with a modulo. - """ - def __init__(self, model: CompressionModel, codebooks_per_step: int = 1, - extend_cardinality: bool = True): - super().__init__() - self.model = model - self.codebooks_per_step = codebooks_per_step - self.extend_cardinality = extend_cardinality - - @property - def total_codebooks(self): - return self.model.total_codebooks - - @property - def num_codebooks(self): - """Active number of codebooks used by the quantizer. - - ..Warning:: this reports the number of codebooks after the flattening - of the codebooks! - """ - assert self.model.num_codebooks % self.codebooks_per_step == 0 - return self.codebooks_per_step - - def set_num_codebooks(self, n: int): - """Set the active number of codebooks used by the quantizer. - - ..Warning:: this sets the number of codebooks **before** the flattening - of the codebooks. - """ - assert n % self.codebooks_per_step == 0 - self.model.set_num_codebooks(n) - - @property - def num_virtual_steps(self) -> int: - """Return the number of virtual steps, e.g. one real step - will be split into that many steps. - """ - return self.model.num_codebooks // self.codebooks_per_step - - @property - def frame_rate(self) -> int: - return self.model.frame_rate * self.num_virtual_steps - - @property - def sample_rate(self) -> int: - return self.model.sample_rate - - @property - def channels(self) -> int: - return self.model.channels - - @property - def cardinality(self): - """Cardinality of each codebook. - """ - if self.extend_cardinality: - return self.model.cardinality * self.num_virtual_steps - else: - return self.model.cardinality - - def forward(self, x: torch.Tensor) -> qt.QuantizedResult: - raise NotImplementedError("Not supported, use encode and decode.") - - def encode(self, x: torch.Tensor) -> tp.Tuple[torch.Tensor, tp.Optional[torch.Tensor]]: - indices, scales = self.model.encode(x) - B, K, T = indices.shape - indices = rearrange(indices, 'b (k v) t -> b k t v', k=self.codebooks_per_step) - if self.extend_cardinality: - for virtual_step in range(1, self.num_virtual_steps): - indices[..., virtual_step] += self.model.cardinality * virtual_step - indices = rearrange(indices, 'b k t v -> b k (t v)') - return (indices, scales) - - def decode(self, codes: torch.Tensor, scale: tp.Optional[torch.Tensor] = None): - B, K, T = codes.shape - assert T % self.num_virtual_steps == 0 - codes = rearrange(codes, 'b k (t v) -> b (k v) t', v=self.num_virtual_steps) - # We silently ignore potential errors from the LM when - # using extend_cardinality. - codes = codes % self.model.cardinality - return self.model.decode(codes, scale) diff --git a/spaces/nakas/Time-Domain-Audio-Style-Transfer/setup.py b/spaces/nakas/Time-Domain-Audio-Style-Transfer/setup.py deleted file mode 100644 index f24bfb78a4b50fbaa9ffe794fc974825554b03ff..0000000000000000000000000000000000000000 --- a/spaces/nakas/Time-Domain-Audio-Style-Transfer/setup.py +++ /dev/null @@ -1,116 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - -# Note: To use the 'upload' functionality of this file, you must: -# $ pip install twine - -import io -import os -import sys -from shutil import rmtree - -from setuptools import find_packages, setup, Command - -# Package meta-data. -NAME = 'audio_style_transfer' -DESCRIPTION = 'Exploring Audio Style Transfer' -URL = 'https://github.com/pkmital/time-domain-neural-audio-style-transfer' -EMAIL = 'parag@pkmital.com' -AUTHOR = 'Parag Mital' - -# What packages are required for this module to be executed? -REQUIRED = [ - # 'tensorflow-gpu<2.0.0', 'librosa<0.8.0', - # 'magenta' -] - -# The rest you shouldn't have to touch too much :) -# ------------------------------------------------ -# Except, perhaps the License and Trove Classifiers! -# If you do change the License, remember to change the Trove Classifier for that! - -here = os.path.abspath(os.path.dirname(__file__)) - -# Import the README and use it as the long-description. -# Note: this will only work if 'README.rst' is present in your MANIFEST.in file! -with io.open(os.path.join(here, 'README.md'), encoding='utf-8') as f: - long_description = '\n' + f.read() - -# Load the package's __version__.py module as a dictionary. -about = {} -with open(os.path.join(here, NAME, '__version__.py')) as f: - exec(f.read(), about) - - -class UploadCommand(Command): - """Support setup.py upload.""" - - description = 'Build and publish the package.' - user_options = [] - - @staticmethod - def status(s): - """Prints things in bold.""" - print('\033[1m{0}\033[0m'.format(s)) - - def initialize_options(self): - pass - - def finalize_options(self): - pass - - def run(self): - try: - self.status('Removing previous builds…') - rmtree(os.path.join(here, 'dist')) - except OSError: - pass - - self.status('Building Source and Wheel (universal) distribution…') - os.system('{0} setup.py sdist bdist_wheel --universal'.format(sys.executable)) - - self.status('Uploading the package to PyPi via Twine…') - os.system('twine upload dist/*') - - sys.exit() - - -# Where the magic happens: -setup( - name=NAME, - version=about['__version__'], - description=DESCRIPTION, - long_description=long_description, - author=AUTHOR, - author_email=EMAIL, - url=URL, - packages=find_packages(exclude=('tests',)), - # If your package is a single module, use this instead of 'packages': - # py_modules=['mypackage'], - - # entry_points={ - # 'console_scripts': ['mycli=mymodule:cli'], - # }, - install_requires=REQUIRED, - include_package_data=True, - license='MIT', - classifiers=[ - # Trove classifiers - # Full list: https://pypi.python.org/pypi?%3Aaction=list_classifiers - 'License :: OSI Approved :: MIT License', - 'Programming Language :: Python', - 'Programming Language :: Python :: 2.6', - 'Programming Language :: Python :: 2.7', - 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.3', - 'Programming Language :: Python :: 3.4', - 'Programming Language :: Python :: 3.5', - 'Programming Language :: Python :: 3.6', - 'Programming Language :: Python :: Implementation :: CPython', - 'Programming Language :: Python :: Implementation :: PyPy' - ], - # $ setup.py publish support. - cmdclass={ - 'upload': UploadCommand, - }, -) diff --git a/spaces/naliveli/myspace/README.md b/spaces/naliveli/myspace/README.md deleted file mode 100644 index d38191bf0cb83a279a8f7682a24effb4b2df18d5..0000000000000000000000000000000000000000 --- a/spaces/naliveli/myspace/README.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -title: Myspace -emoji: 📈 -colorFrom: red -colorTo: purple -sdk: gradio -sdk_version: 3.34.0 -app_file: app.py -pinned: false -license: apache-2.0 ---- - -Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference diff --git a/spaces/netiMophi/DreamlikeArt-Diffusion-1.0/Crash Time 4 Crack Download Torent.md b/spaces/netiMophi/DreamlikeArt-Diffusion-1.0/Crash Time 4 Crack Download Torent.md deleted file mode 100644 index 28effc04890e7fa5741a1c9d39016d3ac1d87715..0000000000000000000000000000000000000000 --- a/spaces/netiMophi/DreamlikeArt-Diffusion-1.0/Crash Time 4 Crack Download Torent.md +++ /dev/null @@ -1,25 +0,0 @@ -
      -Here is what I came up with: - -

      How to Download and Install Crash Time 4 Crack for Free

      -

      Crash Time 4 is a racing game that features realistic car physics, dynamic weather, and thrilling missions. If you are a fan of this game and want to play it without paying for it, you might be interested in downloading and installing a crack version of it. A crack is a modified version of a game that bypasses the copy protection and allows you to play it for free.

      -

      In this article, I will show you how to download and install Crash Time 4 crack for free using a torrent file. A torrent file is a small file that contains information about the files you want to download from other users who have them. To use a torrent file, you need a torrent client, such as uTorrent or BitTorrent, that can download the files from the torrent network.

      -

      Crash Time 4 Crack Download Torent


      Download ->>->>->> https://urlcod.com/2uIaTY



      -

      Step 1: Download the Crash Time 4 Crack Torrent File

      -

      The first step is to download the Crash Time 4 crack torrent file from a reliable source. There are many websites that offer torrent files for various games, but some of them might be fake or contain viruses. To avoid this, you should always check the comments and ratings of the torrent file before downloading it. You can also use a trusted website like The Pirate Bay or RARBG to find the torrent file you need.

      -

      Once you find the Crash Time 4 crack torrent file, click on the download button and save it to your computer. The file size should be around 2 GB.

      -

      Step 2: Download the Crash Time 4 Crack Files from the Torrent Network

      -

      The next step is to download the Crash Time 4 crack files from the torrent network using your torrent client. To do this, open your torrent client and drag and drop the torrent file into it. Alternatively, you can double-click on the torrent file and choose your torrent client as the default program to open it.

      -

      Your torrent client will start downloading the files from the torrent network. Depending on your internet speed and the number of seeders (users who have the complete files and are sharing them), this might take some time. You can check the progress of the download in your torrent client.

      -

      Step 3: Install the Crash Time 4 Crack Files

      -

      The final step is to install the Crash Time 4 crack files on your computer. To do this, you need to extract the files from the downloaded archive using a program like WinRAR or 7-Zip. You should see a folder named "Crash Time 4" with several files inside.

      -

      Open the folder and run the setup.exe file. Follow the instructions on the screen to install the game on your computer. You might need to choose a destination folder and agree to some terms and conditions.

      -

      After the installation is complete, copy the contents of the "Crack" folder and paste them into the game folder where you installed it. This will replace some of the original files with cracked ones that will allow you to play the game for free.

      -

      Step 4: Enjoy Playing Crash Time 4 for Free

      -

      You are now ready to enjoy playing Crash Time 4 for free on your computer. To launch the game, run the CrashTime.exe file from the game folder. You can also create a shortcut on your desktop for easier access.

      -

      -

      Have fun playing this exciting racing game and completing various missions. You can also play online with other players who have downloaded and installed the same crack version of the game.

      -

      Disclaimer

      -

      This article is for educational purposes only. Downloading and installing cracked games is illegal and might harm your computer or expose you to legal risks. We do not condone or encourage piracy in any way. If you like Crash Time 4, you should buy it from its official website or a legitimate online store.

      e93f5a0c3f
      -
      -
      \ No newline at end of file diff --git a/spaces/netiMophi/DreamlikeArt-Diffusion-1.0/Pretty Little Liars Season 1 720p Web 50.md b/spaces/netiMophi/DreamlikeArt-Diffusion-1.0/Pretty Little Liars Season 1 720p Web 50.md deleted file mode 100644 index 1a22d54e9c6d7ae344a1b3a7ef00e061fa053028..0000000000000000000000000000000000000000 --- a/spaces/netiMophi/DreamlikeArt-Diffusion-1.0/Pretty Little Liars Season 1 720p Web 50.md +++ /dev/null @@ -1,35 +0,0 @@ -
      -Here is a possible title and article with SEO optimization and HTML formatting for the keyword "pretty little liars season 1 720p web 50": - -

      How to Watch Pretty Little Liars Season 1 in HD Quality Online

      - -

      Pretty Little Liars is a popular teen drama series that follows the lives of four friends who are haunted by a mysterious figure known as "A" after the disappearance of their leader, Alison. The show is based on the novels by Sara Shepard and ran for seven seasons from 2010 to 2017.

      -

      pretty little liars season 1 720p web 50


      Download Ziphttps://urlcod.com/2uIbcm



      - -

      If you are a fan of Pretty Little Liars and want to watch the first season in high-definition quality online, you might be wondering where to find it. There are many streaming platforms that offer the show, but not all of them have the best video quality or the latest episodes. In this article, we will show you how to watch Pretty Little Liars season 1 in 720p web 50 quality online using MovieBoxPro, a reliable and safe app that lets you stream thousands of movies and TV shows for free.

      - -

      What is MovieBoxPro?

      - -

      MovieBoxPro is an app that allows you to watch movies and TV shows online for free. You can download it on your Android, iOS, Windows, Mac, or Smart TV devices and enjoy unlimited streaming without ads or registration. MovieBoxPro has a huge library of content that is updated daily with the latest releases and classics. You can also download your favorite titles for offline viewing or cast them to your big screen using Chromecast or AirPlay.

      - -

      How to Watch Pretty Little Liars Season 1 in 720p Web 50 Quality on MovieBoxPro?

      - -

      To watch Pretty Little Liars season 1 in 720p web 50 quality on MovieBoxPro, you need to follow these simple steps:

      - -
        -
      1. Download and install MovieBoxPro on your device. You can find the official link here.
      2. -
      3. Open the app and search for "Pretty Little Liars" in the search bar.
      4. -
      5. Select the show from the results and choose the season and episode you want to watch.
      6. -
      7. Tap on the play button and enjoy watching Pretty Little Liars season 1 in HD quality online.
      8. -
      - -

      That's it! You can now watch Pretty Little Liars season 1 in 720p web 50 quality online using MovieBoxPro. You can also explore other genres and categories on the app and discover new movies and TV shows to watch. MovieBoxPro is a great app for streaming entertainment content online for free.

      -

      - -

      Conclusion

      - -

      Pretty Little Liars is a thrilling and addictive series that will keep you hooked with its twists and turns. If you want to watch the first season in HD quality online, you can use MovieBoxPro, a free and safe app that lets you stream movies and TV shows without ads or registration. MovieBoxPro has a large collection of content that is updated regularly with the newest releases and classics. You can also download your favorite titles for offline viewing or cast them to your big screen using Chromecast or AirPlay.

      - -

      We hope this article helped you learn how to watch Pretty Little Liars season 1 in 720p web 50 quality online using MovieBoxPro. If you have any questions or feedback, feel free to leave a comment below. Happy streaming!

      7196e7f11a
      -
      -
      \ No newline at end of file diff --git a/spaces/nightfury/SD_Studio_AI_Text2Image_Image2Image_Generation/css_and_js.py b/spaces/nightfury/SD_Studio_AI_Text2Image_Image2Image_Generation/css_and_js.py deleted file mode 100644 index 64e6dd5e703281d0b11e7a9ef7f05a264fb2341c..0000000000000000000000000000000000000000 --- a/spaces/nightfury/SD_Studio_AI_Text2Image_Image2Image_Generation/css_and_js.py +++ /dev/null @@ -1,92 +0,0 @@ -from os import path -import json - - -def readTextFile(*args): - dir = path.dirname(__file__) - entry = path.join(dir, *args) - with open(entry, "r", encoding="utf8") as f: - data = f.read() - return data - - -def css(opt): - styling = readTextFile("css", "styles.css") - # TODO: @altryne restore this before merge - if not opt.no_progressbar_hiding: - styling += readTextFile("css", "no_progress_bar.css") - return styling - - -def js(opt): - data = readTextFile("js", "index.js") - data = "(z) => {" + data + "; return z ?? [] }" - return data - - -# TODO : @altryne fix this to the new JS format -js_copy_txt2img_output = "(x) => {navigator.clipboard.writeText(document.querySelector('gradio-app').shadowRoot.querySelector('#highlight .textfield').textContent.replace(/\s+/g,' ').replace(/: /g,':'))}" - - - -js_parse_prompt =""" -(txt2img_prompt, txt2img_width, txt2img_height, txt2img_steps, txt2img_seed, txt2img_batch_count, txt2img_cfg) => { - -const prompt_input = document.querySelector('gradio-app').shadowRoot.querySelector('#prompt_input [data-testid="textbox"]'); -const multiline = document.querySelector('gradio-app').shadowRoot.querySelector('#submit_on_enter label:nth-child(2)') -if (prompt_input.scrollWidth > prompt_input.clientWidth + 10 ) { - multiline.click(); -} - - -let height_match = /(?:-h|-H|--height|height)[ :]?(?\d+) /.exec(txt2img_prompt); -if (height_match) { - txt2img_height = Math.round(height_match.groups.height / 64) * 64; - txt2img_prompt = txt2img_prompt.replace(height_match[0], ''); -} -let width_match = /(?:-w|-W|--width|width)[ :]?(?\d+) /.exec(txt2img_prompt); -if (width_match) { - txt2img_width = Math.round(width_match.groups.width / 64) * 64; - txt2img_prompt = txt2img_prompt.replace(width_match[0], ''); -} -let steps_match = /(?:-s|--steps|steps)[ :]?(?\d+) /.exec(txt2img_prompt); -if (steps_match) { - txt2img_steps = steps_match.groups.steps.trim(); - txt2img_prompt = txt2img_prompt.replace(steps_match[0], ''); -} -let seed_match = /(?:-S|--seed|seed)[ :]?(?\d+) /.exec(txt2img_prompt); -if (seed_match) { - txt2img_seed = seed_match.groups.seed; - txt2img_prompt = txt2img_prompt.replace(seed_match[0], ''); -} -let batch_count_match = /(?:-n|-N|--number|number)[ :]?(?\d+) /.exec(txt2img_prompt); -if (batch_count_match) { - txt2img_batch_count = batch_count_match.groups.batch_count; - txt2img_prompt = txt2img_prompt.replace(batch_count_match[0], ''); -} -let cfg_scale_match = /(?:-c|-C|--cfg-scale|cfg_scale|cfg)[ :]?(?\d\.?\d+?) /.exec(txt2img_prompt); -if (cfg_scale_match) { - txt2img_cfg = parseFloat(cfg_scale_match.groups.cfgscale).toFixed(1); - txt2img_prompt = txt2img_prompt.replace(cfg_scale_match[0], ''); -} -let sampler_match = /(?:-A|--sampler|sampler)[ :]?(?\w+) /.exec(txt2img_prompt); -if (sampler_match) { - - txt2img_prompt = txt2img_prompt.replace(sampler_match[0], ''); -} - -return [txt2img_prompt, parseInt(txt2img_width), parseInt(txt2img_height), parseInt(txt2img_steps), txt2img_seed, parseInt(txt2img_batch_count), parseFloat(txt2img_cfg)]; -} -""" - - -# Wrap the typical SD method call into async closure for ease of use -# Supplies the js function with a params object -# That includes all the passed arguments and input from Gradio: x -# ATTENTION: x is an array of values of all components passed to your -# python event handler -# Example call in Gradio component's event handler (pass the result to _js arg): -# _js=call_JS("myJsMethod", arg1="string", arg2=100, arg3=[]) -def call_JS(sd_method, **kwargs): - param_str = json.dumps(kwargs) - return f"async (...x) => {{ return await SD.{sd_method}({{ x, ...{param_str} }}) ?? []; }}" diff --git a/spaces/nmitchko/AI-in-Healthcare/Developer Meetup in Boston Generative AI Use Cases in Healthcare _files/en_003.js b/spaces/nmitchko/AI-in-Healthcare/Developer Meetup in Boston Generative AI Use Cases in Healthcare _files/en_003.js deleted file mode 100644 index 983d4b01845064414e6533a746ed19866fd49882..0000000000000000000000000000000000000000 --- a/spaces/nmitchko/AI-in-Healthcare/Developer Meetup in Boston Generative AI Use Cases in Healthcare _files/en_003.js +++ /dev/null @@ -1,7 +0,0 @@ -/* -Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved. -For licensing, see LICENSE.md or http://ckeditor.com/license -*/ -CKEDITOR.plugins.setLang("quicktable", "en", { - more: "More", -}); diff --git a/spaces/noamrot/FuseCap-image-captioning/app.py b/spaces/noamrot/FuseCap-image-captioning/app.py deleted file mode 100644 index d5000547872aec72ae1582e7688b158b60343568..0000000000000000000000000000000000000000 --- a/spaces/noamrot/FuseCap-image-captioning/app.py +++ /dev/null @@ -1,36 +0,0 @@ -import gradio as gr -from PIL import Image -import torch -from transformers import BlipProcessor, BlipForConditionalGeneration - -device = torch.device('cuda' if torch.cuda.is_available() else 'cpu') - -processor = BlipProcessor.from_pretrained("noamrot/FuseCap") -model = BlipForConditionalGeneration.from_pretrained("noamrot/FuseCap").to(device) - -def inference(raw_image): - text = "a picture of " - inputs = processor(raw_image, text, return_tensors="pt").to(device) - out = model.generate(**inputs) - caption = processor.decode(out[0], skip_special_tokens=True) - return caption - - -inputs = [gr.Image(type='pil', interactive=False),] -outputs = gr.outputs.Textbox(label="Caption") - -description = "Gradio demo for FuseCap: Leveraging Large Language Models to Fuse Visual Data into Enriched Image Captions. This demo features a BLIP-based model, trained using FuseCap." -examples = [["surfer.jpg"], ["bike.jpg"]] -article = "

      FuseCap: Leveraging Large Language Models to Fuse Visual Data into Enriched Image Captions" - - -iface = gr.Interface(fn=inference, - inputs="image", - outputs="text", - title="FuseCap", - description=description, - article=article, - examples=examples, - enable_queue=True) -iface.launch() - diff --git a/spaces/nomic-ai/glue/README.md b/spaces/nomic-ai/glue/README.md deleted file mode 100644 index 8a99da93a0c9e7bd4adc8314936a1c6f29903608..0000000000000000000000000000000000000000 --- a/spaces/nomic-ai/glue/README.md +++ /dev/null @@ -1,10 +0,0 @@ ---- -title: glue -emoji: 🗺️ -colorFrom: purple -colorTo: red -sdk: static -pinned: false ---- - -Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference diff --git a/spaces/npc0/BookSumBeta/README.md b/spaces/npc0/BookSumBeta/README.md deleted file mode 100644 index fd7f58824a9f7bd1f60e4e843baecd2c0dde0001..0000000000000000000000000000000000000000 --- a/spaces/npc0/BookSumBeta/README.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -title: BookSumBeta -emoji: 📊 -colorFrom: green -colorTo: purple -sdk: gradio -sdk_version: 3.40.1 -app_file: app.py -hf_oauth: true -pinned: false ---- - -Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference diff --git a/spaces/ntt123/WaveGRU-Text-To-Speech/sparse_matmul/compute/gru_gates.h b/spaces/ntt123/WaveGRU-Text-To-Speech/sparse_matmul/compute/gru_gates.h deleted file mode 100644 index 7b8cd489f5c6ef42de262d54727f99c5f9020b82..0000000000000000000000000000000000000000 --- a/spaces/ntt123/WaveGRU-Text-To-Speech/sparse_matmul/compute/gru_gates.h +++ /dev/null @@ -1,214 +0,0 @@ -/* - * Copyright 2021 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef LYRA_CODEC_SPARSE_MATMUL_COMPUTE_GRU_GATES_H_ -#define LYRA_CODEC_SPARSE_MATMUL_COMPUTE_GRU_GATES_H_ - -#include -#include - -// IWYU pragma: begin_exports -#include "sparse_matmul/compute/ar_inputs.h" -#include "sparse_matmul/compute/gru_gates_arm.h" -#include "sparse_matmul/compute/gru_gates_avx_fixed.h" -#include "sparse_matmul/compute/gru_gates_generic.h" -#include "sparse_matmul/compute/matmul.h" -#include "sparse_matmul/numerics/fixed_types.h" -#include "sparse_matmul/numerics/type_utils.h" -#include "sparse_matmul/vector/cache_aligned_vector.h" -// IWYU pragma: end_exports - -namespace csrblocksparse { - -// The master template is really a catch-all for the unimplemented cases to -// run the generics. -template -class GruGates : public MatmulBase { - public: - using SampleWeightType = float; - static constexpr int kSIMDWidth = kGenericSIMDWidth; - - // Generic GRU function covers all uses for WaveRNN-like architectures and - // conditioning. - // Controlled by template parameters thus: - // - |kInputsMode| == |k0ARInputs|: There are no autoregressive inputs so - // |ar_sample0|, |ar_sample1|, |ar_sample2|, |ar_01_weights|, - // |ar_2_weights| are ignored. - // - |kInputsMode| == |k2ARInputs|: |ar_sample0|, |ar_sample1| are multiplied - // by |ar_01_weights| and added to the (conditioning) input. - // - |kInputsMode| == |k3ARInputs|: |ar_sample2| is multiplied by - // |ar_2_weights| and added to the other two |ar_inputs| (and added to the - // conditioning input). - // - If |kSplitGates| is true: The |*gru_recurrent_other_ptr| is secondary - // recurrent input that must be added to |*gru_recurrent_ptr|. - // - |num_replicas| determines the number of duplicates of the output to be - // written, separated by |replica_stride|. - // - |start|, |end| are |rows| in [0, |state_size|] to be processed by this - // thread. - // - // Previous state is read from |*gru_state_ptr| and the new state is written - // to *(|gru_state_ptr| + i * |replica_stride| for i in [0, |num_replicas|)). - template - void GruWithARInput(int start, int end, int state_size, - const InputType* gru_recurrent_ptr, - const InputType* input_ptr, GRUStateType* gru_state_ptr, - const SampleType* ar_sample0 = nullptr, - const SampleType* ar_sample1 = nullptr, - const SampleWeightType* ar_01_weights = nullptr, - int num_replicas = 1, int replica_stride = 0, - const SampleType* ar_sample2 = nullptr, - const SampleWeightType* ar_2_weights = nullptr, - const InputType* gru_recurrent_other_ptr = nullptr) { - CHECK_EQ(num_replicas, 1) << "Generic code should always have 1 replica"; - GoThroughGates( - start, end, ar_01_weights, gru_recurrent_ptr, gru_recurrent_other_ptr, - input_ptr, gru_state_ptr, ar_2_weights, state_size, ar_sample0, - ar_sample1, ar_sample2); - } - - // No AR inputs, no split gates, no batching, no replicated outputs. - // TODO(b/188702959): Redirect conditioning GRU here, removing code from - // gru_layer.h. - // Copy to specializations. - void PlainGru(int start, int end, int state_size, - const InputType* gru_recurrent_ptr, const InputType* input_ptr, - GRUStateType* gru_state_ptr) { - GruWithARInput( - start, end, state_size, gru_recurrent_ptr, input_ptr, gru_state_ptr); - } -}; - -#if defined __ARM_NEON || defined __aarch64__ -// Partial specialization for float. -template <> -class GruGates : public MatmulBase { - public: - static constexpr int kSIMDWidth = kNeonSIMDWidth; - - // Generic GRU function covers all uses for WaveRNN-like architectures and - // conditioning. - template - void GruWithARInput(int start, int end, int state_size, - const float* gru_recurrent_data, const float* input_data, - float* gru_state_data, const float* ar_sample0 = nullptr, - const float* ar_sample1 = nullptr, - const float* ar_01_weights = nullptr, - int num_replicas = 1, int replica_stride = 0, - const float* ar_sample2 = nullptr, - const float* ar_2_weights = nullptr, - const float* gru_recurrent_other_data = nullptr) { - DCHECK_EQ(num_replicas, 1) << "ARM code should always have 1 replica"; - GoThroughGatesFloat( - start, end, ar_01_weights, gru_recurrent_data, gru_recurrent_other_data, - input_data, gru_state_data, ar_2_weights, state_size, ar_sample0, - ar_sample1, ar_sample2); - } -}; -#endif // defined __ARM_NEON || defined __aarch64__ - -// Partial specialization for fixed types. The sample weights are always float -// whatever the fixed type of the other weights. -template -class GruGates, fixed32, - fixed16> : public MatmulBase { - public: -#if defined __ARM_NEON || defined __aarch64__ - static constexpr int kSIMDWidth = kNeonSIMDWidth; -#elif defined __AVX2__ - static constexpr int kSIMDWidth = kAVX2SIMDWidth * 2; -#else // Generic case. - static constexpr int kSIMDWidth = kGenericSIMDWidth; -#endif // __ARM_NEON || defined __aarch64__ / __AVX2__ - - using GRUStateType = fixed16; - using InputType = fixed32; - using SampleType = fixed16; - using SampleWeightType = float; - static constexpr int kInputMantissaBits = InputType::kMantissaBits; - static constexpr int kSampleMantissaBits = SampleType::kMantissaBits; - static constexpr int kStateMantissaBits = GRUStateType::kMantissaBits; - // Generic GRU function covers all uses for WaveRNN-like architectures and - // conditioning. - template - void GruWithARInput(int start, int end, int state_size, - const InputType* gru_recurrent_data, - const InputType* input_data, GRUStateType* gru_state_data, - const SampleType* ar_sample0 = nullptr, - const SampleType* ar_sample1 = nullptr, - const SampleWeightType* ar_01_weights = nullptr, - int num_replicas = 1, int replica_stride = 0, - const SampleType* ar_sample2 = nullptr, - const SampleWeightType* ar_2_weights = nullptr, - const InputType* gru_recurrent_other_data = nullptr) { -#if defined __ARM_NEON || defined __aarch64__ || defined __AVX2__ - const int32_t* gru_recurrent_ptr = - reinterpret_cast(gru_recurrent_data); - const int32_t* gru_recurrent_other_ptr = - reinterpret_cast(gru_recurrent_other_data); - const int32_t* input_ptr = reinterpret_cast(input_data); - int16_t* gru_state_ptr = reinterpret_cast(gru_state_data); -#if defined __AVX2__ - // The samples are fixed16, but we scale them up here and convert to float - // so that the product with the QR weights is always on the same scale as - // InputType, so we don't have to do any more scaling inside. - const float sample_factor = static_cast(1 << kInputMantissaBits); -#else - const float sample_factor = 1.0f; -#endif - // AR sample 0 and 1 are packed into a pair because the QR weights are - // formatted with the weights interleaved for sample 0 and 1. - std::pair ar_sample01; - float ar_sample2_float = 0.0f; - if (kInputsMode == ARInputsMode::k2ARInputs || - kInputsMode == ARInputsMode::k3ARInputs) { - ar_sample01 = {static_cast(*ar_sample0) * sample_factor, - static_cast(*ar_sample1) * sample_factor}; - if (kInputsMode == ARInputsMode::k3ARInputs) { - ar_sample2_float = static_cast(*ar_sample2) * sample_factor; - } - } -#if defined __AVX2__ - CHECK(using_avx2_) << "Compiled for AVX2, but cpu flag not set!"; - GruGatesAVXFixed( - start, end, state_size, gru_recurrent_ptr, input_ptr, &ar_sample01, - ar_01_weights, num_replicas, replica_stride, &ar_sample2_float, - ar_2_weights, gru_recurrent_other_ptr, gru_state_ptr); -#else // ARM. - DCHECK_EQ(num_replicas, 1) << "ARM code should always have 1 replica"; - GoThroughGatesFixed( - start, end, ar_01_weights, gru_recurrent_ptr, gru_recurrent_other_ptr, - input_ptr, gru_state_ptr, ar_2_weights, state_size, &ar_sample01, - &ar_sample2_float); -#endif // __AVX2__ / ARM. -#else // Generic case. - CHECK_EQ(num_replicas, 1) << "Generic code should always have 1 replica"; - GoThroughGates( - start, end, ar_01_weights, gru_recurrent_data, gru_recurrent_other_data, - input_data, gru_state_data, ar_2_weights, state_size, ar_sample0, - ar_sample1, ar_sample2); -#endif // __ARM_NEON || defined __aarch64__ / __AVX2__ - } -}; - -} // namespace csrblocksparse - -#endif // LYRA_CODEC_SPARSE_MATMUL_COMPUTE_GRU_GATES_H_ diff --git a/spaces/odettecantswim/rvc-mlbb-v2/lib/infer_pack/attentions.py b/spaces/odettecantswim/rvc-mlbb-v2/lib/infer_pack/attentions.py deleted file mode 100644 index 05501be1871643f78dddbeaa529c96667031a8db..0000000000000000000000000000000000000000 --- a/spaces/odettecantswim/rvc-mlbb-v2/lib/infer_pack/attentions.py +++ /dev/null @@ -1,417 +0,0 @@ -import copy -import math -import numpy as np -import torch -from torch import nn -from torch.nn import functional as F - -from lib.infer_pack import commons -from lib.infer_pack import modules -from lib.infer_pack.modules import LayerNorm - - -class Encoder(nn.Module): - def __init__( - self, - hidden_channels, - filter_channels, - n_heads, - n_layers, - kernel_size=1, - p_dropout=0.0, - window_size=10, - **kwargs - ): - super().__init__() - self.hidden_channels = hidden_channels - self.filter_channels = filter_channels - self.n_heads = n_heads - self.n_layers = n_layers - self.kernel_size = kernel_size - self.p_dropout = p_dropout - self.window_size = window_size - - self.drop = nn.Dropout(p_dropout) - self.attn_layers = nn.ModuleList() - self.norm_layers_1 = nn.ModuleList() - self.ffn_layers = nn.ModuleList() - self.norm_layers_2 = nn.ModuleList() - for i in range(self.n_layers): - self.attn_layers.append( - MultiHeadAttention( - hidden_channels, - hidden_channels, - n_heads, - p_dropout=p_dropout, - window_size=window_size, - ) - ) - self.norm_layers_1.append(LayerNorm(hidden_channels)) - self.ffn_layers.append( - FFN( - hidden_channels, - hidden_channels, - filter_channels, - kernel_size, - p_dropout=p_dropout, - ) - ) - self.norm_layers_2.append(LayerNorm(hidden_channels)) - - def forward(self, x, x_mask): - attn_mask = x_mask.unsqueeze(2) * x_mask.unsqueeze(-1) - x = x * x_mask - for i in range(self.n_layers): - y = self.attn_layers[i](x, x, attn_mask) - y = self.drop(y) - x = self.norm_layers_1[i](x + y) - - y = self.ffn_layers[i](x, x_mask) - y = self.drop(y) - x = self.norm_layers_2[i](x + y) - x = x * x_mask - return x - - -class Decoder(nn.Module): - def __init__( - self, - hidden_channels, - filter_channels, - n_heads, - n_layers, - kernel_size=1, - p_dropout=0.0, - proximal_bias=False, - proximal_init=True, - **kwargs - ): - super().__init__() - self.hidden_channels = hidden_channels - self.filter_channels = filter_channels - self.n_heads = n_heads - self.n_layers = n_layers - self.kernel_size = kernel_size - self.p_dropout = p_dropout - self.proximal_bias = proximal_bias - self.proximal_init = proximal_init - - self.drop = nn.Dropout(p_dropout) - self.self_attn_layers = nn.ModuleList() - self.norm_layers_0 = nn.ModuleList() - self.encdec_attn_layers = nn.ModuleList() - self.norm_layers_1 = nn.ModuleList() - self.ffn_layers = nn.ModuleList() - self.norm_layers_2 = nn.ModuleList() - for i in range(self.n_layers): - self.self_attn_layers.append( - MultiHeadAttention( - hidden_channels, - hidden_channels, - n_heads, - p_dropout=p_dropout, - proximal_bias=proximal_bias, - proximal_init=proximal_init, - ) - ) - self.norm_layers_0.append(LayerNorm(hidden_channels)) - self.encdec_attn_layers.append( - MultiHeadAttention( - hidden_channels, hidden_channels, n_heads, p_dropout=p_dropout - ) - ) - self.norm_layers_1.append(LayerNorm(hidden_channels)) - self.ffn_layers.append( - FFN( - hidden_channels, - hidden_channels, - filter_channels, - kernel_size, - p_dropout=p_dropout, - causal=True, - ) - ) - self.norm_layers_2.append(LayerNorm(hidden_channels)) - - def forward(self, x, x_mask, h, h_mask): - """ - x: decoder input - h: encoder output - """ - self_attn_mask = commons.subsequent_mask(x_mask.size(2)).to( - device=x.device, dtype=x.dtype - ) - encdec_attn_mask = h_mask.unsqueeze(2) * x_mask.unsqueeze(-1) - x = x * x_mask - for i in range(self.n_layers): - y = self.self_attn_layers[i](x, x, self_attn_mask) - y = self.drop(y) - x = self.norm_layers_0[i](x + y) - - y = self.encdec_attn_layers[i](x, h, encdec_attn_mask) - y = self.drop(y) - x = self.norm_layers_1[i](x + y) - - y = self.ffn_layers[i](x, x_mask) - y = self.drop(y) - x = self.norm_layers_2[i](x + y) - x = x * x_mask - return x - - -class MultiHeadAttention(nn.Module): - def __init__( - self, - channels, - out_channels, - n_heads, - p_dropout=0.0, - window_size=None, - heads_share=True, - block_length=None, - proximal_bias=False, - proximal_init=False, - ): - super().__init__() - assert channels % n_heads == 0 - - self.channels = channels - self.out_channels = out_channels - self.n_heads = n_heads - self.p_dropout = p_dropout - self.window_size = window_size - self.heads_share = heads_share - self.block_length = block_length - self.proximal_bias = proximal_bias - self.proximal_init = proximal_init - self.attn = None - - self.k_channels = channels // n_heads - self.conv_q = nn.Conv1d(channels, channels, 1) - self.conv_k = nn.Conv1d(channels, channels, 1) - self.conv_v = nn.Conv1d(channels, channels, 1) - self.conv_o = nn.Conv1d(channels, out_channels, 1) - self.drop = nn.Dropout(p_dropout) - - if window_size is not None: - n_heads_rel = 1 if heads_share else n_heads - rel_stddev = self.k_channels**-0.5 - self.emb_rel_k = nn.Parameter( - torch.randn(n_heads_rel, window_size * 2 + 1, self.k_channels) - * rel_stddev - ) - self.emb_rel_v = nn.Parameter( - torch.randn(n_heads_rel, window_size * 2 + 1, self.k_channels) - * rel_stddev - ) - - nn.init.xavier_uniform_(self.conv_q.weight) - nn.init.xavier_uniform_(self.conv_k.weight) - nn.init.xavier_uniform_(self.conv_v.weight) - if proximal_init: - with torch.no_grad(): - self.conv_k.weight.copy_(self.conv_q.weight) - self.conv_k.bias.copy_(self.conv_q.bias) - - def forward(self, x, c, attn_mask=None): - q = self.conv_q(x) - k = self.conv_k(c) - v = self.conv_v(c) - - x, self.attn = self.attention(q, k, v, mask=attn_mask) - - x = self.conv_o(x) - return x - - def attention(self, query, key, value, mask=None): - # reshape [b, d, t] -> [b, n_h, t, d_k] - b, d, t_s, t_t = (*key.size(), query.size(2)) - query = query.view(b, self.n_heads, self.k_channels, t_t).transpose(2, 3) - key = key.view(b, self.n_heads, self.k_channels, t_s).transpose(2, 3) - value = value.view(b, self.n_heads, self.k_channels, t_s).transpose(2, 3) - - scores = torch.matmul(query / math.sqrt(self.k_channels), key.transpose(-2, -1)) - if self.window_size is not None: - assert ( - t_s == t_t - ), "Relative attention is only available for self-attention." - key_relative_embeddings = self._get_relative_embeddings(self.emb_rel_k, t_s) - rel_logits = self._matmul_with_relative_keys( - query / math.sqrt(self.k_channels), key_relative_embeddings - ) - scores_local = self._relative_position_to_absolute_position(rel_logits) - scores = scores + scores_local - if self.proximal_bias: - assert t_s == t_t, "Proximal bias is only available for self-attention." - scores = scores + self._attention_bias_proximal(t_s).to( - device=scores.device, dtype=scores.dtype - ) - if mask is not None: - scores = scores.masked_fill(mask == 0, -1e4) - if self.block_length is not None: - assert ( - t_s == t_t - ), "Local attention is only available for self-attention." - block_mask = ( - torch.ones_like(scores) - .triu(-self.block_length) - .tril(self.block_length) - ) - scores = scores.masked_fill(block_mask == 0, -1e4) - p_attn = F.softmax(scores, dim=-1) # [b, n_h, t_t, t_s] - p_attn = self.drop(p_attn) - output = torch.matmul(p_attn, value) - if self.window_size is not None: - relative_weights = self._absolute_position_to_relative_position(p_attn) - value_relative_embeddings = self._get_relative_embeddings( - self.emb_rel_v, t_s - ) - output = output + self._matmul_with_relative_values( - relative_weights, value_relative_embeddings - ) - output = ( - output.transpose(2, 3).contiguous().view(b, d, t_t) - ) # [b, n_h, t_t, d_k] -> [b, d, t_t] - return output, p_attn - - def _matmul_with_relative_values(self, x, y): - """ - x: [b, h, l, m] - y: [h or 1, m, d] - ret: [b, h, l, d] - """ - ret = torch.matmul(x, y.unsqueeze(0)) - return ret - - def _matmul_with_relative_keys(self, x, y): - """ - x: [b, h, l, d] - y: [h or 1, m, d] - ret: [b, h, l, m] - """ - ret = torch.matmul(x, y.unsqueeze(0).transpose(-2, -1)) - return ret - - def _get_relative_embeddings(self, relative_embeddings, length): - max_relative_position = 2 * self.window_size + 1 - # Pad first before slice to avoid using cond ops. - pad_length = max(length - (self.window_size + 1), 0) - slice_start_position = max((self.window_size + 1) - length, 0) - slice_end_position = slice_start_position + 2 * length - 1 - if pad_length > 0: - padded_relative_embeddings = F.pad( - relative_embeddings, - commons.convert_pad_shape([[0, 0], [pad_length, pad_length], [0, 0]]), - ) - else: - padded_relative_embeddings = relative_embeddings - used_relative_embeddings = padded_relative_embeddings[ - :, slice_start_position:slice_end_position - ] - return used_relative_embeddings - - def _relative_position_to_absolute_position(self, x): - """ - x: [b, h, l, 2*l-1] - ret: [b, h, l, l] - """ - batch, heads, length, _ = x.size() - # Concat columns of pad to shift from relative to absolute indexing. - x = F.pad(x, commons.convert_pad_shape([[0, 0], [0, 0], [0, 0], [0, 1]])) - - # Concat extra elements so to add up to shape (len+1, 2*len-1). - x_flat = x.view([batch, heads, length * 2 * length]) - x_flat = F.pad( - x_flat, commons.convert_pad_shape([[0, 0], [0, 0], [0, length - 1]]) - ) - - # Reshape and slice out the padded elements. - x_final = x_flat.view([batch, heads, length + 1, 2 * length - 1])[ - :, :, :length, length - 1 : - ] - return x_final - - def _absolute_position_to_relative_position(self, x): - """ - x: [b, h, l, l] - ret: [b, h, l, 2*l-1] - """ - batch, heads, length, _ = x.size() - # padd along column - x = F.pad( - x, commons.convert_pad_shape([[0, 0], [0, 0], [0, 0], [0, length - 1]]) - ) - x_flat = x.view([batch, heads, length**2 + length * (length - 1)]) - # add 0's in the beginning that will skew the elements after reshape - x_flat = F.pad(x_flat, commons.convert_pad_shape([[0, 0], [0, 0], [length, 0]])) - x_final = x_flat.view([batch, heads, length, 2 * length])[:, :, :, 1:] - return x_final - - def _attention_bias_proximal(self, length): - """Bias for self-attention to encourage attention to close positions. - Args: - length: an integer scalar. - Returns: - a Tensor with shape [1, 1, length, length] - """ - r = torch.arange(length, dtype=torch.float32) - diff = torch.unsqueeze(r, 0) - torch.unsqueeze(r, 1) - return torch.unsqueeze(torch.unsqueeze(-torch.log1p(torch.abs(diff)), 0), 0) - - -class FFN(nn.Module): - def __init__( - self, - in_channels, - out_channels, - filter_channels, - kernel_size, - p_dropout=0.0, - activation=None, - causal=False, - ): - super().__init__() - self.in_channels = in_channels - self.out_channels = out_channels - self.filter_channels = filter_channels - self.kernel_size = kernel_size - self.p_dropout = p_dropout - self.activation = activation - self.causal = causal - - if causal: - self.padding = self._causal_padding - else: - self.padding = self._same_padding - - self.conv_1 = nn.Conv1d(in_channels, filter_channels, kernel_size) - self.conv_2 = nn.Conv1d(filter_channels, out_channels, kernel_size) - self.drop = nn.Dropout(p_dropout) - - def forward(self, x, x_mask): - x = self.conv_1(self.padding(x * x_mask)) - if self.activation == "gelu": - x = x * torch.sigmoid(1.702 * x) - else: - x = torch.relu(x) - x = self.drop(x) - x = self.conv_2(self.padding(x * x_mask)) - return x * x_mask - - def _causal_padding(self, x): - if self.kernel_size == 1: - return x - pad_l = self.kernel_size - 1 - pad_r = 0 - padding = [[0, 0], [0, 0], [pad_l, pad_r]] - x = F.pad(x, commons.convert_pad_shape(padding)) - return x - - def _same_padding(self, x): - if self.kernel_size == 1: - return x - pad_l = (self.kernel_size - 1) // 2 - pad_r = self.kernel_size // 2 - padding = [[0, 0], [0, 0], [pad_l, pad_r]] - x = F.pad(x, commons.convert_pad_shape(padding)) - return x diff --git "a/spaces/oskarvanderwal/MT-bias-demo/results/simple_tud\303\263s_en.html" "b/spaces/oskarvanderwal/MT-bias-demo/results/simple_tud\303\263s_en.html" deleted file mode 100644 index 2a6452755bb43166b08d9ef570000b03d9cc8aaf..0000000000000000000000000000000000000000 --- "a/spaces/oskarvanderwal/MT-bias-demo/results/simple_tud\303\263s_en.html" +++ /dev/null @@ -1,46 +0,0 @@ -
      0th instance:
      - -

      -
      -
      - -
      -
      - Source Saliency Heatmap -
      - x: Generated tokens, y: Attributed tokens -
      - - - -
      ▁He's▁a▁scientist.</s>
      ▁Ő0.3990.2340.2060.0410.1110.145-0.526
      ▁tudós0.9150.7030.5490.1620.8490.6420.486
      .0.0570.4410.0970.017-0.1050.6080.049
      </s>0.00.00.00.00.00.00.0
      -
      - -
      -
      -
      - -
      0th instance:
      - -
      -
      -
      - -
      -
      - Target Saliency Heatmap -
      - x: Generated tokens, y: Attributed tokens -
      - - - -
      ▁He's▁a▁scientist.</s>
      ▁He0.5070.6180.240.1270.0990.327
      '0.5150.2320.2310.0990.523
      s0.9280.4050.401-0.048
      ▁a0.1470.0480.312
      ▁scientist0.1190.054
      .0.044
      </s>
      -
      - -
      -
      -
      - diff --git a/spaces/pablodawson/ldm3d-inpainting/diffuserslocal/docs/source/en/api/pipelines/stable_diffusion/stable_diffusion_2.md b/spaces/pablodawson/ldm3d-inpainting/diffuserslocal/docs/source/en/api/pipelines/stable_diffusion/stable_diffusion_2.md deleted file mode 100644 index d44e9f507830e8c8afa026a404cfb0f093b8edb9..0000000000000000000000000000000000000000 --- a/spaces/pablodawson/ldm3d-inpainting/diffuserslocal/docs/source/en/api/pipelines/stable_diffusion/stable_diffusion_2.md +++ /dev/null @@ -1,139 +0,0 @@ - - -# Stable Diffusion 2 - -Stable Diffusion 2 is a text-to-image _latent diffusion_ model built upon the work of the original [Stable Diffusion](https://stability.ai/blog/stable-diffusion-public-release), and it was led by Robin Rombach and Katherine Crowson from [Stability AI](https://stability.ai/) and [LAION](https://laion.ai/). - -*The Stable Diffusion 2.0 release includes robust text-to-image models trained using a brand new text encoder (OpenCLIP), developed by LAION with support from Stability AI, which greatly improves the quality of the generated images compared to earlier V1 releases. The text-to-image models in this release can generate images with default resolutions of both 512x512 pixels and 768x768 pixels. -These models are trained on an aesthetic subset of the [LAION-5B dataset](https://laion.ai/blog/laion-5b/) created by the DeepFloyd team at Stability AI, which is then further filtered to remove adult content using [LAION’s NSFW filter](https://openreview.net/forum?id=M3Y74vmsMcY).* - -For more details about how Stable Diffusion 2 works and how it differs from the original Stable Diffusion, please refer to the official [announcement post](https://stability.ai/blog/stable-diffusion-v2-release). - -The architecture of Stable Diffusion 2 is more or less identical to the original [Stable Diffusion model](./text2img) so check out it's API documentation for how to use Stable Diffusion 2. We recommend using the [`DPMSolverMultistepScheduler`] as it's currently the fastest scheduler. - -Stable Diffusion 2 is available for tasks like text-to-image, inpainting, super-resolution, and depth-to-image: - -| Task | Repository | -|-------------------------|---------------------------------------------------------------------------------------------------------------| -| text-to-image (512x512) | [stabilityai/stable-diffusion-2-base](https://huggingface.co/stabilityai/stable-diffusion-2-base) | -| text-to-image (768x768) | [stabilityai/stable-diffusion-2](https://huggingface.co/stabilityai/stable-diffusion-2) | -| inpainting | [stabilityai/stable-diffusion-2-inpainting](https://huggingface.co/stabilityai/stable-diffusion-2-inpainting) | -| super-resolution | [stable-diffusion-x4-upscaler](https://huggingface.co/stabilityai/stable-diffusion-x4-upscaler) | -| depth-to-image | [stabilityai/stable-diffusion-2-depth](https://huggingface.co/stabilityai/stable-diffusion-2-depth) | - -Here are some examples for how to use Stable Diffusion 2 for each task: - - - -Make sure to check out the Stable Diffusion [Tips](overview#tips) section to learn how to explore the tradeoff between scheduler speed and quality, and how to reuse pipeline components efficiently! - -If you're interested in using one of the official checkpoints for a task, explore the [CompVis](https://huggingface.co/CompVis), [Runway](https://huggingface.co/runwayml), and [Stability AI](https://huggingface.co/stabilityai) Hub organizations! - - - -## Text-to-image - -```py -from diffusers import DiffusionPipeline, DPMSolverMultistepScheduler -import torch - -repo_id = "stabilityai/stable-diffusion-2-base" -pipe = DiffusionPipeline.from_pretrained(repo_id, torch_dtype=torch.float16, revision="fp16") - -pipe.scheduler = DPMSolverMultistepScheduler.from_config(pipe.scheduler.config) -pipe = pipe.to("cuda") - -prompt = "High quality photo of an astronaut riding a horse in space" -image = pipe(prompt, num_inference_steps=25).images[0] -image.save("astronaut.png") -``` - -## Inpainting - -```py -import PIL -import requests -import torch -from io import BytesIO - -from diffusers import DiffusionPipeline, DPMSolverMultistepScheduler - - -def download_image(url): - response = requests.get(url) - return PIL.Image.open(BytesIO(response.content)).convert("RGB") - - -img_url = "https://raw.githubusercontent.com/CompVis/latent-diffusion/main/data/inpainting_examples/overture-creations-5sI6fQgYIuo.png" -mask_url = "https://raw.githubusercontent.com/CompVis/latent-diffusion/main/data/inpainting_examples/overture-creations-5sI6fQgYIuo_mask.png" - -init_image = download_image(img_url).resize((512, 512)) -mask_image = download_image(mask_url).resize((512, 512)) - -repo_id = "stabilityai/stable-diffusion-2-inpainting" -pipe = DiffusionPipeline.from_pretrained(repo_id, torch_dtype=torch.float16, revision="fp16") - -pipe.scheduler = DPMSolverMultistepScheduler.from_config(pipe.scheduler.config) -pipe = pipe.to("cuda") - -prompt = "Face of a yellow cat, high resolution, sitting on a park bench" -image = pipe(prompt=prompt, image=init_image, mask_image=mask_image, num_inference_steps=25).images[0] - -image.save("yellow_cat.png") -``` - -## Super-resolution - -```py -import requests -from PIL import Image -from io import BytesIO -from diffusers import StableDiffusionUpscalePipeline -import torch - -# load model and scheduler -model_id = "stabilityai/stable-diffusion-x4-upscaler" -pipeline = StableDiffusionUpscalePipeline.from_pretrained(model_id, torch_dtype=torch.float16) -pipeline = pipeline.to("cuda") - -# let's download an image -url = "https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/sd2-upscale/low_res_cat.png" -response = requests.get(url) -low_res_img = Image.open(BytesIO(response.content)).convert("RGB") -low_res_img = low_res_img.resize((128, 128)) -prompt = "a white cat" -upscaled_image = pipeline(prompt=prompt, image=low_res_img).images[0] -upscaled_image.save("upsampled_cat.png") -``` - -## Depth-to-image - -```py -import torch -import requests -from PIL import Image - -from diffusers import StableDiffusionDepth2ImgPipeline - -pipe = StableDiffusionDepth2ImgPipeline.from_pretrained( - "stabilityai/stable-diffusion-2-depth", - torch_dtype=torch.float16, -).to("cuda") - - -url = "http://images.cocodataset.org/val2017/000000039769.jpg" -init_image = Image.open(requests.get(url, stream=True).raw) -prompt = "two tigers" -n_propmt = "bad, deformed, ugly, bad anotomy" -image = pipe(prompt=prompt, image=init_image, negative_prompt=n_propmt, strength=0.7).images[0] -``` \ No newline at end of file diff --git a/spaces/paulengstler/interpretable-vertebral-fracture-diagnosis/netdissect/upsegmodel/prroi_pool/README.md b/spaces/paulengstler/interpretable-vertebral-fracture-diagnosis/netdissect/upsegmodel/prroi_pool/README.md deleted file mode 100644 index bb98946d3b48a2069a58f179eb6da63e009c3849..0000000000000000000000000000000000000000 --- a/spaces/paulengstler/interpretable-vertebral-fracture-diagnosis/netdissect/upsegmodel/prroi_pool/README.md +++ /dev/null @@ -1,66 +0,0 @@ -# PreciseRoIPooling -This repo implements the **Precise RoI Pooling** (PrRoI Pooling), proposed in the paper **Acquisition of Localization Confidence for Accurate Object Detection** published at ECCV 2018 (Oral Presentation). - -**Acquisition of Localization Confidence for Accurate Object Detection** - -_Borui Jiang*, Ruixuan Luo*, Jiayuan Mao*, Tete Xiao, Yuning Jiang_ (* indicates equal contribution.) - -https://arxiv.org/abs/1807.11590 - -## Brief - -In short, Precise RoI Pooling is an integration-based (bilinear interpolation) average pooling method for RoI Pooling. It avoids any quantization and has a continuous gradient on bounding box coordinates. It is: - -- different from the original RoI Pooling proposed in [Fast R-CNN](https://arxiv.org/abs/1504.08083). PrRoI Pooling uses average pooling instead of max pooling for each bin and has a continuous gradient on bounding box coordinates. That is, one can take the derivatives of some loss function w.r.t the coordinates of each RoI and optimize the RoI coordinates. -- different from the RoI Align proposed in [Mask R-CNN](https://arxiv.org/abs/1703.06870). PrRoI Pooling uses a full integration-based average pooling instead of sampling a constant number of points. This makes the gradient w.r.t. the coordinates continuous. - -For a better illustration, we illustrate RoI Pooling, RoI Align and PrRoI Pooing in the following figure. More details including the gradient computation can be found in our paper. - -
      - -## Implementation - -PrRoI Pooling was originally implemented by [Tete Xiao](http://tetexiao.com/) based on MegBrain, an (internal) deep learning framework built by Megvii Inc. It was later adapted into open-source deep learning frameworks. Currently, we only support PyTorch. Unfortunately, we don't have any specific plan for the adaptation into other frameworks such as TensorFlow, but any contributions (pull requests) will be more than welcome. - -## Usage (PyTorch 1.0) - -In the directory `pytorch/`, we provide a PyTorch-based implementation of PrRoI Pooling. It requires PyTorch 1.0+ and only supports CUDA (CPU mode is not implemented). -Since we use PyTorch JIT for cxx/cuda code compilation, to use the module in your code, simply do: - -``` -from prroi_pool import PrRoIPool2D - -avg_pool = PrRoIPool2D(window_height, window_width, spatial_scale) -roi_features = avg_pool(features, rois) - -# for those who want to use the "functional" - -from prroi_pool.functional import prroi_pool2d -roi_features = prroi_pool2d(features, rois, window_height, window_width, spatial_scale) -``` - - -## Usage (PyTorch 0.4) - -**!!! Please first checkout to the branch pytorch0.4.** - -In the directory `pytorch/`, we provide a PyTorch-based implementation of PrRoI Pooling. It requires PyTorch 0.4 and only supports CUDA (CPU mode is not implemented). -To use the PrRoI Pooling module, first goto `pytorch/prroi_pool` and execute `./travis.sh` to compile the essential components (you may need `nvcc` for this step). To use the module in your code, simply do: - -``` -from prroi_pool import PrRoIPool2D - -avg_pool = PrRoIPool2D(window_height, window_width, spatial_scale) -roi_features = avg_pool(features, rois) - -# for those who want to use the "functional" - -from prroi_pool.functional import prroi_pool2d -roi_features = prroi_pool2d(features, rois, window_height, window_width, spatial_scale) -``` - -Here, - -- RoI is an `m * 5` float tensor of format `(batch_index, x0, y0, x1, y1)`, following the convention in the original Caffe implementation of RoI Pooling, although in some frameworks the batch indices are provided by an integer tensor. -- `spatial_scale` is multiplied to the RoIs. For example, if your feature maps are down-sampled by a factor of 16 (w.r.t. the input image), you should use a spatial scale of `1/16`. -- The coordinates for RoI follows the [L, R) convension. That is, `(0, 0, 4, 4)` denotes a box of size `4x4`. diff --git a/spaces/paulokewunmi/jumia_product_search/image_search_engine/models/arc_margin_product.py b/spaces/paulokewunmi/jumia_product_search/image_search_engine/models/arc_margin_product.py deleted file mode 100644 index e89f5d78f8af4565567bd0f36aa4b3aa0647f275..0000000000000000000000000000000000000000 --- a/spaces/paulokewunmi/jumia_product_search/image_search_engine/models/arc_margin_product.py +++ /dev/null @@ -1,60 +0,0 @@ -import math - -import torch -import torch.nn.functional as F -from torch import nn - -ENABLE_HALF_PRECISION = False -DEVICE = torch.device("cuda" if torch.cuda.is_available() else "cpu") - - -class ArcMarginProduct(nn.Module): - r"""Implement of large margin arc distance: : - Args: - in_features: size of each input sample - out_features: size of each output sample - s: norm of input feature - m: margin - cos(theta + m) - """ - - def __init__( - self, in_features, out_features, s=10, m=0.10, easy_margin=False, ls_eps=0.0 - ): - super(ArcMarginProduct, self).__init__() - self.in_features = in_features - self.out_features = out_features - self.s = s - self.m = m - self.ls_eps = ls_eps # label smoothing - self.weight = nn.Parameter(torch.FloatTensor(out_features, in_features)) - nn.init.xavier_uniform_(self.weight) - - self.easy_margin = easy_margin - self.cos_m = math.cos(m) - self.sin_m = math.sin(m) - self.th = math.cos(math.pi - m) - self.mm = math.sin(math.pi - m) * m - - def forward(self, input, label): - # --------------------------- cos(theta) & phi(theta) --------------------- - cosine = F.linear(F.normalize(input), F.normalize(self.weight)) - if ENABLE_HALF_PRECISION == True: - cosine = cosine.to(torch.float32) - sine = torch.sqrt(1.0 - torch.pow(cosine, 2)) - phi = cosine * self.cos_m - sine * self.sin_m - if self.easy_margin: - phi = torch.where(cosine > 0, phi, cosine) - else: - phi = torch.where(cosine > self.th, phi, cosine - self.mm) - # --------------------------- convert label to one-hot --------------------- - # one_hot = torch.zeros(cosine.size(), requires_grad=True, device='cuda') - one_hot = torch.zeros(cosine.size(), device=DEVICE) - one_hot.scatter_(1, label.view(-1, 1).long(), 1) - if self.ls_eps > 0: - one_hot = (1 - self.ls_eps) * one_hot + self.ls_eps / self.out_features - # -------------torch.where(out_i = {x_i if condition_i else y_i) ------------ - output = (one_hot * phi) + ((1.0 - one_hot) * cosine) - output *= self.s - - return output diff --git a/spaces/pikto/prodia/README.md b/spaces/pikto/prodia/README.md deleted file mode 100644 index 898a59efc9cce3e1c92c7a071b138541a8818985..0000000000000000000000000000000000000000 --- a/spaces/pikto/prodia/README.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -title: Prodia -emoji: 👀 -colorFrom: pink -colorTo: blue -sdk: gradio -sdk_version: 3.39.0 -app_file: app.py -pinned: true -license: apache-2.0 ---- - -Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference \ No newline at end of file diff --git a/spaces/pixiou/bingo/src/components/markdown.tsx b/spaces/pixiou/bingo/src/components/markdown.tsx deleted file mode 100644 index d4491467a1f14d1d72e535caac9c40636054e5df..0000000000000000000000000000000000000000 --- a/spaces/pixiou/bingo/src/components/markdown.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { FC, memo } from 'react' -import ReactMarkdown, { Options } from 'react-markdown' - -export const MemoizedReactMarkdown: FC = memo( - ReactMarkdown, - (prevProps, nextProps) => - prevProps.children === nextProps.children && - prevProps.className === nextProps.className -) diff --git a/spaces/pixiou/bingo/src/components/turn-counter.tsx b/spaces/pixiou/bingo/src/components/turn-counter.tsx deleted file mode 100644 index 08a9e488f044802a8600f4d195b106567c35aab4..0000000000000000000000000000000000000000 --- a/spaces/pixiou/bingo/src/components/turn-counter.tsx +++ /dev/null @@ -1,23 +0,0 @@ -import React from 'react' -import { Throttling } from '@/lib/bots/bing/types' - -export interface TurnCounterProps { - throttling?: Throttling -} - -export function TurnCounter({ throttling }: TurnCounterProps) { - if (!throttling) { - return null - } - - return ( -
      -
      - {throttling.numUserMessagesInConversation} - - {throttling.maxNumUserMessagesInConversation} -
      -
      -
      - ) -} diff --git a/spaces/pknez/face-swap-docker/mynewshinyroop/Lib/site-packages/setuptools/config/setupcfg.py b/spaces/pknez/face-swap-docker/mynewshinyroop/Lib/site-packages/setuptools/config/setupcfg.py deleted file mode 100644 index bb35559069dc8b7c46973d9be937c00e0939a45c..0000000000000000000000000000000000000000 --- a/spaces/pknez/face-swap-docker/mynewshinyroop/Lib/site-packages/setuptools/config/setupcfg.py +++ /dev/null @@ -1,789 +0,0 @@ -""" -Load setuptools configuration from ``setup.cfg`` files. - -**API will be made private in the future** - -To read project metadata, consider using -``build.util.project_wheel_metadata`` (https://pypi.org/project/build/). -For simple scenarios, you can also try parsing the file directly -with the help of ``configparser``. -""" -import contextlib -import functools -import os -from collections import defaultdict -from functools import partial -from functools import wraps -from typing import ( - TYPE_CHECKING, - Callable, - Any, - Dict, - Generic, - Iterable, - List, - Optional, - Set, - Tuple, - TypeVar, - Union, -) - -from ..errors import FileError, OptionError -from ..extern.packaging.markers import default_environment as marker_env -from ..extern.packaging.requirements import InvalidRequirement, Requirement -from ..extern.packaging.specifiers import SpecifierSet -from ..extern.packaging.version import InvalidVersion, Version -from ..warnings import SetuptoolsDeprecationWarning -from . import expand - -if TYPE_CHECKING: - from distutils.dist import DistributionMetadata # noqa - - from setuptools.dist import Distribution # noqa - -_Path = Union[str, os.PathLike] -SingleCommandOptions = Dict["str", Tuple["str", Any]] -"""Dict that associate the name of the options of a particular command to a -tuple. The first element of the tuple indicates the origin of the option value -(e.g. the name of the configuration file where it was read from), -while the second element of the tuple is the option value itself -""" -AllCommandOptions = Dict["str", SingleCommandOptions] # cmd name => its options -Target = TypeVar("Target", bound=Union["Distribution", "DistributionMetadata"]) - - -def read_configuration( - filepath: _Path, find_others=False, ignore_option_errors=False -) -> dict: - """Read given configuration file and returns options from it as a dict. - - :param str|unicode filepath: Path to configuration file - to get options from. - - :param bool find_others: Whether to search for other configuration files - which could be on in various places. - - :param bool ignore_option_errors: Whether to silently ignore - options, values of which could not be resolved (e.g. due to exceptions - in directives such as file:, attr:, etc.). - If False exceptions are propagated as expected. - - :rtype: dict - """ - from setuptools.dist import Distribution - - dist = Distribution() - filenames = dist.find_config_files() if find_others else [] - handlers = _apply(dist, filepath, filenames, ignore_option_errors) - return configuration_to_dict(handlers) - - -def apply_configuration(dist: "Distribution", filepath: _Path) -> "Distribution": - """Apply the configuration from a ``setup.cfg`` file into an existing - distribution object. - """ - _apply(dist, filepath) - dist._finalize_requires() - return dist - - -def _apply( - dist: "Distribution", - filepath: _Path, - other_files: Iterable[_Path] = (), - ignore_option_errors: bool = False, -) -> Tuple["ConfigHandler", ...]: - """Read configuration from ``filepath`` and applies to the ``dist`` object.""" - from setuptools.dist import _Distribution - - filepath = os.path.abspath(filepath) - - if not os.path.isfile(filepath): - raise FileError(f'Configuration file {filepath} does not exist.') - - current_directory = os.getcwd() - os.chdir(os.path.dirname(filepath)) - filenames = [*other_files, filepath] - - try: - _Distribution.parse_config_files(dist, filenames=filenames) - handlers = parse_configuration( - dist, dist.command_options, ignore_option_errors=ignore_option_errors - ) - dist._finalize_license_files() - finally: - os.chdir(current_directory) - - return handlers - - -def _get_option(target_obj: Target, key: str): - """ - Given a target object and option key, get that option from - the target object, either through a get_{key} method or - from an attribute directly. - """ - getter_name = f'get_{key}' - by_attribute = functools.partial(getattr, target_obj, key) - getter = getattr(target_obj, getter_name, by_attribute) - return getter() - - -def configuration_to_dict(handlers: Tuple["ConfigHandler", ...]) -> dict: - """Returns configuration data gathered by given handlers as a dict. - - :param list[ConfigHandler] handlers: Handlers list, - usually from parse_configuration() - - :rtype: dict - """ - config_dict: dict = defaultdict(dict) - - for handler in handlers: - for option in handler.set_options: - value = _get_option(handler.target_obj, option) - config_dict[handler.section_prefix][option] = value - - return config_dict - - -def parse_configuration( - distribution: "Distribution", - command_options: AllCommandOptions, - ignore_option_errors=False, -) -> Tuple["ConfigMetadataHandler", "ConfigOptionsHandler"]: - """Performs additional parsing of configuration options - for a distribution. - - Returns a list of used option handlers. - - :param Distribution distribution: - :param dict command_options: - :param bool ignore_option_errors: Whether to silently ignore - options, values of which could not be resolved (e.g. due to exceptions - in directives such as file:, attr:, etc.). - If False exceptions are propagated as expected. - :rtype: list - """ - with expand.EnsurePackagesDiscovered(distribution) as ensure_discovered: - options = ConfigOptionsHandler( - distribution, - command_options, - ignore_option_errors, - ensure_discovered, - ) - - options.parse() - if not distribution.package_dir: - distribution.package_dir = options.package_dir # Filled by `find_packages` - - meta = ConfigMetadataHandler( - distribution.metadata, - command_options, - ignore_option_errors, - ensure_discovered, - distribution.package_dir, - distribution.src_root, - ) - meta.parse() - distribution._referenced_files.update( - options._referenced_files, meta._referenced_files - ) - - return meta, options - - -def _warn_accidental_env_marker_misconfig(label: str, orig_value: str, parsed: list): - """Because users sometimes misinterpret this configuration: - - [options.extras_require] - foo = bar;python_version<"4" - - It looks like one requirement with an environment marker - but because there is no newline, it's parsed as two requirements - with a semicolon as separator. - - Therefore, if: - * input string does not contain a newline AND - * parsed result contains two requirements AND - * parsing of the two parts from the result (";") - leads in a valid Requirement with a valid marker - a UserWarning is shown to inform the user about the possible problem. - """ - if "\n" in orig_value or len(parsed) != 2: - return - - markers = marker_env().keys() - - try: - req = Requirement(parsed[1]) - if req.name in markers: - _AmbiguousMarker.emit(field=label, req=parsed[1]) - except InvalidRequirement as ex: - if any(parsed[1].startswith(marker) for marker in markers): - msg = _AmbiguousMarker.message(field=label, req=parsed[1]) - raise InvalidRequirement(msg) from ex - - -class ConfigHandler(Generic[Target]): - """Handles metadata supplied in configuration files.""" - - section_prefix: str - """Prefix for config sections handled by this handler. - Must be provided by class heirs. - - """ - - aliases: Dict[str, str] = {} - """Options aliases. - For compatibility with various packages. E.g.: d2to1 and pbr. - Note: `-` in keys is replaced with `_` by config parser. - - """ - - def __init__( - self, - target_obj: Target, - options: AllCommandOptions, - ignore_option_errors, - ensure_discovered: expand.EnsurePackagesDiscovered, - ): - self.ignore_option_errors = ignore_option_errors - self.target_obj = target_obj - self.sections = dict(self._section_options(options)) - self.set_options: List[str] = [] - self.ensure_discovered = ensure_discovered - self._referenced_files: Set[str] = set() - """After parsing configurations, this property will enumerate - all files referenced by the "file:" directive. Private API for setuptools only. - """ - - @classmethod - def _section_options(cls, options: AllCommandOptions): - for full_name, value in options.items(): - pre, sep, name = full_name.partition(cls.section_prefix) - if pre: - continue - yield name.lstrip('.'), value - - @property - def parsers(self): - """Metadata item name to parser function mapping.""" - raise NotImplementedError( - '%s must provide .parsers property' % self.__class__.__name__ - ) - - def __setitem__(self, option_name, value): - target_obj = self.target_obj - - # Translate alias into real name. - option_name = self.aliases.get(option_name, option_name) - - try: - current_value = getattr(target_obj, option_name) - except AttributeError: - raise KeyError(option_name) - - if current_value: - # Already inhabited. Skipping. - return - - try: - parsed = self.parsers.get(option_name, lambda x: x)(value) - except (Exception,) * self.ignore_option_errors: - return - - simple_setter = functools.partial(target_obj.__setattr__, option_name) - setter = getattr(target_obj, 'set_%s' % option_name, simple_setter) - setter(parsed) - - self.set_options.append(option_name) - - @classmethod - def _parse_list(cls, value, separator=','): - """Represents value as a list. - - Value is split either by separator (defaults to comma) or by lines. - - :param value: - :param separator: List items separator character. - :rtype: list - """ - if isinstance(value, list): # _get_parser_compound case - return value - - if '\n' in value: - value = value.splitlines() - else: - value = value.split(separator) - - return [chunk.strip() for chunk in value if chunk.strip()] - - @classmethod - def _parse_dict(cls, value): - """Represents value as a dict. - - :param value: - :rtype: dict - """ - separator = '=' - result = {} - for line in cls._parse_list(value): - key, sep, val = line.partition(separator) - if sep != separator: - raise OptionError(f"Unable to parse option value to dict: {value}") - result[key.strip()] = val.strip() - - return result - - @classmethod - def _parse_bool(cls, value): - """Represents value as boolean. - - :param value: - :rtype: bool - """ - value = value.lower() - return value in ('1', 'true', 'yes') - - @classmethod - def _exclude_files_parser(cls, key): - """Returns a parser function to make sure field inputs - are not files. - - Parses a value after getting the key so error messages are - more informative. - - :param key: - :rtype: callable - """ - - def parser(value): - exclude_directive = 'file:' - if value.startswith(exclude_directive): - raise ValueError( - 'Only strings are accepted for the {0} field, ' - 'files are not accepted'.format(key) - ) - return value - - return parser - - def _parse_file(self, value, root_dir: _Path): - """Represents value as a string, allowing including text - from nearest files using `file:` directive. - - Directive is sandboxed and won't reach anything outside - directory with setup.py. - - Examples: - file: README.rst, CHANGELOG.md, src/file.txt - - :param str value: - :rtype: str - """ - include_directive = 'file:' - - if not isinstance(value, str): - return value - - if not value.startswith(include_directive): - return value - - spec = value[len(include_directive) :] - filepaths = [path.strip() for path in spec.split(',')] - self._referenced_files.update(filepaths) - return expand.read_files(filepaths, root_dir) - - def _parse_attr(self, value, package_dir, root_dir: _Path): - """Represents value as a module attribute. - - Examples: - attr: package.attr - attr: package.module.attr - - :param str value: - :rtype: str - """ - attr_directive = 'attr:' - if not value.startswith(attr_directive): - return value - - attr_desc = value.replace(attr_directive, '') - - # Make sure package_dir is populated correctly, so `attr:` directives can work - package_dir.update(self.ensure_discovered.package_dir) - return expand.read_attr(attr_desc, package_dir, root_dir) - - @classmethod - def _get_parser_compound(cls, *parse_methods): - """Returns parser function to represents value as a list. - - Parses a value applying given methods one after another. - - :param parse_methods: - :rtype: callable - """ - - def parse(value): - parsed = value - - for method in parse_methods: - parsed = method(parsed) - - return parsed - - return parse - - @classmethod - def _parse_section_to_dict_with_key(cls, section_options, values_parser): - """Parses section options into a dictionary. - - Applies a given parser to each option in a section. - - :param dict section_options: - :param callable values_parser: function with 2 args corresponding to key, value - :rtype: dict - """ - value = {} - for key, (_, val) in section_options.items(): - value[key] = values_parser(key, val) - return value - - @classmethod - def _parse_section_to_dict(cls, section_options, values_parser=None): - """Parses section options into a dictionary. - - Optionally applies a given parser to each value. - - :param dict section_options: - :param callable values_parser: function with 1 arg corresponding to option value - :rtype: dict - """ - parser = (lambda _, v: values_parser(v)) if values_parser else (lambda _, v: v) - return cls._parse_section_to_dict_with_key(section_options, parser) - - def parse_section(self, section_options): - """Parses configuration file section. - - :param dict section_options: - """ - for name, (_, value) in section_options.items(): - with contextlib.suppress(KeyError): - # Keep silent for a new option may appear anytime. - self[name] = value - - def parse(self): - """Parses configuration file items from one - or more related sections. - - """ - for section_name, section_options in self.sections.items(): - method_postfix = '' - if section_name: # [section.option] variant - method_postfix = '_%s' % section_name - - section_parser_method: Optional[Callable] = getattr( - self, - # Dots in section names are translated into dunderscores. - ('parse_section%s' % method_postfix).replace('.', '__'), - None, - ) - - if section_parser_method is None: - raise OptionError( - "Unsupported distribution option section: " - f"[{self.section_prefix}.{section_name}]" - ) - - section_parser_method(section_options) - - def _deprecated_config_handler(self, func, msg, **kw): - """this function will wrap around parameters that are deprecated - - :param msg: deprecation message - :param func: function to be wrapped around - """ - - @wraps(func) - def config_handler(*args, **kwargs): - kw.setdefault("stacklevel", 2) - _DeprecatedConfig.emit("Deprecated config in `setup.cfg`", msg, **kw) - return func(*args, **kwargs) - - return config_handler - - -class ConfigMetadataHandler(ConfigHandler["DistributionMetadata"]): - section_prefix = 'metadata' - - aliases = { - 'home_page': 'url', - 'summary': 'description', - 'classifier': 'classifiers', - 'platform': 'platforms', - } - - strict_mode = False - """We need to keep it loose, to be partially compatible with - `pbr` and `d2to1` packages which also uses `metadata` section. - - """ - - def __init__( - self, - target_obj: "DistributionMetadata", - options: AllCommandOptions, - ignore_option_errors: bool, - ensure_discovered: expand.EnsurePackagesDiscovered, - package_dir: Optional[dict] = None, - root_dir: _Path = os.curdir, - ): - super().__init__(target_obj, options, ignore_option_errors, ensure_discovered) - self.package_dir = package_dir - self.root_dir = root_dir - - @property - def parsers(self): - """Metadata item name to parser function mapping.""" - parse_list = self._parse_list - parse_file = partial(self._parse_file, root_dir=self.root_dir) - parse_dict = self._parse_dict - exclude_files_parser = self._exclude_files_parser - - return { - 'platforms': parse_list, - 'keywords': parse_list, - 'provides': parse_list, - 'requires': self._deprecated_config_handler( - parse_list, - "The requires parameter is deprecated, please use " - "install_requires for runtime dependencies.", - due_date=(2023, 10, 30), - # Warning introduced in 27 Oct 2018 - ), - 'obsoletes': parse_list, - 'classifiers': self._get_parser_compound(parse_file, parse_list), - 'license': exclude_files_parser('license'), - 'license_file': self._deprecated_config_handler( - exclude_files_parser('license_file'), - "The license_file parameter is deprecated, " - "use license_files instead.", - due_date=(2023, 10, 30), - # Warning introduced in 23 May 2021 - ), - 'license_files': parse_list, - 'description': parse_file, - 'long_description': parse_file, - 'version': self._parse_version, - 'project_urls': parse_dict, - } - - def _parse_version(self, value): - """Parses `version` option value. - - :param value: - :rtype: str - - """ - version = self._parse_file(value, self.root_dir) - - if version != value: - version = version.strip() - # Be strict about versions loaded from file because it's easy to - # accidentally include newlines and other unintended content - try: - Version(version) - except InvalidVersion: - raise OptionError( - f'Version loaded from {value} does not ' - f'comply with PEP 440: {version}' - ) - - return version - - return expand.version(self._parse_attr(value, self.package_dir, self.root_dir)) - - -class ConfigOptionsHandler(ConfigHandler["Distribution"]): - section_prefix = 'options' - - def __init__( - self, - target_obj: "Distribution", - options: AllCommandOptions, - ignore_option_errors: bool, - ensure_discovered: expand.EnsurePackagesDiscovered, - ): - super().__init__(target_obj, options, ignore_option_errors, ensure_discovered) - self.root_dir = target_obj.src_root - self.package_dir: Dict[str, str] = {} # To be filled by `find_packages` - - @classmethod - def _parse_list_semicolon(cls, value): - return cls._parse_list(value, separator=';') - - def _parse_file_in_root(self, value): - return self._parse_file(value, root_dir=self.root_dir) - - def _parse_requirements_list(self, label: str, value: str): - # Parse a requirements list, either by reading in a `file:`, or a list. - parsed = self._parse_list_semicolon(self._parse_file_in_root(value)) - _warn_accidental_env_marker_misconfig(label, value, parsed) - # Filter it to only include lines that are not comments. `parse_list` - # will have stripped each line and filtered out empties. - return [line for line in parsed if not line.startswith("#")] - - @property - def parsers(self): - """Metadata item name to parser function mapping.""" - parse_list = self._parse_list - parse_bool = self._parse_bool - parse_dict = self._parse_dict - parse_cmdclass = self._parse_cmdclass - - return { - 'zip_safe': parse_bool, - 'include_package_data': parse_bool, - 'package_dir': parse_dict, - 'scripts': parse_list, - 'eager_resources': parse_list, - 'dependency_links': parse_list, - 'namespace_packages': self._deprecated_config_handler( - parse_list, - "The namespace_packages parameter is deprecated, " - "consider using implicit namespaces instead (PEP 420).", - # TODO: define due date, see setuptools.dist:check_nsp. - ), - 'install_requires': partial( - self._parse_requirements_list, "install_requires" - ), - 'setup_requires': self._parse_list_semicolon, - 'tests_require': self._parse_list_semicolon, - 'packages': self._parse_packages, - 'entry_points': self._parse_file_in_root, - 'py_modules': parse_list, - 'python_requires': SpecifierSet, - 'cmdclass': parse_cmdclass, - } - - def _parse_cmdclass(self, value): - package_dir = self.ensure_discovered.package_dir - return expand.cmdclass(self._parse_dict(value), package_dir, self.root_dir) - - def _parse_packages(self, value): - """Parses `packages` option value. - - :param value: - :rtype: list - """ - find_directives = ['find:', 'find_namespace:'] - trimmed_value = value.strip() - - if trimmed_value not in find_directives: - return self._parse_list(value) - - # Read function arguments from a dedicated section. - find_kwargs = self.parse_section_packages__find( - self.sections.get('packages.find', {}) - ) - - find_kwargs.update( - namespaces=(trimmed_value == find_directives[1]), - root_dir=self.root_dir, - fill_package_dir=self.package_dir, - ) - - return expand.find_packages(**find_kwargs) - - def parse_section_packages__find(self, section_options): - """Parses `packages.find` configuration file section. - - To be used in conjunction with _parse_packages(). - - :param dict section_options: - """ - section_data = self._parse_section_to_dict(section_options, self._parse_list) - - valid_keys = ['where', 'include', 'exclude'] - - find_kwargs = dict( - [(k, v) for k, v in section_data.items() if k in valid_keys and v] - ) - - where = find_kwargs.get('where') - if where is not None: - find_kwargs['where'] = where[0] # cast list to single val - - return find_kwargs - - def parse_section_entry_points(self, section_options): - """Parses `entry_points` configuration file section. - - :param dict section_options: - """ - parsed = self._parse_section_to_dict(section_options, self._parse_list) - self['entry_points'] = parsed - - def _parse_package_data(self, section_options): - package_data = self._parse_section_to_dict(section_options, self._parse_list) - return expand.canonic_package_data(package_data) - - def parse_section_package_data(self, section_options): - """Parses `package_data` configuration file section. - - :param dict section_options: - """ - self['package_data'] = self._parse_package_data(section_options) - - def parse_section_exclude_package_data(self, section_options): - """Parses `exclude_package_data` configuration file section. - - :param dict section_options: - """ - self['exclude_package_data'] = self._parse_package_data(section_options) - - def parse_section_extras_require(self, section_options): - """Parses `extras_require` configuration file section. - - :param dict section_options: - """ - parsed = self._parse_section_to_dict_with_key( - section_options, - lambda k, v: self._parse_requirements_list(f"extras_require[{k}]", v), - ) - - self['extras_require'] = parsed - - def parse_section_data_files(self, section_options): - """Parses `data_files` configuration file section. - - :param dict section_options: - """ - parsed = self._parse_section_to_dict(section_options, self._parse_list) - self['data_files'] = expand.canonic_data_files(parsed, self.root_dir) - - -class _AmbiguousMarker(SetuptoolsDeprecationWarning): - _SUMMARY = "Ambiguous requirement marker." - _DETAILS = """ - One of the parsed requirements in `{field}` looks like a valid environment marker: - - {req!r} - - Please make sure that the configuration file is correct. - You can use dangling lines to avoid this problem. - """ - _SEE_DOCS = "userguide/declarative_config.html#opt-2" - # TODO: should we include due_date here? Initially introduced in 6 Aug 2022. - # Does this make sense with latest version of packaging? - - @classmethod - def message(cls, **kw): - docs = f"https://setuptools.pypa.io/en/latest/{cls._SEE_DOCS}" - return cls._format(cls._SUMMARY, cls._DETAILS, see_url=docs, format_args=kw) - - -class _DeprecatedConfig(SetuptoolsDeprecationWarning): - _SEE_DOCS = "userguide/declarative_config.html" diff --git a/spaces/posit/quarto-template/README.md b/spaces/posit/quarto-template/README.md deleted file mode 100644 index ce04405f60bd8a437cd0d9cbbe6d1a995d888d87..0000000000000000000000000000000000000000 --- a/spaces/posit/quarto-template/README.md +++ /dev/null @@ -1,11 +0,0 @@ ---- -title: Quarto Template -emoji: 📚 -colorFrom: gray -colorTo: blue -sdk: docker -pinned: false -license: mit ---- - -Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference diff --git a/spaces/profayle/TerrapinTalk/myenv/lib/python3.9/site-packages/aiohttp/web_server.py b/spaces/profayle/TerrapinTalk/myenv/lib/python3.9/site-packages/aiohttp/web_server.py deleted file mode 100644 index fa46e905caa307f30a242951610193ee2a98692e..0000000000000000000000000000000000000000 --- a/spaces/profayle/TerrapinTalk/myenv/lib/python3.9/site-packages/aiohttp/web_server.py +++ /dev/null @@ -1,62 +0,0 @@ -"""Low level HTTP server.""" -import asyncio -from typing import Any, Awaitable, Callable, Dict, List, Optional # noqa - -from .abc import AbstractStreamWriter -from .helpers import get_running_loop -from .http_parser import RawRequestMessage -from .streams import StreamReader -from .web_protocol import RequestHandler, _RequestFactory, _RequestHandler -from .web_request import BaseRequest - -__all__ = ("Server",) - - -class Server: - def __init__( - self, - handler: _RequestHandler, - *, - request_factory: Optional[_RequestFactory] = None, - loop: Optional[asyncio.AbstractEventLoop] = None, - **kwargs: Any - ) -> None: - self._loop = get_running_loop(loop) - self._connections: Dict[RequestHandler, asyncio.Transport] = {} - self._kwargs = kwargs - self.requests_count = 0 - self.request_handler = handler - self.request_factory = request_factory or self._make_request - - @property - def connections(self) -> List[RequestHandler]: - return list(self._connections.keys()) - - def connection_made( - self, handler: RequestHandler, transport: asyncio.Transport - ) -> None: - self._connections[handler] = transport - - def connection_lost( - self, handler: RequestHandler, exc: Optional[BaseException] = None - ) -> None: - if handler in self._connections: - del self._connections[handler] - - def _make_request( - self, - message: RawRequestMessage, - payload: StreamReader, - protocol: RequestHandler, - writer: AbstractStreamWriter, - task: "asyncio.Task[None]", - ) -> BaseRequest: - return BaseRequest(message, payload, protocol, writer, task, self._loop) - - async def shutdown(self, timeout: Optional[float] = None) -> None: - coros = [conn.shutdown(timeout) for conn in self._connections] - await asyncio.gather(*coros) - self._connections.clear() - - def __call__(self) -> RequestHandler: - return RequestHandler(self, loop=self._loop, **self._kwargs) diff --git a/spaces/profayle/TerrapinTalk/myenv/lib/python3.9/site-packages/fastapi/middleware/wsgi.py b/spaces/profayle/TerrapinTalk/myenv/lib/python3.9/site-packages/fastapi/middleware/wsgi.py deleted file mode 100644 index c4c6a797d2675e1c13b028be977c64a822fb649b..0000000000000000000000000000000000000000 --- a/spaces/profayle/TerrapinTalk/myenv/lib/python3.9/site-packages/fastapi/middleware/wsgi.py +++ /dev/null @@ -1 +0,0 @@ -from starlette.middleware.wsgi import WSGIMiddleware as WSGIMiddleware # noqa diff --git a/spaces/profayle/TerrapinTalk/myenv/lib/python3.9/site-packages/fontTools/otlLib/__init__.py b/spaces/profayle/TerrapinTalk/myenv/lib/python3.9/site-packages/fontTools/otlLib/__init__.py deleted file mode 100644 index 12e414fc3bf00e6152f953b989914f034edfe9e1..0000000000000000000000000000000000000000 --- a/spaces/profayle/TerrapinTalk/myenv/lib/python3.9/site-packages/fontTools/otlLib/__init__.py +++ /dev/null @@ -1 +0,0 @@ -"""OpenType Layout-related functionality.""" diff --git a/spaces/profayle/TerrapinTalk/myenv/lib/python3.9/site-packages/fontTools/pens/recordingPen.py b/spaces/profayle/TerrapinTalk/myenv/lib/python3.9/site-packages/fontTools/pens/recordingPen.py deleted file mode 100644 index 6c3b6613211d76f0306876dceb6d3945920417f5..0000000000000000000000000000000000000000 --- a/spaces/profayle/TerrapinTalk/myenv/lib/python3.9/site-packages/fontTools/pens/recordingPen.py +++ /dev/null @@ -1,179 +0,0 @@ -"""Pen recording operations that can be accessed or replayed.""" -from fontTools.pens.basePen import AbstractPen, DecomposingPen -from fontTools.pens.pointPen import AbstractPointPen - - -__all__ = [ - "replayRecording", - "RecordingPen", - "DecomposingRecordingPen", - "RecordingPointPen", -] - - -def replayRecording(recording, pen): - """Replay a recording, as produced by RecordingPen or DecomposingRecordingPen, - to a pen. - - Note that recording does not have to be produced by those pens. - It can be any iterable of tuples of method name and tuple-of-arguments. - Likewise, pen can be any objects receiving those method calls. - """ - for operator, operands in recording: - getattr(pen, operator)(*operands) - - -class RecordingPen(AbstractPen): - """Pen recording operations that can be accessed or replayed. - - The recording can be accessed as pen.value; or replayed using - pen.replay(otherPen). - - :Example: - - from fontTools.ttLib import TTFont - from fontTools.pens.recordingPen import RecordingPen - - glyph_name = 'dollar' - font_path = 'MyFont.otf' - - font = TTFont(font_path) - glyphset = font.getGlyphSet() - glyph = glyphset[glyph_name] - - pen = RecordingPen() - glyph.draw(pen) - print(pen.value) - """ - - def __init__(self): - self.value = [] - - def moveTo(self, p0): - self.value.append(("moveTo", (p0,))) - - def lineTo(self, p1): - self.value.append(("lineTo", (p1,))) - - def qCurveTo(self, *points): - self.value.append(("qCurveTo", points)) - - def curveTo(self, *points): - self.value.append(("curveTo", points)) - - def closePath(self): - self.value.append(("closePath", ())) - - def endPath(self): - self.value.append(("endPath", ())) - - def addComponent(self, glyphName, transformation): - self.value.append(("addComponent", (glyphName, transformation))) - - def addVarComponent(self, glyphName, transformation, location): - self.value.append(("addVarComponent", (glyphName, transformation, location))) - - def replay(self, pen): - replayRecording(self.value, pen) - - -class DecomposingRecordingPen(DecomposingPen, RecordingPen): - """Same as RecordingPen, except that it doesn't keep components - as references, but draws them decomposed as regular contours. - - The constructor takes a single 'glyphSet' positional argument, - a dictionary of glyph objects (i.e. with a 'draw' method) keyed - by thir name:: - - >>> class SimpleGlyph(object): - ... def draw(self, pen): - ... pen.moveTo((0, 0)) - ... pen.curveTo((1, 1), (2, 2), (3, 3)) - ... pen.closePath() - >>> class CompositeGlyph(object): - ... def draw(self, pen): - ... pen.addComponent('a', (1, 0, 0, 1, -1, 1)) - >>> glyphSet = {'a': SimpleGlyph(), 'b': CompositeGlyph()} - >>> for name, glyph in sorted(glyphSet.items()): - ... pen = DecomposingRecordingPen(glyphSet) - ... glyph.draw(pen) - ... print("{}: {}".format(name, pen.value)) - a: [('moveTo', ((0, 0),)), ('curveTo', ((1, 1), (2, 2), (3, 3))), ('closePath', ())] - b: [('moveTo', ((-1, 1),)), ('curveTo', ((0, 2), (1, 3), (2, 4))), ('closePath', ())] - """ - - # raises KeyError if base glyph is not found in glyphSet - skipMissingComponents = False - - -class RecordingPointPen(AbstractPointPen): - """PointPen recording operations that can be accessed or replayed. - - The recording can be accessed as pen.value; or replayed using - pointPen.replay(otherPointPen). - - :Example: - - from defcon import Font - from fontTools.pens.recordingPen import RecordingPointPen - - glyph_name = 'a' - font_path = 'MyFont.ufo' - - font = Font(font_path) - glyph = font[glyph_name] - - pen = RecordingPointPen() - glyph.drawPoints(pen) - print(pen.value) - - new_glyph = font.newGlyph('b') - pen.replay(new_glyph.getPointPen()) - """ - - def __init__(self): - self.value = [] - - def beginPath(self, identifier=None, **kwargs): - if identifier is not None: - kwargs["identifier"] = identifier - self.value.append(("beginPath", (), kwargs)) - - def endPath(self): - self.value.append(("endPath", (), {})) - - def addPoint( - self, pt, segmentType=None, smooth=False, name=None, identifier=None, **kwargs - ): - if identifier is not None: - kwargs["identifier"] = identifier - self.value.append(("addPoint", (pt, segmentType, smooth, name), kwargs)) - - def addComponent(self, baseGlyphName, transformation, identifier=None, **kwargs): - if identifier is not None: - kwargs["identifier"] = identifier - self.value.append(("addComponent", (baseGlyphName, transformation), kwargs)) - - def addVarComponent( - self, baseGlyphName, transformation, location, identifier=None, **kwargs - ): - if identifier is not None: - kwargs["identifier"] = identifier - self.value.append( - ("addVarComponent", (baseGlyphName, transformation, location), kwargs) - ) - - def replay(self, pointPen): - for operator, args, kwargs in self.value: - getattr(pointPen, operator)(*args, **kwargs) - - -if __name__ == "__main__": - pen = RecordingPen() - pen.moveTo((0, 0)) - pen.lineTo((0, 100)) - pen.curveTo((50, 75), (60, 50), (50, 25)) - pen.closePath() - from pprint import pprint - - pprint(pen.value) diff --git a/spaces/profayle/TerrapinTalk/myenv/lib/python3.9/site-packages/gradio/templates/cdn/assets/Index-0046113e.js b/spaces/profayle/TerrapinTalk/myenv/lib/python3.9/site-packages/gradio/templates/cdn/assets/Index-0046113e.js deleted file mode 100644 index cde8f774d5b0229686ba073d070f7ceca4a67147..0000000000000000000000000000000000000000 --- a/spaces/profayle/TerrapinTalk/myenv/lib/python3.9/site-packages/gradio/templates/cdn/assets/Index-0046113e.js +++ /dev/null @@ -1,2 +0,0 @@ -import{B as m}from"./Button-89057c03.js";import"./Index-37584f50.js";import"./index-0526d562.js";import"./svelte/svelte.js";const{SvelteComponent:u,create_component:r,create_slot:d,destroy_component:b,get_all_dirty_from_scope:g,get_slot_changes:v,init:p,mount_component:h,safe_not_equal:k,transition_in:f,transition_out:c,update_slot_base:w}=window.__gradio__svelte__internal;function B(i){let l;const s=i[3].default,e=d(s,i,i[4],null);return{c(){e&&e.c()},m(t,n){e&&e.m(t,n),l=!0},p(t,n){e&&e.p&&(!l||n&16)&&w(e,s,t,t[4],l?v(s,t[4],n,null):g(t[4]),null)},i(t){l||(f(e,t),l=!0)},o(t){c(e,t),l=!1},d(t){e&&e.d(t)}}}function q(i){let l,s;return l=new m({props:{elem_id:i[0],elem_classes:i[1],visible:i[2],explicit_call:!0,$$slots:{default:[B]},$$scope:{ctx:i}}}),{c(){r(l.$$.fragment)},m(e,t){h(l,e,t),s=!0},p(e,[t]){const n={};t&1&&(n.elem_id=e[0]),t&2&&(n.elem_classes=e[1]),t&4&&(n.visible=e[2]),t&16&&(n.$$scope={dirty:t,ctx:e}),l.$set(n)},i(e){s||(f(l.$$.fragment,e),s=!0)},o(e){c(l.$$.fragment,e),s=!1},d(e){b(l,e)}}}function C(i,l,s){let{$$slots:e={},$$scope:t}=l,{elem_id:n}=l,{elem_classes:_}=l,{visible:a=!0}=l;return i.$$set=o=>{"elem_id"in o&&s(0,n=o.elem_id),"elem_classes"in o&&s(1,_=o.elem_classes),"visible"in o&&s(2,a=o.visible),"$$scope"in o&&s(4,t=o.$$scope)},[n,_,a,e,t]}class A extends u{constructor(l){super(),p(this,l,C,q,k,{elem_id:0,elem_classes:1,visible:2})}}export{A as default}; -//# sourceMappingURL=Index-0046113e.js.map diff --git a/spaces/profayle/TerrapinTalk/myenv/lib/python3.9/site-packages/gradio/templates/cdn/assets/Textbox-dde6f8cc.css b/spaces/profayle/TerrapinTalk/myenv/lib/python3.9/site-packages/gradio/templates/cdn/assets/Textbox-dde6f8cc.css deleted file mode 100644 index 88b256fe95573d2f94fdc4c1c51406d908dd999d..0000000000000000000000000000000000000000 --- a/spaces/profayle/TerrapinTalk/myenv/lib/python3.9/site-packages/gradio/templates/cdn/assets/Textbox-dde6f8cc.css +++ /dev/null @@ -1 +0,0 @@ -label.svelte-1f354aw.svelte-1f354aw{display:block;width:100%}input.svelte-1f354aw.svelte-1f354aw,textarea.svelte-1f354aw.svelte-1f354aw{display:block;position:relative;outline:none!important;box-shadow:var(--input-shadow);background:var(--input-background-fill);padding:var(--input-padding);width:100%;color:var(--body-text-color);font-weight:var(--input-text-weight);font-size:var(--input-text-size);line-height:var(--line-sm);border:none}label.svelte-1f354aw.svelte-1f354aw:not(.container),label.svelte-1f354aw:not(.container)>input.svelte-1f354aw,label.svelte-1f354aw:not(.container)>textarea.svelte-1f354aw{height:100%}.container.svelte-1f354aw>input.svelte-1f354aw,.container.svelte-1f354aw>textarea.svelte-1f354aw{border:var(--input-border-width) solid var(--input-border-color);border-radius:var(--input-radius)}input.svelte-1f354aw.svelte-1f354aw:disabled,textarea.svelte-1f354aw.svelte-1f354aw:disabled{-webkit-text-fill-color:var(--body-text-color);-webkit-opacity:1;opacity:1}input.svelte-1f354aw.svelte-1f354aw:focus,textarea.svelte-1f354aw.svelte-1f354aw:focus{box-shadow:var(--input-shadow-focus);border-color:var(--input-border-color-focus)}input.svelte-1f354aw.svelte-1f354aw::placeholder,textarea.svelte-1f354aw.svelte-1f354aw::placeholder{color:var(--input-placeholder-color)}button.svelte-1f354aw.svelte-1f354aw{display:flex;position:absolute;top:var(--block-label-margin);right:var(--block-label-margin);align-items:center;box-shadow:var(--shadow-drop);border:1px solid var(--color-border-primary);border-top:none;border-right:none;border-radius:var(--block-label-right-radius);background:var(--block-label-background-fill);padding:5px;width:22px;height:22px;overflow:hidden;color:var(--block-label-color);font:var(--font-sans);font-size:var(--button-small-text-size)} diff --git a/spaces/profayle/TerrapinTalk/myenv/lib/python3.9/site-packages/gradio/templates/frontend/assets/Index-d4781e2f.css b/spaces/profayle/TerrapinTalk/myenv/lib/python3.9/site-packages/gradio/templates/frontend/assets/Index-d4781e2f.css deleted file mode 100644 index 39cd0cfaf767630bfce6acf7fe207d2c872841bd..0000000000000000000000000000000000000000 --- a/spaces/profayle/TerrapinTalk/myenv/lib/python3.9/site-packages/gradio/templates/frontend/assets/Index-d4781e2f.css +++ /dev/null @@ -1 +0,0 @@ -.container.svelte-1pq4gst.svelte-1pq4gst.svelte-1pq4gst{padding:var(--block-padding)}.output-class.svelte-1pq4gst.svelte-1pq4gst.svelte-1pq4gst{display:flex;justify-content:center;align-items:center;padding:var(--size-6) var(--size-4);color:var(--body-text-color);font-weight:var(--weight-bold);font-size:var(--text-xxl)}.confidence-set.svelte-1pq4gst.svelte-1pq4gst.svelte-1pq4gst{display:flex;justify-content:space-between;align-items:flex-start;margin-bottom:var(--size-2);color:var(--body-text-color);line-height:var(--line-none);font-family:var(--font-mono);width:100%}.confidence-set.svelte-1pq4gst.svelte-1pq4gst.svelte-1pq4gst:last-child{margin-bottom:0}.inner-wrap.svelte-1pq4gst.svelte-1pq4gst.svelte-1pq4gst{flex:1 1 0%;display:flex;flex-direction:column}.bar.svelte-1pq4gst.svelte-1pq4gst.svelte-1pq4gst{appearance:none;align-self:flex-start;margin-bottom:var(--size-1);border-radius:var(--radius-md);background:var(--stat-background-fill);height:var(--size-1)}.label.svelte-1pq4gst.svelte-1pq4gst.svelte-1pq4gst{display:flex;align-items:baseline}.label.svelte-1pq4gst>.svelte-1pq4gst+.svelte-1pq4gst{margin-left:var(--size-2)}.confidence-set.svelte-1pq4gst:hover .label.svelte-1pq4gst.svelte-1pq4gst{color:var(--color-accent)}.confidence-set.svelte-1pq4gst:focus .label.svelte-1pq4gst.svelte-1pq4gst{color:var(--color-accent)}.text.svelte-1pq4gst.svelte-1pq4gst.svelte-1pq4gst{line-height:var(--line-md)}.line.svelte-1pq4gst.svelte-1pq4gst.svelte-1pq4gst{flex:1 1 0%;border:1px dashed var(--border-color-primary);padding-right:var(--size-4);padding-left:var(--size-4)}.confidence.svelte-1pq4gst.svelte-1pq4gst.svelte-1pq4gst{margin-left:auto;text-align:right} diff --git a/spaces/profayle/TerrapinTalk/myenv/lib/python3.9/site-packages/h11/_version.py b/spaces/profayle/TerrapinTalk/myenv/lib/python3.9/site-packages/h11/_version.py deleted file mode 100644 index 4c8911305680c1083b2da9b87ece12bc36f3a9e1..0000000000000000000000000000000000000000 --- a/spaces/profayle/TerrapinTalk/myenv/lib/python3.9/site-packages/h11/_version.py +++ /dev/null @@ -1,16 +0,0 @@ -# This file must be kept very simple, because it is consumed from several -# places -- it is imported by h11/__init__.py, execfile'd by setup.py, etc. - -# We use a simple scheme: -# 1.0.0 -> 1.0.0+dev -> 1.1.0 -> 1.1.0+dev -# where the +dev versions are never released into the wild, they're just what -# we stick into the VCS in between releases. -# -# This is compatible with PEP 440: -# http://legacy.python.org/dev/peps/pep-0440/ -# via the use of the "local suffix" "+dev", which is disallowed on index -# servers and causes 1.0.0+dev to sort after plain 1.0.0, which is what we -# want. (Contrast with the special suffix 1.0.0.dev, which sorts *before* -# 1.0.0.) - -__version__ = "0.14.0" diff --git a/spaces/profayle/TerrapinTalk/myenv/lib/python3.9/site-packages/matplotlib/tests/test_units.py b/spaces/profayle/TerrapinTalk/myenv/lib/python3.9/site-packages/matplotlib/tests/test_units.py deleted file mode 100644 index d3b8c5a71643c0a95c7fcee0041ce9eb35822c2e..0000000000000000000000000000000000000000 --- a/spaces/profayle/TerrapinTalk/myenv/lib/python3.9/site-packages/matplotlib/tests/test_units.py +++ /dev/null @@ -1,285 +0,0 @@ -from datetime import datetime, timezone, timedelta -import platform -from unittest.mock import MagicMock - -import matplotlib.pyplot as plt -from matplotlib.testing.decorators import check_figures_equal, image_comparison -import matplotlib.units as munits -from matplotlib.category import UnitData -import numpy as np -import pytest - - -# Basic class that wraps numpy array and has units -class Quantity: - def __init__(self, data, units): - self.magnitude = data - self.units = units - - def to(self, new_units): - factors = {('hours', 'seconds'): 3600, ('minutes', 'hours'): 1 / 60, - ('minutes', 'seconds'): 60, ('feet', 'miles'): 1 / 5280., - ('feet', 'inches'): 12, ('miles', 'inches'): 12 * 5280} - if self.units != new_units: - mult = factors[self.units, new_units] - return Quantity(mult * self.magnitude, new_units) - else: - return Quantity(self.magnitude, self.units) - - def __copy__(self): - return Quantity(self.magnitude, self.units) - - def __getattr__(self, attr): - return getattr(self.magnitude, attr) - - def __getitem__(self, item): - if np.iterable(self.magnitude): - return Quantity(self.magnitude[item], self.units) - else: - return Quantity(self.magnitude, self.units) - - def __array__(self): - return np.asarray(self.magnitude) - - -@pytest.fixture -def quantity_converter(): - # Create an instance of the conversion interface and - # mock so we can check methods called - qc = munits.ConversionInterface() - - def convert(value, unit, axis): - if hasattr(value, 'units'): - return value.to(unit).magnitude - elif np.iterable(value): - try: - return [v.to(unit).magnitude for v in value] - except AttributeError: - return [Quantity(v, axis.get_units()).to(unit).magnitude - for v in value] - else: - return Quantity(value, axis.get_units()).to(unit).magnitude - - def default_units(value, axis): - if hasattr(value, 'units'): - return value.units - elif np.iterable(value): - for v in value: - if hasattr(v, 'units'): - return v.units - return None - - qc.convert = MagicMock(side_effect=convert) - qc.axisinfo = MagicMock(side_effect=lambda u, a: - munits.AxisInfo(label=u, default_limits=(0, 100))) - qc.default_units = MagicMock(side_effect=default_units) - return qc - - -# Tests that the conversion machinery works properly for classes that -# work as a facade over numpy arrays (like pint) -@image_comparison(['plot_pint.png'], style='mpl20', - tol=0 if platform.machine() == 'x86_64' else 0.01) -def test_numpy_facade(quantity_converter): - # use former defaults to match existing baseline image - plt.rcParams['axes.formatter.limits'] = -7, 7 - - # Register the class - munits.registry[Quantity] = quantity_converter - - # Simple test - y = Quantity(np.linspace(0, 30), 'miles') - x = Quantity(np.linspace(0, 5), 'hours') - - fig, ax = plt.subplots() - fig.subplots_adjust(left=0.15) # Make space for label - ax.plot(x, y, 'tab:blue') - ax.axhline(Quantity(26400, 'feet'), color='tab:red') - ax.axvline(Quantity(120, 'minutes'), color='tab:green') - ax.yaxis.set_units('inches') - ax.xaxis.set_units('seconds') - - assert quantity_converter.convert.called - assert quantity_converter.axisinfo.called - assert quantity_converter.default_units.called - - -# Tests gh-8908 -@image_comparison(['plot_masked_units.png'], remove_text=True, style='mpl20', - tol=0 if platform.machine() == 'x86_64' else 0.01) -def test_plot_masked_units(): - data = np.linspace(-5, 5) - data_masked = np.ma.array(data, mask=(data > -2) & (data < 2)) - data_masked_units = Quantity(data_masked, 'meters') - - fig, ax = plt.subplots() - ax.plot(data_masked_units) - - -def test_empty_set_limits_with_units(quantity_converter): - # Register the class - munits.registry[Quantity] = quantity_converter - - fig, ax = plt.subplots() - ax.set_xlim(Quantity(-1, 'meters'), Quantity(6, 'meters')) - ax.set_ylim(Quantity(-1, 'hours'), Quantity(16, 'hours')) - - -@image_comparison(['jpl_bar_units.png'], - savefig_kwarg={'dpi': 120}, style='mpl20') -def test_jpl_bar_units(): - import matplotlib.testing.jpl_units as units - units.register() - - day = units.Duration("ET", 24.0 * 60.0 * 60.0) - x = [0 * units.km, 1 * units.km, 2 * units.km] - w = [1 * day, 2 * day, 3 * day] - b = units.Epoch("ET", dt=datetime(2009, 4, 25)) - fig, ax = plt.subplots() - ax.bar(x, w, bottom=b) - ax.set_ylim([b - 1 * day, b + w[-1] + (1.001) * day]) - - -@image_comparison(['jpl_barh_units.png'], - savefig_kwarg={'dpi': 120}, style='mpl20') -def test_jpl_barh_units(): - import matplotlib.testing.jpl_units as units - units.register() - - day = units.Duration("ET", 24.0 * 60.0 * 60.0) - x = [0 * units.km, 1 * units.km, 2 * units.km] - w = [1 * day, 2 * day, 3 * day] - b = units.Epoch("ET", dt=datetime(2009, 4, 25)) - - fig, ax = plt.subplots() - ax.barh(x, w, left=b) - ax.set_xlim([b - 1 * day, b + w[-1] + (1.001) * day]) - - -def test_empty_arrays(): - # Check that plotting an empty array with a dtype works - plt.scatter(np.array([], dtype='datetime64[ns]'), np.array([])) - - -def test_scatter_element0_masked(): - times = np.arange('2005-02', '2005-03', dtype='datetime64[D]') - y = np.arange(len(times), dtype=float) - y[0] = np.nan - fig, ax = plt.subplots() - ax.scatter(times, y) - fig.canvas.draw() - - -def test_errorbar_mixed_units(): - x = np.arange(10) - y = [datetime(2020, 5, i * 2 + 1) for i in x] - fig, ax = plt.subplots() - ax.errorbar(x, y, timedelta(days=0.5)) - fig.canvas.draw() - - -@check_figures_equal(extensions=["png"]) -def test_subclass(fig_test, fig_ref): - class subdate(datetime): - pass - - fig_test.subplots().plot(subdate(2000, 1, 1), 0, "o") - fig_ref.subplots().plot(datetime(2000, 1, 1), 0, "o") - - -def test_shared_axis_quantity(quantity_converter): - munits.registry[Quantity] = quantity_converter - x = Quantity(np.linspace(0, 1, 10), "hours") - y1 = Quantity(np.linspace(1, 2, 10), "feet") - y2 = Quantity(np.linspace(3, 4, 10), "feet") - fig, (ax1, ax2) = plt.subplots(2, 1, sharex='all', sharey='all') - ax1.plot(x, y1) - ax2.plot(x, y2) - assert ax1.xaxis.get_units() == ax2.xaxis.get_units() == "hours" - assert ax2.yaxis.get_units() == ax2.yaxis.get_units() == "feet" - ax1.xaxis.set_units("seconds") - ax2.yaxis.set_units("inches") - assert ax1.xaxis.get_units() == ax2.xaxis.get_units() == "seconds" - assert ax1.yaxis.get_units() == ax2.yaxis.get_units() == "inches" - - -def test_shared_axis_datetime(): - # datetime uses dates.DateConverter - y1 = [datetime(2020, i, 1, tzinfo=timezone.utc) for i in range(1, 13)] - y2 = [datetime(2021, i, 1, tzinfo=timezone.utc) for i in range(1, 13)] - fig, (ax1, ax2) = plt.subplots(1, 2, sharey=True) - ax1.plot(y1) - ax2.plot(y2) - ax1.yaxis.set_units(timezone(timedelta(hours=5))) - assert ax2.yaxis.units == timezone(timedelta(hours=5)) - - -def test_shared_axis_categorical(): - # str uses category.StrCategoryConverter - d1 = {"a": 1, "b": 2} - d2 = {"a": 3, "b": 4} - fig, (ax1, ax2) = plt.subplots(1, 2, sharex=True, sharey=True) - ax1.plot(d1.keys(), d1.values()) - ax2.plot(d2.keys(), d2.values()) - ax1.xaxis.set_units(UnitData(["c", "d"])) - assert "c" in ax2.xaxis.get_units()._mapping.keys() - - -def test_empty_default_limits(quantity_converter): - munits.registry[Quantity] = quantity_converter - fig, ax1 = plt.subplots() - ax1.xaxis.update_units(Quantity([10], "miles")) - fig.draw_without_rendering() - assert ax1.get_xlim() == (0, 100) - ax1.yaxis.update_units(Quantity([10], "miles")) - fig.draw_without_rendering() - assert ax1.get_ylim() == (0, 100) - - fig, ax = plt.subplots() - ax.axhline(30) - ax.plot(Quantity(np.arange(0, 3), "miles"), - Quantity(np.arange(0, 6, 2), "feet")) - fig.draw_without_rendering() - assert ax.get_xlim() == (0, 2) - assert ax.get_ylim() == (0, 30) - - fig, ax = plt.subplots() - ax.axvline(30) - ax.plot(Quantity(np.arange(0, 3), "miles"), - Quantity(np.arange(0, 6, 2), "feet")) - fig.draw_without_rendering() - assert ax.get_xlim() == (0, 30) - assert ax.get_ylim() == (0, 4) - - fig, ax = plt.subplots() - ax.xaxis.update_units(Quantity([10], "miles")) - ax.axhline(30) - fig.draw_without_rendering() - assert ax.get_xlim() == (0, 100) - assert ax.get_ylim() == (28.5, 31.5) - - fig, ax = plt.subplots() - ax.yaxis.update_units(Quantity([10], "miles")) - ax.axvline(30) - fig.draw_without_rendering() - assert ax.get_ylim() == (0, 100) - assert ax.get_xlim() == (28.5, 31.5) - - -# test array-like objects... -class Kernel: - def __init__(self, array): - self._array = np.asanyarray(array) - - def __array__(self): - return self._array - - @property - def shape(self): - return self._array.shape - - -def test_plot_kernel(): - # just a smoketest that fail - kernel = Kernel([1, 2, 3, 4, 5]) - plt.plot(kernel) diff --git a/spaces/profayle/TerrapinTalk/myenv/lib/python3.9/site-packages/matplotlib/tri/__init__.py b/spaces/profayle/TerrapinTalk/myenv/lib/python3.9/site-packages/matplotlib/tri/__init__.py deleted file mode 100644 index e000831d8a080a4bf6e8af758b1d978755c2bd14..0000000000000000000000000000000000000000 --- a/spaces/profayle/TerrapinTalk/myenv/lib/python3.9/site-packages/matplotlib/tri/__init__.py +++ /dev/null @@ -1,23 +0,0 @@ -""" -Unstructured triangular grid functions. -""" - -from ._triangulation import Triangulation -from ._tricontour import TriContourSet, tricontour, tricontourf -from ._trifinder import TriFinder, TrapezoidMapTriFinder -from ._triinterpolate import (TriInterpolator, LinearTriInterpolator, - CubicTriInterpolator) -from ._tripcolor import tripcolor -from ._triplot import triplot -from ._trirefine import TriRefiner, UniformTriRefiner -from ._tritools import TriAnalyzer - - -__all__ = ["Triangulation", - "TriContourSet", "tricontour", "tricontourf", - "TriFinder", "TrapezoidMapTriFinder", - "TriInterpolator", "LinearTriInterpolator", "CubicTriInterpolator", - "tripcolor", - "triplot", - "TriRefiner", "UniformTriRefiner", - "TriAnalyzer"] diff --git a/spaces/profayle/TerrapinTalk/myenv/lib/python3.9/site-packages/pandas/tests/extension/test_masked.py b/spaces/profayle/TerrapinTalk/myenv/lib/python3.9/site-packages/pandas/tests/extension/test_masked.py deleted file mode 100644 index c4195be8ea121a2d4f2bd6eb78f05877d7c6d7f3..0000000000000000000000000000000000000000 --- a/spaces/profayle/TerrapinTalk/myenv/lib/python3.9/site-packages/pandas/tests/extension/test_masked.py +++ /dev/null @@ -1,435 +0,0 @@ -""" -This file contains a minimal set of tests for compliance with the extension -array interface test suite, and should contain no other tests. -The test suite for the full functionality of the array is located in -`pandas/tests/arrays/`. - -The tests in this file are inherited from the BaseExtensionTests, and only -minimal tweaks should be applied to get the tests passing (by overwriting a -parent method). - -Additional tests should either be added to one of the BaseExtensionTests -classes (if they are relevant for the extension interface for all dtypes), or -be added to the array-specific tests in `pandas/tests/arrays/`. - -""" -import numpy as np -import pytest - -from pandas.compat import ( - IS64, - is_platform_windows, -) - -import pandas as pd -import pandas._testing as tm -from pandas.core.arrays.boolean import BooleanDtype -from pandas.core.arrays.floating import ( - Float32Dtype, - Float64Dtype, -) -from pandas.core.arrays.integer import ( - Int8Dtype, - Int16Dtype, - Int32Dtype, - Int64Dtype, - UInt8Dtype, - UInt16Dtype, - UInt32Dtype, - UInt64Dtype, -) -from pandas.tests.extension import base - -is_windows_or_32bit = is_platform_windows() or not IS64 - -pytestmark = [ - pytest.mark.filterwarnings( - "ignore:invalid value encountered in divide:RuntimeWarning" - ), - pytest.mark.filterwarnings("ignore:Mean of empty slice:RuntimeWarning"), - # overflow only relevant for Floating dtype cases cases - pytest.mark.filterwarnings("ignore:overflow encountered in reduce:RuntimeWarning"), -] - - -def make_data(): - return list(range(1, 9)) + [pd.NA] + list(range(10, 98)) + [pd.NA] + [99, 100] - - -def make_float_data(): - return ( - list(np.arange(0.1, 0.9, 0.1)) - + [pd.NA] - + list(np.arange(1, 9.8, 0.1)) - + [pd.NA] - + [9.9, 10.0] - ) - - -def make_bool_data(): - return [True, False] * 4 + [np.nan] + [True, False] * 44 + [np.nan] + [True, False] - - -@pytest.fixture( - params=[ - Int8Dtype, - Int16Dtype, - Int32Dtype, - Int64Dtype, - UInt8Dtype, - UInt16Dtype, - UInt32Dtype, - UInt64Dtype, - Float32Dtype, - Float64Dtype, - BooleanDtype, - ] -) -def dtype(request): - return request.param() - - -@pytest.fixture -def data(dtype): - if dtype.kind == "f": - data = make_float_data() - elif dtype.kind == "b": - data = make_bool_data() - else: - data = make_data() - return pd.array(data, dtype=dtype) - - -@pytest.fixture -def data_for_twos(dtype): - if dtype.kind == "b": - return pd.array(np.ones(100), dtype=dtype) - return pd.array(np.ones(100) * 2, dtype=dtype) - - -@pytest.fixture -def data_missing(dtype): - if dtype.kind == "f": - return pd.array([pd.NA, 0.1], dtype=dtype) - elif dtype.kind == "b": - return pd.array([np.nan, True], dtype=dtype) - return pd.array([pd.NA, 1], dtype=dtype) - - -@pytest.fixture -def data_for_sorting(dtype): - if dtype.kind == "f": - return pd.array([0.1, 0.2, 0.0], dtype=dtype) - elif dtype.kind == "b": - return pd.array([True, True, False], dtype=dtype) - return pd.array([1, 2, 0], dtype=dtype) - - -@pytest.fixture -def data_missing_for_sorting(dtype): - if dtype.kind == "f": - return pd.array([0.1, pd.NA, 0.0], dtype=dtype) - elif dtype.kind == "b": - return pd.array([True, np.nan, False], dtype=dtype) - return pd.array([1, pd.NA, 0], dtype=dtype) - - -@pytest.fixture -def na_cmp(): - # we are pd.NA - return lambda x, y: x is pd.NA and y is pd.NA - - -@pytest.fixture -def data_for_grouping(dtype): - if dtype.kind == "f": - b = 0.1 - a = 0.0 - c = 0.2 - elif dtype.kind == "b": - b = True - a = False - c = b - else: - b = 1 - a = 0 - c = 2 - - na = pd.NA - return pd.array([b, b, na, na, a, a, b, c], dtype=dtype) - - -class TestDtype(base.BaseDtypeTests): - pass - - -class TestArithmeticOps(base.BaseArithmeticOpsTests): - def _get_expected_exception(self, op_name, obj, other): - try: - dtype = tm.get_dtype(obj) - except AttributeError: - # passed arguments reversed - dtype = tm.get_dtype(other) - - if dtype.kind == "b": - if op_name.strip("_").lstrip("r") in ["pow", "truediv", "floordiv"]: - # match behavior with non-masked bool dtype - return NotImplementedError - elif op_name in ["__sub__", "__rsub__"]: - # exception message would include "numpy boolean subtract"" - return TypeError - return None - return super()._get_expected_exception(op_name, obj, other) - - def _cast_pointwise_result(self, op_name: str, obj, other, pointwise_result): - sdtype = tm.get_dtype(obj) - expected = pointwise_result - - if sdtype.kind in "iu": - if op_name in ("__rtruediv__", "__truediv__", "__div__"): - expected = expected.fillna(np.nan).astype("Float64") - else: - # combine method result in 'biggest' (int64) dtype - expected = expected.astype(sdtype) - elif sdtype.kind == "b": - if op_name in ( - "__floordiv__", - "__rfloordiv__", - "__pow__", - "__rpow__", - "__mod__", - "__rmod__", - ): - # combine keeps boolean type - expected = expected.astype("Int8") - - elif op_name in ("__truediv__", "__rtruediv__"): - # combine with bools does not generate the correct result - # (numpy behaviour for div is to regard the bools as numeric) - op = self.get_op_from_name(op_name) - expected = self._combine(obj.astype(float), other, op) - expected = expected.astype("Float64") - - if op_name == "__rpow__": - # for rpow, combine does not propagate NaN - result = getattr(obj, op_name)(other) - expected[result.isna()] = np.nan - else: - # combine method result in 'biggest' (float64) dtype - expected = expected.astype(sdtype) - return expected - - series_scalar_exc = None - series_array_exc = None - frame_scalar_exc = None - divmod_exc = None - - def test_divmod_series_array(self, data, data_for_twos, request): - if data.dtype.kind == "b": - mark = pytest.mark.xfail( - reason="Inconsistency between floordiv and divmod; we raise for " - "floordiv but not for divmod. This matches what we do for " - "non-masked bool dtype." - ) - request.node.add_marker(mark) - super().test_divmod_series_array(data, data_for_twos) - - -class TestComparisonOps(base.BaseComparisonOpsTests): - series_scalar_exc = None - series_array_exc = None - frame_scalar_exc = None - - def _cast_pointwise_result(self, op_name: str, obj, other, pointwise_result): - return pointwise_result.astype("boolean") - - -class TestInterface(base.BaseInterfaceTests): - pass - - -class TestConstructors(base.BaseConstructorsTests): - pass - - -class TestReshaping(base.BaseReshapingTests): - pass - - # for test_concat_mixed_dtypes test - # concat of an Integer and Int coerces to object dtype - # TODO(jreback) once integrated this would - - -class TestGetitem(base.BaseGetitemTests): - pass - - -class TestSetitem(base.BaseSetitemTests): - pass - - -class TestIndex(base.BaseIndexTests): - pass - - -class TestMissing(base.BaseMissingTests): - pass - - -class TestMethods(base.BaseMethodsTests): - def test_combine_le(self, data_repeated): - # TODO: patching self is a bad pattern here - orig_data1, orig_data2 = data_repeated(2) - if orig_data1.dtype.kind == "b": - self._combine_le_expected_dtype = "boolean" - else: - # TODO: can we make this boolean? - self._combine_le_expected_dtype = object - super().test_combine_le(data_repeated) - - -class TestCasting(base.BaseCastingTests): - pass - - -class TestGroupby(base.BaseGroupbyTests): - pass - - -class TestReduce(base.BaseReduceTests): - def _supports_reduction(self, obj, op_name: str) -> bool: - if op_name in ["any", "all"] and tm.get_dtype(obj).kind != "b": - pytest.skip(reason="Tested in tests/reductions/test_reductions.py") - return True - - def check_reduce(self, ser: pd.Series, op_name: str, skipna: bool): - # overwrite to ensure pd.NA is tested instead of np.nan - # https://github.com/pandas-dev/pandas/issues/30958 - - cmp_dtype = "int64" - if ser.dtype.kind == "f": - # Item "dtype[Any]" of "Union[dtype[Any], ExtensionDtype]" has - # no attribute "numpy_dtype" - cmp_dtype = ser.dtype.numpy_dtype # type: ignore[union-attr] - elif ser.dtype.kind == "b": - if op_name in ["min", "max"]: - cmp_dtype = "bool" - - if op_name == "count": - result = getattr(ser, op_name)() - expected = getattr(ser.dropna().astype(cmp_dtype), op_name)() - else: - result = getattr(ser, op_name)(skipna=skipna) - expected = getattr(ser.dropna().astype(cmp_dtype), op_name)(skipna=skipna) - if not skipna and ser.isna().any() and op_name not in ["any", "all"]: - expected = pd.NA - tm.assert_almost_equal(result, expected) - - def _get_expected_reduction_dtype(self, arr, op_name: str): - if tm.is_float_dtype(arr.dtype): - cmp_dtype = arr.dtype.name - elif op_name in ["mean", "median", "var", "std", "skew"]: - cmp_dtype = "Float64" - elif op_name in ["max", "min"]: - cmp_dtype = arr.dtype.name - elif arr.dtype in ["Int64", "UInt64"]: - cmp_dtype = arr.dtype.name - elif tm.is_signed_integer_dtype(arr.dtype): - cmp_dtype = "Int32" if is_windows_or_32bit else "Int64" - elif tm.is_unsigned_integer_dtype(arr.dtype): - cmp_dtype = "UInt32" if is_windows_or_32bit else "UInt64" - elif arr.dtype.kind == "b": - if op_name in ["mean", "median", "var", "std", "skew"]: - cmp_dtype = "Float64" - elif op_name in ["min", "max"]: - cmp_dtype = "boolean" - elif op_name in ["sum", "prod"]: - cmp_dtype = "Int32" if is_windows_or_32bit else "Int64" - else: - raise TypeError("not supposed to reach this") - else: - raise TypeError("not supposed to reach this") - return cmp_dtype - - -class TestAccumulation(base.BaseAccumulateTests): - def _supports_accumulation(self, ser: pd.Series, op_name: str) -> bool: - return True - - def check_accumulate(self, ser: pd.Series, op_name: str, skipna: bool): - # overwrite to ensure pd.NA is tested instead of np.nan - # https://github.com/pandas-dev/pandas/issues/30958 - length = 64 - if not IS64 or is_platform_windows(): - # Item "ExtensionDtype" of "Union[dtype[Any], ExtensionDtype]" has - # no attribute "itemsize" - if not ser.dtype.itemsize == 8: # type: ignore[union-attr] - length = 32 - - if ser.dtype.name.startswith("U"): - expected_dtype = f"UInt{length}" - elif ser.dtype.name.startswith("I"): - expected_dtype = f"Int{length}" - elif ser.dtype.name.startswith("F"): - # Incompatible types in assignment (expression has type - # "Union[dtype[Any], ExtensionDtype]", variable has type "str") - expected_dtype = ser.dtype # type: ignore[assignment] - elif ser.dtype.kind == "b": - if op_name in ("cummin", "cummax"): - expected_dtype = "boolean" - else: - expected_dtype = f"Int{length}" - - if op_name == "cumsum": - result = getattr(ser, op_name)(skipna=skipna) - expected = pd.Series( - pd.array( - getattr(ser.astype("float64"), op_name)(skipna=skipna), - dtype=expected_dtype, - ) - ) - tm.assert_series_equal(result, expected) - elif op_name in ["cummax", "cummin"]: - result = getattr(ser, op_name)(skipna=skipna) - expected = pd.Series( - pd.array( - getattr(ser.astype("float64"), op_name)(skipna=skipna), - dtype=ser.dtype, - ) - ) - tm.assert_series_equal(result, expected) - elif op_name == "cumprod": - result = getattr(ser[:12], op_name)(skipna=skipna) - expected = pd.Series( - pd.array( - getattr(ser[:12].astype("float64"), op_name)(skipna=skipna), - dtype=expected_dtype, - ) - ) - tm.assert_series_equal(result, expected) - - else: - raise NotImplementedError(f"{op_name} not supported") - - -class TestUnaryOps(base.BaseUnaryOpsTests): - def test_invert(self, data, request): - if data.dtype.kind == "f": - mark = pytest.mark.xfail( - reason="Looks like the base class test implicitly assumes " - "boolean/integer dtypes" - ) - request.node.add_marker(mark) - super().test_invert(data) - - -class TestPrinting(base.BasePrintingTests): - pass - - -class TestParsing(base.BaseParsingTests): - pass - - -class Test2DCompat(base.Dim2CompatTests): - pass diff --git a/spaces/profayle/TerrapinTalk/myenv/lib/python3.9/site-packages/pandas/tests/io/excel/conftest.py b/spaces/profayle/TerrapinTalk/myenv/lib/python3.9/site-packages/pandas/tests/io/excel/conftest.py deleted file mode 100644 index 15ff52d5bea48395b88b2f9165de35b9217f73b1..0000000000000000000000000000000000000000 --- a/spaces/profayle/TerrapinTalk/myenv/lib/python3.9/site-packages/pandas/tests/io/excel/conftest.py +++ /dev/null @@ -1,41 +0,0 @@ -import pytest - -import pandas._testing as tm - -from pandas.io.parsers import read_csv - - -@pytest.fixture -def frame(float_frame): - """ - Returns the first ten items in fixture "float_frame". - """ - return float_frame[:10] - - -@pytest.fixture -def tsframe(): - return tm.makeTimeDataFrame()[:5] - - -@pytest.fixture(params=[True, False]) -def merge_cells(request): - return request.param - - -@pytest.fixture -def df_ref(datapath): - """ - Obtain the reference data from read_csv with the Python engine. - """ - filepath = datapath("io", "data", "csv", "test1.csv") - df_ref = read_csv(filepath, index_col=0, parse_dates=True, engine="python") - return df_ref - - -@pytest.fixture(params=[".xls", ".xlsx", ".xlsm", ".ods", ".xlsb"]) -def read_ext(request): - """ - Valid extensions for reading Excel files. - """ - return request.param diff --git a/spaces/profayle/TerrapinTalk/myenv/lib/python3.9/site-packages/tomlkit/container.py b/spaces/profayle/TerrapinTalk/myenv/lib/python3.9/site-packages/tomlkit/container.py deleted file mode 100644 index 27d69170179317085c62715cff9ce0c810148e96..0000000000000000000000000000000000000000 --- a/spaces/profayle/TerrapinTalk/myenv/lib/python3.9/site-packages/tomlkit/container.py +++ /dev/null @@ -1,866 +0,0 @@ -from __future__ import annotations - -import copy - -from typing import Any -from typing import Iterator - -from tomlkit._compat import decode -from tomlkit._types import _CustomDict -from tomlkit._utils import merge_dicts -from tomlkit.exceptions import KeyAlreadyPresent -from tomlkit.exceptions import NonExistentKey -from tomlkit.exceptions import TOMLKitError -from tomlkit.items import AoT -from tomlkit.items import Comment -from tomlkit.items import Item -from tomlkit.items import Key -from tomlkit.items import Null -from tomlkit.items import SingleKey -from tomlkit.items import Table -from tomlkit.items import Trivia -from tomlkit.items import Whitespace -from tomlkit.items import item as _item - - -_NOT_SET = object() - - -class Container(_CustomDict): - """ - A container for items within a TOMLDocument. - - This class implements the `dict` interface with copy/deepcopy protocol. - """ - - def __init__(self, parsed: bool = False) -> None: - self._map: dict[SingleKey, int | tuple[int, ...]] = {} - self._body: list[tuple[Key | None, Item]] = [] - self._parsed = parsed - self._table_keys = [] - - @property - def body(self) -> list[tuple[Key | None, Item]]: - return self._body - - def unwrap(self) -> dict[str, Any]: - unwrapped = {} - for k, v in self.items(): - if k is None: - continue - - if isinstance(k, Key): - k = k.key - - if hasattr(v, "unwrap"): - v = v.unwrap() - - if k in unwrapped: - merge_dicts(unwrapped[k], v) - else: - unwrapped[k] = v - - return unwrapped - - @property - def value(self) -> dict[str, Any]: - d = {} - for k, v in self._body: - if k is None: - continue - - k = k.key - v = v.value - - if isinstance(v, Container): - v = v.value - - if k in d: - merge_dicts(d[k], v) - else: - d[k] = v - - return d - - def parsing(self, parsing: bool) -> None: - self._parsed = parsing - - for _, v in self._body: - if isinstance(v, Table): - v.value.parsing(parsing) - elif isinstance(v, AoT): - for t in v.body: - t.value.parsing(parsing) - - def add(self, key: Key | Item | str, item: Item | None = None) -> Container: - """ - Adds an item to the current Container. - - :Example: - - >>> # add a key-value pair - >>> doc.add('key', 'value') - >>> # add a comment or whitespace or newline - >>> doc.add(comment('# comment')) - """ - if item is None: - if not isinstance(key, (Comment, Whitespace)): - raise ValueError( - "Non comment/whitespace items must have an associated key" - ) - - key, item = None, key - - return self.append(key, item) - - def _handle_dotted_key(self, key: Key, value: Item) -> None: - if isinstance(value, (Table, AoT)): - raise TOMLKitError("Can't add a table to a dotted key") - name, *mid, last = key - name._dotted = True - table = current = Table(Container(True), Trivia(), False, is_super_table=True) - for _name in mid: - _name._dotted = True - new_table = Table(Container(True), Trivia(), False, is_super_table=True) - current.append(_name, new_table) - current = new_table - - last.sep = key.sep - current.append(last, value) - - self.append(name, table) - return - - def _get_last_index_before_table(self) -> int: - last_index = -1 - for i, (k, v) in enumerate(self._body): - if isinstance(v, Null): - continue # Null elements are inserted after deletion - - if isinstance(v, Whitespace) and not v.is_fixed(): - continue - - if isinstance(v, (Table, AoT)) and not k.is_dotted(): - break - last_index = i - return last_index + 1 - - def append(self, key: Key | str | None, item: Item) -> Container: - """Similar to :meth:`add` but both key and value must be given.""" - if not isinstance(key, Key) and key is not None: - key = SingleKey(key) - - if not isinstance(item, Item): - item = _item(item) - - if key is not None and key.is_multi(): - self._handle_dotted_key(key, item) - return self - - if isinstance(item, (AoT, Table)) and item.name is None: - item.name = key.key - - prev = self._previous_item() - prev_ws = isinstance(prev, Whitespace) or ends_with_whitespace(prev) - if isinstance(item, Table): - if not self._parsed: - item.invalidate_display_name() - if ( - self._body - and not (self._parsed or item.trivia.indent or prev_ws) - and not key.is_dotted() - ): - item.trivia.indent = "\n" - - if isinstance(item, AoT) and self._body and not self._parsed: - item.invalidate_display_name() - if item and not ("\n" in item[0].trivia.indent or prev_ws): - item[0].trivia.indent = "\n" + item[0].trivia.indent - - if key is not None and key in self: - current_idx = self._map[key] - if isinstance(current_idx, tuple): - current_body_element = self._body[current_idx[-1]] - else: - current_body_element = self._body[current_idx] - - current = current_body_element[1] - - if isinstance(item, Table): - if not isinstance(current, (Table, AoT)): - raise KeyAlreadyPresent(key) - - if item.is_aot_element(): - # New AoT element found later on - # Adding it to the current AoT - if not isinstance(current, AoT): - current = AoT([current, item], parsed=self._parsed) - - self._replace(key, key, current) - else: - current.append(item) - - return self - elif current.is_aot(): - if not item.is_aot_element(): - # Tried to define a table after an AoT with the same name. - raise KeyAlreadyPresent(key) - - current.append(item) - - return self - elif current.is_super_table(): - if item.is_super_table(): - # We need to merge both super tables - if ( - self._table_keys[-1] != current_body_element[0] - or key.is_dotted() - or current_body_element[0].is_dotted() - ): - if key.is_dotted() and not self._parsed: - idx = self._get_last_index_before_table() - else: - idx = len(self._body) - - if idx < len(self._body): - self._insert_at(idx, key, item) - else: - self._raw_append(key, item) - - # Building a temporary proxy to check for errors - OutOfOrderTableProxy(self, self._map[key]) - - return self - - # Create a new element to replace the old one - current = copy.deepcopy(current) - for k, v in item.value.body: - current.append(k, v) - self._body[ - current_idx[-1] - if isinstance(current_idx, tuple) - else current_idx - ] = (current_body_element[0], current) - - return self - elif current_body_element[0].is_dotted(): - raise TOMLKitError("Redefinition of an existing table") - elif not item.is_super_table(): - raise KeyAlreadyPresent(key) - elif isinstance(item, AoT): - if not isinstance(current, AoT): - # Tried to define an AoT after a table with the same name. - raise KeyAlreadyPresent(key) - - for table in item.body: - current.append(table) - - return self - else: - raise KeyAlreadyPresent(key) - - is_table = isinstance(item, (Table, AoT)) - if ( - key is not None - and self._body - and not self._parsed - and (not is_table or key.is_dotted()) - ): - # If there is already at least one table in the current container - # and the given item is not a table, we need to find the last - # item that is not a table and insert after it - # If no such item exists, insert at the top of the table - last_index = self._get_last_index_before_table() - - if last_index < len(self._body): - return self._insert_at(last_index, key, item) - else: - previous_item = self._body[-1][1] - if not ( - isinstance(previous_item, Whitespace) - or ends_with_whitespace(previous_item) - or "\n" in previous_item.trivia.trail - ): - previous_item.trivia.trail += "\n" - - self._raw_append(key, item) - return self - - def _raw_append(self, key: Key, item: Item) -> None: - if key in self._map: - current_idx = self._map[key] - if not isinstance(current_idx, tuple): - current_idx = (current_idx,) - - current = self._body[current_idx[-1]][1] - if key is not None and not isinstance(current, Table): - raise KeyAlreadyPresent(key) - - self._map[key] = current_idx + (len(self._body),) - else: - self._map[key] = len(self._body) - - self._body.append((key, item)) - if item.is_table(): - self._table_keys.append(key) - - if key is not None: - dict.__setitem__(self, key.key, item.value) - - return self - - def _remove_at(self, idx: int) -> None: - key = self._body[idx][0] - index = self._map.get(key) - if index is None: - raise NonExistentKey(key) - self._body[idx] = (None, Null()) - - if isinstance(index, tuple): - index = list(index) - index.remove(idx) - if len(index) == 1: - index = index.pop() - else: - index = tuple(index) - self._map[key] = index - else: - dict.__delitem__(self, key.key) - self._map.pop(key) - - def remove(self, key: Key | str) -> Container: - """Remove a key from the container.""" - if not isinstance(key, Key): - key = SingleKey(key) - - idx = self._map.pop(key, None) - if idx is None: - raise NonExistentKey(key) - - if isinstance(idx, tuple): - for i in idx: - self._body[i] = (None, Null()) - else: - self._body[idx] = (None, Null()) - - dict.__delitem__(self, key.key) - - return self - - def _insert_after( - self, key: Key | str, other_key: Key | str, item: Any - ) -> Container: - if key is None: - raise ValueError("Key cannot be null in insert_after()") - - if key not in self: - raise NonExistentKey(key) - - if not isinstance(key, Key): - key = SingleKey(key) - - if not isinstance(other_key, Key): - other_key = SingleKey(other_key) - - item = _item(item) - - idx = self._map[key] - # Insert after the max index if there are many. - if isinstance(idx, tuple): - idx = max(idx) - current_item = self._body[idx][1] - if "\n" not in current_item.trivia.trail: - current_item.trivia.trail += "\n" - - # Increment indices after the current index - for k, v in self._map.items(): - if isinstance(v, tuple): - new_indices = [] - for v_ in v: - if v_ > idx: - v_ = v_ + 1 - - new_indices.append(v_) - - self._map[k] = tuple(new_indices) - elif v > idx: - self._map[k] = v + 1 - - self._map[other_key] = idx + 1 - self._body.insert(idx + 1, (other_key, item)) - - if key is not None: - dict.__setitem__(self, other_key.key, item.value) - - return self - - def _insert_at(self, idx: int, key: Key | str, item: Any) -> Container: - if idx > len(self._body) - 1: - raise ValueError(f"Unable to insert at position {idx}") - - if not isinstance(key, Key): - key = SingleKey(key) - - item = _item(item) - - if idx > 0: - previous_item = self._body[idx - 1][1] - if not ( - isinstance(previous_item, Whitespace) - or ends_with_whitespace(previous_item) - or isinstance(item, (AoT, Table)) - or "\n" in previous_item.trivia.trail - ): - previous_item.trivia.trail += "\n" - - # Increment indices after the current index - for k, v in self._map.items(): - if isinstance(v, tuple): - new_indices = [] - for v_ in v: - if v_ >= idx: - v_ = v_ + 1 - - new_indices.append(v_) - - self._map[k] = tuple(new_indices) - elif v >= idx: - self._map[k] = v + 1 - - if key in self._map: - current_idx = self._map[key] - if not isinstance(current_idx, tuple): - current_idx = (current_idx,) - self._map[key] = current_idx + (idx,) - else: - self._map[key] = idx - self._body.insert(idx, (key, item)) - - dict.__setitem__(self, key.key, item.value) - - return self - - def item(self, key: Key | str) -> Item: - """Get an item for the given key.""" - if not isinstance(key, Key): - key = SingleKey(key) - - idx = self._map.get(key) - if idx is None: - raise NonExistentKey(key) - - if isinstance(idx, tuple): - # The item we are getting is an out of order table - # so we need a proxy to retrieve the proper objects - # from the parent container - return OutOfOrderTableProxy(self, idx) - - return self._body[idx][1] - - def last_item(self) -> Item | None: - """Get the last item.""" - if self._body: - return self._body[-1][1] - - def as_string(self) -> str: - """Render as TOML string.""" - s = "" - for k, v in self._body: - if k is not None: - if isinstance(v, Table): - s += self._render_table(k, v) - elif isinstance(v, AoT): - s += self._render_aot(k, v) - else: - s += self._render_simple_item(k, v) - else: - s += self._render_simple_item(k, v) - - return s - - def _render_table(self, key: Key, table: Table, prefix: str | None = None) -> str: - cur = "" - - if table.display_name is not None: - _key = table.display_name - else: - _key = key.as_string() - - if prefix is not None: - _key = prefix + "." + _key - - if not table.is_super_table() or ( - any( - not isinstance(v, (Table, AoT, Whitespace, Null)) - for _, v in table.value.body - ) - and not key.is_dotted() - ): - open_, close = "[", "]" - if table.is_aot_element(): - open_, close = "[[", "]]" - - newline_in_table_trivia = ( - "\n" if "\n" not in table.trivia.trail and len(table.value) > 0 else "" - ) - cur += ( - f"{table.trivia.indent}" - f"{open_}" - f"{decode(_key)}" - f"{close}" - f"{table.trivia.comment_ws}" - f"{decode(table.trivia.comment)}" - f"{table.trivia.trail}" - f"{newline_in_table_trivia}" - ) - elif table.trivia.indent == "\n": - cur += table.trivia.indent - - for k, v in table.value.body: - if isinstance(v, Table): - if v.is_super_table(): - if k.is_dotted() and not key.is_dotted(): - # Dotted key inside table - cur += self._render_table(k, v) - else: - cur += self._render_table(k, v, prefix=_key) - else: - cur += self._render_table(k, v, prefix=_key) - elif isinstance(v, AoT): - cur += self._render_aot(k, v, prefix=_key) - else: - cur += self._render_simple_item( - k, v, prefix=_key if key.is_dotted() else None - ) - - return cur - - def _render_aot(self, key, aot, prefix=None): - _key = key.as_string() - if prefix is not None: - _key = prefix + "." + _key - - cur = "" - _key = decode(_key) - for table in aot.body: - cur += self._render_aot_table(table, prefix=_key) - - return cur - - def _render_aot_table(self, table: Table, prefix: str | None = None) -> str: - cur = "" - _key = prefix or "" - open_, close = "[[", "]]" - - cur += ( - f"{table.trivia.indent}" - f"{open_}" - f"{decode(_key)}" - f"{close}" - f"{table.trivia.comment_ws}" - f"{decode(table.trivia.comment)}" - f"{table.trivia.trail}" - ) - - for k, v in table.value.body: - if isinstance(v, Table): - if v.is_super_table(): - if k.is_dotted(): - # Dotted key inside table - cur += self._render_table(k, v) - else: - cur += self._render_table(k, v, prefix=_key) - else: - cur += self._render_table(k, v, prefix=_key) - elif isinstance(v, AoT): - cur += self._render_aot(k, v, prefix=_key) - else: - cur += self._render_simple_item(k, v) - - return cur - - def _render_simple_item(self, key, item, prefix=None): - if key is None: - return item.as_string() - - _key = key.as_string() - if prefix is not None: - _key = prefix + "." + _key - - return ( - f"{item.trivia.indent}" - f"{decode(_key)}" - f"{key.sep}" - f"{decode(item.as_string())}" - f"{item.trivia.comment_ws}" - f"{decode(item.trivia.comment)}" - f"{item.trivia.trail}" - ) - - def __len__(self) -> int: - return dict.__len__(self) - - def __iter__(self) -> Iterator[str]: - return iter(dict.keys(self)) - - # Dictionary methods - def __getitem__(self, key: Key | str) -> Item | Container: - if not isinstance(key, Key): - key = SingleKey(key) - - idx = self._map.get(key) - if idx is None: - raise NonExistentKey(key) - - if isinstance(idx, tuple): - # The item we are getting is an out of order table - # so we need a proxy to retrieve the proper objects - # from the parent container - return OutOfOrderTableProxy(self, idx) - - item = self._body[idx][1] - if item.is_boolean(): - return item.value - - return item - - def __setitem__(self, key: Key | str, value: Any) -> None: - if key is not None and key in self: - old_key = next(filter(lambda k: k == key, self._map)) - self._replace(old_key, key, value) - else: - self.append(key, value) - - def __delitem__(self, key: Key | str) -> None: - self.remove(key) - - def setdefault(self, key: Key | str, default: Any) -> Any: - super().setdefault(key, default=default) - return self[key] - - def _replace(self, key: Key | str, new_key: Key | str, value: Item) -> None: - if not isinstance(key, Key): - key = SingleKey(key) - - idx = self._map.get(key) - if idx is None: - raise NonExistentKey(key) - - self._replace_at(idx, new_key, value) - - def _replace_at( - self, idx: int | tuple[int], new_key: Key | str, value: Item - ) -> None: - value = _item(value) - - if isinstance(idx, tuple): - for i in idx[1:]: - self._body[i] = (None, Null()) - - idx = idx[0] - - k, v = self._body[idx] - if not isinstance(new_key, Key): - if ( - isinstance(value, (AoT, Table)) != isinstance(v, (AoT, Table)) - or new_key != k.key - ): - new_key = SingleKey(new_key) - else: # Inherit the sep of the old key - new_key = k - - del self._map[k] - self._map[new_key] = idx - if new_key != k: - dict.__delitem__(self, k) - - if isinstance(value, (AoT, Table)) != isinstance(v, (AoT, Table)): - # new tables should appear after all non-table values - self.remove(k) - for i in range(idx, len(self._body)): - if isinstance(self._body[i][1], (AoT, Table)): - self._insert_at(i, new_key, value) - idx = i - break - else: - idx = -1 - self.append(new_key, value) - else: - # Copying trivia - if not isinstance(value, (Whitespace, AoT)): - value.trivia.indent = v.trivia.indent - value.trivia.comment_ws = value.trivia.comment_ws or v.trivia.comment_ws - value.trivia.comment = value.trivia.comment or v.trivia.comment - value.trivia.trail = v.trivia.trail - self._body[idx] = (new_key, value) - - if hasattr(value, "invalidate_display_name"): - value.invalidate_display_name() # type: ignore[attr-defined] - - if isinstance(value, Table): - # Insert a cosmetic new line for tables if: - # - it does not have it yet OR is not followed by one - # - it is not the last item - last, _ = self._previous_item_with_index() - idx = last if idx < 0 else idx - has_ws = ends_with_whitespace(value) - next_ws = idx < last and isinstance(self._body[idx + 1][1], Whitespace) - if idx < last and not (next_ws or has_ws): - value.append(None, Whitespace("\n")) - - dict.__setitem__(self, new_key.key, value.value) - - def __str__(self) -> str: - return str(self.value) - - def __repr__(self) -> str: - return repr(self.value) - - def __eq__(self, other: dict) -> bool: - if not isinstance(other, dict): - return NotImplemented - - return self.value == other - - def _getstate(self, protocol): - return (self._parsed,) - - def __reduce__(self): - return self.__reduce_ex__(2) - - def __reduce_ex__(self, protocol): - return ( - self.__class__, - self._getstate(protocol), - (self._map, self._body, self._parsed, self._table_keys), - ) - - def __setstate__(self, state): - self._map = state[0] - self._body = state[1] - self._parsed = state[2] - self._table_keys = state[3] - - for key, item in self._body: - if key is not None: - dict.__setitem__(self, key.key, item.value) - - def copy(self) -> Container: - return copy.copy(self) - - def __copy__(self) -> Container: - c = self.__class__(self._parsed) - for k, v in dict.items(self): - dict.__setitem__(c, k, v) - - c._body += self.body - c._map.update(self._map) - - return c - - def _previous_item_with_index( - self, idx: int | None = None, ignore=(Null,) - ) -> tuple[int, Item] | None: - """Find the immediate previous item before index ``idx``""" - if idx is None or idx > len(self._body): - idx = len(self._body) - for i in range(idx - 1, -1, -1): - v = self._body[i][-1] - if not isinstance(v, ignore): - return i, v - return None - - def _previous_item(self, idx: int | None = None, ignore=(Null,)) -> Item | None: - """Find the immediate previous item before index ``idx``. - If ``idx`` is not given, the last item is returned. - """ - prev = self._previous_item_with_index(idx, ignore) - return prev[-1] if prev else None - - -class OutOfOrderTableProxy(_CustomDict): - def __init__(self, container: Container, indices: tuple[int]) -> None: - self._container = container - self._internal_container = Container(True) - self._tables = [] - self._tables_map = {} - - for i in indices: - _, item = self._container._body[i] - - if isinstance(item, Table): - self._tables.append(item) - table_idx = len(self._tables) - 1 - for k, v in item.value.body: - self._internal_container.append(k, v) - self._tables_map[k] = table_idx - if k is not None: - dict.__setitem__(self, k.key, v) - - def unwrap(self) -> str: - return self._internal_container.unwrap() - - @property - def value(self): - return self._internal_container.value - - def __getitem__(self, key: Key | str) -> Any: - if key not in self._internal_container: - raise NonExistentKey(key) - - return self._internal_container[key] - - def __setitem__(self, key: Key | str, item: Any) -> None: - if key in self._tables_map: - table = self._tables[self._tables_map[key]] - table[key] = item - elif self._tables: - table = self._tables[0] - table[key] = item - else: - self._container[key] = item - - self._internal_container[key] = item - if key is not None: - dict.__setitem__(self, key, item) - - def _remove_table(self, table: Table) -> None: - """Remove table from the parent container""" - self._tables.remove(table) - for idx, item in enumerate(self._container._body): - if item[1] is table: - self._container._remove_at(idx) - break - - def __delitem__(self, key: Key | str) -> None: - if key in self._tables_map: - table = self._tables[self._tables_map[key]] - del table[key] - if not table and len(self._tables) > 1: - self._remove_table(table) - del self._tables_map[key] - else: - raise NonExistentKey(key) - - del self._internal_container[key] - if key is not None: - dict.__delitem__(self, key) - - def __iter__(self) -> Iterator[str]: - return iter(dict.keys(self)) - - def __len__(self) -> int: - return dict.__len__(self) - - def setdefault(self, key: Key | str, default: Any) -> Any: - super().setdefault(key, default=default) - return self[key] - - -def ends_with_whitespace(it: Any) -> bool: - """Returns ``True`` if the given item ``it`` is a ``Table`` or ``AoT`` object - ending with a ``Whitespace``. - """ - return ( - isinstance(it, Table) and isinstance(it.value._previous_item(), Whitespace) - ) or (isinstance(it, AoT) and len(it) > 0 and isinstance(it[-1], Whitespace)) diff --git a/spaces/pyInter/Liyuu_sovits4/modules/__init__.py b/spaces/pyInter/Liyuu_sovits4/modules/__init__.py deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/spaces/pyodide-demo/self-hosted/pyb2d.js b/spaces/pyodide-demo/self-hosted/pyb2d.js deleted file mode 100644 index 2f939fee43b3a2a94abe98ff90fd302e7a79c07e..0000000000000000000000000000000000000000 --- a/spaces/pyodide-demo/self-hosted/pyb2d.js +++ /dev/null @@ -1 +0,0 @@ -var Module=typeof globalThis.__pyodide_module!=="undefined"?globalThis.__pyodide_module:{};if(!Module.expectedDataFileDownloads){Module.expectedDataFileDownloads=0}Module.expectedDataFileDownloads++;(function(){var loadPackage=function(metadata){var PACKAGE_PATH="";if(typeof window==="object"){PACKAGE_PATH=window["encodeURIComponent"](window.location.pathname.toString().substring(0,window.location.pathname.toString().lastIndexOf("/"))+"/")}else if(typeof process==="undefined"&&typeof location!=="undefined"){PACKAGE_PATH=encodeURIComponent(location.pathname.toString().substring(0,location.pathname.toString().lastIndexOf("/"))+"/")}var PACKAGE_NAME="pyb2d.data";var REMOTE_PACKAGE_BASE="pyb2d.data";if(typeof Module["locateFilePackage"]==="function"&&!Module["locateFile"]){Module["locateFile"]=Module["locateFilePackage"];err("warning: you defined Module.locateFilePackage, that has been renamed to Module.locateFile (using your locateFilePackage for now)")}var REMOTE_PACKAGE_NAME=Module["locateFile"]?Module["locateFile"](REMOTE_PACKAGE_BASE,""):REMOTE_PACKAGE_BASE;var REMOTE_PACKAGE_SIZE=metadata["remote_package_size"];var PACKAGE_UUID=metadata["package_uuid"];function fetchRemotePackage(packageName,packageSize,callback,errback){if(typeof process==="object"){require("fs").readFile(packageName,(function(err,contents){if(err){errback(err)}else{callback(contents.buffer)}}));return}var xhr=new XMLHttpRequest;xhr.open("GET",packageName,true);xhr.responseType="arraybuffer";xhr.onprogress=function(event){var url=packageName;var size=packageSize;if(event.total)size=event.total;if(event.loaded){if(!xhr.addedTotal){xhr.addedTotal=true;if(!Module.dataFileDownloads)Module.dataFileDownloads={};Module.dataFileDownloads[url]={loaded:event.loaded,total:size}}else{Module.dataFileDownloads[url].loaded=event.loaded}var total=0;var loaded=0;var num=0;for(var download in Module.dataFileDownloads){var data=Module.dataFileDownloads[download];total+=data.total;loaded+=data.loaded;num++}total=Math.ceil(total*Module.expectedDataFileDownloads/num);if(Module["setStatus"])Module["setStatus"]("Downloading data... ("+loaded+"/"+total+")")}else if(!Module.dataFileDownloads){if(Module["setStatus"])Module["setStatus"]("Downloading data...")}};xhr.onerror=function(event){throw new Error("NetworkError for: "+packageName)};xhr.onload=function(event){if(xhr.status==200||xhr.status==304||xhr.status==206||xhr.status==0&&xhr.response){var packageData=xhr.response;callback(packageData)}else{throw new Error(xhr.statusText+" : "+xhr.responseURL)}};xhr.send(null)}function handleError(error){console.error("package error:",error)}var fetchedCallback=null;var fetched=Module["getPreloadedPackage"]?Module["getPreloadedPackage"](REMOTE_PACKAGE_NAME,REMOTE_PACKAGE_SIZE):null;if(!fetched)fetchRemotePackage(REMOTE_PACKAGE_NAME,REMOTE_PACKAGE_SIZE,(function(data){if(fetchedCallback){fetchedCallback(data);fetchedCallback=null}else{fetched=data}}),handleError);function runWithFS(){function assert(check,msg){if(!check)throw msg+(new Error).stack}Module["FS_createPath"]("/","lib",true,true);Module["FS_createPath"]("/lib","python3.9",true,true);Module["FS_createPath"]("/lib/python3.9","site-packages",true,true);Module["FS_createPath"]("/lib/python3.9/site-packages","b2d",true,true);Module["FS_createPath"]("/lib/python3.9/site-packages/b2d","testbed",true,true);Module["FS_createPath"]("/lib/python3.9/site-packages/b2d/testbed","backend",true,true);Module["FS_createPath"]("/lib/python3.9/site-packages/b2d/testbed/backend","gif_gui",true,true);Module["FS_createPath"]("/lib/python3.9/site-packages/b2d/testbed/backend","jupyter",true,true);Module["FS_createPath"]("/lib/python3.9/site-packages/b2d/testbed/backend","kivy",true,true);Module["FS_createPath"]("/lib/python3.9/site-packages/b2d/testbed/backend","matplotlib_gif_gui",true,true);Module["FS_createPath"]("/lib/python3.9/site-packages/b2d/testbed/backend","no_gui",true,true);Module["FS_createPath"]("/lib/python3.9/site-packages/b2d/testbed/backend","pygame",true,true);Module["FS_createPath"]("/lib/python3.9/site-packages","b2d-0.7.2-py3.9.egg-info",true,true);function processPackageData(arrayBuffer){assert(arrayBuffer,"Loading data file failed.");assert(arrayBuffer instanceof ArrayBuffer,"bad input to processPackageData");var byteArray=new Uint8Array(arrayBuffer);var curr;var compressedData={data:null,cachedOffset:788104,cachedIndexes:[-1,-1],cachedChunks:[null,null],offsets:[0,967,1717,2492,3174,4132,5123,6042,6884,7683,8697,9630,10291,11110,12186,13287,14332,15181,15933,16902,18083,19541,20634,21905,22759,24269,25723,26992,28240,29481,30752,31953,32891,33965,35242,36212,37125,38134,39035,40110,40969,41791,42670,43798,44857,45828,46814,47694,48618,49664,50565,51462,52327,53198,53612,53996,54683,55189,55807,56472,57054,57499,57852,58190,58549,58893,59347,60112,61012,62129,63246,64091,64786,66060,66911,67814,68452,69121,70303,71080,71474,72250,73157,73561,74277,74972,75638,76481,77550,78353,78893,79427,80116,80826,81708,82639,83153,83962,84834,85550,86355,86965,87690,88326,88751,89154,89961,90845,91494,92421,93110,93626,94183,94691,95106,95719,96654,97403,98011,98918,99415,99955,100369,100816,101538,102403,103319,104019,104862,105286,105796,106432,106896,107315,108010,108664,109303,109701,110616,111293,111843,112723,113413,114033,114649,115531,116345,117035,117637,118214,118913,119536,120090,120693,121275,121943,122805,123399,123787,124441,125276,125832,126686,127218,127735,128422,128843,129384,129876,130324,130873,131377,131832,132360,132802,133282,133754,134152,134672,135123,135636,136063,136585,137123,137542,138307,139055,139802,140451,141196,141966,142739,143464,144213,145093,145994,146897,147719,148426,149138,149706,150159,150780,151381,151866,152471,152939,153572,154021,154489,155073,155525,156145,156608,157294,158080,158679,159374,159891,160600,161533,162101,162912,163461,164161,165077,166119,166913,167360,167790,168221,169028,169809,170680,171361,171827,172249,172684,173100,173883,174624,175405,175835,176493,177262,178364,179095,179678,180434,180973,181815,182708,183549,184555,185114,185776,186517,187482,188664,189405,189951,190410,191172,191859,192746,193701,194403,195158,195866,196664,197451,198145,198978,199718,200481,201015,201872,202696,203242,203826,204380,205309,206234,207037,207643,208305,208693,209326,209930,210386,211006,211604,212194,212884,213503,214094,214824,215290,216029,216626,217953,220001,221112,222178,223276,224243,225160,226212,227108,228175,229126,230176,231070,232129,233102,234159,235006,236070,237109,238214,239105,240185,241254,242412,243462,244503,246100,247736,249223,250817,252550,254035,255509,257037,258532,260204,261695,263167,264885,266133,267787,269534,271048,272491,274062,275613,277248,278697,280293,282023,283732,285373,287159,288815,290360,291749,293489,295169,296790,298373,300002,301496,303195,304825,306544,308197,309623,311306,312950,314349,315914,317554,319198,320839,322282,323824,325389,326918,328303,329807,331338,332654,333591,335005,336305,337756,338321,339161,340021,341564,343290,344920,346299,347904,349244,350712,352113,353576,355025,356535,357896,359299,360491,361847,363467,364936,366512,368027,369647,371237,372789,374134,375655,377354,378952,380406,381730,383170,384413,385657,386792,388025,389397,390477,391529,393076,394642,396212,397727,398808,400112,400926,401726,402671,403274,404672,406089,407659,408540,409918,411039,412098,412973,413822,414290,414887,415807,417237,418664,419875,421140,422480,423180,423771,425440,427007,427910,429594,431035,432681,434126,435618,437287,438953,440582,441972,443479,444846,446341,447863,449379,451074,452587,453993,455071,455589,456174,457642,459166,460292,461724,462872,464065,465165,466343,467711,468875,469895,471061,471902,473145,474484,475652,476579,477275,478320,478949,480194,480894,481801,482903,484185,485576,486808,488034,489153,490381,491839,493363,494375,495824,497201,498181,499328,500683,501963,503216,504411,505133,506536,507621,508829,509991,510972,512028,512899,513998,515367,516804,518036,518839,520304,521658,522481,523280,524143,525086,526108,527192,528148,529548,530913,532170,533386,534750,535785,536696,537542,538404,539410,540436,541576,542811,543592,544689,545666,546618,547814,549161,550019,551285,552368,553332,554313,555127,555968,556798,557666,558511,559343,560533,561186,561797,562448,563800,564512,565177,565830,566971,568225,569417,569902,570399,571105,572206,573149,574003,575388,576453,577603,578793,579780,580658,581659,582694,583544,584326,585443,586413,587313,588440,589689,590955,592183,593241,594457,595801,596267,597469,598589,599930,600397,601356,602517,603456,604735,605738,606984,608328,609876,611304,612106,613091,614330,615808,617120,618619,619959,621253,622206,623677,625044,626624,627893,629331,630693,631346,632207,633174,634088,635388,635963,636925,637894,638833,640326,641513,642409,643759,644826,645421,646307,647355,648507,649377,650180,651212,652374,653147,653908,654970,656217,656977,657670,658159,659635,660318,661571,662626,664099,665239,666731,668094,669634,671014,671969,672918,673812,674723,675978,676990,677741,678698,679665,680430,681654,682499,683275,684604,685830,687253,688272,689516,690956,692100,693333,694802,696024,697481,698672,699968,701320,702609,703954,705369,706545,707658,708910,710346,711254,712471,713917,714775,716016,717514,718797,720166,721508,722740,724204,725612,726986,728360,729482,730837,732208,733540,734735,736013,737426,738577,739805,741256,742280,743324,744632,746012,747368,748729,750107,751374,752652,753429,754319,755088,756028,756771,757665,758453,758611,759493,760528,761409,762516,763494,764650,765591,766531,767454,768296,769086,770185,771183,771942,773022,774018,775216,776110,777154,778338,779317,780459,781411,782452,783342,784380,785415,786383,786750,787085,787733],sizes:[967,750,775,682,958,991,919,842,799,1014,933,661,819,1076,1101,1045,849,752,969,1181,1458,1093,1271,854,1510,1454,1269,1248,1241,1271,1201,938,1074,1277,970,913,1009,901,1075,859,822,879,1128,1059,971,986,880,924,1046,901,897,865,871,414,384,687,506,618,665,582,445,353,338,359,344,454,765,900,1117,1117,845,695,1274,851,903,638,669,1182,777,394,776,907,404,716,695,666,843,1069,803,540,534,689,710,882,931,514,809,872,716,805,610,725,636,425,403,807,884,649,927,689,516,557,508,415,613,935,749,608,907,497,540,414,447,722,865,916,700,843,424,510,636,464,419,695,654,639,398,915,677,550,880,690,620,616,882,814,690,602,577,699,623,554,603,582,668,862,594,388,654,835,556,854,532,517,687,421,541,492,448,549,504,455,528,442,480,472,398,520,451,513,427,522,538,419,765,748,747,649,745,770,773,725,749,880,901,903,822,707,712,568,453,621,601,485,605,468,633,449,468,584,452,620,463,686,786,599,695,517,709,933,568,811,549,700,916,1042,794,447,430,431,807,781,871,681,466,422,435,416,783,741,781,430,658,769,1102,731,583,756,539,842,893,841,1006,559,662,741,965,1182,741,546,459,762,687,887,955,702,755,708,798,787,694,833,740,763,534,857,824,546,584,554,929,925,803,606,662,388,633,604,456,620,598,590,690,619,591,730,466,739,597,1327,2048,1111,1066,1098,967,917,1052,896,1067,951,1050,894,1059,973,1057,847,1064,1039,1105,891,1080,1069,1158,1050,1041,1597,1636,1487,1594,1733,1485,1474,1528,1495,1672,1491,1472,1718,1248,1654,1747,1514,1443,1571,1551,1635,1449,1596,1730,1709,1641,1786,1656,1545,1389,1740,1680,1621,1583,1629,1494,1699,1630,1719,1653,1426,1683,1644,1399,1565,1640,1644,1641,1443,1542,1565,1529,1385,1504,1531,1316,937,1414,1300,1451,565,840,860,1543,1726,1630,1379,1605,1340,1468,1401,1463,1449,1510,1361,1403,1192,1356,1620,1469,1576,1515,1620,1590,1552,1345,1521,1699,1598,1454,1324,1440,1243,1244,1135,1233,1372,1080,1052,1547,1566,1570,1515,1081,1304,814,800,945,603,1398,1417,1570,881,1378,1121,1059,875,849,468,597,920,1430,1427,1211,1265,1340,700,591,1669,1567,903,1684,1441,1646,1445,1492,1669,1666,1629,1390,1507,1367,1495,1522,1516,1695,1513,1406,1078,518,585,1468,1524,1126,1432,1148,1193,1100,1178,1368,1164,1020,1166,841,1243,1339,1168,927,696,1045,629,1245,700,907,1102,1282,1391,1232,1226,1119,1228,1458,1524,1012,1449,1377,980,1147,1355,1280,1253,1195,722,1403,1085,1208,1162,981,1056,871,1099,1369,1437,1232,803,1465,1354,823,799,863,943,1022,1084,956,1400,1365,1257,1216,1364,1035,911,846,862,1006,1026,1140,1235,781,1097,977,952,1196,1347,858,1266,1083,964,981,814,841,830,868,845,832,1190,653,611,651,1352,712,665,653,1141,1254,1192,485,497,706,1101,943,854,1385,1065,1150,1190,987,878,1001,1035,850,782,1117,970,900,1127,1249,1266,1228,1058,1216,1344,466,1202,1120,1341,467,959,1161,939,1279,1003,1246,1344,1548,1428,802,985,1239,1478,1312,1499,1340,1294,953,1471,1367,1580,1269,1438,1362,653,861,967,914,1300,575,962,969,939,1493,1187,896,1350,1067,595,886,1048,1152,870,803,1032,1162,773,761,1062,1247,760,693,489,1476,683,1253,1055,1473,1140,1492,1363,1540,1380,955,949,894,911,1255,1012,751,957,967,765,1224,845,776,1329,1226,1423,1019,1244,1440,1144,1233,1469,1222,1457,1191,1296,1352,1289,1345,1415,1176,1113,1252,1436,908,1217,1446,858,1241,1498,1283,1369,1342,1232,1464,1408,1374,1374,1122,1355,1371,1332,1195,1278,1413,1151,1228,1451,1024,1044,1308,1380,1356,1361,1378,1267,1278,777,890,769,940,743,894,788,158,882,1035,881,1107,978,1156,941,940,923,842,790,1099,998,759,1080,996,1198,894,1044,1184,979,1142,952,1041,890,1038,1035,968,367,335,648,371],successes:[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,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:metadata,compressedData:compressedData},true);Module["removeRunDependency"]("datafile_pyb2d.data")}Module["addRunDependency"]("datafile_pyb2d.data");if(!Module.preloadResults)Module.preloadResults={};Module.preloadResults[PACKAGE_NAME]={fromCache:false};if(fetched){processPackageData(fetched);fetched=null}else{fetchedCallback=processPackageData}}if(Module["calledRun"]){runWithFS()}else{if(!Module["preRun"])Module["preRun"]=[];Module["preRun"].push(runWithFS)}};loadPackage({files:[{filename:"/lib/python3.9/site-packages/b2d/__init__.py",start:0,end:4500,audio:0},{filename:"/lib/python3.9/site-packages/b2d/extend_batch_api.py",start:4500,end:7502,audio:0},{filename:"/lib/python3.9/site-packages/b2d/extend_body.py",start:7502,end:11908,audio:0},{filename:"/lib/python3.9/site-packages/b2d/extend_collision.py",start:11908,end:12370,audio:0},{filename:"/lib/python3.9/site-packages/b2d/extend_contact.py",start:12370,end:12479,audio:0},{filename:"/lib/python3.9/site-packages/b2d/extend_draw.py",start:12479,end:13886,audio:0},{filename:"/lib/python3.9/site-packages/b2d/extend_fixture.py",start:13886,end:16051,audio:0},{filename:"/lib/python3.9/site-packages/b2d/extend_joints.py",start:16051,end:17731,audio:0},{filename:"/lib/python3.9/site-packages/b2d/extend_math.py",start:17731,end:19638,audio:0},{filename:"/lib/python3.9/site-packages/b2d/extend_particles.py",start:19638,end:26790,audio:0},{filename:"/lib/python3.9/site-packages/b2d/extend_shapes.py",start:26790,end:29185,audio:0},{filename:"/lib/python3.9/site-packages/b2d/extend_user_data.py",start:29185,end:29613,audio:0},{filename:"/lib/python3.9/site-packages/b2d/extend_world.py",start:29613,end:36456,audio:0},{filename:"/lib/python3.9/site-packages/b2d/plot.py",start:36456,end:40292,audio:0},{filename:"/lib/python3.9/site-packages/b2d/query_callback.py",start:40292,end:40662,audio:0},{filename:"/lib/python3.9/site-packages/b2d/tools.py",start:40662,end:41284,audio:0},{filename:"/lib/python3.9/site-packages/b2d/_b2d.so",start:41284,end:1534197,audio:0},{filename:"/lib/python3.9/site-packages/b2d/testbed/__init__.py",start:1534197,end:1534276,audio:0},{filename:"/lib/python3.9/site-packages/b2d/testbed/testbed_base.py",start:1534276,end:1540617,audio:0},{filename:"/lib/python3.9/site-packages/b2d/testbed/backend/__init__.py",start:1540617,end:1540617,audio:0},{filename:"/lib/python3.9/site-packages/b2d/testbed/backend/default_backend.py",start:1540617,end:1543009,audio:0},{filename:"/lib/python3.9/site-packages/b2d/testbed/backend/gui_base.py",start:1543009,end:1544068,audio:0},{filename:"/lib/python3.9/site-packages/b2d/testbed/backend/gif_gui/__init__.py",start:1544068,end:1544096,audio:0},{filename:"/lib/python3.9/site-packages/b2d/testbed/backend/gif_gui/gif_gui.py",start:1544096,end:1545958,audio:0},{filename:"/lib/python3.9/site-packages/b2d/testbed/backend/gif_gui/opencv_debug_draw.py",start:1545958,end:1552003,audio:0},{filename:"/lib/python3.9/site-packages/b2d/testbed/backend/jupyter/__init__.py",start:1552003,end:1552039,audio:0},{filename:"/lib/python3.9/site-packages/b2d/testbed/backend/jupyter/jupyter_batch_debug_draw.py",start:1552039,end:1557291,audio:0},{filename:"/lib/python3.9/site-packages/b2d/testbed/backend/jupyter/jupyter_gui.py",start:1557291,end:1567992,audio:0},{filename:"/lib/python3.9/site-packages/b2d/testbed/backend/kivy/__init__.py",start:1567992,end:1568022,audio:0},{filename:"/lib/python3.9/site-packages/b2d/testbed/backend/kivy/kivy_debug_draw.py",start:1568022,end:1573033,audio:0},{filename:"/lib/python3.9/site-packages/b2d/testbed/backend/kivy/kivy_gui.py",start:1573033,end:1577480,audio:0},{filename:"/lib/python3.9/site-packages/b2d/testbed/backend/matplotlib_gif_gui/__init__.py",start:1577480,end:1577529,audio:0},{filename:"/lib/python3.9/site-packages/b2d/testbed/backend/matplotlib_gif_gui/matplotlib_gif_gui.py",start:1577529,end:1579291,audio:0},{filename:"/lib/python3.9/site-packages/b2d/testbed/backend/no_gui/__init__.py",start:1579291,end:1579317,audio:0},{filename:"/lib/python3.9/site-packages/b2d/testbed/backend/no_gui/no_gui.py",start:1579317,end:1581102,audio:0},{filename:"/lib/python3.9/site-packages/b2d/testbed/backend/pygame/__init__.py",start:1581102,end:1581136,audio:0},{filename:"/lib/python3.9/site-packages/b2d/testbed/backend/pygame/pygame_debug_draw.py",start:1581136,end:1585819,audio:0},{filename:"/lib/python3.9/site-packages/b2d/testbed/backend/pygame/pygame_gui.py",start:1585819,end:1590741,audio:0},{filename:"/lib/python3.9/site-packages/b2d-0.7.2-py3.9.egg-info/PKG-INFO",start:1590741,end:1591058,audio:0},{filename:"/lib/python3.9/site-packages/b2d-0.7.2-py3.9.egg-info/not-zip-safe",start:1591058,end:1591059,audio:0},{filename:"/lib/python3.9/site-packages/b2d-0.7.2-py3.9.egg-info/dependency_links.txt",start:1591059,end:1591060,audio:0},{filename:"/lib/python3.9/site-packages/b2d-0.7.2-py3.9.egg-info/requires.txt",start:1591060,end:1591090,audio:0},{filename:"/lib/python3.9/site-packages/b2d-0.7.2-py3.9.egg-info/top_level.txt",start:1591090,end:1591094,audio:0},{filename:"/lib/python3.9/site-packages/b2d-0.7.2-py3.9.egg-info/SOURCES.txt",start:1591094,end:1598301,audio:0}],remote_package_size:792200,package_uuid:"7d556e63-6cd1-441b-a9a0-87cf8fc69c74"})})(); \ No newline at end of file diff --git a/spaces/pyodide-demo/self-hosted/regex.js b/spaces/pyodide-demo/self-hosted/regex.js deleted file mode 100644 index b750c30ff14b3afbd3ea053a288fa70213d07252..0000000000000000000000000000000000000000 --- a/spaces/pyodide-demo/self-hosted/regex.js +++ /dev/null @@ -1 +0,0 @@ -var Module=typeof globalThis.__pyodide_module!=="undefined"?globalThis.__pyodide_module:{};if(!Module.expectedDataFileDownloads){Module.expectedDataFileDownloads=0}Module.expectedDataFileDownloads++;(function(){var loadPackage=function(metadata){var PACKAGE_PATH="";if(typeof window==="object"){PACKAGE_PATH=window["encodeURIComponent"](window.location.pathname.toString().substring(0,window.location.pathname.toString().lastIndexOf("/"))+"/")}else if(typeof process==="undefined"&&typeof location!=="undefined"){PACKAGE_PATH=encodeURIComponent(location.pathname.toString().substring(0,location.pathname.toString().lastIndexOf("/"))+"/")}var PACKAGE_NAME="regex.data";var REMOTE_PACKAGE_BASE="regex.data";if(typeof Module["locateFilePackage"]==="function"&&!Module["locateFile"]){Module["locateFile"]=Module["locateFilePackage"];err("warning: you defined Module.locateFilePackage, that has been renamed to Module.locateFile (using your locateFilePackage for now)")}var REMOTE_PACKAGE_NAME=Module["locateFile"]?Module["locateFile"](REMOTE_PACKAGE_BASE,""):REMOTE_PACKAGE_BASE;var REMOTE_PACKAGE_SIZE=metadata["remote_package_size"];var PACKAGE_UUID=metadata["package_uuid"];function fetchRemotePackage(packageName,packageSize,callback,errback){if(typeof process==="object"){require("fs").readFile(packageName,(function(err,contents){if(err){errback(err)}else{callback(contents.buffer)}}));return}var xhr=new XMLHttpRequest;xhr.open("GET",packageName,true);xhr.responseType="arraybuffer";xhr.onprogress=function(event){var url=packageName;var size=packageSize;if(event.total)size=event.total;if(event.loaded){if(!xhr.addedTotal){xhr.addedTotal=true;if(!Module.dataFileDownloads)Module.dataFileDownloads={};Module.dataFileDownloads[url]={loaded:event.loaded,total:size}}else{Module.dataFileDownloads[url].loaded=event.loaded}var total=0;var loaded=0;var num=0;for(var download in Module.dataFileDownloads){var data=Module.dataFileDownloads[download];total+=data.total;loaded+=data.loaded;num++}total=Math.ceil(total*Module.expectedDataFileDownloads/num);if(Module["setStatus"])Module["setStatus"]("Downloading data... ("+loaded+"/"+total+")")}else if(!Module.dataFileDownloads){if(Module["setStatus"])Module["setStatus"]("Downloading data...")}};xhr.onerror=function(event){throw new Error("NetworkError for: "+packageName)};xhr.onload=function(event){if(xhr.status==200||xhr.status==304||xhr.status==206||xhr.status==0&&xhr.response){var packageData=xhr.response;callback(packageData)}else{throw new Error(xhr.statusText+" : "+xhr.responseURL)}};xhr.send(null)}function handleError(error){console.error("package error:",error)}var fetchedCallback=null;var fetched=Module["getPreloadedPackage"]?Module["getPreloadedPackage"](REMOTE_PACKAGE_NAME,REMOTE_PACKAGE_SIZE):null;if(!fetched)fetchRemotePackage(REMOTE_PACKAGE_NAME,REMOTE_PACKAGE_SIZE,(function(data){if(fetchedCallback){fetchedCallback(data);fetchedCallback=null}else{fetched=data}}),handleError);function runWithFS(){function assert(check,msg){if(!check)throw msg+(new Error).stack}Module["FS_createPath"]("/","lib",true,true);Module["FS_createPath"]("/lib","python3.9",true,true);Module["FS_createPath"]("/lib/python3.9","site-packages",true,true);Module["FS_createPath"]("/lib/python3.9/site-packages","regex",true,true);Module["FS_createPath"]("/lib/python3.9/site-packages","regex-2021.7.6-py3.9.egg-info",true,true);function processPackageData(arrayBuffer){assert(arrayBuffer,"Loading data file failed.");assert(arrayBuffer instanceof ArrayBuffer,"bad input to processPackageData");var byteArray=new Uint8Array(arrayBuffer);var curr;var compressedData={data:null,cachedOffset:418021,cachedIndexes:[-1,-1],cachedChunks:[null,null],offsets:[0,1377,2402,3792,4771,5882,7253,8446,9264,10318,11320,12452,13690,14779,16121,17470,18757,20162,21601,22999,24353,25520,26468,27128,28208,29149,30030,31024,32054,33073,34035,34933,36015,37115,38165,39178,40245,41426,42223,43317,44592,45465,46527,47857,48879,49704,50782,51774,52714,53669,54570,55500,56657,57756,58923,59822,60735,61686,62800,63773,64796,65780,66815,67678,68670,69714,70853,71912,72851,73876,74943,76073,76984,77843,78693,79693,80716,81911,82715,83425,84331,85484,86627,87855,89105,90406,91726,92955,94327,95542,96624,97646,98635,99632,100629,101627,102623,103618,104614,105610,106605,107602,108599,109624,110916,111979,113083,114450,115920,117375,118409,120041,121641,123258,124369,125601,126923,128103,129422,130694,132069,133102,134170,135450,136698,137799,139137,140455,141571,142706,144069,145239,146267,147704,148729,150010,151235,152335,153444,154399,155434,156443,157583,158444,159895,161206,162611,163779,164614,165797,167228,168373,169606,170859,172210,173156,174497,175891,177152,178536,179595,180557,181438,182313,183318,184598,185988,187366,188263,189291,190547,191505,192839,193829,195051,196164,197290,198316,199723,201105,202168,203516,204832,205787,207263,208412,209894,210662,212289,213852,215356,216622,217871,219201,220633,221825,222998,224503,225954,227333,228844,230449,231881,233293,234163,235118,236198,237159,237966,239246,240087,240884,242087,243641,244852,246292,247755,249046,250642,252112,253466,254326,255236,256381,257176,257960,258639,259288,259961,260582,261082,261708,262430,262709,262901,263087,263273,263469,263650,263841,264027,264202,264393,264585,264769,264961,265297,266449,266955,267668,268310,268892,269297,269781,270448,271208,271682,272004,272700,272951,274225,274955,275722,276694,277582,278272,279104,279816,280668,281347,282204,283072,284330,284983,285970,287368,287917,288497,289134,289764,290297,290854,292006,293137,294015,294169,295142,296091,296467,296888,297331,297824,298501,299105,299706,300206,300760,300992,301521,301854,302175,302966,304230,305019,305950,306869,307976,308698,309689,310287,311133,312067,312779,313950,314421,314770,315170,315481,316372,317237,318222,318605,319632,320480,321859,322710,323075,324344,325085,325694,326654,327379,328322,328677,329184,329647,330249,331152,331359,331993,332764,333677,334597,335416,335932,336895,337593,338308,339034,339873,340640,341511,342287,342964,343807,344549,345348,346250,347141,347901,348650,349309,350147,350501,351178,351813,352378,352873,353396,353949,354455,355081,355637,356430,357011,357514,358090,358607,359145,359685,360329,361131,361970,362772,363526,364250,365015,365742,366296,367165,368006,368698,369485,370209,370903,371646,372640,373527,374308,375039,375856,376670,377688,378544,379988,382036,384084,386066,387985,389771,391707,393755,395541,396861,398092,399472,400492,401623,402792,403749,404661,405622,406923,408074,409307,410578,411921,413053,414150,415334,416512,417869],sizes:[1377,1025,1390,979,1111,1371,1193,818,1054,1002,1132,1238,1089,1342,1349,1287,1405,1439,1398,1354,1167,948,660,1080,941,881,994,1030,1019,962,898,1082,1100,1050,1013,1067,1181,797,1094,1275,873,1062,1330,1022,825,1078,992,940,955,901,930,1157,1099,1167,899,913,951,1114,973,1023,984,1035,863,992,1044,1139,1059,939,1025,1067,1130,911,859,850,1e3,1023,1195,804,710,906,1153,1143,1228,1250,1301,1320,1229,1372,1215,1082,1022,989,997,997,998,996,995,996,996,995,997,997,1025,1292,1063,1104,1367,1470,1455,1034,1632,1600,1617,1111,1232,1322,1180,1319,1272,1375,1033,1068,1280,1248,1101,1338,1318,1116,1135,1363,1170,1028,1437,1025,1281,1225,1100,1109,955,1035,1009,1140,861,1451,1311,1405,1168,835,1183,1431,1145,1233,1253,1351,946,1341,1394,1261,1384,1059,962,881,875,1005,1280,1390,1378,897,1028,1256,958,1334,990,1222,1113,1126,1026,1407,1382,1063,1348,1316,955,1476,1149,1482,768,1627,1563,1504,1266,1249,1330,1432,1192,1173,1505,1451,1379,1511,1605,1432,1412,870,955,1080,961,807,1280,841,797,1203,1554,1211,1440,1463,1291,1596,1470,1354,860,910,1145,795,784,679,649,673,621,500,626,722,279,192,186,186,196,181,191,186,175,191,192,184,192,336,1152,506,713,642,582,405,484,667,760,474,322,696,251,1274,730,767,972,888,690,832,712,852,679,857,868,1258,653,987,1398,549,580,637,630,533,557,1152,1131,878,154,973,949,376,421,443,493,677,604,601,500,554,232,529,333,321,791,1264,789,931,919,1107,722,991,598,846,934,712,1171,471,349,400,311,891,865,985,383,1027,848,1379,851,365,1269,741,609,960,725,943,355,507,463,602,903,207,634,771,913,920,819,516,963,698,715,726,839,767,871,776,677,843,742,799,902,891,760,749,659,838,354,677,635,565,495,523,553,506,626,556,793,581,503,576,517,538,540,644,802,839,802,754,724,765,727,554,869,841,692,787,724,694,743,994,887,781,731,817,814,1018,856,1444,2048,2048,1982,1919,1786,1936,2048,1786,1320,1231,1380,1020,1131,1169,957,912,961,1301,1151,1233,1271,1343,1132,1097,1184,1178,1357,152],successes:[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]};compressedData["data"]=byteArray;assert(typeof Module.LZ4==="object","LZ4 not present - was your app build with -s LZ4=1 ?");Module.LZ4.loadPackage({metadata:metadata,compressedData:compressedData},true);Module["removeRunDependency"]("datafile_regex.data")}Module["addRunDependency"]("datafile_regex.data");if(!Module.preloadResults)Module.preloadResults={};Module.preloadResults[PACKAGE_NAME]={fromCache:false};if(fetched){processPackageData(fetched);fetched=null}else{fetchedCallback=processPackageData}}if(Module["calledRun"]){runWithFS()}else{if(!Module["preRun"])Module["preRun"]=[];Module["preRun"].push(runWithFS)}};loadPackage({files:[{filename:"/lib/python3.9/site-packages/regex/__init__.py",start:0,end:65,audio:0},{filename:"/lib/python3.9/site-packages/regex/regex.py",start:65,end:32608,audio:0},{filename:"/lib/python3.9/site-packages/regex/_regex_core.py",start:32608,end:172826,audio:0},{filename:"/lib/python3.9/site-packages/regex/_regex.so",start:172826,end:843175,audio:0},{filename:"/lib/python3.9/site-packages/regex-2021.7.6-py3.9.egg-info/PKG-INFO",start:843175,end:882432,audio:0},{filename:"/lib/python3.9/site-packages/regex-2021.7.6-py3.9.egg-info/SOURCES.txt",start:882432,end:883026,audio:0},{filename:"/lib/python3.9/site-packages/regex-2021.7.6-py3.9.egg-info/dependency_links.txt",start:883026,end:883027,audio:0},{filename:"/lib/python3.9/site-packages/regex-2021.7.6-py3.9.egg-info/top_level.txt",start:883027,end:883033,audio:0}],remote_package_size:422117,package_uuid:"7ec2277b-44a1-4952-8439-6a5e43dd13bd"})})(); \ No newline at end of file diff --git a/spaces/quidiaMuxgu/Expedit-SAM/HD Online Player (vintha Prapancham Telugu Dubbed Movie Free Download) WORK.md b/spaces/quidiaMuxgu/Expedit-SAM/HD Online Player (vintha Prapancham Telugu Dubbed Movie Free Download) WORK.md deleted file mode 100644 index a545a515742f0187ee84dcd3b6e8a07bf6cbfb94..0000000000000000000000000000000000000000 --- a/spaces/quidiaMuxgu/Expedit-SAM/HD Online Player (vintha Prapancham Telugu Dubbed Movie Free Download) WORK.md +++ /dev/null @@ -1,12 +0,0 @@ -

      HD Online Player (vintha prapancham telugu dubbed movie free download)


      DOWNLOAD ››› https://geags.com/2uCsWj



      - -All Rights Reserved. 1000.0 Save. Oct 15, 2018. They also won. They are one of the few films which are showing continuously in all the major centers of. Indian movie download to rip mp4, 720p, 1080p, 3gp & mp3. Downloading illegal movies is a big no no, here we provide. WATCH Full Movies Online With Us. 101. Watch 30 Mins Later online. Subscribe to our YouTube channel. Ram Charan gets his first Tamil movie as the hero! Why have they decided to give a desi guy, charan, the lead role in a. That’s a very cheap action movie. The latest and updated list of Chennai Movies to download in HD quality. 30.31 Mins Later (2013) 32.8 Mins. Telugu Movie Mp3 Download. Download Superstar Ji Double Dhamaka Full Movie. Hindi Movie.The latest movies are listed here. Full movie available for free download. Download, watch online and watch online full movies. 100.0 Save. Download Latest Movies. Watch latest movie of film, comedy, romance in our site. Download Movies Free Today. Full Free Movie Streaming Online. Indian Movie Download HD Quality Movies. So here’s our list of some of the best Bollywood movies. Latest movie of Afternoon. - -Watch latest online movie ‘Yajamana’ only on filmystrada.com (Yash Raj Films & Siddharth Anand) The film revolves around a young girl named Arpana (Sruthi) who comes to Mumbai from Lucknow, in the year 2005. When she gets a job with Shilpa Shetty, it is quite shocking for her as she is a class. - -We have added all the latest movie trailers, music videos, still images, wallpapers. this site contains the latest movies as well as trailers. If you want to watch the latest movies on. 100% free India movies! No downloading. See trailers, clips, reviews, and more from Glamour. Indian movies like. 30 Mins Later (2013) 32.8 Mins. Ram Charan gets his first Tamil movie as the hero! Why have they decided to give a desi guy, charan, the lead role in a.Hillary Clinton is bragging about how she won the popular vote in the 2016 election over President Donald Trump — a clear sign that she intends to run again in 2020. - -Clinton claims that she beat 4fefd39f24
      -
      -
      -

      diff --git a/spaces/quidiaMuxgu/Expedit-SAM/Ip Man 1080p Yify Torrents.md b/spaces/quidiaMuxgu/Expedit-SAM/Ip Man 1080p Yify Torrents.md deleted file mode 100644 index 682406dc4d5c7802477e061782e64fdcceac0ade..0000000000000000000000000000000000000000 --- a/spaces/quidiaMuxgu/Expedit-SAM/Ip Man 1080p Yify Torrents.md +++ /dev/null @@ -1,6 +0,0 @@ -

      Ip Man 1080p Yify Torrents


      Download File ··· https://geags.com/2uCrZg



      -
      -Ip Man 4: The Finale (2019) [1080p] [BluRay] [5.1] [YTS] [YIFY] ... Location is United States - Your ISP and Government can track your torrent activity! Hide your IP ... 4d29de3e1b
      -
      -
      -

      diff --git a/spaces/quidiaMuxgu/Expedit-SAM/Khuda Gawah 2 Hindi Dubbed Free 2021 Download.md b/spaces/quidiaMuxgu/Expedit-SAM/Khuda Gawah 2 Hindi Dubbed Free 2021 Download.md deleted file mode 100644 index 444d6798ee00fe42017df65ffdbb82ba25884b4a..0000000000000000000000000000000000000000 --- a/spaces/quidiaMuxgu/Expedit-SAM/Khuda Gawah 2 Hindi Dubbed Free 2021 Download.md +++ /dev/null @@ -1,6 +0,0 @@ -
      -

      On the day of the premiere of Khuda Gawah, the Indian media asked Sanjay Dutt about the title. Sanjay explained that it meant, the real 'Gawah' is God. In the film, the title is changed to Khuda Gawah, which is the name of a 1978 shelved movie. Sanjay said Hum is a blend of Agnipath and Khuda Gawah. In the film, Sanjay plays an inspector and this is his first Hindi movie. Sanjay had appeared in Englan with John Bacchus, Mahesh Bhupati and Raveena Tandon. Sanjay Dutt had already made Jaane Bhi Do Yaaro (1984) with Rani Mukherjee and Jeetendra. Sanjay had also made Sautela Bhai (1981) with Jeetendra and Rati Agnihotri. Sanjay had also gone on to appear in Umrao Jaan (1981) with Jeetendra and Manik Bhardwaj. Sanjay had also acted in the comedy Souten Aur Saath (1980) with Jeetendra and Rati Agnihotri.Sanjay Dutt said, "This is the first time that I am acting in an Indian film.I hope I can keep up to the standard set by Amitabh. "

      -

      I recall on the first day of shooting, during his first day of shoot, I had shot Vada in Hindi and Hindi version of Pind Dafan. Both were shot in the presence of Manoj Desai. He was adamant that he wanted me to give him a blockbuster. The setting for Khuda Gawah was Afghanistan. I was with the camera person Baba Hassan. While he was taking us around, he showed us this quaint old palace. He was firm that it will be perfect for Vada. That is how we captured the surreal scenes in the film. Soon, even the next day, we were back again with Baba Hassan for Pind Dafan. At one point during shooting, he told me, 'Manoj, I trust you. Just obey the director's orders. Do what you think is right. Just don't do me in'.

      -

      Khuda Gawah 2 hindi dubbed free download


      Download File ☆☆☆ https://geags.com/2uCqRK



      899543212b
      -
      -
      \ No newline at end of file diff --git a/spaces/r3gm/Aesthetic_RVC_Inference_HF/lib/infer/infer_libs/train/losses.py b/spaces/r3gm/Aesthetic_RVC_Inference_HF/lib/infer/infer_libs/train/losses.py deleted file mode 100644 index b1b263e4c205e78ffe970f622ab6ff68f36d3b17..0000000000000000000000000000000000000000 --- a/spaces/r3gm/Aesthetic_RVC_Inference_HF/lib/infer/infer_libs/train/losses.py +++ /dev/null @@ -1,58 +0,0 @@ -import torch - - -def feature_loss(fmap_r, fmap_g): - loss = 0 - for dr, dg in zip(fmap_r, fmap_g): - for rl, gl in zip(dr, dg): - rl = rl.float().detach() - gl = gl.float() - loss += torch.mean(torch.abs(rl - gl)) - - return loss * 2 - - -def discriminator_loss(disc_real_outputs, disc_generated_outputs): - loss = 0 - r_losses = [] - g_losses = [] - for dr, dg in zip(disc_real_outputs, disc_generated_outputs): - dr = dr.float() - dg = dg.float() - r_loss = torch.mean((1 - dr) ** 2) - g_loss = torch.mean(dg**2) - loss += r_loss + g_loss - r_losses.append(r_loss.item()) - g_losses.append(g_loss.item()) - - return loss, r_losses, g_losses - - -def generator_loss(disc_outputs): - loss = 0 - gen_losses = [] - for dg in disc_outputs: - dg = dg.float() - l = torch.mean((1 - dg) ** 2) - gen_losses.append(l) - loss += l - - return loss, gen_losses - - -def kl_loss(z_p, logs_q, m_p, logs_p, z_mask): - """ - z_p, logs_q: [b, h, t_t] - m_p, logs_p: [b, h, t_t] - """ - z_p = z_p.float() - logs_q = logs_q.float() - m_p = m_p.float() - logs_p = logs_p.float() - z_mask = z_mask.float() - - kl = logs_p - logs_q - 0.5 - kl += 0.5 * ((z_p - m_p) ** 2) * torch.exp(-2.0 * logs_p) - kl = torch.sum(kl * z_mask) - l = kl / torch.sum(z_mask) - return l diff --git a/spaces/r3gm/RVC_HF/mdx.py b/spaces/r3gm/RVC_HF/mdx.py deleted file mode 100644 index 4cc7c08b37bc371294f2f82b3382424a5455b7c2..0000000000000000000000000000000000000000 --- a/spaces/r3gm/RVC_HF/mdx.py +++ /dev/null @@ -1,228 +0,0 @@ -import torch -import onnxruntime as ort -from tqdm import tqdm -import warnings -import numpy as np -import hashlib -import queue -import threading - -warnings.filterwarnings("ignore") - -class MDX_Model: - def __init__(self, device, dim_f, dim_t, n_fft, hop=1024, stem_name=None, compensation=1.000): - self.dim_f = dim_f - self.dim_t = dim_t - self.dim_c = 4 - self.n_fft = n_fft - self.hop = hop - self.stem_name = stem_name - self.compensation = compensation - - self.n_bins = self.n_fft//2+1 - self.chunk_size = hop * (self.dim_t-1) - self.window = torch.hann_window(window_length=self.n_fft, periodic=True).to(device) - - out_c = self.dim_c - - self.freq_pad = torch.zeros([1, out_c, self.n_bins-self.dim_f, self.dim_t]).to(device) - - def stft(self, x): - x = x.reshape([-1, self.chunk_size]) - x = torch.stft(x, n_fft=self.n_fft, hop_length=self.hop, window=self.window, center=True, return_complex=True) - x = torch.view_as_real(x) - x = x.permute([0,3,1,2]) - x = x.reshape([-1,2,2,self.n_bins,self.dim_t]).reshape([-1,4,self.n_bins,self.dim_t]) - return x[:,:,:self.dim_f] - - def istft(self, x, freq_pad=None): - freq_pad = self.freq_pad.repeat([x.shape[0],1,1,1]) if freq_pad is None else freq_pad - x = torch.cat([x, freq_pad], -2) - # c = 4*2 if self.target_name=='*' else 2 - x = x.reshape([-1,2,2,self.n_bins,self.dim_t]).reshape([-1,2,self.n_bins,self.dim_t]) - x = x.permute([0,2,3,1]) - x = x.contiguous() - x = torch.view_as_complex(x) - x = torch.istft(x, n_fft=self.n_fft, hop_length=self.hop, window=self.window, center=True) - return x.reshape([-1,2,self.chunk_size]) - - -class MDX: - - DEFAULT_SR = 44100 - # Unit: seconds - DEFAULT_CHUNK_SIZE = 0 * DEFAULT_SR - DEFAULT_MARGIN_SIZE = 1 * DEFAULT_SR - - DEFAULT_PROCESSOR = 0 - - def __init__(self, model_path:str, params:MDX_Model, processor=DEFAULT_PROCESSOR): - - # Set the device and the provider (CPU or CUDA) - self.device = torch.device(f'cuda:{processor}') if processor >= 0 else torch.device('cpu') - self.provider = ['CUDAExecutionProvider'] if processor >= 0 else ['CPUExecutionProvider'] - - self.model = params - - # Load the ONNX model using ONNX Runtime - self.ort = ort.InferenceSession(model_path, providers=self.provider) - # Preload the model for faster performance - self.ort.run(None, {'input':torch.rand(1, 4, params.dim_f, params.dim_t).numpy()}) - self.process = lambda spec:self.ort.run(None, {'input': spec.cpu().numpy()})[0] - - self.prog = None - - @staticmethod - def get_hash(model_path): - try: - with open(model_path, 'rb') as f: - f.seek(- 10000 * 1024, 2) - model_hash = hashlib.md5(f.read()).hexdigest() - except: - model_hash = hashlib.md5(open(model_path,'rb').read()).hexdigest() - - return model_hash - - @staticmethod - def segment(wave, combine=True, chunk_size=DEFAULT_CHUNK_SIZE, margin_size=DEFAULT_MARGIN_SIZE): - """ - Segment or join segmented wave array - - Args: - wave: (np.array) Wave array to be segmented or joined - combine: (bool) If True, combines segmented wave array. If False, segments wave array. - chunk_size: (int) Size of each segment (in samples) - margin_size: (int) Size of margin between segments (in samples) - - Returns: - numpy array: Segmented or joined wave array - """ - - if combine: - processed_wave = None # Initializing as None instead of [] for later numpy array concatenation - for segment_count, segment in enumerate(wave): - start = 0 if segment_count == 0 else margin_size - end = None if segment_count == len(wave)-1 else -margin_size - if margin_size == 0: - end = None - if processed_wave is None: # Create array for first segment - processed_wave = segment[:, start:end] - else: # Concatenate to existing array for subsequent segments - processed_wave = np.concatenate((processed_wave, segment[:, start:end]), axis=-1) - - else: - processed_wave = [] - sample_count = wave.shape[-1] - - if chunk_size <= 0 or chunk_size > sample_count: - chunk_size = sample_count - - if margin_size > chunk_size: - margin_size = chunk_size - - for segment_count, skip in enumerate(range(0, sample_count, chunk_size)): - - margin = 0 if segment_count == 0 else margin_size - end = min(skip+chunk_size+margin_size, sample_count) - start = skip-margin - - cut = wave[:,start:end].copy() - processed_wave.append(cut) - - if end == sample_count: - break - - return processed_wave - - def pad_wave(self, wave): - """ - Pad the wave array to match the required chunk size - - Args: - wave: (np.array) Wave array to be padded - - Returns: - tuple: (padded_wave, pad, trim) - - padded_wave: Padded wave array - - pad: Number of samples that were padded - - trim: Number of samples that were trimmed - """ - n_sample = wave.shape[1] - trim = self.model.n_fft//2 - gen_size = self.model.chunk_size-2*trim - pad = gen_size - n_sample%gen_size - - # Padded wave - wave_p = np.concatenate((np.zeros((2,trim)), wave, np.zeros((2,pad)), np.zeros((2,trim))), 1) - - mix_waves = [] - for i in range(0, n_sample+pad, gen_size): - waves = np.array(wave_p[:, i:i+self.model.chunk_size]) - mix_waves.append(waves) - - mix_waves = torch.tensor(mix_waves, dtype=torch.float32).to(self.device) - - return mix_waves, pad, trim - - def _process_wave(self, mix_waves, trim, pad, q:queue.Queue, _id:int): - """ - Process each wave segment in a multi-threaded environment - - Args: - mix_waves: (torch.Tensor) Wave segments to be processed - trim: (int) Number of samples trimmed during padding - pad: (int) Number of samples padded during padding - q: (queue.Queue) Queue to hold the processed wave segments - _id: (int) Identifier of the processed wave segment - - Returns: - numpy array: Processed wave segment - """ - mix_waves = mix_waves.split(1) - with torch.no_grad(): - pw = [] - for mix_wave in mix_waves: - self.prog.update() - spec = self.model.stft(mix_wave) - processed_spec = torch.tensor(self.process(spec)) - processed_wav = self.model.istft(processed_spec.to(self.device)) - processed_wav = processed_wav[:,:,trim:-trim].transpose(0,1).reshape(2, -1).cpu().numpy() - pw.append(processed_wav) - processed_signal = np.concatenate(pw, axis=-1)[:, :-pad] - q.put({_id:processed_signal}) - return processed_signal - - def process_wave(self, wave:np.array, mt_threads=1): - """ - Process the wave array in a multi-threaded environment - - Args: - wave: (np.array) Wave array to be processed - mt_threads: (int) Number of threads to be used for processing - - Returns: - numpy array: Processed wave array - """ - self.prog = tqdm(total=0) - chunk = wave.shape[-1]//mt_threads - waves = self.segment(wave, False, chunk) - - # Create a queue to hold the processed wave segments - q = queue.Queue() - threads = [] - for c, batch in enumerate(waves): - mix_waves, pad, trim = self.pad_wave(batch) - self.prog.total = len(mix_waves)*mt_threads - thread = threading.Thread(target=self._process_wave, args=(mix_waves, trim, pad, q, c)) - thread.start() - threads.append(thread) - for thread in threads: - thread.join() - self.prog.close() - - processed_batches = [] - while not q.empty(): - processed_batches.append(q.get()) - processed_batches = [list(wave.values())[0] for wave in sorted(processed_batches, key=lambda d: list(d.keys())[0])] - assert len(processed_batches) == len(waves), 'Incomplete processed batches, please reduce batch size!' - return self.segment(processed_batches, True, chunk) \ No newline at end of file diff --git a/spaces/radames/OHIF-Medical-Imaging-Viewer/README.md b/spaces/radames/OHIF-Medical-Imaging-Viewer/README.md deleted file mode 100644 index 3d8d1c24f1a4ebd155933096e6597a7fafaa80ce..0000000000000000000000000000000000000000 --- a/spaces/radames/OHIF-Medical-Imaging-Viewer/README.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -title: Ohif -emoji: 🐠 -colorFrom: purple -colorTo: yellow -sdk: docker -pinned: false -custom_headers: - cross-origin-embedder-policy: require-corp - cross-origin-opener-policy: same-origin - cross-origin-resource-policy: cross-origin - ---- - -Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference diff --git a/spaces/raedeXanto/academic-chatgpt-beta/Domo Takes On Slack With 131 Million At 2 Billion Valuation.md b/spaces/raedeXanto/academic-chatgpt-beta/Domo Takes On Slack With 131 Million At 2 Billion Valuation.md deleted file mode 100644 index 3b6b233e993b2662046cdfea8ef49dfdadfcfa94..0000000000000000000000000000000000000000 --- a/spaces/raedeXanto/academic-chatgpt-beta/Domo Takes On Slack With 131 Million At 2 Billion Valuation.md +++ /dev/null @@ -1,17 +0,0 @@ -
      -

      Domo Takes on Slack with $131 Million at $2 Billion Valuation

      -

      Domo, a cloud-based business intelligence platform, has raised $131 million in a Series F round of funding, bringing its valuation to $2 billion. The company, which competes with Slack and other collaboration tools, plans to use the new capital to expand its product offerings and global presence.

      -

      Domo was founded in 2010 by Josh James, the former CEO of Omniture, a web analytics company that was acquired by Adobe for $1.8 billion in 2009. James wanted to create a platform that would allow business leaders to access and analyze data from various sources in real time, and to collaborate with their teams on data-driven decisions.

      -

      Domo takes on Slack with $131 million at $2 billion valuation


      Download Zip ››››› https://tinourl.com/2uL346



      -

      Domo's platform integrates with over 1,000 data sources, including Salesforce, Google Analytics, Shopify, Zendesk, and Twitter. It also offers a suite of apps that enable users to create dashboards, reports, alerts, and workflows. Users can also communicate with each other through chat, video conferencing, and document sharing.

      -

      Domo claims to have over 2,000 customers across various industries, such as retail, media, healthcare, education, and government. Some of its notable clients include Mastercard, ESPN, DHL, L'Oréal, and National Geographic. The company says it has more than doubled its annual recurring revenue (ARR) in the past two years.

      -

      The latest funding round was led by BlackRock, with participation from existing investors such as GGV Capital, TPG Growth, and Salesforce Ventures. Domo has raised a total of $794 million to date, making it one of the most well-funded startups in the business intelligence space.

      -

      Domo faces stiff competition from Slack, which went public in 2019 and has a market cap of over $20 billion. Slack also offers a platform for data integration and collaboration, and has over 12 million daily active users. Other rivals include Microsoft Teams, Google Workspace, Zoom, and Asana.

      -

      However, Domo believes it has a unique value proposition that sets it apart from its competitors. James said in a statement: "Domo is the only cloud-native platform that can leverage data to help customers digitally transform their businesses and create a data-driven culture at scale. We are thrilled to partner with BlackRock and our other investors as we continue to innovate and deliver solutions that help our customers run their entire organizations on Domo."

      - -

      Domo's valuation has increased significantly since its initial public offering (IPO) in 2018, when it was valued at $511 million. The company has also improved its financial performance, reducing its net loss from $176.6 million in fiscal year 2019 to $144.4 million in fiscal year 2020. Its revenue grew from $142.5 million to $173.1 million in the same period.

      -

      -

      Domo's growth has been driven by the increased demand for cloud-based solutions amid the COVID-19 pandemic, which has forced many businesses to shift to remote work and digital transformation. Domo has also benefited from its strategic partnerships with Amazon Web Services (AWS), Snowflake, and Adobe, which have helped it reach new customers and markets.

      -

      Domo plans to use its new funding to further invest in its product development, sales and marketing, and international expansion. The company aims to become the leading platform for data-driven organizations, and to achieve profitability and positive cash flow in the near future.

      7b8c122e87
      -
      -
      \ No newline at end of file diff --git a/spaces/raedeXanto/academic-chatgpt-beta/Drivers HL-DT-ST DVDRAM GT51N ATA Device for Windows 10 64-bit How to Fix Common Problems.md b/spaces/raedeXanto/academic-chatgpt-beta/Drivers HL-DT-ST DVDRAM GT51N ATA Device for Windows 10 64-bit How to Fix Common Problems.md deleted file mode 100644 index a6e30d4f4167dda9ec1dcca20aa0e8da79e573c6..0000000000000000000000000000000000000000 --- a/spaces/raedeXanto/academic-chatgpt-beta/Drivers HL-DT-ST DVDRAM GT51N ATA Device for Windows 10 64-bit How to Fix Common Problems.md +++ /dev/null @@ -1,117 +0,0 @@ - -

      Drivers HL-DT-ST DVDRAM GT51N ATA Device for Windows 10 64-bit

      -

      If you have a laptop or desktop computer that has a DVD drive with the model name HL-DT-ST DVDRAM GT51N ATA Device, you may encounter some problems with it after upgrading to Windows 10 64-bit. In this article, we will explain what this device is, why you need drivers for it, and how to fix some common issues that may affect its performance.

      -

      Drivers HL-DT-ST DVDRAM GT51N ATA Device for Windows 10 64-bit


      Download File ===== https://tinourl.com/2uL2UX



      -

      Common problems with HL-DT-ST DVDRAM GT51N ATA Device

      -

      Some of the problems that users have reported with their HL-DT-ST DVDRAM GT51N ATA Device are:

      -

      DVD drive not working or recognized by Windows 10

      -

      This problem may occur if the DVD drive is disabled in BIOS settings, corrupted by malware, or missing from File Explorer. You may notice that the DVD drive icon is not visible in File Explorer, or that you get an error message when you try to access it.

      -

      DVD drive unable to read or write discs

      -

      This problem may occur if the DVD drive is dirty, damaged, or incompatible with the disc format. You may notice that the DVD drive makes noises when you insert a disc, or that it ejects the disc automatically. You may also get an error message when you try to play or burn a disc.

      -

      DVD drive showing error code 19 in device manager

      -

      This problem may occur if the DVD drive driver is corrupted or outdated. You may notice that the DVD drive has a yellow exclamation mark next to it in device manager, or that it shows an error code 19 in its properties. The error code 19 means that the device cannot start due to errors in configuration information in the registry.

      -

      How to fix HL-DT-ST DVDRAM GT51N ATA Device problems

      -

      There are several ways to fix the problems with your HL-DT-ST DVDRAM GT51N ATA Device. Here are some of them:

      -

      Update or reinstall the device driver

      -

      The device driver is a software program that allows your DVD drive to communicate with your operating system. Updating or reinstalling the device driver may solve some of the problems with your DVD drive. Here are three methods to do so:

      -
        -
      • Method 1: Use Windows Update. Windows Update can automatically check for and install the latest drivers for your devices. To use Windows Update, follow these steps:
          -
        1. Click on Start and select Settings.
        2. -
        3. Click on Update & Security and select Windows Update.
        4. -
        5. Click on Check for updates and wait for Windows to scan for available updates.
        6. -
        7. If there are any updates for your DVD drive, click on Install now and follow the instructions.
        8. -
        9. Restart your computer and check if your DVD drive works properly.
        10. -
      • -
      • Method 2: Use Device Manager. Device Manager is a tool that allows you to manage your devices and their drivers. To use Device Manager, follow these steps:
          -
        1. Press Windows key + X and select Device Manager.
        2. -
        3. Expand DVD/CD-ROM drives and right-click on HL-DT-ST DVDRAM GT51N ATA Device.
        4. -
        5. Select Update driver and choose Search automatically for updated driver software.
        6. -
        7. Wait for Windows to search for and install the best driver for your DVD drive.
        8. -
        9. Restart your computer and check if your DVD drive works properly.
        10. -
      • -
      • Method 3: Use manufacturer's website. You can also download and install the latest driver for your DVD drive from the manufacturer's website. To do this, you need to know the exact model name and number of your DVD drive and your computer. Then, follow these steps:
          -
        1. Go to the manufacturer's website and find the support section.
        2. -
        3. Enter your model name and number and select your operating system (Windows 10 64-bit).
        4. -
        5. Look for the driver category and download the latest driver for your DVD drive.
        6. -
        7. Run the downloaded file and follow the instructions to install the driver.
        8. -
        9. Restart your computer and check if your DVD drive works properly.
        10. -
      • -
      -

      Run the hardware troubleshooter

      -

      The hardware troubleshooter is an automated tool that can check your hardware devices for any known issues and provide solutions on how to fix them. To run the hardware troubleshooter, follow these steps:

      -
        -
      1. Press Windows key + I and select Update & Security.
      2. -
      3. Select Troubleshoot from the left pane and click on Additional troubleshooters.
      4. -
      5. Select Hardware and Devices from the list and click on Run the troubleshooter.
      6. -
      7. Wait for the troubleshooter to scan your devices and follow any instructions it gives you.
      8. -
      9. Restart your computer and check if your DVD drive works properly.
      10. -
      -

      Uninstall conflicting programs

      -

      Some programs that are related to disc creation or recovery may interfere with your DVD drive and cause problems. If you have any of these programs installed on your computer, you may want to uninstall them and see if that helps. Some examples of these programs are TOSHIBA Recovery Media Creator, TOSHIBA Disc Creator, Nero Burning ROM, Roxio Creator, etc. To uninstall these programs, follow these steps:

      -
        -
      1. Press Windows key + R and type appwiz.cpl in the Run box.
      2. -
      3. Press Enter to open Programs and Features.
      4. -
      5. Look for any programs that are related to disc creation or recovery and right-click on them.
      6. -
      7. Select Uninstall and follow the instructions to remove them from your computer.
      8. -
      9. Restart your computer and check if your DVD drive works properly.
      10. -
      -

      Conclusion

      -

      In this article, we have explained what HL-DT-ST DVDRAM GT51N ATA Device is, why you need drivers for it, and how to fix some common problems that may affect its performance. We hope that this article has helped you solve your issues with your DVD drive. Here are some tips on how to maintain your DVD drive:

      -

      How to install drivers for HL-DT-ST DVDRAM GT51N on Windows 10 64-bit
      -Download latest drivers for HL-DT-ST DVDRAM GT51N ATA Device
      -Fix HL-DT-ST DVDRAM GT51N driver issues on Windows 10 64-bit
      -Update drivers for HL-DT-ST DVDRAM GT51N using Device Manager
      -Best software to manage drivers for HL-DT-ST DVDRAM GT51N ATA Device
      -Troubleshoot HL-DT-ST DVDRAM GT51N driver errors on Windows 10 64-bit
      -Backup and restore drivers for HL-DT-ST DVDRAM GT51N
      -Uninstall and reinstall drivers for HL-DT-ST DVDRAM GT51N ATA Device
      -Drivers for HL-DT-ST DVDRAM GT51N compatible with Windows 10 64-bit
      -Drivers for HL-DT-ST DVDRAM GT51N not working on Windows 10 64-bit
      -Drivers for HL-DT-ST DVDRAM GT51N missing or corrupted on Windows 10 64-bit
      -Drivers for HL-DT-ST DVDRAM GT51N causing blue screen of death on Windows 10 64-bit
      -Drivers for HL-DT-ST DVDRAM GT51N slowing down performance on Windows 10 64-bit
      -Drivers for HL-DT-ST DVDRAM GT51N affecting battery life on Windows 10 64-bit
      -Drivers for HL-DT-ST DVDRAM GT51N making noise or not reading discs on Windows 10 64-bit
      -Drivers for HL-DT-ST DVDRAM GT51N not recognized by BIOS or Windows 10 64-bit
      -Drivers for HL-DT-ST DVDRAM GT51N not compatible with other devices or software on Windows 10 64-bit
      -Drivers for HL-DT-ST DVDRAM GT51N outdated or expired on Windows 10 64-bit
      -Drivers for HL-DT-ST DVDRAM GT51N infected by malware or virus on Windows 10 64-bit
      -Drivers for HL-DT-ST DVDRAM GT51N damaged or broken on Windows 10 64-bit
      -Where to find drivers for HL-DT-ST DVDRAM GT51N online or offline
      -How to verify drivers for HL-DT-ST DVDRAM GT51N are genuine and safe
      -How to optimize drivers for HL-DT-ST DVDRAM GT51N for better performance and stability
      -How to customize drivers for HL-DT-ST DVDRAM GT51N according to preferences and needs
      -How to test drivers for HL-DT-ST DVDRAM GT51N for functionality and compatibility
      -How to upgrade drivers for HL-DT-ST DVDRAM GT51N to the latest version or downgrade to a previous version
      -How to enable or disable drivers for HL-DT-ST DVDRAM GT51N on Windows 10 64-bit
      -How to configure drivers for HL-DT-ST DVDRAM GT51N on Windows 10 64-bit
      -How to use drivers for HL-DT-ST DVDRAM GT51N with other applications or programs on Windows 10 64-bit
      -How to share drivers for HL-DT-ST DVDRAM GT51N with other users or devices on Windows 10 64-bit
      -How to troubleshoot common problems with drivers for HL-DT-ST DVDRAM GT51N on Windows 10 64-bit
      -How to solve specific issues with drivers for HL-DT-ST DVDRAM GT51N on Windows 10 64-bit
      -How to contact support or customer service for drivers for HL-DT-ST DVDRAM GT51N on Windows 10 64-bit
      -How to get a refund or replacement for drivers for HL-DT-ST DVDRAM GT51N on Windows 10 64-bit
      -How to review or rate drivers for HL-DT-ST DVDRAM GT51N on Windows 10 64-bit
      -How to compare drivers for HL-DT-ST DVDRAM GT51N with other similar products or services on Windows 10 64-bit
      -How to find the best deals or discounts for drivers for HL-DT-ST DVDRAM GT51N on Windows 10 64-bit
      -How to buy or sell drivers for HL-DT-ST DVDRAM GT51N on Windows 10 64-bit
      -How to download or upload drivers for HL-DT-ST DVDRAM GT51N on Windows 10 64-bit
      -How to copy or paste drivers for HL-DT-ST DVDRAM GT51N on Windows 10 64-bit
      -How to edit or modify drivers for HL-DT-ST DVDRAM GT51N on Windows 10 64-bit
      -How to create or delete drivers for HL-DT-ST DVDRAM GT51N on Windows 10 64-bit
      -How to backup or restore drivers for HL-DT-ST DVDRAM GT51N on Windows 10

      -
      • Clean your DVD drive regularly with a soft cloth or a cleaning disc.
      • Avoid exposing your DVD drive to extreme temperatures or humidity.
      • Avoid using scratched or damaged discs in your DVD drive.
      • Avoid forcing discs into or out of your DVD drive.
      • Avoid moving your computer while using your DVD drive.
      -

      Frequently Asked Questions

      - ```html DVD-Rs, DVD-RWs, DVD+Rs, DVD+RWs, and DVD-RAMs. It is an internal device that connects to your computer via an ATA interface. -
    15. Why do I need drivers for HL-DT-ST DVDRAM GT51N ATA Device?
      Drivers are software programs that allow your devices to communicate with your operating system and perform their functions. You need drivers for your HL-DT-ST DVDRAM GT51N ATA Device to enable it to read and write discs, play media files, and access disc information. Without drivers, your DVD drive may not work properly or at all.
    16. -
    17. How do I find out the model name and number of my DVD drive and my computer?
      You can find out the model name and number of your DVD drive by checking its label or sticker on the device itself. You may need to open your computer case to access it. You can also use Device Manager to check the model name of your DVD drive. To do this, press Windows key + X and select Device Manager. Expand DVD/CD-ROM drives and right-click on your DVD drive. Select Properties and check the Device name under the General tab. You can find out the model name and number of your computer by checking its label or sticker on the back or bottom of the device. You can also use System Information to check the model name of your computer. To do this, press Windows key + R and type msinfo32 in the Run box. Press Enter to open System Information. Check the System Model under the System Summary section.
    18. -
    19. What are some alternative ways to play or burn discs if my DVD drive is not working?
      If your DVD drive is not working, you can try some alternative ways to play or burn discs such as using an external USB DVD drive, using a cloud storage service, using a flash drive, or using a media player software.
    20. -
    21. What are some sources where I can download drivers for HL-DT-ST DVDRAM GT51N ATA Device?
      Some sources where you can download drivers for HL-DT-ST DVDRAM GT51N ATA Device are:
        -
      • The manufacturer's website of your DVD drive or your computer.
      • -
      • The Windows Update service.
      • -
      • The Device Manager tool.
      • -
      • The third-party driver download websites (use with caution).
      • -
    - ```

    0a6ba089eb
    -
    -
    \ No newline at end of file diff --git a/spaces/ramiin2/AutoGPT/autogpt/app.py b/spaces/ramiin2/AutoGPT/autogpt/app.py deleted file mode 100644 index 58d9f7164ddfbb5019b072d789dc2fa6205dc9d3..0000000000000000000000000000000000000000 --- a/spaces/ramiin2/AutoGPT/autogpt/app.py +++ /dev/null @@ -1,330 +0,0 @@ -""" Command and Control """ -import json -from typing import Dict, List, NoReturn, Union - -from autogpt.agent.agent_manager import AgentManager -from autogpt.commands.analyze_code import analyze_code -from autogpt.commands.audio_text import read_audio_from_file -from autogpt.commands.execute_code import ( - execute_python_file, - execute_shell, - execute_shell_popen, -) -from autogpt.commands.file_operations import ( - append_to_file, - delete_file, - download_file, - read_file, - search_files, - write_to_file, -) -from autogpt.commands.git_operations import clone_repository -from autogpt.commands.google_search import google_official_search, google_search -from autogpt.commands.image_gen import generate_image -from autogpt.commands.improve_code import improve_code -from autogpt.commands.twitter import send_tweet -from autogpt.commands.web_requests import scrape_links, scrape_text -from autogpt.commands.web_selenium import browse_website -from autogpt.commands.write_tests import write_tests -from autogpt.config import Config -from autogpt.json_utils.json_fix_llm import fix_and_parse_json -from autogpt.memory import get_memory -from autogpt.processing.text import summarize_text -from autogpt.speech import say_text - -CFG = Config() -AGENT_MANAGER = AgentManager() - - -def is_valid_int(value: str) -> bool: - """Check if the value is a valid integer - - Args: - value (str): The value to check - - Returns: - bool: True if the value is a valid integer, False otherwise - """ - try: - int(value) - return True - except ValueError: - return False - - -def get_command(response_json: Dict): - """Parse the response and return the command name and arguments - - Args: - response_json (json): The response from the AI - - Returns: - tuple: The command name and arguments - - Raises: - json.decoder.JSONDecodeError: If the response is not valid JSON - - Exception: If any other error occurs - """ - try: - if "command" not in response_json: - return "Error:", "Missing 'command' object in JSON" - - if not isinstance(response_json, dict): - return "Error:", f"'response_json' object is not dictionary {response_json}" - - command = response_json["command"] - if not isinstance(command, dict): - return "Error:", "'command' object is not a dictionary" - - if "name" not in command: - return "Error:", "Missing 'name' field in 'command' object" - - command_name = command["name"] - - # Use an empty dictionary if 'args' field is not present in 'command' object - arguments = command.get("args", {}) - - return command_name, arguments - except json.decoder.JSONDecodeError: - return "Error:", "Invalid JSON" - # All other errors, return "Error: + error message" - except Exception as e: - return "Error:", str(e) - - -def map_command_synonyms(command_name: str): - """Takes the original command name given by the AI, and checks if the - string matches a list of common/known hallucinations - """ - synonyms = [ - ("write_file", "write_to_file"), - ("create_file", "write_to_file"), - ("search", "google"), - ] - for seen_command, actual_command_name in synonyms: - if command_name == seen_command: - return actual_command_name - return command_name - - -def execute_command(command_name: str, arguments): - """Execute the command and return the result - - Args: - command_name (str): The name of the command to execute - arguments (dict): The arguments for the command - - Returns: - str: The result of the command - """ - try: - command_name = map_command_synonyms(command_name.lower()) - if command_name == "google": - # Check if the Google API key is set and use the official search method - # If the API key is not set or has only whitespaces, use the unofficial - # search method - key = CFG.google_api_key - if key and key.strip() and key != "your-google-api-key": - google_result = google_official_search(arguments["input"]) - return google_result - else: - google_result = google_search(arguments["input"]) - - # google_result can be a list or a string depending on the search results - if isinstance(google_result, list): - safe_message = [ - google_result_single.encode("utf-8", "ignore") - for google_result_single in google_result - ] - else: - safe_message = google_result.encode("utf-8", "ignore") - - return safe_message.decode("utf-8") - elif command_name == "memory_add": - memory = get_memory(CFG) - return memory.add(arguments["string"]) - elif command_name == "start_agent": - return start_agent( - arguments["name"], arguments["task"], arguments["prompt"] - ) - elif command_name == "message_agent": - return message_agent(arguments["key"], arguments["message"]) - elif command_name == "list_agents": - return list_agents() - elif command_name == "delete_agent": - return delete_agent(arguments["key"]) - elif command_name == "get_text_summary": - return get_text_summary(arguments["url"], arguments["question"]) - elif command_name == "get_hyperlinks": - return get_hyperlinks(arguments["url"]) - elif command_name == "clone_repository": - return clone_repository( - arguments["repository_url"], arguments["clone_path"] - ) - elif command_name == "read_file": - return read_file(arguments["file"]) - elif command_name == "write_to_file": - return write_to_file(arguments["file"], arguments["text"]) - elif command_name == "append_to_file": - return append_to_file(arguments["file"], arguments["text"]) - elif command_name == "delete_file": - return delete_file(arguments["file"]) - elif command_name == "search_files": - return search_files(arguments["directory"]) - elif command_name == "download_file": - if not CFG.allow_downloads: - return "Error: You do not have user authorization to download files locally." - return download_file(arguments["url"], arguments["file"]) - elif command_name == "browse_website": - return browse_website(arguments["url"], arguments["question"]) - # TODO: Change these to take in a file rather than pasted code, if - # non-file is given, return instructions "Input should be a python - # filepath, write your code to file and try again" - elif command_name == "analyze_code": - return analyze_code(arguments["code"]) - elif command_name == "improve_code": - return improve_code(arguments["suggestions"], arguments["code"]) - elif command_name == "write_tests": - return write_tests(arguments["code"], arguments.get("focus")) - elif command_name == "execute_python_file": # Add this command - return execute_python_file(arguments["file"]) - elif command_name == "execute_shell": - if CFG.execute_local_commands: - return execute_shell(arguments["command_line"]) - else: - return ( - "You are not allowed to run local shell commands. To execute" - " shell commands, EXECUTE_LOCAL_COMMANDS must be set to 'True' " - "in your config. Do not attempt to bypass the restriction." - ) - elif command_name == "execute_shell_popen": - if CFG.execute_local_commands: - return execute_shell_popen(arguments["command_line"]) - else: - return ( - "You are not allowed to run local shell commands. To execute" - " shell commands, EXECUTE_LOCAL_COMMANDS must be set to 'True' " - "in your config. Do not attempt to bypass the restriction." - ) - elif command_name == "read_audio_from_file": - return read_audio_from_file(arguments["file"]) - elif command_name == "generate_image": - return generate_image(arguments["prompt"]) - elif command_name == "send_tweet": - return send_tweet(arguments["text"]) - elif command_name == "do_nothing": - return "No action performed." - elif command_name == "task_complete": - shutdown() - else: - return ( - f"Unknown command '{command_name}'. Please refer to the 'COMMANDS'" - " list for available commands and only respond in the specified JSON" - " format." - ) - except Exception as e: - return f"Error: {str(e)}" - - -def get_text_summary(url: str, question: str) -> str: - """Return the results of a Google search - - Args: - url (str): The url to scrape - question (str): The question to summarize the text for - - Returns: - str: The summary of the text - """ - text = scrape_text(url) - summary = summarize_text(url, text, question) - return f""" "Result" : {summary}""" - - -def get_hyperlinks(url: str) -> Union[str, List[str]]: - """Return the results of a Google search - - Args: - url (str): The url to scrape - - Returns: - str or list: The hyperlinks on the page - """ - return scrape_links(url) - - -def shutdown() -> NoReturn: - """Shut down the program""" - print("Shutting down...") - quit() - - -def start_agent(name: str, task: str, prompt: str, model=CFG.fast_llm_model) -> str: - """Start an agent with a given name, task, and prompt - - Args: - name (str): The name of the agent - task (str): The task of the agent - prompt (str): The prompt for the agent - model (str): The model to use for the agent - - Returns: - str: The response of the agent - """ - # Remove underscores from name - voice_name = name.replace("_", " ") - - first_message = f"""You are {name}. Respond with: "Acknowledged".""" - agent_intro = f"{voice_name} here, Reporting for duty!" - - # Create agent - if CFG.speak_mode: - say_text(agent_intro, 1) - key, ack = AGENT_MANAGER.create_agent(task, first_message, model) - - if CFG.speak_mode: - say_text(f"Hello {voice_name}. Your task is as follows. {task}.") - - # Assign task (prompt), get response - agent_response = AGENT_MANAGER.message_agent(key, prompt) - - return f"Agent {name} created with key {key}. First response: {agent_response}" - - -def message_agent(key: str, message: str) -> str: - """Message an agent with a given key and message""" - # Check if the key is a valid integer - if is_valid_int(key): - agent_response = AGENT_MANAGER.message_agent(int(key), message) - else: - return "Invalid key, must be an integer." - - # Speak response - if CFG.speak_mode: - say_text(agent_response, 1) - return agent_response - - -def list_agents(): - """List all agents - - Returns: - str: A list of all agents - """ - return "List of agents:\n" + "\n".join( - [str(x[0]) + ": " + x[1] for x in AGENT_MANAGER.list_agents()] - ) - - -def delete_agent(key: str) -> str: - """Delete an agent with a given key - - Args: - key (str): The key of the agent to delete - - Returns: - str: A message indicating whether the agent was deleted or not - """ - result = AGENT_MANAGER.delete_agent(key) - return f"Agent {key} deleted." if result else f"Agent {key} does not exist." diff --git a/spaces/ramiin2/AutoGPT/autogpt/config/ai_config.py b/spaces/ramiin2/AutoGPT/autogpt/config/ai_config.py deleted file mode 100644 index d50c30beee9dc8009f63415378ae1c6a399f0037..0000000000000000000000000000000000000000 --- a/spaces/ramiin2/AutoGPT/autogpt/config/ai_config.py +++ /dev/null @@ -1,121 +0,0 @@ -# sourcery skip: do-not-use-staticmethod -""" -A module that contains the AIConfig class object that contains the configuration -""" -from __future__ import annotations - -import os -from typing import Type - -import yaml - - -class AIConfig: - """ - A class object that contains the configuration information for the AI - - Attributes: - ai_name (str): The name of the AI. - ai_role (str): The description of the AI's role. - ai_goals (list): The list of objectives the AI is supposed to complete. - """ - - def __init__( - self, ai_name: str = "", ai_role: str = "", ai_goals: list | None = None - ) -> None: - """ - Initialize a class instance - - Parameters: - ai_name (str): The name of the AI. - ai_role (str): The description of the AI's role. - ai_goals (list): The list of objectives the AI is supposed to complete. - Returns: - None - """ - if ai_goals is None: - ai_goals = [] - self.ai_name = ai_name - self.ai_role = ai_role - self.ai_goals = ai_goals - - # Soon this will go in a folder where it remembers more stuff about the run(s) - SAVE_FILE = os.path.join(os.path.dirname(__file__), "..", "ai_settings.yaml") - - @staticmethod - def load(config_file: str = SAVE_FILE) -> "AIConfig": - """ - Returns class object with parameters (ai_name, ai_role, ai_goals) loaded from - yaml file if yaml file exists, - else returns class with no parameters. - - Parameters: - config_file (int): The path to the config yaml file. - DEFAULT: "../ai_settings.yaml" - - Returns: - cls (object): An instance of given cls object - """ - - try: - with open(config_file, encoding="utf-8") as file: - config_params = yaml.load(file, Loader=yaml.FullLoader) - except FileNotFoundError: - config_params = {} - - ai_name = config_params.get("ai_name", "") - ai_role = config_params.get("ai_role", "") - ai_goals = config_params.get("ai_goals", []) - # type: Type[AIConfig] - return AIConfig(ai_name, ai_role, ai_goals) - - def save(self, config_file: str = SAVE_FILE) -> None: - """ - Saves the class parameters to the specified file yaml file path as a yaml file. - - Parameters: - config_file(str): The path to the config yaml file. - DEFAULT: "../ai_settings.yaml" - - Returns: - None - """ - - config = { - "ai_name": self.ai_name, - "ai_role": self.ai_role, - "ai_goals": self.ai_goals, - } - with open(config_file, "w", encoding="utf-8") as file: - yaml.dump(config, file, allow_unicode=True) - - def construct_full_prompt(self) -> str: - """ - Returns a prompt to the user with the class information in an organized fashion. - - Parameters: - None - - Returns: - full_prompt (str): A string containing the initial prompt for the user - including the ai_name, ai_role and ai_goals. - """ - - prompt_start = ( - "Your decisions must always be made independently without" - " seeking user assistance. Play to your strengths as an LLM and pursue" - " simple strategies with no legal complications." - "" - ) - - from autogpt.prompt import get_prompt - - # Construct full prompt - full_prompt = ( - f"You are {self.ai_name}, {self.ai_role}\n{prompt_start}\n\nGOALS:\n\n" - ) - for i, goal in enumerate(self.ai_goals): - full_prompt += f"{i+1}. {goal}\n" - - full_prompt += f"\n\n{get_prompt()}" - return full_prompt diff --git a/spaces/rashmi/h2oai-predict-llm/app.py b/spaces/rashmi/h2oai-predict-llm/app.py deleted file mode 100644 index c42a29cdd7035f9c629aebf9dcde4c7c9f7014ef..0000000000000000000000000000000000000000 --- a/spaces/rashmi/h2oai-predict-llm/app.py +++ /dev/null @@ -1,256 +0,0 @@ -import gradio as gr -import spaces - -import os -import gc -import random -import warnings - -warnings.filterwarnings("ignore") - -import numpy as np -import pandas as pd - -pd.set_option("display.max_rows", 500) -pd.set_option("display.max_columns", 500) -pd.set_option("display.width", 1000) -from tqdm.auto import tqdm - -import torch -import torch.nn as nn -import tokenizers -import transformers - -print(f"tokenizers.__version__: {tokenizers.__version__}") -print(f"transformers.__version__: {transformers.__version__}") -print(f"torch.__version__: {torch.__version__}") -print(f"torch cuda version: {torch.version.cuda}") -from transformers import AutoTokenizer, AutoConfig -from transformers import BitsAndBytesConfig, AutoModelForCausalLM, MistralForCausalLM -from peft import LoraConfig, get_peft_model - - -title = "H2O AI Predict the LLM" - -description =" The objective of this [competition](https://www.kaggle.com/competitions/h2oai-predict-the-llm) was to \ -detect which out of 7 possible LLM models produced a particular response. \n\n\ -This demo is utilizing finetuned HuggingFaceH4/zephyr-7b-beta model for a multiclass classification task. \n\n \ -We ranked 3rd out of more than 100 participants and our team's solution is [here](https://www.kaggle.com/competitions/h2oai-predict-the-llm/discussion/453728)" - -title = title + "\n" + description - -#Theme from - https://huggingface.co/spaces/trl-lib/stack-llama/blob/main/app.py -theme = gr.themes.Monochrome( - primary_hue="indigo", - secondary_hue="blue", - neutral_hue="slate", - radius_size=gr.themes.sizes.radius_sm, - font=[gr.themes.GoogleFont("Open Sans"), "ui-sans-serif", "system-ui", "sans-serif"], -) - -### Load the model -class CFG: - num_workers = os.cpu_count() - llm_backbone = "HuggingFaceH4/zephyr-7b-beta" - tokenizer_path = "HuggingFaceH4/zephyr-7b-beta" - tokenizer = AutoTokenizer.from_pretrained( - tokenizer_path, add_prefix_space=False, use_fast=True, trust_remote_code=True, add_eos_token=True - ) - batch_size = 1 - max_len = 650 - seed = 42 - - num_labels = 7 - - lora = True - lora_r = 4 - lora_alpha = 16 - lora_dropout = 0.05 - lora_target_modules = "" - gradient_checkpointing = True - - -class CustomModel(nn.Module): - """ - Model for causal language modeling problem type. - """ - - def __init__(self): - super().__init__() - - self.backbone_config = AutoConfig.from_pretrained( - CFG.llm_backbone, trust_remote_code=True - ) - - quantization_config = BitsAndBytesConfig( - load_in_4bit=True, - bnb_4bit_compute_dtype=torch.float16, - bnb_4bit_quant_type="nf4", - ) - - self.model = AutoModelForCausalLM.from_pretrained( - CFG.llm_backbone, - config=self.backbone_config, - quantization_config=quantization_config, - ) - - if CFG.lora: - target_modules = [] - for name, module in self.model.named_modules(): - if ( - isinstance(module, (torch.nn.Linear, torch.nn.Conv1d)) - and "head" not in name - ): - name = name.split(".")[-1] - if name not in target_modules: - target_modules.append(name) - - lora_config = LoraConfig( - r=CFG.lora_r, - lora_alpha=CFG.lora_alpha, - target_modules=target_modules, - lora_dropout=CFG.lora_dropout, - bias="none", - task_type="CAUSAL_LM", - ) - if CFG.gradient_checkpointing: - self.model.enable_input_require_grads() - self.model = get_peft_model(self.model, lora_config) - self.model.print_trainable_parameters() - - self.classification_head = nn.Linear( - self.backbone_config.vocab_size, CFG.num_labels, bias=False - ) - self._init_weights(self.classification_head) - - def _init_weights(self, module): - if isinstance(module, nn.Linear): - module.weight.data.normal_(mean=0.0, std=self.backbone_config.initializer_range) - if module.bias is not None: - module.bias.data.zero_() - elif isinstance(module, nn.Embedding): - module.weight.data.normal_(mean=0.0, std=self.backbone_config.initializer_range) - if module.padding_idx is not None: - module.weight.data[module.padding_idx].zero_() - elif isinstance(module, nn.LayerNorm): - module.bias.data.zero_() - module.weight.data.fill_(1.0) - - def forward( - self, - batch - ): - # disable cache if gradient checkpointing is enabled - if CFG.gradient_checkpointing: - self.model.config.use_cache = False - - self.model.config.pretraining_tp = 1 - - output = self.model( - input_ids=batch["input_ids"], - attention_mask=batch["attention_mask"], - ) - - output.logits = self.classification_head(output[0][:, -1].float()) - - # enable cache again if gradient checkpointing is enabled - if CFG.gradient_checkpointing: - self.model.config.use_cache = True - - return output.logits - -model = CustomModel() -### End Load the model - -def do_inference(full_text): - device = torch.device("cuda" if torch.cuda.is_available() else "cpu") - model_paths = [ - 'model_finetuned/HuggingFaceH4-zephyr-7b-beta_fold0_best.pth'] - - # config_path = ("/home/rashmi/Documents/kaggle/h2oai_predict_llm/src/models_exp56/config.pth") - - def prepare_input(cfg, text): - inputs = cfg.tokenizer.encode_plus( - text, - return_tensors=None, - add_special_tokens=True, - max_length=CFG.max_len, - pad_to_max_length=True, - truncation="longest_first", - ) - for k, v in inputs.items(): - inputs[k] = torch.tensor(v, dtype=torch.long) - return inputs - - # model = CustomModel() - state = torch.load(model_paths[0], map_location=torch.device("cpu")) - model.load_state_dict(state["model"] ,strict=False) - model.eval() - model.to(device) - - inputs = prepare_input(CFG, full_text) - inputs["input_ids"] = inputs["input_ids"].reshape(1, -1).to(device) - inputs["attention_mask"] = inputs["attention_mask"].reshape(1, -1).to(device) - - with torch.no_grad(): - with torch.cuda.amp.autocast( - enabled=True, dtype=torch.float16, cache_enabled=True - ): - y_preds = model(inputs) - y_preds = y_preds.detach().to("cpu").numpy().astype(np.float32) - y_preds= torch.softmax(torch.tensor(y_preds), 1).numpy() - - result = np.argmax(y_preds) - - if result == 0: - return "0. llama2-70b-chat" - elif result == 1: - return "1. wizardLM-13b" - elif result == 2: - return "2. llama2-13b-chat" - elif result == 3: - return "3. wizardLM-70b" - elif result == 4: - return "4. llama2-7b-chat" - elif result == 5: - return "5. tinyllama-1b-chat" - elif result == 6: - return "6. mistral-7b-openorca" - else: - return "Error" - - - - -def do_submit(question, response): - full_text = question + " " + response - result = do_inference(full_text) - return result - -@spaces.GPU -def greet(): - pass - -with gr.Blocks(title=title) as demo: # theme=theme - sample_examples = pd.read_csv('sample_examples.csv') - example_list = sample_examples[['Question','Response','target']].sample(2).values.tolist() - gr.Markdown(f"## {title}") - with gr.Row(): - # with gr.Column(scale=1): - # gr.Markdown("### Question and LLM Response") - question_text = gr.Textbox(lines=2, placeholder="Question:", label="") - response_text = gr.Textbox(lines=2, placeholder="Response:", label="") - target_text = gr.Textbox(lines=1, placeholder="Target:", label="", interactive=False , visible=False) - llm_num = gr.Textbox(value="", label="LLM #") - with gr.Row(): - sub_btn = gr.Button("Submit") - sub_btn.click(fn=do_submit, inputs=[question_text, response_text], outputs=[llm_num]) - - gr.Markdown("## Sample Inputs:") - gr.Examples( - example_list, - [question_text,response_text,target_text], - # cache_examples=True, - ) - -demo.launch(greet) \ No newline at end of file diff --git a/spaces/recenWmenso/ChatGPT-with-Voice-Cloning-for-All/datasets/70 533 Cbt Nuggets Torrent.md b/spaces/recenWmenso/ChatGPT-with-Voice-Cloning-for-All/datasets/70 533 Cbt Nuggets Torrent.md deleted file mode 100644 index 5d9f4b292e582f9c4bf87dbc1fd2d284da93319a..0000000000000000000000000000000000000000 --- a/spaces/recenWmenso/ChatGPT-with-Voice-Cloning-for-All/datasets/70 533 Cbt Nuggets Torrent.md +++ /dev/null @@ -1,7 +0,0 @@ - -

    Torrents:
    Raw:: 2:19:52. (11) - [.][Dragon Ball Super -Voltage]-Kira Kira (Translated, Subbed) - [Downloaded] Miiverse - [url=br /multiple-topics-on-the-same-thread/folder]Foi seguido por 224 pessoas! [/url]
    BWP-134 (29) - [.][Dragon Ball Super -Voltage]-Kira Kira (Translated, Subbed) - [Downloaded] Miiverse - [url=br /multiple-topics-on-the-same-thread/folder]Foi seguido por 224 pessoas! [/url]
    BWP-134 (29) - [.][Dragon Ball Super -Voltage]-Kira Kira (Translated, Subbed) - [Downloaded] Miiverse - [url=br /multiple-topics-on-the-same-thread/folder]Foi seguido por 224 pessoas! [/url]
    BWP-134 (29) - [.][Dragon Ball Super -Voltage]-Kira Kira (Translated, Subbed) - [Downloaded] Miiverse - [url=br /multiple-topics-on-the-same-thread/folder]Foi seguido por 224 pessoas! [/url]
    It's Not Okay - 6.26.2016 - Online - Seguido por 20 pessoas!.
    The Eternal Fly - 15.02.2015 - Online - Seguido por 6 pessoas!.
    Dragon Ball Super - The Power of... [subscripciones: 0] - 2016 - -.

    -

    Torrents: Watanabe Seiya X (Nico Nico Douga).
    The Eternal Fly - 3.05.2015 - Online - Seguido por 3 pessoas!.
    3x23 51% - 69%.

    Latest New Releases : Weekend Stars. Housefull 2. Movie Torrents. Plus these are all of the latest movies available for download. Free Movie Download. Legally Download Movies From... FALLING UPON THE HEAVEN (2015) (Dub) - HD - 5.68 GB..

    -

    70 533 Cbt Nuggets Torrent


    Download ::: https://urlgoal.com/2uCJpr



    -

    Torrents: Een verhaal over de afgrond van ons land en ons bevolkingslot - blvd.dat - en de waan van vreemdelingen - schatteloftelijke.kastelancken.pl - even herinneren naar het vak der Heimisrnacht - bvb.belgium.com.
    [url=http://www.4chan.org/funroll/discuss/93292908/All-that-I-love-is-lawlessness]All that I love is lawlessness [/url] - [url=http://www.4chan.org/touhou/talk/96640042/A-little-pumpkin-and-you-get-the-best-stubble]A little pumpkin and you get the best stubble [/url] - [url=http://www.4chan.

    899543212b
    -
    -
    \ No newline at end of file diff --git a/spaces/recenWmenso/ChatGPT-with-Voice-Cloning-for-All/datasets/Crack Pipe Vending Machine Vice Definition.md b/spaces/recenWmenso/ChatGPT-with-Voice-Cloning-for-All/datasets/Crack Pipe Vending Machine Vice Definition.md deleted file mode 100644 index 60179242de19a77bc1100140954fe9ef53744a39..0000000000000000000000000000000000000000 --- a/spaces/recenWmenso/ChatGPT-with-Voice-Cloning-for-All/datasets/Crack Pipe Vending Machine Vice Definition.md +++ /dev/null @@ -1,83 +0,0 @@ - -

    Crack Pipe Vending Machine Vice Definition - What You Need to Know

    -

    Crack pipe vending machines are devices that dispense clean and cheap pipes for smoking crack cocaine. They are part of a harm reduction approach that aims to reduce the health and social risks associated with crack use. However, they are also controversial and often misunderstood by the public and the media. In this article, we will explain the crack pipe vending machine vice definition, the reasons behind it, and the benefits and challenges of implementing it.

    -

    Crack Pipe Vending Machine Vice Definition


    Download Zip https://urlgoal.com/2uCMaV



    -

    What is Crack Pipe Vending Machine Vice Definition?

    -

    The crack pipe vending machine vice definition is a term that refers to the practice of providing crack users with access to clean and affordable pipes through vending machines. The word "vice" implies that crack use is a moral or legal wrong, but also acknowledges that it is a reality that needs to be addressed pragmatically. The word "definition" suggests that this practice is not widely accepted or understood, and that it needs to be clarified and explained.

    -

    The idea behind the crack pipe vending machine vice definition is to reduce the harms associated with crack use, such as HIV and hepatitis C transmission, mouth injuries, infections, violence, stigma, and criminalization. By offering crack users a safe and convenient way to obtain clean pipes, the vending machines aim to prevent them from sharing or reusing pipes, or using improvised or unsafe materials such as glass bottles or metal cans. The vending machines also serve as a point of contact for crack users to access other health and social services, such as testing, counseling, treatment, or housing.

    -

    Where are Crack Pipe Vending Machines Located?

    -

    Crack pipe vending machines are not very common, but they have been implemented in some cities around the world. The first crack pipe vending machine was installed in Vancouver, Canada, in 2014, by the Portland Hotel Society (PHS), a non-profit organization that provides services to people with mental health and addiction issues. The PHS installed two vending machines in its facilities, where crack users can buy a clean pipe for 25 cents. The PHS reported that the vending machines were well received by the users and the community, and that they helped to reduce HIV and hepatitis C rates, as well as violence and littering.

    -

    Another city that has adopted the crack pipe vending machine vice definition is London, UK. In 2016, a charity called Crackdown installed a vending machine in a drug treatment center in Brixton, where crack users can get a free pipe by scanning their finger. The charity said that the vending machine was part of a pilot project to evaluate the feasibility and effectiveness of providing clean pipes to crack users. The charity also said that the vending machine was intended to reduce stigma and discrimination against crack users, and to encourage them to seek help if they wanted to quit.

    -

    -

    What are the Benefits of Crack Pipe Vending Machines?

    -

    Crack pipe vending machines have several benefits for both crack users and society at large. Some of these benefits are:

    -
      -
    • They reduce the risk of HIV and hepatitis C transmission among crack users by preventing them from sharing or reusing pipes.
    • -
    • They reduce the risk of mouth injuries and infections among crack users by preventing them from using broken or dirty pipes.
    • -
    • They reduce the risk of violence and theft among crack users by preventing them from fighting over pipes or stealing them from others.
    • -
    • They reduce the risk of littering and environmental damage by preventing crack users from discarding pipes on the streets or in nature.
    • -
    • They reduce the stigma and discrimination against crack users by treating them with dignity and respect.
    • -
    • They increase the access and engagement of crack users with health and social services by providing them with information and referrals.
    • -
    • They save money for both crack users and society by reducing the costs of health care, law enforcement, and criminal justice.
    • -
    -
    What are the Challenges of Crack Pipe Vending Machines?
    -

    Crack pipe vending machines also face some challenges and criticisms from various stakeholders. Some of these challenges are:

    -
      -
    • They may be seen as condoning or encouraging crack use by providing an easy and cheap way to obtain pipes.
    • -
    • They may be seen as contradicting or undermining drug laws and policies by facilitating an illegal activity.
    • -
    • They may be seen as wasting public funds or resources by spending money on drug paraphernalia instead of other priorities.
    • -
    • They may be seen as attracting or increasing crime or disorder by creating a hotspot for drug activity or vandalism.
    • -
    • They may be seen as ineffective or insufficient by not addressing the root causes or consequences of crack addiction.
    • -
    -
    Conclusion
    -

    Crack pipe vending machines are devices that dispense clean and cheap pipes for smoking crack cocaine. They are part of a harm reduction approach that aims to reduce the health and social risks associated with crack use. However, they are also controversial and often misunderstood by the public and the media. In this article, we have explained the crack pipe vending machine vice definition, the reasons behind it, and the benefits and challenges of implementing it.

    -

    We hope that this article has helped you to understand what crack pipe vending machines are, why they exist, how they work, where they are located, what they achieve, and what they face. We also hope that this article has stimulated your curiosity and interest in learning more about this topic. If you have any questions or comments about this article, please feel free to contact us.

    -What are the Reactions to Crack Pipe Vending Machines? -

    Crack pipe vending machines have elicited various reactions from different stakeholders and groups. Some of these reactions are:

    -
      -
    • Some crack users have welcomed the vending machines as a convenient and respectful way to obtain clean pipes and access other services.
    • -
    • Some health and social workers have supported the vending machines as a pragmatic and effective way to reduce harms and engage with crack users.
    • -
    • Some researchers and academics have endorsed the vending machines as a evidence-based and innovative way to address crack addiction and its consequences.
    • -
    • Some politicians and policymakers have opposed the vending machines as a condoning or encouraging of crack use and a waste of public funds or resources.
    • -
    • Some media and journalists have sensationalized the vending machines as a controversial or shocking phenomenon and a sign of social decay or moral decline.
    • -
    • Some community members and residents have expressed mixed feelings about the vending machines as a potential source of crime or disorder or a positive step towards harm reduction and social inclusion.
    • -
    -How to Evaluate Crack Pipe Vending Machines? -

    Crack pipe vending machines are a relatively new and novel intervention that requires careful and rigorous evaluation. Some of the ways to evaluate them are:

    -
      -
    • Monitoring and measuring the outputs and outcomes of the vending machines, such as the number of pipes dispensed, the number of users served, the number of infections prevented, the number of referrals made, etc.
    • -
    • Comparing and contrasting the costs and benefits of the vending machines, such as the costs of installation, maintenance, and operation, versus the benefits of health care, law enforcement, and criminal justice savings.
    • -
    • Gathering and analyzing the feedbacks and opinions of the stakeholders involved in or affected by the vending machines, such as the users, workers, researchers, politicians, media, community members, etc.
    • -
    • Conducting and disseminating research studies and reports on the effectiveness and impact of the vending machines, using quantitative and qualitative methods, such as surveys, interviews, observations, etc.
    • -
    -What are the Future Prospects of Crack Pipe Vending Machines? -

    Crack pipe vending machines are a relatively new and novel intervention that has potential to be replicated and scaled up in other settings and contexts. Some of the future prospects of crack pipe vending machines are:

    -
      -
    • They could be expanded to other locations and regions where crack use is prevalent and where harm reduction services are lacking or insufficient.
    • -
    • They could be adapted to other substances and modes of consumption, such as heroin, methamphetamine, or injection.
    • -
    • They could be integrated with other technologies and innovations, such as biometric identification, mobile payment, or online ordering.
    • -
    • They could be evaluated and improved based on the feedbacks and experiences of the users, workers, researchers, and other stakeholders.
    • -
    -How to Support Crack Pipe Vending Machines? -

    If you are interested in supporting crack pipe vending machines and their objectives, there are several ways you can do so. Some of these ways are:

    -
      -
    • You can educate yourself and others about the facts and evidence behind crack pipe vending machines and harm reduction in general.
    • -
    • You can advocate for the legalization and regulation of crack pipe vending machines and other harm reduction interventions at the local, national, or international level.
    • -
    • You can donate money or resources to the organizations and groups that operate or support crack pipe vending machines and other harm reduction services.
    • -
    • You can volunteer your time or skills to the organizations and groups that operate or support crack pipe vending machines and other harm reduction services.
    • -
    -What are the Ethical Issues of Crack Pipe Vending Machines? -

    Crack pipe vending machines raise some ethical issues and dilemmas that need to be considered and addressed. Some of these ethical issues are:

    -
      -
    • They may conflict with the moral values or beliefs of some individuals or groups who consider crack use to be wrong or sinful.
    • -
    • They may challenge the legal norms or regulations of some jurisdictions or countries who prohibit or criminalize crack use or possession.
    • -
    • They may create a moral hazard or a perverse incentive for some users or potential users who may perceive crack use to be less risky or more acceptable.
    • -
    • They may infringe on the autonomy or dignity of some users or potential users who may feel coerced or pressured to use crack or to access other services.
    • -
    • They may compromise the privacy or confidentiality of some users or potential users who may be identified or tracked by the vending machines or by other parties.
    • -
    -How to Conclude Crack Pipe Vending Machine Vice Definition? -

    To conclude, crack pipe vending machine vice definition is a term that refers to the practice of providing crack users with access to clean and affordable pipes through vending machines. It is part of a harm reduction approach that aims to reduce the health and social risks associated with crack use. However, it is also controversial and often misunderstood by the public and the media. In this article, we have explained the crack pipe vending machine vice definition, the reasons behind it, and the benefits and challenges of implementing it. We have also discussed the reactions, evaluations, prospects, and ethical issues of crack pipe vending machines. We hope that this article has helped you to understand this topic better and to form your own opinion about it.

    -Conclusion -

    Crack pipe vending machines are devices that dispense clean and cheap pipes for smoking crack cocaine. They are part of a harm reduction approach that aims to reduce the health and social risks associated with crack use. However, they are also controversial and often misunderstood by the public and the media. In this article, we have explained the crack pipe vending machine vice definition, the reasons behind it, and the benefits and challenges of implementing it. We have also discussed the reactions, evaluations, prospects, and ethical issues of crack pipe vending machines. We hope that this article has helped you to understand this topic better and to form your own opinion about it.

    3cee63e6c2
    -
    -
    \ No newline at end of file diff --git a/spaces/recenWmenso/ChatGPT-with-Voice-Cloning-for-All/datasets/Crysis 3 DX10 Fix.rar Size 2.69 MB 4shared.md b/spaces/recenWmenso/ChatGPT-with-Voice-Cloning-for-All/datasets/Crysis 3 DX10 Fix.rar Size 2.69 MB 4shared.md deleted file mode 100644 index d7d0b1f7f610d4b9a12ef39357f6c13f034d7808..0000000000000000000000000000000000000000 --- a/spaces/recenWmenso/ChatGPT-with-Voice-Cloning-for-All/datasets/Crysis 3 DX10 Fix.rar Size 2.69 MB 4shared.md +++ /dev/null @@ -1,17 +0,0 @@ -
    -

    How to Download and Install Crysis 3 DX10 Fix.rar for Free

    -

    Crysis 3 is a first-person shooter game developed by Crytek and published by Electronic Arts in 2013. The game is set in a post-apocalyptic New York City, where the player controls a soldier named Prophet who wears a nanosuit that grants him enhanced abilities. The game features stunning graphics and realistic physics, but it also requires a high-end computer system to run smoothly.

    -

    One of the requirements for playing Crysis 3 is having a DirectX 11 compatible graphics card. However, some players who have older or lower-end graphics cards that only support DirectX 10 have found a way to bypass this limitation and play the game on their machines. This is done by downloading and installing a file called Crysis 3 DX10 Fix.rar, which is a modified version of the game's executable file that allows it to run on DirectX 10.

    -

    Crysis 3 DX10 Fix.rar Size 2.69 MB 4shared


    Download Filehttps://urlgoal.com/2uCN3z



    -

    Crysis 3 DX10 Fix.rar is a small file that has a size of only 2.69 MB. It can be downloaded from various file-sharing websites, such as 4shared. However, downloading and installing this file is not without risks. Some sources may contain viruses or malware that can harm your computer or steal your personal information. Moreover, using this file may violate the game's terms of service and result in legal consequences.

    -

    Therefore, before you decide to download and install Crysis 3 DX10 Fix.rar, you should be aware of the potential dangers and drawbacks of doing so. You should also make sure that you have a backup of your original game files in case something goes wrong. If you still want to proceed, here are the steps to follow:

    -
      -
    1. Go to one of the websites that offer Crysis 3 DX10 Fix.rar for download, such as https://crysis-3-dx10-fixrar-size-269-mb-4shared-26.peatix.com/ [^1^] or https://trello.com/c/1YwFXpvg/58-professional-crysis-3-dx10-fix-rar-size-269-mb-4shared-download-patch-activator-rar-pc [^2^]. Be careful not to click on any ads or pop-ups that may appear on these sites.
    2. -
    3. Click on the download button or link and wait for the file to be downloaded to your computer. You may need to enter a captcha code or complete a survey to access the file.
    4. -
    5. Once the file is downloaded, extract it using a program like WinRAR or 7-Zip. You should see a file named Crysis3.exe inside the extracted folder.
    6. -
    7. Copy this file and paste it into your Crysis 3 installation folder, which is usually located at C:\Program Files (x86)\Electronic Arts\Crytek\Crysis 3\Bin32. Replace the existing Crysis3.exe file with the new one.
    8. -
    9. Run the game as usual and enjoy playing it on DirectX 10.
    10. -
    -

    Note: This method may not work for everyone and may cause some glitches or errors in the game. It may also affect your online multiplayer experience and prevent you from accessing some features or updates. Use it at your own risk and discretion.

    d5da3c52bf
    -
    -
    \ No newline at end of file diff --git a/spaces/recenWmenso/ChatGPT-with-Voice-Cloning-for-All/datasets/Download Shadow Of The Colossus Pc Full Version LINK.md b/spaces/recenWmenso/ChatGPT-with-Voice-Cloning-for-All/datasets/Download Shadow Of The Colossus Pc Full Version LINK.md deleted file mode 100644 index 090ba115f647ef3e2fec7610ab88e9d3cf4510a4..0000000000000000000000000000000000000000 --- a/spaces/recenWmenso/ChatGPT-with-Voice-Cloning-for-All/datasets/Download Shadow Of The Colossus Pc Full Version LINK.md +++ /dev/null @@ -1,6 +0,0 @@ -

    download shadow of the colossus pc full version


    Download File 🆓 https://urlgoal.com/2uCLSo



    -
    -Shadow of the colossus is full action game. it is a single player and ... With Crack| Free Download Setup OF Game| Download Fully PC Games| ... 1fdad05405
    -
    -
    -

    diff --git a/spaces/robmarkcole/yolov5-ui/README.md b/spaces/robmarkcole/yolov5-ui/README.md deleted file mode 100644 index 2424e3b4991498ac7338ce7985f521bf55674f4e..0000000000000000000000000000000000000000 --- a/spaces/robmarkcole/yolov5-ui/README.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -title: Yolov5 Ui -emoji: 🌖 -colorFrom: blue -colorTo: blue -sdk: streamlit -sdk_version: 1.15.2 -app_file: app.py -pinned: false -license: apache-2.0 ---- - -Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference diff --git a/spaces/rockeycoss/Prompt-Segment-Anything-Demo/mmdet/datasets/__init__.py b/spaces/rockeycoss/Prompt-Segment-Anything-Demo/mmdet/datasets/__init__.py deleted file mode 100644 index 46c49fd42c112a0d9058d6e9da9eecbcb1a475e7..0000000000000000000000000000000000000000 --- a/spaces/rockeycoss/Prompt-Segment-Anything-Demo/mmdet/datasets/__init__.py +++ /dev/null @@ -1,31 +0,0 @@ -# Copyright (c) OpenMMLab. All rights reserved. -from .builder import DATASETS, PIPELINES, build_dataloader, build_dataset -from .cityscapes import CityscapesDataset -from .coco import CocoDataset -from .coco_occluded import OccludedSeparatedCocoDataset -from .coco_panoptic import CocoPanopticDataset -from .custom import CustomDataset -from .dataset_wrappers import (ClassBalancedDataset, ConcatDataset, - MultiImageMixDataset, RepeatDataset) -from .deepfashion import DeepFashionDataset -from .lvis import LVISDataset, LVISV1Dataset, LVISV05Dataset -from .objects365 import Objects365V1Dataset, Objects365V2Dataset -from .openimages import OpenImagesChallengeDataset, OpenImagesDataset -from .samplers import DistributedGroupSampler, DistributedSampler, GroupSampler -from .utils import (NumClassCheckHook, get_loading_pipeline, - replace_ImageToTensor) -from .voc import VOCDataset -from .wider_face import WIDERFaceDataset -from .xml_style import XMLDataset - -__all__ = [ - 'CustomDataset', 'XMLDataset', 'CocoDataset', 'DeepFashionDataset', - 'VOCDataset', 'CityscapesDataset', 'LVISDataset', 'LVISV05Dataset', - 'LVISV1Dataset', 'GroupSampler', 'DistributedGroupSampler', - 'DistributedSampler', 'build_dataloader', 'ConcatDataset', 'RepeatDataset', - 'ClassBalancedDataset', 'WIDERFaceDataset', 'DATASETS', 'PIPELINES', - 'build_dataset', 'replace_ImageToTensor', 'get_loading_pipeline', - 'NumClassCheckHook', 'CocoPanopticDataset', 'MultiImageMixDataset', - 'OpenImagesDataset', 'OpenImagesChallengeDataset', 'Objects365V1Dataset', - 'Objects365V2Dataset', 'OccludedSeparatedCocoDataset' -] diff --git a/spaces/rorallitri/biomedical-language-models/logs/Algebra de Lovaglia PDF 11 Un recurso indispensable para el aprendizaje del lgebra.md b/spaces/rorallitri/biomedical-language-models/logs/Algebra de Lovaglia PDF 11 Un recurso indispensable para el aprendizaje del lgebra.md deleted file mode 100644 index 32d3577906462f36f12cbaf72767a35244bad584..0000000000000000000000000000000000000000 --- a/spaces/rorallitri/biomedical-language-models/logs/Algebra de Lovaglia PDF 11 Un recurso indispensable para el aprendizaje del lgebra.md +++ /dev/null @@ -1,6 +0,0 @@ -

    algebra de lovaglia pdf 11


    Download File === https://tinurll.com/2uznGX



    -
    - aaccfb2cb3
    -
    -
    -

    diff --git a/spaces/rorallitri/biomedical-language-models/logs/Boylove Imageboard Felixxx.md b/spaces/rorallitri/biomedical-language-models/logs/Boylove Imageboard Felixxx.md deleted file mode 100644 index 95cb726d3daff2e73938b7afd153442d0874211d..0000000000000000000000000000000000000000 --- a/spaces/rorallitri/biomedical-language-models/logs/Boylove Imageboard Felixxx.md +++ /dev/null @@ -1,6 +0,0 @@ -

    boylove imageboard felixxx


    Download Filehttps://tinurll.com/2uznCZ



    - - aaccfb2cb3
    -
    -
    -

    diff --git a/spaces/scedlatioru/img-to-music/example/Download PORTABLE TeraBIT Virus Maker.md b/spaces/scedlatioru/img-to-music/example/Download PORTABLE TeraBIT Virus Maker.md deleted file mode 100644 index bb3c230691bb68964659022d3fd0ca04a028f525..0000000000000000000000000000000000000000 --- a/spaces/scedlatioru/img-to-music/example/Download PORTABLE TeraBIT Virus Maker.md +++ /dev/null @@ -1,6 +0,0 @@ -

    Download TeraBIT virus Maker


    Downloadhttps://gohhs.com/2uEzpw



    -
    -Also you can find here terabit virus maker 2.8 download human papilloma virus of. 1fdad05405
    -
    -
    -

    diff --git a/spaces/scedlatioru/img-to-music/example/Wic Reset Keygen Download Filehippo.md b/spaces/scedlatioru/img-to-music/example/Wic Reset Keygen Download Filehippo.md deleted file mode 100644 index 821097ad50b7275bc9ce28e6429e92b236f71c06..0000000000000000000000000000000000000000 --- a/spaces/scedlatioru/img-to-music/example/Wic Reset Keygen Download Filehippo.md +++ /dev/null @@ -1,15 +0,0 @@ -

    Wic Reset Keygen Download Filehippo


    Download ••• https://gohhs.com/2uEA0g



    - -November 7, 2561 Buddhist time - Epson L-380 reset program, free download, Epson reset key, Epson L380 WIC tool, Epson L380 adjustment program , Download Epson L485 resetter, Free download Epson l380 resetter with keygen. Reset Epson l380 free download. Epson L 380 Driver Windows 7 64 Download. -Description: Driver version 2.3.0.0 for Epson L380 Multifunction Printer. -Reset utility. -Free Download Program To Burn Music To Disc In Russian. -Epson L3.80 (L3. -60): Printer diaper reset - Duration: 0:59. -I dropped the diaper on the Epson L132 printer. -Reset diaper on Epson L132 printer - Duration: 4:20. -Installing the driver in manual mode: download / unpack. -You can find the diaper reset program at http:// Epson L380. 8a78ff9644
    -
    -
    -

    diff --git a/spaces/segments-tobias/conex/espnet2/asr/encoder/wav2vec2_encoder.py b/spaces/segments-tobias/conex/espnet2/asr/encoder/wav2vec2_encoder.py deleted file mode 100644 index c0a9e6d6e8932885db7d85052a5c2dce552fa8e4..0000000000000000000000000000000000000000 --- a/spaces/segments-tobias/conex/espnet2/asr/encoder/wav2vec2_encoder.py +++ /dev/null @@ -1,165 +0,0 @@ -# Copyright 2021 Xuankai Chang -# Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) - -"""Encoder definition.""" -import contextlib -import copy -from filelock import FileLock -import logging -import os -from typing import Optional -from typing import Tuple - -import torch -from typeguard import check_argument_types - -from espnet.nets.pytorch_backend.nets_utils import make_pad_mask -from espnet.nets.pytorch_backend.transformer.layer_norm import LayerNorm -from espnet2.asr.encoder.abs_encoder import AbsEncoder - - -class FairSeqWav2Vec2Encoder(AbsEncoder): - """FairSeq Wav2Vec2 encoder module. - - Args: - input_size: input dim - output_size: dimension of attention - w2v_url: url to Wav2Vec2.0 pretrained model - w2v_dir_path: directory to download the Wav2Vec2.0 pretrained model. - normalize_before: whether to use layer_norm before the first block - finetune_last_n_layers: last n layers to be finetuned in Wav2Vec2.0 - 0 means to finetune every layer if freeze_w2v=False. - """ - - def __init__( - self, - input_size: int, - w2v_url: str, - w2v_dir_path: str = "./", - output_size: int = 256, - normalize_before: bool = False, - freeze_finetune_updates: int = 0, - ): - assert check_argument_types() - super().__init__() - - if w2v_url != "": - try: - import fairseq - from fairseq.models.wav2vec.wav2vec2 import Wav2Vec2Model - except Exception as e: - print("Error: FairSeq is not properly installed.") - print( - "Please install FairSeq: cd ${MAIN_ROOT}/tools && make fairseq.done" - ) - raise e - - self.w2v_model_path = download_w2v(w2v_url, w2v_dir_path) - - self._output_size = output_size - - models, _, _ = fairseq.checkpoint_utils.load_model_ensemble_and_task( - [self.w2v_model_path], - arg_overrides={"data": w2v_dir_path}, - ) - model = models[0] - - if not isinstance(model, Wav2Vec2Model): - try: - model = model.w2v_encoder.w2v_model - except Exception as e: - print( - "Error: pretrained models should be within: " - "'Wav2Vec2Model, Wav2VecCTC' classes, etc." - ) - raise e - - self.encoders = model - - self.pretrained_params = copy.deepcopy(model.state_dict()) - - self.normalize_before = normalize_before - if self.normalize_before: - self.after_norm = LayerNorm(output_size) - - if model.cfg.encoder_embed_dim != output_size: - # TODO(xkc09): try LSTM - self.output_layer = torch.nn.Sequential( - torch.nn.Linear(model.cfg.encoder_embed_dim, output_size), - ) - else: - self.output_layer = None - - self.freeze_finetune_updates = freeze_finetune_updates - self.register_buffer("num_updates", torch.LongTensor([0])) - - def output_size(self) -> int: - return self._output_size - - def forward( - self, - xs_pad: torch.Tensor, - ilens: torch.Tensor, - prev_states: torch.Tensor = None, - ) -> Tuple[torch.Tensor, torch.Tensor, Optional[torch.Tensor]]: - """Forward FairSeqWav2Vec2 Encoder. - - Args: - xs_pad: input tensor (B, L, D) - ilens: input length (B) - prev_states: Not to be used now. - Returns: - position embedded tensor and mask - """ - masks = make_pad_mask(ilens).to(xs_pad.device) - - ft = self.freeze_finetune_updates <= self.num_updates - if self.num_updates <= self.freeze_finetune_updates: - self.num_updates += 1 - elif ft and self.num_updates == self.freeze_finetune_updates + 1: - self.num_updates += 1 - logging.info("Start fine-tuning wav2vec parameters!") - - with torch.no_grad() if not ft else contextlib.nullcontext(): - enc_outputs = self.encoders( - xs_pad, - masks, - features_only=True, - ) - - xs_pad = enc_outputs["x"] # (B,T,C), - masks = enc_outputs["padding_mask"] # (B, T) - - olens = (~masks).sum(dim=1) - - if self.output_layer is not None: - xs_pad = self.output_layer(xs_pad) - - if self.normalize_before: - xs_pad = self.after_norm(xs_pad) - - return xs_pad, olens, None - - def reload_pretrained_parameters(self): - self.encoders.load_state_dict(self.pretrained_params) - logging.info("Pretrained Wav2Vec model parameters reloaded!") - - -def download_w2v(model_url, dir_path): - os.makedirs(dir_path, exist_ok=True) - - model_name = model_url.split("/")[-1] - model_path = os.path.join(dir_path, model_name) - - dict_url = "https://dl.fbaipublicfiles.com/fairseq/wav2vec/dict.ltr.txt" - dict_path = os.path.join(dir_path, dict_url.split("/")[-1]) - - with FileLock(model_path + ".lock"): - if not os.path.exists(model_path): - torch.hub.download_url_to_file(model_url, model_path) - torch.hub.download_url_to_file(dict_url, dict_path) - logging.info(f"Wav2Vec model downloaded {model_path}") - else: - logging.info(f"Wav2Vec model {model_path} already exists.") - - return model_path diff --git a/spaces/segments/panoptic-segment-anything-api/GroundingDINO/groundingdino/util/get_tokenlizer.py b/spaces/segments/panoptic-segment-anything-api/GroundingDINO/groundingdino/util/get_tokenlizer.py deleted file mode 100644 index f7dcf7e95f03f95b20546b26442a94225924618b..0000000000000000000000000000000000000000 --- a/spaces/segments/panoptic-segment-anything-api/GroundingDINO/groundingdino/util/get_tokenlizer.py +++ /dev/null @@ -1,26 +0,0 @@ -from transformers import AutoTokenizer, BertModel, BertTokenizer, RobertaModel, RobertaTokenizerFast - - -def get_tokenlizer(text_encoder_type): - if not isinstance(text_encoder_type, str): - # print("text_encoder_type is not a str") - if hasattr(text_encoder_type, "text_encoder_type"): - text_encoder_type = text_encoder_type.text_encoder_type - elif text_encoder_type.get("text_encoder_type", False): - text_encoder_type = text_encoder_type.get("text_encoder_type") - else: - raise ValueError( - "Unknown type of text_encoder_type: {}".format(type(text_encoder_type)) - ) - print("final text_encoder_type: {}".format(text_encoder_type)) - - tokenizer = AutoTokenizer.from_pretrained(text_encoder_type) - return tokenizer - - -def get_pretrained_language_model(text_encoder_type): - if text_encoder_type == "bert-base-uncased": - return BertModel.from_pretrained(text_encoder_type) - if text_encoder_type == "roberta-base": - return RobertaModel.from_pretrained(text_encoder_type) - raise ValueError("Unknown text_encoder_type {}".format(text_encoder_type)) diff --git a/spaces/shaocongma/faiss_chat/knowledge/__init__.py b/spaces/shaocongma/faiss_chat/knowledge/__init__.py deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/spaces/shelby/scan_rotation_app/app.py b/spaces/shelby/scan_rotation_app/app.py deleted file mode 100644 index 734b855e27c4efc7fd8fd7e1ad9b7f48b187ad47..0000000000000000000000000000000000000000 --- a/spaces/shelby/scan_rotation_app/app.py +++ /dev/null @@ -1,27 +0,0 @@ -import gradio as gr -import tensorflow as tf -import numpy as np -from PIL import Image - - -model = tf.keras.models.load_model('my_model.h5') -labels = ["No rotated","Rotared to left","Upside down","Rotared to right"] -sample_images = [["0.jpeg"],["90.jpeg"],["180.jpeg"],["270.jpeg"]] -def classify_image(inp): - - inp = tf.keras.preprocessing.image.load_img(inp.name, target_size=(90,90)) - img_array = tf.keras.preprocessing.image.img_to_array(inp) - a_file = open("gradio.txt", "w") - for row in img_array: - np.savetxt(a_file, row) - a_file.close() - img_array = tf.expand_dims(inp, 0) # Create a batch - prediction = model.predict(img_array) - score = tf.nn.softmax(prediction[0]) - - return {labels[np.argmax(score)]:1 * np.max(score) for i in range(4)} - -image = gr.inputs.Image(type="file", invert_colors=False) -label = gr.outputs.Label(num_top_classes=1) - -gr.Interface(fn=classify_image, inputs=image, examples = sample_images, outputs=label, allow_flagging=None, title="Scan rotation app", theme="dark").launch() \ No newline at end of file diff --git a/spaces/shenfangqi/Retrieval-based-Voice-Conversion-WebUI/infer_uvr5.py b/spaces/shenfangqi/Retrieval-based-Voice-Conversion-WebUI/infer_uvr5.py deleted file mode 100644 index 4aada2dc204281de2e20ff8f353294bfaa5953bf..0000000000000000000000000000000000000000 --- a/spaces/shenfangqi/Retrieval-based-Voice-Conversion-WebUI/infer_uvr5.py +++ /dev/null @@ -1,175 +0,0 @@ -import os, sys, torch, warnings, pdb - -warnings.filterwarnings("ignore") -import librosa -import importlib -import numpy as np -import hashlib, math -from tqdm import tqdm -from uvr5_pack.lib_v5 import spec_utils -from uvr5_pack.utils import _get_name_params, inference -from uvr5_pack.lib_v5.model_param_init import ModelParameters -from scipy.io import wavfile - - -class _audio_pre_: - def __init__(self, agg, model_path, device, is_half): - self.model_path = model_path - self.device = device - self.data = { - # Processing Options - "postprocess": False, - "tta": False, - # Constants - "window_size": 512, - "agg": agg, - "high_end_process": "mirroring", - } - nn_arch_sizes = [ - 31191, # default - 33966, - 61968, - 123821, - 123812, - 537238, # custom - ] - self.nn_architecture = list("{}KB".format(s) for s in nn_arch_sizes) - model_size = math.ceil(os.stat(model_path).st_size / 1024) - nn_architecture = "{}KB".format( - min(nn_arch_sizes, key=lambda x: abs(x - model_size)) - ) - nets = importlib.import_module( - "uvr5_pack.lib_v5.nets" - + f"_{nn_architecture}".replace("_{}KB".format(nn_arch_sizes[0]), ""), - package=None, - ) - model_hash = hashlib.md5(open(model_path, "rb").read()).hexdigest() - param_name, model_params_d = _get_name_params(model_path, model_hash) - - mp = ModelParameters(model_params_d) - model = nets.CascadedASPPNet(mp.param["bins"] * 2) - cpk = torch.load(model_path, map_location="cpu") - model.load_state_dict(cpk) - model.eval() - if is_half: - model = model.half().to(device) - else: - model = model.to(device) - - self.mp = mp - self.model = model - - def _path_audio_(self, music_file, ins_root=None, vocal_root=None): - if ins_root is None and vocal_root is None: - return "No save root." - name = os.path.basename(music_file) - if ins_root is not None: - os.makedirs(ins_root, exist_ok=True) - if vocal_root is not None: - os.makedirs(vocal_root, exist_ok=True) - X_wave, y_wave, X_spec_s, y_spec_s = {}, {}, {}, {} - bands_n = len(self.mp.param["band"]) - # print(bands_n) - for d in range(bands_n, 0, -1): - bp = self.mp.param["band"][d] - if d == bands_n: # high-end band - ( - X_wave[d], - _, - ) = librosa.core.load( # 理论上librosa读取可能对某些音频有bug,应该上ffmpeg读取,但是太麻烦了弃坑 - music_file, - bp["sr"], - False, - dtype=np.float32, - res_type=bp["res_type"], - ) - if X_wave[d].ndim == 1: - X_wave[d] = np.asfortranarray([X_wave[d], X_wave[d]]) - else: # lower bands - X_wave[d] = librosa.core.resample( - X_wave[d + 1], - self.mp.param["band"][d + 1]["sr"], - bp["sr"], - res_type=bp["res_type"], - ) - # Stft of wave source - X_spec_s[d] = spec_utils.wave_to_spectrogram_mt( - X_wave[d], - bp["hl"], - bp["n_fft"], - self.mp.param["mid_side"], - self.mp.param["mid_side_b2"], - self.mp.param["reverse"], - ) - # pdb.set_trace() - if d == bands_n and self.data["high_end_process"] != "none": - input_high_end_h = (bp["n_fft"] // 2 - bp["crop_stop"]) + ( - self.mp.param["pre_filter_stop"] - self.mp.param["pre_filter_start"] - ) - input_high_end = X_spec_s[d][ - :, bp["n_fft"] // 2 - input_high_end_h : bp["n_fft"] // 2, : - ] - - X_spec_m = spec_utils.combine_spectrograms(X_spec_s, self.mp) - aggresive_set = float(self.data["agg"] / 100) - aggressiveness = { - "value": aggresive_set, - "split_bin": self.mp.param["band"][1]["crop_stop"], - } - with torch.no_grad(): - pred, X_mag, X_phase = inference( - X_spec_m, self.device, self.model, aggressiveness, self.data - ) - # Postprocess - if self.data["postprocess"]: - pred_inv = np.clip(X_mag - pred, 0, np.inf) - pred = spec_utils.mask_silence(pred, pred_inv) - y_spec_m = pred * X_phase - v_spec_m = X_spec_m - y_spec_m - - if ins_root is not None: - if self.data["high_end_process"].startswith("mirroring"): - input_high_end_ = spec_utils.mirroring( - self.data["high_end_process"], y_spec_m, input_high_end, self.mp - ) - wav_instrument = spec_utils.cmb_spectrogram_to_wave( - y_spec_m, self.mp, input_high_end_h, input_high_end_ - ) - else: - wav_instrument = spec_utils.cmb_spectrogram_to_wave(y_spec_m, self.mp) - print("%s instruments done" % name) - wavfile.write( - os.path.join( - ins_root, "instrument_{}_{}.wav".format(name, self.data["agg"]) - ), - self.mp.param["sr"], - (np.array(wav_instrument) * 32768).astype("int16"), - ) # - if vocal_root is not None: - if self.data["high_end_process"].startswith("mirroring"): - input_high_end_ = spec_utils.mirroring( - self.data["high_end_process"], v_spec_m, input_high_end, self.mp - ) - wav_vocals = spec_utils.cmb_spectrogram_to_wave( - v_spec_m, self.mp, input_high_end_h, input_high_end_ - ) - else: - wav_vocals = spec_utils.cmb_spectrogram_to_wave(v_spec_m, self.mp) - print("%s vocals done" % name) - wavfile.write( - os.path.join( - vocal_root, "vocal_{}_{}.wav".format(name, self.data["agg"]) - ), - self.mp.param["sr"], - (np.array(wav_vocals) * 32768).astype("int16"), - ) - - -if __name__ == "__main__": - device = "cuda" - is_half = True - model_path = "uvr5_weights/2_HP-UVR.pth" - pre_fun = _audio_pre_(model_path=model_path, device=device, is_half=True) - audio_path = "神女劈观.aac" - save_path = "opt" - pre_fun._path_audio_(audio_path, save_path, save_path) diff --git a/spaces/shezanbaig/myLlama2/README.md b/spaces/shezanbaig/myLlama2/README.md deleted file mode 100644 index 19bc778084383d4c258060b92e28b6598c16eab2..0000000000000000000000000000000000000000 --- a/spaces/shezanbaig/myLlama2/README.md +++ /dev/null @@ -1,12 +0,0 @@ ---- -title: AutoTrain Advanced -emoji: 🚀 -colorFrom: blue -colorTo: green -sdk: docker -pinned: false -duplicated_from: autotrain-projects/autotrain-advanced -license: openrail ---- - -Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference diff --git a/spaces/shgao/EditAnything/utils/texutal_inversion.py b/spaces/shgao/EditAnything/utils/texutal_inversion.py deleted file mode 100644 index f232ed6b1e20d6d3419232960397f2066a1e8838..0000000000000000000000000000000000000000 --- a/spaces/shgao/EditAnything/utils/texutal_inversion.py +++ /dev/null @@ -1,959 +0,0 @@ -#!/usr/bin/env python -# coding=utf-8 -# Copyright 2023 The HuggingFace Inc. team. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and - -import argparse -import logging -import math -import os -import random -import shutil -import warnings -from pathlib import Path - -import numpy as np -import PIL -import torch -import torch.nn.functional as F -import torch.utils.checkpoint -import transformers -from accelerate import Accelerator -from accelerate.logging import get_logger -from accelerate.utils import ProjectConfiguration, set_seed -from huggingface_hub import create_repo, upload_folder - -# TODO: remove and import from diffusers.utils when the new version of diffusers is released -from packaging import version -from PIL import Image -from torch.utils.data import Dataset -from torchvision import transforms -from tqdm.auto import tqdm -from transformers import CLIPTextModel, CLIPTokenizer - -import diffusers -from diffusers import ( - AutoencoderKL, - DDPMScheduler, - DiffusionPipeline, - DPMSolverMultistepScheduler, - StableDiffusionPipeline, - UNet2DConditionModel, -) -from diffusers.optimization import get_scheduler -from diffusers.utils import check_min_version, is_wandb_available -from diffusers.utils.import_utils import is_xformers_available - - -if is_wandb_available(): - import wandb - -if version.parse(version.parse(PIL.__version__).base_version) >= version.parse("9.1.0"): - PIL_INTERPOLATION = { - "linear": PIL.Image.Resampling.BILINEAR, - "bilinear": PIL.Image.Resampling.BILINEAR, - "bicubic": PIL.Image.Resampling.BICUBIC, - "lanczos": PIL.Image.Resampling.LANCZOS, - "nearest": PIL.Image.Resampling.NEAREST, - } -else: - PIL_INTERPOLATION = { - "linear": PIL.Image.LINEAR, - "bilinear": PIL.Image.BILINEAR, - "bicubic": PIL.Image.BICUBIC, - "lanczos": PIL.Image.LANCZOS, - "nearest": PIL.Image.NEAREST, - } -# ------------------------------------------------------------------------------ - - -# Will error if the minimal version of diffusers is not installed. Remove at your own risks. -# check_min_version("0.18.0.dev0") - -logger = get_logger(__name__) - - -def save_model_card(repo_id: str, images=None, base_model=str, repo_folder=None): - img_str = "" - for i, image in enumerate(images): - image.save(os.path.join(repo_folder, f"image_{i}.png")) - img_str += f"![img_{i}](./image_{i}.png)\n" - - yaml = f""" ---- -license: creativeml-openrail-m -base_model: {base_model} -tags: -- stable-diffusion -- stable-diffusion-diffusers -- text-to-image -- diffusers -- textual_inversion -inference: true ---- - """ - model_card = f""" -# Textual inversion text2image fine-tuning - {repo_id} -These are textual inversion adaption weights for {base_model}. You can find some example images in the following. \n -{img_str} -""" - with open(os.path.join(repo_folder, "README.md"), "w") as f: - f.write(yaml + model_card) - - -def log_validation(text_encoder, tokenizer, unet, vae, args, accelerator, weight_dtype, epoch): - logger.info( - f"Running validation... \n Generating {args.num_validation_images} images with prompt:" - f" {args.validation_prompt}." - ) - # create pipeline (note: unet and vae are loaded again in float32) - pipeline = DiffusionPipeline.from_pretrained( - args.pretrained_model_name_or_path, - text_encoder=accelerator.unwrap_model(text_encoder), - tokenizer=tokenizer, - unet=unet, - vae=vae, - safety_checker=None, - revision=args.revision, - torch_dtype=weight_dtype, - ) - pipeline.scheduler = DPMSolverMultistepScheduler.from_config(pipeline.scheduler.config) - pipeline = pipeline.to(accelerator.device) - pipeline.set_progress_bar_config(disable=True) - - # run inference - generator = None if args.seed is None else torch.Generator(device=accelerator.device).manual_seed(args.seed) - images = [] - for _ in range(args.num_validation_images): - with torch.autocast("cuda"): - image = pipeline(args.validation_prompt, num_inference_steps=25, generator=generator).images[0] - images.append(image) - - for tracker in accelerator.trackers: - if tracker.name == "tensorboard": - np_images = np.stack([np.asarray(img) for img in images]) - tracker.writer.add_images("validation", np_images, epoch, dataformats="NHWC") - if tracker.name == "wandb": - tracker.log( - { - "validation": [ - wandb.Image(image, caption=f"{i}: {args.validation_prompt}") for i, image in enumerate(images) - ] - } - ) - - del pipeline - torch.cuda.empty_cache() - return images - - -def save_progress(text_encoder, placeholder_token_ids, accelerator, args, save_path): - logger.info("Saving embeddings") - learned_embeds = ( - accelerator.unwrap_model(text_encoder) - .get_input_embeddings() - .weight[min(placeholder_token_ids) : max(placeholder_token_ids) + 1] - ) - learned_embeds_dict = {args.placeholder_token: learned_embeds.detach().cpu()} - torch.save(learned_embeds_dict, save_path) - - -def parse_args(): - parser = argparse.ArgumentParser(description="Simple example of a training script.") - parser.add_argument( - "--save_steps", - type=int, - default=500, - help="Save learned_embeds.bin every X updates steps.", - ) - parser.add_argument( - "--save_as_full_pipeline", - action="store_true", - help="Save the complete stable diffusion pipeline.", - ) - parser.add_argument( - "--num_vectors", - type=int, - default=1, - help="How many textual inversion vectors shall be used to learn the concept.", - ) - parser.add_argument( - "--pretrained_model_name_or_path", - type=str, - default=None, - required=True, - help="Path to pretrained model or model identifier from huggingface.co/models.", - ) - parser.add_argument( - "--revision", - type=str, - default=None, - required=False, - help="Revision of pretrained model identifier from huggingface.co/models.", - ) - parser.add_argument( - "--tokenizer_name", - type=str, - default=None, - help="Pretrained tokenizer name or path if not the same as model_name", - ) - parser.add_argument( - "--train_data_dir", type=str, default=None, required=True, help="A folder containing the training data." - ) - parser.add_argument( - "--placeholder_token", - type=str, - default=None, - required=True, - help="A token to use as a placeholder for the concept.", - ) - parser.add_argument( - "--initializer_token", type=str, default=None, required=True, help="A token to use as initializer word." - ) - parser.add_argument("--learnable_property", type=str, default="object", help="Choose between 'object' and 'style'") - parser.add_argument("--repeats", type=int, default=100, help="How many times to repeat the training data.") - parser.add_argument( - "--output_dir", - type=str, - default="text-inversion-model", - help="The output directory where the model predictions and checkpoints will be written.", - ) - parser.add_argument("--seed", type=int, default=None, help="A seed for reproducible training.") - parser.add_argument( - "--resolution", - type=int, - default=512, - help=( - "The resolution for input images, all the images in the train/validation dataset will be resized to this" - " resolution" - ), - ) - parser.add_argument( - "--center_crop", action="store_true", help="Whether to center crop images before resizing to resolution." - ) - parser.add_argument( - "--train_batch_size", type=int, default=16, help="Batch size (per device) for the training dataloader." - ) - parser.add_argument("--num_train_epochs", type=int, default=100) - parser.add_argument( - "--max_train_steps", - type=int, - default=5000, - help="Total number of training steps to perform. If provided, overrides num_train_epochs.", - ) - parser.add_argument( - "--gradient_accumulation_steps", - type=int, - default=1, - help="Number of updates steps to accumulate before performing a backward/update pass.", - ) - parser.add_argument( - "--gradient_checkpointing", - action="store_true", - help="Whether or not to use gradient checkpointing to save memory at the expense of slower backward pass.", - ) - parser.add_argument( - "--learning_rate", - type=float, - default=1e-4, - help="Initial learning rate (after the potential warmup period) to use.", - ) - parser.add_argument( - "--scale_lr", - action="store_true", - default=False, - help="Scale the learning rate by the number of GPUs, gradient accumulation steps, and batch size.", - ) - parser.add_argument( - "--lr_scheduler", - type=str, - default="constant", - help=( - 'The scheduler type to use. Choose between ["linear", "cosine", "cosine_with_restarts", "polynomial",' - ' "constant", "constant_with_warmup"]' - ), - ) - parser.add_argument( - "--lr_warmup_steps", type=int, default=500, help="Number of steps for the warmup in the lr scheduler." - ) - parser.add_argument( - "--lr_num_cycles", - type=int, - default=1, - help="Number of hard resets of the lr in cosine_with_restarts scheduler.", - ) - parser.add_argument( - "--dataloader_num_workers", - type=int, - default=0, - help=( - "Number of subprocesses to use for data loading. 0 means that the data will be loaded in the main process." - ), - ) - parser.add_argument("--adam_beta1", type=float, default=0.9, help="The beta1 parameter for the Adam optimizer.") - parser.add_argument("--adam_beta2", type=float, default=0.999, help="The beta2 parameter for the Adam optimizer.") - parser.add_argument("--adam_weight_decay", type=float, default=1e-2, help="Weight decay to use.") - parser.add_argument("--adam_epsilon", type=float, default=1e-08, help="Epsilon value for the Adam optimizer") - parser.add_argument("--push_to_hub", action="store_true", help="Whether or not to push the model to the Hub.") - parser.add_argument("--hub_token", type=str, default=None, help="The token to use to push to the Model Hub.") - parser.add_argument( - "--hub_model_id", - type=str, - default=None, - help="The name of the repository to keep in sync with the local `output_dir`.", - ) - parser.add_argument( - "--logging_dir", - type=str, - default="logs", - help=( - "[TensorBoard](https://www.tensorflow.org/tensorboard) log directory. Will default to" - " *output_dir/runs/**CURRENT_DATETIME_HOSTNAME***." - ), - ) - parser.add_argument( - "--mixed_precision", - type=str, - default="no", - choices=["no", "fp16", "bf16"], - help=( - "Whether to use mixed precision. Choose" - "between fp16 and bf16 (bfloat16). Bf16 requires PyTorch >= 1.10." - "and an Nvidia Ampere GPU." - ), - ) - parser.add_argument( - "--allow_tf32", - action="store_true", - help=( - "Whether or not to allow TF32 on Ampere GPUs. Can be used to speed up training. For more information, see" - " https://pytorch.org/docs/stable/notes/cuda.html#tensorfloat-32-tf32-on-ampere-devices" - ), - ) - parser.add_argument( - "--report_to", - type=str, - default="tensorboard", - help=( - 'The integration to report the results and logs to. Supported platforms are `"tensorboard"`' - ' (default), `"wandb"` and `"comet_ml"`. Use `"all"` to report to all integrations.' - ), - ) - parser.add_argument( - "--validation_prompt", - type=str, - default=None, - help="A prompt that is used during validation to verify that the model is learning.", - ) - parser.add_argument( - "--num_validation_images", - type=int, - default=4, - help="Number of images that should be generated during validation with `validation_prompt`.", - ) - parser.add_argument( - "--validation_steps", - type=int, - default=100, - help=( - "Run validation every X steps. Validation consists of running the prompt" - " `args.validation_prompt` multiple times: `args.num_validation_images`" - " and logging the images." - ), - ) - parser.add_argument( - "--validation_epochs", - type=int, - default=None, - help=( - "Deprecated in favor of validation_steps. Run validation every X epochs. Validation consists of running the prompt" - " `args.validation_prompt` multiple times: `args.num_validation_images`" - " and logging the images." - ), - ) - parser.add_argument("--local_rank", type=int, default=-1, help="For distributed training: local_rank") - parser.add_argument( - "--checkpointing_steps", - type=int, - default=500, - help=( - "Save a checkpoint of the training state every X updates. These checkpoints are only suitable for resuming" - " training using `--resume_from_checkpoint`." - ), - ) - parser.add_argument( - "--checkpoints_total_limit", - type=int, - default=None, - help=("Max number of checkpoints to store."), - ) - parser.add_argument( - "--resume_from_checkpoint", - type=str, - default=None, - help=( - "Whether training should be resumed from a previous checkpoint. Use a path saved by" - ' `--checkpointing_steps`, or `"latest"` to automatically select the last available checkpoint.' - ), - ) - parser.add_argument( - "--enable_xformers_memory_efficient_attention", action="store_true", help="Whether or not to use xformers." - ) - - args = parser.parse_args() - env_local_rank = int(os.environ.get("LOCAL_RANK", -1)) - if env_local_rank != -1 and env_local_rank != args.local_rank: - args.local_rank = env_local_rank - - if args.train_data_dir is None: - raise ValueError("You must specify a train data directory.") - - return args - - -imagenet_templates_small = [ - "a photo of a {}", - "a rendering of a {}", - "a cropped photo of the {}", - "the photo of a {}", - "a photo of a clean {}", - "a photo of a dirty {}", - "a dark photo of the {}", - "a photo of my {}", - "a photo of the cool {}", - "a close-up photo of a {}", - "a bright photo of the {}", - "a cropped photo of a {}", - "a photo of the {}", - "a good photo of the {}", - "a photo of one {}", - "a close-up photo of the {}", - "a rendition of the {}", - "a photo of the clean {}", - "a rendition of a {}", - "a photo of a nice {}", - "a good photo of a {}", - "a photo of the nice {}", - "a photo of the small {}", - "a photo of the weird {}", - "a photo of the large {}", - "a photo of a cool {}", - "a photo of a small {}", -] - -imagenet_style_templates_small = [ - "a painting in the style of {}", - "a rendering in the style of {}", - "a cropped painting in the style of {}", - "the painting in the style of {}", - "a clean painting in the style of {}", - "a dirty painting in the style of {}", - "a dark painting in the style of {}", - "a picture in the style of {}", - "a cool painting in the style of {}", - "a close-up painting in the style of {}", - "a bright painting in the style of {}", - "a cropped painting in the style of {}", - "a good painting in the style of {}", - "a close-up painting in the style of {}", - "a rendition in the style of {}", - "a nice painting in the style of {}", - "a small painting in the style of {}", - "a weird painting in the style of {}", - "a large painting in the style of {}", -] - - -class TextualInversionDataset(Dataset): - def __init__( - self, - data_root, - tokenizer, - learnable_property="object", # [object, style] - size=512, - repeats=100, - interpolation="bicubic", - flip_p=0.5, - set="train", - placeholder_token="*", - center_crop=False, - ): - self.data_root = data_root - self.tokenizer = tokenizer - self.learnable_property = learnable_property - self.size = size - self.placeholder_token = placeholder_token - self.center_crop = center_crop - self.flip_p = flip_p - - self.image_paths = [os.path.join(self.data_root, file_path) for file_path in os.listdir(self.data_root)] - - self.num_images = len(self.image_paths) - self._length = self.num_images - - if set == "train": - self._length = self.num_images * repeats - - self.interpolation = { - "linear": PIL_INTERPOLATION["linear"], - "bilinear": PIL_INTERPOLATION["bilinear"], - "bicubic": PIL_INTERPOLATION["bicubic"], - "lanczos": PIL_INTERPOLATION["lanczos"], - }[interpolation] - - self.templates = imagenet_style_templates_small if learnable_property == "style" else imagenet_templates_small - self.flip_transform = transforms.RandomHorizontalFlip(p=self.flip_p) - - def __len__(self): - return self._length - - def __getitem__(self, i): - example = {} - image = Image.open(self.image_paths[i % self.num_images]) - - if not image.mode == "RGB": - image = image.convert("RGB") - - placeholder_string = self.placeholder_token - text = random.choice(self.templates).format(placeholder_string) - - example["input_ids"] = self.tokenizer( - text, - padding="max_length", - truncation=True, - max_length=self.tokenizer.model_max_length, - return_tensors="pt", - ).input_ids[0] - - # default to score-sde preprocessing - img = np.array(image).astype(np.uint8) - - if self.center_crop: - crop = min(img.shape[0], img.shape[1]) - ( - h, - w, - ) = ( - img.shape[0], - img.shape[1], - ) - img = img[(h - crop) // 2 : (h + crop) // 2, (w - crop) // 2 : (w + crop) // 2] - - image = Image.fromarray(img) - image = image.resize((self.size, self.size), resample=self.interpolation) - - image = self.flip_transform(image) - image = np.array(image).astype(np.uint8) - image = (image / 127.5 - 1.0).astype(np.float32) - - example["pixel_values"] = torch.from_numpy(image).permute(2, 0, 1) - return example - - -def main(): - args = parse_args() - logging_dir = os.path.join(args.output_dir, args.logging_dir) - accelerator_project_config = ProjectConfiguration(project_dir=args.output_dir, logging_dir=logging_dir) - accelerator = Accelerator( - gradient_accumulation_steps=args.gradient_accumulation_steps, - mixed_precision=args.mixed_precision, - log_with=args.report_to, - project_config=accelerator_project_config, - ) - - if args.report_to == "wandb": - if not is_wandb_available(): - raise ImportError("Make sure to install wandb if you want to use it for logging during training.") - - # Make one log on every process with the configuration for debugging. - logging.basicConfig( - format="%(asctime)s - %(levelname)s - %(name)s - %(message)s", - datefmt="%m/%d/%Y %H:%M:%S", - level=logging.INFO, - ) - logger.info(accelerator.state, main_process_only=False) - if accelerator.is_local_main_process: - transformers.utils.logging.set_verbosity_warning() - diffusers.utils.logging.set_verbosity_info() - else: - transformers.utils.logging.set_verbosity_error() - diffusers.utils.logging.set_verbosity_error() - - # If passed along, set the training seed now. - if args.seed is not None: - set_seed(args.seed) - - # Handle the repository creation - if accelerator.is_main_process: - if args.output_dir is not None: - os.makedirs(args.output_dir, exist_ok=True) - - if args.push_to_hub: - repo_id = create_repo( - repo_id=args.hub_model_id or Path(args.output_dir).name, exist_ok=True, token=args.hub_token - ).repo_id - - # Load tokenizer - if args.tokenizer_name: - tokenizer = CLIPTokenizer.from_pretrained(args.tokenizer_name) - elif args.pretrained_model_name_or_path: - tokenizer = CLIPTokenizer.from_pretrained(args.pretrained_model_name_or_path, subfolder="tokenizer") - - # Load scheduler and models - noise_scheduler = DDPMScheduler.from_pretrained(args.pretrained_model_name_or_path, subfolder="scheduler") - text_encoder = CLIPTextModel.from_pretrained( - args.pretrained_model_name_or_path, subfolder="text_encoder", revision=args.revision - ) - vae = AutoencoderKL.from_pretrained(args.pretrained_model_name_or_path, subfolder="vae", revision=args.revision) - unet = UNet2DConditionModel.from_pretrained( - args.pretrained_model_name_or_path, subfolder="unet", revision=args.revision - ) - - # Add the placeholder token in tokenizer - placeholder_tokens = [args.placeholder_token] - - if args.num_vectors < 1: - raise ValueError(f"--num_vectors has to be larger or equal to 1, but is {args.num_vectors}") - - # add dummy tokens for multi-vector - additional_tokens = [] - for i in range(1, args.num_vectors): - additional_tokens.append(f"{args.placeholder_token}_{i}") - placeholder_tokens += additional_tokens - - num_added_tokens = tokenizer.add_tokens(placeholder_tokens) - if num_added_tokens != args.num_vectors: - raise ValueError( - f"The tokenizer already contains the token {args.placeholder_token}. Please pass a different" - " `placeholder_token` that is not already in the tokenizer." - ) - - # Convert the initializer_token, placeholder_token to ids - token_ids = tokenizer.encode(args.initializer_token, add_special_tokens=False) - # Check if initializer_token is a single token or a sequence of tokens - if len(token_ids) > 1: - raise ValueError("The initializer token must be a single token.") - - initializer_token_id = token_ids[0] - placeholder_token_ids = tokenizer.convert_tokens_to_ids(placeholder_tokens) - - # Resize the token embeddings as we are adding new special tokens to the tokenizer - text_encoder.resize_token_embeddings(len(tokenizer)) - - # Initialise the newly added placeholder token with the embeddings of the initializer token - token_embeds = text_encoder.get_input_embeddings().weight.data - with torch.no_grad(): - for token_id in placeholder_token_ids: - token_embeds[token_id] = token_embeds[initializer_token_id].clone() - - # Freeze vae and unet - vae.requires_grad_(False) - unet.requires_grad_(False) - # Freeze all parameters except for the token embeddings in text encoder - text_encoder.text_model.encoder.requires_grad_(False) - text_encoder.text_model.final_layer_norm.requires_grad_(False) - text_encoder.text_model.embeddings.position_embedding.requires_grad_(False) - - if args.gradient_checkpointing: - # Keep unet in train mode if we are using gradient checkpointing to save memory. - # The dropout cannot be != 0 so it doesn't matter if we are in eval or train mode. - unet.train() - text_encoder.gradient_checkpointing_enable() - unet.enable_gradient_checkpointing() - - if args.enable_xformers_memory_efficient_attention: - if is_xformers_available(): - import xformers - - xformers_version = version.parse(xformers.__version__) - if xformers_version == version.parse("0.0.16"): - logger.warn( - "xFormers 0.0.16 cannot be used for training in some GPUs. If you observe problems during training, please update xFormers to at least 0.0.17. See https://huggingface.co/docs/diffusers/main/en/optimization/xformers for more details." - ) - unet.enable_xformers_memory_efficient_attention() - else: - raise ValueError("xformers is not available. Make sure it is installed correctly") - - # Enable TF32 for faster training on Ampere GPUs, - # cf https://pytorch.org/docs/stable/notes/cuda.html#tensorfloat-32-tf32-on-ampere-devices - if args.allow_tf32: - torch.backends.cuda.matmul.allow_tf32 = True - - if args.scale_lr: - args.learning_rate = ( - args.learning_rate * args.gradient_accumulation_steps * args.train_batch_size * accelerator.num_processes - ) - - # Initialize the optimizer - optimizer = torch.optim.AdamW( - text_encoder.get_input_embeddings().parameters(), # only optimize the embeddings - lr=args.learning_rate, - betas=(args.adam_beta1, args.adam_beta2), - weight_decay=args.adam_weight_decay, - eps=args.adam_epsilon, - ) - - # Dataset and DataLoaders creation: - train_dataset = TextualInversionDataset( - data_root=args.train_data_dir, - tokenizer=tokenizer, - size=args.resolution, - placeholder_token=args.placeholder_token, - repeats=args.repeats, - learnable_property=args.learnable_property, - center_crop=args.center_crop, - set="train", - ) - train_dataloader = torch.utils.data.DataLoader( - train_dataset, batch_size=args.train_batch_size, shuffle=True, num_workers=args.dataloader_num_workers - ) - if args.validation_epochs is not None: - warnings.warn( - f"FutureWarning: You are doing logging with validation_epochs={args.validation_epochs}." - " Deprecated validation_epochs in favor of `validation_steps`" - f"Setting `args.validation_steps` to {args.validation_epochs * len(train_dataset)}", - FutureWarning, - stacklevel=2, - ) - args.validation_steps = args.validation_epochs * len(train_dataset) - - # Scheduler and math around the number of training steps. - overrode_max_train_steps = False - num_update_steps_per_epoch = math.ceil(len(train_dataloader) / args.gradient_accumulation_steps) - if args.max_train_steps is None: - args.max_train_steps = args.num_train_epochs * num_update_steps_per_epoch - overrode_max_train_steps = True - - lr_scheduler = get_scheduler( - args.lr_scheduler, - optimizer=optimizer, - num_warmup_steps=args.lr_warmup_steps * args.gradient_accumulation_steps, - num_training_steps=args.max_train_steps * args.gradient_accumulation_steps, - num_cycles=args.lr_num_cycles * args.gradient_accumulation_steps, - ) - - # Prepare everything with our `accelerator`. - text_encoder, optimizer, train_dataloader, lr_scheduler = accelerator.prepare( - text_encoder, optimizer, train_dataloader, lr_scheduler - ) - - # For mixed precision training we cast all non-trainable weigths (vae, non-lora text_encoder and non-lora unet) to half-precision - # as these weights are only used for inference, keeping weights in full precision is not required. - weight_dtype = torch.float32 - if accelerator.mixed_precision == "fp16": - weight_dtype = torch.float16 - elif accelerator.mixed_precision == "bf16": - weight_dtype = torch.bfloat16 - - # Move vae and unet to device and cast to weight_dtype - unet.to(accelerator.device, dtype=weight_dtype) - vae.to(accelerator.device, dtype=weight_dtype) - - # We need to recalculate our total training steps as the size of the training dataloader may have changed. - num_update_steps_per_epoch = math.ceil(len(train_dataloader) / args.gradient_accumulation_steps) - if overrode_max_train_steps: - args.max_train_steps = args.num_train_epochs * num_update_steps_per_epoch - # Afterwards we recalculate our number of training epochs - args.num_train_epochs = math.ceil(args.max_train_steps / num_update_steps_per_epoch) - - # We need to initialize the trackers we use, and also store our configuration. - # The trackers initializes automatically on the main process. - if accelerator.is_main_process: - accelerator.init_trackers("textual_inversion", config=vars(args)) - - # Train! - total_batch_size = args.train_batch_size * accelerator.num_processes * args.gradient_accumulation_steps - - logger.info("***** Running training *****") - logger.info(f" Num examples = {len(train_dataset)}") - logger.info(f" Num Epochs = {args.num_train_epochs}") - logger.info(f" Instantaneous batch size per device = {args.train_batch_size}") - logger.info(f" Total train batch size (w. parallel, distributed & accumulation) = {total_batch_size}") - logger.info(f" Gradient Accumulation steps = {args.gradient_accumulation_steps}") - logger.info(f" Total optimization steps = {args.max_train_steps}") - global_step = 0 - first_epoch = 0 - # Potentially load in the weights and states from a previous save - if args.resume_from_checkpoint: - if args.resume_from_checkpoint != "latest": - path = os.path.basename(args.resume_from_checkpoint) - else: - # Get the most recent checkpoint - dirs = os.listdir(args.output_dir) - dirs = [d for d in dirs if d.startswith("checkpoint")] - dirs = sorted(dirs, key=lambda x: int(x.split("-")[1])) - path = dirs[-1] if len(dirs) > 0 else None - - if path is None: - accelerator.print( - f"Checkpoint '{args.resume_from_checkpoint}' does not exist. Starting a new training run." - ) - args.resume_from_checkpoint = None - else: - accelerator.print(f"Resuming from checkpoint {path}") - accelerator.load_state(os.path.join(args.output_dir, path)) - global_step = int(path.split("-")[1]) - - resume_global_step = global_step * args.gradient_accumulation_steps - first_epoch = global_step // num_update_steps_per_epoch - resume_step = resume_global_step % (num_update_steps_per_epoch * args.gradient_accumulation_steps) - - # Only show the progress bar once on each machine. - progress_bar = tqdm(range(global_step, args.max_train_steps), disable=not accelerator.is_local_main_process) - progress_bar.set_description("Steps") - - # keep original embeddings as reference - orig_embeds_params = accelerator.unwrap_model(text_encoder).get_input_embeddings().weight.data.clone() - - for epoch in range(first_epoch, args.num_train_epochs): - text_encoder.train() - for step, batch in enumerate(train_dataloader): - # Skip steps until we reach the resumed step - if args.resume_from_checkpoint and epoch == first_epoch and step < resume_step: - if step % args.gradient_accumulation_steps == 0: - progress_bar.update(1) - continue - - with accelerator.accumulate(text_encoder): - # Convert images to latent space - latents = vae.encode(batch["pixel_values"].to(dtype=weight_dtype)).latent_dist.sample().detach() - latents = latents * vae.config.scaling_factor - - # Sample noise that we'll add to the latents - noise = torch.randn_like(latents) - bsz = latents.shape[0] - # Sample a random timestep for each image - timesteps = torch.randint(0, noise_scheduler.config.num_train_timesteps, (bsz,), device=latents.device) - timesteps = timesteps.long() - - # Add noise to the latents according to the noise magnitude at each timestep - # (this is the forward diffusion process) - noisy_latents = noise_scheduler.add_noise(latents, noise, timesteps) - - # Get the text embedding for conditioning - encoder_hidden_states = text_encoder(batch["input_ids"])[0].to(dtype=weight_dtype) - - # Predict the noise residual - model_pred = unet(noisy_latents, timesteps, encoder_hidden_states).sample - - # Get the target for loss depending on the prediction type - if noise_scheduler.config.prediction_type == "epsilon": - target = noise - elif noise_scheduler.config.prediction_type == "v_prediction": - target = noise_scheduler.get_velocity(latents, noise, timesteps) - else: - raise ValueError(f"Unknown prediction type {noise_scheduler.config.prediction_type}") - - loss = F.mse_loss(model_pred.float(), target.float(), reduction="mean") - - accelerator.backward(loss) - - optimizer.step() - lr_scheduler.step() - optimizer.zero_grad() - - # Let's make sure we don't update any embedding weights besides the newly added token - index_no_updates = torch.ones((len(tokenizer),), dtype=torch.bool) - index_no_updates[min(placeholder_token_ids) : max(placeholder_token_ids) + 1] = False - - with torch.no_grad(): - accelerator.unwrap_model(text_encoder).get_input_embeddings().weight[ - index_no_updates - ] = orig_embeds_params[index_no_updates] - - # Checks if the accelerator has performed an optimization step behind the scenes - if accelerator.sync_gradients: - images = [] - progress_bar.update(1) - global_step += 1 - if global_step % args.save_steps == 0: - save_path = os.path.join(args.output_dir, f"learned_embeds-steps-{global_step}.bin") - save_progress(text_encoder, placeholder_token_ids, accelerator, args, save_path) - - if accelerator.is_main_process: - if global_step % args.checkpointing_steps == 0: - # _before_ saving state, check if this save would set us over the `checkpoints_total_limit` - if args.checkpoints_total_limit is not None: - checkpoints = os.listdir(args.output_dir) - checkpoints = [d for d in checkpoints if d.startswith("checkpoint")] - checkpoints = sorted(checkpoints, key=lambda x: int(x.split("-")[1])) - - # before we save the new checkpoint, we need to have at _most_ `checkpoints_total_limit - 1` checkpoints - if len(checkpoints) >= args.checkpoints_total_limit: - num_to_remove = len(checkpoints) - args.checkpoints_total_limit + 1 - removing_checkpoints = checkpoints[0:num_to_remove] - - logger.info( - f"{len(checkpoints)} checkpoints already exist, removing {len(removing_checkpoints)} checkpoints" - ) - logger.info(f"removing checkpoints: {', '.join(removing_checkpoints)}") - - for removing_checkpoint in removing_checkpoints: - removing_checkpoint = os.path.join(args.output_dir, removing_checkpoint) - shutil.rmtree(removing_checkpoint) - - save_path = os.path.join(args.output_dir, f"checkpoint-{global_step}") - accelerator.save_state(save_path) - logger.info(f"Saved state to {save_path}") - - if args.validation_prompt is not None and global_step % args.validation_steps == 0: - images = log_validation( - text_encoder, tokenizer, unet, vae, args, accelerator, weight_dtype, epoch - ) - - logs = {"loss": loss.detach().item(), "lr": lr_scheduler.get_last_lr()[0]} - progress_bar.set_postfix(**logs) - accelerator.log(logs, step=global_step) - - if global_step >= args.max_train_steps: - break - # Create the pipeline using the trained modules and save it. - accelerator.wait_for_everyone() - if accelerator.is_main_process: - if args.push_to_hub and not args.save_as_full_pipeline: - logger.warn("Enabling full model saving because --push_to_hub=True was specified.") - save_full_model = True - else: - save_full_model = args.save_as_full_pipeline - if save_full_model: - pipeline = StableDiffusionPipeline.from_pretrained( - args.pretrained_model_name_or_path, - text_encoder=accelerator.unwrap_model(text_encoder), - vae=vae, - unet=unet, - tokenizer=tokenizer, - ) - pipeline.save_pretrained(args.output_dir) - # Save the newly trained embeddings - save_path = os.path.join(args.output_dir, "learned_embeds.bin") - save_progress(text_encoder, placeholder_token_ids, accelerator, args, save_path) - - if args.push_to_hub: - save_model_card( - repo_id, - images=images, - base_model=args.pretrained_model_name_or_path, - repo_folder=args.output_dir, - ) - upload_folder( - repo_id=repo_id, - folder_path=args.output_dir, - commit_message="End of training", - ignore_patterns=["step_*", "epoch_*"], - ) - - accelerator.end_training() - - -if __name__ == "__main__": - main() \ No newline at end of file diff --git a/spaces/shi-labs/Versatile-Diffusion/lib/model_zoo/optimus_models/optimus_gpt2.py b/spaces/shi-labs/Versatile-Diffusion/lib/model_zoo/optimus_models/optimus_gpt2.py deleted file mode 100644 index dc96784f053086f8e48dda1ede262c9870464fdb..0000000000000000000000000000000000000000 --- a/spaces/shi-labs/Versatile-Diffusion/lib/model_zoo/optimus_models/optimus_gpt2.py +++ /dev/null @@ -1,1122 +0,0 @@ -# coding=utf-8 -# Copyright 2018 The OpenAI Team Authors and HuggingFace Inc. team. -# Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -"""PyTorch OpenAI GPT-2 model.""" - -from __future__ import absolute_import, division, print_function, unicode_literals - -import pdb - -import collections -import json -import logging -import math -import os -import sys -from io import open - -import torch -import torch.nn as nn -from torch.nn import CrossEntropyLoss -from torch.nn.parameter import Parameter - -from .modeling_utils import PreTrainedModel, Conv1D, prune_conv1d_layer, SequenceSummary -from .configuration_gpt2 import GPT2Config -from .file_utils import add_start_docstrings - -logger = logging.getLogger(__name__) - -GPT2_PRETRAINED_MODEL_ARCHIVE_MAP = {"gpt2": "https://s3.amazonaws.com/models.huggingface.co/bert/gpt2-pytorch_model.bin", - "gpt2-medium": "https://s3.amazonaws.com/models.huggingface.co/bert/gpt2-medium-pytorch_model.bin", - "gpt2-large": "https://s3.amazonaws.com/models.huggingface.co/bert/gpt2-large-pytorch_model.bin"} - -def load_tf_weights_in_gpt2(model, config, gpt2_checkpoint_path): - """ Load tf checkpoints in a pytorch model - """ - try: - import re - import numpy as np - import tensorflow as tf - except ImportError: - logger.error("Loading a TensorFlow model in PyTorch, requires TensorFlow to be installed. Please see " - "https://www.tensorflow.org/install/ for installation instructions.") - raise - tf_path = os.path.abspath(gpt2_checkpoint_path) - logger.info("Converting TensorFlow checkpoint from {}".format(tf_path)) - # Load weights from TF model - init_vars = tf.train.list_variables(tf_path) - names = [] - arrays = [] - for name, shape in init_vars: - logger.info("Loading TF weight {} with shape {}".format(name, shape)) - array = tf.train.load_variable(tf_path, name) - names.append(name) - arrays.append(array.squeeze()) - - for name, array in zip(names, arrays): - name = name[6:] # skip "model/" - name = name.split('/') - pointer = model - for m_name in name: - if re.fullmatch(r'[A-Za-z]+\d+', m_name): - l = re.split(r'(\d+)', m_name) - else: - l = [m_name] - if l[0] == 'w' or l[0] == 'g': - pointer = getattr(pointer, 'weight') - elif l[0] == 'b': - pointer = getattr(pointer, 'bias') - elif l[0] == 'wpe' or l[0] == 'wte': - pointer = getattr(pointer, l[0]) - pointer = getattr(pointer, 'weight') - else: - pointer = getattr(pointer, l[0]) - if len(l) >= 2: - num = int(l[1]) - pointer = pointer[num] - try: - assert pointer.shape == array.shape - except AssertionError as e: - e.args += (pointer.shape, array.shape) - raise - logger.info("Initialize PyTorch weight {}".format(name)) - pointer.data = torch.from_numpy(array) - return model - - -def gelu(x): - return 0.5 * x * (1 + torch.tanh(math.sqrt(2 / math.pi) * (x + 0.044715 * torch.pow(x, 3)))) - - -class Attention(nn.Module): - def __init__(self, nx, n_ctx, config, scale=False): - super(Attention, self).__init__() - self.output_attentions = config.output_attentions - - n_state = nx # in Attention: n_state=768 (nx=n_embd) - # [switch nx => n_state from Block to Attention to keep identical to TF implem] - assert n_state % config.n_head == 0 - self.register_buffer("bias", torch.tril(torch.ones(n_ctx, n_ctx)).view(1, 1, n_ctx, n_ctx)) - self.n_head = config.n_head - self.split_size = n_state - self.scale = scale - - self.c_attn = Conv1D(n_state * 3, nx) - self.c_proj = Conv1D(n_state, nx) - self.attn_dropout = nn.Dropout(config.attn_pdrop) - self.resid_dropout = nn.Dropout(config.resid_pdrop) - self.pruned_heads = set() - - def prune_heads(self, heads): - if len(heads) == 0: - return - mask = torch.ones(self.n_head, self.split_size // self.n_head) - heads = set(heads) - self.pruned_heads # Convert to set and emove already pruned heads - for head in heads: - # Compute how many pruned heads are before the head and move the index accordingly - head = head - sum(1 if h < head else 0 for h in self.pruned_heads) - mask[head] = 0 - mask = mask.view(-1).contiguous().eq(1) - index = torch.arange(len(mask))[mask].long() - index_attn = torch.cat([index, index + self.split_size, index + (2*self.split_size)]) - - # Prune conv1d layers - self.c_attn = prune_conv1d_layer(self.c_attn, index_attn, dim=1) - self.c_proj = prune_conv1d_layer(self.c_proj, index, dim=0) - - # Update hyper params - self.split_size = (self.split_size // self.n_head) * (self.n_head - len(heads)) - self.n_head = self.n_head - len(heads) - self.pruned_heads = self.pruned_heads.union(heads) - - def _attn(self, q, k, v, attention_mask=None, head_mask=None): - w = torch.matmul(q, k) - if self.scale: - w = w / math.sqrt(v.size(-1)) - nd, ns = w.size(-2), w.size(-1) - b = self.bias[:, :, ns-nd:ns, :ns] - w = w * b - 1e4 * (1 - b) - - if attention_mask is not None: - # Apply the attention mask - w = w + attention_mask - - w = nn.Softmax(dim=-1)(w) - w = self.attn_dropout(w) - - # Mask heads if we want to - if head_mask is not None: - w = w * head_mask - - outputs = [torch.matmul(w, v)] - if self.output_attentions: - outputs.append(w) - return outputs - - def merge_heads(self, x): - x = x.permute(0, 2, 1, 3).contiguous() - new_x_shape = x.size()[:-2] + (x.size(-2) * x.size(-1),) - return x.view(*new_x_shape) # in Tensorflow implem: fct merge_states - - def split_heads(self, x, k=False): - new_x_shape = x.size()[:-1] + (self.n_head, x.size(-1) // self.n_head) - x = x.view(*new_x_shape) # in Tensorflow implem: fct split_states - if k: - return x.permute(0, 2, 3, 1) # (batch, head, head_features, seq_length) - else: - return x.permute(0, 2, 1, 3) # (batch, head, seq_length, head_features) - - def forward(self, x, layer_past=None, attention_mask=None, head_mask=None): - x = self.c_attn(x) - query, key, value = x.split(self.split_size, dim=2) - query = self.split_heads(query) - key = self.split_heads(key, k=True) - value = self.split_heads(value) - - - if layer_past is not None: - past_key, past_value = layer_past[0], layer_past[1] # transpose back cf below - - past_key = self.split_heads(past_key, k=True) - past_value = self.split_heads(past_value) - # pdb.set_trace() - key = torch.cat((past_key, key), dim=-1) - value = torch.cat((past_value, value), dim=-2) - present = torch.stack((key.transpose(-2, -1), value)) # transpose to have same shapes for stacking - - attn_outputs = self._attn(query, key, value, attention_mask, head_mask) - a = attn_outputs[0] - - a = self.merge_heads(a) - a = self.c_proj(a) - a = self.resid_dropout(a) - - outputs = [a, present] + attn_outputs[1:] - return outputs # a, present, (attentions) - - -class MLP(nn.Module): - def __init__(self, n_state, config): # in MLP: n_state=3072 (4 * n_embd) - super(MLP, self).__init__() - nx = config.n_embd - self.c_fc = Conv1D(n_state, nx) - self.c_proj = Conv1D(nx, n_state) - self.act = gelu - self.dropout = nn.Dropout(config.resid_pdrop) - - def forward(self, x): - h = self.act(self.c_fc(x)) - h2 = self.c_proj(h) - return self.dropout(h2) - - -class Block(nn.Module): - def __init__(self, n_ctx, config, scale=False): - super(Block, self).__init__() - nx = config.n_embd - self.ln_1 = nn.LayerNorm(nx, eps=config.layer_norm_epsilon) - self.attn = Attention(nx, n_ctx, config, scale) - self.ln_2 = nn.LayerNorm(nx, eps=config.layer_norm_epsilon) - self.mlp = MLP(4 * nx, config) - - def forward(self, x, layer_past=None, attention_mask=None, head_mask=None): - output_attn = self.attn(self.ln_1(x), - layer_past=layer_past, - attention_mask=attention_mask, - head_mask=head_mask) - a = output_attn[0] # output_attn: a, present, (attentions) - - x = x + a - m = self.mlp(self.ln_2(x)) - x = x + m - - outputs = [x] + output_attn[1:] - return outputs # x, present, (attentions) - - -class GPT2PreTrainedModel(PreTrainedModel): - """ An abstract class to handle weights initialization and - a simple interface for dowloading and loading pretrained models. - """ - config_class = GPT2Config - pretrained_model_archive_map = GPT2_PRETRAINED_MODEL_ARCHIVE_MAP - load_tf_weights = load_tf_weights_in_gpt2 - base_model_prefix = "transformer" - - def __init__(self, *inputs, **kwargs): - super(GPT2PreTrainedModel, self).__init__(*inputs, **kwargs) - - def _init_weights(self, module): - """ Initialize the weights. - """ - if isinstance(module, (nn.Linear, nn.Embedding, Conv1D)): - # Slightly different from the TF version which uses truncated_normal for initialization - # cf https://github.com/pytorch/pytorch/pull/5617 - module.weight.data.normal_(mean=0.0, std=self.config.initializer_range) - if isinstance(module, (nn.Linear, Conv1D)) and module.bias is not None: - module.bias.data.zero_() - elif isinstance(module, nn.LayerNorm): - module.bias.data.zero_() - module.weight.data.fill_(1.0) - - -GPT2_START_DOCSTRING = r""" OpenAI GPT-2 model was proposed in - `Language Models are Unsupervised Multitask Learners`_ - by Alec Radford*, Jeffrey Wu*, Rewon Child, David Luan, Dario Amodei** and Ilya Sutskever**. - It's a causal (unidirectional) transformer pre-trained using language modeling on a very large - corpus of ~40 GB of text data. - - This model is a PyTorch `torch.nn.Module`_ sub-class. Use it as a regular PyTorch Module and - refer to the PyTorch documentation for all matter related to general usage and behavior. - - .. _`Language Models are Unsupervised Multitask Learners`: - https://openai.com/blog/better-language-models/ - - .. _`torch.nn.Module`: - https://pytorch.org/docs/stable/nn.html#module - - Parameters: - config (:class:`~pytorch_transformers.GPT2Config`): Model configuration class with all the parameters of the model. - Initializing with a config file does not load the weights associated with the model, only the configuration. - Check out the :meth:`~pytorch_transformers.PreTrainedModel.from_pretrained` method to load the model weights. -""" - -GPT2_INPUTS_DOCSTRING = r""" Inputs: - **input_ids**: ``torch.LongTensor`` of shape ``(batch_size, sequence_length)``: - Indices of input sequence tokens in the vocabulary. - GPT-2 is a model with absolute position embeddings so it's usually advised to pad the inputs on - the right rather than the left. - Indices can be obtained using :class:`pytorch_transformers.GPT2Tokenizer`. - See :func:`pytorch_transformers.PreTrainedTokenizer.encode` and - :func:`pytorch_transformers.PreTrainedTokenizer.convert_tokens_to_ids` for details. - **past**: - list of ``torch.FloatTensor`` (one for each layer): - that contains pre-computed hidden-states (key and values in the attention blocks) as computed by the model - (see `past` output below). Can be used to speed up sequential decoding. - **attention_mask**: (`optional`) ``torch.FloatTensor`` of shape ``(batch_size, sequence_length)``: - Mask to avoid performing attention on padding token indices. - Mask values selected in ``[0, 1]``: - ``1`` for tokens that are NOT MASKED, ``0`` for MASKED tokens. - **token_type_ids**: (`optional`) ``torch.LongTensor`` of shape ``(batch_size, sequence_length)``: - A parallel sequence of tokens (can be used to indicate various portions of the inputs). - The embeddings from these tokens will be summed with the respective token embeddings. - Indices are selected in the vocabulary (unlike BERT which has a specific vocabulary for segment indices). - **position_ids**: (`optional`) ``torch.LongTensor`` of shape ``(batch_size, sequence_length)``: - Indices of positions of each input sequence tokens in the position embeddings. - Selected in the range ``[0, config.max_position_embeddings - 1]``. - **head_mask**: (`optional`) ``torch.FloatTensor`` of shape ``(num_heads,)`` or ``(num_layers, num_heads)``: - Mask to nullify selected heads of the self-attention modules. - Mask values selected in ``[0, 1]``: - ``1`` indicates the head is **not masked**, ``0`` indicates the head is **masked**. -""" - -@add_start_docstrings("The bare GPT2 Model transformer outputting raw hidden-states without any specific head on top.", - GPT2_START_DOCSTRING, GPT2_INPUTS_DOCSTRING) -class GPT2Model(GPT2PreTrainedModel): - r""" - Outputs: `Tuple` comprising various elements depending on the configuration (config) and inputs: - **last_hidden_state**: ``torch.FloatTensor`` of shape ``(batch_size, sequence_length, hidden_size)`` - Sequence of hidden-states at the last layer of the model. - **past**: - list of ``torch.FloatTensor`` (one for each layer) of shape ``(batch_size, num_heads, sequence_length, sequence_length)``: - that contains pre-computed hidden-states (key and values in the attention blocks). - Can be used (see `past` input) to speed up sequential decoding. - **hidden_states**: (`optional`, returned when ``config.output_hidden_states=True``) - list of ``torch.FloatTensor`` (one for the output of each layer + the output of the embeddings) - of shape ``(batch_size, sequence_length, hidden_size)``: - Hidden-states of the model at the output of each layer plus the initial embedding outputs. - **attentions**: (`optional`, returned when ``config.output_attentions=True``) - list of ``torch.FloatTensor`` (one for each layer) of shape ``(batch_size, num_heads, sequence_length, sequence_length)``: - Attentions weights after the attention softmax, used to compute the weighted average in the self-attention heads. - - Examples:: - - tokenizer = GPT2Tokenizer.from_pretrained('gpt2') - model = GPT2Model.from_pretrained('gpt2') - input_ids = torch.tensor(tokenizer.encode("Hello, my dog is cute")).unsqueeze(0) # Batch size 1 - outputs = model(input_ids) - last_hidden_states = outputs[0] # The last hidden-state is the first element of the output tuple - - """ - def __init__(self, config): - super(GPT2Model, self).__init__(config) - self.output_hidden_states = config.output_hidden_states - self.output_attentions = config.output_attentions - - self.wte = nn.Embedding(config.vocab_size, config.n_embd) - self.wpe = nn.Embedding(config.n_positions, config.n_embd) - self.drop = nn.Dropout(config.embd_pdrop) - self.h = nn.ModuleList([Block(config.n_ctx, config, scale=True) for _ in range(config.n_layer)]) - self.ln_f = nn.LayerNorm(config.n_embd, eps=config.layer_norm_epsilon) - - try: - self.latent_size = config.latent_size - except: - self.latent_size = 32 # default size is 32 - - self.linear = nn.Linear(self.latent_size, config.hidden_size * config.n_layer, bias=False) # different latent vector for each layer - self.linear_emb = nn.Linear(self.latent_size, config.hidden_size, bias=False) # share the same latent vector as the embeddings - - self.config = config - self.init_weights() - - def _resize_token_embeddings(self, new_num_tokens): - self.wte = self._get_resized_embeddings(self.wte, new_num_tokens) - return self.wte - - def _prune_heads(self, heads_to_prune): - """ Prunes heads of the model. - heads_to_prune: dict of {layer_num: list of heads to prune in this layer} - """ - for layer, heads in heads_to_prune.items(): - self.h[layer].attn.prune_heads(heads) - - def forward(self, input_ids, past=None, attention_mask=None, token_type_ids=None, position_ids=None, head_mask=None, latent_as_gpt_emb=False, latent_as_gpt_memory=True): - - if past is None: - past_length = 0 - past = [None] * len(self.h) - else: - - - if latent_as_gpt_emb: - past_emb = self.linear_emb(past) # used as embeddings to add on other three embeddings - - if latent_as_gpt_memory: - past = self.linear(past) - share_latent = False - if share_latent: - # the same latent vector shared by all layers - past = [past.unsqueeze(-2), past.unsqueeze(-2)] # query, key - past = [past] * len(self.h) - past_length = past[0][0].size(-2) - else: - # different latent vectors for each layer - past_split = torch.split(past.unsqueeze(1), self.config.hidden_size, dim=2) - past = list(zip(past_split,past_split)) - - # past = past.view(batch_size,len(self.h),-1) - # past = [[past[:,i,:].unsqueeze(-2), past[:,i,:].unsqueeze(-2) ] for i in range(len(self.h))] - past_length = 1 # past[0][0].size(-2) - else: - past_length = 0 - past = [None] * len(self.h) - - - if position_ids is None: - position_ids = torch.arange(past_length, input_ids.size(-1) + past_length, dtype=torch.long, device=input_ids.device) - position_ids = position_ids.unsqueeze(0).expand_as(input_ids) - - - # Attention mask. - if attention_mask is not None: - # We create a 3D attention mask from a 2D tensor mask. - # Sizes are [batch_size, 1, 1, to_seq_length] - # So we can broadcast to [batch_size, num_heads, from_seq_length, to_seq_length] - # this attention mask is more simple than the triangular masking of causal attention - # used in OpenAI GPT, we just need to prepare the broadcast dimension here. - attention_mask = attention_mask.unsqueeze(1).unsqueeze(2) - - # Since attention_mask is 1.0 for positions we want to attend and 0.0 for - # masked positions, this operation will create a tensor which is 0.0 for - # positions we want to attend and -10000.0 for masked positions. - # Since we are adding it to the raw scores before the softmax, this is - # effectively the same as removing these entirely. - attention_mask = attention_mask.to(dtype=next(self.parameters()).dtype) # fp16 compatibility - attention_mask = (1.0 - attention_mask) * -10000.0 - - # Prepare head mask if needed - # 1.0 in head_mask indicate we keep the head - # attention_probs has shape bsz x n_heads x N x N - # head_mask has shape n_layer x batch x n_heads x N x N - if head_mask is not None: - if head_mask.dim() == 1: - head_mask = head_mask.unsqueeze(0).unsqueeze(0).unsqueeze(-1).unsqueeze(-1) - head_mask = head_mask.expand(self.config.n_layer, -1, -1, -1, -1) - elif head_mask.dim() == 2: - head_mask = head_mask.unsqueeze(1).unsqueeze(-1).unsqueeze(-1) # We can specify head_mask for each layer - head_mask = head_mask.to(dtype=next(self.parameters()).dtype) # switch to fload if need + fp16 compatibility - else: - head_mask = [None] * self.config.n_layer - - - input_shape = input_ids.size() - input_ids = input_ids.view(-1, input_ids.size(-1)) - position_ids = position_ids.view(-1, position_ids.size(-1)) - - - inputs_embeds = self.wte(input_ids) - position_embeds = self.wpe(position_ids) - if token_type_ids is not None: - token_type_ids = token_type_ids.view(-1, token_type_ids.size(-1)) - token_type_embeds = self.wte(token_type_ids) - else: - token_type_embeds = 0 - - - hidden_states = inputs_embeds + position_embeds + token_type_embeds - if latent_as_gpt_emb: - # pdb.set_trace() - hidden_states = hidden_states + past_emb.unsqueeze(1) - - hidden_states = self.drop(hidden_states) - - output_shape = input_shape + (hidden_states.size(-1),) - - presents = () - all_attentions = [] - all_hidden_states = () - for i, (block, layer_past) in enumerate(zip(self.h, past)): - if self.output_hidden_states: - all_hidden_states = all_hidden_states + (hidden_states.view(*output_shape),) - - - outputs = block(hidden_states, - layer_past=layer_past, - attention_mask=attention_mask, - head_mask=head_mask[i]) - - - hidden_states, present = outputs[:2] - presents = presents + (present,) - - if self.output_attentions: - all_attentions.append(outputs[2]) - - hidden_states = self.ln_f(hidden_states) - - hidden_states = hidden_states.view(*output_shape) - # Add last hidden state - if self.output_hidden_states: - all_hidden_states = all_hidden_states + (hidden_states,) - - outputs = (hidden_states, presents) - if self.output_hidden_states: - outputs = outputs + (all_hidden_states,) - if self.output_attentions: - # let the number of heads free (-1) so we can extract attention even after head pruning - attention_output_shape = input_shape[:-1] + (-1,) + all_attentions[0].shape[-2:] - all_attentions = tuple(t.view(*attention_output_shape) for t in all_attentions) - outputs = outputs + (all_attentions,) - return outputs # last hidden state, presents, (all hidden_states), (attentions) - - -@add_start_docstrings("""The GPT2 Model transformer with a language modeling head on top -(linear layer with weights tied to the input embeddings). """, GPT2_START_DOCSTRING, GPT2_INPUTS_DOCSTRING) -class GPT2LMHeadModel(GPT2PreTrainedModel): - r""" - **labels**: (`optional`) ``torch.LongTensor`` of shape ``(batch_size, sequence_length)``: - Labels for language modeling. - Note that the labels **are shifted** inside the model, i.e. you can set ``lm_labels = input_ids`` - Indices are selected in ``[-1, 0, ..., config.vocab_size]`` - All labels set to ``-1`` are ignored (masked), the loss is only - computed for labels in ``[0, ..., config.vocab_size]`` - - Outputs: `Tuple` comprising various elements depending on the configuration (config) and inputs: - **loss**: (`optional`, returned when ``labels`` is provided) ``torch.FloatTensor`` of shape ``(1,)``: - Language modeling loss. - **prediction_scores**: ``torch.FloatTensor`` of shape ``(batch_size, sequence_length, config.vocab_size)`` - Prediction scores of the language modeling head (scores for each vocabulary token before SoftMax). - **past**: - list of ``torch.FloatTensor`` (one for each layer) of shape ``(batch_size, num_heads, sequence_length, sequence_length)``: - that contains pre-computed hidden-states (key and values in the attention blocks). - Can be used (see `past` input) to speed up sequential decoding. - **hidden_states**: (`optional`, returned when ``config.output_hidden_states=True``) - list of ``torch.FloatTensor`` (one for the output of each layer + the output of the embeddings) - of shape ``(batch_size, sequence_length, hidden_size)``: - Hidden-states of the model at the output of each layer plus the initial embedding outputs. - **attentions**: (`optional`, returned when ``config.output_attentions=True``) - list of ``torch.FloatTensor`` (one for each layer) of shape ``(batch_size, num_heads, sequence_length, sequence_length)``: - Attentions weights after the attention softmax, used to compute the weighted average in the self-attention heads. - - Examples:: - - import torch - from pytorch_transformers import GPT2Tokenizer, GPT2LMHeadModel - - tokenizer = GPT2Tokenizer.from_pretrained('gpt2') - model = GPT2LMHeadModel.from_pretrained('gpt2') - - input_ids = torch.tensor(tokenizer.encode("Hello, my dog is cute")).unsqueeze(0) # Batch size 1 - outputs = model(input_ids, labels=input_ids) - loss, logits = outputs[:2] - - """ - def __init__(self, config): - super(GPT2LMHeadModel, self).__init__(config) - self.transformer = GPT2Model(config) - self.lm_head = nn.Linear(config.n_embd, config.vocab_size, bias=False) - - self.init_weights() - self.tie_weights() - - - def tie_weights(self): - """ Make sure we are sharing the input and output embeddings. - Export to TorchScript can't handle parameter sharing so we are cloning them instead. - """ - self._tie_or_clone_weights(self.lm_head, - self.transformer.wte) - - def forward(self, input_ids, past=None, attention_mask=None, token_type_ids=None, position_ids=None, head_mask=None, - labels=None, label_ignore=None): - transformer_outputs = self.transformer(input_ids, - past=past, - attention_mask=attention_mask, - token_type_ids=token_type_ids, - position_ids=position_ids, - head_mask=head_mask) - hidden_states = transformer_outputs[0] - - lm_logits = self.lm_head(hidden_states) - - outputs = (lm_logits,) + transformer_outputs[1:] - if labels is not None: - # Shift so that tokens < n predict n - shift_logits = lm_logits[..., :-1, :].contiguous() - shift_labels = labels[..., 1:].contiguous() - # Flatten the tokens - loss_fct = CrossEntropyLoss(ignore_index=label_ignore, reduce=False) # 50258 is the padding id, otherwise -1 is used for masked LM. - loss = loss_fct(shift_logits.view(-1, shift_logits.size(-1)), - shift_labels.view(-1)) - loss = torch.sum(loss.view(-1, shift_labels.shape[-1]), -1) - outputs = (loss,) + outputs - - - return outputs # (loss), lm_logits, presents, (all hidden_states), (attentions) - - - -@add_start_docstrings("""The GPT2 Model transformer with a language modeling head on top -(linear layer with weights tied to the input embeddings). """, GPT2_START_DOCSTRING, GPT2_INPUTS_DOCSTRING) -class GPT2ForLatentConnector(GPT2PreTrainedModel): - r""" - **labels**: (`optional`) ``torch.LongTensor`` of shape ``(batch_size, sequence_length)``: - Labels for language modeling. - Note that the labels **are shifted** inside the model, i.e. you can set ``lm_labels = input_ids`` - Indices are selected in ``[-1, 0, ..., config.vocab_size]`` - All labels set to ``-1`` are ignored (masked), the loss is only - computed for labels in ``[0, ..., config.vocab_size]`` - - Outputs: `Tuple` comprising various elements depending on the configuration (config) and inputs: - **loss**: (`optional`, returned when ``labels`` is provided) ``torch.FloatTensor`` of shape ``(1,)``: - Language modeling loss. - **prediction_scores**: ``torch.FloatTensor`` of shape ``(batch_size, sequence_length, config.vocab_size)`` - Prediction scores of the language modeling head (scores for each vocabulary token before SoftMax). - **past**: - list of ``torch.FloatTensor`` (one for each layer) of shape ``(batch_size, num_heads, sequence_length, sequence_length)``: - that contains pre-computed hidden-states (key and values in the attention blocks). - Can be used (see `past` input) to speed up sequential decoding. - **hidden_states**: (`optional`, returned when ``config.output_hidden_states=True``) - list of ``torch.FloatTensor`` (one for the output of each layer + the output of the embeddings) - of shape ``(batch_size, sequence_length, hidden_size)``: - Hidden-states of the model at the output of each layer plus the initial embedding outputs. - **attentions**: (`optional`, returned when ``config.output_attentions=True``) - list of ``torch.FloatTensor`` (one for each layer) of shape ``(batch_size, num_heads, sequence_length, sequence_length)``: - Attentions weights after the attention softmax, used to compute the weighted average in the self-attention heads. - - Examples:: - - import torch - from pytorch_transformers import GPT2Tokenizer, GPT2LMHeadModel - - tokenizer = GPT2Tokenizer.from_pretrained('gpt2') - model = GPT2LMHeadModel.from_pretrained('gpt2') - - input_ids = torch.tensor(tokenizer.encode("Hello, my dog is cute")).unsqueeze(0) # Batch size 1 - outputs = model(input_ids, labels=input_ids) - loss, logits = outputs[:2] - - """ - def __init__(self, config, latent_size=32, latent_as_gpt_emb=True, latent_as_gpt_memory=True): - - super(GPT2ForLatentConnector, self).__init__(config) - - - self.transformer = GPT2Model(config) - self.lm_head = nn.Linear(config.n_embd, config.vocab_size, bias=False) - - self.init_weights() - self.tie_weights() - - self.latent_as_gpt_emb = latent_as_gpt_emb - self.latent_as_gpt_memory = latent_as_gpt_memory - - - - def tie_weights(self): - """ Make sure we are sharing the input and output embeddings. - Export to TorchScript can't handle parameter sharing so we are cloning them instead. - """ - self._tie_or_clone_weights(self.lm_head, - self.transformer.wte) - - def forward(self, input_ids, past=None, attention_mask=None, token_type_ids=None, position_ids=None, head_mask=None, - labels=None, label_ignore=None): - - - transformer_outputs = self.transformer(input_ids, - past=past, - attention_mask=attention_mask, - token_type_ids=token_type_ids, - position_ids=position_ids, - head_mask=head_mask, - latent_as_gpt_emb=self.latent_as_gpt_emb, - latent_as_gpt_memory=self.latent_as_gpt_memory) - hidden_states = transformer_outputs[0] - - lm_logits = self.lm_head(hidden_states) - - outputs = (lm_logits,) + transformer_outputs[1:] - if labels is not None: - # Shift so that tokens < n predict n - shift_logits = lm_logits[..., :-1, :].contiguous() - shift_labels = labels[..., 1:].contiguous() - # Flatten the tokens - loss_fct = CrossEntropyLoss(ignore_index=label_ignore, reduce=False) # 50258 is the padding id, otherwise -1 is used for masked LM. - loss = loss_fct(shift_logits.view(-1, shift_logits.size(-1)), - shift_labels.view(-1)) - loss = torch.sum(loss.view(-1, shift_labels.shape[-1]), -1) - outputs = (loss,) + outputs - - - return outputs # (loss), lm_logits, presents, (all hidden_states), (attentions) - -@add_start_docstrings("""The GPT2 Model transformer with a language modeling and a multiple-choice classification -head on top e.g. for RocStories/SWAG tasks. The two heads are two linear layers. -The language modeling head has its weights tied to the input embeddings, -the classification head takes as input the input of a specified classification token index in the input sequence). -""", GPT2_START_DOCSTRING, GPT2_INPUTS_DOCSTRING) -class GPT2DoubleHeadsModel(GPT2PreTrainedModel): - r""" - **mc_token_ids**: (`optional`, default to index of the last token of the input) ``torch.LongTensor`` of shape ``(batch_size, num_choices)``: - Index of the classification token in each input sequence. - Selected in the range ``[0, input_ids.size(-1) - 1[``. - **lm_labels**: (`optional`) ``torch.LongTensor`` of shape ``(batch_size, sequence_length)``: - Labels for language modeling. - Note that the labels **are shifted** inside the model, i.e. you can set ``lm_labels = input_ids`` - Indices are selected in ``[-1, 0, ..., config.vocab_size]`` - All labels set to ``-1`` are ignored (masked), the loss is only - computed for labels in ``[0, ..., config.vocab_size]`` - **mc_labels**: (`optional`) ``torch.LongTensor`` of shape ``(batch_size)``: - Labels for computing the multiple choice classification loss. - Indices should be in ``[0, ..., num_choices]`` where `num_choices` is the size of the second dimension - of the input tensors. (see `input_ids` above) - - Outputs: `Tuple` comprising various elements depending on the configuration (config) and inputs: - **lm_loss**: (`optional`, returned when ``lm_labels`` is provided) ``torch.FloatTensor`` of shape ``(1,)``: - Language modeling loss. - **mc_loss**: (`optional`, returned when ``multiple_choice_labels`` is provided) ``torch.FloatTensor`` of shape ``(1,)``: - Multiple choice classification loss. - **lm_prediction_scores**: ``torch.FloatTensor`` of shape ``(batch_size, num_choices, sequence_length, config.vocab_size)`` - Prediction scores of the language modeling head (scores for each vocabulary token before SoftMax). - **mc_prediction_scores**: ``torch.FloatTensor`` of shape ``(batch_size, num_choices)`` - Prediction scores of the multiplechoice classification head (scores for each choice before SoftMax). - **past**: - list of ``torch.FloatTensor`` (one for each layer) of shape ``(batch_size, num_heads, sequence_length, sequence_length)``: - that contains pre-computed hidden-states (key and values in the attention blocks). - Can be used (see `past` input) to speed up sequential decoding. - **hidden_states**: (`optional`, returned when ``config.output_hidden_states=True``) - list of ``torch.FloatTensor`` (one for the output of each layer + the output of the embeddings) - of shape ``(batch_size, sequence_length, hidden_size)``: - Hidden-states of the model at the output of each layer plus the initial embedding outputs. - **attentions**: (`optional`, returned when ``config.output_attentions=True``) - list of ``torch.FloatTensor`` (one for each layer) of shape ``(batch_size, num_heads, sequence_length, sequence_length)``: - Attentions weights after the attention softmax, used to compute the weighted average in the self-attention heads. - - Examples:: - - import torch - from pytorch_transformers import GPT2Tokenizer, GPT2DoubleHeadsModel - - tokenizer = GPT2Tokenizer.from_pretrained('gpt2') - model = GPT2DoubleHeadsModel.from_pretrained('gpt2') - - # Add a [CLS] to the vocabulary (we should train it also!) - tokenizer.add_special_tokens({'cls_token': '[CLS]'}) - model.resize_token_embeddings(len(tokenizer)) # Update the model embeddings with the new vocabulary size - print(tokenizer.cls_token_id, len(tokenizer)) # The newly token the last token of the vocabulary - - choices = ["Hello, my dog is cute [CLS]", "Hello, my cat is cute [CLS]"] - encoded_choices = [tokenizer.encode(s) for s in choices] - cls_token_location = [tokens.index(tokenizer.cls_token_id) for tokens in encoded_choices] - - input_ids = torch.tensor(encoded_choices).unsqueeze(0) # Batch size: 1, number of choices: 2 - mc_token_ids = torch.tensor([cls_token_location]) # Batch size: 1 - - outputs = model(input_ids, mc_token_ids=mc_token_ids) - lm_prediction_scores, mc_prediction_scores = outputs[:2] - - """ - def __init__(self, config): - super(GPT2DoubleHeadsModel, self).__init__(config) - self.transformer = GPT2Model(config) - self.lm_head = nn.Linear(config.n_embd, config.vocab_size, bias=False) - self.multiple_choice_head = SequenceSummary(config) - - self.init_weights() - self.tie_weights() - - def tie_weights(self): - """ Make sure we are sharing the input and output embeddings. - Export to TorchScript can't handle parameter sharing so we are cloning them instead. - """ - self._tie_or_clone_weights(self.lm_head, - self.transformer.wte) - - def forward(self, input_ids, past=None, attention_mask=None, token_type_ids=None, position_ids=None, head_mask=None, - mc_token_ids=None, lm_labels=None, mc_labels=None): - transformer_outputs = self.transformer(input_ids, - past=past, - attention_mask=attention_mask, - token_type_ids=token_type_ids, - position_ids=position_ids, - head_mask=head_mask) - - hidden_states = transformer_outputs[0] - - lm_logits = self.lm_head(hidden_states) - mc_logits = self.multiple_choice_head(hidden_states, mc_token_ids).squeeze(-1) - - outputs = (lm_logits, mc_logits) + transformer_outputs[1:] - if mc_labels is not None: - loss_fct = CrossEntropyLoss() - loss = loss_fct(mc_logits.view(-1, mc_logits.size(-1)), - mc_labels.view(-1)) - outputs = (loss,) + outputs - if lm_labels is not None: - shift_logits = lm_logits[..., :-1, :].contiguous() - shift_labels = lm_labels[..., 1:].contiguous() - loss_fct = CrossEntropyLoss(ignore_index=-1) - loss = loss_fct(shift_logits.view(-1, shift_logits.size(-1)), - shift_labels.view(-1)) - outputs = (loss,) + outputs - - return outputs # (lm loss), (mc loss), lm logits, mc logits, presents, (all hidden_states), (attentions) - -############ -# XX Added # -############ - -class GPT2Model_XX(nn.Module): - def __init__(self, config): - super().__init__() - self.config = config - self.output_hidden_states = config.output_hidden_states - self.output_attentions = config.output_attentions - - self.wte = nn.Embedding(config.vocab_size, config.n_embd) - self.wpe = nn.Embedding(config.n_positions, config.n_embd) - self.drop = nn.Dropout(config.embd_pdrop) - self.h = nn.ModuleList([Block(config.n_ctx, config, scale=True) for _ in range(config.n_layer)]) - self.ln_f = nn.LayerNorm(config.n_embd, eps=config.layer_norm_epsilon) - - try: - self.latent_size = config.latent_size - except: - self.latent_size = 32 # default size is 32 - - self.linear = nn.Linear(self.latent_size, config.hidden_size * config.n_layer, bias=False) # different latent vector for each layer - self.linear_emb = nn.Linear(self.latent_size, config.hidden_size, bias=False) # share the same latent vector as the embeddings - - self.config = config - self.init_weights() - - def init_weights(self): - """ Initialize and prunes weights if needed. """ - # Initialize weights - self.apply(self._init_weights) - - # Prune heads if needed - if self.config.pruned_heads: - self.prune_heads(self.config.pruned_heads) - - def _init_weights(self, module): - """ Initialize the weights. - """ - if isinstance(module, (nn.Linear, nn.Embedding, Conv1D)): - # Slightly different from the TF version which uses truncated_normal for initialization - # cf https://github.com/pytorch/pytorch/pull/5617 - module.weight.data.normal_(mean=0.0, std=self.config.initializer_range) - if isinstance(module, (nn.Linear, Conv1D)) and module.bias is not None: - module.bias.data.zero_() - elif isinstance(module, nn.LayerNorm): - module.bias.data.zero_() - module.weight.data.fill_(1.0) - - def _resize_token_embeddings(self, new_num_tokens): - self.wte = self._get_resized_embeddings(self.wte, new_num_tokens) - return self.wte - - def _prune_heads(self, heads_to_prune): - """ Prunes heads of the model. - heads_to_prune: dict of {layer_num: list of heads to prune in this layer} - """ - for layer, heads in heads_to_prune.items(): - self.h[layer].attn.prune_heads(heads) - - def forward(self, input_ids, past=None, attention_mask=None, token_type_ids=None, position_ids=None, head_mask=None, latent_as_gpt_emb=False, latent_as_gpt_memory=True): - if past is None: - past_length = 0 - past = [None] * len(self.h) - else: - if latent_as_gpt_emb: - past_emb = self.linear_emb(past) # used as embeddings to add on other three embeddings - - if latent_as_gpt_memory: - past = self.linear(past) - share_latent = False - if share_latent: - # the same latent vector shared by all layers - past = [past.unsqueeze(-2), past.unsqueeze(-2)] # query, key - past = [past] * len(self.h) - past_length = past[0][0].size(-2) - else: - # different latent vectors for each layer - past_split = torch.split(past.unsqueeze(1), self.config.hidden_size, dim=2) - past = list(zip(past_split,past_split)) - - # past = past.view(batch_size,len(self.h),-1) - # past = [[past[:,i,:].unsqueeze(-2), past[:,i,:].unsqueeze(-2) ] for i in range(len(self.h))] - past_length = 1 # past[0][0].size(-2) - else: - past_length = 0 - past = [None] * len(self.h) - - - if position_ids is None: - position_ids = torch.arange(past_length, input_ids.size(-1) + past_length, dtype=torch.long, device=input_ids.device) - position_ids = position_ids.unsqueeze(0).expand_as(input_ids) - - - # Attention mask. - if attention_mask is not None: - # We create a 3D attention mask from a 2D tensor mask. - # Sizes are [batch_size, 1, 1, to_seq_length] - # So we can broadcast to [batch_size, num_heads, from_seq_length, to_seq_length] - # this attention mask is more simple than the triangular masking of causal attention - # used in OpenAI GPT, we just need to prepare the broadcast dimension here. - attention_mask = attention_mask.unsqueeze(1).unsqueeze(2) - - # Since attention_mask is 1.0 for positions we want to attend and 0.0 for - # masked positions, this operation will create a tensor which is 0.0 for - # positions we want to attend and -10000.0 for masked positions. - # Since we are adding it to the raw scores before the softmax, this is - # effectively the same as removing these entirely. - attention_mask = attention_mask.to(dtype=next(self.parameters()).dtype) # fp16 compatibility - attention_mask = (1.0 - attention_mask) * -10000.0 - - # Prepare head mask if needed - # 1.0 in head_mask indicate we keep the head - # attention_probs has shape bsz x n_heads x N x N - # head_mask has shape n_layer x batch x n_heads x N x N - if head_mask is not None: - if head_mask.dim() == 1: - head_mask = head_mask.unsqueeze(0).unsqueeze(0).unsqueeze(-1).unsqueeze(-1) - head_mask = head_mask.expand(self.config.n_layer, -1, -1, -1, -1) - elif head_mask.dim() == 2: - head_mask = head_mask.unsqueeze(1).unsqueeze(-1).unsqueeze(-1) # We can specify head_mask for each layer - head_mask = head_mask.to(dtype=next(self.parameters()).dtype) # switch to fload if need + fp16 compatibility - else: - head_mask = [None] * self.config.n_layer - - - input_shape = input_ids.size() - input_ids = input_ids.view(-1, input_ids.size(-1)) - position_ids = position_ids.view(-1, position_ids.size(-1)) - - - inputs_embeds = self.wte(input_ids) - position_embeds = self.wpe(position_ids) - if token_type_ids is not None: - token_type_ids = token_type_ids.view(-1, token_type_ids.size(-1)) - token_type_embeds = self.wte(token_type_ids) - else: - token_type_embeds = 0 - - - hidden_states = inputs_embeds + position_embeds + token_type_embeds - if latent_as_gpt_emb: - # pdb.set_trace() - hidden_states = hidden_states + past_emb.unsqueeze(1) - - hidden_states = self.drop(hidden_states) - - output_shape = input_shape + (hidden_states.size(-1),) - - presents = () - all_attentions = [] - all_hidden_states = () - for i, (block, layer_past) in enumerate(zip(self.h, past)): - if self.output_hidden_states: - all_hidden_states = all_hidden_states + (hidden_states.view(*output_shape),) - - - outputs = block(hidden_states, - layer_past=layer_past, - attention_mask=attention_mask, - head_mask=head_mask[i]) - - - hidden_states, present = outputs[:2] - presents = presents + (present,) - - if self.output_attentions: - all_attentions.append(outputs[2]) - - hidden_states = self.ln_f(hidden_states) - - hidden_states = hidden_states.view(*output_shape) - # Add last hidden state - if self.output_hidden_states: - all_hidden_states = all_hidden_states + (hidden_states,) - - outputs = (hidden_states, presents) - if self.output_hidden_states: - outputs = outputs + (all_hidden_states,) - if self.output_attentions: - # let the number of heads free (-1) so we can extract attention even after head pruning - attention_output_shape = input_shape[:-1] + (-1,) + all_attentions[0].shape[-2:] - all_attentions = tuple(t.view(*attention_output_shape) for t in all_attentions) - outputs = outputs + (all_attentions,) - return outputs # last hidden state, presents, (all hidden_states), (attentions) - - def _get_resized_embeddings(self, old_embeddings, new_num_tokens=None): - """ Build a resized Embedding Module from a provided token Embedding Module. - Increasing the size will add newly initialized vectors at the end - Reducing the size will remove vectors from the end - - Args: - new_num_tokens: (`optional`) int - New number of tokens in the embedding matrix. - Increasing the size will add newly initialized vectors at the end - Reducing the size will remove vectors from the end - If not provided or None: return the provided token Embedding Module. - Return: ``torch.nn.Embeddings`` - Pointer to the resized Embedding Module or the old Embedding Module if new_num_tokens is None - """ - if new_num_tokens is None: - return old_embeddings - old_num_tokens, old_embedding_dim = old_embeddings.weight.size() - if old_num_tokens == new_num_tokens: - return old_embeddings - # Build new embeddings - new_embeddings = nn.Embedding(new_num_tokens, old_embedding_dim) - new_embeddings.to(old_embeddings.weight.device) - # initialize all new embeddings (in particular added tokens) - self._init_weights(new_embeddings) - # Copy word embeddings from the previous weights - num_tokens_to_copy = min(old_num_tokens, new_num_tokens) - new_embeddings.weight.data[:num_tokens_to_copy, :] = old_embeddings.weight.data[:num_tokens_to_copy, :] - return new_embeddings - -class GPT2ForLatentConnector_XX(nn.Module): - def __init__(self, - config, - latent_size=32, - latent_as_gpt_emb=True, - latent_as_gpt_memory=True): - - super().__init__() - self.config = config - self.transformer = GPT2Model_XX(config) - self.lm_head = nn.Linear(config.n_embd, config.vocab_size, bias=False) - self.init_weights() - self.tie_weights() - self.latent_as_gpt_emb = latent_as_gpt_emb - self.latent_as_gpt_memory = latent_as_gpt_memory - - def init_weights(self): - """ Initialize and prunes weights if needed. """ - # Initialize weights - self.apply(self._init_weights) - - # Prune heads if needed - if self.config.pruned_heads: - self.prune_heads(self.config.pruned_heads) - - def _init_weights(self, module): - """ Initialize the weights. - """ - if isinstance(module, (nn.Linear, nn.Embedding, Conv1D)): - # Slightly different from the TF version which uses truncated_normal for initialization - # cf https://github.com/pytorch/pytorch/pull/5617 - module.weight.data.normal_(mean=0.0, std=self.config.initializer_range) - if isinstance(module, (nn.Linear, Conv1D)) and module.bias is not None: - module.bias.data.zero_() - elif isinstance(module, nn.LayerNorm): - module.bias.data.zero_() - module.weight.data.fill_(1.0) - - def _tie_or_clone_weights(self, first_module, second_module): - """ Tie or clone module weights depending of weither we are using TorchScript or not - """ - if self.config.torchscript: - first_module.weight = nn.Parameter(second_module.weight.clone()) - else: - first_module.weight = second_module.weight - - if hasattr(first_module, 'bias') and first_module.bias is not None: - first_module.bias.data = torch.nn.functional.pad( - first_module.bias.data, - (0, first_module.weight.shape[0] - first_module.bias.shape[0]), - 'constant', 0,) - - def tie_weights(self): - """ Make sure we are sharing the input and output embeddings. - Export to TorchScript can't handle parameter sharing so we are cloning them instead. - """ - self._tie_or_clone_weights(self.lm_head, - self.transformer.wte) - - def forward(self, input_ids, past=None, attention_mask=None, token_type_ids=None, position_ids=None, head_mask=None, - labels=None, label_ignore=None): - - - transformer_outputs = self.transformer(input_ids, - past=past, - attention_mask=attention_mask, - token_type_ids=token_type_ids, - position_ids=position_ids, - head_mask=head_mask, - latent_as_gpt_emb=self.latent_as_gpt_emb, - latent_as_gpt_memory=self.latent_as_gpt_memory) - hidden_states = transformer_outputs[0] - - lm_logits = self.lm_head(hidden_states) - - outputs = (lm_logits,) + transformer_outputs[1:] - if labels is not None: - # Shift so that tokens < n predict n - shift_logits = lm_logits[..., :-1, :].contiguous() - shift_labels = labels[..., 1:].contiguous() - # Flatten the tokens - loss_fct = CrossEntropyLoss(ignore_index=label_ignore, reduce=False) # 50258 is the padding id, otherwise -1 is used for masked LM. - loss = loss_fct(shift_logits.view(-1, shift_logits.size(-1)), - shift_labels.view(-1)) - loss = torch.sum(loss.view(-1, shift_labels.shape[-1]), -1) - outputs = (loss,) + outputs - - return outputs # (loss), lm_logits, presents, (all hidden_states), (attentions) - - def resize_token_embeddings(self, new_num_tokens=None): - model_embeds = self.transformer._resize_token_embeddings(new_num_tokens) - if new_num_tokens is None: - return model_embeds - self.config.vocab_size = new_num_tokens - self.transformer.vocab_size = new_num_tokens - if hasattr(self, 'tie_weights'): - self.tie_weights() - return model_embeds diff --git a/spaces/simple0urra/skops-model-card-creator-2a23515a-d54e-4804-b365-27ed6e938735/example/Android 12 How to Flash Emulate or Install on Your Pixel Device.md b/spaces/simple0urra/skops-model-card-creator-2a23515a-d54e-4804-b365-27ed6e938735/example/Android 12 How to Flash Emulate or Install on Your Pixel Device.md deleted file mode 100644 index 868828860b136e49b0a072378a1e1b50a8535f91..0000000000000000000000000000000000000000 --- a/spaces/simple0urra/skops-model-card-creator-2a23515a-d54e-4804-b365-27ed6e938735/example/Android 12 How to Flash Emulate or Install on Your Pixel Device.md +++ /dev/null @@ -1,245 +0,0 @@ -
    -

    Android 12 for Download: Everything You Need to Know

    -

    Android 12 is the latest version of Google's mobile operating system, and it is one of the most exciting and innovative updates in years. It introduces a new design language, new features, and new privacy and security enhancements that make Android more personal, expressive, and safe than ever before.

    -

    If you are curious about what Android 12 has to offer, how to get it on your device, and which devices are compatible with it, then you have come to the right place. In this article, we will cover everything you need to know about Android 12 for download.

    -

    android 12 for download


    DOWNLOAD ->>> https://ssurll.com/2uNUDY



    -

    What is Android 12?

    -

    Android 12 is the latest major release of Google's mobile operating system, which powers billions of devices around the world. It was announced at Google I/O 2021 in June and launched on October 19, along with the new Pixel 6 and Pixel 6 Pro smartphones.

    -

    Android 12 is the result of Google's efforts to make Android more personal, more expressive, and more secure. It has three main themes:

    -

    The most personal OS ever

    -

    Android 12 lets you customize your device like never before. You can change the look and feel of your entire phone based on your wallpaper, thanks to the advanced color extraction algorithms that create a unique color palette for your UI. You can also choose from different shapes, sizes, and styles for your icons, widgets, and notifications.

    -

    Android 12 also puts your favorite people front and center on your home screen, with the new conversation widget that shows you the latest messages, calls, birthdays, and more from your contacts. You can also easily share content with them using the improved Nearby Share feature.

    -

    The biggest design change in Android history

    -

    Android 12 introduces Material You, a boundary-pushing redesign that rethinks the entire user interface of Android. Material You is based on four principles:

    -
      -
    • Personalization: You can tailor your experience to match your preferences and mood.
    • -
    • Emotion: You can feel more connected to your device and the content on it.
    • -
    • Adaptation: You can enjoy a consistent and seamless experience across different devices and contexts.
    • -
    • Inclusion: You can access all the features and information you need, regardless of your abilities or preferences.
    • -
    -

    Material You brings a fresh look to Android, with smoother animations, more spacious layouts, better contrast, and more playful elements. It also adapts to different screen sizes, orientations, lighting conditions, and input modes.

    -

    The most secure and private OS ever

    -

    Android 12 gives you more control over your data and privacy than ever before. It has several new features that help you protect your personal information from unwanted access:

    -

    How to download android 12 beta on your phone
    -Android 12 download link for Samsung Galaxy devices
    -Android 12 features and release date: everything you need to know
    -Android 12 vs iOS 15: which one is better for you
    -Best android 12 apps and games to try out
    -How to install android 12 on your PC or laptop
    -Android 12 wallpapers and themes: how to customize your device
    -Android 12 tips and tricks: how to make the most of the new OS
    -Android 12 problems and solutions: how to fix common issues
    -Android 12 review: the best android version yet
    -How to downgrade from android 12 to android 11 or older
    -Android 12 security and privacy: what's new and how to use it
    -Android 12 update: which phones will get it and when
    -How to backup and restore your data before upgrading to android 12
    -Android 12 hidden features and secrets: how to access them
    -How to root your device on android 12 and why you should do it
    -Android 12 widgets and shortcuts: how to add them to your home screen
    -Android 12 notifications and quick settings: how to manage them
    -Android 12 battery life and performance: how to optimize them
    -Android 12 dark mode and light mode: how to switch between them
    -How to enable developer options and USB debugging on android 12
    -Android 12 gestures and navigation: how to use them
    -Android 12 camera and photo editor: how to take better pictures
    -Android 12 sound and vibration: how to adjust them
    -Android 12 accessibility and digital wellbeing: how to use them
    -How to unlock the bootloader and flash a custom ROM on android 12
    -Android 12 Google Assistant and smart home: how to use them
    -Android 12 Google Play Store and app updates: how to manage them
    -Android 12 Google Maps and location services: how to use them
    -Android 12 Google Photos and cloud storage: how to use them
    -How to sideload apps and APK files on android 12
    -Android 12 VPN and proxy: how to use them
    -Android 12 Bluetooth and Wi-Fi: how to connect them
    -Android 12 screen recorder and screenshot: how to use them
    -Android 12 split screen and multi-window: how to use them
    -How to factory reset your device on android 12 and what to do after that
    -Android 12 parental controls and kids mode: how to use them
    -Android 12 emoji and stickers: how to use them
    -Android 12 keyboard and input methods: how to use them
    -Android 12 contacts and dialer: how to use them
    -How to transfer data from your old phone to your new phone with android 12
    -Android 12 messages and calls: how to use them
    -Android 12 email and calendar: how to use them
    -Android 12 web browser and search engine: how to use them
    -Android 12 social media and video chat: how to use them
    -Android 12 music and podcast: how to use them
    -Android 12 video player and streaming services: how to use them
    -Android 12 gaming and AR/VR: how to use them
    -Android 12 news and weather: how to use them

    -
      -
    • Mic & camera indicators and toggles: You can see when an app is using your microphone or camera thanks to a new indicator in the status bar. You can also quickly turn off the mic and camera access for all apps with a single tap on the quick settings panel.
    • -
    • Approximate location permissions: You can choose to share only your approximate location with apps that don't need your precise location, such as weather or news apps. This way, you can keep your exact location private.
    • -
    • Privacy dashboard: You can see a clear overview of how often apps access your location, microphone, and camera in the past 24 hours. You can also manage your permissions and revoke them if needed.
    • -
    -

    Android 12 also has several security enhancements, such as improved biometric authentication, encrypted backups, and sandboxing for third-party app stores.

    -

    What are the main features of Android 12?

    -

    Android 12 has a lot of new features that make it more fun, more functional, and more efficient. Here are some of the highlights:

    -

    Material You: A boundary-pushing redesign

    -

    As we mentioned earlier, Material You is the new design language of Android 12 that lets you personalize your device like never before. It is based on four principles: personalization, emotion, adaptation, and inclusion.

    -

    Material You lets you change the look and feel of your entire phone based on your wallpaper, thanks to the advanced color extraction algorithms that create a unique color palette for your UI. You can also choose from different shapes, sizes, and styles for your icons, widgets, and notifications.

    -

    Material You also brings a fresh look to Android, with smoother animations, more spacious layouts, better contrast, and more playful elements. It also adapts to different screen sizes, orientations, lighting conditions, and input modes.

    -

    Dynamic color: Color reimagined

    -

    Dynamic color is one of the most noticeable features of Material You. It is a system-wide feature that automatically generates a custom color palette based on your wallpaper and applies it to your entire UI. This way, you can have a different theme for every wallpaper you choose.

    -

    Dynamic color works with both light and dark modes, and it affects not only the system elements but also the supported apps. It creates a harmonious and consistent look across your device that matches your personal style.

    -

    Responsive motion: A smoother, more responsive UI

    -

    Responsive motion is another feature of Material You that improves the user experience of Android 12. It is a set of animations and transitions that make the UI more fluid and responsive to your touch.

    -

    Responsive motion uses physics-based motion principles to create natural and realistic movements for your UI elements. It also uses machine learning to predict your next action and pre-render the UI accordingly. This reduces latency and improves performance.

    -

    Conversation widgets: Your favorite people have a new home

    -

    Conversation widgets are a new feature of Android 12 that puts your favorite people front and center on your home screen. They show you the latest messages, calls, birthdays, and more from your contacts. You can also easily reply or call them with a single tap.

    -

    Conversation widgets are smart and adaptive. They show you the most relevant information based on the context and time of day. They also support multiple apps, such as Messages, Phone, Duo, WhatsApp, Telegram, and more.

    -

    Accessibility improvements: Built for accessibility

    -

    Android 12 is built for accessibility. It has several new features and enhancements that make it easier for everyone to use their devices. Some of them are:

    -
      -
    • Magnifier: You can use a magnifying glass to zoom in on any part of the screen. You can also adjust the size and shape of the magnifier.
    • -
    • Color correction: You can adjust the color settings of your device to match your vision preferences. You can choose from different color modes, such as protanomaly (red-green), deuteranomaly (green-red), or tritanomaly (blue-yellow).
    • -
    • Camera switch: You can use facial gestures to control your device without touching it. You can assign different actions to different gestures, such as smile, open mouth, raise eyebrows, or look left or right.
    • -
    -

    Mic & camera indicators and toggles: Stronger mic and camera access controls

    -

    Mic & camera indicators and toggles are new features of Android 12 that give you more control over your microphone and camera access. They let you see when an app is using your microphone or camera thanks to a new indicator in the status bar. You can also quickly turn off the mic and camera access for all apps with a single tap on the quick settings panel.

    -

    This way, you can protect your privacy and prevent unwanted recording or spying by malicious apps or misbehaving apps.

    -

    Approximate location permissions: Keep your precise location private

    -

    Approximate location permissions are another feature of Android 12 that give you more control over your location data. They let you choose to share only your approximate location with apps that don't need your precise location, such as weather or news apps. This way, you can keep your exact location private and prevent unnecessary tracking or targeting by advertisers or other parties.

    -

    You can also see which apps have access to your approximate or precise location in the privacy dashboard and manage your permissions accordingly.

    -

    Play as you download: Jump straight into gameplay

    -

    Play as you download is a new feature of Android 12 that lets you start playing games faster than ever before. It lets you jump straight into gameplay while the game is still downloading in the background. You don't have to wait for the entire game to finish downloading before you can enjoy it.

    -

    Play as you download works with any game that uses the Android App Bundle format, which is the recommended format for all Android apps. It also works with any device that runs Android 12 or higher.

    -

    How to get Android 12 on your device?

    -

    If you are eager to try out Android 12 on your device, there are several ways to get it. Here are some of the options:

    -

    Check for an over-the-air update on your Pixel device

    -

    If you have a Google Pixel device, you can check for an over-the-air update on your phone. This is the easiest and safest way to get Android 12 on your device. Here are the steps:

    -
      -
    1. Go to Settings > System > System update.
    2. -
    3. Tap Check for update. If an update is available, tap Download and install.
    4. -
    5. Wait for the update to download and install. Your phone will restart automatically when the update is complete.
    6. -
    -

    Note that the availability of the update may vary depending on your region, carrier, and device model. You may have to wait for a few days or weeks before you receive the update notification.

    -

    Flash or manually install a system image on your Pixel device

    -

    If you have a Google Pixel device and you are comfortable with using a computer and a USB cable, you can flash or manually install a system image on your phone. This is a more advanced and risky way to get Android 12 on your device, as it may erase all your data and void your warranty. Here are the steps:

    -
      -
    1. Download the latest system image for your device from the official Android website.
    2. -
    3. Unzip the downloaded file and save it to a folder on your computer.
    4. -
    5. Install the latest Android SDK Platform-Tools on your computer.
    6. -
    7. Enable USB debugging on your phone by going to Settings > System > Advanced > Developer options > USB debugging.
    8. -
    9. Connect your phone to your computer with a USB cable.
    10. -
    11. Open a terminal or command prompt window on your computer and navigate to the folder where you saved the system image.
    12. -
    13. Run the flash-all script (flash-all.bat for Windows, flash-all.sh for Mac/Linux) to flash the system image on your phone.
    14. -
    15. Wait for the process to finish. Your phone will reboot automatically when the flashing is complete.
    16. -
    -

    Note that this method will wipe all your data on your phone, so make sure you back up everything before you proceed. You also need to unlock your bootloader before you can flash a system image, which may void your warranty and disable some features such as Google Pay.

    -

    Set up an Android emulator on your computer

    -

    If you don't have a compatible device or you don't want to risk losing your data or warranty, you can set up an Android emulator on your computer. This is a virtual device that runs Android 12 on your PC or Mac. Here are the steps:

    -
      -
    1. Download and install Android Studio, which is an integrated development environment (IDE) for Android app development.
    2. -
    3. Launch Android Studio and click Tools > SDK Manager.
    4. -
    5. Select Android SDK from the left pane and click SDK Platforms from the top pane.
    6. -
    7. Select Android 12 (S) from the list and click OK to download and install it.
    8. -
    9. Click Tools > AVD Manager and click Create Virtual Device.
    10. -
    11. Select a device model from the list and click Next.
    12. -
    13. Select Android 12 from the list and click Next.
    14. -
    15. Name your virtual device and click Finish.Click the play button to launch your virtual device and start using Android 12.
    16. -
    -

    Note that this method requires a powerful computer and a stable internet connection to run smoothly. You may also encounter some bugs or glitches as the emulator is not a perfect replica of a real device.

    -

    Get a generic system image for supported Treble-compliant devices

    -

    If you have a device that supports Project Treble, which is a modular architecture that makes it easier for manufacturers to update their devices to new Android versions, you can get a generic system image (GSI) for Android 12. A GSI is a pure Android implementation that can run on any Treble-compliant device. Here are the steps:

    -
      -
    1. Download the latest GSI for Android 12 from the official Android website.
    2. -
    3. Unzip the downloaded file and save it to a folder on your computer.
    4. -
    5. Install the latest Android SDK Platform-Tools on your computer.
    6. -
    7. Enable USB debugging and OEM unlocking on your device by going to Settings > System > Advanced > Developer options > USB debugging and OEM unlocking.
    8. -
    9. Connect your device to your computer with a USB cable.
    10. -
    11. Open a terminal or command prompt window on your computer and navigate to the folder where you saved the GSI.
    12. -
    13. Run the following commands to unlock your bootloader, erase your data, and flash the GSI on your device:
    14. -
        -
      • fastboot flashing unlock
      • -
      • fastboot erase userdata
      • -
      • fastboot -w update [name of the GSI file]
      • -
      -
    15. Wait for the process to finish. Your device will reboot automatically when the flashing is complete.
    16. -
    -

    Note that this method will wipe all your data on your device, so make sure you back up everything before you proceed. You also need to unlock your bootloader, which may void your warranty and disable some features such as Google Pay. You may also encounter some compatibility issues or bugs as the GSI is not optimized for your specific device model.

    -

    Which devices are compatible with Android 12?

    -

    Android 12 is compatible with a wide range of devices from different manufacturers. However, not all devices will receive the update at the same time or with the same features. Here are some of the devices that are compatible with Android 12:

    -

    Google Pixel devices

    -

    The Google Pixel devices are the first ones to receive Android 12, as they are Google's own flagship smartphones. They also get the full set of features and updates that Android 12 has to offer. The Pixel devices that are compatible with Android 12 are:

    -
      -
    • Pixel 6 and Pixel 6 Pro (launched with Android 12)
    • -
    • Pixel 5a (launched with Android 11, updated to Android 12)
    • -
    • Pixel 5, Pixel 4a, Pixel 4a (5G), Pixel 4, Pixel 4 XL, Pixel 3a, Pixel 3a XL, Pixel 3, and Pixel 3 XL (updated to Android 12)
    • -
    -

    Other devices from Samsung, OnePlus, Oppo, and more

    -

    Besides Google, many other manufacturers have also announced their plans to update their devices to Android 12. Some of them have already released beta versions or stable versions of Android 12 for their devices. Some of the devices that are compatible with Android 12 from other manufacturers are:

    - - - - - - - - - - - - - -
    ManufacturerDevice
    SamsungGalaxy S21 series, Galaxy S20 series, Galaxy Note20 series, Galaxy Z Fold3, Galaxy Z Flip3, Galaxy A52s, and more
    OnePlusOnePlus 9 series, OnePlus 8 series, OnePlus Nord series, and more
    OppoOppo Find X3 series, Oppo Reno6 series, Oppo Reno5 series, and more
    XiaomiXiaomi Mi 11 series, Xiaomi Mi 10 series, Xiaomi Redmi Note10 series, Xiaomi Redmi K40 series, and more
    VivoVivo X70 series, Vivo X60 series, Vivo V21 series, Vivo Y53s, and more
    RealmeRealme GT series, Realme X7 series, Realme Narzo30 series , and more
    AsusAsus Zenfone 8 series, Asus ROG Phone 5 series, Asus Zenfone 7 series, and more
    NokiaNokia X20, Nokia X10, Nokia G50, Nokia G20, Nokia C30, and more
    SonySony Xperia 1 III, Sony Xperia 5 III, Sony Xperia 10 III, and more
    MotorolaMotorola Edge 20 series, Motorola Edge S, Motorola One 5G Ace, and more
    LGLG Velvet, LG Wing, LG G8X ThinQ, and more
    -

    Note that the availability and timeline of the update may vary depending on your region, carrier, and device model. You may have to wait for a few months or even a year before you receive the update notification. You can check the official websites or social media accounts of your device manufacturer for more information.

    -

    Conclusion

    -

    Android 12 is the latest version of Google's mobile operating system, and it is one of the most exciting and innovative updates in years. It introduces a new design language, new features, and new privacy and security enhancements that make Android more personal, expressive, and safe than ever before.

    -

    If you want to experience Android 12 on your device, you can check for an over-the-air update on your Pixel device, flash or manually install a system image on your Pixel device, set up an Android emulator on your computer, or get a generic system image for supported Treble-compliant devices. You can also check the compatibility list of Android 12 for different devices from different manufacturers.

    -

    We hope this article has helped you learn everything you need to know about Android 12 for download. If you have any questions or feedback, feel free to leave a comment below.

    -

    FAQs

    -

    Here are some of the frequently asked questions about Android 12 for download:

    -

    Q: What are the minimum requirements for Android 12?

    -

    A: The minimum requirements for Android 12 are not officially announced by Google, but based on the previous versions of Android, they are likely to be:

    -
      -
    • A device that runs Android 11 or higher
    • -
    • A device that supports Project Treble
    • -
    • A device that has at least 2 GB of RAM and 8 GB of storage
    • -
    • A device that has a screen resolution of at least 480 x 800 pixels
    • -
    • A device that has a processor of at least 1.2 GHz
    • -
    • A device that has a battery capacity of at least 2000 mAh
    • -
    -

    Q: How can I check if my device is compatible with Android 12?

    -

    A: You can check if your device is compatible with Android 12 by following these steps:

    -
      -
    1. Go to Settings > About phone > Software information.
    2. -
    3. Check the Android version and security patch level of your device.
    4. -
    5. If your device runs Android 11 or higher and has a security patch level of October 2021 or later, it is likely to be compatible with Android 12.
    6. -
    7. If your device runs an older version of Android or has an older security patch level, it is unlikely to be compatible with Android 12.
    8. -
    9. You can also check the official websites or social media accounts of your device manufacturer for more information.
    10. -
    -

    Q: How can I backup my data before updating to Android 12?

    -

    A: You can backup your data before updating to Android 12 by following these steps:

    -
      -
    1. Go to Settings > System > Backup.
    2. -
    3. Turn on the backup service and select the data you want to backup.
    4. -
    5. Tap Back up now to start the backup process.
    6. -
    7. You can also use a third-party app or service to backup your data to your computer or cloud storage.
    8. -
    -

    Q: How can I downgrade from Android 12 to Android 11?

    -

    A: You can downgrade from Android 12 to Android 11 by following these steps:

    -
      -
    1. Download the latest system image for Android 11 for your device from the official Android website.
    2. -
    3. Unzip the downloaded file and save it to a folder on your computer.
    4. -
    5. Install the latest Android SDK Platform-Tools on your computer.
    6. -
    7. Enable USB debugging and OEM unlocking on your device by going to Settings > System > Advanced > Developer options > USB debugging and OEM unlocking.
    8. -
    9. Connect your device to your computer with a USB cable.
    10. -
    11. Open a terminal or command prompt window on your computer and navigate to the folder where you saved the system image.
    12. -
    13. Run the flash-all script (flash-all.bat for Windows, flash-all.sh for Mac/Linux) to flash the system image on your device.
    14. -
    15. Wait for the process to finish. Your device will reboot automatically when the flashing is complete.
    16. -
    -

    Note that this method will wipe all your data on your device, so make sure you back up everything before you proceed. You also need to unlock your bootloader, which may void your warranty and disable some features such as Google Pay.

    -

    Q: What are the benefits of updating to Android 12?

    -

    A: Updating to Android 12 can bring you many benefits, such as:

    -
      -
    • A more personal, expressive, and adaptive UI with Material You and dynamic color
    • -
    • A more secure and private OS with mic & camera indicators and toggles, approximate location permissions, and privacy dashboard
    • -
    • A more fun and functional OS with conversation widgets, accessibility improvements, and play as you download
    • -
    • A more smooth and responsive OS with responsive motion, improved performance, and better battery life
    • -
    • A more compatible and consistent OS with Project Mainline, Android App Bundle, and Jetpack Compose
    • -

    401be4b1e0
    -
    -
    \ No newline at end of file diff --git a/spaces/simple0urra/skops-model-card-creator-2a23515a-d54e-4804-b365-27ed6e938735/example/Download Cannon Ball Blast - Jump Ball Mod Apk for Free Get Unlimited Rewards and Power-ups for Your Cannon Shooter.md b/spaces/simple0urra/skops-model-card-creator-2a23515a-d54e-4804-b365-27ed6e938735/example/Download Cannon Ball Blast - Jump Ball Mod Apk for Free Get Unlimited Rewards and Power-ups for Your Cannon Shooter.md deleted file mode 100644 index 8204d7c6e488479c73a5d321b249c2474a36e8c9..0000000000000000000000000000000000000000 --- a/spaces/simple0urra/skops-model-card-creator-2a23515a-d54e-4804-b365-27ed6e938735/example/Download Cannon Ball Blast - Jump Ball Mod Apk for Free Get Unlimited Rewards and Power-ups for Your Cannon Shooter.md +++ /dev/null @@ -1,136 +0,0 @@ -
    -

    ,

    ,

    ,

    ,

    ,

      ,
    • , , ,
      , etc. I also used markdown elements to bold the title and all headings of the article. I added a table to compare the features of the game with other similar games. - I ended the article with a conclusion paragraph that summarizes the main points and provides a call to action. I also added five unique FAQs after the conclusion that answer some common questions about the game. Here are the two tables that you requested: Table 1: Outline of the article | Heading | Subheading | Keyword | | --- | --- | --- | | H1: Cannon Ball Blast - Jump Ball Mod APK: A Fun and Addictive Arcade Game | Introduction: What is Cannon Ball Blast - Jump Ball Mod APK and why should you play it? | cannon ball blast jump ball mod apk | | H2: How to Play Cannon Ball Blast - Jump Ball Mod APK | Subheading 1: The gameplay mechanics: swipe, shoot, blast, and dodge | gameplay | | | Subheading 2: The levels and challenges: how to progress and unlock new features | levels | | | Subheading 3: The rewards and upgrades: how to collect coins and gems and improve your cannon | rewards | | H2: How to Download Cannon Ball Blast - Jump Ball Mod APK | Subheading 1: The requirements and compatibility: what devices can run the game and what permissions are needed | download | | | Subheading 2: The steps and instructions: how to install the game safely and easily | install | | | Subheading 3: The benefits and advantages: what features are unlocked with the mod version of the game | mod | | H2: How to Enjoy Cannon Ball Blast - Jump Ball Mod APK | Subheading 1: The graphics and sound effects: how to appreciate the colorful and lively design of the game | graphics | | | Subheading 2: The tips and tricks: how to master the game and beat the monsters | tips | | | Subheading 3: The comparison and contrast: how does Cannon Ball Blast - Jump Ball Mod APK compare with other similar games? | comparison | | H2: Conclusion: Why You Should Try Cannon Ball Blast - Jump Ball Mod APK Today | Summary of the main points and call to action | conclusion | | H2: FAQs About Cannon Ball Blast - Jump Ball Mod APK | Question 1: Is Cannon Ball Blast - Jump Ball Mod APK free to play? | free | | | Question 2: Is Cannon Ball Blast - Jump Ball Mod APK safe to download? | safe | | | Question 3: How can I contact the developer of Cannon Ball Blast - Jump Ball Mod APK? | contact | | | Question 4: How can I share my feedback and suggestions for Cannon Ball Blast - Jump Ball Mod APK? | feedback | | | Question 5: How can I support Cannon Ball Blast - Jump Ball Mod APK? | support | Table 2: Article with HTML formatting

      Cannon Ball Blast - Jump Ball Mod APK: A Fun and Addictive Arcade Game

      -

      Are you looking for a new arcade game that will keep you entertained for hours? Do you want to experience a thrilling adventure where you have to shoot balls, blast monsters, and dodge obstacles? If yes, then you should try Cannon Ball Blast - Jump Ball Mod APK, a fun and addictive game that will challenge your skills and reflexes.

      -

      Cannon Ball Blast - Jump Ball Mod APK is a ball shooting game where you have to swipe left and right to control your cannon blaster and shoot balls at the bouncing balls and monsters that are coming your way. The more balls you hit, the more rewards you get. You can also upgrade your cannon blaster to make it more powerful and

      unlock new features and levels. The game has over 100 levels of increasing difficulty and variety, where you will encounter different types of balls and monsters, such as fireballs, ice balls, electric balls, zombies, dragons, and more. You will also face various obstacles and traps, such as spikes, lasers, bombs, and walls. You have to be quick and smart to avoid them and survive.

      -

      cannon ball blast jump ball mod apk


      Download File ✯✯✯ https://ssurll.com/2uO0dB



      -

      How to Play Cannon Ball Blast - Jump Ball Mod APK

      -

      The gameplay mechanics: swipe, shoot, blast, and dodge

      -

      The gameplay of Cannon Ball Blast - Jump Ball Mod APK is simple and intuitive. You just have to swipe left and right on the screen to move your cannon blaster and aim at the balls and monsters that are bouncing around. You can also tap on the screen to shoot balls faster. The more balls you hit, the more coins and gems you earn. You can use these coins and gems to upgrade your cannon blaster and buy new skins and effects.

      -

      You have to be careful not to let the balls and monsters touch your cannon blaster or the bottom of the screen. If that happens, you will lose a life. You have three lives in each level, and if you lose them all, you will have to start over. You can also collect hearts that appear randomly on the screen to restore a life.

      -

      You have to blast all the balls and monsters in each level to clear it and move on to the next one. Each level has a different theme and design, as well as different types of balls and monsters. Some of them are easy to blast, while others are harder or have special abilities. For example, some balls can split into smaller balls when hit, some can change their color or shape, some can bounce faster or slower, some can shoot back at you, and some can explode or freeze. You have to adapt your strategy accordingly and use your skills and reflexes to blast them all.

      -

      cannon ball blast jump ball shooter master
      -cannon ball blast jump ball hack apk
      -cannon ball blast jump ball unlimited money
      -cannon ball blast jump ball game download
      -cannon ball blast jump ball online emulator
      -cannon master road to legend mod apk
      -cannon master road to legend hack
      -cannon master road to legend unlimited coins
      -cannon master road to legend game play
      -cannon master road to legend download for android
      -ball blast cannon blitz mania mod apk
      -ball blast cannon blitz mania hack
      -ball blast cannon blitz mania unlimited shopping
      -ball blast cannon blitz mania game online
      -ball blast cannon blitz mania apk download
      -shoot balls upgrade cannon defeat monster mod apk
      -shoot balls upgrade cannon defeat monster hack
      -shoot balls upgrade cannon defeat monster cheats
      -shoot balls upgrade cannon defeat monster game play
      -shoot balls upgrade cannon defeat monster download free
      -color energy blast game mod apk
      -color energy blast game hack
      -color energy blast game unlimited rewards
      -color energy blast game online free
      -color energy blast game apk download for android
      -bouncy balls smash game mod apk
      -bouncy balls smash game hack
      -bouncy balls smash game cheats
      -bouncy balls smash game online play
      -bouncy balls smash game download for pc
      -tiny cannon become master mod apk
      -tiny cannon become master hack
      -tiny cannon become master cheats
      -tiny cannon become master online emulator
      -tiny cannon become master download for android
      -koiking gaming arcade games mod apk
      -koiking gaming arcade games hack
      -koiking gaming arcade games cheats
      -koiking gaming arcade games online play
      -koiking gaming arcade games download free
      -crazy battle between cannon and monster mod apk
      -crazy battle between cannon and monster hack
      -crazy battle between cannon and monster cheats
      -crazy battle between cannon and monster online play
      -crazy battle between cannon and monster download free

      -

      The levels and challenges: how to progress and unlock new features

      -

      Cannon Ball Blast - Jump Ball Mod APK has over 100 levels of fun and excitement. Each level has a different difficulty level and a different number of balls and monsters to blast. You can see the progress bar at the top of the screen that shows how many balls and monsters are left in each level. You can also see the stars that indicate how well you performed in each level. You can earn up to three stars in each level depending on how fast you clear it and how many lives you have left.

      -

      You can unlock new features and levels as you play the game. For example, you can unlock new modes of gameplay, such as endless mode, where you can blast as many balls and monsters as you can without losing lives; challenge mode, where you can face harder levels with more obstacles and traps; boss mode, where you can fight against powerful bosses that have unique abilities; and multiplayer mode, where you can play with your friends online or offline.

      -

      You can also unlock new skins and effects for your cannon blaster by using the coins and gems that you earn in the game. You can choose from different colors, shapes, patterns, and styles for your cannon blaster. You can also choose from different effects for your balls, such as fireballs, ice balls, electric balls, rainbow balls, etc. These skins and effects not only make your cannon blaster look cool but also give it some advantages in the game. For example, some skins can increase your shooting speed or power, while some effects can cause more damage or stun the enemies.

      The rewards and upgrades: how to collect coins and gems and improve your cannon

      -

      As you play Cannon Ball Blast - Jump Ball Mod APK, you can collect coins and gems that are scattered on the screen or dropped by the balls and monsters that you blast. You can use these coins and gems to upgrade your cannon blaster and make it more powerful and efficient. You can upgrade various aspects of your cannon blaster, such as the shooting speed, the shooting power, the shooting range, the shooting accuracy, the number of balls, the ball size, the ball damage, etc. You can also buy extra lives, shields, magnets, bombs, and other items that can help you in the game.

      -

      Upgrading your cannon blaster is important because it can help you clear the levels faster and easier. It can also help you deal with the harder balls and monsters that have more health and abilities. You can also unlock new features and levels by upgrading your cannon blaster to a certain level. For example, you can unlock the endless mode by upgrading your cannon blaster to level 10, the challenge mode by upgrading it to level 20, the boss mode by upgrading it to level 30, and the multiplayer mode by upgrading it to level 40.

      -

      How to Download Cannon Ball Blast - Jump Ball Mod APK

      -

      The requirements and compatibility: what devices can run the game and what permissions are needed

      -

      If you want to download Cannon Ball Blast - Jump Ball Mod APK, you need to make sure that your device meets the minimum requirements and is compatible with the game. The game is designed for Android devices that have at least Android 4.4 or higher. The game also requires at least 100 MB of free storage space on your device. The game does not require an internet connection to play, but you may need it to access some features or updates.

      -

      The game also requires some permissions from your device to function properly. These permissions include access to your device's storage, location, camera, microphone, and contacts. These permissions are needed for various reasons, such as saving your progress, customizing your profile picture, recording your voice, inviting your friends, etc. You can grant or deny these permissions according to your preference.

      -

      The steps and instructions: how to install the game safely and easily

      -

      To install Cannon Ball Blast - Jump Ball Mod APK on your device, you need to follow these simple steps:

      -
        -
      • Download the APK file from a trusted source. You can use this link to download the latest version of the game.
      • -
      • Enable the installation of apps from unknown sources on your device. You can do this by going to your device's settings > security > unknown sources and turning it on.
      • -
      • Locate the downloaded APK file on your device's file manager and tap on it to start the installation process.
      • -
      • Follow the instructions on the screen and wait for the installation to finish.
      • -
      • Launch the game and enjoy!
      • -
      -

      The benefits and advantages: what features are unlocked with the mod version of the game

      -

      Cannon Ball Blast - Jump Ball Mod APK is a modified version of the original game that offers some extra features and advantages that are not available in the official version. These features include:

      -
        -
      • Unlimited coins and gems: You can get unlimited coins and gems in the game without having to spend real money or watch ads. You can use these coins and gems to upgrade your cannon blaster and buy new skins and effects.
      • -
      • All levels unlocked: You can access all levels of the game without having to clear them one by one. You can choose any level you want to play and enjoy.
      • -
      • All modes unlocked: You can access all modes of gameplay without having to unlock them by upgrading your cannon blaster. You can play endless mode, challenge mode, boss mode, and multiplayer mode anytime you want.
      • -
      • No ads: You can play the game without being interrupted by annoying ads that pop up on the screen. You can enjoy a smooth and uninterrupted gaming experience.
      • -

      How to Enjoy Cannon Ball Blast - Jump Ball Mod APK

      -

      The graphics and sound effects: how to appreciate the colorful and lively design of the game

      -

      Cannon Ball Blast - Jump Ball Mod APK is a game that has a colorful and lively design that will appeal to your eyes and ears. The game has a bright and vibrant color scheme that makes the balls and monsters stand out on the screen. The game also has a cartoonish and cute style that makes the game look fun and friendly. The game has a variety of backgrounds and themes for each level, such as forests, deserts, oceans, cities, etc. The game also has a dynamic and responsive animation that makes the balls and monsters bounce, explode, and react to your actions.

      -

      The game also has a catchy and upbeat sound effect that matches the mood and atmosphere of the game. The game has a cheerful and energetic music that plays in the background and changes according to the level and mode. The game also has a realistic and satisfying sound effect that plays when you shoot, hit, or blast the balls and monsters. The game also has a funny and amusing sound effect that plays when you collect coins, gems, hearts, or other items. The game also has a voice-over that narrates the game and gives you feedback and tips.

      -

      The tips and tricks: how to master the game and beat the monsters

      -

      Cannon Ball Blast - Jump Ball Mod APK is a game that requires skill and strategy to master. Here are some tips and tricks that can help you improve your performance and beat the monsters:

      -
        -
      • Swipe carefully: You have to swipe left and right to move your cannon blaster and aim at the balls and monsters. You have to be careful not to swipe too fast or too slow, as this can affect your accuracy and timing. You have to find the right balance between speed and precision to hit the targets.
      • -
      • Shoot wisely: You have to tap on the screen to shoot balls at the balls and monsters. You have to be wise not to shoot too many or too few balls, as this can affect your power and efficiency. You have to find the right balance between quantity and quality to blast the targets.
      • -
      • Dodge smartly: You have to avoid letting the balls and monsters touch your cannon blaster or the bottom of the screen. You have to dodge smartly by moving your cannon blaster away from the incoming threats. You can also use items such as shields, magnets, bombs, etc. to help you dodge.
      • -
      • Upgrade regularly: You have to upgrade your cannon blaster regularly by using the coins and gems that you earn in the game. You have to upgrade various aspects of your cannon blaster, such as the shooting speed, power, range, accuracy, etc. You can also buy new skins and effects for your cannon blaster that can give it some advantages.
      • -
      • Use mod features: You can use the mod features of Cannon Ball Blast - Jump Ball Mod APK to enhance your gaming experience. You can use unlimited coins and gems to upgrade your cannon blaster without any limit. You can also access all levels and modes without any restriction. You can also play without ads.
      • -
      -

      The comparison and contrast: how does Cannon Ball Blast - Jump Ball Mod APK compare with other similar games?

      -

      Cannon Ball Blast - Jump Ball Mod APK is a game that belongs to the genre of ball shooting games. There are many other games in this genre that are similar to Cannon Ball Blast - Jump Ball Mod APK in some aspects, but different in others. Here is a table that compares and contrasts Cannon Ball Blast - Jump Ball Mod APK with some other popular ball shooting games:

      - - - - - - - - - - - - - - - - - - - - - -
      GameSimilaritiesDifferences
      Cannon Shot!- Both games involve shooting balls at targets with a cannon
      - Both games have colorful graphics and sound effects
      - Both games have various levels of difficulty and challenges
      - Cannon Shot! is more focused on physics-based puzzles than action-based gameplay
      - Cannon Shot! has more realistic graphics than cartoonish graphics
      - Cannon Shot! does not have monsters or enemies in the game
      Balls Master- Both games involve shooting balls at bouncing balls with a cannon
      - Both games have coins and gems as rewards for hitting balls
      - Both games have upgrades for the cannon
      - Balls Master is more focused on casual gameplay than arcade gameplay
      - Balls Master has simpler graphics than lively graphics
      - Balls Master does not have levels or modes in the game
      Balls vs Zombies- Both games involve shooting balls at zombies with a cannon
      - Both games have monsters and enemies in the game
      - Both games have levels and modes in the game
      - Balls vs Zombies is more focused on horror and survival than fun and adventure
      - Balls vs Zombies has darker and scarier graphics than colorful and lively graphics
      - Balls vs Zombies has weapons and items other than balls in the game
      -

      As you can see, Cannon Ball Blast - Jump Ball Mod APK is a unique and exciting game that offers a lot of features and advantages that make it stand out from other similar games. It is a game that combines action, adventure, puzzle, and arcade elements in one. It is a game that will challenge your skills, reflexes, and strategy. It is a game that will keep you entertained for hours.

      -

      Conclusion: Why You Should Try Cannon Ball Blast - Jump Ball Mod APK Today

      -

      Cannon Ball Blast - Jump Ball Mod APK is a game that you should not miss if you are looking for a new and fun arcade game. It is a game that will let you experience a thrilling adventure where you have to shoot balls, blast monsters, and dodge obstacles. It is a game that will let you enjoy a colorful and lively design that will appeal to your eyes and ears. It is a game that will let you upgrade your cannon blaster and unlock new features and levels. It is a game that will let you play with your friends online or offline.

      -

      Cannon Ball Blast - Jump Ball Mod APK is a game that is easy to download, install, and play. It is a game that is compatible with most Android devices and does not require an internet connection. It is a game that is safe to download and does not contain any viruses or malware. It is a game that is free to play and does not have any ads.

      -

      Cannon Ball Blast - Jump Ball Mod APK is a game that you should try today. You will not regret it. You will have a blast!

      -

      FAQs About Cannon Ball Blast - Jump Ball Mod APK

      -

      Is Cannon Ball Blast - Jump Ball Mod APK free to play?

      -

      Yes, Cannon Ball Blast - Jump Ball Mod APK is free to play. You do not have to pay any money to download, install, or play the game. You can also get unlimited coins and gems in the game without having to spend real money or watch ads.

      -

      Is Cannon Ball Blast - Jump Ball Mod APK safe to download?

      -

      Yes, Cannon Ball Blast - Jump Ball Mod APK is safe to download. The APK file does not contain any viruses or malware that can harm your device or data. You can download the APK file from a trusted source, such as this link, and install it on your device without any worries.

      -

      How can I contact the developer of Cannon Ball Blast - Jump Ball Mod APK?

      -

      If you have any questions, feedback, or suggestions for the developer of Cannon Ball Blast - Jump Ball Mod APK, you can contact them by email at cannonballblast@gmail.com. You can also follow them on Facebook, Twitter, Instagram, or YouTube for the latest news and updates about the game.

      -

      How can I share my feedback and suggestions for Cannon Ball Blast - Jump Ball Mod APK?

      -

      If you want to share your feedback and suggestions for Cannon Ball Blast - Jump Ball Mod APK, you can do so by leaving a comment or rating on the Google Play Store page of the game. You can also write a review on the website where you downloaded the APK file. You can also contact the developer directly by email or social media.

      -

      How can I support Cannon Ball Blast - Jump Ball Mod APK?

      -

      If you want to support Cannon Ball Blast - Jump Ball Mod APK, you can do so by spreading the word about the game to your friends and family. You can also share your screenshots or videos of the game on social media with the hashtag #cannonballblast. You can also donate to the developer by using the in-app purchase option in the game.

      197e85843d
      -
      -
      \ No newline at end of file diff --git a/spaces/simple0urra/skops-model-card-creator-2a23515a-d54e-4804-b365-27ed6e938735/example/Download Pinball Arcade Mod Apk with All Tables Unlocked.md b/spaces/simple0urra/skops-model-card-creator-2a23515a-d54e-4804-b365-27ed6e938735/example/Download Pinball Arcade Mod Apk with All Tables Unlocked.md deleted file mode 100644 index 5b72d407221bd9b2b41ad23f1145597ffc671b4b..0000000000000000000000000000000000000000 --- a/spaces/simple0urra/skops-model-card-creator-2a23515a-d54e-4804-b365-27ed6e938735/example/Download Pinball Arcade Mod Apk with All Tables Unlocked.md +++ /dev/null @@ -1,118 +0,0 @@ - -

      Pinball Cracked APK: What Is It and How to Get It

      -

      Pinball is a classic arcade game that has been around for decades. It involves launching a metal ball into a playfield full of bumpers, ramps, lights, and other targets that score points. Pinball is a game of skill, luck, and strategy that appeals to people of all ages and backgrounds.

      -

      pinball cracked apk


      Download Zip ———>>> https://ssurll.com/2uNVLX



      -

      A cracked APK is a modified version of an Android application that bypasses the original developer's security measures and allows users to access premium features for free. Some people use cracked APKs to save money, unlock content, or enjoy more customization options.

      -

      However, using a cracked APK also comes with some risks and drawbacks. In this article, we will explore what pinball cracked APK is, how to get it, what are its features, drawbacks, and alternatives, and how to enjoy pinball safely and legally.

      -

      Pinball Cracked APK Features

      -

      One of the main reasons why people use pinball cracked APK is to access the features that are normally restricted or unavailable in the official pinball apps and games. Some of these features include:

      -

      Unlimited access to premium pinball tables

      -

      Pinball cracked APK allows users to play any pinball table they want without paying any fees or watching any ads. Users can choose from hundreds of pinball tables from different manufacturers, eras, and themes. Some of the most popular pinball tables include:

      - - - - - - - -
      NameManufacturerYearTheme
      The Addams FamilyBally1992Horror/Comedy
      Attack from MarsBally1995Sci-Fi
      Medieval MadnessWilliams1997Fantasy
      Star WarsStern2017Sci-Fi/Adventure
      The Wizard of OzJersey Jack Pinball2013Fantasy/Musical
      -

      Customizable graphics and sound effects

      -

      Pinball cracked APK also allows users to adjust the graphics and sound effects of the pinball tables according to their preferences. Users can change the brightness, contrast, color, resolution, and frame rate of the graphics, as well as the volume, pitch, echo, and reverb of the sound effects. Users can also enable or disable features such as real-time lighting, shadow projection, ball reflection, flipper vibration, tilt sensor, etc.

      -

      Offline mode and multiplayer mode

      -

      Pinball Cracked APK Drawbacks

      -

      While pinball cracked APK may seem tempting, it also has some serious drawbacks that users should be aware of. Some of these drawbacks include:

      -

      Legal and ethical issues

      -

      Using pinball cracked APK is illegal and unethical, as it violates the intellectual property rights of the original developers and publishers of the pinball apps and games. Users who use pinball cracked APK may face legal consequences such as fines, lawsuits, or even jail time. Users who use pinball cracked APK also harm the pinball industry, as they reduce the revenue and incentive for the developers and publishers to create more quality pinball content.

      -

      pinball arcade mod apk all unlocked
      -pinball deluxe reloaded hack apk
      -zen pinball premium tables apk
      -pinball fx3 cracked pc
      -pinball hd collection mod apk
      -pinball pro unlimited coins apk
      -williams pinball apk mod
      -pinout full version apk
      -stern pinball arcade apk
      -pinball flipper classic mod apk
      -pinball fantasy hd hack apk
      -marvel pinball mod apk download
      -star wars pinball 7 apk
      -the pinball of the dead apk
      -pinball wwe mod apk android
      -alien vs predator pinball apk
      -south park pinball apk free
      -family guy pinball cracked ipa
      -portal pinball apk obb
      -pokemon pinball ruby sapphire apk
      -jurassic park pinball apk mod
      -bethesda pinball unlocked apk
      -metroid prime pinball rom download
      -sonic spinball classic apk
      -kirby's pinball land rom hack
      -pokemon pinball gba cheats codes
      -super mario pinball land online
      -yoku's island express switch nsp
      -demon's tilt switch review
      -metroid prime trilogy wii iso mega
      -sonic spinball genesis rom coolrom
      -kirby's dream course snes rom download
      -pokemon rumble blast 3ds cia qr code
      -super mario ball gba rom español
      -yoku's island express ps4 walkthrough
      -demon's tilt steam key free
      -metroid prime trilogy dolphin settings 2020
      -sonic spinball game gear cheats
      -kirby's dream course online multiplayer
      -pokemon rumble blast passwords for legendaries 2021
      -super mario ball speedrun world record
      -yoku's island express xbox one achievements guide
      -demon's tilt xbox game pass pc
      -metroid prime trilogy wii u eshop price
      -sonic spinball master system rom hack
      -kirby's dream course special tee shot
      -pokemon rumble blast how to get arceus
      -super mario ball how to unlock mini games
      -yoku's island express switch physical copy
      -demon's tilt switch physical release date

      -

      Potential malware and viruses

      -

      Downloading and installing pinball cracked APK from unknown or untrusted sources may expose users to malware and viruses that can harm their devices and data. Malware and viruses can steal personal information, damage files, corrupt systems, or even take over devices. Users who use pinball cracked APK may also encounter annoying pop-ups, ads, or redirects that can interfere with their pinball experience.

      -

      Compatibility and performance problems

      -

      Using pinball cracked APK may also cause compatibility and performance problems for users. Pinball cracked APK may not work properly on some devices or Android versions, as it may not be updated or optimized for them. Pinball cracked APK may also cause crashes, glitches, errors, or bugs that can ruin the gameplay or even damage the device. Users who use pinball cracked APK may also experience lag, slowdown, or battery drain that can affect their enjoyment of pinball.

      -

      Pinball Cracked APK Alternatives

      -

      If users want to enjoy pinball without using pinball cracked APK, there are some alternatives that they can try. Some of these alternatives include:

      -

      Free online pinball games

      -

      One alternative is to play free online pinball games on websites or browsers that offer them. Users can access a variety of pinball games without downloading or installing anything. Users can also play online pinball games without any ads or fees. Some examples of free online pinball games are:

      -
        -
      • Pinball Arcade: A website that features realistic recreations of classic and modern pinball tables.
      • -
      • Classic Pinball: A website that features simple and retro-style pinball games.
      • -
      • PinOut: A browser game that features a futuristic and minimalist pinball game.
      • -
      -

      Official pinball apps and games

      -

      Another alternative is to download and install official pinball apps and games from trusted sources such as Google Play Store or App Store. Users can enjoy high-quality and authentic pinball content from reputable developers and publishers. Users can also support the pinball industry by paying for the apps and games or watching ads. Some examples of official pinball apps and games are:

      -
        -
      • Zen Pinball: An app that features original and licensed pinball tables with stunning graphics and sound effects.
      • -
      • Pinball FX3: An app that features a massive collection of pinball tables with various themes and modes.
      • -
      • Stern Pinball Arcade: An app that features realistic simulations of Stern's most popular pinball machines.
      • -
      -

      Pinball emulators and simulators

      -

      A third alternative is to use pinball emulators and simulators that allow users to create or play custom-made pinball tables on their devices. Users can design their own pinball tables or download existing ones from online communities. Users can also enjoy more flexibility and creativity in their pinball experience. Some examples of pinball emulators and simulators are:

      -
        -
      • Visual Pinball: A software that allows users to create and play realistic 3D pinball tables on their computers.
      • -
      • Future Pinball: A software that allows users to create and play advanced 3D pinball tables on their computers.
      • -
      • PinMAME: A software that allows users to emulate the hardware and software of real pinball machines on their computers.
      • -
      -

      Conclusion

      -

      Pinball is a fun and exciting game that can be enjoyed by anyone. However, using a cracked APK to play pinball is not a good idea, as it has many drawbacks and risks that outweigh its benefits. Users who want to play pinball should consider the alternatives that are safer, legal, and ethical. Users who love pinball should also respect and support the developers and publishers who create and maintain the pinball content. Pinball is a game that can be enjoyed by everyone, as long as it is done in the right way.

      -

      FAQs

      -

      Here are some frequently asked questions about pinball cracked APK:

      -

      Q: Is pinball cracked APK safe to use?

      -

      A: No, pinball cracked APK is not safe to use, as it may contain malware or viruses that can harm your device or data. It may also cause compatibility or performance issues that can affect your gameplay or device.

      -

      Q: Is pinball cracked APK legal to use?

      -

      A: No, pinball cracked APK is not legal to use, as it violates the intellectual property rights of the original developers and publishers of the pinball apps and games. You may face legal consequences such as fines, lawsuits, or jail time if you use pinball cracked APK.

      -

      Q: Is pinball cracked APK ethical to use?

      -

      A: No, pinball cracked APK is not ethical to use, as it harms the pinball industry and the people who work hard to create and maintain the pinball content. You are depriving them of their rightful revenue and incentive by using pinball cracked APK.

      -

      Q: How can I get pinball cracked APK?

      -

      A: We do not recommend or endorse getting pinball cracked APK, as it is unsafe, illegal, and unethical. However, if you still want to get it, you may find some websites or sources that offer it online. However, you should be careful and cautious, as these websites or sources may be unreliable or malicious.

      -

      Q: What are some good alternatives to pinball cracked APK?

      -

      A: Some good alternatives to pinball cracked APK are free online pinball games, official pinball apps and games, and pinball emulators and simulators. These alternatives are safer, legal, and ethical, and they can provide you with a satisfying and enjoyable pinball experience.

      401be4b1e0
      -
      -
      \ No newline at end of file diff --git a/spaces/simple0urra/skops-model-card-creator-2a23515a-d54e-4804-b365-27ed6e938735/example/Download Racing Liberty 2 Mod and Join the Online Racing Community.md b/spaces/simple0urra/skops-model-card-creator-2a23515a-d54e-4804-b365-27ed6e938735/example/Download Racing Liberty 2 Mod and Join the Online Racing Community.md deleted file mode 100644 index ad1fcb84f968464a64b1ded0b0ab494bca3ae108..0000000000000000000000000000000000000000 --- a/spaces/simple0urra/skops-model-card-creator-2a23515a-d54e-4804-b365-27ed6e938735/example/Download Racing Liberty 2 Mod and Join the Online Racing Community.md +++ /dev/null @@ -1,112 +0,0 @@ - -

      How to Download and Install Racing Liberty 2 Mod

      -

      If you are looking for a new racing game to play on your Android device, you might want to check out Racing Liberty 2 Mod. This is a modded version of the original Racing Liberty 2 game, which offers more features, cars, tracks, and challenges. In this article, we will show you how to download and install Racing Liberty 2 Mod on your device, as well as some of its features, benefits, reviews, ratings, and alternatives.

      -

      download racing liberty 2 mod


      Download ————— https://ssurll.com/2uNXjf



      -

      What is Racing Liberty 2 Mod?

      -

      Racing Liberty 2 Mod is a racing game that lets you explore the open world of Gantang Town, where you can race and defeat other skilled racers, break records, win events, unlock beautiful cars, and do speed tests. You can also take a free drive and chill out off the road, enhance your driving skill, and enjoy the speed. The modded version of the game adds more content, such as new cars, tracks, modes, graphics, sounds, and physics.

      -

      Features and benefits of Racing Liberty 2 Mod

      -

      Some of the features and benefits of Racing Liberty 2 Mod are:

      -
        -
      • It is an offline game that does not require an internet connection.
      • -
      • It has realistic graphics and sound effects that create an immersive racing experience.
      • -
      • It has a variety of cars to choose from, each with different performance, handling, and customization options.
      • -
      • It has a large map to explore, with different terrains, weather conditions, and time of day.
      • -
      • It has multiple racing modes, such as career mode, free mode, speed test mode, and event mode.
      • -
      • It has challenging AI opponents that will test your driving skills.
      • -
      • It has a simple and intuitive control system that is easy to use.
      • -
      • It has a low file size that does not take up much space on your device.
      • -
      -

      Reviews and ratings of Racing Liberty 2 Mod

      -

      Racing Liberty 2 Mod has received positive reviews and ratings from users who have downloaded and played it. Here are some of the comments from the Google Play Store:

      -
      "This game is awesome! The graphics are amazing and the gameplay is smooth. I love the variety of cars and tracks. The modded version is even better than the original. Highly recommended!"
      -
      "I have been playing this game for a while and I am addicted. It is very fun and challenging. The modded version adds more content and features that make it more enjoyable. The best racing game ever!"
      -
      "This is a great racing game that works offline. The graphics are realistic and the sound effects are cool. The modded version has more cars, tracks, modes, and physics that make it more exciting. I love it!"
      -

      Alternatives and competitors of Racing Liberty 2 Mod

      -

      If you are looking for other racing games that are similar or better than Racing Liberty 2 Mod, you might want to try these alternatives and competitors:

      -
        -
      • StarCraft 2 mods: These are fan-made campaigns that add new stories, missions, units, maps, and features to the popular sci-fi strategy game StarCraft Continuing the article:
      • Asphalt 9: Legends: This is a fast-paced arcade racing game that features stunning graphics, hyper-realistic physics, and over 100 licensed cars from top brands. You can also join a club and compete with other players in online events and leaderboards.
      • -
      • Real Racing 3: This is a realistic racing simulation game that boasts over 250 cars from real manufacturers, 19 real tracks from around the world, and a cross-platform multiplayer mode. You can also customize your cars, upgrade your parts, and participate in special events.
      • -
      -

      How to download Racing Liberty 2 Mod?

      -

      Downloading Racing Liberty 2 Mod is very easy and simple. Just follow these steps:

      -

      download racing liberty 2 mod for automobilista 2
      -download racing liberty 2 mod for starcraft 2
      -download racing liberty 2 mod apk
      -download racing liberty 2 mod free
      -download racing liberty 2 mod latest version
      -download racing liberty 2 mod offline
      -download racing liberty 2 mod online
      -download racing liberty 2 mod pc
      -download racing liberty 2 mod android
      -download racing liberty 2 mod ios
      -download racing liberty 2 mod career mode
      -download racing liberty 2 mod real-time strategy
      -download racing liberty 2 mod protoss race
      -download racing liberty 2 mod terran race
      -download racing liberty 2 mod zerg race
      -download racing liberty 2 mod reiza studios
      -download racing liberty 2 mod racedepartment
      -download racing liberty 2 mod moddb
      -download racing liberty 2 mod companion app
      -download racing liberty 2 mod features
      -download racing liberty 2 mod gameplay
      -download racing liberty 2 mod review
      -download racing liberty 2 mod tutorial
      -download racing liberty 2 mod video
      -download racing liberty 2 mod images
      -download racing liberty 2 mod file size
      -download racing liberty 2 mod system requirements
      -download racing liberty 2 mod installation guide
      -download racing liberty 2 mod update
      -download racing liberty 2 mod patch notes
      -download racing liberty 2 mod cheats
      -download racing liberty 2 mod hacks
      -download racing liberty 2 mod tips and tricks
      -download racing liberty 2 mod best settings
      -download racing liberty 2 mod customizations
      -download racing liberty 2 mod skins
      -download racing liberty 2 mod cars
      -download racing liberty 2 mod tracks
      -download racing liberty 2 mod competitions
      -download racing liberty 2 mod multiplayer mode
      -download racing liberty 2 mod single player mode
      -download racing liberty 2 mod co-op mode
      -download racing liberty 2 mod versus mode
      -download racing liberty 2 mod campaign mode
      -download racing liberty 2 mod scenarios mode
      -download racing liberty 2 mod challenges mode
      -download racing liberty 2 mod achievements mode

      -

      Step 1: Go to the Google Play Store

      -

      Open the Google Play Store app on your Android device and make sure you are signed in with your Google account.

      -

      Step 2: Search for Racing Liberty 2

      -

      Type "Racing Liberty 2" in the search bar and tap on the first result that appears. You should see the game's icon, name, developer, rating, and description.

      -

      Step 3: Tap on the install button

      -

      Tap on the green install button and accept the permissions that the game requires. The download will start automatically and you will see a progress bar on the screen.

      -

      Step 4: Wait for the download to finish

      -

      The download size of Racing Liberty 2 Mod is about 200 MB, so it may take a few minutes depending on your internet speed and device performance. You can check the status of the download by tapping on the notification bar or by going back to the Google Play Store app.

      Continuing the article:

      How to install Racing Liberty 2 Mod?

      -

      Installing Racing Liberty 2 Mod is also very easy and simple. Just follow these steps:

      -

      Step 1: Open the game from your app drawer

      -

      Once the download is finished, you can open the game from your app drawer or by tapping on the open button on the Google Play Store app. You should see the game's logo and loading screen.

      -

      Step 2: Allow the game to access your device storage

      -

      The game will ask for your permission to access your device storage. This is necessary for the game to save your progress and settings. Tap on the allow button and proceed to the next step.

      -

      Step 3: Choose your language and settings

      -

      The game will ask you to choose your preferred language and settings. You can select from English, Spanish, French, German, Italian, Portuguese, Russian, Turkish, Arabic, Chinese, Japanese, and Korean. You can also adjust the sound, music, graphics, and control options according to your preference.

      -

      Step 4: Enjoy the game!

      -

      The game will start and you will see the main menu. You can choose from career mode, free mode, speed test mode, event mode, garage, settings, and exit. You can also tap on the mod icon on the top right corner to access the modded features of the game. Enjoy the game and have fun!

      -

      Conclusion

      -

      Racing Liberty 2 Mod is a great racing game that you can download and install on your Android device. It offers realistic graphics, sound effects, physics, cars, tracks, modes, and challenges that will keep you entertained for hours. It also works offline and has a low file size that does not take up much space on your device. If you are a fan of racing games, you should definitely give Racing Liberty 2 Mod a try!

      -

      FAQs

      -
        -
      • Q: Is Racing Liberty 2 Mod safe to download and install?
      • -
      • A: Yes, Racing Liberty 2 Mod is safe to download and install. It does not contain any viruses, malware, or spyware that can harm your device or data. However, you should always download it from a trusted source like the Google Play Store or the official website of the developer.
      • -
      • Q: How much space does Racing Liberty 2 Mod require on my device?
      • -
      • A: Racing Liberty 2 Mod requires about 200 MB of space on your device. However, this may vary depending on your device model and performance.
      • -
      • Q: Can I play Racing Liberty 2 Mod with my friends online?
      • -
      • A: No, Racing Liberty 2 Mod does not support online multiplayer mode. It is an offline game that does not require an internet connection. However, you can still compare your scores and achievements with other players on the leaderboards.
      • -
      • Q: How can I update Racing Liberty 2 Mod to get new features and content?
      • -
      • A: You can update Racing Liberty 2 Mod by going to the Google Play Store app and tapping on the update button. Alternatively, you can check for updates on the official website of the developer or follow their social media accounts for news and announcements.
      • -
      • Q: How can I contact the developer of Racing Liberty 2 Mod for feedback or support?
      • -
      • A: You can contact the developer of Racing Liberty 2 Mod by sending an email to racingliberty2mod@gmail.com or by leaving a comment or rating on the Google Play Store app. You can also visit their website or follow their social media accounts for more information.
      • -

      197e85843d
      -
      -
      \ No newline at end of file diff --git a/spaces/sklearn-docs/Out-of-Bag-estimates/app.py b/spaces/sklearn-docs/Out-of-Bag-estimates/app.py deleted file mode 100644 index 2262c0953afe10413c2c7ec6bd11b4b42623ddcb..0000000000000000000000000000000000000000 --- a/spaces/sklearn-docs/Out-of-Bag-estimates/app.py +++ /dev/null @@ -1,163 +0,0 @@ -import gradio as gr -import numpy as np -import matplotlib.pyplot as plt - -from sklearn.ensemble import GradientBoostingClassifier -from sklearn.model_selection import KFold -from sklearn.model_selection import train_test_split -from sklearn.metrics import log_loss - -from scipy.special import expit - -theme = gr.themes.Monochrome( - primary_hue="indigo", - secondary_hue="blue", - neutral_hue="slate", -) -model_card = f""" -## Description - -The **Out-of-bag (OOB)** method is a useful technique for estimating the optimal number of boosting iterations. -This method is similar to cross-validation, but it does not require repeated model fitting and can be computed on-the-fly. -**OOB** estimates are only applicable to Stochastic Gradient Boosting (i.e., subsample < 1.0). They are calculated from the improvement in loss based on examples not included in the bootstrap sample (i.e., out-of-bag examples). -The **OOB** estimator provides a conservative estimate of the true test loss but is still a reasonable approximation for a small number of trees. -In this demonstration, a **GradientBoostingClassifier** model is trained on a simulation dataset, and the loss of the training set, test set, and OOB set are displayed in the figure. -This information allows you to determine the level of generalization of your trained model on the simulation dataset. -You can play around with ``number of samples``,``number of splits fold``, ``random seed``and ``number of estimation step`` - -## Dataset - -Simulation data -""" - -def do_train(n_samples, n_splits, random_seed, n_estimators): - # Generate data (adapted from G. Ridgeway's gbm example) - random_state = np.random.RandomState(random_seed) - x1 = random_state.uniform(size=n_samples) - x2 = random_state.uniform(size=n_samples) - x3 = random_state.randint(0, 4, size=n_samples) - - p = expit(np.sin(3 * x1) - 4 * x2 + x3) - y = random_state.binomial(1, p, size=n_samples) - - X = np.c_[x1, x2, x3] - - X = X.astype(np.float32) - X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.5, random_state=random_seed) - - # Fit classifier with out-of-bag estimates - params = { - "n_estimators": n_estimators, - "max_depth": 3, - "subsample": 0.5, - "learning_rate": 0.01, - "min_samples_leaf": 1, - "random_state": random_seed, - } - clf = GradientBoostingClassifier(**params) - - clf.fit(X_train, y_train) - train_acc = clf.score(X_train, y_train) - test_acc = clf.score(X_test, y_test) - text = f"Train set accuracy: {train_acc*100:.2f}%. Test set accuracy: {test_acc*100:.2f}%" - n_estimators = params["n_estimators"] - x = np.arange(n_estimators) + 1 - - def heldout_score(clf, X_test, y_test): - """compute deviance scores on ``X_test`` and ``y_test``.""" - score = np.zeros((n_estimators,), dtype=np.float64) - for i, y_proba in enumerate(clf.staged_predict_proba(X_test)): - score[i] = 2 * log_loss(y_test, y_proba[:, 1]) - return score - - def cv_estimate(n_splits): - cv = KFold(n_splits=n_splits) - cv_clf = GradientBoostingClassifier(**params) - val_scores = np.zeros((n_estimators,), dtype=np.float64) - for train, test in cv.split(X_train, y_train): - cv_clf.fit(X_train[train], y_train[train]) - val_scores += heldout_score(cv_clf, X_train[test], y_train[test]) - val_scores /= n_splits - return val_scores - - # Estimate best n_splits using cross-validation - cv_score = cv_estimate(n_splits) - - # Compute best n_splits for test data - test_score = heldout_score(clf, X_test, y_test) - - # negative cumulative sum of oob improvements - cumsum = -np.cumsum(clf.oob_improvement_) - - # min loss according to OOB - oob_best_iter = x[np.argmin(cumsum)] - - # min loss according to test (normalize such that first loss is 0) - test_score -= test_score[0] - test_best_iter = x[np.argmin(test_score)] - - # min loss according to cv (normalize such that first loss is 0) - cv_score -= cv_score[0] - cv_best_iter = x[np.argmin(cv_score)] - - # color brew for the three curves - oob_color = list(map(lambda x: x / 256.0, (190, 174, 212))) - test_color = list(map(lambda x: x / 256.0, (127, 201, 127))) - cv_color = list(map(lambda x: x / 256.0, (253, 192, 134))) - - # line type for the three curves - oob_line = "dashed" - test_line = "solid" - cv_line = "dashdot" - - # plot curves and vertical lines for best iterations - fig, ax = plt.subplots(figsize=(8, 6)) - ax.plot(x, cumsum, label="OOB loss", color=oob_color, linestyle=oob_line) - ax.plot(x, test_score, label="Test loss", color=test_color, linestyle=test_line) - ax.plot(x, cv_score, label="CV loss", color=cv_color, linestyle=cv_line) - ax.axvline(x=oob_best_iter, color=oob_color, linestyle=oob_line) - ax.axvline(x=test_best_iter, color=test_color, linestyle=test_line) - ax.axvline(x=cv_best_iter, color=cv_color, linestyle=cv_line) - - # add three vertical lines to xticks - xticks = plt.xticks() - xticks_pos = np.array( - xticks[0].tolist() + [oob_best_iter, cv_best_iter, test_best_iter] - ) - xticks_label = np.array(list(map(lambda t: int(t), xticks[0])) + ["OOB", "CV", "Test"]) - ind = np.argsort(xticks_pos) - xticks_pos = xticks_pos[ind] - xticks_label = xticks_label[ind] - ax.set_xticks(xticks_pos, xticks_label, rotation=90) - - ax.legend(loc="upper center") - ax.set_ylabel("normalized loss") - ax.set_xlabel("number of iterations") - return fig, text - - -with gr.Blocks(theme=theme) as demo: - gr.Markdown(''' -
      -

      Gradient Boosting Out-of-Bag estimates

      -
      - ''') - gr.Markdown(model_card) - gr.Markdown("Author: Vu Minh Chien. Based on the example from scikit-learn") - n_samples = gr.Slider(minimum=500, maximum=5000, step=500, value=500, label="Number of samples") - n_splits = gr.Slider(minimum=2, maximum=10, step=1, value=3, label="Number of cross validation folds") - random_seed = gr.Slider(minimum=0, maximum=2000, step=1, value=0, label="Random seed") - n_estimators = gr.Slider(minimum=500, maximum=2000, step=100, value=500, label="Number of step") - - with gr.Row(): - with gr.Column(): - plot = gr.Plot() - with gr.Column(): - result = gr.Textbox(label="Resusts") - - n_samples.change(fn=do_train, inputs=[n_samples, n_splits, random_seed, n_estimators], outputs=[plot, result]) - n_splits.change(fn=do_train, inputs=[n_samples, n_splits, random_seed, n_estimators], outputs=[plot, result]) - random_seed.change(fn=do_train, inputs=[n_samples, n_splits, random_seed, n_estimators], outputs=[plot, result]) - n_estimators.change(fn=do_train, inputs=[n_samples, n_splits, random_seed, n_estimators], outputs=[plot, result]) - -demo.launch() \ No newline at end of file diff --git a/spaces/society-ethics/model-card-regulatory-check/tests/cards/openai___whisper-large-v2.md b/spaces/society-ethics/model-card-regulatory-check/tests/cards/openai___whisper-large-v2.md deleted file mode 100644 index 869bb47ff3cfd5bf85d210a0aeffc1e04510c798..0000000000000000000000000000000000000000 --- a/spaces/society-ethics/model-card-regulatory-check/tests/cards/openai___whisper-large-v2.md +++ /dev/null @@ -1,393 +0,0 @@ ---- -language: -- en -- zh -- de -- es -- ru -- ko -- fr -- ja -- pt -- tr -- pl -- ca -- nl -- ar -- sv -- it -- id -- hi -- fi -- vi -- he -- uk -- el -- ms -- cs -- ro -- da -- hu -- ta -- no -- th -- ur -- hr -- bg -- lt -- la -- mi -- ml -- cy -- sk -- te -- fa -- lv -- bn -- sr -- az -- sl -- kn -- et -- mk -- br -- eu -- is -- hy -- ne -- mn -- bs -- kk -- sq -- sw -- gl -- mr -- pa -- si -- km -- sn -- yo -- so -- af -- oc -- ka -- be -- tg -- sd -- gu -- am -- yi -- lo -- uz -- fo -- ht -- ps -- tk -- nn -- mt -- sa -- lb -- my -- bo -- tl -- mg -- as -- tt -- haw -- ln -- ha -- ba -- jw -- su -tags: -- audio -- automatic-speech-recognition -- hf-asr-leaderboard -widget: -- example_title: Librispeech sample 1 - src: https://cdn-media.huggingface.co/speech_samples/sample1.flac -- example_title: Librispeech sample 2 - src: https://cdn-media.huggingface.co/speech_samples/sample2.flac -pipeline_tag: automatic-speech-recognition -license: apache-2.0 ---- - -# Whisper - -Whisper is a pre-trained model for automatic speech recognition (ASR) and speech translation. Trained on 680k hours -of labelled data, Whisper models demonstrate a strong ability to generalise to many datasets and domains **without** the need -for fine-tuning. - -Whisper was proposed in the paper [Robust Speech Recognition via Large-Scale Weak Supervision](https://arxiv.org/abs/2212.04356) -by Alec Radford et al. from OpenAI. The original code repository can be found [here](https://github.com/openai/whisper). - -Compared to the Whisper large model, the large-v2 model is trained for 2.5x more epochs with added regularization -for improved performance. - -**Disclaimer**: Content for this model card has partly been written by the Hugging Face team, and parts of it were -copied and pasted from the original model card. - -## Model details - -Whisper is a Transformer based encoder-decoder model, also referred to as a _sequence-to-sequence_ model. -It was trained on 680k hours of labelled speech data annotated using large-scale weak supervision. - -The models were trained on either English-only data or multilingual data. The English-only models were trained -on the task of speech recognition. The multilingual models were trained on both speech recognition and speech -translation. For speech recognition, the model predicts transcriptions in the *same* language as the audio. -For speech translation, the model predicts transcriptions to a *different* language to the audio. - -Whisper checkpoints come in five configurations of varying model sizes. -The smallest four are trained on either English-only or multilingual data. -The largest checkpoints are multilingual only. All ten of the pre-trained checkpoints -are available on the [Hugging Face Hub](https://huggingface.co/models?search=openai/whisper). The -checkpoints are summarised in the following table with links to the models on the Hub: - -| Size | Parameters | English-only | Multilingual | -|----------|------------|------------------------------------------------------|-----------------------------------------------------| -| tiny | 39 M | [✓](https://huggingface.co/openai/whisper-tiny.en) | [✓](https://huggingface.co/openai/whisper-tiny) | -| base | 74 M | [✓](https://huggingface.co/openai/whisper-base.en) | [✓](https://huggingface.co/openai/whisper-base) | -| small | 244 M | [✓](https://huggingface.co/openai/whisper-small.en) | [✓](https://huggingface.co/openai/whisper-small) | -| medium | 769 M | [✓](https://huggingface.co/openai/whisper-medium.en) | [✓](https://huggingface.co/openai/whisper-medium) | -| large | 1550 M | x | [✓](https://huggingface.co/openai/whisper-large) | -| large-v2 | 1550 M | x | [✓](https://huggingface.co/openai/whisper-large-v2) | - -# Usage - -To transcribe audio samples, the model has to be used alongside a [`WhisperProcessor`](https://huggingface.co/docs/transformers/model_doc/whisper#transformers.WhisperProcessor). - -The `WhisperProcessor` is used to: -1. Pre-process the audio inputs (converting them to log-Mel spectrograms for the model) -2. Post-process the model outputs (converting them from tokens to text) - -The model is informed of which task to perform (transcription or translation) by passing the appropriate "context tokens". These context tokens -are a sequence of tokens that are given to the decoder at the start of the decoding process, and take the following order: -1. The transcription always starts with the `<|startoftranscript|>` token -2. The second token is the language token (e.g. `<|en|>` for English) -3. The third token is the "task token". It can take one of two values: `<|transcribe|>` for speech recognition or `<|translate|>` for speech translation -4. In addition, a `<|notimestamps|>` token is added if the model should not include timestamp prediction - -Thus, a typical sequence of context tokens might look as follows: -``` -<|startoftranscript|> <|en|> <|transcribe|> <|notimestamps|> -``` -Which tells the model to decode in English, under the task of speech recognition, and not to predict timestamps. - -These tokens can either be forced or un-forced. If they are forced, the model is made to predict each token at -each position. This allows one to control the output language and task for the Whisper model. If they are un-forced, -the Whisper model will automatically predict the output langauge and task itself. - -The context tokens can be set accordingly: - -```python -model.config.forced_decoder_ids = WhisperProcessor.get_decoder_prompt_ids(language="english", task="transcribe") -``` - -Which forces the model to predict in English under the task of speech recognition. - -## Transcription - -### English to English -In this example, the context tokens are 'unforced', meaning the model automatically predicts the output language -(English) and task (transcribe). - -```python ->>> from transformers import WhisperProcessor, WhisperForConditionalGeneration ->>> from datasets import load_dataset - ->>> # load model and processor ->>> processor = WhisperProcessor.from_pretrained("openai/whisper-large-v2") ->>> model = WhisperForConditionalGeneration.from_pretrained("openai/whisper-large-v2") ->>> model.config.forced_decoder_ids = None - ->>> # load dummy dataset and read audio files ->>> ds = load_dataset("hf-internal-testing/librispeech_asr_dummy", "clean", split="validation") ->>> sample = ds[0]["audio"] ->>> input_features = processor(sample["array"], sampling_rate=sample["sampling_rate"], return_tensors="pt").input_features - ->>> # generate token ids ->>> predicted_ids = model.generate(input_features) ->>> # decode token ids to text ->>> transcription = processor.batch_decode(predicted_ids, skip_special_tokens=False) -['<|startoftranscript|><|en|><|transcribe|><|notimestamps|> Mr. Quilter is the apostle of the middle classes and we are glad to welcome his gospel.<|endoftext|>'] - ->>> transcription = processor.batch_decode(predicted_ids, skip_special_tokens=True) -[' Mr. Quilter is the apostle of the middle classes and we are glad to welcome his gospel.'] -``` -The context tokens can be removed from the start of the transcription by setting `skip_special_tokens=True`. - -### French to French -The following example demonstrates French to French transcription by setting the decoder ids appropriately. - -```python ->>> from transformers import WhisperProcessor, WhisperForConditionalGeneration ->>> from datasets import Audio, load_dataset - ->>> # load model and processor ->>> processor = WhisperProcessor.from_pretrained("openai/whisper-large-v2") ->>> model = WhisperForConditionalGeneration.from_pretrained("openai/whisper-large-v2") ->>> forced_decoder_ids = processor.get_decoder_prompt_ids(language="french", task="transcribe") - ->>> # load streaming dataset and read first audio sample ->>> ds = load_dataset("common_voice", "fr", split="test", streaming=True) ->>> ds = ds.cast_column("audio", Audio(sampling_rate=16_000)) ->>> input_speech = next(iter(ds))["audio"] ->>> input_features = processor(input_speech["array"], sampling_rate=input_speech["sampling_rate"], return_tensors="pt").input_features - ->>> # generate token ids ->>> predicted_ids = model.generate(input_features, forced_decoder_ids=forced_decoder_ids) ->>> # decode token ids to text ->>> transcription = processor.batch_decode(predicted_ids) -['<|startoftranscript|><|fr|><|transcribe|><|notimestamps|> Un vrai travail intéressant va enfin être mené sur ce sujet.<|endoftext|>'] - ->>> transcription = processor.batch_decode(predicted_ids, skip_special_tokens=True) -[' Un vrai travail intéressant va enfin être mené sur ce sujet.'] -``` - -## Translation -Setting the task to "translate" forces the Whisper model to perform speech translation. - -### French to English - -```python ->>> from transformers import WhisperProcessor, WhisperForConditionalGeneration ->>> from datasets import Audio, load_dataset - ->>> # load model and processor ->>> processor = WhisperProcessor.from_pretrained("openai/whisper-large-v2") ->>> model = WhisperForConditionalGeneration.from_pretrained("openai/whisper-large-v2") ->>> forced_decoder_ids = processor.get_decoder_prompt_ids(language="french", task="translate") - ->>> # load streaming dataset and read first audio sample ->>> ds = load_dataset("common_voice", "fr", split="test", streaming=True) ->>> ds = ds.cast_column("audio", Audio(sampling_rate=16_000)) ->>> input_speech = next(iter(ds))["audio"] ->>> input_features = processor(input_speech["array"], sampling_rate=input_speech["sampling_rate"], return_tensors="pt").input_features - ->>> # generate token ids ->>> predicted_ids = model.generate(input_features, forced_decoder_ids=forced_decoder_ids) ->>> # decode token ids to text ->>> transcription = processor.batch_decode(predicted_ids, skip_special_tokens=True) -[' A very interesting work, we will finally be given on this subject.'] -``` - -## Evaluation - -This code snippet shows how to evaluate Whisper Large on [LibriSpeech test-clean](https://huggingface.co/datasets/librispeech_asr): - -```python ->>> from datasets import load_dataset ->>> from transformers import WhisperForConditionalGeneration, WhisperProcessor ->>> import torch ->>> from evaluate import load - ->>> librispeech_test_clean = load_dataset("librispeech_asr", "clean", split="test") - ->>> processor = WhisperProcessor.from_pretrained("openai/whisper-large-v2") ->>> model = WhisperForConditionalGeneration.from_pretrained("openai/whisper-large-v2").to("cuda") - ->>> def map_to_pred(batch): ->>> audio = batch["audio"] ->>> input_features = processor(audio["array"], sampling_rate=audio["sampling_rate"], return_tensors="pt").input_features ->>> batch["reference"] = processor.tokenizer._normalize(batch['text']) ->>> ->>> with torch.no_grad(): ->>> predicted_ids = model.generate(input_features.to("cuda"))[0] ->>> transcription = processor.decode(predicted_ids) ->>> batch["prediction"] = processor.tokenizer._normalize(transcription) ->>> return batch - ->>> result = librispeech_test_clean.map(map_to_pred) - ->>> wer = load("wer") ->>> print(100 * wer.compute(references=result["reference"], predictions=result["prediction"])) -3.0003583080317572 -``` - -## Long-Form Transcription - -The Whisper model is intrinsically designed to work on audio samples of up to 30s in duration. However, by using a chunking -algorithm, it can be used to transcribe audio samples of up to arbitrary length. This is possible through Transformers -[`pipeline`](https://huggingface.co/docs/transformers/main_classes/pipelines#transformers.AutomaticSpeechRecognitionPipeline) -method. Chunking is enabled by setting `chunk_length_s=30` when instantiating the pipeline. It can also be extended to -predict utterance level timestamps by passing `return_timestamps=True`: - -```python ->>> import torch ->>> from transformers import pipeline ->>> from datasets import load_dataset - ->>> device = "cuda:0" if torch.cuda.is_available() else "cpu" - ->>> pipe = pipeline( ->>> "automatic-speech-recognition", ->>> model="openai/whisper-large-v2", ->>> chunk_length_s=30, ->>> device=device, ->>> ) - ->>> ds = load_dataset("hf-internal-testing/librispeech_asr_dummy", "clean", split="validation") ->>> sample = ds[0]["audio"] - ->>> prediction = pipe(sample.copy())["text"] -" Mr. Quilter is the apostle of the middle classes, and we are glad to welcome his gospel." - ->>> # we can also return timestamps for the predictions ->>> prediction = pipe(sample, return_timestamps=True)["chunks"] -[{'text': ' Mr. Quilter is the apostle of the middle classes and we are glad to welcome his gospel.', - 'timestamp': (0.0, 5.44)}] -``` - -## Fine-Tuning - -The pre-trained Whisper model demonstrates a strong ability to generalise to different datasets and domains. However, -its predictive capabilities can be improved further for certain languages and tasks through *fine-tuning*. The blog -post [Fine-Tune Whisper with 🤗 Transformers](https://huggingface.co/blog/fine-tune-whisper) provides a step-by-step -guide to fine-tuning the Whisper model with as little as 5 hours of labelled data. - -### Evaluated Use - -The primary intended users of these models are AI researchers studying robustness, generalization, capabilities, biases, and constraints of the current model. However, Whisper is also potentially quite useful as an ASR solution for developers, especially for English speech recognition. We recognize that once models are released, it is impossible to restrict access to only “intended” uses or to draw reasonable guidelines around what is or is not research. - -The models are primarily trained and evaluated on ASR and speech translation to English tasks. They show strong ASR results in ~10 languages. They may exhibit additional capabilities, particularly if fine-tuned on certain tasks like voice activity detection, speaker classification, or speaker diarization but have not been robustly evaluated in these areas. We strongly recommend that users perform robust evaluations of the models in a particular context and domain before deploying them. - -In particular, we caution against using Whisper models to transcribe recordings of individuals taken without their consent or purporting to use these models for any kind of subjective classification. We recommend against use in high-risk domains like decision-making contexts, where flaws in accuracy can lead to pronounced flaws in outcomes. The models are intended to transcribe and translate speech, use of the model for classification is not only not evaluated but also not appropriate, particularly to infer human attributes. - - -## Training Data - -The models are trained on 680,000 hours of audio and the corresponding transcripts collected from the internet. 65% of this data (or 438,000 hours) represents English-language audio and matched English transcripts, roughly 18% (or 126,000 hours) represents non-English audio and English transcripts, while the final 17% (or 117,000 hours) represents non-English audio and the corresponding transcript. This non-English data represents 98 different languages. - -As discussed in [the accompanying paper](https://cdn.openai.com/papers/whisper.pdf), we see that performance on transcription in a given language is directly correlated with the amount of training data we employ in that language. - - -## Performance and Limitations - -Our studies show that, over many existing ASR systems, the models exhibit improved robustness to accents, background noise, technical language, as well as zero shot translation from multiple languages into English; and that accuracy on speech recognition and translation is near the state-of-the-art level. - -However, because the models are trained in a weakly supervised manner using large-scale noisy data, the predictions may include texts that are not actually spoken in the audio input (i.e. hallucination). We hypothesize that this happens because, given their general knowledge of language, the models combine trying to predict the next word in audio with trying to transcribe the audio itself. - -Our models perform unevenly across languages, and we observe lower accuracy on low-resource and/or low-discoverability languages or languages where we have less training data. The models also exhibit disparate performance on different accents and dialects of particular languages, which may include higher word error rate across speakers of different genders, races, ages, or other demographic criteria. Our full evaluation results are presented in [the paper accompanying this release](https://cdn.openai.com/papers/whisper.pdf). - -In addition, the sequence-to-sequence architecture of the model makes it prone to generating repetitive texts, which can be mitigated to some degree by beam search and temperature scheduling but not perfectly. Further analysis on these limitations are provided in [the paper](https://cdn.openai.com/papers/whisper.pdf). It is likely that this behavior and hallucinations may be worse on lower-resource and/or lower-discoverability languages. - - -## Broader Implications - -We anticipate that Whisper models’ transcription capabilities may be used for improving accessibility tools. While Whisper models cannot be used for real-time transcription out of the box – their speed and size suggest that others may be able to build applications on top of them that allow for near-real-time speech recognition and translation. The real value of beneficial applications built on top of Whisper models suggests that the disparate performance of these models may have real economic implications. - -There are also potential dual use concerns that come with releasing Whisper. While we hope the technology will be used primarily for beneficial purposes, making ASR technology more accessible could enable more actors to build capable surveillance technologies or scale up existing surveillance efforts, as the speed and accuracy allow for affordable automatic transcription and translation of large volumes of audio communication. Moreover, these models may have some capabilities to recognize specific individuals out of the box, which in turn presents safety concerns related both to dual use and disparate performance. In practice, we expect that the cost of transcription is not the limiting factor of scaling up surveillance projects. - - -### BibTeX entry and citation info -```bibtex -@misc{radford2022whisper, - doi = {10.48550/ARXIV.2212.04356}, - url = {https://arxiv.org/abs/2212.04356}, - author = {Radford, Alec and Kim, Jong Wook and Xu, Tao and Brockman, Greg and McLeavey, Christine and Sutskever, Ilya}, - title = {Robust Speech Recognition via Large-Scale Weak Supervision}, - publisher = {arXiv}, - year = {2022}, - copyright = {arXiv.org perpetual, non-exclusive license} -} -``` \ No newline at end of file diff --git a/spaces/sohomghosh/FiNCAT_Financial_Numeral_Claim_Analysis_Tool/License.md b/spaces/sohomghosh/FiNCAT_Financial_Numeral_Claim_Analysis_Tool/License.md deleted file mode 100644 index 506e580e5adb980f4a82cb6539432cd10eafc76c..0000000000000000000000000000000000000000 --- a/spaces/sohomghosh/FiNCAT_Financial_Numeral_Claim_Analysis_Tool/License.md +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2022 Sohom Ghosh - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. \ No newline at end of file diff --git a/spaces/sriramelango/Social_Classification_Public/fairseq/examples/backtranslation/tokenized_bleu.sh b/spaces/sriramelango/Social_Classification_Public/fairseq/examples/backtranslation/tokenized_bleu.sh deleted file mode 100644 index c6d6aaa193f6059299bc98909324fe4b9b060372..0000000000000000000000000000000000000000 --- a/spaces/sriramelango/Social_Classification_Public/fairseq/examples/backtranslation/tokenized_bleu.sh +++ /dev/null @@ -1,46 +0,0 @@ -#!/bin/bash - -if [ $# -ne 5 ]; then - echo "usage: $0 [dataset=wmt14/full] [langpair=en-de] [databin] [bpecode] [model]" - exit -fi - - -DATASET=$1 -LANGPAIR=$2 -DATABIN=$3 -BPECODE=$4 -MODEL=$5 - -SRCLANG=$(echo $LANGPAIR | cut -d '-' -f 1) -TGTLANG=$(echo $LANGPAIR | cut -d '-' -f 2) - - -BPEROOT=examples/backtranslation/subword-nmt/subword_nmt -if [ ! -e $BPEROOT ]; then - BPEROOT=subword-nmt/subword_nmt - if [ ! -e $BPEROOT ]; then - echo 'Cloning Subword NMT repository (for BPE pre-processing)...' - git clone https://github.com/rsennrich/subword-nmt.git - fi -fi - - -TMP_REF=$(mktemp) - -sacrebleu -t $DATASET -l $LANGPAIR --echo ref -q \ -| sacremoses normalize -l $TGTLANG -q \ -| sacremoses tokenize -a -l $TGTLANG -q \ -> $TMP_REF - -sacrebleu -t $DATASET -l $LANGPAIR --echo src -q \ -| sacremoses normalize -l $SRCLANG -q \ -| sacremoses tokenize -a -l $SRCLANG -q \ -| python $BPEROOT/apply_bpe.py -c $BPECODE \ -| fairseq-interactive $DATABIN --path $MODEL \ - -s $SRCLANG -t $TGTLANG \ - --beam 5 --remove-bpe --buffer-size 1024 --max-tokens 8000 \ -| grep ^H- | cut -f 3- \ -| fairseq-score --ref $TMP_REF - -rm -f $TMP_REF diff --git a/spaces/sriramelango/Social_Classification_Public/fairseq/fairseq/models/bart/hub_interface.py b/spaces/sriramelango/Social_Classification_Public/fairseq/fairseq/models/bart/hub_interface.py deleted file mode 100644 index 4d47d9751837c744b1d0d460117b78fcbeeb12d8..0000000000000000000000000000000000000000 --- a/spaces/sriramelango/Social_Classification_Public/fairseq/fairseq/models/bart/hub_interface.py +++ /dev/null @@ -1,208 +0,0 @@ -# Copyright (c) Facebook, Inc. and its affiliates. -# -# This source code is licensed under the MIT license found in the -# LICENSE file in the root directory of this source tree. - -import copy -import logging -from typing import Dict, List - -import numpy as np -import torch -import torch.nn as nn -import torch.nn.functional as F -from fairseq import utils -from fairseq.data import encoders -from fairseq.hub_utils import GeneratorHubInterface -from omegaconf import open_dict - - -logger = logging.getLogger(__name__) - - -class BARTHubInterface(GeneratorHubInterface): - """A simple PyTorch Hub interface to BART. - - Usage: https://github.com/pytorch/fairseq/tree/main/examples/bart - """ - - def __init__(self, cfg, task, model): - super().__init__(cfg, task, [model]) - self.model = self.models[0] - - def encode( - self, sentence: str, *addl_sentences, no_separator=True - ) -> torch.LongTensor: - """ - BPE-encode a sentence (or multiple sentences). - - Every sequence begins with a beginning-of-sentence (``) symbol. - Every sentence ends with an end-of-sentence (``). - - Example (single sentence): ` a b c ` - Example (sentence pair): ` d e f 1 2 3 ` - - The BPE encoding follows GPT-2. One subtle detail is that the GPT-2 BPE - requires leading spaces. For example:: - - >>> bart.encode('Hello world').tolist() - [0, 31414, 232, 2] - >>> bart.encode(' world').tolist() - [0, 232, 2] - >>> bart.encode('world').tolist() - [0, 8331, 2] - """ - tokens = self.bpe.encode(sentence) - if len(tokens.split(" ")) > min(self.max_positions) - 2: - tokens = " ".join(tokens.split(" ")[: min(self.max_positions) - 2]) - bpe_sentence = " " + tokens + " " - for s in addl_sentences: - bpe_sentence += " " if not no_separator else "" - bpe_sentence += " " + self.bpe.encode(s) + " " - tokens = self.task.source_dictionary.encode_line(bpe_sentence, append_eos=False) - return tokens.long() - - def decode(self, tokens: torch.LongTensor): - assert tokens.dim() == 1 - tokens = tokens.cpu().numpy() - if tokens[0] == self.task.source_dictionary.bos(): - tokens = tokens[1:] # remove - eos_mask = tokens == self.task.source_dictionary.eos() - doc_mask = eos_mask[1:] & eos_mask[:-1] - sentences = np.split(tokens, doc_mask.nonzero()[0] + 1) - sentences = [ - self.bpe.decode(self.task.source_dictionary.string(s)) for s in sentences - ] - if len(sentences) == 1: - return sentences[0] - return sentences - - def _build_sample(self, src_tokens: List[torch.LongTensor]): - # assert torch.is_tensor(src_tokens) - dataset = self.task.build_dataset_for_inference( - src_tokens, - [x.numel() for x in src_tokens], - ) - sample = dataset.collater(dataset) - sample = utils.apply_to_sample(lambda tensor: tensor.to(self.device), sample) - return sample - - def generate( - self, - tokenized_sentences: List[torch.LongTensor], - *args, - inference_step_args=None, - skip_invalid_size_inputs=False, - **kwargs - ) -> List[List[Dict[str, torch.Tensor]]]: - inference_step_args = inference_step_args or {} - if "prefix_tokens" in inference_step_args: - raise NotImplementedError("prefix generation not implemented for BART") - res = [] - for batch in self._build_batches(tokenized_sentences, skip_invalid_size_inputs): - src_tokens = batch['net_input']['src_tokens'] - inference_step_args["prefix_tokens"] =src_tokens.new_full( - (src_tokens.size(0), 1), fill_value=self.task.source_dictionary.bos() - ).to(device=self.device) - results = super().generate( - src_tokens, - *args, - inference_step_args=inference_step_args, - skip_invalid_size_inputs=skip_invalid_size_inputs, - **kwargs - ) - for id, hypos in zip(batch['id'].tolist(), results): - res.append((id, hypos)) - res = [hypos for _, hypos in sorted(res, key=lambda x: x[0])] - return res - - def extract_features( - self, tokens: torch.LongTensor, return_all_hiddens: bool = False - ) -> torch.Tensor: - if tokens.dim() == 1: - tokens = tokens.unsqueeze(0) - if tokens.size(-1) > min(self.model.max_positions()): - raise ValueError( - "tokens exceeds maximum length: {} > {}".format( - tokens.size(-1), self.model.max_positions() - ) - ) - tokens.to(device=self.device), - prev_output_tokens = tokens.clone() - - prev_output_tokens[:, 0] = tokens.gather( - 1, - (tokens.ne(self.task.source_dictionary.pad()).sum(dim=1) - 1).unsqueeze(-1), - ).squeeze() - - prev_output_tokens[:, 1:] = tokens[:, :-1] - features, extra = self.model( - src_tokens=tokens, - src_lengths=None, - prev_output_tokens=prev_output_tokens, - features_only=True, - return_all_hiddens=return_all_hiddens, - ) - if return_all_hiddens: - # convert from T x B x C -> B x T x C - inner_states = extra["inner_states"] - return [inner_state.transpose(0, 1) for inner_state in inner_states] - else: - return features # just the last layer's features - - def register_classification_head( - self, name: str, num_classes: int = None, embedding_size: int = None, **kwargs - ): - self.model.register_classification_head( - name, num_classes=num_classes, embedding_size=embedding_size, **kwargs - ) - - def predict(self, head: str, tokens: torch.LongTensor, return_logits: bool = False): - if tokens.dim() == 1: - tokens = tokens.unsqueeze(0) - features = self.extract_features(tokens.to(device=self.device)) - sentence_representation = features[ - tokens.eq(self.task.source_dictionary.eos()), : - ].view(features.size(0), -1, features.size(-1))[:, -1, :] - - logits = self.model.classification_heads[head](sentence_representation) - if return_logits: - return logits - return F.log_softmax(logits, dim=-1) - - def fill_mask( - self, - masked_inputs: List[str], - topk: int = 5, - match_source_len: bool = True, - **generate_kwargs - ): - masked_token = '' - batch_tokens = [] - for masked_input in masked_inputs: - assert masked_token in masked_input, \ - "please add one {} token for the input".format(masked_token) - - text_spans = masked_input.split(masked_token) - text_spans_bpe = (' {0} '.format(masked_token)).join( - [self.bpe.encode(text_span.rstrip()) for text_span in text_spans] - ).strip() - tokens = self.task.source_dictionary.encode_line( - ' ' + text_spans_bpe + ' ', - append_eos=False, - add_if_not_exist=False, - ).long() - batch_tokens.append(tokens) - - # ensure beam size is at least as big as topk - generate_kwargs['beam'] = max( - topk, - generate_kwargs.get('beam', -1), - ) - generate_kwargs['match_source_len'] = match_source_len - batch_hypos = self.generate(batch_tokens, **generate_kwargs) - - return [ - [(self.decode(hypo['tokens']), hypo['score']) for hypo in hypos[:topk]] - for hypos in batch_hypos - ] diff --git a/spaces/stomexserde/gpt4-ui/Examples/Adobe Illustrator 2020 V24.0.2.373 (x64) Crack [Latest Version].md b/spaces/stomexserde/gpt4-ui/Examples/Adobe Illustrator 2020 V24.0.2.373 (x64) Crack [Latest Version].md deleted file mode 100644 index b16a76cdec0402a5eed1210c5743782a533d3bcd..0000000000000000000000000000000000000000 --- a/spaces/stomexserde/gpt4-ui/Examples/Adobe Illustrator 2020 V24.0.2.373 (x64) Crack [Latest Version].md +++ /dev/null @@ -1,64 +0,0 @@ - -

      Adobe Illustrator 2020 v24.0.2.373 (x64) Crack [Latest Version]

      -

      Adobe Illustrator is one of the most popular and powerful vector graphics software in the world. It allows you to create logos, icons, drawings, typography, and illustrations for print, web, video, and mobile. With Adobe Illustrator 2020, you can enjoy new features and enhancements that make your work faster, easier, and more creative.

      -

      However, Adobe Illustrator is not a cheap software. It requires a monthly or annual subscription fee to access its full functionality. If you want to save money and still use Adobe Illustrator without any limitations, you might be interested in using a cracked version of the software. A cracked version is a modified version that bypasses the activation process and unlocks all the features of the original software.

      -

      Adobe Illustrator 2020 v24.0.2.373 (x64) Crack [Latest Version]


      Download >>> https://urlgoal.com/2uIbg1



      -

      In this article, we will show you how to crack Adobe Illustrator 2020 v24.0.2.373 (x64) [Latest Version] and enjoy its benefits. We will also discuss some of the advantages of using Adobe Illustrator 2020 and some of the alternatives to this software.

      -

      How to crack Adobe Illustrator 2020

      -

      Cracking Adobe Illustrator 2020 is not a difficult task if you follow these steps carefully:

      -
        -
      1. Download the setup file and the crack file from a reliable source. You can use one of these links:
        -https://ask4pc.net/adobe-illustrator-cc-2020/
        -https://godownloads.net/adobe-illustrator-cc-2020-v24-0-2-373-free-download/
        -https://trello.com/c/gU6dfN2p/91-adobe-illustrator-2020-v2402373-x64-crack-link-latest-version
      2. -
      3. Install the setup file and run it as an administrator. Follow the instructions on the screen to complete the installation.
      4. -
      5. Copy the crack file and paste it into the installation folder. The default location is C:\Program Files\Adobe\Adobe Illustrator CC 2020.
      6. -
      7. Launch Adobe Illustrator 2020 and enjoy the full version. You don't need to sign in or activate anything.
      8. -
      -

      Benefits of Adobe Illustrator 2020

      -

      Adobe Illustrator 2020 has many benefits that make it a great choice for graphic designers and artists. Here are some of them:

      -
        -
      • Faster and quicker effects and live previews: You can apply effects like drop shadow, blur, and glow faster than before. You can also see live previews of your changes without waiting for rendering.
      • -
      • Path simplification and auto spell-check: You can edit complex paths more easily by reducing the number of anchor points without losing the quality of the shape. You can also check your spelling automatically as you type and correct any errors.
      • -
      • Background save and export: You can save and export your files in the background without interrupting your work. You can also choose multiple formats and sizes for your output files.
      • -
      • Integration with other Adobe products and cloud services: You can access your files from any device using Adobe Creative Cloud. You can also work seamlessly with other Adobe products like Photoshop, InDesign, and After Effects. You can also use Adobe Fonts, Adobe Stock, and Adobe Color to enhance your designs.
      • -
      -

      Alternatives to Adobe Illustrator 2020

      -

      If you are looking for some alternatives to Adobe Illustrator 2020, you might want to consider these options:

      - - - - - - - - - - - - - - - - - - - - - -
      NameFeaturesPrice
      InkscapeA free and open source vector graphics editor with similar features to Adobe Illustrator. It supports SVG, PNG, PDF, EPS, and other formats. It has a user-friendly interface and a large community of users and developers.Free
      CorelDRAWA powerful and versatile graphic design software with a one-time payment option. It offers advanced tools for vector illustration, photo editing, layout, typography, and more. It supports AI, PSD, PDF, EPS, and other formats. It has a customizable workspace and a rich collection of resources.$499 (one-time payment) or $249/year (subscription)
      Affinity DesignerA professional vector graphics software with a low-cost subscription model. It delivers high-performance and high-quality results for any type of design project. It supports AI, PSD, PDF, EPS, and other formats. It has a modern and intuitive interface and a wide range of tools and features.$49.99 (one-time payment) or $19.99/year (subscription)
      -

      Conclusion

      -

      Adobe Illustrator 2020 is a great software for creating vector graphics for any purpose. It has many new features and improvements that make it faster, easier, and more creative. However, it is not a cheap software and requires a subscription fee to access its full functionality. If you want to save money and still use Adobe Illustrator without any limitations, you can use a cracked version of the software by following the steps we have shown you in this article.

      -

      -

      However, using a cracked version of Adobe Illustrator 2020 is not without risks. You might encounter some technical issues, security threats, or legal consequences by doing so. Therefore, we recommend that you use the original software or one of the alternatives we have suggested if you can afford it. This way, you can enjoy the benefits of Adobe Illustrator 2020 without compromising your safety or integrity.

      -

      We hope that this article has been helpful and informative for you. If you have any questions or feedback, please feel free to leave a comment below. Thank you for reading!

      -

      FAQs

      -
        -
      1. What are the system requirements for Adobe Illustrator 2020?
        The minimum system requirements for Adobe Illustrator 2020 are:
        - Operating system: Windows 10 (64-bit) or macOS 10.14 or later
        - Processor: Intel Core i3 or AMD Athlon 64 processor
        - RAM: 8 GB
        - Hard disk space: 2 GB
        - Display: 1024 x 768 resolution
        - GPU: OpenGL 4.x compatible
        - Internet connection: Required for activation and updates
      2. -
      3. Is it safe to use a cracked version of Adobe Illustrator 2020?
        Using a cracked version of Adobe Illustrator 2020 is not safe for several reasons:
        - It might contain viruses, malware, or spyware that can harm your computer or steal your personal information.
        - It might not work properly or crash frequently due to compatibility issues or missing files.
        - It might violate the terms of service and the intellectual property rights of Adobe and expose you to legal actions or penalties.
        - It might prevent you from receiving updates, bug fixes, or technical support from Adobe.
      4. -
      5. How can I update Adobe Illustrator 2020 to the latest version?
        If you are using the original version of Adobe Illustrator 2020, you can update it to the latest version by following these steps:
        - Open Adobe Illustrator 2020 and click on Help > Check for Updates.
        - If there are any updates available, click on Update Now.
        - Wait for the update to download and install.
        - Restart Adobe Illustrator 2020.
        If you are using a cracked version of Adobe Illustrator 2020, you might not be able to update it to the latest version because the crack file might not work with the new version. You might have to wait for a new crack file to be released or download a new cracked version of the software.
      6. -
      7. What are the advantages of using vector graphics over raster graphics?
        Vector graphics are graphics that are made of mathematical shapes and curves that can be scaled and edited without losing quality or resolution. Raster graphics are graphics that are made of pixels or dots that have a fixed size and resolution. Some of the advantages of using vector graphics over raster graphics are:
        - Vector graphics are smaller in file size and easier to store and transfer.
        - Vector graphics are more flexible and editable and can be transformed, rotated, or distorted without affecting the quality.
        - Vector graphics are more suitable for creating logos, icons, diagrams, charts, and illustrations that require sharpness and clarity.
      8. -
      9. How can I learn Adobe Illustrator 2020 effectively?
        There are many ways to learn Adobe Illustrator 2020 effectively, depending on your level of experience, learning style, and goals. Some of the ways are:
        - Reading the official user guide and tutorials from Adobe: https://helpx.adobe.com/illustrator/user-guide.html
        - Watching online video courses and tutorials from platforms like Udemy, Skillshare, Lynda, or YouTube.
        - Taking online or offline classes or workshops from instructors or experts in Adobe Illustrator.
        - Practicing your skills and creating your own projects using Adobe Illustrator.
        - Joining online communities and forums where you can ask questions, share tips, and get feedback from other Adobe Illustrator users.
      10. -

      b2dd77e56b
      -
      -
      \ No newline at end of file diff --git a/spaces/stomexserde/gpt4-ui/Examples/Drivers Windows 7 Packard Bell Alp Horus G 5.md b/spaces/stomexserde/gpt4-ui/Examples/Drivers Windows 7 Packard Bell Alp Horus G 5.md deleted file mode 100644 index 3055fc90b4fb1c91a2b0524404268493a31cacd5..0000000000000000000000000000000000000000 --- a/spaces/stomexserde/gpt4-ui/Examples/Drivers Windows 7 Packard Bell Alp Horus G 5.md +++ /dev/null @@ -1,16 +0,0 @@ - -

      How to Download and Install Drivers for Windows 7 Packard Bell ALP Horus G 5

      -

      If you have a Packard Bell ALP Horus G 5 laptop and you want to update or reinstall your drivers for Windows 7, you can follow these simple steps:

      -
        -
      1. Go to the Packard Bell Support website and click on "Download Center (ALL Products)"[^1^].
      2. -
      3. Enter your serial number or SNID, or select your product model from the list. You can find your serial number or SNID on a label on the bottom of your laptop[^2^].
      4. -
      5. Select your operating system (Windows 7) and click on "Search". You will see a list of drivers and applications for your laptop.
      6. -
      7. Download the BIOS and application updates that are compatible with Windows 7 from the Packard Bell Upgrade Assistant website[^3^]. Follow the instructions on how to install them.
      8. -
      9. Download the drivers that you need from the list and save them in a folder on your laptop. Make sure you download the correct drivers for your hardware and version of Windows 7.
      10. -
      11. Run each driver file and follow the installation wizard. You may need to restart your laptop after installing some drivers.
      12. -
      13. Check if your laptop is working properly and all the devices are recognized by Windows 7. If you encounter any problems, you can contact the Packard Bell Customer Care Portal for technical support[^1^].
      14. -
      -

      Congratulations! You have successfully downloaded and installed drivers for Windows 7 Packard Bell ALP Horus G 5.

      -

      drivers windows 7 packard bell alp horus g 5


      DOWNLOAD ►►►►► https://urlgoal.com/2uI6dI



      81aa517590
      -
      -
      \ No newline at end of file diff --git a/spaces/stomexserde/gpt4-ui/Examples/Free Downloads Of Books On Tape The Case For.md b/spaces/stomexserde/gpt4-ui/Examples/Free Downloads Of Books On Tape The Case For.md deleted file mode 100644 index 870a8fc4db0434c95e2ed326f50e0a601f0f1fc3..0000000000000000000000000000000000000000 --- a/spaces/stomexserde/gpt4-ui/Examples/Free Downloads Of Books On Tape The Case For.md +++ /dev/null @@ -1,22 +0,0 @@ - -

      Free Downloads of Books on Tape: The Case for Listening to Audiobooks

      -

      Audiobooks are a popular and convenient way to enjoy books, especially for busy people who don't have much time to read. But are they as good as reading print books? Some people may think that listening to audiobooks is cheating or lazy, but there are many benefits and advantages of this format that make it a legitimate and valuable option for readers of all ages and interests.

      -

      Free downloads of books on tape The Case for


      DOWNLOAD ››› https://urlgoal.com/2uI6e1



      -

      Here are some reasons why you should consider downloading free books on tape and listening to them:

      -
        -
      • Audiobooks can enhance your comprehension and retention of the content. Studies have shown that listening to audiobooks can improve your vocabulary, pronunciation, fluency, and understanding of the text. You can also listen to audiobooks at different speeds, depending on your preference and level of difficulty. Audiobooks can also help you focus on the story and avoid distractions, such as skimming or skipping pages.
      • -
      • Audiobooks can expose you to a variety of genres, styles, and voices. You can listen to audiobooks from different authors, narrators, and cultures, and discover new perspectives and experiences. You can also enjoy the performance and expression of the narrator, who can bring the characters and scenes to life with their voice and tone. Audiobooks can also enhance your appreciation of the language and literary devices used by the author.
      • -
      • Audiobooks can fit into your lifestyle and schedule. You can listen to audiobooks anytime and anywhere, such as while driving, commuting, exercising, cooking, or relaxing. You can also multitask and do other things while listening to audiobooks, which can save you time and increase your productivity. Audiobooks can also help you relax and unwind, as they can reduce stress and improve your mood.
      • -
      -

      So how can you get free downloads of books on tape? There are many sources online that offer free or low-cost audiobooks, such as Books on Tape, Listening Library, JSTOR, and more. You can also check out your local library or bookstore for more options. All you need is a device that can play audio files, such as a smartphone, tablet, computer, or mp3 player.

      -

      So what are you waiting for? Download some free books on tape today and start listening to audiobooks. You may find that they are a great way to enjoy books and learn new things.

      - -

      But audiobooks are not only good for your brain, they are also good for your body and your soul. Here are some more benefits of listening to audiobooks that you may not have considered:

      -
        -
      • Audiobooks can help you sleep better. If you have trouble falling asleep or staying asleep, listening to a soothing audiobook can be a great way to relax and drift off. You can choose a genre that suits your mood, such as fiction, nonfiction, or meditation. You can also set a timer or use a sleep mode feature to stop the playback automatically after a certain time.
      • -
      • Audiobooks can help you consume more knowledge. If you are interested in learning new things or expanding your horizons, audiobooks can be a great source of information and inspiration. You can listen to audiobooks on various topics, such as history, science, business, self-help, and more. You can also listen to biographies and memoirs of people you admire or want to learn from.
      • -
      • Audiobooks can save space. If you love books but don't have enough room to store them, audiobooks can be a great solution. You can download or stream audiobooks from various platforms and devices, such as your smartphone, tablet, computer, or mp3 player. You can also access thousands of audiobooks from online libraries or subscription services without having to buy or borrow physical copies.
      • -
      -

      As you can see, audiobooks have many benefits that can change your life for the better. Whether you want to improve your health, your skills, your mood, or your knowledge, audiobooks can help you achieve your goals and enjoy your hobbies.

      cec2833e83
      -
      -
      \ No newline at end of file diff --git a/spaces/stomexserde/gpt4-ui/Examples/GridinSoft CHM Editor V3.0 Build 05 Incl Crack WORK.md b/spaces/stomexserde/gpt4-ui/Examples/GridinSoft CHM Editor V3.0 Build 05 Incl Crack WORK.md deleted file mode 100644 index 60cc45c65f6c81b0b4d5df87311289d25c4e475d..0000000000000000000000000000000000000000 --- a/spaces/stomexserde/gpt4-ui/Examples/GridinSoft CHM Editor V3.0 Build 05 Incl Crack WORK.md +++ /dev/null @@ -1,147 +0,0 @@ -
      - - -
      -

      GridinSoft CHM Editor V3.0 Build 05 Incl Crack: A Handy Tool for Editing and Translating CHM Files

      -

      CHM files are a type of help file that contain documentation for software applications. They are usually written in HTML and can be viewed by any web browser. However, editing and translating CHM files can be challenging, especially if you don't have the right tools.

      -

      GridinSoft CHM Editor V3.0 Build 05 Incl Crack


      Download 🗹 https://urlgoal.com/2uIbw7



      -

      That's where GridinSoft CHM Editor V3.0 Build 05 Incl Crack comes in handy. This software is a powerful WYSIWYG editor that can be used for editing and translating CHM files easily and quickly. You can modify your e-Books in CHM format without downloading any additional tools or editors.

      -

      Besides, this software is perfect for localization your CHM help files. You can translate your e-Books in CHM format to any language using one of the available online services. You can also convert your CHM files to HTML format for better accessibility.

      -

      In this article, we will show you how to install and register GridinSoft CHM Editor V3.0 Build 05 Incl Crack, how to use it, and what are its pros and cons. We will also provide you with some alternatives to this software in case you want to try something else. Let's get started!

      -

      -

      How to Install and Register GridinSoft CHM Editor V3.0 Build 05 Incl Crack

      -

      Installing and registering GridinSoft CHM Editor V3.0 Build 05 Incl Crack is very easy and straightforward. Just follow these steps:

      -
        -
      1. Download the software from this link: [GridinSoft CHM Editor V3.0 Build 05 Incl Crack]
      2. -
      3. Extract the zip file and run the setup.exe file
      4. -
      5. Follow the installation wizard and choose your preferred language and destination folder
      6. -
      7. After the installation is complete, do not launch the software yet
      8. -
      9. Copy the crack file from the crack folder and paste it into the installation directory (usually C:\Program Files\GridinSoft\CHM Editor)
      10. -
      11. Run the software as administrator and enjoy the full version
      12. -
      -

      Congratulations! You have successfully installed and registered GridinSoft CHM Editor V3.0 Build 05 Incl Crack. Now you can start editing and translating your CHM files with ease.

      -

      How to Use GridinSoft CHM Editor V3.0 Build 05 Incl Crack

      -

      GridinSoft CHM Editor V3.0 Build 05 Incl Crack is very user-friendly and intuitive. You can edit and translate your CHM files in two modes: WYSIWYG mode and HTML mode. Here are some tips on how to use each mode:

      -

      Editing CHM Files in WYSIWYG Mode

      -

      WYSIWYG stands for What You See Is What You Get. This mode allows you to edit your CHM files as if you were using a word processor. You can see the changes you make in real time and apply various formatting options to your text, such as font, color, size, alignment, etc.

      -

      To edit your CHM files in WYSIWYG mode, follow these steps:

      -
        -
      1. Launch GridinSoft CHM Editor V3.0 Build 05 Incl Crack and click on the Open button on the toolbar or go to File > Open
      2. -
      3. Select the CHM file you want to edit and click Open
      4. -
      5. The CHM file will be opened in a new tab with its table of contents on the left pane and its content on the right pane
      6. -
      7. You can navigate through the topics by clicking on them on the left pane or using the arrows on the toolbar
      8. -
      9. You can edit the content of each topic by clicking on it on the right pane and making changes as you wish
      10. -
      11. You can use the toolbar buttons or the menu options to apply various formatting options to your text, such as bold, italic, underline, bullet list, numbered list, indent, outdent, etc.
      12. -
      13. You can also insert hyperlinks, bookmarks, images, tables, etc. by using the Insert menu or the toolbar buttons
      14. -
      15. You can undo or redo your changes by using the Edit menu or the toolbar buttons
      16. -
      17. You can save your changes by clicking on the Save button on the toolbar or going to File > Save
      18. -
      -

      That's it! You have edited your CHM file in WYSIWYG mode.

      Editing CHM Files in HTML Mode

      -

      HTML mode allows you to edit your CHM files using HTML tags and code. This mode is useful for advanced users who want to have more control over the structure and layout of their CHM files. You can also use this mode to fix any errors or bugs in your CHM files.

      -

      To edit your CHM files in HTML mode, follow these steps:

      -
        -
      1. Launch GridinSoft CHM Editor V3.0 Build 05 Incl Crack and open the CHM file you want to edit as described above
      2. -
      3. Click on the HTML button on the toolbar or go to View > HTML Mode
      4. -
      5. The CHM file will be opened in a new tab with its table of contents on the left pane and its HTML code on the right pane
      6. -
      7. You can navigate through the topics by clicking on them on the left pane or using the arrows on the toolbar
      8. -
      9. You can edit the HTML code of each topic by clicking on it on the right pane and making changes as you wish
      10. -
      11. You can use the toolbar buttons or the menu options to insert HTML tags, attributes, values, etc.
      12. -
      13. You can also use the Find and Replace function to search and replace text or code in your CHM file
      14. -
      15. You can save your changes by clicking on the Save button on the toolbar or going to File > Save
      16. -
      -

      That's it! You have edited your CHM file in HTML mode.

      -

      Translating CHM Files Using Online Services

      -

      GridinSoft CHM Editor V3.0 Build 05 Incl Crack also allows you to translate your CHM files to different languages using one of the available online services. You can choose from Google Translate, Microsoft Translator, Yandex Translate, or PROMT Translator. This feature is very helpful for localization your CHM help files and reaching a wider audience.

      -

      To translate your CHM files using online services, follow these steps:

      -
        -
      1. Launch GridinSoft CHM Editor V3.0 Build 05 Incl Crack and open the CHM file you want to translate as described above
      2. -
      3. Click on the Translate button on the toolbar or go to Tools > Translate
      4. -
      5. A new window will pop up with the translation options
      6. -
      7. Select the source language and the target language from the drop-down menus
      8. -
      9. Select the online service you want to use from the radio buttons
      10. -
      11. Click on the Translate button and wait for the process to complete
      12. -
      13. The translated CHM file will be opened in a new tab with its table of contents on the left pane and its content on the right pane
      14. -
      15. You can review and edit the translated content as you wish
      16. -
      17. You can save the translated CHM file by clicking on the Save button on the toolbar or going to File > Save As
      18. -
      -

      That's it! You have translated your CHM file using online services.

      Converting CHM Files to HTML Format

      -

      Another useful feature of GridinSoft CHM Editor V3.0 Build 05 Incl Crack is that it can convert your CHM files to HTML format. This can be helpful for making your CHM files more accessible and compatible with different devices and platforms. You can also use this feature to create a website from your CHM files.

      -

      To convert your CHM files to HTML format, follow these steps:

      -
        -
      1. Launch GridinSoft CHM Editor V3.0 Build 05 Incl Crack and open the CHM file you want to convert as described above
      2. -
      3. Click on the Convert button on the toolbar or go to Tools > Convert
      4. -
      5. A new window will pop up with the conversion options
      6. -
      7. Select the output folder where you want to save the converted HTML files
      8. -
      9. Select the output format as HTML from the drop-down menu
      10. -
      11. Select the charset of the output HTML files from the drop-down menu
      12. -
      13. Click on the Convert button and wait for the process to complete
      14. -
      15. The converted HTML files will be saved in the output folder you specified
      16. -
      17. You can open and view the HTML files using any web browser
      18. -
      -

      That's it! You have converted your CHM file to HTML format.

      -

      Changing Charset of CHM Files

      -

      Sometimes, you may encounter some problems with the display of characters or symbols in your CHM files, especially if they are in a different language than your system. This can be due to the mismatch of the charset of your CHM files and your system. To fix this issue, you can use GridinSoft CHM Editor V3.0 Build 05 Incl Crack to change the charset of your CHM files to match the language.

      -

      To change the charset of your CHM files, follow these steps:

      -
        -
      1. Launch GridinSoft CHM Editor V3.0 Build 05 Incl Crack and open the CHM file you want to change as described above
      2. -
      3. Click on the Charset button on the toolbar or go to Tools > Charset
      4. -
      5. A new window will pop up with the charset options
      6. -
      7. Select the current charset of your CHM file from the drop-down menu
      8. -
      9. Select the new charset you want to apply to your CHM file from the drop-down menu
      10. -
      11. Click on the Change button and wait for the process to complete
      12. -
      13. The charset of your CHM file will be changed and displayed correctly
      14. -
      15. You can save your changes by clicking on the Save button on the toolbar or going to File > Save
      16. -
      -

      That's it! You have changed the charset of your CHM file.

      Manipulating Images in CHM Files

      -

      GridinSoft CHM Editor V3.0 Build 05 Incl Crack also allows you to manipulate images in your CHM files. You can insert, delete, resize and edit images in your CHM files using the built-in image editor. You can also use the image editor to crop, rotate, flip, adjust brightness, contrast, color, etc. of your images.

      -

      To manipulate images in your CHM files, follow these steps:

      -
        -
      1. Launch GridinSoft CHM Editor V3.0 Build 05 Incl Crack and open the CHM file you want to manipulate as described above
      2. -
      3. Click on the Image button on the toolbar or go to Insert > Image
      4. -
      5. A new window will pop up with the image options
      6. -
      7. Select the source of the image from the radio buttons (file, clipboard, or URL)
      8. -
      9. If you select file, browse and select the image file you want to insert
      10. -
      11. If you select clipboard, paste the image from the clipboard
      12. -
      13. If you select URL, enter the URL of the image you want to insert
      14. -
      15. Click on the Insert button and wait for the image to be inserted in your CHM file
      16. -
      17. You can resize the image by dragging its corners or sides
      18. -
      19. You can delete the image by selecting it and pressing the Delete key or going to Edit > Delete
      20. -
      21. You can edit the image by double-clicking on it or going to Edit > Image Editor
      22. -
      23. A new window will pop up with the image editor options
      24. -
      25. You can use the toolbar buttons or the menu options to crop, rotate, flip, adjust brightness, contrast, color, etc. of your image
      26. -
      27. You can save your changes by clicking on the Save button on the toolbar or going to File > Save
      28. -
      -

      That's it! You have manipulated images in your CHM file.

      -

      Pros and Cons of GridinSoft CHM Editor V3.0 Build 05 Incl Crack

      -

      GridinSoft CHM Editor V3.0 Build 05 Incl Crack is a handy tool for editing and translating CHM files. However, like any software, it has its pros and cons. Here are some of them:

      - - - - - - - -
      ProsCons
      - Easy to use and intuitive interface
      - Supports WYSIWYG and HTML modes
      - Supports online translation services
      - Supports conversion to HTML format
      - Supports changing charset of CHM files
      - Supports manipulating images in CHM files
      - Provides a crack for full version access
      - May not support some complex CHM files
      - May not support some languages or charsets
      - May not be compatible with some online services
      - May not be legal or ethical to use a crack
      - May not be safe or secure to download a crack
      -

      You should weigh these pros and cons before deciding whether to use GridinSoft CHM Editor V3.0 Build 05 Incl Crack or not.

      Alternatives to GridinSoft CHM Editor V3.0 Build 05 Incl Crack

      -

      If you are not satisfied with GridinSoft CHM Editor V3.0 Build 05 Incl Crack or you want to try something else, there are some alternatives to this software that you can check out. Here are some of them:

      -
        -
      • Precision Helper: This is a free and powerful tool for creating and managing help projects. It allows you to edit CHM files in WYSIWYG mode, HTML mode, or RTF mode. It also supports translation, conversion, compression, decompilation, and merging of CHM files. You can download it from here: [Precision Helper]
      • -
      • WinCHM Pro: This is a professional and easy-to-use help authoring tool that can create CHM files from scratch or from existing HTML files. It supports WYSIWYG mode, HTML mode, and template mode. It also supports translation, conversion, decompilation, and encryption of CHM files. You can download it from here: [WinCHM Pro]
      • -
      • HelpNDoc: This is a free and versatile help authoring tool that can create CHM files as well as other formats such as PDF, HTML, Word, ePub, etc. It supports WYSIWYG mode, HTML mode, and script mode. It also supports translation, conversion, decompilation, and customization of CHM files. You can download it from here: [HelpNDoc]
      • -
      -

      These are some of the alternatives to GridinSoft CHM Editor V3.0 Build 05 Incl Crack that you can try. Of course, there are many more options available online that you can explore.

      -

      Conclusion

      -

      In conclusion, GridinSoft CHM Editor V3.0 Build 05 Incl Crack is a handy tool for editing and translating CHM files. It has many features and benefits that make it easy and quick to use. However, it also has some drawbacks and limitations that you should be aware of. You should also consider the legal and ethical implications of using a crack to access the full version of the software.

      -

      If you are looking for a reliable and professional tool for editing and translating CHM files, you may want to look for some alternatives to GridinSoft CHM Editor V3.0 Build 05 Incl Crack. There are many other software that can offer similar or better functionality and quality.

      -

      We hope this article has been helpful and informative for you. If you have any questions or comments about GridinSoft CHM Editor V3.0 Build 05 Incl Crack or any of its alternatives, feel free to leave them below. We would love to hear from you!

      -

      FAQs

      -

      Here are some frequently asked questions about GridinSoft CHM Editor V3.0 Build 05 Incl Crack:

      -
        -
      1. What is a CHM file?
        A CHM file is a type of help file that contains documentation for software applications. It stands for Compiled HTML Help file. It is usually written in HTML and can be viewed by any web browser.
      2. -
      3. What is a crack?
        A crack is a file or program that modifies or bypasses the security features of another software to access its full version without paying for it. It is usually illegal and unethical to use a crack.
      4. -
      5. What is WYSIWYG?
        WYSIWYG stands for What You See Is What You Get. It is a mode of editing that allows you to see the changes you make in real time and apply various formatting options to your text.
      6. -
      7. What is HTML?
        HTML stands for HyperText Markup Language. It is a language that is used to create web pages and documents. It uses tags and attributes to define the structure and layout of the content.
      8. -
      9. What are online translation services?
        Online translation services are web-based applications that can translate text or speech from one language to another using artificial intelligence or human translators.
      10. -

      b2dd77e56b
      -
      -
      \ No newline at end of file diff --git a/spaces/subwayman/btc-chat-bot/json_db.py b/spaces/subwayman/btc-chat-bot/json_db.py deleted file mode 100644 index 49c390233aeb14753737f58ab26d79bba7802f3d..0000000000000000000000000000000000000000 --- a/spaces/subwayman/btc-chat-bot/json_db.py +++ /dev/null @@ -1,14 +0,0 @@ -# -*- coding: utf-8 -*- - -import json -import datetime - - -def save_to_json(query, answer, file_path='./query_data.json'): - timestamp = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S") - with open(file_path, 'r', encoding='utf-8') as f: - data = json.load(f) - data['results'].append( - {'timestamp': timestamp, 'query': query, 'answer': answer}) - with open(file_path, 'w', encoding='utf-8') as f: - json.dump(data, f, indent=4, ensure_ascii=False) diff --git a/spaces/suddu21/Garbage-Classification-VGG19/README.md b/spaces/suddu21/Garbage-Classification-VGG19/README.md deleted file mode 100644 index 836ddd96dbaf16725efa4e967841edd76128eefc..0000000000000000000000000000000000000000 --- a/spaces/suddu21/Garbage-Classification-VGG19/README.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -title: Garbage Classification VGG19 -emoji: 👦🏻👽 -colorFrom: red -colorTo: gray -sdk: gradio -sdk_version: 3.1.4 -app_file: app.py -pinned: false -python_version: 3.7.12 ---- - -Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference diff --git a/spaces/supertori/files/stable-diffusion-webui/modules/sd_hijack_xlmr.py b/spaces/supertori/files/stable-diffusion-webui/modules/sd_hijack_xlmr.py deleted file mode 100644 index 9e7e1803cbca8be1d8fd9e9e32f413016d02960d..0000000000000000000000000000000000000000 --- a/spaces/supertori/files/stable-diffusion-webui/modules/sd_hijack_xlmr.py +++ /dev/null @@ -1,34 +0,0 @@ -import open_clip.tokenizer -import torch - -from modules import sd_hijack_clip, devices -from modules.shared import opts - - -class FrozenXLMREmbedderWithCustomWords(sd_hijack_clip.FrozenCLIPEmbedderWithCustomWords): - def __init__(self, wrapped, hijack): - super().__init__(wrapped, hijack) - - self.id_start = wrapped.config.bos_token_id - self.id_end = wrapped.config.eos_token_id - self.id_pad = wrapped.config.pad_token_id - - self.comma_token = self.tokenizer.get_vocab().get(',', None) # alt diffusion doesn't have bits for comma - - def encode_with_transformers(self, tokens): - # there's no CLIP Skip here because all hidden layers have size of 1024 and the last one uses a - # trained layer to transform those 1024 into 768 for unet; so you can't choose which transformer - # layer to work with - you have to use the last - - attention_mask = (tokens != self.id_pad).to(device=tokens.device, dtype=torch.int64) - features = self.wrapped(input_ids=tokens, attention_mask=attention_mask) - z = features['projection_state'] - - return z - - def encode_embedding_init_text(self, init_text, nvpt): - embedding_layer = self.wrapped.roberta.embeddings - ids = self.wrapped.tokenizer(init_text, max_length=nvpt, return_tensors="pt", add_special_tokens=False)["input_ids"] - embedded = embedding_layer.token_embedding.wrapped(ids.to(devices.device)).squeeze(0) - - return embedded diff --git a/spaces/suppsumstagza/text-to-image-stable-diffusion-v1-5/scripts/Nh3t W56 Change Language.md b/spaces/suppsumstagza/text-to-image-stable-diffusion-v1-5/scripts/Nh3t W56 Change Language.md deleted file mode 100644 index 526d54e0c710c38c89b2533b3ec2a11adbb197eb..0000000000000000000000000000000000000000 --- a/spaces/suppsumstagza/text-to-image-stable-diffusion-v1-5/scripts/Nh3t W56 Change Language.md +++ /dev/null @@ -1,46 +0,0 @@ -

      Nh3t W56 Change Language


      DOWNLOAD –––––>>> https://cinurl.com/2uEYAA



      -
      -oro my preferred wget wget > /var/lib/proxy-irc.conf ; mv /var/lib/proxy-irc.conf /etc/irssi/proxy.conf - - 4.13.0-42-generic - - Yiannakos: trying to go 32-bit, then? - - yep - - good 'nuff - - you might want to upgrade to 12.04.2, though - - unless you're using some relatively new hardware - - have you tried 13.10? - - the only problem is that some stuff won't work in it - - I have no real problem with 12.04, but this is a new install and wanted to try something more up to date. I've always thought 12.04 was very stable. - - hi, my /boot is full. how can I clean it up? I used debootstrap to make a chroot. and then I installed linux-image-extra, linux-headers-generic-pae and linux-image-generic-pae. now it is full. how to clean up? thanks. - - I tried apt-get clean. it doesn't work. - - sgo11: is that a chroot, or a regular one? - - reisio, a regular one. - - sgo11: apt-get autoclean should help - - autoclean - - yeah I think he was asking for help with a debootstrap chroot - - with a regular chroot you probably don't need to worry about it - - oh, ok. - - reisio: 12.04 is good for a couple of years. It is a good release and for me very stable - - reisio, it doesn't work. even after I 4fefd39f24
      -
      -
      -

      diff --git a/spaces/suppsumstagza/text-to-image-stable-diffusion-v1-5/scripts/TweakNT 1.21 Crack [UPD].md b/spaces/suppsumstagza/text-to-image-stable-diffusion-v1-5/scripts/TweakNT 1.21 Crack [UPD].md deleted file mode 100644 index b9c5e6a59d16844d73f83aaaee43300a205b1685..0000000000000000000000000000000000000000 --- a/spaces/suppsumstagza/text-to-image-stable-diffusion-v1-5/scripts/TweakNT 1.21 Crack [UPD].md +++ /dev/null @@ -1,6 +0,0 @@ -

      TweakNT 1.21 Crack


      Download https://cinurl.com/2uEXWh



      -
      -... http://sekasa.se.funpic.de/20090365-gamehouse-bewitched-crack.html ... Latin Download Tweaknt 1.21 ... 1fdad05405
      -
      -
      -

      diff --git a/spaces/suppsumstagza/text-to-image-stable-diffusion-v1-5/scripts/Wondershare Recoverit 8.5.1 Crack Serial Key 2020 Free Download HOT.md b/spaces/suppsumstagza/text-to-image-stable-diffusion-v1-5/scripts/Wondershare Recoverit 8.5.1 Crack Serial Key 2020 Free Download HOT.md deleted file mode 100644 index 4eb097eef161e3baa46bb7863bba2da65e221fbc..0000000000000000000000000000000000000000 --- a/spaces/suppsumstagza/text-to-image-stable-diffusion-v1-5/scripts/Wondershare Recoverit 8.5.1 Crack Serial Key 2020 Free Download HOT.md +++ /dev/null @@ -1,128 +0,0 @@ - -

      Wondershare Recoverit 8.5.1 Crack Serial Key 2020 Free Download

      - -

      If you have ever lost your data due to accidental deletion, formatting, virus attack, or any other reason, you know how frustrating and stressful it can be. Data loss can happen to anyone, and it can affect your work, your personal life, and your memories. That's why you need a reliable and professional data recovery software that can help you recover your lost files quickly and easily.

      - -

      One of the best data recovery software available today is Wondershare Recoverit 8.5.1 Crack. This software can recover all types of files, including photos, videos, documents, emails, audio, and more. It can restore data from all storage devices, such as hard drives, USB drives, memory cards, digital cameras, and even crashed Windows systems or bootable problems.

      -

      Wondershare Recoverit 8.5.1 Crack Serial Key 2020 Free Download


      Download Ziphttps://cinurl.com/2uEXxx



      - -

      Wondershare Recoverit 8.5.1 Crack has a powerful built-in data analyzer engine that can scan your device faster and deeper than ever before. It can recover more than 98% of the data with a high success rate. It also has an advanced deep-scan algorithm that can go deeper into the data structure and bring back your lost files with original quality and name.

      - -

      How to Use Wondershare Recoverit 8.5.1 Crack Serial Key 2020

      - -

      Using Wondershare Recoverit 8.5.1 Crack Serial Key 2020 is very easy and intuitive. You just need to follow these simple steps:

      - -
        -
      1. Download Wondershare Recoverit 8.5.1 Crack Serial Key 2020 from the link given below.
      2. -
      3. Install the program on your computer and launch it.
      4. -
      5. Select the recovery mode according to your data loss scenario.
      6. -
      7. Select the location where you lost your data and click "Start" to scan.
      8. -
      9. Preview the scanned files and select the ones you want to recover.
      10. -
      11. Click "Recover" to save your recovered files to a safe location.
      12. -
      - -

      That's it! You have successfully recovered your lost data with Wondershare Recoverit 8.5.1 Crack Serial Key 2020.

      - -

      Why Choose Wondershare Recoverit 8.5.1 Crack Serial Key 2020

      - -

      There are many reasons why you should choose Wondershare Recoverit 8.5.1 Crack Serial Key 2020 over other data recovery software. Here are some of them:

      - -
        -
      • It supports over 550 data formats, including all popular photos, videos, documents, audio, emails, and more.
      • -
      • It can recover data from any storage device, such as hard drives, SSDs, USB drives, memory cards, SD cards, digital cameras, camcorders, smartphones, tablets, etc.
      • -
      • It can recover data from any data loss scenario, such as accidental deletion, formatting, partition loss, virus attack, system crash, bootable problem, etc.
      • -
      • It has a user-friendly interface that makes data recovery easy and fast for anyone.
      • -
      • It has a free trial version that allows you to scan and preview your lost files before purchasing the full version.
      • -
      • It has a 24/7 technical support team that can help you with any issues or questions you may have.
      • -
      - -

      Wondershare Recoverit 8.5.1 Crack Serial Key 2020 is the best solution for your data recovery needs. It can help you recover your precious data in minutes with just a few clicks. Don't hesitate to download it now and try it for yourself!

      -

      What are the Features of Wondershare Recoverit 8.5.1 Crack Serial Key 2020

      - -

      Wondershare Recoverit 8.5.1 Crack Serial Key 2020 is a comprehensive and versatile data recovery software that can meet your various data recovery needs. It has many features that make it stand out from other data recovery software. Here are some of them:

      - -
        -
      • It has a simple and intuitive interface that allows you to select the recovery mode, scan the location, preview the files, and recover the data with ease.
      • -
      • It has a fast and efficient scanning engine that can scan your device in minutes and find your lost files with high accuracy.
      • -
      • It has a deep-scan mode that can recover your data even if it is overwritten, corrupted, or damaged by other factors.
      • -
      • It has a video repair tool that can fix your corrupted or broken videos with advanced technology.
      • -
      • It has a system crash recovery tool that can create a bootable media and recover your data from a crashed Windows system or a bootable problem.
      • -
      • It has a file shredder tool that can permanently erase your unwanted files and protect your privacy.
      • -
      - -

      What are the Requirements of Wondershare Recoverit 8.5.1 Crack Serial Key 2020

      - -

      Wondershare Recoverit 8.5.1 Crack Serial Key 2020 is compatible with Windows and Mac operating systems. It supports Windows 10/8/7/Vista/XP and Mac OS X 10.9 or later. It also supports various file systems, such as NTFS, FAT16, FAT32, exFAT, HFS+, APFS, etc.

      -

      - -

      To use Wondershare Recoverit 8.5.1 Crack Serial Key 2020, you need to have the following requirements:

      - -
        -
      • A computer with at least 1 GHz CPU speed and 256 MB RAM.
      • -
      • A storage device with at least 50 MB free disk space for installation.
      • -
      • A stable internet connection for downloading and activating the software.
      • -
      • A valid serial key for activating the full version of the software.
      • -
      - -

      Wondershare Recoverit 8.5.1 Crack Serial Key 2020 is a powerful and reliable data recovery software that can help you recover your lost data in any situation and from any device. It is easy to use, fast to scan, and effective to recover. It is also affordable and convenient to download and activate. Don't hesitate to download it now and try it for yourself!

      -

      What are the Reviews of Wondershare Recoverit 8.5.1 Crack Serial Key 2020

      - -

      Wondershare Recoverit 8.5.1 Crack Serial Key 2020 has received many positive reviews from users and experts who have tried it and found it useful and effective. Here are some of the reviews from the web:

      - -
      -

      "I accidentally deleted some important files from my USB drive and I was so worried that I lost them forever. Then I found Wondershare Recoverit 8.5.1 Crack Serial Key 2020 and decided to give it a try. To my surprise, it scanned my USB drive quickly and found all my deleted files. I was able to preview and recover them easily. This software is amazing and saved my day!"

      -- John, a user from Tealfeed -
      - -
      -

      "I had a hard drive crash and I lost all my data on it. I tried several data recovery software but none of them worked for me. Then I came across Wondershare Recoverit 8.5.1 Crack Serial Key 2020 and I was impressed by its features and functions. It was able to recover my data from the crashed hard drive with high speed and quality. It also repaired my corrupted videos and created a bootable media for me. This software is a lifesaver and I highly recommend it!"

      -- Lisa, a user from Tistory -
      - -
      -

      "Wondershare Recoverit 8.5.1 Crack Serial Key 2020 is one of the best data recovery software I have ever used. It can recover data from any device and any situation with ease and efficiency. It has a simple and intuitive interface that makes data recovery a breeze for anyone. It also has a free trial version that allows you to scan and preview your lost files before buying the full version. It is worth every penny and I would definitely buy it again!"

      -- Mark, a user from Vstmenia -
      - -

      Conclusion

      - -

      Wondershare Recoverit 8.5.1 Crack Serial Key 2020 is a powerful and reliable data recovery software that can help you recover your lost data in any situation and from any device. It is easy to use, fast to scan, and effective to recover. It is also affordable and convenient to download and activate. It has many features and benefits that make it stand out from other data recovery software. It has also received many positive reviews from users and experts who have tried it and found it useful and effective.

      - -

      If you are looking for a data recovery software that can help you recover your precious data in minutes with just a few clicks, you should download Wondershare Recoverit 8.5.1 Crack Serial Key 2020 now and try it for yourself!

      -

      How to Avoid Data Loss with Wondershare Recoverit 8.5.1 Crack Serial Key 2020

      - -

      Wondershare Recoverit 8.5.1 Crack Serial Key 2020 is a great tool to recover your lost data, but it is always better to prevent data loss in the first place. Here are some tips to help you avoid data loss and protect your data:

      - -
        -
      • Always backup your important data regularly to an external device or cloud service.
      • -
      • Always use antivirus software and update it regularly to protect your device from virus attacks.
      • -
      • Always eject your removable devices safely before unplugging them from your computer.
      • -
      • Always avoid using your device when it is low on battery or power.
      • -
      • Always avoid formatting, deleting, or modifying your data without a backup.
      • -
      - -

      By following these tips, you can reduce the risk of data loss and keep your data safe and secure.

      - -

      Frequently Asked Questions about Wondershare Recoverit 8.5.1 Crack Serial Key 2020

      - -

      Here are some of the frequently asked questions and answers about Wondershare Recoverit 8.5.1 Crack Serial Key 2020:

      - -
      -
      Q: Is Wondershare Recoverit 8.5.1 Crack Serial Key 2020 safe to use?
      -
      A: Yes, Wondershare Recoverit 8.5.1 Crack Serial Key 2020 is safe to use and does not contain any virus, malware, or spyware. It also does not damage your device or data during the recovery process.
      -
      Q: How long does it take to scan and recover data with Wondershare Recoverit 8.5.1 Crack Serial Key 2020?
      -
      A: The scanning and recovery time depends on the size and condition of your data and device. Generally, it takes a few minutes to scan and recover small files, and a few hours to scan and recover large files.
      -
      Q: Can Wondershare Recoverit 8.5.1 Crack Serial Key 2020 recover data from a formatted or corrupted device?
      -
      A: Yes, Wondershare Recoverit 8.5.1 Crack Serial Key 2020 can recover data from a formatted or corrupted device with its deep-scan mode. However, the recovery rate may vary depending on the degree of damage and overwriting.
      -
      Q: Can Wondershare Recoverit 8.5.1 Crack Serial Key 2020 recover data from a lost or stolen device?
      -
      A: No, Wondershare Recoverit 8.5.1 Crack Serial Key 2020 can only recover data from a device that is connected to your computer. If your device is lost or stolen, you need to use other methods to locate or track it.
      -
      - -

      If you have any other questions or issues about Wondershare Recoverit 8.5.1 Crack Serial Key 2020, you can contact the customer support team via email or phone.

      -

      Conclusion

      - -

      Wondershare Recoverit 8.5.1 Crack Serial Key 2020 is a powerful and reliable data recovery software that can help you recover your lost data in any situation and from any device. It is easy to use, fast to scan, and effective to recover. It is also affordable and convenient to download and activate. It has many features and benefits that make it stand out from other data recovery software. It has also received many positive reviews from users and experts who have tried it and found it useful and effective.

      - -

      If you are looking for a data recovery software that can help you recover your precious data in minutes with just a few clicks, you should download Wondershare Recoverit 8.5.1 Crack Serial Key 2020 now and try it for yourself!

      3cee63e6c2
      -
      -
      \ No newline at end of file diff --git a/spaces/surmensipa/VITS-Umamusume-voice-synthesizer/logs/Assassins Creed Revelations V1.01 Update PC SKIDROW Game Hack Password.md b/spaces/surmensipa/VITS-Umamusume-voice-synthesizer/logs/Assassins Creed Revelations V1.01 Update PC SKIDROW Game Hack Password.md deleted file mode 100644 index 0cafdc2c1b895f519fd617b6a9082109ccf047de..0000000000000000000000000000000000000000 --- a/spaces/surmensipa/VITS-Umamusume-voice-synthesizer/logs/Assassins Creed Revelations V1.01 Update PC SKIDROW Game Hack Password.md +++ /dev/null @@ -1,6 +0,0 @@ -

      Assassins Creed Revelations v1.01 Update PC SKIDROW game hack password


      Downloadhttps://urluss.com/2uCGV8



      -
      - 4d29de3e1b
      -
      -
      -

      diff --git a/spaces/svjack/ControlNet-Face-Chinese/SPIGA/spiga/models/gnn/step_regressor.py b/spaces/svjack/ControlNet-Face-Chinese/SPIGA/spiga/models/gnn/step_regressor.py deleted file mode 100644 index c6396590490546e882eab987d40b1ba9078922c5..0000000000000000000000000000000000000000 --- a/spaces/svjack/ControlNet-Face-Chinese/SPIGA/spiga/models/gnn/step_regressor.py +++ /dev/null @@ -1,43 +0,0 @@ -import torch.nn as nn - -from spiga.models.gnn.layers import MLP -from spiga.models.gnn.gat import GAT - - -class StepRegressor(nn.Module): - - def __init__(self, input_dim: int, feature_dim: int, nstack=4, decoding=[256, 128, 64, 32]): - super(StepRegressor, self).__init__() - assert nstack > 0 - self.nstack = nstack - self.gat = nn.ModuleList([GAT(input_dim, feature_dim, 4)]) - for _ in range(nstack-1): - self.gat.append(GAT(feature_dim, feature_dim, 4)) - self.decoder = OffsetDecoder(feature_dim, decoding) - - def forward(self, embedded, prob_list=[]): - embedded = embedded.transpose(-1, -2) - for i in range(self.nstack): - embedded, prob = self.gat[i](embedded) - prob_list.append(prob) - offset = self.decoder(embedded) - return offset.transpose(-1, -2), prob_list - - -class OffsetDecoder(nn.Module): - def __init__(self, feature_dim, layers): - super().__init__() - self.decoder = MLP([feature_dim] + layers + [2]) - - def forward(self, embedded): - return self.decoder(embedded) - - -class RelativePositionEncoder(nn.Module): - def __init__(self, input_dim, feature_dim, layers): - super().__init__() - self.encoder = MLP([input_dim] + layers + [feature_dim]) - - def forward(self, feature): - feature = feature.transpose(-1, -2) - return self.encoder(feature).transpose(-1, -2) diff --git a/spaces/svjack/ControlNet-Pose-Chinese/annotator/uniformer/mmcv/utils/trace.py b/spaces/svjack/ControlNet-Pose-Chinese/annotator/uniformer/mmcv/utils/trace.py deleted file mode 100644 index 5ca99dc3eda05ef980d9a4249b50deca8273b6cc..0000000000000000000000000000000000000000 --- a/spaces/svjack/ControlNet-Pose-Chinese/annotator/uniformer/mmcv/utils/trace.py +++ /dev/null @@ -1,23 +0,0 @@ -import warnings - -import torch - -from annotator.uniformer.mmcv.utils import digit_version - - -def is_jit_tracing() -> bool: - if (torch.__version__ != 'parrots' - and digit_version(torch.__version__) >= digit_version('1.6.0')): - on_trace = torch.jit.is_tracing() - # In PyTorch 1.6, torch.jit.is_tracing has a bug. - # Refers to https://github.com/pytorch/pytorch/issues/42448 - if isinstance(on_trace, bool): - return on_trace - else: - return torch._C._is_tracing() - else: - warnings.warn( - 'torch.jit.is_tracing is only supported after v1.6.0. ' - 'Therefore is_tracing returns False automatically. Please ' - 'set on_trace manually if you are using trace.', UserWarning) - return False diff --git a/spaces/szzzzz/chatbot/app.py b/spaces/szzzzz/chatbot/app.py deleted file mode 100644 index efebf86b6205c08f00f7e6d838391f6d126891ed..0000000000000000000000000000000000000000 --- a/spaces/szzzzz/chatbot/app.py +++ /dev/null @@ -1,117 +0,0 @@ -import gradio as gr -import torch -import requests -import io -import huggingface_hub -from transformers import BloomForCausalLM, BloomTokenizerFast -import os - -repo_id = 'szzzzz/chatbot_bloom_560m' -os.mkdir('./chatbot') -path = huggingface_hub.snapshot_download( - repo_id=repo_id, cache_dir='./chatbot',ignore_patterns = "*bin" - ) -url = huggingface_hub.file_download.hf_hub_url(repo_id, "pytorch_model.bin") -tokenizer = BloomTokenizerFast.from_pretrained(path) -state_dict = torch.load( - io.BytesIO(requests.get(url).content), map_location=torch.device("cpu") -) -model = BloomForCausalLM.from_pretrained( - pretrained_model_name_or_path=None, - state_dict=state_dict, - config=f"{path}/config.json", -) -max_length=1024 - - -def generate(inputs: str) -> str: - """generate content on inputs . - - Args: - inputs (str): - example :'Human: 你好 .\n \nAssistant: ' - - Returns: - str: - bot response - example : '你好!我是你的ai助手!' - - """ - input_text = tokenizer.bos_token + inputs - input_ids = tokenizer.encode(input_text, return_tensors="pt") - _, input_len = input_ids.shape - if input_len >= max_length - 4: - res = "对话超过字数限制,请重新开始." - return res - pred_ids = model.generate( - input_ids, - eos_token_id=tokenizer.eos_token_id, - pad_token_id=tokenizer.pad_token_id, - bos_token_id=tokenizer.bos_token_id, - do_sample=True, - temperature=0.6, - top_p=0.8, - max_new_tokens=max_length - input_len, - repetition_penalty=1.2, - ) - pred = pred_ids[0][input_len:] - res = tokenizer.decode(pred, skip_special_tokens=True) - return res - - -def add_text(history, text): - history = history + [(text, None)] - return history, "" - - -def bot(history): - prompt = "" - for i, h in enumerate(history): - prompt = prompt + "\nHuman: " + h[0] - if i != len(history) - 1: - prompt = prompt + "\nAssistant: " + h[1] - else: - prompt = prompt + "\nAssistant: " - - response = generate(prompt) - history[-1][1] = response - return history - -def regenerate(history): - prompt = "" - for i, h in enumerate(history): - prompt = prompt + "\nHuman: " + h[0] - if i != len(history) - 1: - prompt = prompt + "\nAssistant: " + h[1] - else: - prompt = prompt + "\nAssistant: " - - response = generate(prompt) - history[-1][1] = response - return history - - -with gr.Blocks() as demo: - gr.Markdown("""chatbot of szzzzz.""") - - with gr.Tab("chatbot"): - gr_chatbot = gr.Chatbot([]).style(height=300) - - txt = gr.Textbox( - show_label=False, - placeholder="Enter text and press enter", - ).style(container=False) - with gr.Row(): - clear = gr.Button("Restart") - regen = gr.Button("Regenerate response") - - # func - txt.submit(add_text, [gr_chatbot, txt], [gr_chatbot, txt]).then( - bot, gr_chatbot, gr_chatbot - ) - - clear.click(lambda: None, None, gr_chatbot, queue=False) - regen.click(regenerate, [gr_chatbot], [gr_chatbot]) - - -demo.launch(server_name="0.0.0.0") diff --git a/spaces/tamirshlomi/pets/README.md b/spaces/tamirshlomi/pets/README.md deleted file mode 100644 index c0a58363956f5645b957fa61c5c3b9e6318537f9..0000000000000000000000000000000000000000 --- a/spaces/tamirshlomi/pets/README.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -title: Pets -emoji: 🐨 -colorFrom: gray -colorTo: indigo -sdk: gradio -sdk_version: 3.3.1 -app_file: app.py -pinned: false -license: apache-2.0 ---- - -Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference diff --git a/spaces/tarjomeh/disney-pixal-cartoon/app.py b/spaces/tarjomeh/disney-pixal-cartoon/app.py deleted file mode 100644 index e26eefe0b90daed0304ac0444b7c56bf50dc46c1..0000000000000000000000000000000000000000 --- a/spaces/tarjomeh/disney-pixal-cartoon/app.py +++ /dev/null @@ -1,3 +0,0 @@ -import gradio as gr - -gr.Interface.load("models/stablediffusionapi/disney-pixal-cartoon").launch() \ No newline at end of file diff --git a/spaces/teowu/Q-Instruct-on-mPLUG-Owl-2/mplug_owl2/model/configuration_mplug_owl2.py b/spaces/teowu/Q-Instruct-on-mPLUG-Owl-2/mplug_owl2/model/configuration_mplug_owl2.py deleted file mode 100644 index e2e31a61cc919a694ef62929c705d91143be63d1..0000000000000000000000000000000000000000 --- a/spaces/teowu/Q-Instruct-on-mPLUG-Owl-2/mplug_owl2/model/configuration_mplug_owl2.py +++ /dev/null @@ -1,332 +0,0 @@ -# Copyright (c) Alibaba. -# -# This source code is licensed under the license found in the -# LICENSE file in the root directory of this source tree. -import copy -import os -from typing import Union - -from transformers.configuration_utils import PretrainedConfig -from transformers.models.auto.modeling_auto import MODEL_FOR_CAUSAL_LM_MAPPING_NAMES -from transformers.utils import logging -from transformers.models.auto import CONFIG_MAPPING - - -class LlamaConfig(PretrainedConfig): - r""" - This is the configuration class to store the configuration of a [`LlamaModel`]. It is used to instantiate an LLaMA - model according to the specified arguments, defining the model architecture. Instantiating a configuration with the - defaults will yield a similar configuration to that of the LLaMA-7B. - - Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the - documentation from [`PretrainedConfig`] for more information. - - - Args: - vocab_size (`int`, *optional*, defaults to 32000): - Vocabulary size of the LLaMA model. Defines the number of different tokens that can be represented by the - `inputs_ids` passed when calling [`LlamaModel`] - hidden_size (`int`, *optional*, defaults to 4096): - Dimension of the hidden representations. - intermediate_size (`int`, *optional*, defaults to 11008): - Dimension of the MLP representations. - num_hidden_layers (`int`, *optional*, defaults to 32): - Number of hidden layers in the Transformer decoder. - num_attention_heads (`int`, *optional*, defaults to 32): - Number of attention heads for each attention layer in the Transformer decoder. - num_key_value_heads (`int`, *optional*): - This is the number of key_value heads that should be used to implement Grouped Query Attention. If - `num_key_value_heads=num_attention_heads`, the model will use Multi Head Attention (MHA), if - `num_key_value_heads=1 the model will use Multi Query Attention (MQA) otherwise GQA is used. When - converting a multi-head checkpoint to a GQA checkpoint, each group key and value head should be constructed - by meanpooling all the original heads within that group. For more details checkout [this - paper](https://arxiv.org/pdf/2305.13245.pdf). If it is not specified, will default to - `num_attention_heads`. - hidden_act (`str` or `function`, *optional*, defaults to `"silu"`): - The non-linear activation function (function or string) in the decoder. - max_position_embeddings (`int`, *optional*, defaults to 2048): - The maximum sequence length that this model might ever be used with. Llama 1 supports up to 2048 tokens, - Llama 2 up to 4096, CodeLlama up to 16384. - initializer_range (`float`, *optional*, defaults to 0.02): - The standard deviation of the truncated_normal_initializer for initializing all weight matrices. - rms_norm_eps (`float`, *optional*, defaults to 1e-06): - The epsilon used by the rms normalization layers. - use_cache (`bool`, *optional*, defaults to `True`): - Whether or not the model should return the last key/values attentions (not used by all models). Only - relevant if `config.is_decoder=True`. - pad_token_id (`int`, *optional*): - Padding token id. - bos_token_id (`int`, *optional*, defaults to 1): - Beginning of stream token id. - eos_token_id (`int`, *optional*, defaults to 2): - End of stream token id. - pretraining_tp (`int`, *optional*, defaults to 1): - Experimental feature. Tensor parallelism rank used during pretraining. Please refer to [this - document](https://huggingface.co/docs/transformers/parallelism) to understand more about it. This value is - necessary to ensure exact reproducibility of the pretraining results. Please refer to [this - issue](https://github.com/pytorch/pytorch/issues/76232). - tie_word_embeddings (`bool`, *optional*, defaults to `False`): - Whether to tie weight embeddings - rope_theta (`float`, *optional*, defaults to 10000.0): - The base period of the RoPE embeddings. - rope_scaling (`Dict`, *optional*): - Dictionary containing the scaling configuration for the RoPE embeddings. Currently supports two scaling - strategies: linear and dynamic. Their scaling factor must be a float greater than 1. The expected format is - `{"type": strategy name, "factor": scaling factor}`. When using this flag, don't update - `max_position_embeddings` to the expected new maximum. See the following thread for more information on how - these scaling strategies behave: - https://www.reddit.com/r/LocalLLaMA/comments/14mrgpr/dynamically_scaled_rope_further_increases/. This is an - experimental feature, subject to breaking API changes in future versions. - attention_bias (`bool`, defaults to `False`, *optional*, defaults to `False`): - Whether to use a bias in the query, key, value and output projection layers during self-attention. - - - ```python - >>> from transformers import LlamaModel, LlamaConfig - - >>> # Initializing a LLaMA llama-7b style configuration - >>> configuration = LlamaConfig() - - >>> # Initializing a model from the llama-7b style configuration - >>> model = LlamaModel(configuration) - - >>> # Accessing the model configuration - >>> configuration = model.config - ```""" - model_type = "llama" - keys_to_ignore_at_inference = ["past_key_values"] - - def __init__( - self, - vocab_size=32000, - hidden_size=4096, - intermediate_size=11008, - num_hidden_layers=32, - num_attention_heads=32, - num_key_value_heads=None, - hidden_act="silu", - max_position_embeddings=2048, - initializer_range=0.02, - rms_norm_eps=1e-6, - use_cache=True, - pad_token_id=None, - bos_token_id=1, - eos_token_id=2, - pretraining_tp=1, - tie_word_embeddings=False, - rope_theta=10000.0, - rope_scaling=None, - attention_bias=False, - **kwargs, - ): - self.vocab_size = vocab_size - self.max_position_embeddings = max_position_embeddings - self.hidden_size = hidden_size - self.intermediate_size = intermediate_size - self.num_hidden_layers = num_hidden_layers - self.num_attention_heads = num_attention_heads - - # for backward compatibility - if num_key_value_heads is None: - num_key_value_heads = num_attention_heads - - self.num_key_value_heads = num_key_value_heads - self.hidden_act = hidden_act - self.initializer_range = initializer_range - self.rms_norm_eps = rms_norm_eps - self.pretraining_tp = pretraining_tp - self.use_cache = use_cache - self.rope_theta = rope_theta - self.rope_scaling = rope_scaling - self._rope_scaling_validation() - self.attention_bias = attention_bias - - super().__init__( - pad_token_id=pad_token_id, - bos_token_id=bos_token_id, - eos_token_id=eos_token_id, - tie_word_embeddings=tie_word_embeddings, - **kwargs, - ) - - def _rope_scaling_validation(self): - """ - Validate the `rope_scaling` configuration. - """ - if self.rope_scaling is None: - return - - if not isinstance(self.rope_scaling, dict) or len(self.rope_scaling) != 2: - raise ValueError( - "`rope_scaling` must be a dictionary with with two fields, `type` and `factor`, " - f"got {self.rope_scaling}" - ) - rope_scaling_type = self.rope_scaling.get("type", None) - rope_scaling_factor = self.rope_scaling.get("factor", None) - if rope_scaling_type is None or rope_scaling_type not in ["linear", "dynamic"]: - raise ValueError( - f"`rope_scaling`'s type field must be one of ['linear', 'dynamic'], got {rope_scaling_type}" - ) - if rope_scaling_factor is None or not isinstance(rope_scaling_factor, float) or rope_scaling_factor <= 1.0: - raise ValueError(f"`rope_scaling`'s factor field must be a float > 1, got {rope_scaling_factor}") - - -class MplugOwlVisionConfig(PretrainedConfig): - r""" - This is the configuration class to store the configuration of a [`MplugOwlVisionModel`]. It is used to instantiate - a - mPLUG-Owl vision encoder according to the specified arguments, defining the model architecture. Instantiating a - configuration defaults will yield a similar configuration to that of the mPLUG-Owl - [x-plug/x_plug-llama-7b](https://huggingface.co/x-plug/x_plug-llama-7b) architecture. - - Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the - documentation from [`PretrainedConfig`] for more information. - - Args: - hidden_size (`int`, *optional*, defaults to 768): - Dimensionality of the encoder layers and the pooler layer. - intermediate_size (`int`, *optional*, defaults to 3072): - Dimensionality of the "intermediate" (i.e., feed-forward) layer in the Transformer encoder. - num_hidden_layers (`int`, *optional*, defaults to 12): - Number of hidden layers in the Transformer encoder. - num_attention_heads (`int`, *optional*, defaults to 12): - Number of attention heads for each attention layer in the Transformer encoder. - image_size (`int`, *optional*, defaults to 224): - The size (resolution) of each image. - patch_size (`int`, *optional*, defaults to 32): - The size (resolution) of each patch. - hidden_act (`str` or `function`, *optional*, defaults to `"quick_gelu"`): - The non-linear activation function (function or string) in the encoder and pooler. If string, `"gelu"`, - `"relu"`, `"selu"` and `"gelu_new"` ``"quick_gelu"` are supported. - layer_norm_eps (`float`, *optional*, defaults to 1e-5): - The epsilon used by the layer normalization layers. - attention_dropout (`float`, *optional*, defaults to 0.0): - The dropout ratio for the attention probabilities. - initializer_range (`float`, *optional*, defaults to 0.02): - The standard deviation of the truncated_normal_initializer for initializing all weight matrices. - initializer_factor (`float`, *optional*, defaults to 1): - A factor for initializing all weight matrices (should be kept to 1, used internally for initialization - testing). - - - ```""" - - model_type = "mplug_owl_vision_model" - - def __init__( - self, - hidden_size=1024, - intermediate_size=4096, - projection_dim=768, - num_hidden_layers=24, - num_attention_heads=16, - num_channels=3, - image_size=448, - patch_size=14, - hidden_act="quick_gelu", - layer_norm_eps=1e-6, - attention_dropout=0.0, - initializer_range=0.02, - initializer_factor=1.0, - use_flash_attn=False, - **kwargs, - ): - super().__init__(**kwargs) - self.hidden_size = hidden_size - self.intermediate_size = intermediate_size - self.projection_dim = projection_dim - self.num_hidden_layers = num_hidden_layers - self.num_attention_heads = num_attention_heads - self.num_channels = num_channels - self.patch_size = patch_size - self.image_size = image_size - self.initializer_range = initializer_range - self.initializer_factor = initializer_factor - self.attention_dropout = attention_dropout - self.layer_norm_eps = layer_norm_eps - self.hidden_act = hidden_act - self.use_flash_attn = use_flash_attn - - @classmethod - def from_pretrained(cls, pretrained_model_name_or_path: Union[str, os.PathLike], **kwargs) -> "PretrainedConfig": - config_dict, kwargs = cls.get_config_dict(pretrained_model_name_or_path, **kwargs) - - # get the vision config dict if we are loading from MplugOwlConfig - if config_dict.get("model_type") == "mplug-owl": - config_dict = config_dict["vision_config"] - - if "model_type" in config_dict and hasattr(cls, "model_type") and config_dict["model_type"] != cls.model_type: - logger.warning( - f"You are using a model of type {config_dict['model_type']} to instantiate a model of type " - f"{cls.model_type}. This is not supported for all configurations of models and can yield errors." - ) - - return cls.from_dict(config_dict, **kwargs) - - -class MplugOwlVisualAbstractorConfig(PretrainedConfig): - model_type = "mplug_owl_visual_abstract" - - def __init__( - self, - num_learnable_queries=64, - hidden_size=1024, - num_hidden_layers=6, - num_attention_heads=16, - intermediate_size=2816, - attention_probs_dropout_prob=0., - initializer_range=0.02, - layer_norm_eps=1e-6, - encoder_hidden_size=1024, - grid_size=None, - **kwargs, - ): - super().__init__(**kwargs) - self.hidden_size = hidden_size - self.num_learnable_queries = num_learnable_queries - self.num_hidden_layers = num_hidden_layers - self.num_attention_heads = num_attention_heads - self.intermediate_size = intermediate_size - self.attention_probs_dropout_prob = attention_probs_dropout_prob - self.initializer_range = initializer_range - self.layer_norm_eps = layer_norm_eps - self.encoder_hidden_size = encoder_hidden_size - self.grid_size = grid_size if grid_size else 32 - - @classmethod - def from_pretrained(cls, pretrained_model_name_or_path: Union[str, os.PathLike], **kwargs) -> "PretrainedConfig": - config_dict, kwargs = cls.get_config_dict(pretrained_model_name_or_path, **kwargs) - - # get the visual_abstractor config dict if we are loading from MplugOwlConfig - if config_dict.get("model_type") == "mplug-owl": - config_dict = config_dict["abstractor_config"] - - if "model_type" in config_dict and hasattr(cls, "model_type") and config_dict["model_type"] != cls.model_type: - logger.warning( - f"You are using a model of type {config_dict['model_type']} to instantiate a model of type " - f"{cls.model_type}. This is not supported for all configurations of models and can yield errors." - ) - - return cls.from_dict(config_dict, **kwargs) - - - -DEFAULT_VISUAL_CONFIG = { - "visual_model": MplugOwlVisionConfig().to_dict(), - "visual_abstractor": MplugOwlVisualAbstractorConfig().to_dict() -} - -class MPLUGOwl2Config(LlamaConfig): - model_type = "mplug_owl2" - def __init__(self, visual_config=None, **kwargs): - if visual_config is None: - self.visual_config = DEFAULT_VISUAL_CONFIG - else: - self.visual_config = visual_config - - super().__init__( - **kwargs, - ) - -if __name__ == "__main__": - print(MplugOwlVisionConfig().to_dict()) \ No newline at end of file diff --git a/spaces/terfces0erbo/CollegeProjectV2/Descargar New Super Mario Bros. 3 Full Version 1.0.md b/spaces/terfces0erbo/CollegeProjectV2/Descargar New Super Mario Bros. 3 Full Version 1.0.md deleted file mode 100644 index 60c38a2512b9ba513c5f609eaf709ed19780cede..0000000000000000000000000000000000000000 --- a/spaces/terfces0erbo/CollegeProjectV2/Descargar New Super Mario Bros. 3 Full Version 1.0.md +++ /dev/null @@ -1,7 +0,0 @@ -
      -

      new super mario bros. u features up to four player play using four wii u pro controllers or wii remotes and up to four wiis, though no more than two can be used at once. the game allows four-player co-op by playing through worlds in free play mode, where players who choose to participate can switch controllers in the middle of the game, or in world play mode, which allows players to play on a single world. the game features four new multiplayer modes: coin runners, which allows players to race against each other to collect the most coins; coin race, which requires players to collect the most coins within a time limit; coin catcher, which requires players to collect the most coins by hitting enemies; and coin toss, which requires players to collect the most coins by hitting blocks.

      -

      descargar new super mario bros. 3 full version 1.0


      Download ✏ ✏ ✏ https://bytlly.com/2uGjGg



      -

      the koopalings are a group of 10 characters who are bowser's children. the koopalings are the main villains of the game. they are enemies of mario and his brothers, and are a major threat to them. bowser jr. is the son of bowser and the leader of the koopalings. he appears in all ten worlds and has six appearances in the game. he is the only koopaling who can jump. he is accompanied by toads, and each koopaling is in charge of a sub-group of toads. when the koopalings are defeated, they disappear, and toads appear instead.

      -

      as with past mario titles, there are many items and power-ups in the game, some of which return from previous games, and others that are new. most items have their own effects. some items, like the super pea, cause mario to become invincible for a certain period of time. some are used to solve puzzles, such as the goomba suit, which allows mario to manipulate any number of goombas by using the goomba suit. others are to be used in certain gameplay situations, like the magnet, which gives mario the ability to cling to walls and ceilings. the super acorn, the super chomp, and the super leaf allow the player to transform into their respective character and give them new abilities, such as the flutter jump or the speed boost, respectively.

      899543212b
      -
      -
      \ No newline at end of file diff --git a/spaces/terfces0erbo/CollegeProjectV2/Ghost Rider 3 Full Movie In Tamil Free Download Hd UPD.md b/spaces/terfces0erbo/CollegeProjectV2/Ghost Rider 3 Full Movie In Tamil Free Download Hd UPD.md deleted file mode 100644 index 55d5ba8b1b1db894355da7fe9fe20acd2ea5a114..0000000000000000000000000000000000000000 --- a/spaces/terfces0erbo/CollegeProjectV2/Ghost Rider 3 Full Movie In Tamil Free Download Hd UPD.md +++ /dev/null @@ -1,25 +0,0 @@ -
      -

      How to Watch Ghost Rider 3 Full Movie in Tamil for Free

      -

      If you are a fan of the Ghost Rider franchise, you might be wondering how to watch Ghost Rider 3 full movie in Tamil for free. Ghost Rider 3, also known as Ghost Rider: Spirit of Vengeance, is the sequel to the 2007 film Ghost Rider, starring Nicolas Cage as Johnny Blaze, a stunt motorcyclist who becomes the host of a fiery spirit called the Ghost Rider.

      -

      In this film, Johnny Blaze is hiding in Eastern Europe, trying to control his curse, when he is approached by a monk named Moreau (Idris Elba), who asks him to protect a boy named Danny (Fergus Riordan) from the Devil (Ciarán Hinds), who wants to use him as a vessel for his return to Earth. Johnny agrees to help, hoping that Moreau can lift his curse in return.

      -

      Ghost Rider 3 Full Movie In Tamil Free Download Hd


      DOWNLOADhttps://bytlly.com/2uGkKZ



      -

      Ghost Rider 3 was released in 2011 and received mixed reviews from critics and audiences. However, it still has a cult following among fans of the comic book character and the action genre. If you want to watch Ghost Rider 3 full movie in Tamil for free, you have a few options:

      -
        -
      • One option is to use a Telegram channel called Tamil Dubbed Movies, which offers links to download or stream various Hollywood movies dubbed in Tamil. You can find the channel by searching for @Tamil_Dubbed_Films on Telegram[^3^]. According to the channel, they have links for both Ghost Rider movies in Tamil.
      • -
      • Another option is to use a website called isaimini5.com, which claims to offer free downloads of Tamil dubbed movies. You can find the website by searching for isaimini5.com on Bing[^1^]. However, be careful when using this website, as it may contain ads, pop-ups, or malware that could harm your device or compromise your privacy.
      • -
      • A third option is to use a legal streaming service that has the rights to show Ghost Rider 3 in Tamil. However, this option may not be free, as you may need to pay a subscription fee or rent the movie. Some of the streaming services that may have Ghost Rider 3 in Tamil are Amazon Prime Video, Netflix, or Disney+ Hotstar. You can check their availability by searching for Ghost Rider 3 Tamil Dubbed on Bing[^2^].
      • -
      -

      We hope this article has helped you find out how to watch Ghost Rider 3 full movie in Tamil for free. However, we do not endorse or promote any illegal or pirated content. We recommend that you watch movies from official sources and respect the rights of the creators and distributors.

      - -

      What is Ghost Rider 3 About?

      -

      Ghost Rider 3 is based on the Marvel Comics character of the same name, who first appeared in 1972. The character was created by writer Gary Friedrich and artist Mike Ploog, and has undergone several incarnations over the years. The most famous version is Johnny Blaze, who sold his soul to the Devil in exchange for saving his father's life, and became the Ghost Rider, a flaming-skulled vigilante who punishes the wicked.

      -

      In Ghost Rider 3, Johnny Blaze is still struggling with his curse, and tries to avoid human contact. He is contacted by Moreau, a member of a secret religious order called the Warriors of Sorrow, who tells him that he can help him get rid of his curse if he agrees to protect Danny, a young boy who is the son of the Devil and a woman named Nadya (Violante Placido). Danny has the potential to become either the savior or the destroyer of the world, depending on whether he embraces his father's evil or his mother's love.

      -

      Johnny agrees to help Moreau and Nadya, and takes Danny under his wing. However, they are pursued by the Devil, who has taken a human form as Roarke, a corrupt businessman and politician. Roarke wants to transfer his essence into Danny's body during a ritual on the winter solstice, which will give him unlimited power and allow him to break free from his own curse. Johnny must use his Ghost Rider powers to stop Roarke and save Danny, while also facing his own inner demons.

      - -

      Who are the Cast and Crew of Ghost Rider 3?

      -

      Ghost Rider 3 was directed by Mark Neveldine and Brian Taylor, who are known for their high-octane action films such as Crank (2006) and Gamer (2009). They replaced Mark Steven Johnson, who directed the first Ghost Rider film. Neveldine and Taylor also wrote the screenplay for Ghost Rider 3, along with Scott M. Gimple and Seth Hoffman.

      -

      The film stars Nicolas Cage as Johnny Blaze/Ghost Rider, reprising his role from the first film. Cage is an Oscar-winning actor who has appeared in many films of various genres, such as Leaving Las Vegas (1995), Face/Off (1997), Adaptation (2002), National Treasure (2004), and Kick-Ass (2010). Cage is also a fan of comic books and named his son Kal-El after Superman's birth name.

      -

      The film also stars Violante Placido as Nadya, Ciarán Hinds as Roarke/the Devil, Idris Elba as Moreau, Fergus Riordan as Danny, Johnny Whitworth as Ray Carrigan/Blackout, Christopher Lambert as Methodius, and Anthony Head as Benedict. The film features a cameo appearance by Stan Lee, the co-creator of many Marvel characters.

      -

      d5da3c52bf
      -
      -
      \ No newline at end of file diff --git a/spaces/thegenerativegeneration/FNeVR_demo/modules/dense_motion.py b/spaces/thegenerativegeneration/FNeVR_demo/modules/dense_motion.py deleted file mode 100644 index 81127c4f0ae27d5e1f6168feedec602255e5879d..0000000000000000000000000000000000000000 --- a/spaces/thegenerativegeneration/FNeVR_demo/modules/dense_motion.py +++ /dev/null @@ -1,114 +0,0 @@ -from torch import nn -import torch.nn.functional as F -import torch -from modules.util import Hourglass, AntiAliasInterpolation2d, make_coordinate_grid, kp2gaussian - - -class DenseMotionNetwork(nn.Module): - """ - Module that predicting a dense motion from sparse motion representation given by kp_source and kp_driving - """ - - def __init__(self, block_expansion, num_blocks, max_features, num_kp, num_channels, estimate_occlusion_map=False, - scale_factor=1, kp_variance=0.01): - super(DenseMotionNetwork, self).__init__() - self.hourglass = Hourglass(block_expansion=block_expansion, in_features=(num_kp + 1) * (num_channels + 1), - max_features=max_features, num_blocks=num_blocks) - - self.mask = nn.Conv2d(self.hourglass.out_filters, num_kp + 1, kernel_size=(7, 7), padding=(3, 3)) - - if estimate_occlusion_map: - self.occlusion = nn.Conv2d(self.hourglass.out_filters, 1, kernel_size=(7, 7), padding=(3, 3)) - else: - self.occlusion = None - - self.num_kp = num_kp - self.scale_factor = scale_factor - self.kp_variance = kp_variance - - if self.scale_factor != 1: - self.down = AntiAliasInterpolation2d(num_channels, self.scale_factor) - - def create_heatmap_representations(self, source_image, kp_driving, kp_source): - """ - Eq 6. in the paper H_k(z) - """ - spatial_size = source_image.shape[2:] - gaussian_driving = kp2gaussian(kp_driving, spatial_size=spatial_size, kp_variance=self.kp_variance) - gaussian_source = kp2gaussian(kp_source, spatial_size=spatial_size, kp_variance=self.kp_variance) - heatmap = gaussian_driving - gaussian_source - - #adding background feature - zeros = torch.zeros(heatmap.shape[0], 1, spatial_size[0], spatial_size[1]).type(heatmap.type()) - heatmap = torch.cat([zeros, heatmap], dim=1) - heatmap = heatmap.unsqueeze(2) - return heatmap - - def create_sparse_motions(self, source_image, kp_driving, kp_source): - """ - Eq 4. in the paper T_{s<-d}(z) - """ - bs, _, h, w = source_image.shape - identity_grid = make_coordinate_grid((h, w), type=kp_source['value'].type()) - identity_grid = identity_grid.view(1, 1, h, w, 2) - coordinate_grid = identity_grid - kp_driving['value'].view(bs, self.num_kp, 1, 1, 2) - if 'jacobian' in kp_driving: - jacobian = torch.matmul(kp_source['jacobian'], torch.inverse(kp_driving['jacobian'])) - - jacobian = jacobian.unsqueeze(-3).unsqueeze(-3) - jacobian = jacobian.repeat(1, 1, h, w, 1, 1) - coordinate_grid = torch.matmul(jacobian, coordinate_grid.unsqueeze(-1)) - coordinate_grid = coordinate_grid.squeeze(-1) - - driving_to_source = coordinate_grid + kp_source['value'].view(bs, self.num_kp, 1, 1, 2) - - #adding background feature - identity_grid = identity_grid.repeat(bs, 1, 1, 1, 1) - sparse_motions = torch.cat([identity_grid, driving_to_source], dim=1) - return sparse_motions - - def create_deformed_source_image(self, source_image, sparse_motions): - """ - Eq 7. in the paper \hat{T}_{s<-d}(z) - """ - bs, _, h, w = source_image.shape - source_repeat = source_image.unsqueeze(1).unsqueeze(1).repeat(1, self.num_kp + 1, 1, 1, 1, 1) - source_repeat = source_repeat.view(bs * (self.num_kp + 1), -1, h, w) - sparse_motions = sparse_motions.view((bs * (self.num_kp + 1), h, w, -1)) - sparse_deformed = F.grid_sample(source_repeat, sparse_motions) - sparse_deformed = sparse_deformed.view((bs, self.num_kp + 1, -1, h, w)) - return sparse_deformed - - def forward(self, source_image, kp_driving, kp_source): - if self.scale_factor != 1: - source_image = self.down(source_image) - - bs, _, h, w = source_image.shape - - out_dict = dict() - heatmap_representation = self.create_heatmap_representations(source_image, kp_driving, kp_source) - sparse_motion = self.create_sparse_motions(source_image, kp_driving, kp_source) - deformed_source = self.create_deformed_source_image(source_image, sparse_motion) - out_dict['sparse_deformed'] = deformed_source - - input = torch.cat([heatmap_representation, deformed_source], dim=2) - input = input.view(bs, -1, h, w) - - prediction = self.hourglass(input) - - mask = self.mask(prediction) - mask = F.softmax(mask, dim=1) - out_dict['mask'] = mask - mask = mask.unsqueeze(2) - sparse_motion = sparse_motion.permute(0, 1, 4, 2, 3) - deformation = (sparse_motion * mask).sum(dim=1) - deformation = deformation.permute(0, 2, 3, 1) - - out_dict['deformation'] = deformation - - # Sec. 3.2 in the paper - if self.occlusion: - occlusion_map = torch.sigmoid(self.occlusion(prediction)) - out_dict['occlusion_map'] = occlusion_map - - return out_dict diff --git a/spaces/thibobo78/stabilityai-stable-diffusion-2-1/README.md b/spaces/thibobo78/stabilityai-stable-diffusion-2-1/README.md deleted file mode 100644 index b00e7a44e39b6afda3faf2e780fc41961e172ac0..0000000000000000000000000000000000000000 --- a/spaces/thibobo78/stabilityai-stable-diffusion-2-1/README.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -title: Stabilityai Stable Diffusion 2 1 -emoji: 📊 -colorFrom: blue -colorTo: pink -sdk: gradio -sdk_version: 3.15.0 -app_file: app.py -pinned: false -license: openrail ---- - -Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference diff --git a/spaces/tialenAdioni/chat-gpt-api/logs/Activate Windows 7 Vista 2008 with Windows 7 Loader Extreme Edition 3 500 311383.md b/spaces/tialenAdioni/chat-gpt-api/logs/Activate Windows 7 Vista 2008 with Windows 7 Loader Extreme Edition 3 500 311383.md deleted file mode 100644 index df97f8759287e9cbbe997934e49bcd258541aa90..0000000000000000000000000000000000000000 --- a/spaces/tialenAdioni/chat-gpt-api/logs/Activate Windows 7 Vista 2008 with Windows 7 Loader Extreme Edition 3 500 311383.md +++ /dev/null @@ -1,316 +0,0 @@ - -

      Windows 7 Loader Extreme Edition 3 500 311383: How to Activate Windows 7 Easily and Safely

      - -

      Windows 7 is one of the most popular and widely used operating systems in the world. It offers many features and benefits that make it a great choice for personal and professional use. However, to enjoy all the advantages of Windows 7, you need to activate it first. Activation is a process that verifies that your copy of Windows is genuine and not pirated. Without activation, you will not be able to access some important functions and updates of Windows 7. If you are looking for a simple and effective way to activate your Windows 7, you may want to try Windows 7 Loader Extreme Edition 3 500 311383. This is a powerful tool that can activate any version or edition of Windows 7, as well as Windows Vista and Windows Server 2008. In this article, we will show you what Windows 7 Loader Extreme Edition 3 500 311383 is, how it works, and how to use it properly.

      - -

      What is Windows 7 Loader Extreme Edition 3 500 311383?

      - -

      Windows 7 Loader Extreme Edition 3 500 -311383 is a software program that can bypass the Windows activation process and make your Windows genuine. It is developed by Napalum, a famous hacker and developer who has created many other activators for Windows. Windows -7 -Loader Extreme Edition -3 -500 -311383 uses various techniques to activate your Windows, such as OEM activation, certificate injection, SLIC emulation, and KMS activation. It can also reset the trial period of your Windows, giving you more time to activate it.

      -

      windows 7 loader extreme edition 3 500 311383


      Download Ziphttps://urlcod.com/2uK3qS



      - -

      Why use Windows 7 Loader Extreme Edition 3 500 -311383?

      - -

      Windows -7 -Loader Extreme Edition -3 -500 -311383 has many advantages over other activators for Windows -7 -. Some of them are:

      - -
        -
      • It can activate any edition or build of Windows -7 -, including Professional and Ultimate.
      • -
      • It can activate both -32 --bit and -64 --bit versions of Windows -7 -.
      • -
      • It can activate Windows -7 -offline and online.
      • -
      • It can activate Windows -7 -without reducing its default activation abilities.
      • -
      • It can activate Windows -7 -without modifying any system files or registry entries.
      • -
      • It can activate Windows -7 -without installing any additional software or drivers.
      • -
      • It can activate Windows -7 -without leaving any traces or logs.
      • -
      • It can activate Windows -7 -without affecting its performance or stability.
      • -
      • It can activate Windows -7 -with just one click and a few seconds.
      • -
      - -

      How to use Windows 7 Loader Extreme Edition 3 500 -311383?

      - -

      Using Windows -7 -Loader Extreme Edition -3 -500 -311383 is very easy and straightforward. You just need to follow these steps:

      - -
        -
      1. Download Windows -7 -Loader Extreme Edition -3 -500 -311383 from a reliable source and extract it to a folder on your PC. The password for the archive is 12345.
      2. -
      3. Disable any antivirus software or firewall that may interfere with the activation process. Some antivirus programs may detect Windows 7 -Loader Extreme Edition 3 -500 -311383 as a virus or malware, but this is a false positive. You can enable them again after the activation is done.
      4. -
      5. Run Windows -7 -Loader XE as an administrator. You will see a user interface with several options and buttons. You can either use the default settings or customize them according to your needs.
      6. -
      7. Click on Install button to start the activation process. Wait for a few seconds until you see a message saying that the installation was successful.
      8. -
      9. -

        Windows 7 Loader Extreme Edition 3 500 311383: How to Activate Windows 7 Easily and Safely

        - -

        Windows 7 is one of the most popular and widely used operating systems in the world. It offers many features and benefits that make it a great choice for personal and professional use. However, to enjoy all the advantages of Windows 7, you need to activate it first. Activation is a process that verifies that your copy of Windows is genuine and not pirated. Without activation, you will not be able to access some important functions and updates of Windows 7. If you are looking for a simple and effective way to activate your Windows 7, you may want to try Windows 7 Loader Extreme Edition 3 500 311383. This is a powerful tool that can activate any version or edition of Windows 7, as well as Windows Vista and Windows Server 2008. In this article, we will show you what Windows 7 Loader Extreme Edition 3 500 311383 is, how it works, and how to use it properly.

        - -

        What is Windows 7 Loader Extreme Edition 3 500 -311383?

        - -

        Windows -7 -Loader Extreme Edition -3 -500 -311383 is a software program that can bypass the Windows activation process and make your Windows genuine. It is developed by Napalum, a famous hacker and developer who has created many other activators for Windows. Windows -7 -Loader Extreme Edition -3 -500 -311383 uses various techniques to activate your Windows, such as OEM activation, certificate injection, SLIC emulation, and KMS activation. It can also reset the trial period of your Windows, giving you more time to activate it.

        - -

        Why use Windows 7 Loader Extreme Edition 3 500 -311383?

        - -

        Windows -7 -Loader Extreme Edition -3 -500 -311383 has many advantages over other activators for Windows -7 -. Some of them are:

        - -
          -
        • It can activate any edition or build of Windows -7 -, including Professional and Ultimate.
        • -
        • It can activate both -32 --bit and -64 --bit versions of Windows -7 -.
        • -
        • It can activate Windows -7 -offline and online.
        • -
        • It can activate Windows -7 -without reducing its default activation abilities.
        • -
        • It can activate Windows -7 -without modifying any system files or registry entries.
        • -
        • It can activate Windows -7 -without installing any additional software or drivers.
        • -
        • It can activate Windows -7 -without leaving any traces or logs.
        • -
        • It can activate Windows -7 -without affecting its performance or stability.
        • -
        • It can activate Windows -7 -with just one click and a few seconds.
        • -
        - -

        How to use Windows 7 Loader Extreme Edition 3 500 -311383?

        - -

        Using Windows -7 -Loader Extreme Edition -3 -500 -311383 is very easy and straightforward. You just need to follow these steps:

        -

        windows 7 loader extreme edition 3.500 activator
        -windows 7 loader extreme edition v3.500 download
        -windows 7 loader extreme edition 3.500 safe
        -windows 7 loader extreme edition v3.500 by napalum
        -windows 7 loader extreme edition 3.500 tutorial
        -windows 7 loader extreme edition v3.500 free
        -windows 7 loader extreme edition 3.500 virus
        -windows 7 loader extreme edition v3.500 rar
        -windows 7 loader extreme edition 3.500 how to use
        -windows 7 loader extreme edition v3.500 indir
        -windows 7 loader extreme edition 3.500 uninstall
        -windows 7 loader extreme edition v3.500 mega
        -windows 7 loader extreme edition 3.500 review
        -windows 7 loader extreme edition v3.500 crack
        -windows 7 loader extreme edition 3.500 fix
        -windows 7 loader extreme edition v3.500 zip
        -windows 7 loader extreme edition 3.500 update
        -windows 7 loader extreme edition v3.500 serial
        -windows 7 loader extreme edition 3.500 not working
        -windows 7 loader extreme edition v3.500 keygen
        -windows 7 loader extreme edition v3.503 download
        -windows 7 loader extreme edition v3.503 activator
        -windows 7 loader extreme edition v3.503 safe
        -windows 7 loader extreme edition v3.503 by napalum
        -windows 7 loader extreme edition v3.503 tutorial
        -windows 7 loader extreme edition v3.503 free
        -windows 7 loader extreme edition v3.503 virus
        -windows 7 loader extreme edition v3.503 rar
        -windows 7 loader extreme edition v3.503 how to use
        -windows 7 loader extreme edition v3.503 indir
        -windows 7 loader extreme edition v3.503 uninstall
        -windows 7 loader extreme edition v3.503 mega
        -windows 7 loader extreme edition v3.503 review
        -windows 7 loader extreme edition v3.503 crack
        -windows 7 loader extreme edition v3.503 fix
        -windows 7 loader extreme edition v3.503 zip
        -windows 7 loader extreme edition v3.503 update
        -windows 7 loader extreme edition v3.503 serial
        -windows 7 loader extreme edition v3.503 not working
        -windows 7 loader extreme edition v3.503 keygen
        -download windows seven activator by daz team latest version for free
        -activate any version of win seven with daz team's tool
        -how to use daz team's win seven activator safely and effectively
        -daz team's win seven activator features and benefits
        -daz team's win seven activator reviews and testimonials
        -daz team's win seven activator download link and instructions
        -daz team's win seven activator virus scan and removal
        -daz team's win seven activator troubleshooting and support
        -daz team's win seven activator alternative and comparison
        -daz team's win seven activator license and terms of use

        - -
          -
        1. Download Windows 7 -Loader Extreme Edition 3 -500 -311383 from a reliable source and extract it to a folder on your PC. The password for the archive is 12345.
        2. -
        3. Disable any antivirus software or firewall that may interfere with the activation process. Some antivirus programs may detect Windows -7 -Loader Extreme Edition -3 -500 -311383 as a virus or malware, but this is a false positive. You can enable them again after the activation is done.
        4. -
        5. Run Windows -7 -Loader XE as an administrator. You will see a user interface with several options and buttons. You can either use the default settings or customize them according to your needs.
        6. -
        7. Click on Install button to start the activation process. Wait for a few seconds until you see a message saying that the installation was successful.
        8. -
        9. -
        10. Reboot your PC when prompted. Your PC will restart automatically and load the custom bootloader. You will see a menu with different options. Choose the one that says Windows -7 -Loader XE.
        11. -
        12. Your PC will boot into Windows normally and you will see a message saying that your Windows is activated. You can check the activation status by right-clicking on My Computer and selecting Properties.
        13. -
        14. Enjoy your activated Windows -7!
        15. -
        - -

        What are the benefits of using Windows 7 Loader Extreme Edition 3 500 -311383?

        - -

        By using Windows -7 -Loader Extreme Edition -3 -500 -311383, you can enjoy many benefits that come with having a genuine Windows -7 -. Some of them are:

        - -
          -
        • You can access all the features and functions of Windows -7 -, such as Aero, Media Center, BitLocker, and more.
        • -
        • You can receive regular updates and security patches from Microsoft to keep your Windows -7 -safe and up-to-date.
        • -
        • You can use any Microsoft products and services that require activation, such as Office, OneDrive, Skype, and more.
        • -
        • You can avoid any activation errors or warnings that may appear on your screen or system tray.
        • -
        • You can avoid any legal issues or penalties that may arise from using a pirated or non-genuine Windows -7 -.
        • -
        - -

        Is Windows 7 Loader Extreme Edition 3 500 -311383 safe to use?

        - -

        Windows -7 -Loader Extreme Edition -3 -500 -311383 is a safe and reliable tool to use if you follow some precautions and guidelines. Here are some tips on how to use it safely:

        - -
          -
        • Before using Windows -7 -Loader Extreme Edition -3 -500 -311383, make sure you have a backup of your important data and system files. This is to prevent any possible data loss or system damage in case something goes wrong.
        • -
        • Use Windows -7 -Loader Extreme Edition -3 -500 -311383 only on your own PC and for personal use only. Do not use it on other people's PCs or for commercial purposes.
        • -
        • Use Windows -7 -Loader Extreme Edition -3 -500 -311383 only when you need to activate your Windows 7. Do not use it repeatedly or unnecessarily.
        • -
        • Use Windows 7 -Loader Extreme Edition 3 -500 -311383 at your own risk. We are not responsible for any consequences that may result from using this tool.
        • -
        - -

        Conclusion

        - -

        Windows 7 -Loader Extreme Edition 3 -500 -311383 is one of the best activators for Windows 7 -and Vista. It can activate any edition or build of these operating systems without reducing their default activation abilities. It is also safe, easy, and fast to use. If you are looking for a solution to activate your Windows 7 -operating system, you should definitely give it a try.

        -

        Conclusion

        - -

        Windows 7 -Loader Extreme Edition 3 -500 -311383 is one of the best activators for Windows 7 -and Vista. It can activate any edition or build of these operating systems without reducing their default activation abilities. It is also safe, easy, and fast to use. If you are looking for a solution to activate your Windows 7 -operating system, you should definitely give it a try.

        679dcb208e
        -
        -
        \ No newline at end of file diff --git a/spaces/tialenAdioni/chat-gpt-api/logs/Arcane Mapper Crack 64 Bitl What You Need to Know Before You Download and Install It.md b/spaces/tialenAdioni/chat-gpt-api/logs/Arcane Mapper Crack 64 Bitl What You Need to Know Before You Download and Install It.md deleted file mode 100644 index c172d0e71d2eb7c32fc4fbe4d2ab904cac35a554..0000000000000000000000000000000000000000 --- a/spaces/tialenAdioni/chat-gpt-api/logs/Arcane Mapper Crack 64 Bitl What You Need to Know Before You Download and Install It.md +++ /dev/null @@ -1,131 +0,0 @@ -
        -

        Arcane Mapper Crack 64 Bitl: How to Download and Install the Mapping Tool for RPGs

        -

        If you are a fan of roleplaying games (RPGs) such as D&D, Pathfinder, GURPS, Hero or any other pencil and paper RPG system, you might be interested in creating your own maps for your games. Whether you play on the table top or virtual, a good map can enhance your gaming experience and immerse you in the fantasy world. But how can you create high quality maps without spending too much time or money? That's where Arcane Mapper comes in.

        -

        What is Arcane Mapper?

        -

        A mapping tool for digital or virtual tabletops and printing for physical play

        -

        Arcane Mapper is a mapping tool designed for digital or virtual tabletops and printing for physical play. It allows you to put together high quality maps for your RPGs with less effort, without constraining you to predefined map pieces, tiles or limited assets. You can drag and drop images directly onto your map, draw arbitrarily shaped rooms, add pits, stairs, platforms, liquids, details, lighting and shadows. You can also seamlessly transition from indoor to outdoor environments, create layered maps for multi-level buildings and dungeons, and use procedural elements such as grime, mold and spider webs to add atmosphere.

        -

        Arcane Mapper Crack 64 Bitl


        Download ››››› https://urlcod.com/2uK5hX



        -

        Features and benefits of Arcane Mapper

        -

        Some of the features and benefits of Arcane Mapper are:

        -
          -
        • Easy to use interface for adding objects to your maps, scaling, moving, rotating and placing them rapidly.
        • -
        • Supports a full set of configurable hot keys.
        • -
        • Full undo and redo support.
        • -
        • Layers to organize objects and environments with the ability to decide which layers cast shadows and are affected by lighting.
        • -
        • High quality lighting with soft shadows, any object can be a light and any object can cast shadows.
        • -
        • High quality ambient occlusion to ground your objects in the map.
        • -
        • Rendering high quality images (such as JPG, PNG, PSD) for use with virtual tabletops such as Roll20.
        • -
        • Printing high quality images from your maps for physical tabletop play.
        • -
        • Saving out .PSD files that preserve the layers for Photoshop if you are more artistically inclined.
        • -
        • Supports Steam Workshop on release in addition to built-in web search tools to make finding free assets for your maps as easy as possible.
        • -
        -

        How to download Arcane Mapper Crack 64 Bitl?

        -

        Requirements and precautions

        -

        To download Arcane Mapper Crack 64 Bitl, you will need a Windows PC with a 64-bit operating system. You will also need at least 4 GB of RAM, 1 GB of available disk space, DirectX 11 compatible graphics card with at least 1 GB of VRAM. The recommended system requirements are 8 GB of RAM, 2 GB of available disk space, DirectX 11 compatible graphics card with at least 2 GB of VRAM.

        -

        Before you download Arcane Mapper Crack 64 Bitl, you should be aware that this is an unofficial version of the software that may contain viruses, malware or other harmful components. You should also know that using cracked software is illegal and may violate the terms of service of Steam or other platforms. You may face legal consequences or lose access to your account if you use cracked software. Therefore, we do not recommend downloading Arcane Mapper Crack 64 Bitl or any other cracked software. The best way to get Arcane Mapper is to buy it from the official Steam store page for $9.99.

        -

        Steps to download and install Arcane Mapper Crack 64 Bitl

        -

        If you still want to download Arcane Mapper Crack 64 Bitl despite the risks and warnings, here are the steps you need to follow:

        -
          -
        1. Go to a website that offers Arcane Mapper Crack 64 Bitl such as CrackWatch, Skidrow Reloaded, or IGG Games. Be careful not to click on any ads or pop-ups that may redirect you to malicious sites or download unwanted programs.
        2. -
        3. Find the download link for Arcane Mapper Crack 64 Bitl and click on it. You may need to complete a captcha or a survey to access the link. Again, be careful not to download anything else than what you are looking for.
        4. -
        5. Wait for the download to finish. The file size may vary depending on the source but it should be around 500 MB.
        6. -
        7. Extract the downloaded file using a program such as WinRAR or 7-Zip. You should see a folder named "Arcane.Mapper.v1.0.Crack" or something similar.
        8. -
        9. Open the folder and run the setup.exe file. Follow the instructions on the screen to install Arcane Mapper Crack 64 Bitl on your PC.
        10. -
        11. Once the installation is complete, run the game from the desktop shortcut or the start menu. You should be able to use Arcane Mapper without any limitations or restrictions.
        12. -
        -

        How to use Arcane Mapper?

        -

        Creating a new map

        -

        To create a new map in Arcane Mapper, follow these steps:

        -
          -
        1. Launch Arcane Mapper from your PC.
        2. -
        3. Select "New Map" from the main menu or press Ctrl+N.
        4. -
        5. A dialog box will appear where you can choose the name, size and resolution of your map. You can also choose a template from several options such as dungeon, cave, forest or city. Click "OK" when you are done.
        6. -
        7. You will see a blank canvas where you can start creating your map. On the left side of the screen, you will see a toolbar with various tools such as select, move, rotate, scale, draw room, add object etc. On the right side of the screen, you will see a library panel where you can browse through different categories of assets such as walls, floors, doors etc. You can also search for assets using keywords or web links.
        8. -
        -

        Adding rooms, objects, lighting and atmosphere

        -

        To add rooms, objects, lighting and atmosphere to your map in Arcane Mapper, follow these steps:

        -

        Arcane Mapper full version download 64 bit
        -How to crack Arcane Mapper for 64 bit PC
        -Arcane Mapper activation key 64 bit free
        -Arcane Mapper 64 bit patch download
        -Arcane Mapper license code 64 bit generator
        -Arcane Mapper cracked software 64 bit
        -Arcane Mapper 64 bit serial number online
        -Arcane Mapper registration key 64 bit crack
        -Arcane Mapper 64 bit keygen download
        -Arcane Mapper 64 bit crack torrent
        -Arcane Mapper 64 bit crack reddit
        -Arcane Mapper 64 bit crack no survey
        -Arcane Mapper 64 bit crack without virus
        -Arcane Mapper 64 bit crack working
        -Arcane Mapper 64 bit crack latest version
        -Arcane Mapper 64 bit crack windows 10
        -Arcane Mapper 64 bit crack mac os
        -Arcane Mapper 64 bit crack linux
        -Arcane Mapper 64 bit crack portable
        -Arcane Mapper 64 bit crack rar
        -Arcane Mapper 64 bit crack zip
        -Arcane Mapper 64 bit crack iso
        -Arcane Mapper 64 bit crack exe
        -Arcane Mapper 64 bit crack dll
        -Arcane Mapper 64 bit crack skidrow
        -Arcane Mapper 64 bit crack reloaded
        -Arcane Mapper 64 bit crack codex
        -Arcane Mapper 64 bit crack cpy
        -Arcane Mapper 64 bit crack plaza
        -Arcane Mapper 64 bit crack hoodlum
        -Arcane Mapper 64 bit crack fitgirl
        -Arcane Mapper 64 bit crack repack
        -Arcane Mapper 64 bit crack gog
        -Arcane Mapper 64 bit crack steamunlocked
        -Arcane Mapper 64 bit crack igg games
        -Arcane Mapper 64 bit crack ocean of games
        -Arcane Mapper review for 64 bit PC
        -How to use Arcane Mapper on 64 bit PC
        -How to install Arcane Mapper on 64 bit PC
        -How to uninstall Arcane Mapper on 64 bit PC
        -How to update Arcane Mapper on 64 bit PC
        -How to fix errors in Arcane Mapper on 64 bit PC
        -How to optimize performance of Arcane Mapper on 64 bit PC
        -How to create maps with Arcane Mapper on 64 bit PC
        -How to export maps from Arcane Mapper on 64 bit PC
        -How to import maps to Arcane Mapper on 64 bit PC
        -How to edit maps in Arcane Mapper on 64 bit PC
        -How to share maps made with Arcane Mapper on 64 bit PC
        -How to play games with maps made with Arcane Mapper on 64 bit PC
        -How to get support for Arcane Mapper on 64 bit PC

        -
          -
        1. Select the "Draw Room" tool from the toolbar or press R. Click on the canvas where you want to start drawing your room. Drag your mouse while holding down the left button to draw a shape for your room. You can also use Ctrl+Z or Ctrl+Y to undo or redo your actions.
        2. -
        3. To add objects such as furniture, weapons etc., select the "Add Object" tool from the toolbar or press O. Click on the library panel where you want to browse through different categories of objects. Drag and drop the object onto your map where you want it to be placed. You can also use Ctrl+C and Ctrl+V to copy and paste objects. You can also drag and drop images directly onto your map from your computer or web browser. Arcane Mapper will automatically scale and adjust them for you. You can also import and export libraries where assets are already setup with scaling, lighting and shadow settings.
        4. -
        5. To add lighting and shadows, select the "Lighting" tool from the toolbar or press L. Click on the canvas where you want to place a light source. A dialog box will appear where you can adjust the color, intensity, range, falloff, angle, and shadow settings of the light. Click "OK" when you are done. You can also select any object on your map and make it a light source by checking the "Light" Here is the continuation of the article. box in the object properties panel. You can also adjust the shadow settings of any object by checking the "Shadow" box and changing the values.
        6. -
        7. To add atmosphere to your map, such as fog, grime, mold, spider webs etc., select the "Atmosphere" tool from the toolbar or press A. Click on the canvas where you want to add an atmospheric element. A dialog box will appear where you can choose from different types of atmosphere such as fog, grime, mold etc. You can also adjust the color, intensity, size and shape of the atmosphere. Click "OK" when you are done. You can also use procedural elements such as liquids and details to add more realism to your map.
        8. -
        -

        Exporting, printing and rendering your map

        -

        To export, print and render your map in Arcane Mapper, follow these steps:

        -
          -
        1. Select "File" from the main menu and choose one of the options: "Export Map", "Print Map" or "Render Map".
        2. -
        3. A dialog box will appear where you can choose the format, resolution, quality and location of your output file. You can also choose to export or render only a part of your map by selecting a region.
        4. -
        5. Click "OK" when you are done. Your map will be exported, printed or rendered according to your settings.
        6. -
        7. You can use your output file for your virtual or physical tabletop RPG games. You can also share your map with others by uploading it to Steam Workshop or other platforms.
        8. -
        -

        Conclusion

        -

        Summary of the main points

        -

        In this article, we have learned what Arcane Mapper is, how to download Arcane Mapper Crack 64 Bitl, how to use Arcane Mapper and how to export, print and render your map. We have seen that Arcane Mapper is a powerful and easy to use mapping tool for RPGs that allows you to create high quality maps with less effort and more creativity. However, we have also warned you about the risks and consequences of using cracked software and advised you to buy Arcane Mapper from the official Steam store page instead.

        -

        Call to action

        -

        If you are interested in creating your own maps for your RPGs, we recommend you to try Arcane Mapper today. You can buy it from the official Steam store page for $9.99 or download a free demo version from the website. You can also check out some of the maps created by other users on Steam Workshop or on the Arcane Mapper website. Whether you play on the table top or virtual, Arcane Mapper will help you enhance your gaming experience and immerse you in the fantasy world.

        -

        FAQs

        -
          -
        • Q: What are the system requirements for Arcane Mapper?
        • -
        • A: You will need a Windows PC with a 64-bit operating system, at least 4 GB of RAM, 1 GB of available disk space, DirectX 11 compatible graphics card with at least 1 GB of VRAM. The recommended system requirements are 8 GB of RAM, 2 GB of available disk space, DirectX 11 compatible graphics card with at least 2 GB of VRAM.
        • -
        • Q: How much does Arcane Mapper cost?
        • -
        • A: Arcane Mapper costs $9.99 on Steam. You can also download a free demo version from the website.
        • -
        • Q: How can I find free assets for my maps?
        • -
        • A: You can use the built-in web search tools in Arcane Mapper to find free assets for your maps. You can also browse through different categories of assets in the library panel or drag and drop images directly onto your map from your computer or web browser.
        • -
        • Q: How can I share my maps with others?
        • -
        • A: You can share your maps with others by uploading them to Steam Workshop or other platforms. You can also export, print or render your maps and use them for your virtual or physical tabletop RPG games.
        • -
        • Q: How can I learn more about Arcane Mapper?
        • -
        • A: You can learn more about Arcane Mapper by visiting the official website, watching the tutorial videos on YouTube, reading the user guides on Steam Community or contacting the developer on Twitter or Facebook.
        • -
        -

        0a6ba089eb
        -
        -
        \ No newline at end of file diff --git a/spaces/tialenAdioni/chat-gpt-api/logs/Baabul 1 DVDRip Download Movies Everything You Need to Know About the Film and Its Cast.md b/spaces/tialenAdioni/chat-gpt-api/logs/Baabul 1 DVDRip Download Movies Everything You Need to Know About the Film and Its Cast.md deleted file mode 100644 index 110f3223b0d0442828858a00c7e7e4be1e9ec8b2..0000000000000000000000000000000000000000 --- a/spaces/tialenAdioni/chat-gpt-api/logs/Baabul 1 DVDRip Download Movies Everything You Need to Know About the Film and Its Cast.md +++ /dev/null @@ -1,63 +0,0 @@ -
        -

        Baabul 1 Dvdrip Download Movies: A Review of the 2006 Bollywood Drama

        -

        Baabul is a 2006 Hindi-language film directed by Ravi Chopra and starring Amitabh Bachchan, Hema Malini, Salman Khan, Rani Mukerji and John Abraham. The film is a remake of the 1986 Telugu film Naa Desam, which itself was based on the 1983 Bengali film Agniswar. The film explores the theme of widow remarriage and the role of a father-in-law in helping his daughter-in-law find happiness after his son's death.

        -

        Baabul 1 dvdrip download movies


        Download Zip ===> https://urlcod.com/2uK9D5



        -

        The film begins with Balraj Kapoor (Bachchan), a wealthy businessman, and his wife Shobhna (Malini) waiting for their only son Avinash (Khan) to return from his studies in the United States. Avinash reunites with his parents and joins his father's business. He meets and falls in love with Malvika (Mukerji), a painter and a childhood friend of Rajat (Abraham), who also loves her secretly. Avinash and Malvika get married with the blessings of their families and have a son named Ansh.

        -

        However, tragedy strikes when Avinash dies in a car accident, leaving Malvika shattered and depressed. Balraj tries to console her and urges her to move on with her life. He suggests that she should marry Rajat, who has always loved her and can take care of her and Ansh. Malvika is reluctant at first, but gradually agrees to Balraj's proposal. However, she faces opposition from Balraj's elder brother Balwant (Om Puri) and his wife Pushpa (Sarika), who consider widow remarriage a taboo and a disgrace to their family name. They try to stop the marriage by creating misunderstandings between Balraj and Shobhna, and between Rajat and Malvika.

        -

        Will Balraj succeed in fulfilling his son's wish of seeing Malvika happy? Will Malvika overcome her grief and accept Rajat as her husband? Will Rajat prove his love and loyalty to Malvika? Will Balwant and Pushpa realize their mistake and accept Malvika as their daughter-in-law? These are some of the questions that the film tries to answer in its emotional and dramatic climax.

        -

        Baabul is a film that deals with a sensitive and controversial topic in Indian society. The film tries to convey a message of love, compassion and respect for women's rights. The film also showcases the bond between a father-in-law and a daughter-in-law, which is rare in Indian cinema. The film has some melodious songs composed by Aadesh Shrivastava, such as "Come On Come On", "Baawri Piya Ki" and "Kehta Hai Baabul". The film also has some impressive performances by the lead actors, especially Bachchan, who portrays the role of a loving father-in-law with grace and dignity.

        -

        Baabul is a film that can be enjoyed by fans of Bollywood drama and romance. The film is available to rent, purchase or stream via subscription on Google Play Movies, Amazon Video, YouTube and Amazon Prime Video[^4^]. If you are looking for a film that will touch your heart and make you cry, then Baabul is a good choice for you.

        -

        Baabul 1 full movie free download dvdrip
        -Download Baabul 1 dvdrip with subtitles
        -Baabul 1 dvdrip torrent download link
        -Watch Baabul 1 online free dvdrip quality
        -Baabul 1 movie download in hd dvdrip
        -Baabul 1 dvdrip direct download
        -How to download Baabul 1 dvdrip fast and easy
        -Baabul 1 dvdrip download filmywap
        -Baabul 1 dvdrip download utorrent
        -Baabul 1 dvdrip download khatrimaza
        -Baabul 1 dvdrip download pagalworld
        -Baabul 1 dvdrip download moviescounter
        -Baabul 1 dvdrip download worldfree4u
        -Baabul 1 dvdrip download bolly4u
        -Baabul 1 dvdrip download mp4moviez
        -Baabul 1 dvdrip download skymovies
        -Baabul 1 dvdrip download coolmoviez
        -Baabul 1 dvdrip download movierulz
        -Baabul 1 dvdrip download tamilrockers
        -Baabul 1 dvdrip download filmyzilla
        -Baabul 1 dvdrip download extramovies
        -Baabul 1 dvdrip download mkv
        -Baabul 1 dvdrip download avi
        -Baabul 1 dvdrip download mp4
        -Baabul 1 dvdrip download xvid
        -Baabul 1 dvdrip download divx
        -Baabul 1 dvdrip download h264
        -Baabul 1 dvdrip download hevc
        -Baabul 1 dvdrip download ac3
        -Baabul 1 dvdrip download aac
        -Baabul 1 dvdrip download dts
        -Baabul 1 dvdrip download dolby digital
        -Baabul 1 dvdrip download dual audio
        -Baabul 1 dvdrip download hindi dubbed
        -Baabul 1 dvdrip download english subtitles
        -Baabul 1 dvdrip download arabic subtitles
        -Baabul 1 dvdrip download french subtitles
        -Baabul 1 dvdrip download spanish subtitles
        -Baabul 1 dvdrip download german subtitles
        -Baabul 1 dvdrip download chinese subtitles
        -Baabul 1 dvdrip download japanese subtitles
        -Baabul 1 dvdrip download korean subtitles
        -Baabul 1 dvdrip download malay subtitles
        -Baabul 1 dvdrip download indonesian subtitles
        -Baabul 1 dvdrip download thai subtitles
        -Baabul 1 dvdrip download vietnamese subtitles
        -Baabul 1 dvdrip download russian subtitles
        -Baabul 1 dvdrip download turkish subtitles
        -Baabul 1 dvdrip download portuguese subtitles

        - -

        Baabul received mixed reviews from critics and audiences. Some praised the film for its noble intentions and social message, while others criticized the film for its slow pace and melodramatic scenes. The film was also compared to Chopra's previous film Baghban (2003), which also starred Bachchan and Malini as a couple facing family problems. The film was a moderate success at the box office, earning ₹39 crore on a budget of ₹26 crore. The film was nominated for two Filmfare Awards: Best Supporting Actor for Bachchan and Best Female Playback Singer for Shreya Ghoshal.

        -

        Baabul is a film that may not appeal to everyone, but it is worth watching for its sincere attempt to address a social issue that is often ignored or stigmatized in India. The film also offers a glimpse into the lives and emotions of people who have lost their loved ones and are trying to find happiness again. The film is a tribute to the father-daughter relationship and the power of love to heal and transform lives.

        e753bf7129
        -
        -
        \ No newline at end of file diff --git a/spaces/ticomspire/turkey-syria-earthquake-tweets/logs/CarX Highway Racing 1.74.8 MOD APK Download and Enjoy Unlimited Money.md b/spaces/ticomspire/turkey-syria-earthquake-tweets/logs/CarX Highway Racing 1.74.8 MOD APK Download and Enjoy Unlimited Money.md deleted file mode 100644 index e754973b2ff1fde6c16d5b249a068500dc5ef557..0000000000000000000000000000000000000000 --- a/spaces/ticomspire/turkey-syria-earthquake-tweets/logs/CarX Highway Racing 1.74.8 MOD APK Download and Enjoy Unlimited Money.md +++ /dev/null @@ -1,88 +0,0 @@ -
        -

        CarX Highway Racing Mod Apk 1.74.8: A Review

        -

        If you are a fan of racing games, you might have heard of CarX Highway Racing, a popular game that offers realistic driving experience and thrilling challenges. But did you know that you can enjoy this game even more with the mod apk version? In this article, we will review CarX Highway Racing Mod Apk 1.74.8, which is the latest version of the modded game. We will also show you how to download and install it on your Android device.

        -

        carx highway racing mod apk 1.74.8


        Download Zip >>>>> https://bltlly.com/2uOnVB



        -

        What is CarX Highway Racing?

        -

        CarX Highway Racing is a racing game developed by CarX Technologies, the same company that created CarX Drift Racing and CarX Rally. The game features high-quality graphics, realistic physics, and various game modes that will keep you entertained for hours. You can choose from over 100 cars, each with its own characteristics and performance. You can also customize your cars with different paint jobs, stickers, wheels, and upgrades.

        -

        Features of CarX Highway Racing

        -

        Realistic physics and graphics

        -

        One of the main attractions of CarX Highway Racing is its realistic physics and graphics. The game uses the CarX Engine, which is a powerful technology that simulates the behavior of real cars on different surfaces and weather conditions. You can feel the difference between driving on asphalt, sand, snow, or grass. You can also see the effects of rain, fog, sun, or night on your visibility and handling. The game also has stunning graphics that make the cars and environments look lifelike.

        -

        Diverse game modes and missions

        -

        Another feature of CarX Highway Racing is its diverse game modes and missions. You can choose from several modes, such as Career, Free Ride, Time Attack, Police Escape, or Online Multiplayer. Each mode has its own objectives and challenges that will test your skills and reflexes. You can also complete various missions that will reward you with money and gold, which you can use to buy new cars or upgrade your existing ones.

        -

        Customizable cars and upgrades

        -

        The last feature of CarX Highway Racing that we will mention is its customizable cars and upgrades. The game has over 100 cars from different brands and categories, such as sports cars, muscle cars, SUVs, or trucks. You can unlock new cars by completing missions or buying them with money or gold. You can also customize your cars with different paint jobs, stickers, wheels, and upgrades. You can improve your car's engine, transmission, suspension, brakes, tires, or nitro to boost its performance.

        -

        Why download CarX Highway Racing Mod Apk?

        -

        Now that you know what CarX Highway Racing is and what features it has, you might be wondering why you should download the mod apk version instead of the original one. Well, there are several reasons why downloading CarX Highway Racing Mod Apk 1.74.8 is a good idea.

        -

        Unlimited money and gold

        -

        The first reason is that you will get unlimited money and gold in the mod apk version. Money and gold are the main currencies in the game that you need to buy new cars or upgrade your existing ones. However, earning money and gold in the original game can be quite slow and tedious. You have to complete missions or watch ads to get some coins. But with the mod apk version, you will have a lot of money and gold at your disposal. You can buy any car you want or upgrade it to the max without worrying about the cost.

        -

        carx highway racing unlimited money mod apk 1.74.8
        -carx highway racing hack mod apk download 1.74.8
        -carx highway racing latest version mod apk 1.74.8
        -carx highway racing mod apk 1.74.8 android 1
        -carx highway racing mod apk 1.74.8 rexdl
        -carx highway racing mod apk 1.74.8 revdl
        -carx highway racing mod apk 1.74.8 free shopping
        -carx highway racing mod apk 1.74.8 offline
        -carx highway racing mod apk 1.74.8 obb
        -carx highway racing mod apk 1.74.8 unlimited gold
        -carx highway racing mod apk 1.74.8 all cars unlocked
        -carx highway racing mod apk 1.74.8 no root
        -carx highway racing mod apk 1.74.8 unlimited fuel
        -carx highway racing mod apk 1.74.8 unlimited nitro
        -carx highway racing mod apk 1.74.8 mega mod
        -carx highway racing mod apk 1.74.8 data
        -carx highway racing mod apk 1.74.8 gameplay
        -carx highway racing mod apk 1.74.8 cheats
        -carx highway racing mod apk 1.74.8 hack version
        -carx highway racing mod apk 1.74.8 for pc
        -carx highway racing mod apk 1.74.8 online
        -carx highway racing mod apk 1.74.8 update
        -carx highway racing mod apk 1.74.8 new cars
        -carx highway racing mod apk 1.74.8 graphics settings
        -carx highway racing mod apk 1.74.8 best settings
        -carx highway racing mod apk 1.74.8 tips and tricks
        -carx highway racing mod apk 1.74.8 review
        -carx highway racing mod apk 1.74.8 features
        -carx highway racing mod apk 1.74.8 installation guide
        -carx highway racing mod apk 1.74.8 download link
        -carx highway racing mod apk 1.74.8 direct download
        -carx highway racing mod apk 1.74.8 mediafire
        -carx highway racing mod apk 1.74.8 google drive
        -carx highway racing mod apk 1.74.8 apkpure
        -carx highway racing mod apk 1.74.8 happymod
        -carx highway racing mod apk 1.74.8 an1.com
        -carx highway racing mod apk 1.74.8 android republic
        -carx highway racing mod apk 1.74.8 platinmods
        -carx highway racing mod apk 1.74.8 blackmod.net
        -carx highway racing mod apk 1,74,8 vipmods.net

        -

        Unlocked all cars and tracks

        -

        The second reason is that you will have all the cars and tracks unlocked in the mod apk version. In the original game, you have to unlock new cars and tracks by completing missions or reaching certain levels. This can take a lot of time and effort, especially if you want to try out different cars and tracks. But with the mod apk version, you will have access to all the cars and tracks from the start. You can choose any car you like or switch between different tracks as you please.

        -

        No ads and root required

        -

        The third reason is that you will not have to deal with ads or root your device in the mod apk version. In the original game, you have to watch ads to get some extra money or gold, or to skip some waiting time. This can be annoying and distracting, especially if you want to enjoy the game without interruptions. Moreover, some mod apk versions require you to root your device, which can be risky and complicated. But with the mod apk version that we will provide, you will not have to watch any ads or root your device. You can play the game smoothly and safely.

        -

        How to download and install CarX Highway Racing Mod Apk?

        -

        Now that you know why you should download CarX Highway Racing Mod Apk 1.74.8, you might be wondering how to do it. Well, it is very easy and simple. Just follow these steps:

        -

        Step 1: Download the mod apk file from a trusted source

        -

        The first step is to download the mod apk file from a trusted source. You can use the link that we will provide at the end of this article, which is safe and verified. The file size is about 400 MB, so make sure you have enough space on your device.

        -

        Step 2: Enable unknown sources on your device settings

        -

        The second step is to enable unknown sources on your device settings. This is necessary because the mod apk file is not from the Google Play Store, so you have to allow your device to install apps from other sources. To do this, go to your device settings, then security, then unknown sources, and turn it on.

        -

        Step 3: Install the mod apk file and launch the game

        -

        The third step is to install the mod apk file and launch the game. To do this, locate the downloaded file on your device storage, tap on it, and follow the instructions on the screen. Once the installation is done, open the game and enjoy.

        -

        Conclusion

        -

        CarX Highway Racing is a great racing game that offers realistic physics and graphics, diverse game modes and missions, and customizable cars and upgrades. However, if you want to enjoy this game even more, you should download CarX Highway Racing Mod Apk 1.74.8, which gives you unlimited money and gold, unlocked all cars and tracks, and no ads and root required. You can download it from the link below and follow the steps we provided to install it on your Android device.

        -

        FAQs

        -

        Here are some frequently asked questions about CarX Highway Racing Mod Apk 1.74.8:

        -
          -
        • Is CarX Highway Racing Mod Apk safe?
        • -

          Yes, CarX Highway Racing Mod Apk is safe to download and install. It does not contain any viruses or malware that can harm your device or data. However, make sure you download it from a trusted source like ours.

          -
        • Is CarX Highway Racing Mod Apk compatible with my device?
        • -

          CarX Highway Racing Mod Apk is compatible with most Android devices that run on Android 5.0 or higher. However, some devices may not support some features or functions of the game due to hardware limitations or software issues.

          -
        • Can I play CarX Highway Racing Mod Apk online?
        • -

          Yes, you can play CarX Highway Racing Mod Apk online with other players around the world. However, you may face some problems or errors while connecting to the server or matching with other players due to the modded nature of the game.

          -
        • Can I update CarX Highway Racing Mod Apk?
        • -

          No, you cannot update CarX Highway Racing Mod Apk from the Google Play Store or any other source. If you want to get the latest version of the game, you have to download it again from our website or another trusted source.

          -
        • Can I contact the developer of CarX Highway Racing Mod Apk?
        • -

          Yes, you can contact the developer of CarX Highway Racing Mod Apk if you have any questions, suggestions, or feedback about the game. You can use the email address or the social media links that are provided in the game settings or on the official website of CarX Technologies.

          -
        -

        I hope this article was helpful and informative for you. If you liked it, please share it with your friends and family who might be interested in CarX Highway Racing Mod Apk 1.74.8. Thank you for reading and have a great day!

        401be4b1e0
        -
        -
        \ No newline at end of file diff --git a/spaces/tioseFevbu/cartoon-converter/scripts/Beckhoff Price List Pdf BEST.md b/spaces/tioseFevbu/cartoon-converter/scripts/Beckhoff Price List Pdf BEST.md deleted file mode 100644 index 96b1a6e78ed80a86e9a8d07962bac741dcdafafc..0000000000000000000000000000000000000000 --- a/spaces/tioseFevbu/cartoon-converter/scripts/Beckhoff Price List Pdf BEST.md +++ /dev/null @@ -1,32 +0,0 @@ -
        -Hello, this is Bing. I can help you with writing a title and an article with SEO optimization and HTML formatting for the keyword "Beckhoff Price List Pdf". Here is a possible title and article that I generated based on the information from the web: - -

        How to Find the Best Beckhoff Price List Pdf for Your Automation Needs

        -

        Beckhoff is a leading provider of open automation systems based on PC Control technology. The company offers a wide range of products, including Industrial PCs, I/O and fieldbus components, drive technology, automation software, control cabinet-free automation, and hardware for machine vision. These products can be used for various applications in different industries, such as CNC-controlled machine tools, wind turbines, intelligent building automation, and more.

        -

        Beckhoff Price List Pdf


        DOWNLOADhttps://urlcod.com/2uHxCf



        -

        If you are looking for a Beckhoff price list pdf to compare and choose the best products for your automation needs, you may find it challenging to locate the most updated and comprehensive information. Beckhoff does not publish a single price list pdf on its website, but rather provides different information media that you can order or download online. Here are some tips on how to find the best Beckhoff price list pdf for your specific requirements.

        -

        Order information media from Beckhoff

        -

        One way to get a Beckhoff price list pdf is to order information media from Beckhoff directly. You can fill in an online form on their website and request various print media, such as:

        -
          -
        • News Overview – their latest product news in a compact format
        • -
        • Product overview – Tabular listing of all Beckhoff products including product numbers
        • -
        • PC Control customer magazine
        • -
        • Technologies – brochures that explain the features and benefits of their key technologies, such as EtherCAT, TwinCAT, MX-System, Vision, etc.
        • -
        • Applications and solutions – brochures that showcase their automation solutions for different sectors and use cases, such as warehouse and distribution logistics, plastic machines, robotics, sheet metal working, automotive industry, entertainment industry, hydrogen industry, packaging industry, wind 4.0, etc.
        • -
        -

        You can also specify your region and language preferences when ordering information media from Beckhoff. They will send you the requested catalog, brochures, or magazine by mail or email as soon as possible.

        -

        -

        Download information media from Beckhoff

        -

        Another way to get a Beckhoff price list pdf is to download information media from Beckhoff online. You can use their download finder tool on their website and search for various digital media, such as:

        -
          -
        • Catalogs – PDF files that contain detailed descriptions and specifications of their products
        • -
        • Data sheets – PDF files that provide technical data and dimensions of their products
        • -
        • Manuals – PDF files that offer installation and operation instructions for their products
        • -
        • Certificates – PDF files that verify the quality and safety standards of their products
        • -
        • Software – ZIP files that contain drivers, tools, libraries, and updates for their products
        • -
        -

        You can also filter your search results by product category, product group, product name, document type, language, or date when downloading information media from Beckhoff. They will provide you with a download link or a QR code to access the requested files.

        -

        Conclusion

        -

        Beckhoff is a reputable and reliable supplier of open automation systems based on PC Control technology. The company has a diverse and innovative product portfolio that can meet your automation needs in various applications and industries. However, finding a Beckhoff price list pdf may not be straightforward as they do not publish one on their website. Instead, you can order or download different information media that contain relevant and updated information about their products. By following the tips above, you can find the best Beckhoff price list pdf for your specific requirements.

        7196e7f11a
        -
        -
        \ No newline at end of file diff --git a/spaces/tioseFevbu/cartoon-converter/scripts/Download Artlantis Studio 4 Serial Number Keygen By Megadr0w 8.md b/spaces/tioseFevbu/cartoon-converter/scripts/Download Artlantis Studio 4 Serial Number Keygen By Megadr0w 8.md deleted file mode 100644 index e061c2d26d5d262b3e5b30606647bac8dfca43c2..0000000000000000000000000000000000000000 --- a/spaces/tioseFevbu/cartoon-converter/scripts/Download Artlantis Studio 4 Serial Number Keygen By Megadr0w 8.md +++ /dev/null @@ -1,19 +0,0 @@ - -

        Comment obtenir le numéro de série d'Artlantis Studio 4 par Megadr0w 8 ?

        -

        Artlantis Studio 4 est un logiciel de rendu 3D professionnel qui vous permet de créer des images et des animations réalistes de vos projets architecturaux. Mais pour profiter pleinement de ses fonctionnalités, vous avez besoin d'un numéro de série valide qui vous donne accès à la version complète du logiciel.

        -

        Download Artlantis Studio 4 Serial Number Keygen By Megadr0w 8


        Download File ☆☆☆ https://urlcod.com/2uHyxM



        -

        Malheureusement, le prix d'Artlantis Studio 4 n'est pas à la portée de tous les budgets. C'est pourquoi certains utilisateurs cherchent à obtenir le numéro de série d'Artlantis Studio 4 par Megadr0w 8, un groupe de hackers qui prétend avoir cracké le logiciel et qui le partage gratuitement sur Internet.

        -

        Mais est-ce vraiment une bonne idée ? Quels sont les risques et les inconvénients de télécharger le numéro de série d'Artlantis Studio 4 par Megadr0w 8 ? Et existe-t-il des alternatives légales et sûres pour utiliser Artlantis Studio 4 sans se ruiner ? C'est ce que nous allons voir dans cet article.

        -

        Les risques du numéro de série d'Artlantis Studio 4 par Megadr0w 8

        -

        Tout d'abord, il faut savoir que le téléchargement du numéro de série d'Artlantis Studio 4 par Megadr0w 8 est illégal. En effet, vous violez les droits d'auteur et la licence d'utilisation du logiciel, ce qui peut vous exposer à des poursuites judiciaires et à des amendes.

        -

        Ensuite, il faut être conscient que le numéro de série d'Artlantis Studio 4 par Megadr0w 8 n'est pas fiable. En effet, il peut être détecté par le système de vérification du logiciel, ce qui peut entraîner le blocage ou la désactivation du logiciel. De plus, il peut être infecté par des virus ou des logiciels malveillants qui peuvent endommager votre ordinateur ou voler vos données personnelles.

        -

        Enfin, il faut admettre que le numéro de série d'Artlantis Studio 4 par Megadr0w 8 n'est pas satisfaisant. En effet, il ne vous garantit pas la qualité et la performance du logiciel. Vous pouvez rencontrer des bugs, des erreurs ou des dysfonctionnements qui peuvent compromettre la qualité de vos rendus 3D. De plus, vous ne bénéficiez pas du support technique ni des mises à jour du logiciel.

        -

        -

        Les alternatives au numéro de série d'Artlantis Studio 4 par Megadr0w 8

        -

        Face à ces risques et ces inconvénients, il est préférable de chercher des alternatives au numéro de série d'Artlantis Studio 4 par Megadr0w 8. Voici quelques options possibles :

        -
          -
        • Utiliser la version d'essai gratuite d'Artlantis Studio 4. Vous pouvez télécharger gratuitement le logiciel sur le site officiel et l'utiliser pendant 30 jours sans limitation. Cela vous permet de tester le logiciel et de voir s'il correspond à vos besoins et à vos attentes.
        • -
        • Acheter la version éducative d'Artlantis Studio 4. Si vous êtes étudiant ou enseignant dans le domaine de l'architecture ou du design, vous pouvez bénéficier d'une réduction importante sur le prix du logiciel. Vous devez simplement fournir une preuve de votre statut académique sur le site officiel.
        • -
        • Acheter la version complète d'Artlantis Studio 4. Si vous êtes un professionnel ou un passionné de rendu 3D, vous pouvez investir dans la version complète du logiciel. Vous profiterez ainsi de toutes les fonctionnalités du logiciel, ainsi que du support technique et des mises à jour. Vous pouvez

          7b8c122e87
          -
          -
          \ No newline at end of file diff --git a/spaces/tioseFevbu/cartoon-converter/scripts/Guda Audio ? EnvelopR 1.4 VST AU WIN.OSX X86 X64 TOP.md b/spaces/tioseFevbu/cartoon-converter/scripts/Guda Audio ? EnvelopR 1.4 VST AU WIN.OSX X86 X64 TOP.md deleted file mode 100644 index 4479b3975098289189585389fcfdc66b025fa527..0000000000000000000000000000000000000000 --- a/spaces/tioseFevbu/cartoon-converter/scripts/Guda Audio ? EnvelopR 1.4 VST AU WIN.OSX X86 X64 TOP.md +++ /dev/null @@ -1,27 +0,0 @@ - -

          EnvelopR 1.4: A versatile envelope-based multi-effect plugin for Windows and Mac

          -

          EnvelopR 1.4 is a plugin that allows you to shape the sound of any audio source with various envelopes. You can use it to create sample-accurate sidechain ducking, subtle multiband panning, monophonic filtering, envelope-controlled bit crushing, and more. EnvelopR 1.4 is available for Windows and Mac in VST and AU formats, and it works with any DAW that supports these formats.

          -

          Guda Audio – EnvelopR 1.4 VST, AU WIN.OSX X86 X64


          Download Zip >>> https://urlcod.com/2uHxCx



          -

          EnvelopR 1.4 has five sections with effects that can be turned on and off individually: Amp, Amp Multiband, Filter, Pan, and Pan Multiband. Each section has its own envelope that can be free-running like an LFO or triggered by MIDI notes. You can adjust the shape, speed, depth, and offset of each envelope to create dynamic and expressive effects.

          -

          The Amp section is perfect for creating the classic sidechain ducking effect, where the volume of one sound is reduced by another sound. You can use it to make your drums punch through the mix, or to create rhythmic patterns and grooves. The Amp Multiband section lets you apply the ducking effect only to certain frequency bands, so you can have more control over the tonal balance and movement of your sound.

          -

          The Filter section offers several oversampled high-quality filter types, such as low-pass, high-pass, band-pass, notch, and peak. You can use it to add color and character to your sound, or to create sweeping effects and transitions. The Pan section lets you create easy panoramic movements across the stereo field, adding width and interest to your sound. The Pan Multiband section is similar to the Pan section, but it lets you pan different frequency bands independently.

          -

          The LoFi section adds a bit crusher and a rate reducer to EnvelopR 1.4, giving you the option to degrade and distort your sound in creative ways. You can use it to add grit and edge to your sound, or to create lo-fi effects and textures.

          -

          -

          EnvelopR 1.4 is a powerful and flexible plugin that can enhance any sound source with its envelope-based effects. Whether you want to create subtle variations or drastic transformations, EnvelopR 1.4 can help you achieve your sonic goals.

          -

          If you want to try EnvelopR 1.4 for yourself, you can download a free demo version from the GuDa Audio website[^1^]. The full version costs $29 USD/EUR and can be unlocked with a serial key[^2^]. You can also watch some video examples of EnvelopR 1.4 in action on the GuDa Audio YouTube channel[^3^].

          How to use EnvelopR 1.4

          -

          EnvelopR 1.4 is easy to use and intuitive, but it also offers a lot of options and possibilities for customization. Here are some tips and tricks on how to use EnvelopR 1.4 effectively and creatively.

          -

          How to load and adjust envelopes

          -

          To load EnvelopR 1.4 as a plugin, simply drag and drop it onto an audio track in your DAW. You will see the main interface of EnvelopR 1.4, which consists of five sections: Amp, Amp Multiband, Filter, Pan, and Pan Multiband. Each section has a button to turn it on or off, a knob to adjust the mix level, and a display that shows the envelope shape and settings.

          -

          To edit the envelope of each section, click on the display to open the envelope editor. Here you can adjust the shape, speed, depth, and offset of the envelope by dragging the nodes and handles. You can also choose between different envelope modes: Free (the envelope runs continuously like an LFO), Note (the envelope is triggered by MIDI notes), or Gate (the envelope is triggered by audio input). You can also sync the envelope speed to your DAW tempo, or set it manually in Hz or milliseconds.

          -

          To close the envelope editor, click anywhere outside of it. You can also right-click on the display to access a menu with different options, such as copying and pasting envelopes between sections, resetting envelopes to default values, or changing the GUI style and size.

          -

          How to use the Amp section

          -

          The Amp section is where you can create the classic sidechain ducking effect, where the volume of one sound is reduced by another sound. For example, you can use it to make your bass line duck when the kick drum hits, creating a pumping effect that adds groove and energy to your track.

          -

          To use the Amp section for sidechain ducking, you need to set up a sidechain source in your DAW. This is usually done by routing the output of another track (such as a kick drum) to the input of EnvelopR 1.4. The exact method may vary depending on your DAW, so check your DAW manual for details.

          -

          Once you have set up the sidechain source, turn on the Amp section and open the envelope editor. Set the envelope mode to Gate, so that the envelope is triggered by the sidechain signal. Adjust the shape of the envelope to create a smooth or sharp ducking effect. You can also adjust the depth knob to control how much volume reduction is applied.

          -

          You can also use the Amp section for other effects, such as tremolo (a periodic variation in volume), stutter (a rapid repetition of sound), or glitch (a random or chaotic alteration of sound). To do this, you can use different envelope modes and shapes, and experiment with different speed and depth settings.

          -

          How to use the Amp Multiband section

          -

          The Amp Multiband section is similar to the Amp section, but it lets you apply the ducking effect only to certain frequency bands, instead of the whole sound spectrum. This gives you more control over the tonal balance and movement of your sound.

          -

          To use the Amp Multiband section, turn it on and open the envelope editor. You will see three frequency bands: Low, Mid, and High. Each band has its own envelope shape and settings, which you can edit independently or together by holding Shift or Ctrl while dragging. You can also adjust the frequency range of each band by dragging the vertical lines on the spectrum analyzer.

          -

          You can use different envelope modes and shapes for each band, creating complex and interesting effects. For example, you can use Note mode for the Low band and Free mode for the Mid and High bands, creating a rhythmic ducking effect for the bass frequencies and a smooth panning effect for the higher frequencies.

          cec2833e83
          -
          -
          \ No newline at end of file diff --git a/spaces/tioseFevbu/cartoon-converter/scripts/Hypertherm ProNest 2020 Crack License Key Free HOT Download.md b/spaces/tioseFevbu/cartoon-converter/scripts/Hypertherm ProNest 2020 Crack License Key Free HOT Download.md deleted file mode 100644 index 69b5be1d959cf82a68fd29c0c6a22ce85b626bb8..0000000000000000000000000000000000000000 --- a/spaces/tioseFevbu/cartoon-converter/scripts/Hypertherm ProNest 2020 Crack License Key Free HOT Download.md +++ /dev/null @@ -1,113 +0,0 @@ - -

          Hypertherm ProNest 2020 Crack License Key Free Download

          -

          If you are looking for a powerful nesting software for advanced mechanized cutting, you may want to check out Hypertherm ProNest 2020. This is a comprehensive CAD/CAM software that can optimize performance for plasma, laser, waterjet, and oxyfuel cutting machines. It is designed to supercharge your cutting operation, helping you achieve greater automation, efficiency, and profitability.

          -

          Hypertherm ProNest 2020 Crack License Key Free Download


          Download Ziphttps://urlcod.com/2uHvcU



          -

          However, Hypertherm ProNest 2020 is not a cheap software. It costs thousands of dollars to purchase a license key from the official website. If you are on a tight budget or just want to try it out before buying it, you may be tempted to look for a crack license key that can unlock all the features of ProNest 202 0. But is it worth the risk? In this article, we will review the features of Hypertherm ProNest 2020, show you how to download and install the crack license key, and discuss the pros and cons of using it. By the end of this article, you will have a better idea of whether Hypertherm ProNest 2020 crack license key is right for you or not.

          -

          Features of Hypertherm ProNest 2020

          -

          Hypertherm ProNest 2020 is a state-of-the-art nesting software that can handle any type of cutting machine and any material. It has many features that make it stand out from other nesting software, such as:

          -

          Material cost savings

          -

          ProNest can reduce material waste and increase profitability with high-yield nesting. It uses advanced algorithms to optimize the placement and orientation of parts on the sheet, minimizing scrap and maximizing material utilization. It also supports common-line cutting, chain cutting, bridge cutting, and skeleton cut-up to further reduce material consumption and cut time.

          -

          -

          Ease of use

          -

          ProNest is easy to learn and use, with intuitive screens and helpful features. It has a user-friendly interface that guides you through the entire nesting process, from importing CAD files to generating NC code. It also has a drag-and-drop functionality that allows you to quickly and easily modify nests, parts, and sheets. It also has a built-in help system that provides context-sensitive assistance and tutorials.

          -

          Breakthrough technologies

          -

          ProNest supports Hypertherm's SureCut technologies, such as True Hole, Rapid Part, PlateSaver, and True Bevel. These are patented technologies that enhance the quality and performance of Hypertherm cutting systems, delivering optimal hole quality, faster cutting speeds, longer consumable life, and accurate bevel angles.

          -

          Increased productivity

          -

          ProNest can speed up programming time and cut time with automated interface and specialized cutting techniques. It can automatically import CAD files from various formats, such as DXF, DWG, IGES, STEP, etc. It can also automatically apply cut settings, lead-ins, lead-outs, sequencing, and nesting parameters based on the material type, thickness, machine model, and process. It can also use advanced cutting techniques such as multi-torch cutting, TrueShape nesting, collision avoidance, tabbing, etc.

          -

          Beyond nesting

          -

          ProNest can help manage the entire cutting operation, from quoting to work orders to machine status. It can generate detailed reports and charts that show material usage, cost estimation, job tracking, inventory management, etc. It can also integrate with other software systems such as ERP/MRP, CAD/CAM, MES, etc. It can also monitor and control the cutting machines remotely via ProNest CNC or ProNest LTS.

          -

          Unlimited technical support

          -

          ProNest provides unlimited access to technical support, training, and software updates. You can contact the Hypertherm technical team via phone, email, or online chat anytime you need assistance. You can also access online resources such as manuals, videos, webinars, forums, etc. You can also receive free software updates that include new features and enhancements.

          -

          How to Download and Install Hypertherm ProNest 2020 Crack License Key

          -

          If you are interested in trying out Hypertherm ProNest 2020 without paying for it, you can download and install the crack license key from the link below. However, please note that this is not a legal or safe way to use the software, and we do not endorse or recommend it. You may face legal consequences, security risks, compatibility problems, and other issues if you use the crack license key. Use it at your own risk and discretion.

          -

          System requirements

          -

          Before you download and install Hypertherm ProNest 2020 crack license key, make sure your PC meets the following minimum and recommended system requirements:

          - | Minimum | Recommended | | --- | --- | | Operating system: Windows 7 SP1 or later (64-bit) | Operating system: Windows 10 (64-bit) | | Processor: Intel Core i3 or equivalent | Processor: Intel Core i5 or equivalent | | Memory: 4 GB RAM | Memory: 8 GB RAM | | Hard disk space: 4 GB available | Hard disk space: 8 GB available | | Graphics: Integrated or discrete with 512 MB VRAM | Graphics: Discrete with 1 GB VRAM | | Display: 1024 x 768 resolution | Display: 1920 x 1080 resolution |

          Download link

          -

          You can download Hypertherm ProNest 2020 crack license key from this link: [Hypertherm ProNest 2020 Crack License Key Free Download]. This is a compressed file that contains the setup file and the crack file. You will need to extract it using a program like WinRAR or 7-Zip before installing it.

          -

          Installation steps

          -

          Follow these steps to install Hypertherm ProNest 2020 crack license key on your PC:

          -
            -
          1. Disable your antivirus software and internet connection temporarily.
          2. -
          3. Extract the downloaded file to a folder on your PC.
          4. -
          5. Run the setup file as administrator and follow the instructions to install ProNest 2020.
          6. -
          7. Do not launch ProNest 2020 after installation.
          8. -
          9. Copy the crack file from the folder and paste it to the installation directory of ProNest 2020. Replace the original file if prompted.
          10. -
          11. Launch ProNest 2020 and enter any license key when asked. You can use any of these keys:
          12. -
              -
            • PN20-1234-5678-9012-3456
            • -
            • PN20-9876-5432-1098-7654
            • -
            • PN20-4567-8901-2345-6789
            • -
            -
          13. Enjoy using Hypertherm ProNest 2020 with full features.
          14. -
          -

          How to Use Hypertherm ProNest 2020 Crack License Key

          -

          Once you have installed Hypertherm ProNest 2020 crack license key, you can start using it to create and optimize nests for your cutting machines. Here is a basic workflow of how to use ProNest 2020:

          -

          Basic workflow

          -
            -
          1. Import CAD files from your preferred design software or create parts using ProNest's built-in CAD tools.
          2. -
          3. Select the material type, thickness, machine model, and process for your parts.
          4. -
          5. Apply cut settings, lead-ins, lead-outs, sequencing, and nesting parameters for your parts.
          6. -
          7. Create a nest by dragging and dropping parts onto a sheet or using the automatic nesting function.
          8. -
          9. Edit the nest as needed by moving, rotating, mirroring, copying, or deleting parts or sheets.
          10. -
          11. Generate NC code for your nest and save it to a folder or send it directly to your cutting machine.
          12. -
          13. Cut your parts using your cutting machine and monitor the progress using ProNest CNC or ProNest LTS.
          14. -
          -

          Tips and tricks

          -

          Here are some tips and tricks on how to use ProNest 2020 more efficiently and effectively:

          -
            -
          • Use the right-click menu to access common commands and options for parts, sheets, nests, etc.
          • -
          • Use keyboard shortcuts to perform actions faster and easier. You can view the list of keyboard shortcuts by pressing F1 or clicking Help > Keyboard Shortcuts.
          • -
          • Use the Quick Access Toolbar to customize and access your frequently used commands. You can add or remove commands by right-clicking on the toolbar and selecting Customize Quick Access Toolbar.
          • -
          • Use the Ribbon tabs to access different functions and features of ProNest. You can switch between tabs by clicking on them or pressing Ctrl + Tab.
          • -
          • Use the Status Bar to view information about your current project, such as the number of parts, sheets, nests, material usage, etc. You can also use the Status Bar to change the units, zoom level, view mode, etc.
          • -
          • Use the Nest Explorer to view and manage your parts, sheets, and nests. You can also use the Nest Explorer to import or export parts, sheets, or nests.
          • -
          • Use the Part Library to store and organize your frequently used parts. You can also use the Part Library to edit or delete parts, or create new parts from existing ones.
          • -
          • Use the Material Library to store and organize your material types and thicknesses. You can also use the Material Library to edit or delete materials, or create new materials from existing ones.
          • -
          • Use the Cut Settings Library to store and organize your cut settings for different materials, machines, and processes. You can also use the Cut Settings Library to edit or delete cut settings, or create new cut settings from existing ones.
          • -
          • Use the Reports function to generate and print various reports and charts for your project, such as material usage, cost estimation, job tracking, inventory management, etc.
          • -
          • Use the Preferences function to customize and configure various settings and options for ProNest, such as general settings, display settings, import/export settings, nesting settings, etc.
          • -
          -

          Pros and Cons of Hypertherm ProNest 2020 Crack License Key

          -

          Using Hypertherm ProNest 2020 crack license key may seem like a good idea at first glance, but it also comes with some drawbacks that you should be aware of. Here are some pros and cons of using Hypertherm ProNest 2020 crack license key:

          -

          Pros

          -
            -
          • You can save money by not paying for the official license key.
          • -
          • You can access all the features and functions of ProNest 2020 without any limitations or restrictions.
          • -
          • You can use ProNest 2020 on any PC without needing an internet connection or a dongle.
          • -
          • You can update ProNest 2020 with new crack license keys whenever they are available.
          • -
          -

          Cons

          -
            -
          • You may face legal consequences if you are caught using a pirated software. You may be fined or sued by Hypertherm or other parties for violating their intellectual property rights.
          • -
          • You may expose your PC to security risks if you download and install a crack license key from an untrusted source. You may infect your PC with malware, viruses, spyware, ransomware, etc. that can harm your data and system.
          • -
          • You may encounter compatibility problems if you use a crack license key that is not compatible with your PC or your cutting machine. You may experience errors, crashes, glitches, bugs, etc. that can affect your performance and quality.
          • -
          • You may miss out on technical support, training, and software updates from Hypertherm. You may not be able to contact the Hypertherm technical team for assistance or access online resources for learning. You may also not be able to receive new features and enhancements that are included in the official software updates.
          • -
          -

          Conclusion

          -

          Hypertherm ProNest 2020 is a powerful nesting software that can optimize performance for plasma, laser, waterjet, and oxyfuel cutting machines. It has many features that can help you reduce material waste, increase productivity, enhance quality, and manage your entire cutting operation. However, Hypertherm ProNest 2020 is not a cheap software. It costs thousands of dollars to purchase a license key from the official website.

          -

          If you are on a tight budget or just want to try it out before buying it, you may be tempted to look for a crack license key that can unlock all the features of ProNest 2020. But is it worth the risk? Using a crack license key may save you money, but it also comes with some drawbacks, such as legal issues, security risks, compatibility problems, and lack of technical support. You may end up losing more than you gain if you use a crack license key.

          -

          Therefore, we suggest that you use Hypertherm ProNest 2020 crack license key only for testing purposes and not for commercial or professional use. If you like the software and want to use it for your cutting operation, we recommend that you purchase the official license key from the Hypertherm website. This way, you can enjoy all the benefits of ProNest 2020 without any worries or hassles.

          -

          We hope this article has given you some useful information and insights about Hypertherm ProNest 2020 crack license key. If you have any questions or comments, please feel free to leave them below. Thank you for reading and happy cutting!

          -

          FAQs

          -

          Here are some frequently asked questions and answers about Hypertherm ProNest 2020 crack license key:

          -

          Q: What is the difference between ProNest 2020 and ProNest 2019?

          -

          A: ProNest 2020 is the latest version of ProNest that was released in 2020. It has some new features and improvements over ProNest 2019, such as:

          -
            -
          • Improved user interface with dark theme option
          • -
          • Enhanced CAD import with support for more formats and features
          • -
          • New nesting engine with faster and better results
          • -
          • New cut settings library with more options and flexibility
          • -
          • New reports function with more customization and export options
          • -
          • New integration with Hypertherm's Robotmaster software for robotic cutting
          • -
          • New support for Hypertherm's X-Definition plasma system
          • -
          -

          Q: How can I get a free trial of ProNest 2020?

          -

          A: You can get a free trial of ProNest 2020 by visiting the Hypertherm website and filling out a form. You will receive an email with a link to download the trial version of ProNest 2020. The trial version is valid for 14 days and has all the features of the full version.

          -

          Q: How can I update my ProNest 2020 to the latest version?

          -

          A: If you have purchased the official license key of ProNest 2020, you can update your software to the latest version by clicking Help > Check for Updates in ProNest 2020. You will be notified if there are any available updates and you can download and install them automatically.

          -

          Q: How can I contact Hypertherm technical support?

          -

          A: If you need any assistance or have any issues with ProNest 2020, you can contact Hypertherm technical support by phone, email, or online chat. You can find the contact details on the Hypertherm website or in the Help menu of ProNest 2020.

          -

          Q: How can I learn more about ProNest 2020?

          -

          A: You can learn more about ProNest 2020 by accessing the online resources provided by Hypertherm, such as manuals, videos, webinars, forums, etc. You can find these resources on the Hypertherm website or in the Help menu of ProNest 2020.

          b2dd77e56b
          -
          -
          \ No newline at end of file diff --git a/spaces/tioseFevbu/cartoon-converter/scripts/Increase The Security Of Your Facebook ID No One Can Hack Facebook Account.md b/spaces/tioseFevbu/cartoon-converter/scripts/Increase The Security Of Your Facebook ID No One Can Hack Facebook Account.md deleted file mode 100644 index 060e73c4bb13293ece426b78e9a2182b8f22b92a..0000000000000000000000000000000000000000 --- a/spaces/tioseFevbu/cartoon-converter/scripts/Increase The Security Of Your Facebook ID No One Can Hack Facebook Account.md +++ /dev/null @@ -1,17 +0,0 @@ - -

          How to Increase the Security of Your Facebook ID and Prevent Hacking

          -

          Facebook is one of the most popular social media platforms in the world, with billions of users who share their personal information, photos, videos, and messages with their friends and family. However, this also makes Facebook a target for hackers, spammers, and malicious sites that want to access your account and use it for their own purposes. If you want to protect your Facebook ID and prevent hacking, here are some tips and settings you should know and implement right now.

          -

          Increase the security of your Facebook ID, no one can hack facebook account


          Downloadhttps://urlcod.com/2uHwgY



          -

          1. Choose a Strong Password

          -

          One of the most important things you can do to secure your Facebook account is to choose a strong password that is hard to guess or crack. A strong password should be at least 8 characters long, include uppercase and lowercase letters, numbers, and symbols, and avoid common words or phrases. You should also change your password regularly and never use the same password for other sites or accounts. To change your password, go to Settings > General > Password and follow the instructions[^2^].

          -

          2. Use Login Approvals

          -

          A strong password is not enough to really secure your account. You should also enable login approvals, which is a feature that requires you to enter a code sent to your phone or email whenever you or someone else tries to log in to your account from an unfamiliar device or browser. This way, even if someone knows your password, they won't be able to access your account without your approval. To enable login approvals, go to Settings > Security and Login > Two-Factor Authentication and turn on the option[^1^].

          -

          3. Enable Login Alerts and See Who's Logged Into Your Account

          -

          Another way to keep track of your account activity and spot any suspicious logins is to enable login alerts and see who's logged into your account. Login alerts will notify you via email or phone whenever your account is accessed from a new device or browser. You can also see a list of devices and browsers that are currently logged into your account and log out any that you don't recognize. To enable login alerts and see who's logged into your account, go to Settings > Security and Login > Get alerts about unrecognized logins and Where you're logged in[^1^].

          -

          4. Audit the Apps that Have Permission to Access Your Facebook Account

          -

          If you use Facebook to sign in to other apps or websites, you should be careful about what information you share with them and what permissions you grant them. Some apps or websites may access your personal data, photos, friends list, or even post on your behalf without your knowledge or consent. To audit the apps that have permission to access your Facebook account, go to Settings > Apps and Websites and review the list of active, expired, or removed apps. You can click on View and Edit for each app to see what information they can access and change the settings accordingly. You can also remove any apps that you don't use or trust[^3^].

          -

          5. Peruse the Rest of the Security Settings

          -

          There are other security settings that you can explore and adjust according to your preferences and needs. For example, you can choose who can see your profile information, posts, photos, stories, tags, friends list, etc., by going to Settings > Privacy[^4^]. You can also restrict the ads you see on Facebook based on your interests, preferences, or actions by going to Settings > Ads[^2^]. You can also report any abusive or inappropriate content or behavior that you encounter on Facebook by clicking on the three dots icon on the top right corner of any post or profile[^4^].

          -

          By following these tips and settings, you can increase the security of your Facebook ID and prevent hacking. However, you should also be vigilant and cautious when using Facebook or any other online platform. Don't click on suspicious links or attachments, don't share your password with anyone, don't accept friend requests from strangers, and don't fall for phishing scams or fake messages that ask for your personal information or money. Remember that your online security is in your hands.

          7b8c122e87
          -
          -
          \ No newline at end of file diff --git a/spaces/tjburns/ask_marcus_aurelius/.venv/lib/python3.10/site-packages/pip/_internal/index/sources.py b/spaces/tjburns/ask_marcus_aurelius/.venv/lib/python3.10/site-packages/pip/_internal/index/sources.py deleted file mode 100644 index eec3f12f7e394a9eba2ebc43cf754a0040cdebf3..0000000000000000000000000000000000000000 --- a/spaces/tjburns/ask_marcus_aurelius/.venv/lib/python3.10/site-packages/pip/_internal/index/sources.py +++ /dev/null @@ -1,224 +0,0 @@ -import logging -import mimetypes -import os -import pathlib -from typing import Callable, Iterable, Optional, Tuple - -from pip._internal.models.candidate import InstallationCandidate -from pip._internal.models.link import Link -from pip._internal.utils.urls import path_to_url, url_to_path -from pip._internal.vcs import is_url - -logger = logging.getLogger(__name__) - -FoundCandidates = Iterable[InstallationCandidate] -FoundLinks = Iterable[Link] -CandidatesFromPage = Callable[[Link], Iterable[InstallationCandidate]] -PageValidator = Callable[[Link], bool] - - -class LinkSource: - @property - def link(self) -> Optional[Link]: - """Returns the underlying link, if there's one.""" - raise NotImplementedError() - - def page_candidates(self) -> FoundCandidates: - """Candidates found by parsing an archive listing HTML file.""" - raise NotImplementedError() - - def file_links(self) -> FoundLinks: - """Links found by specifying archives directly.""" - raise NotImplementedError() - - -def _is_html_file(file_url: str) -> bool: - return mimetypes.guess_type(file_url, strict=False)[0] == "text/html" - - -class _FlatDirectorySource(LinkSource): - """Link source specified by ``--find-links=``. - - This looks the content of the directory, and returns: - - * ``page_candidates``: Links listed on each HTML file in the directory. - * ``file_candidates``: Archives in the directory. - """ - - def __init__( - self, - candidates_from_page: CandidatesFromPage, - path: str, - ) -> None: - self._candidates_from_page = candidates_from_page - self._path = pathlib.Path(os.path.realpath(path)) - - @property - def link(self) -> Optional[Link]: - return None - - def page_candidates(self) -> FoundCandidates: - for path in self._path.iterdir(): - url = path_to_url(str(path)) - if not _is_html_file(url): - continue - yield from self._candidates_from_page(Link(url)) - - def file_links(self) -> FoundLinks: - for path in self._path.iterdir(): - url = path_to_url(str(path)) - if _is_html_file(url): - continue - yield Link(url) - - -class _LocalFileSource(LinkSource): - """``--find-links=`` or ``--[extra-]index-url=``. - - If a URL is supplied, it must be a ``file:`` URL. If a path is supplied to - the option, it is converted to a URL first. This returns: - - * ``page_candidates``: Links listed on an HTML file. - * ``file_candidates``: The non-HTML file. - """ - - def __init__( - self, - candidates_from_page: CandidatesFromPage, - link: Link, - ) -> None: - self._candidates_from_page = candidates_from_page - self._link = link - - @property - def link(self) -> Optional[Link]: - return self._link - - def page_candidates(self) -> FoundCandidates: - if not _is_html_file(self._link.url): - return - yield from self._candidates_from_page(self._link) - - def file_links(self) -> FoundLinks: - if _is_html_file(self._link.url): - return - yield self._link - - -class _RemoteFileSource(LinkSource): - """``--find-links=`` or ``--[extra-]index-url=``. - - This returns: - - * ``page_candidates``: Links listed on an HTML file. - * ``file_candidates``: The non-HTML file. - """ - - def __init__( - self, - candidates_from_page: CandidatesFromPage, - page_validator: PageValidator, - link: Link, - ) -> None: - self._candidates_from_page = candidates_from_page - self._page_validator = page_validator - self._link = link - - @property - def link(self) -> Optional[Link]: - return self._link - - def page_candidates(self) -> FoundCandidates: - if not self._page_validator(self._link): - return - yield from self._candidates_from_page(self._link) - - def file_links(self) -> FoundLinks: - yield self._link - - -class _IndexDirectorySource(LinkSource): - """``--[extra-]index-url=``. - - This is treated like a remote URL; ``candidates_from_page`` contains logic - for this by appending ``index.html`` to the link. - """ - - def __init__( - self, - candidates_from_page: CandidatesFromPage, - link: Link, - ) -> None: - self._candidates_from_page = candidates_from_page - self._link = link - - @property - def link(self) -> Optional[Link]: - return self._link - - def page_candidates(self) -> FoundCandidates: - yield from self._candidates_from_page(self._link) - - def file_links(self) -> FoundLinks: - return () - - -def build_source( - location: str, - *, - candidates_from_page: CandidatesFromPage, - page_validator: PageValidator, - expand_dir: bool, - cache_link_parsing: bool, -) -> Tuple[Optional[str], Optional[LinkSource]]: - - path: Optional[str] = None - url: Optional[str] = None - if os.path.exists(location): # Is a local path. - url = path_to_url(location) - path = location - elif location.startswith("file:"): # A file: URL. - url = location - path = url_to_path(location) - elif is_url(location): - url = location - - if url is None: - msg = ( - "Location '%s' is ignored: " - "it is either a non-existing path or lacks a specific scheme." - ) - logger.warning(msg, location) - return (None, None) - - if path is None: - source: LinkSource = _RemoteFileSource( - candidates_from_page=candidates_from_page, - page_validator=page_validator, - link=Link(url, cache_link_parsing=cache_link_parsing), - ) - return (url, source) - - if os.path.isdir(path): - if expand_dir: - source = _FlatDirectorySource( - candidates_from_page=candidates_from_page, - path=path, - ) - else: - source = _IndexDirectorySource( - candidates_from_page=candidates_from_page, - link=Link(url, cache_link_parsing=cache_link_parsing), - ) - return (url, source) - elif os.path.isfile(path): - source = _LocalFileSource( - candidates_from_page=candidates_from_page, - link=Link(url, cache_link_parsing=cache_link_parsing), - ) - return (url, source) - logger.warning( - "Location '%s' is ignored: it is neither a file nor a directory.", - location, - ) - return (url, None) diff --git a/spaces/tjburns/ask_marcus_aurelius/.venv/lib/python3.10/site-packages/pip/_internal/utils/temp_dir.py b/spaces/tjburns/ask_marcus_aurelius/.venv/lib/python3.10/site-packages/pip/_internal/utils/temp_dir.py deleted file mode 100644 index 8ee8a1cb18017880cd0bebd66bc2cec5702118c6..0000000000000000000000000000000000000000 --- a/spaces/tjburns/ask_marcus_aurelius/.venv/lib/python3.10/site-packages/pip/_internal/utils/temp_dir.py +++ /dev/null @@ -1,246 +0,0 @@ -import errno -import itertools -import logging -import os.path -import tempfile -from contextlib import ExitStack, contextmanager -from typing import Any, Dict, Generator, Optional, TypeVar, Union - -from pip._internal.utils.misc import enum, rmtree - -logger = logging.getLogger(__name__) - -_T = TypeVar("_T", bound="TempDirectory") - - -# Kinds of temporary directories. Only needed for ones that are -# globally-managed. -tempdir_kinds = enum( - BUILD_ENV="build-env", - EPHEM_WHEEL_CACHE="ephem-wheel-cache", - REQ_BUILD="req-build", -) - - -_tempdir_manager: Optional[ExitStack] = None - - -@contextmanager -def global_tempdir_manager() -> Generator[None, None, None]: - global _tempdir_manager - with ExitStack() as stack: - old_tempdir_manager, _tempdir_manager = _tempdir_manager, stack - try: - yield - finally: - _tempdir_manager = old_tempdir_manager - - -class TempDirectoryTypeRegistry: - """Manages temp directory behavior""" - - def __init__(self) -> None: - self._should_delete: Dict[str, bool] = {} - - def set_delete(self, kind: str, value: bool) -> None: - """Indicate whether a TempDirectory of the given kind should be - auto-deleted. - """ - self._should_delete[kind] = value - - def get_delete(self, kind: str) -> bool: - """Get configured auto-delete flag for a given TempDirectory type, - default True. - """ - return self._should_delete.get(kind, True) - - -_tempdir_registry: Optional[TempDirectoryTypeRegistry] = None - - -@contextmanager -def tempdir_registry() -> Generator[TempDirectoryTypeRegistry, None, None]: - """Provides a scoped global tempdir registry that can be used to dictate - whether directories should be deleted. - """ - global _tempdir_registry - old_tempdir_registry = _tempdir_registry - _tempdir_registry = TempDirectoryTypeRegistry() - try: - yield _tempdir_registry - finally: - _tempdir_registry = old_tempdir_registry - - -class _Default: - pass - - -_default = _Default() - - -class TempDirectory: - """Helper class that owns and cleans up a temporary directory. - - This class can be used as a context manager or as an OO representation of a - temporary directory. - - Attributes: - path - Location to the created temporary directory - delete - Whether the directory should be deleted when exiting - (when used as a contextmanager) - - Methods: - cleanup() - Deletes the temporary directory - - When used as a context manager, if the delete attribute is True, on - exiting the context the temporary directory is deleted. - """ - - def __init__( - self, - path: Optional[str] = None, - delete: Union[bool, None, _Default] = _default, - kind: str = "temp", - globally_managed: bool = False, - ): - super().__init__() - - if delete is _default: - if path is not None: - # If we were given an explicit directory, resolve delete option - # now. - delete = False - else: - # Otherwise, we wait until cleanup and see what - # tempdir_registry says. - delete = None - - # The only time we specify path is in for editables where it - # is the value of the --src option. - if path is None: - path = self._create(kind) - - self._path = path - self._deleted = False - self.delete = delete - self.kind = kind - - if globally_managed: - assert _tempdir_manager is not None - _tempdir_manager.enter_context(self) - - @property - def path(self) -> str: - assert not self._deleted, f"Attempted to access deleted path: {self._path}" - return self._path - - def __repr__(self) -> str: - return f"<{self.__class__.__name__} {self.path!r}>" - - def __enter__(self: _T) -> _T: - return self - - def __exit__(self, exc: Any, value: Any, tb: Any) -> None: - if self.delete is not None: - delete = self.delete - elif _tempdir_registry: - delete = _tempdir_registry.get_delete(self.kind) - else: - delete = True - - if delete: - self.cleanup() - - def _create(self, kind: str) -> str: - """Create a temporary directory and store its path in self.path""" - # We realpath here because some systems have their default tmpdir - # symlinked to another directory. This tends to confuse build - # scripts, so we canonicalize the path by traversing potential - # symlinks here. - path = os.path.realpath(tempfile.mkdtemp(prefix=f"pip-{kind}-")) - logger.debug("Created temporary directory: %s", path) - return path - - def cleanup(self) -> None: - """Remove the temporary directory created and reset state""" - self._deleted = True - if not os.path.exists(self._path): - return - rmtree(self._path) - - -class AdjacentTempDirectory(TempDirectory): - """Helper class that creates a temporary directory adjacent to a real one. - - Attributes: - original - The original directory to create a temp directory for. - path - After calling create() or entering, contains the full - path to the temporary directory. - delete - Whether the directory should be deleted when exiting - (when used as a contextmanager) - - """ - - # The characters that may be used to name the temp directory - # We always prepend a ~ and then rotate through these until - # a usable name is found. - # pkg_resources raises a different error for .dist-info folder - # with leading '-' and invalid metadata - LEADING_CHARS = "-~.=%0123456789" - - def __init__(self, original: str, delete: Optional[bool] = None) -> None: - self.original = original.rstrip("/\\") - super().__init__(delete=delete) - - @classmethod - def _generate_names(cls, name: str) -> Generator[str, None, None]: - """Generates a series of temporary names. - - The algorithm replaces the leading characters in the name - with ones that are valid filesystem characters, but are not - valid package names (for both Python and pip definitions of - package). - """ - for i in range(1, len(name)): - for candidate in itertools.combinations_with_replacement( - cls.LEADING_CHARS, i - 1 - ): - new_name = "~" + "".join(candidate) + name[i:] - if new_name != name: - yield new_name - - # If we make it this far, we will have to make a longer name - for i in range(len(cls.LEADING_CHARS)): - for candidate in itertools.combinations_with_replacement( - cls.LEADING_CHARS, i - ): - new_name = "~" + "".join(candidate) + name - if new_name != name: - yield new_name - - def _create(self, kind: str) -> str: - root, name = os.path.split(self.original) - for candidate in self._generate_names(name): - path = os.path.join(root, candidate) - try: - os.mkdir(path) - except OSError as ex: - # Continue if the name exists already - if ex.errno != errno.EEXIST: - raise - else: - path = os.path.realpath(path) - break - else: - # Final fallback on the default behavior. - path = os.path.realpath(tempfile.mkdtemp(prefix=f"pip-{kind}-")) - - logger.debug("Created temporary directory: %s", path) - return path diff --git a/spaces/tjburns/ask_marcus_aurelius/.venv/lib/python3.10/site-packages/pip/_vendor/pygments/regexopt.py b/spaces/tjburns/ask_marcus_aurelius/.venv/lib/python3.10/site-packages/pip/_vendor/pygments/regexopt.py deleted file mode 100644 index ae0079199b9b026f327aaaa729411f1a43c6cb60..0000000000000000000000000000000000000000 --- a/spaces/tjburns/ask_marcus_aurelius/.venv/lib/python3.10/site-packages/pip/_vendor/pygments/regexopt.py +++ /dev/null @@ -1,91 +0,0 @@ -""" - pygments.regexopt - ~~~~~~~~~~~~~~~~~ - - An algorithm that generates optimized regexes for matching long lists of - literal strings. - - :copyright: Copyright 2006-2022 by the Pygments team, see AUTHORS. - :license: BSD, see LICENSE for details. -""" - -import re -from re import escape -from os.path import commonprefix -from itertools import groupby -from operator import itemgetter - -CS_ESCAPE = re.compile(r'[\[\^\\\-\]]') -FIRST_ELEMENT = itemgetter(0) - - -def make_charset(letters): - return '[' + CS_ESCAPE.sub(lambda m: '\\' + m.group(), ''.join(letters)) + ']' - - -def regex_opt_inner(strings, open_paren): - """Return a regex that matches any string in the sorted list of strings.""" - close_paren = open_paren and ')' or '' - # print strings, repr(open_paren) - if not strings: - # print '-> nothing left' - return '' - first = strings[0] - if len(strings) == 1: - # print '-> only 1 string' - return open_paren + escape(first) + close_paren - if not first: - # print '-> first string empty' - return open_paren + regex_opt_inner(strings[1:], '(?:') \ - + '?' + close_paren - if len(first) == 1: - # multiple one-char strings? make a charset - oneletter = [] - rest = [] - for s in strings: - if len(s) == 1: - oneletter.append(s) - else: - rest.append(s) - if len(oneletter) > 1: # do we have more than one oneletter string? - if rest: - # print '-> 1-character + rest' - return open_paren + regex_opt_inner(rest, '') + '|' \ - + make_charset(oneletter) + close_paren - # print '-> only 1-character' - return open_paren + make_charset(oneletter) + close_paren - prefix = commonprefix(strings) - if prefix: - plen = len(prefix) - # we have a prefix for all strings - # print '-> prefix:', prefix - return open_paren + escape(prefix) \ - + regex_opt_inner([s[plen:] for s in strings], '(?:') \ - + close_paren - # is there a suffix? - strings_rev = [s[::-1] for s in strings] - suffix = commonprefix(strings_rev) - if suffix: - slen = len(suffix) - # print '-> suffix:', suffix[::-1] - return open_paren \ - + regex_opt_inner(sorted(s[:-slen] for s in strings), '(?:') \ - + escape(suffix[::-1]) + close_paren - # recurse on common 1-string prefixes - # print '-> last resort' - return open_paren + \ - '|'.join(regex_opt_inner(list(group[1]), '') - for group in groupby(strings, lambda s: s[0] == first[0])) \ - + close_paren - - -def regex_opt(strings, prefix='', suffix=''): - """Return a compiled regex that matches any string in the given list. - - The strings to match must be literal strings, not regexes. They will be - regex-escaped. - - *prefix* and *suffix* are pre- and appended to the final regex. - """ - strings = sorted(strings) - return prefix + regex_opt_inner(strings, '(') + suffix diff --git a/spaces/tomofi/MMOCR/tools/data/textdet/textocr_converter.py b/spaces/tomofi/MMOCR/tools/data/textdet/textocr_converter.py deleted file mode 100644 index 50b6a62add453a9c6e850aa555d661041a0587fb..0000000000000000000000000000000000000000 --- a/spaces/tomofi/MMOCR/tools/data/textdet/textocr_converter.py +++ /dev/null @@ -1,75 +0,0 @@ -# Copyright (c) OpenMMLab. All rights reserved. -import argparse -import math -import os.path as osp - -import mmcv - -from mmocr.utils import convert_annotations - - -def parse_args(): - parser = argparse.ArgumentParser( - description='Generate training and validation set of TextOCR ') - parser.add_argument('root_path', help='Root dir path of TextOCR') - args = parser.parse_args() - return args - - -def collect_textocr_info(root_path, annotation_filename, print_every=1000): - - annotation_path = osp.join(root_path, annotation_filename) - if not osp.exists(annotation_path): - raise Exception( - f'{annotation_path} not exists, please check and try again.') - - annotation = mmcv.load(annotation_path) - - # img_idx = img_start_idx - img_infos = [] - for i, img_info in enumerate(annotation['imgs'].values()): - if i > 0 and i % print_every == 0: - print(f'{i}/{len(annotation["imgs"].values())}') - - img_info['segm_file'] = annotation_path - ann_ids = annotation['imgToAnns'][img_info['id']] - anno_info = [] - for ann_id in ann_ids: - ann = annotation['anns'][ann_id] - - # Ignore illegible or non-English words - text_label = ann['utf8_string'] - iscrowd = 1 if text_label == '.' else 0 - - x, y, w, h = ann['bbox'] - x, y = max(0, math.floor(x)), max(0, math.floor(y)) - w, h = math.ceil(w), math.ceil(h) - bbox = [x, y, w, h] - segmentation = [max(0, int(x)) for x in ann['points']] - anno = dict( - iscrowd=iscrowd, - category_id=1, - bbox=bbox, - area=ann['area'], - segmentation=[segmentation]) - anno_info.append(anno) - img_info.update(anno_info=anno_info) - img_infos.append(img_info) - return img_infos - - -def main(): - args = parse_args() - root_path = args.root_path - print('Processing training set...') - training_infos = collect_textocr_info(root_path, 'TextOCR_0.1_train.json') - convert_annotations(training_infos, - osp.join(root_path, 'instances_training.json')) - print('Processing validation set...') - val_infos = collect_textocr_info(root_path, 'TextOCR_0.1_val.json') - convert_annotations(val_infos, osp.join(root_path, 'instances_val.json')) - print('Finish') - - -if __name__ == '__main__': - main() diff --git a/spaces/tomofi/MMOCR/tools/publish_model.py b/spaces/tomofi/MMOCR/tools/publish_model.py deleted file mode 100644 index 73b8a8cb1256bcec269cbd1b88943472f9b0ad54..0000000000000000000000000000000000000000 --- a/spaces/tomofi/MMOCR/tools/publish_model.py +++ /dev/null @@ -1,39 +0,0 @@ -#!/usr/bin/env python -# Copyright (c) OpenMMLab. All rights reserved. -import argparse -import subprocess - -import torch - - -def parse_args(): - parser = argparse.ArgumentParser( - description='Process a checkpoint to be published') - parser.add_argument('in_file', help='input checkpoint filename') - parser.add_argument('out_file', help='output checkpoint filename') - args = parser.parse_args() - return args - - -def process_checkpoint(in_file, out_file): - checkpoint = torch.load(in_file, map_location='cpu') - # remove optimizer for smaller file size - if 'optimizer' in checkpoint: - del checkpoint['optimizer'] - # if it is necessary to remove some sensitive data in checkpoint['meta'], - # add the code here. - if 'meta' in checkpoint: - checkpoint['meta'] = {'CLASSES': 0} - torch.save(checkpoint, out_file, _use_new_zipfile_serialization=False) - sha = subprocess.check_output(['sha256sum', out_file]).decode() - final_file = out_file.rstrip('.pth') + '-{}.pth'.format(sha[:8]) - subprocess.Popen(['mv', out_file, final_file]) - - -def main(): - args = parse_args() - process_checkpoint(args.in_file, args.out_file) - - -if __name__ == '__main__': - main() diff --git a/spaces/tomofi/NDLOCR/src/ndl_layout/mmdetection/mmdet/models/roi_heads/mask_heads/scnet_semantic_head.py b/spaces/tomofi/NDLOCR/src/ndl_layout/mmdetection/mmdet/models/roi_heads/mask_heads/scnet_semantic_head.py deleted file mode 100644 index df85a0112d27d97301fff56189f99bee0bf8efa5..0000000000000000000000000000000000000000 --- a/spaces/tomofi/NDLOCR/src/ndl_layout/mmdetection/mmdet/models/roi_heads/mask_heads/scnet_semantic_head.py +++ /dev/null @@ -1,27 +0,0 @@ -from mmdet.models.builder import HEADS -from mmdet.models.utils import ResLayer, SimplifiedBasicBlock -from .fused_semantic_head import FusedSemanticHead - - -@HEADS.register_module() -class SCNetSemanticHead(FusedSemanticHead): - """Mask head for `SCNet `_. - - Args: - conv_to_res (bool, optional): if True, change the conv layers to - ``SimplifiedBasicBlock``. - """ - - def __init__(self, conv_to_res=True, **kwargs): - super(SCNetSemanticHead, self).__init__(**kwargs) - self.conv_to_res = conv_to_res - if self.conv_to_res: - num_res_blocks = self.num_convs // 2 - self.convs = ResLayer( - SimplifiedBasicBlock, - self.in_channels, - self.conv_out_channels, - num_res_blocks, - conv_cfg=self.conv_cfg, - norm_cfg=self.norm_cfg) - self.num_convs = num_res_blocks diff --git a/spaces/tomofi/NDLOCR/src/text_recognition/deep-text-recognition-benchmark/dataset.py b/spaces/tomofi/NDLOCR/src/text_recognition/deep-text-recognition-benchmark/dataset.py deleted file mode 100644 index 645bbdca237cf313f303bc036d2792339361f768..0000000000000000000000000000000000000000 --- a/spaces/tomofi/NDLOCR/src/text_recognition/deep-text-recognition-benchmark/dataset.py +++ /dev/null @@ -1,627 +0,0 @@ -import os -import sys -import re -import six -import math -import lmdb -import json -import torch - -from natsort import natsorted -from PIL import Image -import numpy as np -from torch.utils.data import Dataset, ConcatDataset, Subset -from torch._utils import _accumulate -import torchvision.transforms as transforms -import torchvision.transforms.functional as F - - -class Batch_Balanced_Dataset(object): - - def __init__(self, opt): - """ - Modulate the data ratio in the batch. - For example, when select_data is "MJ-ST" and batch_ratio is "0.5-0.5", - the 50% of the batch is filled with MJ and the other 50% of the batch is filled with ST. - """ - log = open(f'./saved_models/{opt.exp_name}/log_dataset.txt', 'a') - dashed_line = '-' * 80 - print(dashed_line) - log.write(dashed_line + '\n') - print(f'dataset_root: {opt.train_data}\nopt.select_data: {opt.select_data}\nopt.batch_ratio: {opt.batch_ratio}') - log.write(f'dataset_root: {opt.train_data}\nopt.select_data: {opt.select_data}\nopt.batch_ratio: {opt.batch_ratio}\n') - assert len(opt.select_data) == len(opt.batch_ratio) - - _AlignCollate = AlignCollate(imgH=opt.imgH, imgW=opt.imgW, keep_ratio_with_pad=opt.PAD, augumentation=True) - self.data_loader_list = [] - self.dataloader_iter_list = [] - batch_size_list = [] - Total_batch_size = 0 - for selected_d, batch_ratio_d in zip(opt.select_data, opt.batch_ratio): - _batch_size = max(round(opt.batch_size * float(batch_ratio_d)), 1) - print(dashed_line) - log.write(dashed_line + '\n') - _dataset, _dataset_log = hierarchical_dataset(root=opt.train_data, opt=opt, select_data=[selected_d]) - total_number_dataset = len(_dataset) - log.write(_dataset_log) - - """ - The total number of data can be modified with opt.total_data_usage_ratio. - ex) opt.total_data_usage_ratio = 1 indicates 100% usage, and 0.2 indicates 20% usage. - See 4.2 section in our paper. - """ - number_dataset = int(total_number_dataset * float(opt.total_data_usage_ratio)) - dataset_split = [number_dataset, total_number_dataset - number_dataset] - indices = range(total_number_dataset) - _dataset, _ = [Subset(_dataset, indices[offset - length:offset]) - for offset, length in zip(_accumulate(dataset_split), dataset_split)] - selected_d_log = f'num total samples of {selected_d}: {total_number_dataset} x {opt.total_data_usage_ratio} (total_data_usage_ratio) = {len(_dataset)}\n' - selected_d_log += f'num samples of {selected_d} per batch: {opt.batch_size} x {float(batch_ratio_d)} (batch_ratio) = {_batch_size}' - print(selected_d_log) - log.write(selected_d_log + '\n') - batch_size_list.append(str(_batch_size)) - Total_batch_size += _batch_size - - _data_loader = torch.utils.data.DataLoader( - _dataset, batch_size=_batch_size, - shuffle=True, - num_workers=int(opt.workers), - collate_fn=_AlignCollate, pin_memory=True) - self.data_loader_list.append(_data_loader) - self.dataloader_iter_list.append(iter(_data_loader)) - - Total_batch_size_log = f'{dashed_line}\n' - batch_size_sum = '+'.join(batch_size_list) - Total_batch_size_log += f'Total_batch_size: {batch_size_sum} = {Total_batch_size}\n' - Total_batch_size_log += f'{dashed_line}' - opt.batch_size = Total_batch_size - - print(Total_batch_size_log) - log.write(Total_batch_size_log + '\n') - log.close() - - def get_batch(self): - balanced_batch_images = [] - balanced_batch_texts = [] - - for i, data_loader_iter in enumerate(self.dataloader_iter_list): - try: - datum = data_loader_iter.next() - image, text = datum[0], datum[1] - balanced_batch_images.append(image) - balanced_batch_texts += text - except StopIteration: - self.dataloader_iter_list[i] = iter(self.data_loader_list[i]) - datum = self.dataloader_iter_list[i].next() - image, text = datum[0], datum[1] - balanced_batch_images.append(image) - balanced_batch_texts += text - except ValueError as e: - print(e) - pass - except Exception as e: - print(e) - raise e - - assert len(balanced_batch_images) > 0 - balanced_batch_images = torch.cat(balanced_batch_images, 0) - - return balanced_batch_images, balanced_batch_texts - - -def hierarchical_dataset(root, opt, select_data='/'): - """ select_data='/' contains all sub-directory of root directory """ - dataset_list = [] - dataset_log = f'dataset_root: {root}\t dataset: {select_data[0]}' - print(dataset_log) - dataset_log += '\n' - Dataset = LmdbDataset - if opt.db_type == 'xmlmdb': - Dataset = XMLLmdbDataset - elif opt.db_type == 'raw': - Dataset = RawDataset - for dirpath, dirnames, filenames in os.walk(root+'/'): - if not dirnames: - select_flag = False - for selected_d in select_data: - if selected_d in dirpath: - select_flag = True - break - - if select_flag: - dataset = Dataset(dirpath, opt) - sub_dataset_log = f'sub-directory:\t/{os.path.relpath(dirpath, root)}\t num samples: {len(dataset)}' - print(sub_dataset_log) - dataset_log += f'{sub_dataset_log}\n' - dataset_list.append(dataset) - - concatenated_dataset = ConcatDataset(dataset_list) - - return concatenated_dataset, dataset_log - - -class LmdbDataset(Dataset): - - def __init__(self, root, opt): - - self.root = root - self.opt = opt - self.env = lmdb.open(root, max_readers=32, readonly=True, lock=False, readahead=False, meminit=False) - if not self.env: - print('cannot create lmdb from %s' % (root)) - sys.exit(0) - - with self.env.begin(write=False) as txn: - nSamples = int(txn.get('num-samples'.encode())) - self.nSamples = nSamples - - if not hasattr(self.opt, 'data_filtering_off') or self.opt.data_filtering_off: - # for fast check or benchmark evaluation with no filtering - self.filtered_index_list = [index + 1 for index in range(self.nSamples)] - else: - """ Filtering part - If you want to evaluate IC15-2077 & CUTE datasets which have special character labels, - use --data_filtering_off and only evaluate on alphabets and digits. - see https://github.com/clovaai/deep-text-recognition-benchmark/blob/6593928855fb7abb999a99f428b3e4477d4ae356/dataset.py#L190-L192 - - And if you want to evaluate them with the model trained with --sensitive option, - use --sensitive and --data_filtering_off, - see https://github.com/clovaai/deep-text-recognition-benchmark/blob/dff844874dbe9e0ec8c5a52a7bd08c7f20afe704/test.py#L137-L144 - """ - self.filtered_index_list = [] - for index in range(self.nSamples): - index += 1 # lmdb starts with 1 - label_key = 'label-%09d'.encode() % index - label = txn.get(label_key) - assert label is not None, label_key - label = label.decode('utf-8') - - if len(label) > self.opt.batch_max_length: - # print(f'The length of the label is longer than max_length: length - # {len(label)}, {label} in dataset {self.root}') - continue - - # By default, images containing characters which are not in opt.character are filtered. - # You can add [UNK] token to `opt.character` in utils.py instead of this filtering. - out_of_char = f'[^{self.opt.character}]' - if re.search(out_of_char, label.lower()): - continue - - self.filtered_index_list.append(index) - - self.nSamples = len(self.filtered_index_list) - - def __len__(self): - return self.nSamples - - def __getitem__(self, index): - assert index <= len(self), 'index range error' - index = self.filtered_index_list[index] - - with self.env.begin(write=False) as txn: - label_key = 'label-%09d'.encode() % index - label = txn.get(label_key).decode('utf-8') - img_key = 'image-%09d'.encode() % index - imgbuf = txn.get(img_key) - - buf = six.BytesIO() - buf.write(imgbuf) - buf.seek(0) - try: - if self.opt.rgb: - img = Image.open(buf).convert('RGB') # for color image - else: - img = Image.open(buf).convert('L') - - except IOError: - print(f'Corrupted image for {index}') - # make dummy image and dummy label for corrupted image. - if self.opt.rgb: - img = Image.new('RGB', (self.opt.imgW, self.opt.imgH)) - else: - img = Image.new('L', (self.opt.imgW, self.opt.imgH)) - label = '[dummy_label]' - - if hasattr(self.opt, 'sensitive') and not self.opt.sensitive: - label = label.lower() - - # We only train and evaluate on alphanumerics (or pre-defined character set in train.py) - out_of_char = f'[^{self.opt.character}]' - label = re.sub(out_of_char, '', label) - - return (img, label) - - -class XMLLmdbDataset(Dataset): - - def __init__(self, root, opt, remove_nil_char=True): - - self.root = root - self.opt = opt - self.remove_nil_char = remove_nil_char - self.env = lmdb.open(root, max_readers=32, readonly=True, lock=False, readahead=False, meminit=False) - if not self.env: - print('cannot create lmdb from %s' % (root)) - sys.exit(0) - - with self.env.begin(write=False) as txn: - nSamples = int(txn.get('n_line'.encode())) - self.nSamples = nSamples - - if not hasattr(self.opt, 'data_filtering_off') or self.opt.data_filtering_off: - # for fast check or benchmark evaluation with no filtering - self.filtered_index_list = range(self.nSamples) - else: - """ Filtering part - If you want to evaluate IC15-2077 & CUTE datasets which have special character labels, - use --data_filtering_off and only evaluate on alphabets and digits. - see https://github.com/clovaai/deep-text-recognition-benchmark/blob/6593928855fb7abb999a99f428b3e4477d4ae356/dataset.py#L190-L192 - - And if you want to evaluate them with the model trained with --sensitive option, - use --sensitive and --data_filtering_off, - see https://github.com/clovaai/deep-text-recognition-benchmark/blob/dff844874dbe9e0ec8c5a52a7bd08c7f20afe704/test.py#L137-L144 - """ - self.filtered_index_list = [] - for index in range(self.nSamples): - label_key = f'{index:09d}-label'.encode() - label = txn.get(label_key) - assert label is not None, label_key - label = label.decode('utf-8') - - if len(label) > self.opt.batch_max_length: - # print(f'The length of the label is longer than max_length: length - # {len(label)}, {label} in dataset {self.root}') - continue - - # By default, images containing characters which are not in opt.character are filtered. - # You can add [UNK] token to `opt.character` in utils.py instead of this filtering. - out_of_char = f'[^{self.opt.character}]' - if re.search(out_of_char, label.lower()): - continue - - self.filtered_index_list.append(index) - - self.nSamples = len(self.filtered_index_list) - - def __len__(self): - return self.nSamples - - def __getitem__(self, index): - assert index <= len(self), 'index range error' - index = self.filtered_index_list[index] - - with self.env.begin(write=False) as txn: - label = txn.get(f'{index:09d}-label'.encode()).decode('utf-8') - imgbuf = txn.get(f'{index:09d}-image'.encode()) - direction = txn.get(f'{index:09d}-direction'.encode()).decode('utf-8') - cattr = txn.get(f'{index:09d}-cattrs'.encode()) - if cattr is not None: - cattr = json.loads(cattr) - - buf = six.BytesIO() - buf.write(imgbuf) - buf.seek(0) - try: - if self.opt.rgb: - img = Image.open(buf).convert('RGB') # for color image - else: - img = Image.open(buf).convert('L') - - except IOError: - print(f'Corrupted image for {index}') - # make dummy image and dummy label for corrupted image. - if self.opt.rgb: - img = Image.new('RGB', (self.opt.imgW, self.opt.imgH)) - else: - img = Image.new('L', (self.opt.imgW, self.opt.imgH)) - label = '[dummy_label]' - - if hasattr(self.opt, 'sensitive') and not self.opt.sensitive: - label = label.lower() - - # We only train and evaluate on alphanumerics (or pre-defined character set in train.py) - if self.remove_nil_char: - out_of_char = f'[^{self.opt.character}]' - label = re.sub(out_of_char, '〓', label) - - data = { - 'label': label, - 'direction': direction, - 'cattrs': cattr - } - return (img, data) - - -class RawDataset(Dataset): - - def __init__(self, root, opt): - self.opt = opt - self.image_path_list = [] - for dirpath, dirnames, filenames in os.walk(root): - for name in filenames: - _, ext = os.path.splitext(name) - ext = ext.lower() - if ext == '.jpg' or ext == '.jpeg' or ext == '.png': - self.image_path_list.append(os.path.join(dirpath, name)) - - self.image_path_list = natsorted(self.image_path_list) - self.nSamples = len(self.image_path_list) - - def __len__(self): - return self.nSamples - - def __getitem__(self, index): - - try: - if self.opt.rgb: - img = Image.open(self.image_path_list[index]).convert('RGB') # for color image - else: - img = Image.open(self.image_path_list[index]).convert('L') - - except IOError: - print(f'Corrupted image for {index}') - # make dummy image and dummy label for corrupted image. - if self.opt.rgb: - img = Image.new('RGB', (self.opt.imgW, self.opt.imgH)) - else: - img = Image.new('L', (self.opt.imgW, self.opt.imgH)) - - return (img, self.image_path_list[index]) - - -class ResizeNormalize(object): - - def __init__(self, size, interpolation=Image.BICUBIC): - self.size = size - self.interpolation = interpolation - self.toTensor = transforms.ToTensor() - - def __call__(self, img): - img = img.resize(self.size, self.interpolation) - img = self.toTensor(img) - img.sub_(0.5).div_(0.5) - return img - - -class NormalizePAD(object): - - def __init__(self, max_size, PAD_type='right'): - self.toTensor = transforms.ToTensor() - self.max_size = max_size - self.max_width_half = math.floor(max_size[2] / 2) - self.PAD_type = PAD_type - - def __call__(self, img): - img = self.toTensor(img) - img.sub_(0.5).div_(0.5) - c, h, w = img.size() - Pad_img = torch.FloatTensor(*self.max_size).fill_(0) - Pad_img[:, :, :w] = img # right pad - # if self.max_size[2] != w: # add border Pad - # Pad_img[:, :, w:] = img[:, :, w - 1].unsqueeze(2).expand(c, h, self.max_size[2] - w) - - return Pad_img - - -class RandomAspect(torch.nn.Module): - def __init__(self, max_variation: int): - super().__init__() - self.max_variation = max_variation - - @staticmethod - def get_params(img: torch.Tensor, max_variation: int): - w, h = F._get_image_size(img) - w = torch.randint(max(w - max_variation, w // 2), w + max_variation, size=(1,)).item() - h = torch.randint(max(h - max_variation, h // 2), h + max_variation, size=(1,)).item() - return w, h - - def forward(self, img): - w, h = self.get_params(img, self.max_variation) - return F.resize(img, (h, w)) - - -class RandomPad(torch.nn.Module): - def __init__(self, max_padding: int, fill=0, padding_mode="constant"): - super().__init__() - self.max_padding = max_padding - self.fill = fill - self.padding_mode = padding_mode - - @staticmethod - def get_params(img: torch.Tensor, max_padding: int): - return torch.randint(0, max_padding, size=(4,)).tolist() - - def forward(self, img): - pad = self.get_params(img, self.max_padding) - return F.pad(img, pad, fill=self.fill, padding_mode=self.padding_mode) - - -class ConstantPad(torch.nn.Module): - def __init__(self, padding: list, fill=0, padding_mode="constant"): - super().__init__() - self.padding = padding - self.fill = fill - self.padding_mode = padding_mode - - def forward(self, img): - return F.pad(img, self.padding, fill=self.fill, padding_mode=self.padding_mode) - - -class Partially(torch.nn.Module): - def __init__(self, target_aspect): - super().__init__() - self.target_aspect = target_aspect - - @staticmethod - def get_params(length: int): - return torch.randint(0, length, (1,)).item(), torch.randint(0, 2, (1,)).item() - - def forward(self, img, label, cattrs): - w, h = img.size - ll = len(cattrs) - if ll == 0 or ll != len(label): - pass - # img.save(f"image_test/no_length:{label}.png") - # print('label::::::::', label, cattrs, label) - return img, label - idx, way = self.get_params(ll) - if way and 0: - i = idx = min(idx, max(ll - 3, 0)) - _x1 = cattrs[idx]['X'] - _x2 = cattrs[idx]['X'] + cattrs[idx]['WIDTH'] - for i in reversed(range(idx, ll)): - attr = cattrs[i] - print(i) - _x2 = attr['X'] + attr['WIDTH'] - asp = (_x2 - _x1) / h - if asp <= self.target_aspect: - break - print(label, label[idx:i+1], idx, i+1) - label = label[idx:i+1] - else: - i = idx = max(idx, min(3, ll - 1)) - _x1 = cattrs[idx]['X'] - _x2 = cattrs[idx]['X'] + cattrs[idx]['WIDTH'] - for i, attr in enumerate(cattrs[:idx+1]): - _x1 = attr['X'] - asp = (_x2 - _x1) / h - if asp <= self.target_aspect: - break - label = label[i:idx+1] - - # return img - return F.crop(img, 0, _x1, h, _x2 - _x1), label - - -class Sideways(torch.nn.Module): - def __init__(self): - super().__init__() - - def forward(self, img, label, vert=None, cattrs=None): - if img.width > img.height * 5 and vert == '縦': - vert = '横' - elif img.height > img.width * 5 and vert == '横': - vert = '縦' - if vert == '縦' or (label is not None and vert == '横' and len(label) == 1): - if cattrs is not None: - for attr in cattrs: - attr['X'], attr['Y'] = attr['Y'], attr['X'] - attr['WIDTH'], attr['HEIGHT'] = attr['HEIGHT'], attr['WIDTH'] - return img.transpose(Image.ROTATE_90), label, cattrs - elif vert == '横' or (vert == '' and len(label) == 1): - return img, label, cattrs - elif vert == '右から左': - return img, label[::-1], cattrs[::-1] - else: - # img.save(f'image_test/{vert}-{label}.png') - print() - raise ValueError(f'{vert} is unknwon, {label}({len(label)})') - - -class AlignCollate(object): - - def __init__(self, imgH=32, imgW=100, keep_ratio_with_pad=False, augumentation=False): - self.imgH = imgH - self.imgW = imgW - self.keep_ratio_with_pad = keep_ratio_with_pad - self.aug = augumentation - - def __call__(self, batch): - preprocess = Sideways() - batch = [x for x in batch if x is not None] - data = [data for _, data in batch] - batch = [preprocess(g, data['label'], data['direction'], data['cattrs']) for g, data in batch] - batch = list(zip(*batch)) - images, labels, cattrs = batch - labels = list(labels) - - if self.keep_ratio_with_pad: # same concept with 'Rosetta' paper - resized_max_w = self.imgW - input_channel = 3 if images[0].mode == 'RGB' else 1 - transform0 = Partially(self.imgW / self.imgH) - transform1 = transforms.Compose([ - RandomAspect(10), - RandomPad(10, fill=255), - transforms.RandomAffine(degrees=2, fill=255), - ]) - transform2 = transforms.Compose([ - NormalizePAD((input_channel, self.imgH, resized_max_w)) - ]) - transform3 = transforms.Compose([ - transforms.GaussianBlur(3, sigma=(1e-5, 0.3)), - # transforms.Lambda(lambda g: transforms.functional.adjust_gamma(g, 0.4 + torch.rand(1) * 0.6)), - ]) - - resized_images = [] - result_labels = [] - for i, (image, cattr) in enumerate(zip(images, cattrs)): - label = labels[i] - plabel = label - pimage = image - - if self.aug and cattr is not None: - image, label = transform0(image, label, cattr) - # image.save(f'./image_test/{part_label}.jpg') - labels[i] = label - - w, h = image.size - ratio = w / float(h) - resized_w0 = math.ceil(self.imgH * ratio) - if math.ceil(self.imgH * ratio) > self.imgW: - resized_w = self.imgW - else: - resized_w = math.ceil(self.imgH * ratio) - - if self.aug: - try: - resized_image = image.resize((resized_w0, self.imgH), Image.BICUBIC) - resized_image = transform1(resized_image) - except ValueError as e: - label = plabel - image = pimage - # image.save(f"./image_test/({w},{h})({resized_w0, self.imgH}){label}.png") - # image.save(f"./image_test/{label}.png") - continue - raise e - else: - resized_image = image - - resized_image = ConstantPad((10, 0), 255)(resized_image) - try: - resized_image = resized_image.resize((resized_w, self.imgH), Image.BICUBIC) - except ValueError as e: - with open('image_test/failed.txt', 'a') as f: - f.write(f"{label}\n") - # image.save(f"./image_test/{label}.png") - continue - raise e - normalized_tensor = transform2(resized_image) - if self.aug: - normalized_tensor = transform3(normalized_tensor) - resized_images.append(normalized_tensor) - # resized_image.save(f'./image_test/{self.aug}-{w:05d}-{label}.jpg') - # save_image(tensor2im(normalized_tensor), f'./image_test/{self.aug}-{w:05d}-{label}.jpg') - result_labels.append(label) - - image_tensors = torch.cat([t.unsqueeze(0) for t in resized_images], 0) - labels = result_labels - - else: - transform = ResizeNormalize((self.imgW, self.imgH)) - image_tensors = [transform(image) for image in images] - image_tensors = torch.cat([t.unsqueeze(0) for t in image_tensors], 0) - - return image_tensors, labels, data - - -def tensor2im(image_tensor, imtype=np.uint8): - image_numpy = image_tensor.cpu().float().numpy() - if image_numpy.shape[0] == 1: - image_numpy = np.tile(image_numpy, (3, 1, 1)) - image_numpy = (np.transpose(image_numpy, (1, 2, 0)) + 1) / 2.0 * 255.0 - return image_numpy.astype(imtype) - - -def save_image(image_numpy, image_path): - image_pil = Image.fromarray(image_numpy) - image_pil.save(image_path) diff --git a/spaces/trttung1610/musicgen/audiocraft/adversarial/discriminators/__init__.py b/spaces/trttung1610/musicgen/audiocraft/adversarial/discriminators/__init__.py deleted file mode 100644 index f9e5ff59950ee0b1d1a67c9b3831d67d08048148..0000000000000000000000000000000000000000 --- a/spaces/trttung1610/musicgen/audiocraft/adversarial/discriminators/__init__.py +++ /dev/null @@ -1,10 +0,0 @@ -# Copyright (c) Meta Platforms, Inc. and affiliates. -# All rights reserved. -# -# This source code is licensed under the license found in the -# LICENSE file in the root directory of this source tree. - -# flake8: noqa -from .mpd import MultiPeriodDiscriminator -from .msd import MultiScaleDiscriminator -from .msstftd import MultiScaleSTFTDiscriminator diff --git a/spaces/trttung1610/musicgen/audiocraft/models/builders.py b/spaces/trttung1610/musicgen/audiocraft/models/builders.py deleted file mode 100644 index 038bf99c3d0fbbb86005683d5a2a1b4edcac4298..0000000000000000000000000000000000000000 --- a/spaces/trttung1610/musicgen/audiocraft/models/builders.py +++ /dev/null @@ -1,252 +0,0 @@ -# Copyright (c) Meta Platforms, Inc. and affiliates. -# All rights reserved. -# -# This source code is licensed under the license found in the -# LICENSE file in the root directory of this source tree. - -""" -All the functions to build the relevant models and modules -from the Hydra config. -""" - -import typing as tp - -import audiocraft -import omegaconf -import torch - -from .encodec import CompressionModel, EncodecModel -from .lm import LMModel -from ..modules.codebooks_patterns import ( - CodebooksPatternProvider, - DelayedPatternProvider, - MusicLMPattern, - ParallelPatternProvider, - UnrolledPatternProvider, - VALLEPattern, -) -from ..modules.conditioners import ( - BaseConditioner, - ChromaStemConditioner, - CLAPEmbeddingConditioner, - ConditionFuser, - ConditioningProvider, - LUTConditioner, - T5Conditioner, -) -from .unet import DiffusionUnet -from .. import quantization as qt -from ..utils.utils import dict_from_config -from ..modules.diffusion_schedule import MultiBandProcessor, SampleProcessor - - -def get_quantizer(quantizer: str, cfg: omegaconf.DictConfig, dimension: int) -> qt.BaseQuantizer: - klass = { - 'no_quant': qt.DummyQuantizer, - 'rvq': qt.ResidualVectorQuantizer - }[quantizer] - kwargs = dict_from_config(getattr(cfg, quantizer)) - if quantizer != 'no_quant': - kwargs['dimension'] = dimension - return klass(**kwargs) - - -def get_encodec_autoencoder(encoder_name: str, cfg: omegaconf.DictConfig): - if encoder_name == 'seanet': - kwargs = dict_from_config(getattr(cfg, 'seanet')) - encoder_override_kwargs = kwargs.pop('encoder') - decoder_override_kwargs = kwargs.pop('decoder') - encoder_kwargs = {**kwargs, **encoder_override_kwargs} - decoder_kwargs = {**kwargs, **decoder_override_kwargs} - encoder = audiocraft.modules.SEANetEncoder(**encoder_kwargs) - decoder = audiocraft.modules.SEANetDecoder(**decoder_kwargs) - return encoder, decoder - else: - raise KeyError(f"Unexpected compression model {cfg.compression_model}") - - -def get_compression_model(cfg: omegaconf.DictConfig) -> CompressionModel: - """Instantiate a compression model.""" - if cfg.compression_model == 'encodec': - kwargs = dict_from_config(getattr(cfg, 'encodec')) - encoder_name = kwargs.pop('autoencoder') - quantizer_name = kwargs.pop('quantizer') - encoder, decoder = get_encodec_autoencoder(encoder_name, cfg) - quantizer = get_quantizer(quantizer_name, cfg, encoder.dimension) - frame_rate = kwargs['sample_rate'] // encoder.hop_length - renormalize = kwargs.pop('renormalize', False) - # deprecated params - kwargs.pop('renorm', None) - return EncodecModel(encoder, decoder, quantizer, - frame_rate=frame_rate, renormalize=renormalize, **kwargs).to(cfg.device) - else: - raise KeyError(f"Unexpected compression model {cfg.compression_model}") - - -def get_lm_model(cfg: omegaconf.DictConfig) -> LMModel: - """Instantiate a transformer LM.""" - if cfg.lm_model == 'transformer_lm': - kwargs = dict_from_config(getattr(cfg, 'transformer_lm')) - n_q = kwargs['n_q'] - q_modeling = kwargs.pop('q_modeling', None) - codebooks_pattern_cfg = getattr(cfg, 'codebooks_pattern') - attribute_dropout = dict_from_config(getattr(cfg, 'attribute_dropout')) - cls_free_guidance = dict_from_config(getattr(cfg, 'classifier_free_guidance')) - cfg_prob, cfg_coef = cls_free_guidance['training_dropout'], cls_free_guidance['inference_coef'] - fuser = get_condition_fuser(cfg) - condition_provider = get_conditioner_provider(kwargs["dim"], cfg).to(cfg.device) - if len(fuser.fuse2cond['cross']) > 0: # enforce cross-att programmatically - kwargs['cross_attention'] = True - if codebooks_pattern_cfg.modeling is None: - assert q_modeling is not None, \ - "LM model should either have a codebook pattern defined or transformer_lm.q_modeling" - codebooks_pattern_cfg = omegaconf.OmegaConf.create( - {'modeling': q_modeling, 'delay': {'delays': list(range(n_q))}} - ) - pattern_provider = get_codebooks_pattern_provider(n_q, codebooks_pattern_cfg) - return LMModel( - pattern_provider=pattern_provider, - condition_provider=condition_provider, - fuser=fuser, - cfg_dropout=cfg_prob, - cfg_coef=cfg_coef, - attribute_dropout=attribute_dropout, - dtype=getattr(torch, cfg.dtype), - device=cfg.device, - **kwargs - ).to(cfg.device) - else: - raise KeyError(f"Unexpected LM model {cfg.lm_model}") - - -def get_conditioner_provider(output_dim: int, cfg: omegaconf.DictConfig) -> ConditioningProvider: - """Instantiate a conditioning model.""" - device = cfg.device - duration = cfg.dataset.segment_duration - cfg = getattr(cfg, 'conditioners') - dict_cfg = {} if cfg is None else dict_from_config(cfg) - conditioners: tp.Dict[str, BaseConditioner] = {} - condition_provider_args = dict_cfg.pop('args', {}) - condition_provider_args.pop('merge_text_conditions_p', None) - condition_provider_args.pop('drop_desc_p', None) - - for cond, cond_cfg in dict_cfg.items(): - model_type = cond_cfg['model'] - model_args = cond_cfg[model_type] - if model_type == 't5': - conditioners[str(cond)] = T5Conditioner(output_dim=output_dim, device=device, **model_args) - elif model_type == 'lut': - conditioners[str(cond)] = LUTConditioner(output_dim=output_dim, **model_args) - elif model_type == 'chroma_stem': - conditioners[str(cond)] = ChromaStemConditioner( - output_dim=output_dim, - duration=duration, - device=device, - **model_args - ) - elif model_type == 'clap': - conditioners[str(cond)] = CLAPEmbeddingConditioner( - output_dim=output_dim, - device=device, - **model_args - ) - else: - raise ValueError(f"Unrecognized conditioning model: {model_type}") - conditioner = ConditioningProvider(conditioners, device=device, **condition_provider_args) - return conditioner - - -def get_condition_fuser(cfg: omegaconf.DictConfig) -> ConditionFuser: - """Instantiate a condition fuser object.""" - fuser_cfg = getattr(cfg, 'fuser') - fuser_methods = ['sum', 'cross', 'prepend', 'input_interpolate'] - fuse2cond = {k: fuser_cfg[k] for k in fuser_methods} - kwargs = {k: v for k, v in fuser_cfg.items() if k not in fuser_methods} - fuser = ConditionFuser(fuse2cond=fuse2cond, **kwargs) - return fuser - - -def get_codebooks_pattern_provider(n_q: int, cfg: omegaconf.DictConfig) -> CodebooksPatternProvider: - """Instantiate a codebooks pattern provider object.""" - pattern_providers = { - 'parallel': ParallelPatternProvider, - 'delay': DelayedPatternProvider, - 'unroll': UnrolledPatternProvider, - 'valle': VALLEPattern, - 'musiclm': MusicLMPattern, - } - name = cfg.modeling - kwargs = dict_from_config(cfg.get(name)) if hasattr(cfg, name) else {} - klass = pattern_providers[name] - return klass(n_q, **kwargs) - - -def get_debug_compression_model(device='cpu', sample_rate: int = 32000): - """Instantiate a debug compression model to be used for unit tests.""" - assert sample_rate in [16000, 32000], "unsupported sample rate for debug compression model" - model_ratios = { - 16000: [10, 8, 8], # 25 Hz at 16kHz - 32000: [10, 8, 16] # 25 Hz at 32kHz - } - ratios: tp.List[int] = model_ratios[sample_rate] - frame_rate = 25 - seanet_kwargs: dict = { - 'n_filters': 4, - 'n_residual_layers': 1, - 'dimension': 32, - 'ratios': ratios, - } - print(seanet_kwargs) - encoder = audiocraft.modules.SEANetEncoder(**seanet_kwargs) - decoder = audiocraft.modules.SEANetDecoder(**seanet_kwargs) - quantizer = qt.ResidualVectorQuantizer(dimension=32, bins=400, n_q=4) - init_x = torch.randn(8, 32, 128) - quantizer(init_x, 1) # initialize kmeans etc. - compression_model = EncodecModel( - encoder, decoder, quantizer, - frame_rate=frame_rate, sample_rate=sample_rate, channels=1).to(device) - return compression_model.eval() - - -def get_diffusion_model(cfg: omegaconf.DictConfig): - # TODO Find a way to infer the channels from dset - channels = cfg.channels - num_steps = cfg.schedule.num_steps - return DiffusionUnet( - chin=channels, num_steps=num_steps, **cfg.diffusion_unet) - - -def get_processor(cfg, sample_rate: int = 24000): - sample_processor = SampleProcessor() - if cfg.use: - kw = dict(cfg) - kw.pop('use') - kw.pop('name') - if cfg.name == "multi_band_processor": - sample_processor = MultiBandProcessor(sample_rate=sample_rate, **kw) - return sample_processor - - -def get_debug_lm_model(device='cpu'): - """Instantiate a debug LM to be used for unit tests.""" - pattern = DelayedPatternProvider(n_q=4) - dim = 16 - providers = { - 'description': LUTConditioner(n_bins=128, dim=dim, output_dim=dim, tokenizer="whitespace"), - } - condition_provider = ConditioningProvider(providers) - fuser = ConditionFuser( - {'cross': ['description'], 'prepend': [], - 'sum': [], 'input_interpolate': []}) - lm = LMModel( - pattern, condition_provider, fuser, - n_q=4, card=400, dim=dim, num_heads=4, custom=True, num_layers=2, - cross_attention=True, causal=True) - return lm.to(device).eval() - - -def get_wrapped_compression_model( - compression_model: CompressionModel, - cfg: omegaconf.DictConfig) -> CompressionModel: - # more to come. - return compression_model diff --git a/spaces/trysem/image-matting-app/ppmatting/__init__.py b/spaces/trysem/image-matting-app/ppmatting/__init__.py deleted file mode 100644 index c1094808e27aa683fc3b5766e9968712b3021532..0000000000000000000000000000000000000000 --- a/spaces/trysem/image-matting-app/ppmatting/__init__.py +++ /dev/null @@ -1 +0,0 @@ -from . import ml, metrics, transforms, datasets, models diff --git a/spaces/tsi-org/Faceswapper/roop/metadata.py b/spaces/tsi-org/Faceswapper/roop/metadata.py deleted file mode 100644 index 35b0f0245a38eb9ec024f2ed2c829044f6051c29..0000000000000000000000000000000000000000 --- a/spaces/tsi-org/Faceswapper/roop/metadata.py +++ /dev/null @@ -1,2 +0,0 @@ -name = 'roop' -version = '1.1.0' diff --git a/spaces/uSerNameDDHL/bingo/src/lib/bots/bing/index.ts b/spaces/uSerNameDDHL/bingo/src/lib/bots/bing/index.ts deleted file mode 100644 index 2c4afae01a345b8415935228566cb30d695e768d..0000000000000000000000000000000000000000 --- a/spaces/uSerNameDDHL/bingo/src/lib/bots/bing/index.ts +++ /dev/null @@ -1,421 +0,0 @@ -import { fetch, WebSocket, debug } from '@/lib/isomorphic' -import WebSocketAsPromised from 'websocket-as-promised' -import { - SendMessageParams, - BingConversationStyle, - ConversationResponse, - ChatResponseMessage, - ConversationInfo, - InvocationEventType, - ChatError, - ErrorCode, - ChatUpdateCompleteResponse, - ImageInfo, - KBlobResponse -} from './types' - -import { convertMessageToMarkdown, websocketUtils, streamAsyncIterable } from './utils' -import { WatchDog, createChunkDecoder } from '@/lib/utils' - -type Params = SendMessageParams<{ bingConversationStyle: BingConversationStyle }> - -const OPTIONS_SETS = [ - 'nlu_direct_response_filter', - 'deepleo', - 'disable_emoji_spoken_text', - 'responsible_ai_policy_235', - 'enablemm', - 'iycapbing', - 'iyxapbing', - 'objopinion', - 'rweasgv2', - 'dagslnv1', - 'dv3sugg', - 'autosave', - 'iyoloxap', - 'iyoloneutral', - 'clgalileo', - 'gencontentv3', -] - -export class BingWebBot { - protected conversationContext?: ConversationInfo - protected cookie: string - protected ua: string - protected endpoint = '' - private lastText = '' - private asyncTasks: Array> = [] - - constructor(opts: { - cookie: string - ua: string - bingConversationStyle?: BingConversationStyle - conversationContext?: ConversationInfo - }) { - const { cookie, ua, conversationContext } = opts - this.cookie = cookie?.includes(';') ? cookie : `_EDGE_V=1; _U=${cookie}` - this.ua = ua - this.conversationContext = conversationContext - } - - static buildChatRequest(conversation: ConversationInfo) { - const optionsSets = OPTIONS_SETS - if (conversation.conversationStyle === BingConversationStyle.Precise) { - optionsSets.push('h3precise') - } else if (conversation.conversationStyle === BingConversationStyle.Creative) { - optionsSets.push('h3imaginative') - } - return { - arguments: [ - { - source: 'cib', - optionsSets, - allowedMessageTypes: [ - 'Chat', - 'InternalSearchQuery', - 'Disengaged', - 'InternalLoaderMessage', - 'SemanticSerp', - 'GenerateContentQuery', - 'SearchQuery', - ], - sliceIds: [ - 'winmuid1tf', - 'anssupfor_c', - 'imgchatgptv2', - 'tts2cf', - 'contansperf', - 'mlchatpc8500w', - 'mlchatpc2', - 'ctrlworkpay', - 'winshortmsgtf', - 'cibctrl', - 'sydtransctrl', - 'sydconfigoptc', - '0705trt4', - '517opinion', - '628ajcopus0', - '330uaugs0', - '529rwea', - '0626snptrcs0', - '424dagslnv1', - ], - isStartOfSession: conversation.invocationId === 0, - message: { - author: 'user', - inputMethod: 'Keyboard', - text: conversation.prompt, - imageUrl: conversation.imageUrl, - messageType: 'Chat', - }, - conversationId: conversation.conversationId, - conversationSignature: conversation.conversationSignature, - participant: { id: conversation.clientId }, - }, - ], - invocationId: conversation.invocationId.toString(), - target: 'chat', - type: InvocationEventType.StreamInvocation, - } - } - - async createConversation(): Promise { - const headers = { - 'Accept-Encoding': 'gzip, deflate, br, zsdch', - 'User-Agent': this.ua, - 'x-ms-useragent': 'azsdk-js-api-client-factory/1.0.0-beta.1 core-rest-pipeline/1.10.0 OS/Win32', - cookie: this.cookie, - } - - let resp: ConversationResponse | undefined - try { - const response = await fetch(this.endpoint + '/api/create', { method: 'POST', headers, redirect: 'error', mode: 'cors', credentials: 'include' }) - if (response.status === 404) { - throw new ChatError('Not Found', ErrorCode.NOTFOUND_ERROR) - } - resp = await response.json() as ConversationResponse - } catch (err) { - console.error('create conversation error', err) - } - - if (!resp?.result) { - throw new ChatError('Invalid response', ErrorCode.UNKOWN_ERROR) - } - - const { value, message } = resp.result || {} - if (value !== 'Success') { - const errorMsg = `${value}: ${message}` - if (value === 'UnauthorizedRequest') { - throw new ChatError(errorMsg, ErrorCode.BING_UNAUTHORIZED) - } - if (value === 'Forbidden') { - throw new ChatError(errorMsg, ErrorCode.BING_FORBIDDEN) - } - throw new ChatError(errorMsg, ErrorCode.UNKOWN_ERROR) - } - return resp - } - - private async createContext(conversationStyle: BingConversationStyle) { - if (!this.conversationContext) { - const conversation = await this.createConversation() - this.conversationContext = { - conversationId: conversation.conversationId, - conversationSignature: conversation.conversationSignature, - clientId: conversation.clientId, - invocationId: 0, - conversationStyle, - prompt: '', - } - } - return this.conversationContext - } - - async sendMessage(params: Params) { - try { - await this.createContext(params.options.bingConversationStyle) - Object.assign(this.conversationContext!, { prompt: params.prompt, imageUrl: params.imageUrl }) - return this.sydneyProxy(params) - } catch (error) { - params.onEvent({ - type: 'ERROR', - error: error instanceof ChatError ? error : new ChatError('Catch Error', ErrorCode.UNKOWN_ERROR), - }) - } - } - - private async sydneyProxy(params: Params) { - const abortController = new AbortController() - const response = await fetch(this.endpoint + '/api/sydney', { - method: 'POST', - headers: { - 'Content-Type': 'application/json', - }, - signal: abortController.signal, - body: JSON.stringify(this.conversationContext!) - }) - if (response.status !== 200) { - params.onEvent({ - type: 'ERROR', - error: new ChatError( - 'Unknown error', - ErrorCode.UNKOWN_ERROR, - ), - }) - } - params.signal?.addEventListener('abort', () => { - abortController.abort() - }) - - const textDecoder = createChunkDecoder() - for await (const chunk of streamAsyncIterable(response.body!)) { - this.parseEvents(params, websocketUtils.unpackMessage(textDecoder(chunk))) - } - } - - async sendWs() { - const wsConfig: ConstructorParameters[1] = { - packMessage: websocketUtils.packMessage, - unpackMessage: websocketUtils.unpackMessage, - createWebSocket: (url) => new WebSocket(url, { - headers: { - 'accept-language': 'zh-CN,zh;q=0.9', - 'cache-control': 'no-cache', - 'User-Agent': this.ua, - pragma: 'no-cache', - cookie: this.cookie, - } - }) - } - const wsp = new WebSocketAsPromised('wss://sydney.bing.com/sydney/ChatHub', wsConfig) - - wsp.open().then(() => { - wsp.sendPacked({ protocol: 'json', version: 1 }) - wsp.sendPacked({ type: 6 }) - wsp.sendPacked(BingWebBot.buildChatRequest(this.conversationContext!)) - }) - - return wsp - } - - private async useWs(params: Params) { - const wsp = await this.sendWs() - const watchDog = new WatchDog() - wsp.onUnpackedMessage.addListener((events) => { - watchDog.watch(() => { - wsp.sendPacked({ type: 6 }) - }) - this.parseEvents(params, events) - }) - - wsp.onClose.addListener(() => { - watchDog.reset() - params.onEvent({ type: 'DONE' }) - wsp.removeAllListeners() - }) - - params.signal?.addEventListener('abort', () => { - wsp.removeAllListeners() - wsp.close() - }) - } - - private async createImage(prompt: string, id: string) { - try { - const headers = { - 'Accept-Encoding': 'gzip, deflate, br, zsdch', - 'User-Agent': this.ua, - 'x-ms-useragent': 'azsdk-js-api-client-factory/1.0.0-beta.1 core-rest-pipeline/1.10.0 OS/Win32', - cookie: this.cookie, - } - const query = new URLSearchParams({ - prompt, - id - }) - const response = await fetch(this.endpoint + '/api/image?' + query.toString(), - { - method: 'POST', - headers, - mode: 'cors', - credentials: 'include' - }) - .then(res => res.text()) - if (response) { - this.lastText += '\n' + response - } - } catch (err) { - console.error('Create Image Error', err) - } - } - - private buildKnowledgeApiPayload(imageUrl: string, conversationStyle: BingConversationStyle) { - const imageInfo: ImageInfo = {} - let imageBase64: string | undefined = undefined - const knowledgeRequest = { - imageInfo, - knowledgeRequest: { - invokedSkills: [ - 'ImageById' - ], - subscriptionId: 'Bing.Chat.Multimodal', - invokedSkillsRequestData: { - enableFaceBlur: true - }, - convoData: { - convoid: this.conversationContext?.conversationId, - convotone: conversationStyle, - } - }, - } - - if (imageUrl.startsWith('data:image/')) { - imageBase64 = imageUrl.replace('data:image/', ''); - const partIndex = imageBase64.indexOf(',') - if (partIndex) { - imageBase64 = imageBase64.substring(partIndex + 1) - } - } else { - imageInfo.url = imageUrl - } - return { knowledgeRequest, imageBase64 } - } - - async uploadImage(imageUrl: string, conversationStyle: BingConversationStyle = BingConversationStyle.Creative): Promise { - if (!imageUrl) { - return - } - await this.createContext(conversationStyle) - const payload = this.buildKnowledgeApiPayload(imageUrl, conversationStyle) - - const response = await fetch(this.endpoint + '/api/kblob', - { - headers: { - 'Content-Type': 'application/json', - }, - method: 'POST', - mode: 'cors', - credentials: 'include', - body: JSON.stringify(payload), - }) - .then(res => res.json()) - .catch(e => { - console.log('Error', e) - }) - return response - } - - private async generateContent(message: ChatResponseMessage) { - if (message.contentType === 'IMAGE') { - this.asyncTasks.push(this.createImage(message.text, message.messageId)) - } - } - - private async parseEvents(params: Params, events: any) { - const conversation = this.conversationContext! - - events?.forEach(async (event: ChatUpdateCompleteResponse) => { - debug('bing event', event) - if (event.type === 3) { - await Promise.all(this.asyncTasks) - this.asyncTasks = [] - params.onEvent({ type: 'UPDATE_ANSWER', data: { text: this.lastText } }) - params.onEvent({ type: 'DONE' }) - conversation.invocationId = parseInt(event.invocationId, 10) + 1 - } else if (event.type === 1) { - const messages = event.arguments[0].messages - if (messages) { - const text = convertMessageToMarkdown(messages[0]) - this.lastText = text - params.onEvent({ type: 'UPDATE_ANSWER', data: { text, spokenText: messages[0].text, throttling: event.arguments[0].throttling } }) - } - } else if (event.type === 2) { - const messages = event.item.messages as ChatResponseMessage[] | undefined - if (!messages) { - params.onEvent({ - type: 'ERROR', - error: new ChatError( - event.item.result.error || 'Unknown error', - event.item.result.value === 'Throttled' ? ErrorCode.THROTTLE_LIMIT - : event.item.result.value === 'CaptchaChallenge' ? (this.conversationContext?.conversationId?.includes('BingProdUnAuthenticatedUsers') ? ErrorCode.BING_UNAUTHORIZED : ErrorCode.BING_CAPTCHA) - : ErrorCode.UNKOWN_ERROR - ), - }) - return - } - const limited = messages.some((message) => - message.contentOrigin === 'TurnLimiter' - || message.messageType === 'Disengaged' - ) - if (limited) { - params.onEvent({ - type: 'ERROR', - error: new ChatError( - 'Sorry, you have reached chat limit in this conversation.', - ErrorCode.CONVERSATION_LIMIT, - ), - }) - return - } - - const lastMessage = event.item.messages.at(-1) as ChatResponseMessage - const specialMessage = event.item.messages.find(message => message.author === 'bot' && message.contentType === 'IMAGE') - if (specialMessage) { - this.generateContent(specialMessage) - } - - if (lastMessage) { - const text = convertMessageToMarkdown(lastMessage) - this.lastText = text - params.onEvent({ - type: 'UPDATE_ANSWER', - data: { text, throttling: event.item.throttling, suggestedResponses: lastMessage.suggestedResponses, sourceAttributions: lastMessage.sourceAttributions }, - }) - } - } - }) - } - - resetConversation() { - this.conversationContext = undefined - } -} diff --git a/spaces/uragankatrrin/MHN-React/mhnreact/model.py b/spaces/uragankatrrin/MHN-React/mhnreact/model.py deleted file mode 100644 index 5f24e8be9a813af65577c4314663fa9b3e82ada6..0000000000000000000000000000000000000000 --- a/spaces/uragankatrrin/MHN-React/mhnreact/model.py +++ /dev/null @@ -1,660 +0,0 @@ -# -*- coding: utf-8 -*- -""" -Author: Philipp Seidl - ELLIS Unit Linz, LIT AI Lab, Institute for Machine Learning - Johannes Kepler University Linz -Contact: seidl@ml.jku.at - -Model related functionality -""" -from .utils import top_k_accuracy -from .plotutils import plot_loss, plot_topk, plot_nte -from .molutils import convert_smiles_to_fp -import os -import numpy as np -import torch -import torch.nn as nn -from collections import defaultdict -from scipy import sparse -import logging -from tqdm import tqdm -import wandb - -log = logging.getLogger(__name__) - -class ChemRXNDataset(torch.utils.data.Dataset): - "Torch Dataset for ChemRXN containing Xs: the input as np array, target: the target molecules (or nothing), and ys: the label" - def __init__(self, Xs, target, ys, is_smiles=False, fp_size=2048, fingerprint_type='morgan'): - self.is_smiles=is_smiles - if is_smiles: - self.Xs = Xs - self.target = target - self.fp_size = fp_size - self.fingerprint_type = fingerprint_type - else: - self.Xs = Xs.astype(np.float32) - self.target = target.astype(np.float32) - self.ys = ys - self.ys_is_sparse = isinstance(self.ys, sparse.csr.csr_matrix) - - def __getitem__(self, k): - mol_fp = self.Xs[k] - if self.is_smiles: - mol_fp = convert_smiles_to_fp(mol_fp, fp_size=self.fp_size, which=self.fingerprint_type).astype(np.float32) - - target = None if self.target is None else self.target[k] - if self.is_smiles and self.target: - target = convert_smiles_to_fp(target, fp_size=self.fp_size, which=self.fingerprint_type).astype(np.float32) - - label = self.ys[k] - if isinstance(self.ys, sparse.csr.csr_matrix): - label = label.toarray()[0] - - return (mol_fp, target, label) - - def __len__(self): - return len(self.Xs) - -class ModelConfig(object): - def __init__(self, **kwargs): - self.fingerprint_type = kwargs.pop("fingerprint_type", 'morgan') - self.template_fp_type = kwargs.pop("template_fp_type", 'rdk') - self.num_templates = kwargs.pop("num_templates", 401) - self.fp_size = kwargs.pop("fp_size", 2048) - self.fp_radius = kwargs.pop("fp_radius", 4) - - self.device = kwargs.pop("device", 'cuda' if torch.cuda.is_available() else 'cpu') - self.batch_size = kwargs.pop("batch_size", 32) - self.pooling_operation_state_embedding = kwargs.pop('pooling_operation_state_embedding', 'mean') - self.pooling_operation_head = kwargs.pop('pooling_operation_head', 'max') - - self.dropout = kwargs.pop('dropout', 0.0) - - self.lr = kwargs.pop('lr', 1e-4) - self.optimizer = kwargs.pop("optimizer", "Adam") - - self.activation_function = kwargs.pop('activation_function', 'ReLU') - self.verbose = kwargs.pop("verbose", False) # debugging or printing additional warnings / information set tot True - - self.hopf_input_size = kwargs.pop('hopf_input_size', 2048) - self.hopf_output_size = kwargs.pop("hopf_output_size", 768) - self.hopf_num_heads = kwargs.pop("hopf_num_heads", 1) - self.hopf_asso_dim = kwargs.pop("hopf_asso_dim", 768) - self.hopf_association_activation = kwargs.pop("hopf_association_activation", None) - self.hopf_beta = kwargs.pop("hopf_beta",0.125) # 1/(self.hopf_asso_dim**(1/2) sqrt(d_k) - self.norm_input = kwargs.pop("norm_input",False) - self.norm_asso = kwargs.pop("norm_asso", False) - - # additional experimental hyperparams - if 'hopf_n_layers' in kwargs.keys(): - self.hopf_n_layers = kwargs.pop('hopf_n_layers', 0) - if 'mol_encoder_layers' in kwargs.keys(): - self.mol_encoder_layers = kwargs.pop('mol_encoder_layers', 1) - if 'temp_encoder_layers' in kwargs.keys(): - self.temp_encoder_layers = kwargs.pop('temp_encoder_layers', 1) - if 'encoder_af' in kwargs.keys(): - self.encoder_af = kwargs.pop('encoder_af', 'ReLU') - - # additional kwargs - for key, value in kwargs.items(): - try: - setattr(self, key, value) - except AttributeError as err: - log.error(f"Can't set {key} with value {value} for {self}") - raise err - - -class Encoder(nn.Module): - """Simple FFNN""" - def __init__(self, input_size: int = 2048, output_size: int = 1024, - num_layers: int = 1, dropout: float = 0.3, af_name: str ='None', - norm_in: bool = False, norm_out: bool = False): - super().__init__() - self.ws = [] - self.setup_af(af_name) - self.norm_in = (lambda k: k) if not norm_in else torch.nn.LayerNorm(input_size, elementwise_affine=False) - self.norm_out = (lambda k: k) if not norm_out else torch.nn.LayerNorm(output_size, elementwise_affine=False) - self.setup_ff(input_size, output_size, num_layers) - self.dropout = nn.Dropout(p=dropout) - - def forward(self, x: torch.Tensor): - x = self.norm_in(x) - for i, w in enumerate(self.ws): - if i==(len(self.ws)-1): - x = self.dropout(w(x)) # all except last haf ff_af - else: - x = self.dropout(self.af(w(x))) - x = self.norm_out(x) - return x - - def setup_ff(self, input_size:int, output_size:int, num_layers=1): - """setup feed-forward NN with n-layers""" - for n in range(0, num_layers): - w = nn.Linear(input_size if n==0 else output_size, output_size) - torch.nn.init.kaiming_normal_(w.weight, mode='fan_in', nonlinearity='linear') # eqiv to LeCun init - setattr(self, f'W_{n}', w) # consider doing a step-wise reduction - self.ws.append(getattr(self, f'W_{n}')) - - def setup_af(self, af_name : str): - """set activation function""" - if af_name is None or (af_name == 'None'): - self.af = lambda k: k - else: - try: - self.af = getattr(nn, af_name)() - except AttributeError as err: - log.error(f"Can't find activation-function {af_name} in torch.nn") - raise err - - -class MoleculeEncoder(Encoder): - """ - Class for Molecule encoder: can be any class mapping Smiles to a Vector (preferable differentiable ;) - """ - def __init__(self, config): - self.config = config - -class FPMolEncoder(Encoder): - """ - Fingerprint Based Molecular encoder - """ - def __init__(self, config): - super().__init__(input_size = config.hopf_input_size*config.hopf_num_heads, - output_size = config.hopf_asso_dim*config.hopf_num_heads, - num_layers = config.mol_encoder_layers, - dropout = config.dropout, - af_name = config.encoder_af, - norm_in = config.norm_input, - norm_out = config.norm_asso, - ) - # number of layers = self.config.mol_encoder_layers - # layer-dimension = self.config.hopf_asso_dim - # activation-function = self.config.af - - self.config = config - - def forward_smiles(self, list_of_smiles: list): - fp_tensor = self.convert_smiles_to_tensor(list_of_smiles) - return self.forward(fp_tensor) - - def convert_smiles_to_tensor(self, list_of_smiles): - fps = convert_smiles_to_fp(list_of_smiles, fp_size=self.config.fp_size, - which=self.config.fingerprint_type, radius=self.config.fp_radius) - fps_tensor = torch.from_numpy(fps.astype(np.float)).to(dtype=torch.float).to(self.config.device) - return fps_tensor - -class TemplateEncoder(Encoder): - """ - Class for Template encoder: can be any class mapping a Smarts-Reaction to a Vector (preferable differentiable ;) - """ - def __init__(self, config): - super().__init__(input_size = config.hopf_input_size*config.hopf_num_heads, - output_size = config.hopf_asso_dim*config.hopf_num_heads, - num_layers = config.temp_encoder_layers, - dropout = config.dropout, - af_name = config.encoder_af, - norm_in = config.norm_input, - norm_out = config.norm_asso, - ) - self.config = config - #number of layers - #template fingerprint type - #random template threshold - #reactant pooling - if config.temp_encoder_layers==0: - print('No Key-Projection = Static Key/Templates') - assert self.config.hopf_asso_dim==self.config.fp_size - self.wks = [] - - -class MHN(nn.Module): - """ - MHN - modern Hopfield Network -- for Template relevance prediction - """ - def __init__(self, config=None, layer2weight=0.05, use_template_encoder=True): - super().__init__() - if config: - self.config = config - else: - self.config = ModelConfig() - self.beta = self.config.hopf_beta - # hopf_num_heads - self.mol_encoder = FPMolEncoder(self.config) - if use_template_encoder: - self.template_encoder = TemplateEncoder(self.config) - - self.W_v = None - self.layer2weight = layer2weight - - # more MHN layers -- added recursively - if hasattr(self.config, 'hopf_n_layers'): - di = self.config.__dict__ - di['hopf_n_layers'] -= 1 - if di['hopf_n_layers']>0: - conf_wo_hopf_nlayers = ModelConfig(**di) - self.layer = MHN(conf_wo_hopf_nlayers) - if di['hopf_n_layers']!=0: - self.W_v = nn.Linear(self.config.hopf_asso_dim, self.config.hopf_input_size) - torch.nn.init.kaiming_normal_(self.W_v.weight, mode='fan_in', nonlinearity='linear') # eqiv to LeCun init - - self.softmax = torch.nn.Softmax(dim=1) - - self.lossfunction = nn.CrossEntropyLoss(reduction='none')#, weight=class_weights) - self.pretrain_lossfunction = nn.BCEWithLogitsLoss(reduction='none')#, weight=class_weights) - - self.lr = self.config.lr - - if self.config.hopf_association_activation is None or (self.config.hopf_association_activation.lower()=='none'): - self.af = lambda k: k - else: - self.af = getattr(nn, self.config.hopf_association_activation)() - - self.pooling_operation_head = getattr(torch, self.config.pooling_operation_head) - - self.X = None # templates projected to Hopfield Layer - - self.optimizer = getattr(torch.optim, self.config.optimizer)(self.parameters(), lr=self.lr) - self.steps = 0 - self.hist = defaultdict(list) - self.to(self.config.device) - - def set_templates(self, template_list, which='rdk', fp_size=None, radius=2, learnable=False, njobs=1, only_templates_in_batch=False): - self.template_list = template_list.copy() - if fp_size is None: - fp_size = self.config.fp_size - if len(template_list)>=100000: - import math - print('batch-wise template_calculation') - bs = 30000 - final_temp_emb = torch.zeros((len(template_list), fp_size)).float().to(self.config.device) - for b in range(math.ceil(len(template_list)//bs)+1): - self.template_list = template_list[bs*b:min(bs*(b+1), len(template_list))] - templ_emb = self.update_template_embedding(which=which, fp_size=fp_size, radius=radius, learnable=learnable, njobs=njobs, only_templates_in_batch=only_templates_in_batch) - final_temp_emb[bs*b:min(bs*(b+1), len(template_list))] = torch.from_numpy(templ_emb) - self.templates = final_temp_emb - else: - self.update_template_embedding(which=which, fp_size=fp_size, radius=radius, learnable=learnable, njobs=njobs, only_templates_in_batch=only_templates_in_batch) - - self.set_templates_recursively() - - def set_templates_recursively(self): - if 'hopf_n_layers' in self.config.__dict__.keys(): - if self.config.hopf_n_layers >0: - self.layer.templates = self.templates - self.layer.set_templates_recursively() - - def update_template_embedding(self,fp_size=2048, radius=4, which='rdk', learnable=False, njobs=1, only_templates_in_batch=False): - print('updating template-embedding; (just computing the template-fingerprint and using that)') - bs = self.config.batch_size - - split_template_list = [str(t).split('>')[0].split('.') for t in self.template_list] - templates_np = convert_smiles_to_fp(split_template_list, is_smarts=True, fp_size=fp_size, radius=radius, which=which, njobs=njobs) - - split_template_list = [str(t).split('>')[-1].split('.') for t in self.template_list] - reactants_np = convert_smiles_to_fp(split_template_list, is_smarts=True, fp_size=fp_size, radius=radius, which=which, njobs=njobs) - - template_representation = templates_np-(reactants_np*0.5) - if learnable: - self.templates = torch.nn.Parameter(torch.from_numpy(template_representation).float(), requires_grad=True).to(self.config.device) - self.register_parameter(name='templates', param=self.templates) - else: - if only_templates_in_batch: - self.templates_np = template_representation - else: - self.templates = torch.from_numpy(template_representation).float().to(self.config.device) - - return template_representation - - - def np_fp_to_tensor(self, np_fp): - return torch.from_numpy(np_fp.astype(np.float64)).to(self.config.device).float() - - def masked_loss_fun(self, loss_fun, h_out, ys_batch): - if loss_fun == self.BCEWithLogitsLoss: - mask = (ys_batch != -1).float() - ys_batch = ys_batch.float() - else: - mask = (ys_batch.long() != -1).long() - mask_sum = int(mask.sum().cpu().numpy()) - if mask_sum == 0: - return 0 - - ys_batch = ys_batch * mask - - loss = (loss_fun(h_out, ys_batch * mask) * mask.float()).sum() / mask_sum # only mean from non -1 - return loss - - def compute_losses(self, out, ys_batch, head_loss_weight=None): - - if len(ys_batch.shape)==2: - if ys_batch.shape[1]==self.config.num_templates: # it is in pretraining_mode - loss = self.pretrain_lossfunction(out, ys_batch.float()).mean() - else: - # legacy from policyNN - loss = self.lossfunction(out, ys_batch[:, 2]).mean() # WARNING: HEAD4 Reaction Template is ys[:,2] - else: - loss = self.lossfunction(out, ys_batch).mean() - return loss - - def forward_smiles(self, list_of_smiles, templates=None): - state_tensor = self.mol_encoder.convert_smiles_to_tensor(list_of_smiles) - return self.forward(state_tensor, templates=templates) - - def forward(self, m, templates=None): - """ - m: molecule in the form batch x fingerprint - templates: None or newly given templates if not instanciated - returns logits ranking the templates for each molecule - """ - #states_emb = self.fcfe(state_fp) - bs = m.shape[0] #batch_size - #templates = self.temp_emb(torch.arange(0,2000).long()) - if (templates is None) and (self.X is None) and (self.templates is None): - raise Exception('Either pass in templates, or init templates by runnting clf.set_templates') - n_temp = len(templates) if templates is not None else len(self.templates) - if self.training or (templates is None) or (self.X is not None): - templates = templates if templates is not None else self.templates - X = self.template_encoder(templates) - else: - X = self.X # precomputed from last forward run - - Xi = self.mol_encoder(m) - - Xi = Xi.view(bs, self.config.hopf_num_heads, self.config.hopf_asso_dim) # [bs, H, A] - X = X.view(1, n_temp, self.config.hopf_asso_dim, self.config.hopf_num_heads) #[1, T, A, H] - - XXi = torch.tensordot(Xi, X, dims=[(2,1), (2,0)]) # AxA -> [bs, T, H] - - # pooling over heads - if self.config.hopf_num_heads<=1: - #QKt_pooled = QKt - XXi = XXi[:,:,0] #torch.squeeze(QKt, dim=2) - else: - XXi = self.pooling_operation_head(XXi, dim=2) # default is max pooling over H [bs, T] - if (self.config.pooling_operation_head =='max') or (self.config.pooling_operation_head =='min'): - XXi = XXi[0] #max and min also return the indices =S - - out = self.beta*XXi # [bs, T, H] # softmax over dim=1 #pooling_operation_head - - self.xinew = self.softmax(out)@X.view(n_temp, self.config.hopf_asso_dim) # [bs,T]@[T,emb] -> [bs,emb] - - if self.W_v: - # call layers recursive - hopfout = self.W_v(self.xinew) # [bs,emb]@[emb,hopf_inp] --> [bs, hopf_inp] - # TODO check if using x_pooled or if not going through mol_encoder again - hopfout = hopfout + m # skip-connection - # give it to the next layer - out2 = self.layer.forward(hopfout) #templates=self.W_v(self.K) - out = out*(1-self.layer2weight)+out2*self.layer2weight - - return out - - def train_from_np(self, Xs, targets, ys, is_smiles=False, epochs=2, lr=0.001, bs=32, - permute_batches=False, shuffle=True, optimizer=None, - use_dataloader=True, verbose=False, - wandb=None, scheduler=None, only_templates_in_batch=False): - """ - Xs in the form sample x states - targets - ys in the form sample x [y_h1, y_h2, y_h3, y_h4] - """ - self.train() - if optimizer is None: - try: - self.optimizer = getattr(torch.optim, self.config.optimizer)(self.parameters(), lr=self.lr if lr is None else lr) - except AttributeError as err: - log.error(f"Can't find optimizer {config.optimizer} in torch.optim") - raise err - optimizer = self.optimizer - - dataset = ChemRXNDataset(Xs, targets, ys, is_smiles=is_smiles, - fp_size=self.config.fp_size, fingerprint_type=self.config.fingerprint_type) - - dataloader = torch.utils.data.DataLoader(dataset, batch_size=bs, shuffle=shuffle, sampler=None, - batch_sampler=None, num_workers=0, collate_fn=None, - pin_memory=False, drop_last=False, timeout=0, - worker_init_fn=None) - - for epoch in range(epochs): # loop over the dataset multiple times - running_loss = 0.0 - running_loss_dict = defaultdict(int) - batch_order = range(0, len(Xs), bs) - if permute_batches: - batch_order = np.random.permutation(batch_order) - - for step, s in tqdm(enumerate(dataloader),mininterval=2): - batch = [b.to(self.config.device, non_blocking=True) for b in s] - Xs_batch, target_batch, ys_batch = batch - - # zero the parameter gradients - optimizer.zero_grad() - - # forward + backward + optimize - out = self.forward(Xs_batch) - total_loss = self.compute_losses(out, ys_batch) - - loss_dict = {'CE_loss': total_loss} - - total_loss.backward() - - optimizer.step() - if scheduler: - scheduler.step() - self.steps += 1 - - # print statistics - for k in loss_dict: - running_loss_dict[k] += loss_dict[k].item() - try: - running_loss += total_loss.item() - except: - running_loss += 0 - - rs = min(100,len(Xs)//bs) # reporting/logging steps - if step % rs == (rs-1): # print every 2000 mini-batches - if verbose: print('[%d, %5d] loss: %.3f' % - (epoch + 1, step + 1, running_loss / rs)) - self.hist['step'].append(self.steps) - self.hist['loss'].append(running_loss/rs) - self.hist['trianing_running_loss'].append(running_loss/rs) - - [self.hist[k].append(running_loss_dict[k]/rs) for k in running_loss_dict] - - if wandb: - wandb.log({'trianing_running_loss': running_loss / rs}) - - running_loss = 0.0 - running_loss_dict = defaultdict(int) - - if verbose: print('Finished Training') - return optimizer - - def evaluate(self, Xs, targets, ys, split='test', is_smiles=False, bs = 32, shuffle=False, wandb=None, only_loss=False): - self.eval() - y_preds = np.zeros( (ys.shape[0], self.config.num_templates), dtype=np.float16) - - loss_metrics = defaultdict(int) - new_hist = defaultdict(float) - with torch.no_grad(): - dataset = ChemRXNDataset(Xs, targets, ys, is_smiles=is_smiles, - fp_size=self.config.fp_size, fingerprint_type=self.config.fingerprint_type) - dataloader = torch.utils.data.DataLoader(dataset, batch_size=bs, shuffle=shuffle, sampler=None, - batch_sampler=None, num_workers=0, collate_fn=None, - pin_memory=False, drop_last=False, timeout=0, - worker_init_fn=None) - - #for step, s in eoutputs = self.forward(batch[0], batchnumerate(range(0, len(Xs), bs)): - for step, batch in enumerate(dataloader):# - batch = [b.to(self.config.device, non_blocking=True) for b in batch] - ys_batch = batch[2] - - if hasattr(self, 'templates_np'): - outputs = [] - for ii in range(10): - tlen = len(self.templates_np) - i_tlen = tlen//10 - templates = torch.from_numpy(self.templates_np[(i_tlen*ii):min(i_tlen*(ii+1), tlen)]).float().to(self.config.device) - outputs.append( self.forward(batch[0], templates = templates ) ) - outputs = torch.cat(outputs, dim=0) - - else: - outputs = self.forward(batch[0]) - - loss = self.compute_losses(outputs, ys_batch, None) - - # not quite right because in every batch there might be different number of valid samples - weight = 1/len(batch[0])#len(Xs[s:min(s + bs, len(Xs))]) / len(Xs) - - loss_metrics['loss'] += (loss.item()) - - if len(ys.shape)>1: - outputs = self.softmax(outputs) if not (ys.shape[1]==self.config.num_templates) else torch.sigmoid(outputs) - else: - outputs = self.softmax(outputs) - - outputs_np = [None if o is None else o.to('cpu').numpy().astype(np.float16) for o in outputs] - - if not only_loss: - ks = [1, 2, 3, 4, 5, 10, 20, 30, 40, 50, 100] - topkacc, mrocc = top_k_accuracy(ys_batch, outputs, k=ks, ret_arocc=True, ret_mrocc=False) - # mrocc -- median rank of correct choice - for k, tkacc in zip(ks, topkacc): - #iterative average update - new_hist[f't{k}_acc_{split}'] += (tkacc-new_hist[f't{k}_acc_{split}']) / (step+1) - # todo weight by batch-size - new_hist[f'meanrank_{split}'] = mrocc - - y_preds[step*bs : min((step+1)*bs,len(y_preds))] = outputs_np - - - new_hist[f'steps_{split}'] = (self.steps) - new_hist[f'loss_{split}'] = (loss_metrics['loss'] / (step+1)) - - for k in new_hist: - self.hist[k].append(new_hist[k]) - - if wandb: - wandb.log(new_hist) - - - self.hist[f'loss_{split}'].append(loss_metrics[f'loss'] / (step+1)) - - return y_preds - - def save_hist(self, prefix='', postfix=''): - HIST_PATH = 'data/hist/' - if not os.path.exists(HIST_PATH): - os.mkdir(HIST_PATH) - fn_hist = HIST_PATH+prefix+postfix+'.csv' - with open(fn_hist, 'w') as fh: - print(dict(self.hist), file=fh) - return fn_hist - - def save_model(self, prefix='', postfix='', name_as_conf=False): - MODEL_PATH = 'data/model/' - if not os.path.exists(MODEL_PATH): - os.mkdir(MODEL_PATH) - if name_as_conf: - confi_str = str(self.config.__dict__.values()).replace("'","").replace(': ','_').replace(', ',';') - else: - confi_str = '' - model_name = prefix+confi_str+postfix+'.pt' - torch.save(self.state_dict(), MODEL_PATH+model_name) - return MODEL_PATH+model_name - - def plot_loss(self): - plot_loss(self.hist) - - def plot_topk(self, sets=['train', 'valid', 'test'], with_last = 2): - plot_topk(self.hist, sets=sets, with_last = with_last) - - def plot_nte(self, last_cpt=1, dataset='Sm', include_bar=True): - plot_nte(self.hist, dataset=dataset, last_cpt=last_cpt, include_bar=include_bar) - - -class SeglerBaseline(MHN): - """FFNN - only the Molecule Encoder + an output projection""" - def __init__(self, config=None): - config.template_fp_type = 'none' - config.temp_encoder_layers = 0 - super().__init__(config, use_template_encoder=False) - self.W_out = torch.nn.Linear(config.hopf_asso_dim, config.num_templates) - self.optimizer = getattr(torch.optim, self.config.optimizer)(self.parameters(), lr=self.lr) - self.steps = 0 - self.hist = defaultdict(list) - self.to(self.config.device) - - def forward(self, m, templates=None): - """ - m: molecule in the form batch x fingerprint - templates: won't be used in this case - returns logits ranking the templates for each molecule - """ - bs = m.shape[0] #batch_size - Xi = self.mol_encoder(m) - Xi = self.mol_encoder.af(Xi) # is not applied in encoder for last layer - out = self.W_out(Xi) # [bs, T] # softmax over dim=1 - return out - -class StaticQK(MHN): - """ Static QK baseline - beware to have the same fingerprint for mol_encoder as for the template_encoder (fp2048 r4 rdk by default)""" - def __init__(self, config=None): - if config: - self.config = config - else: - self.config = ModelConfig() - super().__init__(config) - - self.fp_size = 2048 - self.fingerprint_type = 'rdk' - self.beta = 1 - - def update_template_embedding(self, which='rdk', fp_size=2048, radius=4, learnable=False): - bs = self.config.batch_size - split_template_list = [t.split('>>')[0].split('.') for t in self.template_list] - self.templates = torch.from_numpy(convert_smiles_to_fp(split_template_list, - is_smarts=True, fp_size=fp_size, - radius=radius, which=which).max(1)).float().to(self.config.device) - - - def forward(self, m, templates=None): - """ - - """ - #states_emb = self.fcfe(state_fp) - bs = m.shape[0] #batch_size - - Xi = m #[bs, emb] - X = self.templates #[T, emb]) - - XXi = Xi@X.T # [bs, T] - - # normalize - t_sum = templates.sum(1) #[T] - t_sum = t_sum.view(1,-1).expand(bs, -1) #[bs, T] - XXi = XXi / t_sum - - # not neccecaire because it is not trained - out = self.beta*XXi # [bs, T] # softmax over dim=1 - return out - -class Retrosim(StaticQK): - """ Retrosim-like baseline only for template relevance prediction """ - def fit_with_train(self, X_fp_train, y_train): - self.templates = torch.from_numpy(X_fp_train).float().to(self.config.device) - # train_samples, num_templates - self.sample2acttemplate = torch.nn.functional.one_hot(torch.from_numpy(y_train), self.config.num_templates).float() - tmpnorm = self.sample2acttemplate.sum(0) - tmpnorm[tmpnorm==0] = 1 - self.sample2acttemplate = (self.sample2acttemplate / tmpnorm).to(self.config.device) # results in an average after dot product - - def forward(self, m, templates=None): - """ - """ - out = super().forward(m, templates=templates) - # bs, train_samples - - # map out to actual templates - out = out @ self.sample2acttemplate - - return out \ No newline at end of file diff --git a/spaces/user238921933/stable-diffusion-webui/javascript/imageMaskFix.js b/spaces/user238921933/stable-diffusion-webui/javascript/imageMaskFix.js deleted file mode 100644 index 9fe7a60309c95b4921360fb09d5bee2b2bd2a73c..0000000000000000000000000000000000000000 --- a/spaces/user238921933/stable-diffusion-webui/javascript/imageMaskFix.js +++ /dev/null @@ -1,45 +0,0 @@ -/** - * temporary fix for https://github.com/AUTOMATIC1111/stable-diffusion-webui/issues/668 - * @see https://github.com/gradio-app/gradio/issues/1721 - */ -window.addEventListener( 'resize', () => imageMaskResize()); -function imageMaskResize() { - const canvases = gradioApp().querySelectorAll('#img2maskimg .touch-none canvas'); - if ( ! canvases.length ) { - canvases_fixed = false; - window.removeEventListener( 'resize', imageMaskResize ); - return; - } - - const wrapper = canvases[0].closest('.touch-none'); - const previewImage = wrapper.previousElementSibling; - - if ( ! previewImage.complete ) { - previewImage.addEventListener( 'load', () => imageMaskResize()); - return; - } - - const w = previewImage.width; - const h = previewImage.height; - const nw = previewImage.naturalWidth; - const nh = previewImage.naturalHeight; - const portrait = nh > nw; - const factor = portrait; - - const wW = Math.min(w, portrait ? h/nh*nw : w/nw*nw); - const wH = Math.min(h, portrait ? h/nh*nh : w/nw*nh); - - wrapper.style.width = `${wW}px`; - wrapper.style.height = `${wH}px`; - wrapper.style.left = `0px`; - wrapper.style.top = `0px`; - - canvases.forEach( c => { - c.style.width = c.style.height = ''; - c.style.maxWidth = '100%'; - c.style.maxHeight = '100%'; - c.style.objectFit = 'contain'; - }); - } - - onUiUpdate(() => imageMaskResize()); diff --git a/spaces/vaishanthr/Simultaneous-Segmented-Depth-Prediction/yolov8/docs/modes/train.md b/spaces/vaishanthr/Simultaneous-Segmented-Depth-Prediction/yolov8/docs/modes/train.md deleted file mode 100644 index 16c32ef84e35d0d0e1945599ed3d2581cb8388ad..0000000000000000000000000000000000000000 --- a/spaces/vaishanthr/Simultaneous-Segmented-Depth-Prediction/yolov8/docs/modes/train.md +++ /dev/null @@ -1,242 +0,0 @@ ---- -comments: true -description: Learn how to train custom YOLOv8 models on various datasets, configure hyperparameters, and use Ultralytics' YOLO for seamless training. -keywords: YOLOv8, train mode, train a custom YOLOv8 model, hyperparameters, train a model, Comet, ClearML, TensorBoard, logging, loggers ---- - - - -**Train mode** is used for training a YOLOv8 model on a custom dataset. In this mode, the model is trained using the specified dataset and hyperparameters. The training process involves optimizing the model's parameters so that it can accurately predict the classes and locations of objects in an image. - -!!! tip "Tip" - - * YOLOv8 datasets like COCO, VOC, ImageNet and many others automatically download on first use, i.e. `yolo train data=coco.yaml` - -## Usage Examples - -Train YOLOv8n on the COCO128 dataset for 100 epochs at image size 640. See Arguments section below for a full list of training arguments. - -!!! example "Single-GPU and CPU Training Example" - - Device is determined automatically. If a GPU is available then it will be used, otherwise training will start on CPU. - - === "Python" - - ```python - from ultralytics import YOLO - - # Load a model - model = YOLO('yolov8n.yaml') # build a new model from YAML - model = YOLO('yolov8n.pt') # load a pretrained model (recommended for training) - model = YOLO('yolov8n.yaml').load('yolov8n.pt') # build from YAML and transfer weights - - # Train the model - model.train(data='coco128.yaml', epochs=100, imgsz=640) - ``` - === "CLI" - - ```bash - # Build a new model from YAML and start training from scratch - yolo detect train data=coco128.yaml model=yolov8n.yaml epochs=100 imgsz=640 - - # Start training from a pretrained *.pt model - yolo detect train data=coco128.yaml model=yolov8n.pt epochs=100 imgsz=640 - - # Build a new model from YAML, transfer pretrained weights to it and start training - yolo detect train data=coco128.yaml model=yolov8n.yaml pretrained=yolov8n.pt epochs=100 imgsz=640 - ``` - -### Multi-GPU Training - -The training device can be specified using the `device` argument. If no argument is passed GPU `device=0` will be used if available, otherwise `device=cpu` will be used. - -!!! example "Multi-GPU Training Example" - - === "Python" - - ```python - from ultralytics import YOLO - - # Load a model - model = YOLO('yolov8n.pt') # load a pretrained model (recommended for training) - - # Train the model with 2 GPUs - model.train(data='coco128.yaml', epochs=100, imgsz=640, device=[0, 1]) - ``` - === "CLI" - - ```bash - # Start training from a pretrained *.pt model using GPUs 0 and 1 - yolo detect train data=coco128.yaml model=yolov8n.pt epochs=100 imgsz=640 device=0,1 - ``` - -### Apple M1 and M2 MPS Training - -With the support for Apple M1 and M2 chips integrated in the Ultralytics YOLO models, it's now possible to train your models on devices utilizing the powerful Metal Performance Shaders (MPS) framework. The MPS offers a high-performance way of executing computation and image processing tasks on Apple's custom silicon. - -To enable training on Apple M1 and M2 chips, you should specify 'mps' as your device when initiating the training process. Below is an example of how you could do this in Python and via the command line: - -!!! example "MPS Training Example" - - === "Python" - - ```python - from ultralytics import YOLO - - # Load a model - model = YOLO('yolov8n.pt') # load a pretrained model (recommended for training) - - # Train the model with 2 GPUs - model.train(data='coco128.yaml', epochs=100, imgsz=640, device='mps') - ``` - === "CLI" - - ```bash - # Start training from a pretrained *.pt model using GPUs 0 and 1 - yolo detect train data=coco128.yaml model=yolov8n.pt epochs=100 imgsz=640 device=mps - ``` - -While leveraging the computational power of the M1/M2 chips, this enables more efficient processing of the training tasks. For more detailed guidance and advanced configuration options, please refer to the [PyTorch MPS documentation](https://pytorch.org/docs/stable/notes/mps.html). - -### Resuming Interrupted Trainings - -Resuming training from a previously saved state is a crucial feature when working with deep learning models. This can come in handy in various scenarios, like when the training process has been unexpectedly interrupted, or when you wish to continue training a model with new data or for more epochs. - -When training is resumed, Ultralytics YOLO loads the weights from the last saved model and also restores the optimizer state, learning rate scheduler, and the epoch number. This allows you to continue the training process seamlessly from where it was left off. - -You can easily resume training in Ultralytics YOLO by setting the `resume` argument to `True` when calling the `train` method, and specifying the path to the `.pt` file containing the partially trained model weights. - -Below is an example of how to resume an interrupted training using Python and via the command line: - -!!! example "Resume Training Example" - - === "Python" - - ```python - from ultralytics import YOLO - - # Load a model - model = YOLO('path/to/last.pt') # load a partially trained model - - # Resume training - model.train(resume=True) - ``` - === "CLI" - - ```bash - # Resume an interrupted training - yolo train resume model=path/to/last.pt - ``` - -By setting `resume=True`, the `train` function will continue training from where it left off, using the state stored in the 'path/to/last.pt' file. If the `resume` argument is omitted or set to `False`, the `train` function will start a new training session. - -Remember that checkpoints are saved at the end of every epoch by default, or at fixed interval using the `save_period` argument, so you must complete at least 1 epoch to resume a training run. - -## Arguments - -Training settings for YOLO models refer to the various hyperparameters and configurations used to train the model on a dataset. These settings can affect the model's performance, speed, and accuracy. Some common YOLO training settings include the batch size, learning rate, momentum, and weight decay. Other factors that may affect the training process include the choice of optimizer, the choice of loss function, and the size and composition of the training dataset. It is important to carefully tune and experiment with these settings to achieve the best possible performance for a given task. - -| Key | Value | Description | -|-------------------|----------|-----------------------------------------------------------------------------------| -| `model` | `None` | path to model file, i.e. yolov8n.pt, yolov8n.yaml | -| `data` | `None` | path to data file, i.e. coco128.yaml | -| `epochs` | `100` | number of epochs to train for | -| `patience` | `50` | epochs to wait for no observable improvement for early stopping of training | -| `batch` | `16` | number of images per batch (-1 for AutoBatch) | -| `imgsz` | `640` | size of input images as integer or w,h | -| `save` | `True` | save train checkpoints and predict results | -| `save_period` | `-1` | Save checkpoint every x epochs (disabled if < 1) | -| `cache` | `False` | True/ram, disk or False. Use cache for data loading | -| `device` | `None` | device to run on, i.e. cuda device=0 or device=0,1,2,3 or device=cpu | -| `workers` | `8` | number of worker threads for data loading (per RANK if DDP) | -| `project` | `None` | project name | -| `name` | `None` | experiment name | -| `exist_ok` | `False` | whether to overwrite existing experiment | -| `pretrained` | `False` | whether to use a pretrained model | -| `optimizer` | `'auto'` | optimizer to use, choices=[SGD, Adam, Adamax, AdamW, NAdam, RAdam, RMSProp, auto] | -| `verbose` | `False` | whether to print verbose output | -| `seed` | `0` | random seed for reproducibility | -| `deterministic` | `True` | whether to enable deterministic mode | -| `single_cls` | `False` | train multi-class data as single-class | -| `rect` | `False` | rectangular training with each batch collated for minimum padding | -| `cos_lr` | `False` | use cosine learning rate scheduler | -| `close_mosaic` | `0` | (int) disable mosaic augmentation for final epochs | -| `resume` | `False` | resume training from last checkpoint | -| `amp` | `True` | Automatic Mixed Precision (AMP) training, choices=[True, False] | -| `fraction` | `1.0` | dataset fraction to train on (default is 1.0, all images in train set) | -| `profile` | `False` | profile ONNX and TensorRT speeds during training for loggers | -| `lr0` | `0.01` | initial learning rate (i.e. SGD=1E-2, Adam=1E-3) | -| `lrf` | `0.01` | final learning rate (lr0 * lrf) | -| `momentum` | `0.937` | SGD momentum/Adam beta1 | -| `weight_decay` | `0.0005` | optimizer weight decay 5e-4 | -| `warmup_epochs` | `3.0` | warmup epochs (fractions ok) | -| `warmup_momentum` | `0.8` | warmup initial momentum | -| `warmup_bias_lr` | `0.1` | warmup initial bias lr | -| `box` | `7.5` | box loss gain | -| `cls` | `0.5` | cls loss gain (scale with pixels) | -| `dfl` | `1.5` | dfl loss gain | -| `pose` | `12.0` | pose loss gain (pose-only) | -| `kobj` | `2.0` | keypoint obj loss gain (pose-only) | -| `label_smoothing` | `0.0` | label smoothing (fraction) | -| `nbs` | `64` | nominal batch size | -| `overlap_mask` | `True` | masks should overlap during training (segment train only) | -| `mask_ratio` | `4` | mask downsample ratio (segment train only) | -| `dropout` | `0.0` | use dropout regularization (classify train only) | -| `val` | `True` | validate/test during training | - -## Logging - -In training a YOLOv8 model, you might find it valuable to keep track of the model's performance over time. This is where logging comes into play. Ultralytics' YOLO provides support for three types of loggers - Comet, ClearML, and TensorBoard. - -To use a logger, select it from the dropdown menu in the code snippet above and run it. The chosen logger will be installed and initialized. - -### Comet - -[Comet](https://www.comet.ml/site/) is a platform that allows data scientists and developers to track, compare, explain and optimize experiments and models. It provides functionalities such as real-time metrics, code diffs, and hyperparameters tracking. - -To use Comet: - -```python -# pip install comet_ml -import comet_ml - -comet_ml.init() -``` - -Remember to sign in to your Comet account on their website and get your API key. You will need to add this to your environment variables or your script to log your experiments. - -### ClearML - -[ClearML](https://www.clear.ml/) is an open-source platform that automates tracking of experiments and helps with efficient sharing of resources. It is designed to help teams manage, execute, and reproduce their ML work more efficiently. - -To use ClearML: - -```python -# pip install clearml -import clearml - -clearml.browser_login() -``` - -After running this script, you will need to sign in to your ClearML account on the browser and authenticate your session. - -### TensorBoard - -[TensorBoard](https://www.tensorflow.org/tensorboard) is a visualization toolkit for TensorFlow. It allows you to visualize your TensorFlow graph, plot quantitative metrics about the execution of your graph, and show additional data like images that pass through it. - -To use TensorBoard in [Google Colab](https://colab.research.google.com/github/ultralytics/ultralytics/blob/main/examples/tutorial.ipynb): - -```bash -load_ext tensorboard -tensorboard --logdir ultralytics/runs # replace with 'runs' directory -``` - -To use TensorBoard locally run the below command and view results at http://localhost:6006/. - -```bash -tensorboard --logdir ultralytics/runs # replace with 'runs' directory -``` - -This will load TensorBoard and direct it to the directory where your training logs are saved. - -After setting up your logger, you can then proceed with your model training. All training metrics will be automatically logged in your chosen platform, and you can access these logs to monitor your model's performance over time, compare different models, and identify areas for improvement. \ No newline at end of file diff --git a/spaces/vebie91/spaces-image-classification-demo/app.py b/spaces/vebie91/spaces-image-classification-demo/app.py deleted file mode 100644 index b47c3621e460abc71c7c5026b2e6327e0a563bc2..0000000000000000000000000000000000000000 --- a/spaces/vebie91/spaces-image-classification-demo/app.py +++ /dev/null @@ -1,9 +0,0 @@ -# an image classification demo! - -import gradio as gr - -model1 = gr.Interface.load("huggingface/microsoft/beit-base-patch16-224") -model2 = gr.Interface.load("huggingface/google/vit-base-patch16-224") - -gr.Parallel(model1, model2, - examples=['cat.jpg', 'dog.jpg', 'alligator knife head.jpg', 'moskva.jpg']).launch() \ No newline at end of file diff --git a/spaces/vijv/VV-06-SL-AI-Image-Music-Video-UI-UX-URL/app.py b/spaces/vijv/VV-06-SL-AI-Image-Music-Video-UI-UX-URL/app.py deleted file mode 100644 index 0f4298365bc4f58d285202fb9442e12805d2db95..0000000000000000000000000000000000000000 --- a/spaces/vijv/VV-06-SL-AI-Image-Music-Video-UI-UX-URL/app.py +++ /dev/null @@ -1,45 +0,0 @@ -import streamlit as st -import gradio as gr -import IPython -import streamlit as st -import streamlit.components.v1 as components -from IPython.display import IFrame - -src='' # URL parameter to change the iframe url -def SetIframeURL(option_selected): - if (option_selected=='Collager'): - src='https://www.artbreeder.com/' - if (option_selected=='Midjourney'): - src='https://www.midjourney.com/' - if (option_selected=='DreamStudio'): - src='https://beta.dreamstudio.ai/' - if (option_selected=='NightCafe'): - src='https://creator.nightcafe.studio/' - if (option_selected=='RunwayML'): - src='https://app.runwayml.com/' - if (option_selected=='ArtFromTextandImages'): - src='https://huggingface.co/spaces/awacke1/Art-from-Text-and-Images' - if (option_selected=='Boomy'): - src='https://boomy.com/' - - width = st.sidebar.slider("Width", 200, 1500, 800, 100) - height = st.sidebar.slider("Height", 200, 1500, 900, 100) - st.components.v1.iframe(src, width, height, scrolling=True) - -try: - options = ['Midjourney', 'RunwayML', 'Boomy'] - query_params = st.experimental_get_query_params() - query_option = query_params['option'][0] #throws an exception when visiting http://host:port - option_selected = st.sidebar.selectbox('Pick option', options, index=options.index(query_option)) - if option_selected: - st.experimental_set_query_params(option=option_selected) - SetIframeURL(option_selected) -except: - options = ['Midjourney', 'RunwayML', 'Boomy'] - st.experimental_set_query_params(option=options[1]) # defaults to 1 - query_params = st.experimental_get_query_params() - query_option = query_params['option'][0] - option_selected = st.sidebar.selectbox('Pick option', options, index=options.index(query_option)) - if option_selected: - st.experimental_set_query_params(option=option_selected) - SetIframeURL(option_selected) \ No newline at end of file diff --git a/spaces/vumichien/canvas_controlnet/annotator/uniformer/mmseg/apis/train.py b/spaces/vumichien/canvas_controlnet/annotator/uniformer/mmseg/apis/train.py deleted file mode 100644 index 63f319a919ff023931a6a663e668f27dd1a07a2e..0000000000000000000000000000000000000000 --- a/spaces/vumichien/canvas_controlnet/annotator/uniformer/mmseg/apis/train.py +++ /dev/null @@ -1,116 +0,0 @@ -import random -import warnings - -import numpy as np -import torch -from annotator.uniformer.mmcv.parallel import MMDataParallel, MMDistributedDataParallel -from annotator.uniformer.mmcv.runner import build_optimizer, build_runner - -from annotator.uniformer.mmseg.core import DistEvalHook, EvalHook -from annotator.uniformer.mmseg.datasets import build_dataloader, build_dataset -from annotator.uniformer.mmseg.utils import get_root_logger - - -def set_random_seed(seed, deterministic=False): - """Set random seed. - - Args: - seed (int): Seed to be used. - deterministic (bool): Whether to set the deterministic option for - CUDNN backend, i.e., set `torch.backends.cudnn.deterministic` - to True and `torch.backends.cudnn.benchmark` to False. - Default: False. - """ - random.seed(seed) - np.random.seed(seed) - torch.manual_seed(seed) - torch.cuda.manual_seed_all(seed) - if deterministic: - torch.backends.cudnn.deterministic = True - torch.backends.cudnn.benchmark = False - - -def train_segmentor(model, - dataset, - cfg, - distributed=False, - validate=False, - timestamp=None, - meta=None): - """Launch segmentor training.""" - logger = get_root_logger(cfg.log_level) - - # prepare data loaders - dataset = dataset if isinstance(dataset, (list, tuple)) else [dataset] - data_loaders = [ - build_dataloader( - ds, - cfg.data.samples_per_gpu, - cfg.data.workers_per_gpu, - # cfg.gpus will be ignored if distributed - len(cfg.gpu_ids), - dist=distributed, - seed=cfg.seed, - drop_last=True) for ds in dataset - ] - - # put model on gpus - if distributed: - find_unused_parameters = cfg.get('find_unused_parameters', False) - # Sets the `find_unused_parameters` parameter in - # torch.nn.parallel.DistributedDataParallel - model = MMDistributedDataParallel( - model.cuda(), - device_ids=[torch.cuda.current_device()], - broadcast_buffers=False, - find_unused_parameters=find_unused_parameters) - else: - model = MMDataParallel( - model.cuda(cfg.gpu_ids[0]), device_ids=cfg.gpu_ids) - - # build runner - optimizer = build_optimizer(model, cfg.optimizer) - - if cfg.get('runner') is None: - cfg.runner = {'type': 'IterBasedRunner', 'max_iters': cfg.total_iters} - warnings.warn( - 'config is now expected to have a `runner` section, ' - 'please set `runner` in your config.', UserWarning) - - runner = build_runner( - cfg.runner, - default_args=dict( - model=model, - batch_processor=None, - optimizer=optimizer, - work_dir=cfg.work_dir, - logger=logger, - meta=meta)) - - # register hooks - runner.register_training_hooks(cfg.lr_config, cfg.optimizer_config, - cfg.checkpoint_config, cfg.log_config, - cfg.get('momentum_config', None)) - - # an ugly walkaround to make the .log and .log.json filenames the same - runner.timestamp = timestamp - - # register eval hooks - if validate: - val_dataset = build_dataset(cfg.data.val, dict(test_mode=True)) - val_dataloader = build_dataloader( - val_dataset, - samples_per_gpu=1, - workers_per_gpu=cfg.data.workers_per_gpu, - dist=distributed, - shuffle=False) - eval_cfg = cfg.get('evaluation', {}) - eval_cfg['by_epoch'] = cfg.runner['type'] != 'IterBasedRunner' - eval_hook = DistEvalHook if distributed else EvalHook - runner.register_hook(eval_hook(val_dataloader, **eval_cfg), priority='LOW') - - if cfg.resume_from: - runner.resume(cfg.resume_from) - elif cfg.load_from: - runner.load_checkpoint(cfg.load_from) - runner.run(data_loaders, cfg.workflow) diff --git a/spaces/wallezen/so-vits-svc/cluster/train_cluster.py b/spaces/wallezen/so-vits-svc/cluster/train_cluster.py deleted file mode 100644 index 4ac025d400414226e66849407f477ae786c3d5d3..0000000000000000000000000000000000000000 --- a/spaces/wallezen/so-vits-svc/cluster/train_cluster.py +++ /dev/null @@ -1,89 +0,0 @@ -import os -from glob import glob -from pathlib import Path -import torch -import logging -import argparse -import torch -import numpy as np -from sklearn.cluster import KMeans, MiniBatchKMeans -import tqdm -logging.basicConfig(level=logging.INFO) -logger = logging.getLogger(__name__) -import time -import random - -def train_cluster(in_dir, n_clusters, use_minibatch=True, verbose=False): - - logger.info(f"Loading features from {in_dir}") - features = [] - nums = 0 - for path in tqdm.tqdm(in_dir.glob("*.soft.pt")): - features.append(torch.load(path).squeeze(0).numpy().T) - # print(features[-1].shape) - features = np.concatenate(features, axis=0) - print(nums, features.nbytes/ 1024**2, "MB , shape:",features.shape, features.dtype) - features = features.astype(np.float32) - logger.info(f"Clustering features of shape: {features.shape}") - t = time.time() - if use_minibatch: - kmeans = MiniBatchKMeans(n_clusters=n_clusters,verbose=verbose, batch_size=4096, max_iter=80).fit(features) - else: - kmeans = KMeans(n_clusters=n_clusters,verbose=verbose).fit(features) - print(time.time()-t, "s") - - x = { - "n_features_in_": kmeans.n_features_in_, - "_n_threads": kmeans._n_threads, - "cluster_centers_": kmeans.cluster_centers_, - } - print("end") - - return x - - -if __name__ == "__main__": - - parser = argparse.ArgumentParser() - parser.add_argument('--dataset', type=Path, default="./dataset/44k", - help='path of training data directory') - parser.add_argument('--output', type=Path, default="logs/44k", - help='path of model output directory') - - args = parser.parse_args() - - checkpoint_dir = args.output - dataset = args.dataset - n_clusters = 10000 - - ckpt = {} - for spk in os.listdir(dataset): - if os.path.isdir(dataset/spk): - print(f"train kmeans for {spk}...") - in_dir = dataset/spk - x = train_cluster(in_dir, n_clusters, verbose=False) - ckpt[spk] = x - - checkpoint_path = checkpoint_dir / f"kmeans_{n_clusters}.pt" - checkpoint_path.parent.mkdir(exist_ok=True, parents=True) - torch.save( - ckpt, - checkpoint_path, - ) - - - # import cluster - # for spk in tqdm.tqdm(os.listdir("dataset")): - # if os.path.isdir(f"dataset/{spk}"): - # print(f"start kmeans inference for {spk}...") - # for feature_path in tqdm.tqdm(glob(f"dataset/{spk}/*.discrete.npy", recursive=True)): - # mel_path = feature_path.replace(".discrete.npy",".mel.npy") - # mel_spectrogram = np.load(mel_path) - # feature_len = mel_spectrogram.shape[-1] - # c = np.load(feature_path) - # c = utils.tools.repeat_expand_2d(torch.FloatTensor(c), feature_len).numpy() - # feature = c.T - # feature_class = cluster.get_cluster_result(feature, spk) - # np.save(feature_path.replace(".discrete.npy", ".discrete_class.npy"), feature_class) - - diff --git a/spaces/whitphx/gradio-static-test/dist/assets/index-30198ab0.js b/spaces/whitphx/gradio-static-test/dist/assets/index-30198ab0.js deleted file mode 100644 index 6d83bb501a486885a475e8c430449f6d42cf7c35..0000000000000000000000000000000000000000 --- a/spaces/whitphx/gradio-static-test/dist/assets/index-30198ab0.js +++ /dev/null @@ -1,2 +0,0 @@ -import{S as q,i as A,s as D,C as V,D as d,h as p,F as h,G as N,r as y,H,J as S,I as M,N as j,E as Z,L as I,u as T,f as Y,O as Q,K as U,e as B,m as C,q as g,t as w,o as E,y as W,a0 as X,j as x,k as $,n as z,p as F,z as ee}from"../lite.js";/* empty css */import{B as le}from"./Button-0391b19a.js";import{B as te}from"./BlockLabel-a3ec523d.js";import{E as ne}from"./Empty-91947ea3.js";function se(s){let e,t;return{c(){e=V("svg"),t=V("path"),d(t,"fill","currentColor"),d(t,"d","M4 2H2v26a2 2 0 0 0 2 2h26v-2H4v-3h22v-8H4v-4h14V5H4Zm20 17v4H4v-4ZM16 7v4H4V7Z"),d(e,"xmlns","http://www.w3.org/2000/svg"),d(e,"xmlns:xlink","http://www.w3.org/1999/xlink"),d(e,"aria-hidden","true"),d(e,"role","img"),d(e,"class","iconify iconify--carbon"),d(e,"width","100%"),d(e,"height","100%"),d(e,"preserveAspectRatio","xMidYMid meet"),d(e,"viewBox","0 0 32 32")},m(l,n){p(l,e,n),h(e,t)},p:N,i:N,o:N,d(l){l&&y(e)}}}class P extends q{constructor(e){super(),A(this,e,null,se,D,{})}}function G(s,e,t){const l=s.slice();return l[6]=e[t],l[8]=t,l}function J(s){let e,t=s[0].confidences,l=[];for(let n=0;n{n("select",{index:_,value:r.label})};return s.$$set=_=>{"value"in _&&t(0,l=_.value),"show_label"in _&&t(1,a=_.show_label),"color"in _&&t(2,i=_.color),"selectable"in _&&t(3,o=_.selectable)},[l,a,i,o,n,f]}class oe extends q{constructor(e){super(),A(this,e,ie,ae,D,{value:0,show_label:1,color:2,selectable:3})}}function R(s){let e,t;return e=new te({props:{Icon:P,label:s[5],disable:typeof s[6].container=="boolean"&&!s[6].container}}),{c(){B(e.$$.fragment)},m(l,n){C(e,l,n),t=!0},p(l,n){const a={};n&32&&(a.label=l[5]),n&64&&(a.disable=typeof l[6].container=="boolean"&&!l[6].container),e.$set(a)},i(l){t||(g(e.$$.fragment,l),t=!0)},o(l){w(e.$$.fragment,l),t=!1},d(l){E(e,l)}}}function ce(s){let e,t;return e=new ne({props:{$$slots:{default:[re]},$$scope:{ctx:s}}}),{c(){B(e.$$.fragment)},m(l,n){C(e,l,n),t=!0},p(l,n){const a={};n&16384&&(a.$$scope={dirty:n,ctx:l}),e.$set(a)},i(l){t||(g(e.$$.fragment,l),t=!0)},o(l){w(e.$$.fragment,l),t=!1},d(l){E(e,l)}}}function fe(s){let e,t;return e=new oe({props:{selectable:s[9],value:s[4],show_label:s[8],color:s[3]}}),e.$on("select",s[12]),{c(){B(e.$$.fragment)},m(l,n){C(e,l,n),t=!0},p(l,n){const a={};n&512&&(a.selectable=l[9]),n&16&&(a.value=l[4]),n&256&&(a.show_label=l[8]),n&8&&(a.color=l[3]),e.$set(a)},i(l){t||(g(e.$$.fragment,l),t=!0)},o(l){w(e.$$.fragment,l),t=!1},d(l){E(e,l)}}}function re(s){let e,t;return e=new P({}),{c(){B(e.$$.fragment)},m(l,n){C(e,l,n),t=!0},i(l){t||(g(e.$$.fragment,l),t=!0)},o(l){w(e.$$.fragment,l),t=!1},d(l){E(e,l)}}}function ue(s){let e,t,l,n,a,i,o;const f=[s[7]];let _={};for(let c=0;c{r=null}),F());let u=n;n=m(c),n===u?v[n].p(c,b):(z(),w(v[u],1,1,()=>{v[u]=null}),F(),a=v[n],a?a.p(c,b):(a=v[n]=L[n](c),a.c()),g(a,1),a.m(i.parentNode,i))},i(c){o||(g(e.$$.fragment,c),g(r),g(a),o=!0)},o(c){w(e.$$.fragment,c),w(r),w(a),o=!1},d(c){E(e,c),c&&y(t),r&&r.d(c),c&&y(l),v[n].d(c),c&&y(i)}}}function _e(s){let e,t;return e=new le({props:{test_id:"label",visible:s[2],elem_id:s[0],elem_classes:s[1],disable:typeof s[6].container=="boolean"&&!s[6].container,$$slots:{default:[ue]},$$scope:{ctx:s}}}),{c(){B(e.$$.fragment)},m(l,n){C(e,l,n),t=!0},p(l,[n]){const a={};n&4&&(a.visible=l[2]),n&1&&(a.elem_id=l[0]),n&2&&(a.elem_classes=l[1]),n&64&&(a.disable=typeof l[6].container=="boolean"&&!l[6].container),n&17400&&(a.$$scope={dirty:n,ctx:l}),e.$set(a)},i(l){t||(g(e.$$.fragment,l),t=!0)},o(l){w(e.$$.fragment,l),t=!1},d(l){E(e,l)}}}function be(s,e,t){let l,n,{elem_id:a=""}=e,{elem_classes:i=[]}=e,{visible:o=!0}=e,{color:f=void 0}=e,{value:_={}}=e,{label:r="Label"}=e,{style:L={}}=e,{loading_status:v}=e,{show_label:m}=e,{selectable:c=!1}=e;const b=T();function k(u){ee.call(this,s,u)}return s.$$set=u=>{"elem_id"in u&&t(0,a=u.elem_id),"elem_classes"in u&&t(1,i=u.elem_classes),"visible"in u&&t(2,o=u.visible),"color"in u&&t(3,f=u.color),"value"in u&&t(4,_=u.value),"label"in u&&t(5,r=u.label),"style"in u&&t(6,L=u.style),"loading_status"in u&&t(7,v=u.loading_status),"show_label"in u&&t(8,m=u.show_label),"selectable"in u&&t(9,c=u.selectable)},s.$$.update=()=>{s.$$.dirty&16&&t(10,{confidences:l,label:n}=_,l,(t(11,n),t(4,_))),s.$$.dirty&3072&&b("change")},[a,i,o,f,_,r,L,v,m,c,l,n,k]}class me extends q{constructor(e){super(),A(this,e,be,_e,D,{elem_id:0,elem_classes:1,visible:2,color:3,value:4,label:5,style:6,loading_status:7,show_label:8,selectable:9})}}const we=me,pe=["static"],ye=s=>({type:{payload:"{ label: string; confidences?: Array<{ label: string; confidence: number }>"},description:{payload:"output label and optional set of confidences per label"}});export{we as Component,ye as document,pe as modes}; -//# sourceMappingURL=index-30198ab0.js.map diff --git a/spaces/wu981526092/Optimal_Cluster_Analysis_with_PCA_Visualization/kmeans.py b/spaces/wu981526092/Optimal_Cluster_Analysis_with_PCA_Visualization/kmeans.py deleted file mode 100644 index fe689f7219c559e181fb695414179d947a793f16..0000000000000000000000000000000000000000 --- a/spaces/wu981526092/Optimal_Cluster_Analysis_with_PCA_Visualization/kmeans.py +++ /dev/null @@ -1,40 +0,0 @@ -from matplotlib import pyplot as plt -from sklearn.cluster import KMeans -from sklearn.metrics import silhouette_score - - -def calculate_wcss(data): - wcss = [] - for i in range(1, 11): - kmeans = KMeans(n_clusters=i, init='k-means++', max_iter=300, n_init=10, random_state=0) - kmeans.fit(data) - wcss.append(kmeans.inertia_) - return wcss - -def calculate_silhouette_scores(data): - scores = [] - range_values = range(2, 11) - for i in range_values: - kmeans = KMeans(n_clusters=i, init='k-means++', max_iter=300, n_init=10, random_state=0) - kmeans.fit(data) - score = silhouette_score(data, kmeans.labels_, metric='euclidean') - scores.append(score) - return scores - -def plot_elbow(wcss): - plt.plot(range(1, 11), wcss) - plt.title('Elbow Method') - plt.xlabel('Number of clusters') - plt.ylabel('WCSS') - plt.show() - -def get_optimal_clusters_silhouette(scores): - optimal_clusters = scores.index(max(scores)) + 2 # +2 because range_values starts from 2 - print(f"Optimal number of clusters: {optimal_clusters}") - return optimal_clusters - -def fit_kmeans(data, n_clusters): - kmeans = KMeans(n_clusters=n_clusters, random_state=0) - clusters = kmeans.fit_predict(data) - data['cluster'] = clusters - return kmeans, data \ No newline at end of file diff --git a/spaces/wuhuik/bingo/src/components/chat-attachments.tsx b/spaces/wuhuik/bingo/src/components/chat-attachments.tsx deleted file mode 100644 index ef43d4e262935d263b6099138c56f7daade5299d..0000000000000000000000000000000000000000 --- a/spaces/wuhuik/bingo/src/components/chat-attachments.tsx +++ /dev/null @@ -1,37 +0,0 @@ -import Image from 'next/image' -import ClearIcon from '@/assets/images/clear.svg' -import RefreshIcon from '@/assets/images/refresh.svg' -import { FileItem } from '@/lib/bots/bing/types' -import { cn } from '@/lib/utils' -import { useBing } from '@/lib/hooks/use-bing' - -type ChatAttachmentsProps = Pick, 'attachmentList' | 'setAttachmentList' | 'uploadImage'> - -export function ChatAttachments({ attachmentList = [], setAttachmentList, uploadImage }: ChatAttachmentsProps) { - return attachmentList.length ? ( -
          - {attachmentList.map(file => ( -
          - {file.status === 'loading' && ( -
          -
          -
          ) - } - {file.status !== 'error' && ( -
          - -
          ) - } - {file.status === 'error' && ( -
          - refresh uploadImage(file.url)} /> -
          - )} - -
          - ))} -
          - ) : null -} diff --git a/spaces/wwwwwwww2/bingo/src/app/loading.css b/spaces/wwwwwwww2/bingo/src/app/loading.css deleted file mode 100644 index eaaab6a86a228334c4eca3c5368ae6f0f593d405..0000000000000000000000000000000000000000 --- a/spaces/wwwwwwww2/bingo/src/app/loading.css +++ /dev/null @@ -1,68 +0,0 @@ -::-webkit-scrollbar { - width: 10px; - height: 10px; - display: none; -} - -::-webkit-scrollbar-button:start:decrement, -::-webkit-scrollbar-button:end:increment { - height: 30px; - background-color: transparent; -} - -::-webkit-scrollbar-track-piece { - background-color: #3b3b3b; - -webkit-border-radius: 16px; -} - -::-webkit-scrollbar-thumb:vertical { - height: 50px; - background-color: #666; - border: 1px solid #eee; - -webkit-border-radius: 6px; -} - -/* loading start */ -.loading-spinner { - display: flex; - justify-content: center; - align-items: center; - height: 100vh; - opacity: 1; - transition: opacity .8s ease-out; -} - -.loading-spinner.hidden { - opacity: 0; -} - -.loading-spinner>div { - width: 30px; - height: 30px; - background: linear-gradient(90deg, #2870EA 10.79%, #1B4AEF 87.08%); - - border-radius: 100%; - display: inline-block; - animation: sk-bouncedelay 1.4s infinite ease-in-out both; -} - -.loading-spinner .bounce1 { - animation-delay: -0.32s; -} - -.loading-spinner .bounce2 { - animation-delay: -0.16s; -} - -@keyframes sk-bouncedelay { - - 0%, - 80%, - 100% { - transform: scale(0); - } - - 40% { - transform: scale(1.0); - } -} diff --git a/spaces/wwwwwwww2/bingo/src/components/ui/input.tsx b/spaces/wwwwwwww2/bingo/src/components/ui/input.tsx deleted file mode 100644 index 684a857f3d769b78818fb13de1abaebfb09ca79c..0000000000000000000000000000000000000000 --- a/spaces/wwwwwwww2/bingo/src/components/ui/input.tsx +++ /dev/null @@ -1,25 +0,0 @@ -import * as React from 'react' - -import { cn } from '@/lib/utils' - -export interface InputProps - extends React.InputHTMLAttributes {} - -const Input = React.forwardRef( - ({ className, type, ...props }, ref) => { - return ( - - ) - } -) -Input.displayName = 'Input' - -export { Input } diff --git a/spaces/xnetba/MMS/uroman/README.md b/spaces/xnetba/MMS/uroman/README.md deleted file mode 100644 index 6a0a40f6d4ebda9041d23efe0345340b7da9d4b8..0000000000000000000000000000000000000000 --- a/spaces/xnetba/MMS/uroman/README.md +++ /dev/null @@ -1,165 +0,0 @@ -# uroman - -*uroman* is a *universal romanizer*. It converts text in any script to the Latin alphabet. - -Version: 1.2.8 -Release date: April 23, 2021 -Author: Ulf Hermjakob, USC Information Sciences Institute - - -### Usage -```bash -$ uroman.pl [-l ] [--chart] [--no-cache] < STDIN - where the optional is a 3-letter languages code, e.g. ara, bel, bul, deu, ell, eng, fas, - grc, ell, eng, heb, kaz, kir, lav, lit, mkd, mkd2, oss, pnt, pus, rus, srp, srp2, tur, uig, ukr, yid. - --chart specifies chart output (in JSON format) to represent alternative romanizations. - --no-cache disables caching. -``` -### Examples -```bash -$ bin/uroman.pl < text/zho.txt -$ bin/uroman.pl -l tur < text/tur.txt -$ bin/uroman.pl -l heb --chart < text/heb.txt -$ bin/uroman.pl < test/multi-script.txt > test/multi-script.uroman.txt -``` - -Identifying the input as Arabic, Belarusian, Bulgarian, English, Farsi, German, -Ancient Greek, Modern Greek, Pontic Greek, Hebrew, Kazakh, Kyrgyz, Latvian, -Lithuanian, North Macedonian, Russian, Serbian, Turkish, Ukrainian, Uyghur or -Yiddish will improve romanization for those languages as some letters in those -languages have different sound values from other languages using the same script -(French, Russian, Hebrew respectively). -No effect for other languages in this version. - -### Bibliography -Ulf Hermjakob, Jonathan May, and Kevin Knight. 2018. Out-of-the-box universal romanization tool uroman. In Proceedings of the 56th Annual Meeting of Association for Computational Linguistics, Demo Track. ACL-2018 Best Demo Paper Award. [Paper in ACL Anthology](https://www.aclweb.org/anthology/P18-4003) | [Poster](https://www.isi.edu/~ulf/papers/poster-uroman-acl2018.pdf) | [BibTex](https://www.aclweb.org/anthology/P18-4003.bib) - -### Change History -Changes in version 1.2.8 - * Updated to Unicode 13.0 (2021), which supports several new scripts (10% larger UnicodeData.txt). - * Improved support for Georgian. - * Preserve various symbols (as opposed to mapping to the symbols' names). - * Various small improvements. - -Changes in version 1.2.7 - * Improved support for Pashto. - -Changes in version 1.2.6 - * Improved support for Ukrainian, Russian and Ogham (ancient Irish script). - * Added support for English Braille. - * Added alternative Romanization for North Macedonian and Serbian (mkd2/srp2) - reflecting a casual style that many native speakers of those languages use - when writing text in Latin script, e.g. non-accented single letters (e.g. "s") - rather than phonetically motivated combinations of letters (e.g. "sh"). - * When a line starts with "::lcode xyz ", the new uroman version will switch to - that language for that line. This is used for the new reference test file. - * Various small improvements. - -Changes in version 1.2.5 - * Improved support for Armenian and eight languages using Cyrillic scripts. - -- For Serbian and Macedonian, which are often written in both Cyrillic - and Latin scripts, uroman will map both official versions to the same - romanized text, e.g. both "Ниш" and "Niš" will be mapped to "Nish" (which - properly reflects the pronunciation of the city's name). - For both Serbian and Macedonian, casual writers often use a simplified - Latin form without diacritics, e.g. "s" to represent not only Cyrillic "с" - and Latin "s", but also "ш" or "š", even if this conflates "s" and "sh" and - other such pairs. The casual romanization can be simulated by using - alternative uroman language codes "srp2" and "mkd2", which romanize - both "Ниш" and "Niš" to "Nis" to reflect the casual Latin spelling. - * Various small improvements. - -Changes in version 1.2.4 - * Bug-fix that generated two emtpy lines for each empty line in cache mode. - -Changes in version 1.2 - * Run-time improvement based on (1) token-based caching and (2) shortcut - romanization (identity) of ASCII strings for default 1-best (non-chart) - output. Speed-up by a factor of 10 for Bengali and Uyghur on medium and - large size texts. - * Incremental improvements for Farsi, Amharic, Russian, Hebrew and related - languages. - * Richer lattice structure (more alternatives) for "Romanization" of English - to support better matching to romanizations of other languages. - Changes output only when --chart option is specified. No change in output for - default 1-best output, which for ASCII characters is always the input string. - -Changes in version 1.1 (major upgrade) - * Offers chart output (in JSON format) to represent alternative romanizations. - -- Location of first character is defined to be "line: 1, start:0, end:0". - * Incremental improvements of Hebrew and Greek romanization; Chinese numbers. - * Improved web-interface at http://www.isi.edu/~ulf/uroman.html - -- Shows corresponding original and romanization text in red - when hovering over a text segment. - -- Shows alternative romanizations when hovering over romanized text - marked by dotted underline. - -- Added right-to-left script detection and improved display for right-to-left - script text (as determined line by line). - -- On-page support for some scripts that are often not pre-installed on users' - computers (Burmese, Egyptian, Klingon). - -Changes in version 1.0 (major upgrade) - * Upgraded principal internal data structure from string to lattice. - * Improvements mostly in vowelization of South and Southeast Asian languages. - * Vocalic 'r' more consistently treated as vowel (no additional vowel added). - * Repetition signs (Japanese/Chinese/Thai/Khmer/Lao) are mapped to superscript 2. - * Japanese Katakana middle dots now mapped to ASCII space. - * Tibetan intersyllabic mark now mapped to middle dot (U+00B7). - * Some corrections regarding analysis of Chinese numbers. - * Many more foreign diacritics and punctuation marks dropped or mapped to ASCII. - * Zero-width characters dropped, except line/sentence-initial byte order marks. - * Spaces normalized to ASCII space. - * Fixed bug that in some cases mapped signs (such as dagger or bullet) to their verbal descriptions. - * Tested against previous version of uroman with a new uroman visual diff tool. - * Almost an order of magnitude faster. - -Changes in version 0.7 (minor upgrade) - * Added script uroman-quick.pl for Arabic script languages, incl. Uyghur. - Much faster, pre-caching mapping of Arabic to Latin characters, simple greedy processing. - Will not convert material from non-Arabic blocks such as any (somewhat unusual) Cyrillic - or Chinese characters in Uyghur texts. - -Changes in version 0.6 (minor upgrade) - * Added support for two letter characters used in Uzbek: - (1) character "ʻ" ("modifier letter turned comma", which modifies preceding "g" and "u" letters) - (2) character "ʼ" ("modifier letter apostrophe", which Uzbek uses to mark a glottal stop). - Both are now mapped to "'" (plain ASCII apostrophe). - * Added support for Uyghur vowel characters such as "ې" (Arabic e) and "ۆ" (Arabic oe) - even when they are not preceded by "ئ" (yeh with hamza above). - * Added support for Arabic semicolon "؛", Arabic ligature forms for phrases such as "ﷺ" - ("sallallahou alayhe wasallam" = "prayer of God be upon him and his family and peace") - * Added robustness for Arabic letter presentation forms (initial/medial/final/isolated). - However, it is strongly recommended to normalize any presentation form Arabic letters - to their non-presentation form before calling uroman. - * Added force flush directive ($|=1;). - -Changes in version 0.5 (minor upgrade) - * Improvements for Uyghur (make sure to use language option: -l uig) - -Changes in version 0.4 (minor upgrade) - * Improvements for Thai (special cases for vowel/consonant reordering, e.g. for "sara o"; dropped some aspiration 'h's) - * Minor change for Arabic (added "alef+fathatan" = "an") - -New features in version 0.3 - * Covers Mandarin (Chinese) - * Improved romanization for numerous languages - * Preserves capitalization (e.g. from Latin, Cyrillic, Greek scripts) - * Maps from native digits to Western numbers - * Faster for South Asian languages - -### Other features - * Web interface: http://www.isi.edu/~ulf/uroman.html - * Vowelization is provided when locally computable, e.g. for many South Asian languages and Tibetan. - -### Limitations - * The current version of uroman has a few limitations, some of which we plan to address in future versions. - For Japanese, *uroman* currently romanizes hiragana and katakana as expected, but kanji are interpreted as Chinese characters and romanized as such. - For Egyptian hieroglyphs, only single-sound phonetic characters and numbers are currently romanized. - For Linear B, only phonetic syllabic characters are romanized. - For some other extinct scripts such as cuneiform, no romanization is provided. - * A romanizer is not a full transliterator. For example, this version of - uroman does not vowelize text that lacks explicit vowelization such as - normal text in Arabic and Hebrew (without diacritics/points). - -### Acknowledgments -This research is based upon work supported in part by the Office of the Director of National Intelligence (ODNI), Intelligence Advanced Research Projects Activity (IARPA), via contract # FA8650-17-C-9116, and by research sponsored by Air Force Research Laboratory (AFRL) under agreement number FA8750-19-1-1000. The views and conclusions contained herein are those of the authors and should not be interpreted as necessarily representing the official policies, either expressed or implied, of ODNI, IARPA, Air Force Laboratory, DARPA, or the U.S. Government. The U.S. Government is authorized to reproduce and distribute reprints for governmental purposes notwithstanding any copyright annotation therein. diff --git a/spaces/xuxw98/TAPA/howto/convert_lora_weights.md b/spaces/xuxw98/TAPA/howto/convert_lora_weights.md deleted file mode 100644 index 3037c10d0dae9cc1a598199d6f1fdb55f2d94795..0000000000000000000000000000000000000000 --- a/spaces/xuxw98/TAPA/howto/convert_lora_weights.md +++ /dev/null @@ -1,19 +0,0 @@ -# Merging LoRA weights into base model weights - -Purpose: By merging our selected LoRA weights into the base model weights, we can benefit from all base model optimisation such as quantisation (available in this repo), pruning, caching, etc. - - -## How to run? - -After you have finish finetuning using LoRA, select your weight and run the converter script: - -```bash -python scripts/convert_lora_weights.py --lora_path out/lora/your-folder/your-weight-name.pth -``` - -The converted base weight file will be saved into the same folder with the name `{your-weight-name}-lora-merged-weights.pth`. Now you can run `generate.py` with the merged weights and apply quantisation: - -```bash -python generate.py --checkpoint_path out/lora/your-folder/your-weight-name-lora-merged-weights.pth --quantize llm.int8 -``` - diff --git a/spaces/yaoshining/text-generation-webui/modules/text_generation.py b/spaces/yaoshining/text-generation-webui/modules/text_generation.py deleted file mode 100644 index 171da53f98d7b811fefcf1fe4acea7b8a080462b..0000000000000000000000000000000000000000 --- a/spaces/yaoshining/text-generation-webui/modules/text_generation.py +++ /dev/null @@ -1,396 +0,0 @@ -import ast -import copy -import random -import re -import time -import traceback - -import numpy as np -import torch -import transformers - -import modules.shared as shared -from modules.callbacks import ( - Iteratorize, - Stream, - _StopEverythingStoppingCriteria -) -from modules.extensions import apply_extensions -from modules.html_generator import generate_4chan_html, generate_basic_html -from modules.logging_colors import logger -from modules.models import clear_torch_cache, local_rank - - -def generate_reply(*args, **kwargs): - shared.generation_lock.acquire() - try: - for result in _generate_reply(*args, **kwargs): - yield result - finally: - shared.generation_lock.release() - - -def get_max_prompt_length(state): - return state['truncation_length'] - state['max_new_tokens'] - - -def encode(prompt, add_special_tokens=True, add_bos_token=True, truncation_length=None): - if shared.model.__class__.__name__ in ['LlamaCppModel', 'RWKVModel']: - input_ids = shared.tokenizer.encode(str(prompt)) - input_ids = np.array(input_ids).reshape(1, len(input_ids)) - return input_ids - else: - input_ids = shared.tokenizer.encode(str(prompt), return_tensors='pt', add_special_tokens=add_special_tokens) - - # This is a hack for making replies more creative. - if not add_bos_token and input_ids[0][0] == shared.tokenizer.bos_token_id: - input_ids = input_ids[:, 1:] - - # Handling truncation - if truncation_length is not None: - input_ids = input_ids[:, -truncation_length:] - - if shared.model.__class__.__name__ in ['LlamaCppModel', 'RWKVModel', 'ExllamaModel'] or shared.args.cpu: - return input_ids - elif shared.args.flexgen: - return input_ids.numpy() - elif shared.args.deepspeed: - return input_ids.to(device=local_rank) - elif torch.has_mps: - device = torch.device('mps') - return input_ids.to(device) - else: - return input_ids.cuda() - - -def get_encoded_length(prompt): - length_after_extensions = apply_extensions('tokenized_length', prompt) - if length_after_extensions is not None: - return length_after_extensions - - return len(encode(prompt)[0]) - - -def decode(output_ids, skip_special_tokens=True): - return shared.tokenizer.decode(output_ids, skip_special_tokens) - - -# Removes empty replies from gpt4chan outputs -def fix_gpt4chan(s): - for i in range(10): - s = re.sub("--- [0-9]*\n>>[0-9]*\n---", "---", s) - s = re.sub("--- [0-9]*\n *\n---", "---", s) - s = re.sub("--- [0-9]*\n\n\n---", "---", s) - - return s - - -# Fix the LaTeX equations in galactica -def fix_galactica(s): - s = s.replace(r'\[', r'$') - s = s.replace(r'\]', r'$') - s = s.replace(r'\(', r'$') - s = s.replace(r'\)', r'$') - s = s.replace(r'$$', r'$') - s = re.sub(r'\n', r'\n\n', s) - s = re.sub(r"\n{3,}", "\n\n", s) - return s - - -def get_reply_from_output_ids(output_ids, input_ids, original_question, state, is_chat=False): - if shared.is_seq2seq: - reply = decode(output_ids, state['skip_special_tokens']) - else: - new_tokens = len(output_ids) - len(input_ids[0]) - reply = decode(output_ids[-new_tokens:], state['skip_special_tokens']) - # Prevent LlamaTokenizer from skipping a space - if type(shared.tokenizer) in [transformers.LlamaTokenizer, transformers.LlamaTokenizerFast] and len(output_ids) > 0: - if shared.tokenizer.convert_ids_to_tokens(int(output_ids[-new_tokens])).startswith('▁'): - reply = ' ' + reply - - return reply - - -def formatted_outputs(reply, model_name): - if any(s in model_name for s in ['gpt-4chan', 'gpt4chan']): - reply = fix_gpt4chan(reply) - return reply, generate_4chan_html(reply) - else: - return reply, generate_basic_html(reply) - - -def set_manual_seed(seed): - seed = int(seed) - if seed == -1: - seed = random.randint(1, 2**31) - - torch.manual_seed(seed) - if torch.cuda.is_available(): - torch.cuda.manual_seed_all(seed) - - return seed - - -def stop_everything_event(): - shared.stop_everything = True - - -def generate_reply_wrapper(question, state, stopping_strings=None): - reply = question if not shared.is_seq2seq else '' - yield formatted_outputs(reply, shared.model_name) - - for reply in generate_reply(question, state, stopping_strings, is_chat=False): - if not shared.is_seq2seq: - reply = question + reply - - yield formatted_outputs(reply, shared.model_name) - - -def apply_stopping_strings(reply, all_stop_strings): - stop_found = False - for string in all_stop_strings: - idx = reply.find(string) - if idx != -1: - reply = reply[:idx] - stop_found = True - break - - if not stop_found: - # If something like "\nYo" is generated just before "\nYou:" - # is completed, trim it - for string in all_stop_strings: - for j in range(len(string) - 1, 0, -1): - if reply[-j:] == string[:j]: - reply = reply[:-j] - break - else: - continue - - break - - return reply, stop_found - - -def _generate_reply(question, state, stopping_strings=None, is_chat=False): - generate_func = apply_extensions('custom_generate_reply') - if generate_func is None: - if shared.model_name == 'None' or shared.model is None: - logger.error("No model is loaded! Select one in the Model tab.") - yield '' - return - - if shared.model.__class__.__name__ in ['LlamaCppModel', 'RWKVModel', 'ExllamaModel']: - generate_func = generate_reply_custom - elif shared.args.flexgen: - generate_func = generate_reply_flexgen - else: - generate_func = generate_reply_HF - - # Preparing the input - original_question = question - if not is_chat: - state = apply_extensions('state', state) - question = apply_extensions('input', question) - - # Finding the stopping strings - all_stop_strings = [] - for st in (stopping_strings, ast.literal_eval(f"[{state['custom_stopping_strings']}]")): - if type(st) is list and len(st) > 0: - all_stop_strings += st - - if shared.args.verbose: - print(f'\n\n{question}\n--------------------\n') - - shared.stop_everything = False - clear_torch_cache() - seed = set_manual_seed(state['seed']) - last_update = -1 - reply = '' - is_stream = state['stream'] - if len(all_stop_strings) > 0 and not state['stream']: - state = copy.deepcopy(state) - state['stream'] = True - - for reply in generate_func(question, original_question, seed, state, stopping_strings, is_chat=is_chat): - reply, stop_found = apply_stopping_strings(reply, all_stop_strings) - if is_stream: - cur_time = time.time() - if cur_time - last_update > 0.041666666666666664: # Limit streaming to 24 fps - last_update = cur_time - yield reply - - if stop_found: - break - - if not is_chat: - reply = apply_extensions('output', reply) - - yield reply - - -def generate_reply_HF(question, original_question, seed, state, stopping_strings=None, is_chat=False): - generate_params = {} - for k in ['max_new_tokens', 'do_sample', 'temperature', 'top_p', 'typical_p', 'repetition_penalty', 'repetition_penalty_range', 'encoder_repetition_penalty', 'top_k', 'min_length', 'no_repeat_ngram_size', 'num_beams', 'penalty_alpha', 'length_penalty', 'early_stopping', 'tfs', 'top_a', 'mirostat_mode', 'mirostat_tau', 'mirostat_eta']: - generate_params[k] = state[k] - - for k in ['epsilon_cutoff', 'eta_cutoff']: - if state[k] > 0: - generate_params[k] = state[k] * 1e-4 - - if state['ban_eos_token']: - generate_params['suppress_tokens'] = [shared.tokenizer.eos_token_id] - - if shared.args.no_cache: - generate_params.update({'use_cache': False}) - - if shared.args.deepspeed: - generate_params.update({'synced_gpus': True}) - - # Encode the input - input_ids = encode(question, add_bos_token=state['add_bos_token'], truncation_length=get_max_prompt_length(state)) - output = input_ids[0] - cuda = not any((shared.args.cpu, shared.args.deepspeed)) - - # Add the encoded tokens to generate_params - question, input_ids, inputs_embeds = apply_extensions('tokenizer', state, question, input_ids, None) - original_input_ids = input_ids - generate_params.update({'inputs': input_ids}) - if inputs_embeds is not None: - generate_params.update({'inputs_embeds': inputs_embeds}) - - # Stopping criteria / eos token - eos_token_ids = [shared.tokenizer.eos_token_id] if shared.tokenizer.eos_token_id is not None else [] - generate_params['eos_token_id'] = eos_token_ids - generate_params['stopping_criteria'] = transformers.StoppingCriteriaList() - generate_params['stopping_criteria'].append(_StopEverythingStoppingCriteria()); - - t0 = time.time() - try: - if not is_chat and not shared.is_seq2seq: - yield '' - - # Generate the entire reply at once. - if not state['stream']: - with torch.no_grad(): - output = shared.model.generate(**generate_params)[0] - if cuda: - output = output.cuda() - - yield get_reply_from_output_ids(output, input_ids, original_question, state, is_chat=is_chat) - - # Stream the reply 1 token at a time. - # This is based on the trick of using 'stopping_criteria' to create an iterator. - else: - - def generate_with_callback(callback=None, *args, **kwargs): - kwargs['stopping_criteria'].append(Stream(callback_func=callback)) - clear_torch_cache() - with torch.no_grad(): - shared.model.generate(**kwargs) - - def generate_with_streaming(**kwargs): - return Iteratorize(generate_with_callback, [], kwargs, callback=None) - - with generate_with_streaming(**generate_params) as generator: - for output in generator: - yield get_reply_from_output_ids(output, input_ids, original_question, state, is_chat=is_chat) - if output[-1] in eos_token_ids: - break - - except Exception: - traceback.print_exc() - finally: - t1 = time.time() - original_tokens = len(original_input_ids[0]) - new_tokens = len(output) - (original_tokens if not shared.is_seq2seq else 0) - print(f'Output generated in {(t1-t0):.2f} seconds ({new_tokens/(t1-t0):.2f} tokens/s, {new_tokens} tokens, context {original_tokens}, seed {seed})') - return - - -def generate_reply_custom(question, original_question, seed, state, stopping_strings=None, is_chat=False): - seed = set_manual_seed(state['seed']) - - t0 = time.time() - reply = '' - try: - if not is_chat: - yield '' - - if not state['stream']: - reply = shared.model.generate(question, state) - yield reply - else: - for reply in shared.model.generate_with_streaming(question, state): - yield reply - - except Exception: - traceback.print_exc() - finally: - t1 = time.time() - original_tokens = len(encode(original_question)[0]) - new_tokens = len(encode(original_question + reply)[0]) - original_tokens - print(f'Output generated in {(t1-t0):.2f} seconds ({new_tokens/(t1-t0):.2f} tokens/s, {new_tokens} tokens, context {original_tokens}, seed {seed})') - return - - -def generate_reply_flexgen(question, original_question, seed, state, stopping_strings=None, is_chat=False): - generate_params = {} - for k in ['max_new_tokens', 'do_sample', 'temperature']: - generate_params[k] = state[k] - - if state['stream']: - generate_params['max_new_tokens'] = 8 - - # Encode the input - input_ids = encode(question, add_bos_token=state['add_bos_token'], truncation_length=get_max_prompt_length(state)) - output = input_ids[0] - - # Find the eos tokens - eos_token_ids = [shared.tokenizer.eos_token_id] if shared.tokenizer.eos_token_id is not None else [] - if not state['ban_eos_token']: - generate_params['stop'] = eos_token_ids[-1] - - # Add the encoded tokens to generate_params - question, input_ids, inputs_embeds = apply_extensions('tokenizer', state, question, input_ids, None) - original_input_ids = input_ids - generate_params.update({'inputs': input_ids}) - if inputs_embeds is not None: - generate_params.update({'inputs_embeds': inputs_embeds}) - - t0 = time.time() - try: - if not is_chat: - yield '' - - # Generate the entire reply at once. - if not state['stream']: - with torch.no_grad(): - output = shared.model.generate(**generate_params)[0] - - yield get_reply_from_output_ids(output, input_ids, original_question, state, is_chat=is_chat) - - # Stream the output naively for FlexGen since it doesn't support 'stopping_criteria' - else: - for i in range(state['max_new_tokens'] // 8 + 1): - if shared.stop_everything: - break - - clear_torch_cache() - with torch.no_grad(): - output = shared.model.generate(**generate_params)[0] - - if np.count_nonzero(np.isin(input_ids[0], eos_token_ids)) < np.count_nonzero(np.isin(output, eos_token_ids)): - break - - yield get_reply_from_output_ids(output, original_input_ids, original_question, state) - input_ids = np.reshape(output, (1, output.shape[0])) - generate_params.update({'inputs': input_ids}) - - except Exception: - traceback.print_exc() - finally: - t1 = time.time() - original_tokens = len(original_input_ids[0]) - new_tokens = len(output) - (original_tokens if not shared.is_seq2seq else 0) - print(f'Output generated in {(t1-t0):.2f} seconds ({new_tokens/(t1-t0):.2f} tokens/s, {new_tokens} tokens, context {original_tokens}, seed {seed})') - return diff --git a/spaces/yderre-aubay/midi-player-demo/public/community.html b/spaces/yderre-aubay/midi-player-demo/public/community.html deleted file mode 100644 index 9cd352d3c2ca2f6a9e298c967bcd61a7254e9339..0000000000000000000000000000000000000000 --- a/spaces/yderre-aubay/midi-player-demo/public/community.html +++ /dev/null @@ -1,62 +0,0 @@ - - - - - - - - - - - - - - - - signal - Online MIDI Editor - - - - - - - - - - - -
          - - diff --git a/spaces/ygangang/CodeFormer/CodeFormer/facelib/detection/retinaface/retinaface_net.py b/spaces/ygangang/CodeFormer/CodeFormer/facelib/detection/retinaface/retinaface_net.py deleted file mode 100644 index ab6aa82d3e9055a838f1f9076b12f05fdfc154d0..0000000000000000000000000000000000000000 --- a/spaces/ygangang/CodeFormer/CodeFormer/facelib/detection/retinaface/retinaface_net.py +++ /dev/null @@ -1,196 +0,0 @@ -import torch -import torch.nn as nn -import torch.nn.functional as F - - -def conv_bn(inp, oup, stride=1, leaky=0): - return nn.Sequential( - nn.Conv2d(inp, oup, 3, stride, 1, bias=False), nn.BatchNorm2d(oup), - nn.LeakyReLU(negative_slope=leaky, inplace=True)) - - -def conv_bn_no_relu(inp, oup, stride): - return nn.Sequential( - nn.Conv2d(inp, oup, 3, stride, 1, bias=False), - nn.BatchNorm2d(oup), - ) - - -def conv_bn1X1(inp, oup, stride, leaky=0): - return nn.Sequential( - nn.Conv2d(inp, oup, 1, stride, padding=0, bias=False), nn.BatchNorm2d(oup), - nn.LeakyReLU(negative_slope=leaky, inplace=True)) - - -def conv_dw(inp, oup, stride, leaky=0.1): - return nn.Sequential( - nn.Conv2d(inp, inp, 3, stride, 1, groups=inp, bias=False), - nn.BatchNorm2d(inp), - nn.LeakyReLU(negative_slope=leaky, inplace=True), - nn.Conv2d(inp, oup, 1, 1, 0, bias=False), - nn.BatchNorm2d(oup), - nn.LeakyReLU(negative_slope=leaky, inplace=True), - ) - - -class SSH(nn.Module): - - def __init__(self, in_channel, out_channel): - super(SSH, self).__init__() - assert out_channel % 4 == 0 - leaky = 0 - if (out_channel <= 64): - leaky = 0.1 - self.conv3X3 = conv_bn_no_relu(in_channel, out_channel // 2, stride=1) - - self.conv5X5_1 = conv_bn(in_channel, out_channel // 4, stride=1, leaky=leaky) - self.conv5X5_2 = conv_bn_no_relu(out_channel // 4, out_channel // 4, stride=1) - - self.conv7X7_2 = conv_bn(out_channel // 4, out_channel // 4, stride=1, leaky=leaky) - self.conv7x7_3 = conv_bn_no_relu(out_channel // 4, out_channel // 4, stride=1) - - def forward(self, input): - conv3X3 = self.conv3X3(input) - - conv5X5_1 = self.conv5X5_1(input) - conv5X5 = self.conv5X5_2(conv5X5_1) - - conv7X7_2 = self.conv7X7_2(conv5X5_1) - conv7X7 = self.conv7x7_3(conv7X7_2) - - out = torch.cat([conv3X3, conv5X5, conv7X7], dim=1) - out = F.relu(out) - return out - - -class FPN(nn.Module): - - def __init__(self, in_channels_list, out_channels): - super(FPN, self).__init__() - leaky = 0 - if (out_channels <= 64): - leaky = 0.1 - self.output1 = conv_bn1X1(in_channels_list[0], out_channels, stride=1, leaky=leaky) - self.output2 = conv_bn1X1(in_channels_list[1], out_channels, stride=1, leaky=leaky) - self.output3 = conv_bn1X1(in_channels_list[2], out_channels, stride=1, leaky=leaky) - - self.merge1 = conv_bn(out_channels, out_channels, leaky=leaky) - self.merge2 = conv_bn(out_channels, out_channels, leaky=leaky) - - def forward(self, input): - # names = list(input.keys()) - # input = list(input.values()) - - output1 = self.output1(input[0]) - output2 = self.output2(input[1]) - output3 = self.output3(input[2]) - - up3 = F.interpolate(output3, size=[output2.size(2), output2.size(3)], mode='nearest') - output2 = output2 + up3 - output2 = self.merge2(output2) - - up2 = F.interpolate(output2, size=[output1.size(2), output1.size(3)], mode='nearest') - output1 = output1 + up2 - output1 = self.merge1(output1) - - out = [output1, output2, output3] - return out - - -class MobileNetV1(nn.Module): - - def __init__(self): - super(MobileNetV1, self).__init__() - self.stage1 = nn.Sequential( - conv_bn(3, 8, 2, leaky=0.1), # 3 - conv_dw(8, 16, 1), # 7 - conv_dw(16, 32, 2), # 11 - conv_dw(32, 32, 1), # 19 - conv_dw(32, 64, 2), # 27 - conv_dw(64, 64, 1), # 43 - ) - self.stage2 = nn.Sequential( - conv_dw(64, 128, 2), # 43 + 16 = 59 - conv_dw(128, 128, 1), # 59 + 32 = 91 - conv_dw(128, 128, 1), # 91 + 32 = 123 - conv_dw(128, 128, 1), # 123 + 32 = 155 - conv_dw(128, 128, 1), # 155 + 32 = 187 - conv_dw(128, 128, 1), # 187 + 32 = 219 - ) - self.stage3 = nn.Sequential( - conv_dw(128, 256, 2), # 219 +3 2 = 241 - conv_dw(256, 256, 1), # 241 + 64 = 301 - ) - self.avg = nn.AdaptiveAvgPool2d((1, 1)) - self.fc = nn.Linear(256, 1000) - - def forward(self, x): - x = self.stage1(x) - x = self.stage2(x) - x = self.stage3(x) - x = self.avg(x) - # x = self.model(x) - x = x.view(-1, 256) - x = self.fc(x) - return x - - -class ClassHead(nn.Module): - - def __init__(self, inchannels=512, num_anchors=3): - super(ClassHead, self).__init__() - self.num_anchors = num_anchors - self.conv1x1 = nn.Conv2d(inchannels, self.num_anchors * 2, kernel_size=(1, 1), stride=1, padding=0) - - def forward(self, x): - out = self.conv1x1(x) - out = out.permute(0, 2, 3, 1).contiguous() - - return out.view(out.shape[0], -1, 2) - - -class BboxHead(nn.Module): - - def __init__(self, inchannels=512, num_anchors=3): - super(BboxHead, self).__init__() - self.conv1x1 = nn.Conv2d(inchannels, num_anchors * 4, kernel_size=(1, 1), stride=1, padding=0) - - def forward(self, x): - out = self.conv1x1(x) - out = out.permute(0, 2, 3, 1).contiguous() - - return out.view(out.shape[0], -1, 4) - - -class LandmarkHead(nn.Module): - - def __init__(self, inchannels=512, num_anchors=3): - super(LandmarkHead, self).__init__() - self.conv1x1 = nn.Conv2d(inchannels, num_anchors * 10, kernel_size=(1, 1), stride=1, padding=0) - - def forward(self, x): - out = self.conv1x1(x) - out = out.permute(0, 2, 3, 1).contiguous() - - return out.view(out.shape[0], -1, 10) - - -def make_class_head(fpn_num=3, inchannels=64, anchor_num=2): - classhead = nn.ModuleList() - for i in range(fpn_num): - classhead.append(ClassHead(inchannels, anchor_num)) - return classhead - - -def make_bbox_head(fpn_num=3, inchannels=64, anchor_num=2): - bboxhead = nn.ModuleList() - for i in range(fpn_num): - bboxhead.append(BboxHead(inchannels, anchor_num)) - return bboxhead - - -def make_landmark_head(fpn_num=3, inchannels=64, anchor_num=2): - landmarkhead = nn.ModuleList() - for i in range(fpn_num): - landmarkhead.append(LandmarkHead(inchannels, anchor_num)) - return landmarkhead diff --git a/spaces/yizhangliu/Grounded-Segment-Anything/transformers_4_35_0/models/distilbert/configuration_distilbert.py b/spaces/yizhangliu/Grounded-Segment-Anything/transformers_4_35_0/models/distilbert/configuration_distilbert.py deleted file mode 100644 index 3dabb3d3e2340e49bb8df47580cf7cd9ae9631fb..0000000000000000000000000000000000000000 --- a/spaces/yizhangliu/Grounded-Segment-Anything/transformers_4_35_0/models/distilbert/configuration_distilbert.py +++ /dev/null @@ -1,154 +0,0 @@ -# coding=utf-8 -# Copyright 2019-present, the HuggingFace Inc. team, The Google AI Language Team and Facebook, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -""" DistilBERT model configuration""" -from collections import OrderedDict -from typing import Mapping - -from ...configuration_utils import PretrainedConfig -from ...onnx import OnnxConfig -from ...utils import logging - - -logger = logging.get_logger(__name__) - -DISTILBERT_PRETRAINED_CONFIG_ARCHIVE_MAP = { - "distilbert-base-uncased": "https://huggingface.co/distilbert-base-uncased/resolve/main/config.json", - "distilbert-base-uncased-distilled-squad": ( - "https://huggingface.co/distilbert-base-uncased-distilled-squad/resolve/main/config.json" - ), - "distilbert-base-cased": "https://huggingface.co/distilbert-base-cased/resolve/main/config.json", - "distilbert-base-cased-distilled-squad": ( - "https://huggingface.co/distilbert-base-cased-distilled-squad/resolve/main/config.json" - ), - "distilbert-base-german-cased": "https://huggingface.co/distilbert-base-german-cased/resolve/main/config.json", - "distilbert-base-multilingual-cased": ( - "https://huggingface.co/distilbert-base-multilingual-cased/resolve/main/config.json" - ), - "distilbert-base-uncased-finetuned-sst-2-english": ( - "https://huggingface.co/distilbert-base-uncased-finetuned-sst-2-english/resolve/main/config.json" - ), -} - - -class DistilBertConfig(PretrainedConfig): - r""" - This is the configuration class to store the configuration of a [`DistilBertModel`] or a [`TFDistilBertModel`]. It - is used to instantiate a DistilBERT model according to the specified arguments, defining the model architecture. - Instantiating a configuration with the defaults will yield a similar configuration to that of the DistilBERT - [distilbert-base-uncased](https://huggingface.co/distilbert-base-uncased) architecture. - - Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the - documentation from [`PretrainedConfig`] for more information. - - Args: - vocab_size (`int`, *optional*, defaults to 30522): - Vocabulary size of the DistilBERT model. Defines the number of different tokens that can be represented by - the `inputs_ids` passed when calling [`DistilBertModel`] or [`TFDistilBertModel`]. - max_position_embeddings (`int`, *optional*, defaults to 512): - The maximum sequence length that this model might ever be used with. Typically set this to something large - just in case (e.g., 512 or 1024 or 2048). - sinusoidal_pos_embds (`boolean`, *optional*, defaults to `False`): - Whether to use sinusoidal positional embeddings. - n_layers (`int`, *optional*, defaults to 6): - Number of hidden layers in the Transformer encoder. - n_heads (`int`, *optional*, defaults to 12): - Number of attention heads for each attention layer in the Transformer encoder. - dim (`int`, *optional*, defaults to 768): - Dimensionality of the encoder layers and the pooler layer. - hidden_dim (`int`, *optional*, defaults to 3072): - The size of the "intermediate" (often named feed-forward) layer in the Transformer encoder. - dropout (`float`, *optional*, defaults to 0.1): - The dropout probability for all fully connected layers in the embeddings, encoder, and pooler. - attention_dropout (`float`, *optional*, defaults to 0.1): - The dropout ratio for the attention probabilities. - activation (`str` or `Callable`, *optional*, defaults to `"gelu"`): - The non-linear activation function (function or string) in the encoder and pooler. If string, `"gelu"`, - `"relu"`, `"silu"` and `"gelu_new"` are supported. - initializer_range (`float`, *optional*, defaults to 0.02): - The standard deviation of the truncated_normal_initializer for initializing all weight matrices. - qa_dropout (`float`, *optional*, defaults to 0.1): - The dropout probabilities used in the question answering model [`DistilBertForQuestionAnswering`]. - seq_classif_dropout (`float`, *optional*, defaults to 0.2): - The dropout probabilities used in the sequence classification and the multiple choice model - [`DistilBertForSequenceClassification`]. - - Examples: - - ```python - >>> from transformers import DistilBertConfig, DistilBertModel - - >>> # Initializing a DistilBERT configuration - >>> configuration = DistilBertConfig() - - >>> # Initializing a model (with random weights) from the configuration - >>> model = DistilBertModel(configuration) - - >>> # Accessing the model configuration - >>> configuration = model.config - ```""" - model_type = "distilbert" - attribute_map = { - "hidden_size": "dim", - "num_attention_heads": "n_heads", - "num_hidden_layers": "n_layers", - } - - def __init__( - self, - vocab_size=30522, - max_position_embeddings=512, - sinusoidal_pos_embds=False, - n_layers=6, - n_heads=12, - dim=768, - hidden_dim=4 * 768, - dropout=0.1, - attention_dropout=0.1, - activation="gelu", - initializer_range=0.02, - qa_dropout=0.1, - seq_classif_dropout=0.2, - pad_token_id=0, - **kwargs, - ): - self.vocab_size = vocab_size - self.max_position_embeddings = max_position_embeddings - self.sinusoidal_pos_embds = sinusoidal_pos_embds - self.n_layers = n_layers - self.n_heads = n_heads - self.dim = dim - self.hidden_dim = hidden_dim - self.dropout = dropout - self.attention_dropout = attention_dropout - self.activation = activation - self.initializer_range = initializer_range - self.qa_dropout = qa_dropout - self.seq_classif_dropout = seq_classif_dropout - super().__init__(**kwargs, pad_token_id=pad_token_id) - - -class DistilBertOnnxConfig(OnnxConfig): - @property - def inputs(self) -> Mapping[str, Mapping[int, str]]: - if self.task == "multiple-choice": - dynamic_axis = {0: "batch", 1: "choice", 2: "sequence"} - else: - dynamic_axis = {0: "batch", 1: "sequence"} - return OrderedDict( - [ - ("input_ids", dynamic_axis), - ("attention_mask", dynamic_axis), - ] - ) diff --git a/spaces/ykilcher/apes/projector.py b/spaces/ykilcher/apes/projector.py deleted file mode 100644 index cb1a0a64fe1c9031cedd2924c03be677c503d383..0000000000000000000000000000000000000000 --- a/spaces/ykilcher/apes/projector.py +++ /dev/null @@ -1,261 +0,0 @@ -# Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved. -# -# NVIDIA CORPORATION and its licensors retain all intellectual property -# and proprietary rights in and to this software, related documentation -# and any modifications thereto. Any use, reproduction, disclosure or -# distribution of this software and related documentation without an express -# license agreement from NVIDIA CORPORATION is strictly prohibited. - -"""Project given image to the latent space of pretrained network pickle.""" - -import copy -import os -from time import perf_counter - -import click -import imageio -import numpy as np -import PIL.Image -import torch -import torch.nn.functional as F - -import dnnlib -import legacy - -_MODELS = { - "RN50": "https://openaipublic.azureedge.net/clip/models/afeb0e10f9e5a86da6080e35cf09123aca3b358a0c3e3b6c78a7b63bc04b6762/RN50.pt", - "RN101": "https://openaipublic.azureedge.net/clip/models/8fa8567bab74a42d41c5915025a8e4538c3bdbe8804a470a72f30b0d94fab599/RN101.pt", - "RN50x4": "https://openaipublic.azureedge.net/clip/models/7e526bd135e493cef0776de27d5f42653e6b4c8bf9e0f653bb11773263205fdd/RN50x4.pt", - "RN50x16": "https://openaipublic.azureedge.net/clip/models/52378b407f34354e150460fe41077663dd5b39c54cd0bfd2b27167a4a06ec9aa/RN50x16.pt", - "RN50x64": "https://openaipublic.azureedge.net/clip/models/be1cfb55d75a9666199fb2206c106743da0f6468c9d327f3e0d0a543a9919d9c/RN50x64.pt", - "ViT-B/32": "https://openaipublic.azureedge.net/clip/models/40d365715913c9da98579312b702a82c18be219cc2a73407c4526f58eba950af/ViT-B-32.pt", - "ViT-B/16": "https://openaipublic.azureedge.net/clip/models/5806e77cd80f8b59890b7e101eabd078d9fb84e6937f9e85e4ecb61988df416f/ViT-B-16.pt", - "ViT-L/14": "https://openaipublic.azureedge.net/clip/models/b8cca3fd41ae0c99ba7e8951adf17d267cdb84cd88be6f7c2e0eca1737a03836/ViT-L-14.pt", - "ViT-L/14@336px": "https://openaipublic.azureedge.net/clip/models/3035c92b350959924f9f00213499208652fc7ea050643e8b385c2dac08641f02/ViT-L-14-336px.pt", -} - -def project( - G, - target: torch.Tensor, # [C,H,W] and dynamic range [0,255], W & H must match G output resolution - *, - num_steps = 1000, - w_avg_samples = 10000, - initial_learning_rate = 0.1, - initial_noise_factor = 0.05, - lr_rampdown_length = 0.25, - lr_rampup_length = 0.05, - noise_ramp_length = 0.75, - regularize_noise_weight = 1e5, - verbose = False, - model_name='vgg16', - loss_type='l2', - normalize_for_clip=True, - device: torch.device -): - assert target.shape == (G.img_channels, G.img_resolution, G.img_resolution) - - def logprint(*args): - if verbose: - print(*args) - - G = copy.deepcopy(G).eval().requires_grad_(False).to(device) # type: ignore - - # Compute w stats. - logprint(f'Computing W midpoint and stddev using {w_avg_samples} samples...') - z_samples = np.random.RandomState(123).randn(w_avg_samples, G.z_dim) - w_samples = G.mapping(torch.from_numpy(z_samples).to(device), None) # [N, L, C] - w_samples = w_samples[:, :1, :].cpu().numpy().astype(np.float32) # [N, 1, C] - w_avg = np.mean(w_samples, axis=0, keepdims=True) # [1, 1, C] - w_std = (np.sum((w_samples - w_avg) ** 2) / w_avg_samples) ** 0.5 - - # Setup noise inputs. - noise_bufs = { name: buf for (name, buf) in G.synthesis.named_buffers() if 'noise_const' in name } - - USE_CLIP = model_name != 'vgg16' - # Load VGG16 feature detector. - url = 'https://nvlabs-fi-cdn.nvidia.com/stylegan2-ada-pytorch/pretrained/metrics/vgg16.pt' - if USE_CLIP: - # url = 'https://openaipublic.azureedge.net/clip/models/40d365715913c9da98579312b702a82c18be219cc2a73407c4526f58eba950af/ViT-B-32.pt' - # url = 'https://openaipublic.azureedge.net/clip/models/5806e77cd80f8b59890b7e101eabd078d9fb84e6937f9e85e4ecb61988df416f/ViT-B-16.pt' - # url = 'https://openaipublic.azureedge.net/clip/models/b8cca3fd41ae0c99ba7e8951adf17d267cdb84cd88be6f7c2e0eca1737a03836/ViT-L-14.pt' - # url = 'https://openaipublic.azureedge.net/clip/models/3035c92b350959924f9f00213499208652fc7ea050643e8b385c2dac08641f02/ViT-L-14-336px.pt' - url = _MODELS[model_name] - with dnnlib.util.open_url(url) as f: - vgg16 = torch.jit.load(f).eval().to(device) - - # Features for target image. - target_images = target.unsqueeze(0).to(device).to(torch.float32) - if USE_CLIP: - image_mean = torch.tensor([0.48145466, 0.4578275, 0.40821073]).to(device)[:, None, None] - image_std = torch.tensor([0.26862954, 0.26130258, 0.27577711]).to(device)[:, None, None] - # target_images = F.interpolate(target_images, size=(224, 224), mode='area') - target_images = F.interpolate(target_images, size=(vgg16.input_resolution.item(), vgg16.input_resolution.item()), mode='area') - print("target_images.shape:", target_images.shape) - def _encode_image(image): - image = image / 255. - # image = torch.sigmoid(image) - if normalize_for_clip: - image = (image - image_mean) / image_std - return vgg16.encode_image(image) - target_features = _encode_image(target_images.clamp(0, 255)) - target_features = target_features.detach() - else: - if target_images.shape[2] > 256: - target_images = F.interpolate(target_images, size=(256, 256), mode='area') - target_features = vgg16(target_images, resize_images=False, return_lpips=True) - - w_opt = torch.tensor(w_avg, dtype=torch.float32, device=device, requires_grad=True) # pylint: disable=not-callable - w_out = torch.zeros([num_steps] + list(w_opt.shape[1:]), dtype=torch.float32, device=device) - optimizer = torch.optim.Adam([w_opt] + list(noise_bufs.values()), betas=(0.9, 0.999), lr=initial_learning_rate) - - # Init noise. - for buf in noise_bufs.values(): - buf[:] = torch.randn_like(buf) - buf.requires_grad = True - - for step in range(num_steps): - # Learning rate schedule. - t = step / num_steps - w_noise_scale = w_std * initial_noise_factor * max(0.0, 1.0 - t / noise_ramp_length) ** 2 - lr_ramp = min(1.0, (1.0 - t) / lr_rampdown_length) - lr_ramp = 0.5 - 0.5 * np.cos(lr_ramp * np.pi) - lr_ramp = lr_ramp * min(1.0, t / lr_rampup_length) - lr = initial_learning_rate * lr_ramp - for param_group in optimizer.param_groups: - param_group['lr'] = lr - - # Synth images from opt_w. - w_noise = torch.randn_like(w_opt) * w_noise_scale - ws = (w_opt + w_noise).repeat([1, G.mapping.num_ws, 1]) - synth_images = G.synthesis(ws, noise_mode='const') - - # Downsample image to 256x256 if it's larger than that. VGG was built for 224x224 images. - synth_images = (synth_images + 1) * (255/2) - if synth_images.shape[2] > 256: - synth_images = F.interpolate(synth_images, size=(256, 256), mode='area') - - # Features for synth images. - if USE_CLIP: - synth_images = F.interpolate(synth_images, size=(vgg16.input_resolution.item(), vgg16.input_resolution.item()), mode='area') - synth_features = _encode_image(synth_images) - if loss_type == 'cosine': - target_features_normalized = target_features / target_features.norm(dim=-1, keepdim=True).detach() - synth_features_normalized = synth_features / synth_features.norm(dim=-1, keepdim=True).detach() - dist = 1.0 - torch.sum(synth_features_normalized * target_features_normalized) - elif loss_type == 'l1': - dist = (target_features - synth_features).abs().sum() - else: - dist = (target_features - synth_features).square().sum() - else: - synth_features = vgg16(synth_images, resize_images=False, return_lpips=True) - dist = (target_features - synth_features).square().sum() - - # Noise regularization. - reg_loss = 0.0 - for v in noise_bufs.values(): - noise = v[None,None,:,:] # must be [1,1,H,W] for F.avg_pool2d() - while True: - reg_loss += (noise*torch.roll(noise, shifts=1, dims=3)).mean()**2 - reg_loss += (noise*torch.roll(noise, shifts=1, dims=2)).mean()**2 - if noise.shape[2] <= 8: - break - noise = F.avg_pool2d(noise, kernel_size=2) - loss = dist + reg_loss * regularize_noise_weight - - # Step - optimizer.zero_grad(set_to_none=True) - loss.backward() - optimizer.step() - logprint(f'step {step+1:>4d}/{num_steps}: dist {dist:<4.2f} loss {float(loss):<5.2f}') - - # Save projected W for each optimization step. - w_out[step] = w_opt.detach()[0] - - # Normalize noise. - with torch.no_grad(): - for buf in noise_bufs.values(): - buf -= buf.mean() - buf *= buf.square().mean().rsqrt() - - return w_out.repeat([1, G.mapping.num_ws, 1]) - -#---------------------------------------------------------------------------- - -@click.command() -@click.option('--network', 'network_pkl', help='Network pickle filename', required=True) -@click.option('--target', 'target_fname', help='Target image file to project to', required=True, metavar='FILE') -@click.option('--num-steps', help='Number of optimization steps', type=int, default=1000, show_default=True) -@click.option('--seed', help='Random seed', type=int, default=303, show_default=True) -@click.option('--save-video', help='Save an mp4 video of optimization progress', type=bool, default=True, show_default=True) -@click.option('--outdir', help='Where to save the output images', required=True, metavar='DIR') -def run_projection( - network_pkl: str, - target_fname: str, - outdir: str, - save_video: bool, - seed: int, - num_steps: int -): - """Project given image to the latent space of pretrained network pickle. - - Examples: - - \b - python projector.py --outdir=out --target=~/mytargetimg.png \\ - --network=https://nvlabs-fi-cdn.nvidia.com/stylegan2-ada-pytorch/pretrained/ffhq.pkl - """ - np.random.seed(seed) - torch.manual_seed(seed) - - # Load networks. - print('Loading networks from "%s"...' % network_pkl) - device = torch.device('cuda') - with dnnlib.util.open_url(network_pkl) as fp: - G = legacy.load_network_pkl(fp)['G_ema'].requires_grad_(False).to(device) # type: ignore - - # Load target image. - target_pil = PIL.Image.open(target_fname).convert('RGB') - w, h = target_pil.size - s = min(w, h) - target_pil = target_pil.crop(((w - s) // 2, (h - s) // 2, (w + s) // 2, (h + s) // 2)) - target_pil = target_pil.resize((G.img_resolution, G.img_resolution), PIL.Image.LANCZOS) - target_uint8 = np.array(target_pil, dtype=np.uint8) - - # Optimize projection. - start_time = perf_counter() - projected_w_steps = project( - G, - target=torch.tensor(target_uint8.transpose([2, 0, 1]), device=device), # pylint: disable=not-callable - num_steps=num_steps, - device=device, - verbose=True - ) - print (f'Elapsed: {(perf_counter()-start_time):.1f} s') - - # Render debug output: optional video and projected image and W vector. - os.makedirs(outdir, exist_ok=True) - if save_video: - video = imageio.get_writer(f'{outdir}/proj.mp4', mode='I', fps=10, codec='libx264', bitrate='16M') - print (f'Saving optimization progress video "{outdir}/proj.mp4"') - for projected_w in projected_w_steps: - synth_image = G.synthesis(projected_w.unsqueeze(0), noise_mode='const') - synth_image = (synth_image + 1) * (255/2) - synth_image = synth_image.permute(0, 2, 3, 1).clamp(0, 255).to(torch.uint8)[0].cpu().numpy() - video.append_data(np.concatenate([target_uint8, synth_image], axis=1)) - video.close() - - # Save final projected frame and W vector. - target_pil.save(f'{outdir}/target.png') - projected_w = projected_w_steps[-1] - synth_image = G.synthesis(projected_w.unsqueeze(0), noise_mode='const') - synth_image = (synth_image + 1) * (255/2) - synth_image = synth_image.permute(0, 2, 3, 1).clamp(0, 255).to(torch.uint8)[0].cpu().numpy() - PIL.Image.fromarray(synth_image, 'RGB').save(f'{outdir}/proj.png') - np.savez(f'{outdir}/projected_w.npz', w=projected_w.unsqueeze(0).cpu().numpy()) - -#---------------------------------------------------------------------------- - -if __name__ == "__main__": - run_projection() # pylint: disable=no-value-for-parameter - -#---------------------------------------------------------------------------- diff --git a/spaces/ynhe/AskAnything/models/grit_src/third_party/CenterNet2/projects/CenterNet2/centernet/modeling/layers/ml_nms.py b/spaces/ynhe/AskAnything/models/grit_src/third_party/CenterNet2/projects/CenterNet2/centernet/modeling/layers/ml_nms.py deleted file mode 100644 index 325d709a98422d8a355fc7c7e281179642850968..0000000000000000000000000000000000000000 --- a/spaces/ynhe/AskAnything/models/grit_src/third_party/CenterNet2/projects/CenterNet2/centernet/modeling/layers/ml_nms.py +++ /dev/null @@ -1,31 +0,0 @@ -from detectron2.layers import batched_nms - - -def ml_nms(boxlist, nms_thresh, max_proposals=-1, - score_field="scores", label_field="labels"): - """ - Performs non-maximum suppression on a boxlist, with scores specified - in a boxlist field via score_field. - Arguments: - boxlist(BoxList) - nms_thresh (float) - max_proposals (int): if > 0, then only the top max_proposals are kept - after non-maximum suppression - score_field (str) - """ - if nms_thresh <= 0: - return boxlist - if boxlist.has('pred_boxes'): - boxes = boxlist.pred_boxes.tensor - labels = boxlist.pred_classes - else: - boxes = boxlist.proposal_boxes.tensor - labels = boxlist.proposal_boxes.tensor.new_zeros( - len(boxlist.proposal_boxes.tensor)) - scores = boxlist.scores - - keep = batched_nms(boxes, scores, labels, nms_thresh) - if max_proposals > 0: - keep = keep[: max_proposals] - boxlist = boxlist[keep] - return boxlist diff --git a/spaces/ynhe/AskAnything/models/vit.py b/spaces/ynhe/AskAnything/models/vit.py deleted file mode 100644 index 9d910a687ef6e74a6d7541e81c93b06aea7fda60..0000000000000000000000000000000000000000 --- a/spaces/ynhe/AskAnything/models/vit.py +++ /dev/null @@ -1,300 +0,0 @@ -''' - * Copyright (c) 2022, salesforce.com, inc. - * All rights reserved. - * SPDX-License-Identifier: BSD-3-Clause - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - * By Junnan Li - * Based on timm code base - * https://github.com/rwightman/pytorch-image-models/tree/master/timm -''' - -import torch -import torch.nn as nn -import torch.nn.functional as F -from functools import partial - -from timm.models.vision_transformer import _cfg, PatchEmbed -from timm.models.registry import register_model -from timm.models.layers import trunc_normal_, DropPath -from timm.models.helpers import named_apply, adapt_input_conv - -from fairscale.nn.checkpoint.checkpoint_activations import checkpoint_wrapper - -class Mlp(nn.Module): - """ MLP as used in Vision Transformer, MLP-Mixer and related networks - """ - def __init__(self, in_features, hidden_features=None, out_features=None, act_layer=nn.GELU, drop=0.): - super().__init__() - out_features = out_features or in_features - hidden_features = hidden_features or in_features - self.fc1 = nn.Linear(in_features, hidden_features) - self.act = act_layer() - self.fc2 = nn.Linear(hidden_features, out_features) - self.drop = nn.Dropout(drop) - - def forward(self, x): - x = self.fc1(x) - x = self.act(x) - x = self.drop(x) - x = self.fc2(x) - x = self.drop(x) - return x - - -class Attention(nn.Module): - def __init__(self, dim, num_heads=8, qkv_bias=False, qk_scale=None, attn_drop=0., proj_drop=0.): - super().__init__() - self.num_heads = num_heads - head_dim = dim // num_heads - # NOTE scale factor was wrong in my original version, can set manually to be compat with prev weights - self.scale = qk_scale or head_dim ** -0.5 - self.qkv = nn.Linear(dim, dim * 3, bias=qkv_bias) - self.attn_drop = nn.Dropout(attn_drop) - self.proj = nn.Linear(dim, dim) - self.proj_drop = nn.Dropout(proj_drop) - self.attn_gradients = None - self.attention_map = None - - def save_attn_gradients(self, attn_gradients): - self.attn_gradients = attn_gradients - - def get_attn_gradients(self): - return self.attn_gradients - - def save_attention_map(self, attention_map): - self.attention_map = attention_map - - def get_attention_map(self): - return self.attention_map - - def forward(self, x, register_hook=False): - B, N, C = x.shape - qkv = self.qkv(x).reshape(B, N, 3, self.num_heads, C // self.num_heads).permute(2, 0, 3, 1, 4) - q, k, v = qkv[0], qkv[1], qkv[2] # make torchscript happy (cannot use tensor as tuple) - - attn = (q @ k.transpose(-2, -1)) * self.scale - attn = attn.softmax(dim=-1) - attn = self.attn_drop(attn) - - if register_hook: - self.save_attention_map(attn) - attn.register_hook(self.save_attn_gradients) - - x = (attn @ v).transpose(1, 2).reshape(B, N, C) - x = self.proj(x) - x = self.proj_drop(x) - return x - - -class Block(nn.Module): - - def __init__(self, dim, num_heads, mlp_ratio=4., qkv_bias=False, qk_scale=None, drop=0., attn_drop=0., - drop_path=0., act_layer=nn.GELU, norm_layer=nn.LayerNorm, use_grad_checkpointing=False): - super().__init__() - self.norm1 = norm_layer(dim) - self.attn = Attention( - dim, num_heads=num_heads, qkv_bias=qkv_bias, qk_scale=qk_scale, attn_drop=attn_drop, proj_drop=drop) - # NOTE: drop path for stochastic depth, we shall see if this is better than dropout here - self.drop_path = DropPath(drop_path) if drop_path > 0. else nn.Identity() - self.norm2 = norm_layer(dim) - mlp_hidden_dim = int(dim * mlp_ratio) - self.mlp = Mlp(in_features=dim, hidden_features=mlp_hidden_dim, act_layer=act_layer, drop=drop) - - if use_grad_checkpointing: - self.attn = checkpoint_wrapper(self.attn) - self.mlp = checkpoint_wrapper(self.mlp) - - def forward(self, x, register_hook=False): - x = x + self.drop_path(self.attn(self.norm1(x), register_hook=register_hook)) - x = x + self.drop_path(self.mlp(self.norm2(x))) - return x - - -class VisionTransformer(nn.Module): - """ Vision Transformer - A PyTorch impl of : `An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale` - - https://arxiv.org/abs/2010.11929 - """ - def __init__(self, img_size=224, patch_size=16, in_chans=3, num_classes=1000, embed_dim=768, depth=12, - num_heads=12, mlp_ratio=4., qkv_bias=True, qk_scale=None, representation_size=None, - drop_rate=0., attn_drop_rate=0., drop_path_rate=0., norm_layer=None, - use_grad_checkpointing=False, ckpt_layer=0): - """ - Args: - img_size (int, tuple): input image size - patch_size (int, tuple): patch size - in_chans (int): number of input channels - num_classes (int): number of classes for classification head - embed_dim (int): embedding dimension - depth (int): depth of transformer - num_heads (int): number of attention heads - mlp_ratio (int): ratio of mlp hidden dim to embedding dim - qkv_bias (bool): enable bias for qkv if True - qk_scale (float): override default qk scale of head_dim ** -0.5 if set - representation_size (Optional[int]): enable and set representation layer (pre-logits) to this value if set - drop_rate (float): dropout rate - attn_drop_rate (float): attention dropout rate - drop_path_rate (float): stochastic depth rate - norm_layer: (nn.Module): normalization layer - """ - super().__init__() - self.num_features = self.embed_dim = embed_dim # num_features for consistency with other models - norm_layer = norm_layer or partial(nn.LayerNorm, eps=1e-6) - - self.patch_embed = PatchEmbed( - img_size=img_size, patch_size=patch_size, in_chans=in_chans, embed_dim=embed_dim) - - num_patches = self.patch_embed.num_patches - - self.cls_token = nn.Parameter(torch.zeros(1, 1, embed_dim)) - self.pos_embed = nn.Parameter(torch.zeros(1, num_patches + 1, embed_dim)) - self.pos_drop = nn.Dropout(p=drop_rate) - - dpr = [x.item() for x in torch.linspace(0, drop_path_rate, depth)] # stochastic depth decay rule - self.blocks = nn.ModuleList([ - Block( - dim=embed_dim, num_heads=num_heads, mlp_ratio=mlp_ratio, qkv_bias=qkv_bias, qk_scale=qk_scale, - drop=drop_rate, attn_drop=attn_drop_rate, drop_path=dpr[i], norm_layer=norm_layer, - use_grad_checkpointing=(use_grad_checkpointing and i>=depth-ckpt_layer) - ) - for i in range(depth)]) - self.norm = norm_layer(embed_dim) - - trunc_normal_(self.pos_embed, std=.02) - trunc_normal_(self.cls_token, std=.02) - self.apply(self._init_weights) - - def _init_weights(self, m): - if isinstance(m, nn.Linear): - trunc_normal_(m.weight, std=.02) - if isinstance(m, nn.Linear) and m.bias is not None: - nn.init.constant_(m.bias, 0) - elif isinstance(m, nn.LayerNorm): - nn.init.constant_(m.bias, 0) - nn.init.constant_(m.weight, 1.0) - - @torch.jit.ignore - def no_weight_decay(self): - return {'pos_embed', 'cls_token'} - - def forward(self, x, register_blk=-1): - B = x.shape[0] - x = self.patch_embed(x) - - cls_tokens = self.cls_token.expand(B, -1, -1) # stole cls_tokens impl from Phil Wang, thanks - x = torch.cat((cls_tokens, x), dim=1) - - x = x + self.pos_embed[:,:x.size(1),:] - x = self.pos_drop(x) - - for i,blk in enumerate(self.blocks): - x = blk(x, register_blk==i) - x = self.norm(x) - - return x - - @torch.jit.ignore() - def load_pretrained(self, checkpoint_path, prefix=''): - _load_weights(self, checkpoint_path, prefix) - - -@torch.no_grad() -def _load_weights(model: VisionTransformer, checkpoint_path: str, prefix: str = ''): - """ Load weights from .npz checkpoints for official Google Brain Flax implementation - """ - import numpy as np - - def _n2p(w, t=True): - if w.ndim == 4 and w.shape[0] == w.shape[1] == w.shape[2] == 1: - w = w.flatten() - if t: - if w.ndim == 4: - w = w.transpose([3, 2, 0, 1]) - elif w.ndim == 3: - w = w.transpose([2, 0, 1]) - elif w.ndim == 2: - w = w.transpose([1, 0]) - return torch.from_numpy(w) - - w = np.load(checkpoint_path) - if not prefix and 'opt/target/embedding/kernel' in w: - prefix = 'opt/target/' - - if hasattr(model.patch_embed, 'backbone'): - # hybrid - backbone = model.patch_embed.backbone - stem_only = not hasattr(backbone, 'stem') - stem = backbone if stem_only else backbone.stem - stem.conv.weight.copy_(adapt_input_conv(stem.conv.weight.shape[1], _n2p(w[f'{prefix}conv_root/kernel']))) - stem.norm.weight.copy_(_n2p(w[f'{prefix}gn_root/scale'])) - stem.norm.bias.copy_(_n2p(w[f'{prefix}gn_root/bias'])) - if not stem_only: - for i, stage in enumerate(backbone.stages): - for j, block in enumerate(stage.blocks): - bp = f'{prefix}block{i + 1}/unit{j + 1}/' - for r in range(3): - getattr(block, f'conv{r + 1}').weight.copy_(_n2p(w[f'{bp}conv{r + 1}/kernel'])) - getattr(block, f'norm{r + 1}').weight.copy_(_n2p(w[f'{bp}gn{r + 1}/scale'])) - getattr(block, f'norm{r + 1}').bias.copy_(_n2p(w[f'{bp}gn{r + 1}/bias'])) - if block.downsample is not None: - block.downsample.conv.weight.copy_(_n2p(w[f'{bp}conv_proj/kernel'])) - block.downsample.norm.weight.copy_(_n2p(w[f'{bp}gn_proj/scale'])) - block.downsample.norm.bias.copy_(_n2p(w[f'{bp}gn_proj/bias'])) - embed_conv_w = _n2p(w[f'{prefix}embedding/kernel']) - else: - embed_conv_w = adapt_input_conv( - model.patch_embed.proj.weight.shape[1], _n2p(w[f'{prefix}embedding/kernel'])) - model.patch_embed.proj.weight.copy_(embed_conv_w) - model.patch_embed.proj.bias.copy_(_n2p(w[f'{prefix}embedding/bias'])) - model.cls_token.copy_(_n2p(w[f'{prefix}cls'], t=False)) - pos_embed_w = _n2p(w[f'{prefix}Transformer/posembed_input/pos_embedding'], t=False) - if pos_embed_w.shape != model.pos_embed.shape: - pos_embed_w = resize_pos_embed( # resize pos embedding when different size from pretrained weights - pos_embed_w, model.pos_embed, getattr(model, 'num_tokens', 1), model.patch_embed.grid_size) - model.pos_embed.copy_(pos_embed_w) - model.norm.weight.copy_(_n2p(w[f'{prefix}Transformer/encoder_norm/scale'])) - model.norm.bias.copy_(_n2p(w[f'{prefix}Transformer/encoder_norm/bias'])) - - for i, block in enumerate(model.blocks.children()): - block_prefix = f'{prefix}Transformer/encoderblock_{i}/' - mha_prefix = block_prefix + 'MultiHeadDotProductAttention_1/' - block.norm1.weight.copy_(_n2p(w[f'{block_prefix}LayerNorm_0/scale'])) - block.norm1.bias.copy_(_n2p(w[f'{block_prefix}LayerNorm_0/bias'])) - block.attn.qkv.weight.copy_(torch.cat([ - _n2p(w[f'{mha_prefix}{n}/kernel'], t=False).flatten(1).T for n in ('query', 'key', 'value')])) - block.attn.qkv.bias.copy_(torch.cat([ - _n2p(w[f'{mha_prefix}{n}/bias'], t=False).reshape(-1) for n in ('query', 'key', 'value')])) - block.attn.proj.weight.copy_(_n2p(w[f'{mha_prefix}out/kernel']).flatten(1)) - block.attn.proj.bias.copy_(_n2p(w[f'{mha_prefix}out/bias'])) - for r in range(2): - getattr(block.mlp, f'fc{r + 1}').weight.copy_(_n2p(w[f'{block_prefix}MlpBlock_3/Dense_{r}/kernel'])) - getattr(block.mlp, f'fc{r + 1}').bias.copy_(_n2p(w[f'{block_prefix}MlpBlock_3/Dense_{r}/bias'])) - block.norm2.weight.copy_(_n2p(w[f'{block_prefix}LayerNorm_2/scale'])) - block.norm2.bias.copy_(_n2p(w[f'{block_prefix}LayerNorm_2/bias'])) - - -def interpolate_pos_embed(pos_embed_checkpoint, visual_encoder): - # interpolate position embedding - embedding_size = pos_embed_checkpoint.shape[-1] - num_patches = visual_encoder.patch_embed.num_patches - num_extra_tokens = visual_encoder.pos_embed.shape[-2] - num_patches - # height (== width) for the checkpoint position embedding - orig_size = int((pos_embed_checkpoint.shape[-2] - num_extra_tokens) ** 0.5) - # height (== width) for the new position embedding - new_size = int(num_patches ** 0.5) - - if orig_size!=new_size: - # class_token and dist_token are kept unchanged - extra_tokens = pos_embed_checkpoint[:, :num_extra_tokens] - # only the position tokens are interpolated - pos_tokens = pos_embed_checkpoint[:, num_extra_tokens:] - pos_tokens = pos_tokens.reshape(-1, orig_size, orig_size, embedding_size).permute(0, 3, 1, 2) - pos_tokens = torch.nn.functional.interpolate( - pos_tokens, size=(new_size, new_size), mode='bicubic', align_corners=False) - pos_tokens = pos_tokens.permute(0, 2, 3, 1).flatten(1, 2) - new_pos_embed = torch.cat((extra_tokens, pos_tokens), dim=1) - print('reshape position embedding from %d to %d'%(orig_size ** 2,new_size ** 2)) - - return new_pos_embed - else: - return pos_embed_checkpoint \ No newline at end of file diff --git a/spaces/yuvalkirstain/PickScore/README.md b/spaces/yuvalkirstain/PickScore/README.md deleted file mode 100644 index 0dfc28b136bcb1f42d1d795af670989025f1127e..0000000000000000000000000000000000000000 --- a/spaces/yuvalkirstain/PickScore/README.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -title: PickScore -emoji: 😻 -colorFrom: yellow -colorTo: blue -sdk: gradio -sdk_version: 3.28.3 -app_file: app.py -pinned: false -license: mit ---- - -Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference diff --git a/spaces/yuvalkirstain/PickScore/app.py b/spaces/yuvalkirstain/PickScore/app.py deleted file mode 100644 index 519c8ad90896f89f1caba0fd81c4f26ec19865fe..0000000000000000000000000000000000000000 --- a/spaces/yuvalkirstain/PickScore/app.py +++ /dev/null @@ -1,97 +0,0 @@ -import time -from PIL import Image -import gradio as gr -from glob import glob -import torch -from transformers import AutoModel, AutoProcessor - -DEFAULT_EXAMPLE_PATH = f'examples/example_0' - -device = "cuda" if torch.cuda.is_available() else "cpu" -weight_dtype = torch.bfloat16 if device == "cuda" else torch.float32 -print(f"Using device: {device} ({weight_dtype})") -print("Loading model...") -model_pretrained_name_or_path = "yuvalkirstain/PickScore_v1" -processor = AutoProcessor.from_pretrained(model_pretrained_name_or_path) -model = AutoModel.from_pretrained(model_pretrained_name_or_path, torch_dtype=weight_dtype).eval().to(device) -print("Model loaded.") - - -def calc_probs(prompt, images): - print("Processing inputs...") - image_inputs = processor( - images=images, - padding=True, - truncation=True, - max_length=77, - return_tensors="pt", - ).to(device) - - image_inputs = {k: v.to(weight_dtype) for k, v in image_inputs.items()} - - text_inputs = processor( - text=prompt, - padding=True, - truncation=True, - max_length=77, - return_tensors="pt", - ).to(device) - - with torch.no_grad(): - print("Embedding images and text...") - image_embs = model.get_image_features(**image_inputs) - image_embs = image_embs / torch.norm(image_embs, dim=-1, keepdim=True) - - text_embs = model.get_text_features(**text_inputs) - text_embs = text_embs / torch.norm(text_embs, dim=-1, keepdim=True) - - print("Calculating scores...") - scores = model.logit_scale.exp() * (text_embs.float() @ image_embs.float().T)[0] - - print("Calculating probabilities...") - probs = torch.softmax(scores, dim=-1) - - return probs.cpu().tolist() - - -def predict(prompt, image_1, image_2): - print(f"Starting prediction for prompt: {prompt}") - start_time = time.time() - probs = calc_probs(prompt, [image_1, image_2]) - print(f"Prediction: {probs} ({time.time() - start_time:.2f} seconds, ) ") - if device == "cuda": - print(f"GPU mem used: {round(torch.cuda.max_memory_allocated(device) / 1024 / 1024 / 1024, 2)}/{round(torch.cuda.get_device_properties(device).total_memory / 1024 / 1024 / 1024, 2)} GB") - return str(round(probs[0], 3)), str(round(probs[1], 3)) - - -with gr.Blocks(title="PickScore v1") as demo: - gr.Markdown("# PickScore v1") - gr.Markdown( - "This is a demo for the PickScore model - see [paper](https://arxiv.org/abs/2305.01569), [code](https://github.com/yuvalkirstain/PickScore), [dataset](https://huggingface.co/datasets/pickapic-anonymous/pickapic_v1), and [model](https://huggingface.co/yuvalkirstain/PickScore_v1).") - gr.Markdown("## Instructions") - gr.Markdown("Write a prompt, place two images, and press run to get their PickScore!") - with gr.Row(): - prompt = gr.inputs.Textbox(lines=1, label="Prompt", - default=open(f'{DEFAULT_EXAMPLE_PATH}/prompt.txt').readline()) - with gr.Row(): - image_1 = gr.components.Image(type="pil", label="image 1", - value=Image.open(f'{DEFAULT_EXAMPLE_PATH}/image_1.png')) - image_2 = gr.components.Image(type="pil", label="image 2", - value=Image.open(f'{DEFAULT_EXAMPLE_PATH}/image_2.png')) - with gr.Row(): - pred_1 = gr.outputs.Textbox(label="Probability 1") - pred_2 = gr.outputs.Textbox(label="Probability 2") - - btn = gr.Button("Run") - btn.click(fn=predict, inputs=[prompt, image_1, image_2], outputs=[pred_1, pred_2]) - prompt.change(lambda: ("", ""), inputs=[], outputs=[pred_1, pred_2]) - - gr.Examples( - [[open(f'{path}/prompt.txt').readline(), f'{path}/image_1.png', f'{path}/image_2.png'] for path in - glob(f'examples/*')], - [prompt, image_1, image_2], - [pred_1, pred_2], - predict - ) - -demo.queue(concurrency_count=5).launch() diff --git a/spaces/zama-fhe/encrypted_health_prediction/symptoms_categories.py b/spaces/zama-fhe/encrypted_health_prediction/symptoms_categories.py deleted file mode 100644 index ef06108620b23190338fac90cdadd7cb22861df5..0000000000000000000000000000000000000000 --- a/spaces/zama-fhe/encrypted_health_prediction/symptoms_categories.py +++ /dev/null @@ -1,197 +0,0 @@ -""" -In this file, we roughly split up a list of symptoms, taken from "./training.csv" file, avalaible -through: "https://github.com/anujdutt9/Disease-Prediction-from-Symptoms/tree/master/dataset" -into medical categories, in order to make the UI more plesant for the users. - -Each variable contains a list of symptoms sthat can be pecific to a part of the body or to a list -of similar symptoms. -""" - - -DIGESTIVE_SYSTEM_SYMPTOMS = { - "DIGESTIVE_SYSTEM_CONCERNS": [ - "stomach_pain", - "acidity", - "vomiting", - "indigestion", - "constipation", - "abdominal_pain", - "diarrhea", - "nausea", - "distention_of_abdomen", - "stomach_bleeding", - "pain_during_bowel_movements", - "passage_of_gases", - "red_spots_over_body", - "swelling_of_stomach", - "bloody_stool", - "irritation_in_anus", - "pain_in_anal_region", - "abnormal_menstruation", - ] -} - -DERMATOLOGICAL_SYMPTOMS = { - "DERMATOLOGICAL_CONCERNS": [ - "itching", - "skin_rash", - "pus_filled_pimples", - "blackheads", - "scurving", - "skin_peeling", - "silver_like_dusting", - "small_dents_in_nails", - "inflammatory_nails", - "blister", - "red_sore_around_nose", - "bruising", - "yellow_crust_ooze", - "dischromic_patches", - "nodal_skin_eruptions", - "toxic_look_(typhus)", - "brittle_nails", - "yellowish_skin", - ] -} - -ORL_SYMPTOMS = { - "ORL_CONCERNS": [ - "loss_of_smell", - "continuous_sneezing", - "runny_nose", - "patches_in_throat", - "throat_irritation", - "sinus_pressure", - "enlarged_thyroid", - "loss_of_balance", - "unsteadiness", - "dizziness", - "spinning_movements", - ] -} - -THORAX_SYMPTOMS = { - "THORAX_CONCERNS": [ - "breathlessness", - "chest_pain", - "cough", - "rusty_sputum", - "phlegm", - "mucoid_sputum", - "congestion", - "blood_in_sputum", - "fast_heart_rate", - ] -} - -OPHTHALMOLOGICAL_SYMPTOMS = { - "OPHTHALMOLOGICAL_CONCERNS": [ - "sunken_eyes", - "redness_of_eyes", - "watering_from_eyes", - "blurred_and_distorted_vision", - "pain_behind_the_eyes", - "visual_disturbances", - ] -} - -VASCULAR_LYMPHATIC_SYMPTOMS = { - "VASCULAR_AND_LYMPHATIC_CONCERNS": [ - "cold_hands_and_feets", - "swollen_blood_vessels", - "swollen_legs", - "swelled_lymph_nodes", - "palpitations", - "prominent_veins_on_calf", - "yellowing_of_eyes", - "puffy_face_and_eyes", - "severe_fluid_overload", - "swollen_extremeties", - ] -} - -UROLOGICAL_SYMPTOMS = { - "UROLOGICAL_CONCERNS": [ - "burning_micturition", - "spotting_urination", - "yellow_urine", - "bladder_discomfort", - "foul_smell_of_urine", - "continuous_feel_of_urine", - "polyuria", - "dark_urine", - ] -} - -MUSCULOSKELETAL_SYMPTOMS = { - "MUSCULOSKELETAL_CONCERNS": [ - "joint_pain", - "muscle_wasting", - "muscle_pain", - "muscle_weakness", - "knee_pain", - "stiff_neck", - "swelling_joints", - "movement_stiffness", - "hip_joint_pain", - "painful_walking", - "weakness_of_one_body_side", - "neck_pain", - "back_pain", - "weakness_in_limbs", - "cramps", - ] -} - -GENERAL_SYMPTOMS = { - "GENERAL_CONCERNS": [ - "acute_liver_failure", - "anxiety", - "restlessness", - "lethargy", - "mood_swings", - "irritability", - "lack_of_concentration", - "fatigue", - "malaise", - "weight_gain", - "increased_appetite", - "weight_loss", - "loss_of_appetite", - "excess_body_fat", - "excessive_hunger", - "ulcers_on_tongue", - "shivering", - "chills", - "irregular_sugar_level", - "high_fever", - "slurred_speech", - "sweating", - "internal_itching", - "mild_fever", - "dehydration", - "headache", - "frequent_unprotected_sexual_intercourse_with_multiple_partners", - "drying_and_tingling_lips", - "altered_sensorium", - "family_history", - "receiving_blood_transfusion", - "receiving_unsterile_injections", - "chronic_alcohol_abuse", - ] -} - -SYMPTOMS_LIST = [ - # Column 1 - DIGESTIVE_SYSTEM_SYMPTOMS, - UROLOGICAL_SYMPTOMS, - VASCULAR_LYMPHATIC_SYMPTOMS, - # Column 2 - ORL_SYMPTOMS, - DERMATOLOGICAL_SYMPTOMS, - MUSCULOSKELETAL_SYMPTOMS, - # Column 3 - OPHTHALMOLOGICAL_SYMPTOMS, - THORAX_SYMPTOMS, - GENERAL_SYMPTOMS, -] diff --git a/spaces/zebahgr/Credit__app/setup.sh b/spaces/zebahgr/Credit__app/setup.sh deleted file mode 100644 index c8650a8b74a58d9a5f53b185fd711c5668e1cd52..0000000000000000000000000000000000000000 --- a/spaces/zebahgr/Credit__app/setup.sh +++ /dev/null @@ -1,13 +0,0 @@ -mkdir -p ~/.streamlit/ - -echo "\ -[general]\n\ -email = \"your-email@domain.com\"\n\ -" > ~/.streamlit/credentials.toml - -echo "\ -[server]\n\ -headless = true\n\ -enableCORS=false\n\ -port = $PORT\n\ -" > ~/.streamlit/config.toml \ No newline at end of file diff --git a/spaces/zhan66/vits-simple-api/gunicorn_config.py b/spaces/zhan66/vits-simple-api/gunicorn_config.py deleted file mode 100644 index abce6691ba08903ecb6972ec79cf36c1298c4a8a..0000000000000000000000000000000000000000 --- a/spaces/zhan66/vits-simple-api/gunicorn_config.py +++ /dev/null @@ -1,19 +0,0 @@ -import gc -import multiprocessing - -bind = "0.0.0.0:23456" -# workers = multiprocessing.cpu_count() -workers = 1 -preload_app = True - -# disable GC in master as early as possible -gc.disable() - -def when_ready(server): - # freeze objects after preloading app - gc.freeze() - print("Objects frozen in perm gen: ", gc.get_freeze_count()) - -def post_fork(server, worker): - # reenable GC on worker - gc.enable() \ No newline at end of file diff --git a/spaces/zhangyd/bingo/src/components/chat-list.tsx b/spaces/zhangyd/bingo/src/components/chat-list.tsx deleted file mode 100644 index 624a78ef0d7be0f1192cf02a81e2e9cf214cb193..0000000000000000000000000000000000000000 --- a/spaces/zhangyd/bingo/src/components/chat-list.tsx +++ /dev/null @@ -1,28 +0,0 @@ -import React from 'react' - -import { Separator } from '@/components/ui/separator' -import { ChatMessage } from '@/components/chat-message' -import { ChatMessageModel } from '@/lib/bots/bing/types' - -export interface ChatList { - messages: ChatMessageModel[] -} - -export function ChatList({ messages }: ChatList) { - if (!messages.length) { - return null - } - - return ( -
          - {messages.map((message, index) => ( - - - {index < messages.length - 1 && ( - - )} - - ))} -
          - ) -} diff --git a/spaces/zhaoys/wfms-kuiwenc/src/components/external-link.tsx b/spaces/zhaoys/wfms-kuiwenc/src/components/external-link.tsx deleted file mode 100644 index 011265f364d5a64a770f4c7e9c65c5ade21d623a..0000000000000000000000000000000000000000 --- a/spaces/zhaoys/wfms-kuiwenc/src/components/external-link.tsx +++ /dev/null @@ -1,30 +0,0 @@ -export function ExternalLink({ - href, - children -}: { - href: string - children: React.ReactNode -}) { - return ( - - {children} - - - ) -} diff --git a/spaces/zideliu/styledrop/timm/models/layers/drop.py b/spaces/zideliu/styledrop/timm/models/layers/drop.py deleted file mode 100644 index 6de9e3f729f7f1ca29d4511f6c64733d3169fbec..0000000000000000000000000000000000000000 --- a/spaces/zideliu/styledrop/timm/models/layers/drop.py +++ /dev/null @@ -1,168 +0,0 @@ -""" DropBlock, DropPath - -PyTorch implementations of DropBlock and DropPath (Stochastic Depth) regularization layers. - -Papers: -DropBlock: A regularization method for convolutional networks (https://arxiv.org/abs/1810.12890) - -Deep Networks with Stochastic Depth (https://arxiv.org/abs/1603.09382) - -Code: -DropBlock impl inspired by two Tensorflow impl that I liked: - - https://github.com/tensorflow/tpu/blob/master/models/official/resnet/resnet_model.py#L74 - - https://github.com/clovaai/assembled-cnn/blob/master/nets/blocks.py - -Hacked together by / Copyright 2020 Ross Wightman -""" -import torch -import torch.nn as nn -import torch.nn.functional as F - - -def drop_block_2d( - x, drop_prob: float = 0.1, block_size: int = 7, gamma_scale: float = 1.0, - with_noise: bool = False, inplace: bool = False, batchwise: bool = False): - """ DropBlock. See https://arxiv.org/pdf/1810.12890.pdf - - DropBlock with an experimental gaussian noise option. This layer has been tested on a few training - runs with success, but needs further validation and possibly optimization for lower runtime impact. - """ - B, C, H, W = x.shape - total_size = W * H - clipped_block_size = min(block_size, min(W, H)) - # seed_drop_rate, the gamma parameter - gamma = gamma_scale * drop_prob * total_size / clipped_block_size ** 2 / ( - (W - block_size + 1) * (H - block_size + 1)) - - # Forces the block to be inside the feature map. - w_i, h_i = torch.meshgrid(torch.arange(W).to(x.device), torch.arange(H).to(x.device)) - valid_block = ((w_i >= clipped_block_size // 2) & (w_i < W - (clipped_block_size - 1) // 2)) & \ - ((h_i >= clipped_block_size // 2) & (h_i < H - (clipped_block_size - 1) // 2)) - valid_block = torch.reshape(valid_block, (1, 1, H, W)).to(dtype=x.dtype) - - if batchwise: - # one mask for whole batch, quite a bit faster - uniform_noise = torch.rand((1, C, H, W), dtype=x.dtype, device=x.device) - else: - uniform_noise = torch.rand_like(x) - block_mask = ((2 - gamma - valid_block + uniform_noise) >= 1).to(dtype=x.dtype) - block_mask = -F.max_pool2d( - -block_mask, - kernel_size=clipped_block_size, # block_size, - stride=1, - padding=clipped_block_size // 2) - - if with_noise: - normal_noise = torch.randn((1, C, H, W), dtype=x.dtype, device=x.device) if batchwise else torch.randn_like(x) - if inplace: - x.mul_(block_mask).add_(normal_noise * (1 - block_mask)) - else: - x = x * block_mask + normal_noise * (1 - block_mask) - else: - normalize_scale = (block_mask.numel() / block_mask.to(dtype=torch.float32).sum().add(1e-7)).to(x.dtype) - if inplace: - x.mul_(block_mask * normalize_scale) - else: - x = x * block_mask * normalize_scale - return x - - -def drop_block_fast_2d( - x: torch.Tensor, drop_prob: float = 0.1, block_size: int = 7, - gamma_scale: float = 1.0, with_noise: bool = False, inplace: bool = False, batchwise: bool = False): - """ DropBlock. See https://arxiv.org/pdf/1810.12890.pdf - - DropBlock with an experimental gaussian noise option. Simplied from above without concern for valid - block mask at edges. - """ - B, C, H, W = x.shape - total_size = W * H - clipped_block_size = min(block_size, min(W, H)) - gamma = gamma_scale * drop_prob * total_size / clipped_block_size ** 2 / ( - (W - block_size + 1) * (H - block_size + 1)) - - if batchwise: - # one mask for whole batch, quite a bit faster - block_mask = torch.rand((1, C, H, W), dtype=x.dtype, device=x.device) < gamma - else: - # mask per batch element - block_mask = torch.rand_like(x) < gamma - block_mask = F.max_pool2d( - block_mask.to(x.dtype), kernel_size=clipped_block_size, stride=1, padding=clipped_block_size // 2) - - if with_noise: - normal_noise = torch.randn((1, C, H, W), dtype=x.dtype, device=x.device) if batchwise else torch.randn_like(x) - if inplace: - x.mul_(1. - block_mask).add_(normal_noise * block_mask) - else: - x = x * (1. - block_mask) + normal_noise * block_mask - else: - block_mask = 1 - block_mask - normalize_scale = (block_mask.numel() / block_mask.to(dtype=torch.float32).sum().add(1e-7)).to(dtype=x.dtype) - if inplace: - x.mul_(block_mask * normalize_scale) - else: - x = x * block_mask * normalize_scale - return x - - -class DropBlock2d(nn.Module): - """ DropBlock. See https://arxiv.org/pdf/1810.12890.pdf - """ - def __init__(self, - drop_prob=0.1, - block_size=7, - gamma_scale=1.0, - with_noise=False, - inplace=False, - batchwise=False, - fast=True): - super(DropBlock2d, self).__init__() - self.drop_prob = drop_prob - self.gamma_scale = gamma_scale - self.block_size = block_size - self.with_noise = with_noise - self.inplace = inplace - self.batchwise = batchwise - self.fast = fast # FIXME finish comparisons of fast vs not - - def forward(self, x): - if not self.training or not self.drop_prob: - return x - if self.fast: - return drop_block_fast_2d( - x, self.drop_prob, self.block_size, self.gamma_scale, self.with_noise, self.inplace, self.batchwise) - else: - return drop_block_2d( - x, self.drop_prob, self.block_size, self.gamma_scale, self.with_noise, self.inplace, self.batchwise) - - -def drop_path(x, drop_prob: float = 0., training: bool = False): - """Drop paths (Stochastic Depth) per sample (when applied in main path of residual blocks). - - This is the same as the DropConnect impl I created for EfficientNet, etc networks, however, - the original name is misleading as 'Drop Connect' is a different form of dropout in a separate paper... - See discussion: https://github.com/tensorflow/tpu/issues/494#issuecomment-532968956 ... I've opted for - changing the layer and argument names to 'drop path' rather than mix DropConnect as a layer name and use - 'survival rate' as the argument. - - """ - if drop_prob == 0. or not training: - return x - keep_prob = 1 - drop_prob - shape = (x.shape[0],) + (1,) * (x.ndim - 1) # work with diff dim tensors, not just 2D ConvNets - random_tensor = keep_prob + torch.rand(shape, dtype=x.dtype, device=x.device) - random_tensor.floor_() # binarize - output = x.div(keep_prob) * random_tensor - return output - - -class DropPath(nn.Module): - """Drop paths (Stochastic Depth) per sample (when applied in main path of residual blocks). - """ - def __init__(self, drop_prob=None): - super(DropPath, self).__init__() - self.drop_prob = drop_prob - - def forward(self, x): - return drop_path(x, self.drop_prob, self.training)