commit 437db0991211f000f0fa6ea127c58c031263d791 Author: Alex Krunch Date: Sat Aug 17 10:21:07 2019 +0200 Project added diff --git a/README.md b/README.md new file mode 100644 index 0000000..6e0a986 --- /dev/null +++ b/README.md @@ -0,0 +1,57 @@ +# AnonIB 3D by Alex Krunch +![Screenshot](https://pbs.twimg.com/media/D9Hjo53W4AUguEy.jpg) +This project is a prototype for a 3D anonymous imageboard. The goal is to use the video game structure an abstraction layer to minimize censorship. Full project running here: https://3dchan.net + +## Software +The project use Angular >6 and PHP > 5. It also use the libraries BabylonJS for the 3D and LazerDB for JSON database. +[BabylonJS](https://github.com/BabylonJS/Babylon.js/tree/master/dist) +[LazerDB](https://github.com/Greg0/Lazer-Database) + +## Installation +**1/ Drag and drop the content at the _/ready2use/_ at the root of your server.** +If you want to add AnonIB 3D to a subfolder, you will need to recompile the Angular project using this build command: +```bash +ng build --prod --base-href=/path-to-subfolder/ +``` + +Add this .htaccess, modify _path-to-sub-folder_, and place it at the root of your sub-folder. +```bash + RewriteEngine on + RewriteCond %{REQUEST_FILENAME} -s [OR] + RewriteCond %{REQUEST_FILENAME} -l [OR] + RewriteCond %{REQUEST_FILENAME} -d + RewriteRule ^.*$ - [NC,L] + RewriteRule ^(srv|user)($|/) - [L] + RewriteRule ^(.*) /path-to-sub-folder/index.html [NC,L] +``` +Don't forget to add the content of _/src_php/_ in _/path-to-sub-folder/srv/_ + + +**2/ Add you own custom map list** +Go to _/php/MapController.php_ and add and suppress a new line. Use only characters allowed in Url for the board name. +```bash +array_push($levelToPlace, new Level("newmap", 15, 13, true, true) ); +``` + +**3/Initialize the admin password + the DB** +Go to _/srv/php/admin.php_ +Type the you password in the field +Click on Set password +To re-init the password go to _/php/password/password.txt_ and erase the file +After this erase database + posts and maps if they already exist and click Init the database + Init Map and Posts + +**4/Access to the admin** +Go to _/admin_ , type your password and click on New user or Existing user. +You know have access to the admin. Click on the Launch the Admin. +Posts is to review , delete or ban user. +Map is to change map. At the top you got a selector to choose the chan of the map, and at the bottom you got a selector for the type of tile you want to use. + +## Project status +I paused the project due to my personal situation. There all you need in the code to activate the image upload, but security flows in it are highly probable. + +## Support +For any question or problem contact me by mail (monsieur.krunch@gmail.com) or on Twitter (https://twitter.com/alexkrunch) + + +## License +[MIT](https://choosealicense.com/licenses/mit/) \ No newline at end of file diff --git a/ready2use/assets/amaz/amaz.json b/ready2use/assets/amaz/amaz.json new file mode 100644 index 0000000..6fb85c4 --- /dev/null +++ b/ready2use/assets/amaz/amaz.json @@ -0,0 +1,58 @@ +[ + { + "url":"https://amzn.to/2VUOerv", + "picture":"https://i.pinimg.com/originals/6b/7c/fa/6b7cfa7ca8acb25025f5bf7ea0056e92.jpg", + "name":"Reçois le livre le très bon \"Sonny 60 years Hells Angels \" chez toi demain!", + "desc":"Un super bouquins d'illustration sur les hells angels des années 60!", + "chan": "alpha", + "loc": "fr" + }, + { + "url":"https://amzn.to/2YSwn6B", + "picture":"./assets/amaz/come_get_it.jpg", + "name":"Get this book \"Come and Take It \" by the guy who 3D printed a 🔫, Cody Wilson!", + "desc":"Come and Take It", + "chan": "alpha", + "loc": "us" + }, + { + "url":"https://amzn.to/2K9wu9U", + "picture":"https://images-na.ssl-images-amazon.com/images/I/41qdCTNSp8L._SX330_BO1,204,203,200_.jpg", + "name":"Get this book \"Radicals \" on crypto anarchism at home tomorow!", + "desc":"An awesome book on crypto anarchism", + "chan": "alpha", + "loc": "us" + }, + { + "url":"https://amzn.to/2EAtkZg", + "picture":"./assets/amaz/dark_net.webp", + "name":"Get the only good book on the \"Dark Net\" exploring the topic in depth.", + "desc":"An awesome book on crypto anarchism", + "chan": "alpha", + "loc": "us" + }, + { + "url":"https://amzn.to/2QsNIAf", + "picture":"./assets/amaz/joker_leto.jpg", + "name":"🤡 to LIVE IN A SOCIETY, get this. At your home tomorrow", + "desc":"Jared Leto's joker", + "chan": "alpha", + "loc": "us" + }, + { + "url":"https://amzn.to/2W9L2NZ", + "picture":"https://images-na.ssl-images-amazon.com/images/I/61znu9JU9IL._UY445_.jpg", + "name":"No GF? Become the GF with this sailor uniform! Get it Tomorow!", + "desc":"A very sailor uniform cosplay.", + "chan": "alpha", + "loc": "us" + }, + { + "url":"https://amzn.to/2QAxzJ7", + "picture":"./assets/amaz/joker_nolan.jpg", + "name":"🤡 13% of the population but 53% of the crime. By Nendoroid", + "desc":"Christopher Nolan's joker", + "chan": "alpha", + "loc": "us" + } +] diff --git a/ready2use/assets/amaz/come_get_it.jpg b/ready2use/assets/amaz/come_get_it.jpg new file mode 100644 index 0000000..5b414f5 Binary files /dev/null and b/ready2use/assets/amaz/come_get_it.jpg differ diff --git a/ready2use/assets/amaz/dark_net.webp b/ready2use/assets/amaz/dark_net.webp new file mode 100644 index 0000000..c965025 Binary files /dev/null and b/ready2use/assets/amaz/dark_net.webp differ diff --git a/ready2use/assets/amaz/joker_leto.jpg b/ready2use/assets/amaz/joker_leto.jpg new file mode 100644 index 0000000..613cc88 Binary files /dev/null and b/ready2use/assets/amaz/joker_leto.jpg differ diff --git a/ready2use/assets/amaz/joker_nolan.jpg b/ready2use/assets/amaz/joker_nolan.jpg new file mode 100644 index 0000000..a0bebea Binary files /dev/null and b/ready2use/assets/amaz/joker_nolan.jpg differ diff --git a/ready2use/assets/img/bg_radi_red.png b/ready2use/assets/img/bg_radi_red.png new file mode 100644 index 0000000..9713b22 Binary files /dev/null and b/ready2use/assets/img/bg_radi_red.png differ diff --git a/ready2use/assets/img/bg_radi_red_dark.png b/ready2use/assets/img/bg_radi_red_dark.png new file mode 100644 index 0000000..ffd9c6d Binary files /dev/null and b/ready2use/assets/img/bg_radi_red_dark.png differ diff --git a/ready2use/assets/img/grid.png b/ready2use/assets/img/grid.png new file mode 100644 index 0000000..128795f Binary files /dev/null and b/ready2use/assets/img/grid.png differ diff --git a/ready2use/assets/img/home_bg.jpeg b/ready2use/assets/img/home_bg.jpeg new file mode 100644 index 0000000..6c18577 Binary files /dev/null and b/ready2use/assets/img/home_bg.jpeg differ diff --git a/ready2use/assets/img/home_bg_dark.png b/ready2use/assets/img/home_bg_dark.png new file mode 100644 index 0000000..9df2e9a Binary files /dev/null and b/ready2use/assets/img/home_bg_dark.png differ diff --git a/ready2use/assets/img/home_bg_dark_lite.png b/ready2use/assets/img/home_bg_dark_lite.png new file mode 100644 index 0000000..2ce3311 Binary files /dev/null and b/ready2use/assets/img/home_bg_dark_lite.png differ diff --git a/ready2use/assets/img/preview.jpeg b/ready2use/assets/img/preview.jpeg new file mode 100644 index 0000000..4f6430a Binary files /dev/null and b/ready2use/assets/img/preview.jpeg differ diff --git a/ready2use/assets/img/tool_bar_bg.png b/ready2use/assets/img/tool_bar_bg.png new file mode 100644 index 0000000..95e0b7d Binary files /dev/null and b/ready2use/assets/img/tool_bar_bg.png differ diff --git a/ready2use/assets/map/alpha.json b/ready2use/assets/map/alpha.json new file mode 100644 index 0000000..c57858d --- /dev/null +++ b/ready2use/assets/map/alpha.json @@ -0,0 +1,139 @@ +{ "height":14, + "layers":[ + { + "data":[2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 2, 2, 1, 1, 2, 1, 1, 1, 1, 1, 2, 1, 193, 1, 1, 2, 1, 1, 2, 2, 1, 1, 2, 1, 1, 1, 1, 1, 2, 1, 2, 1, 1, 2, 1, 1, 2, 2, 1, 1, 2, 1, 1, 1, 1, 1, 2, 1, 2, 1, 1, 2, 1, 1, 2, 2, 1, 1, 2, 1, 1, 1, 1, 1, 2, 1, 2, 1, 1, 2, 1, 1, 2, 2, 1, 1, 2, 2, 2, 193, 2, 2, 2, 2, 2, 1, 1, 2, 1, 1, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 2, 1, 1, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 2, 1, 1, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 194, 1, 1, 221, 1, 1, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2], + "height":14, + "name":"decors1", + "opacity":1, + "type":"tilelayer", + "visible":true, + "width":18, + "x":0, + "y":0 + }, + { + "draworder":"topdown", + "height":0, + "name":"characters", + "objects":[ + { + "height":32, + "id":1, + "name":"playerstart", + "rotation":0, + "type":"", + "visible":true, + "width":32, + "x":189, + "y":144 + }, + { + "height":32, + "id":2, + "name":"anon", + "rotation":0, + "type":"", + "visible":true, + "width":32, + "x":129, + "y":354 + }, + { + "height":32, + "id":3, + "name":"anon", + "rotation":0, + "type":"", + "visible":true, + "width":32, + "x":384, + "y":160 + }, + { + "height":32, + "id":4, + "name":"anon", + "rotation":0, + "type":"", + "visible":true, + "width":32, + "x":417, + "y":160 + }], + "opacity":1, + "type":"objectgroup", + "visible":true, + "width":0, + "x":0, + "y":0 + }, + { + "draworder":"topdown", + "height":0, + "name":"objects", + "objects":[ + { + "height":19, + "id":7, + "name":"dick", + "rotation":0, + "type":"", + "visible":true, + "width":21, + "x":197, + "y":361 + }, + { + "height":19, + "id":8, + "name":"sunglasses", + "rotation":0, + "type":"", + "visible":true, + "width":18, + "x":326, + "y":199 + }], + "opacity":1, + "type":"objectgroup", + "visible":true, + "width":0, + "x":0, + "y":0 + }, + { + "draworder":"topdown", + "height":14, + "name":"gates", + "objects":[ + { + "height":27, + "id":9, + "name":"level2", + "rotation":0, + "type":"", + "visible":true, + "width":30, + "x":47, + "y":9 + }], + "opacity":1, + "type":"objectgroup", + "visible":true, + "width":18, + "x":0, + "y":0 + }], + "nextobjectid":12, + "orientation":"orthogonal", + "renderorder":"left-down", + "tileheight":32, + "tilesets":[ + { + "firstgid":1, + "source":"..\/..\/..\/tilemap\/tile-set-dungeon.tsx" + }], + "tilewidth":32, + "version":1, + "width":18 +} \ No newline at end of file diff --git a/ready2use/assets/map/level2.json b/ready2use/assets/map/level2.json new file mode 100644 index 0000000..013e8bf --- /dev/null +++ b/ready2use/assets/map/level2.json @@ -0,0 +1,94 @@ +{ "height":30, + "layers":[ + { + "data":[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, 1, 1, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, 1, 1, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, 1, 1, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, 1, 1, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 2, 0, 0, 0, 0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1, 1, 1, 1, 2, 1, 1, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, 2, 0, 0, 0, 0, 0, 0, 2, 1, 1, 1, 2, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 2, 1, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 0, 0, 0], + "height":30, + "name":"decors2", + "opacity":1, + "type":"tilelayer", + "visible":true, + "width":30, + "x":0, + "y":0 + }, + { + "draworder":"topdown", + "height":0, + "name":"characters", + "objects":[ + { + "height":32, + "id":1, + "name":"playerstart", + "rotation":0, + "type":"", + "visible":true, + "width":32, + "x":398, + "y":80 + }, + { + "height":32, + "id":2, + "name":"anon", + "rotation":0, + "type":"", + "visible":true, + "width":32, + "x":352, + "y":670 + }, + { + "height":32, + "id":9, + "name":"anon", + "rotation":0, + "type":"", + "visible":true, + "width":32, + "x":355, + "y":607 + }], + "opacity":1, + "type":"objectgroup", + "visible":true, + "width":0, + "x":0, + "y":0 + }, + { + "draworder":"topdown", + "height":0, + "name":"objects", + "objects":[], + "opacity":1, + "type":"objectgroup", + "visible":true, + "width":0, + "x":0, + "y":0 + }], + "nextobjectid":10, + "orientation":"orthogonal", + "renderorder":"left-down", + "tileheight":32, + "tilesets":[ + { + "firstgid":1, + "source":"..\/..\/..\/tilemap\/tile-set-dungeon.tsx" + }], + "tilewidth":32, + "version":1, + "width":30 +} \ No newline at end of file diff --git a/ready2use/assets/map/room1.json b/ready2use/assets/map/room1.json new file mode 100644 index 0000000..8088558 --- /dev/null +++ b/ready2use/assets/map/room1.json @@ -0,0 +1,128 @@ +{ "height":14, + "layers":[ + { + "data":[2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 2, 2, 1, 1, 2, 1, 1, 1, 1, 1, 2, 1, 193, 1, 1, 2, 1, 1, 2, 2, 1, 1, 2, 1, 1, 1, 1, 1, 2, 1, 2, 1, 1, 2, 1, 1, 2, 2, 1, 1, 2, 1, 1, 1, 1, 1, 2, 1, 2, 1, 1, 2, 1, 1, 2, 2, 1, 1, 2, 1, 1, 1, 1, 1, 2, 1, 2, 1, 1, 2, 1, 1, 2, 2, 1, 1, 2, 2, 2, 193, 2, 2, 2, 2, 2, 1, 1, 2, 1, 1, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 2, 1, 1, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 194, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2], + "height":14, + "name":"decors1", + "opacity":1, + "type":"tilelayer", + "visible":true, + "width":18, + "x":0, + "y":0 + }, + { + "draworder":"topdown", + "height":0, + "name":"characters", + "objects":[ + { + "height":32, + "id":1, + "name":"playerstart", + "rotation":0, + "type":"", + "visible":true, + "width":32, + "x":189, + "y":144 + }, + { + "height":32, + "id":3, + "name":"anon", + "rotation":0, + "type":"", + "visible":true, + "width":32, + "x":384, + "y":160 + }, + { + "height":32, + "id":4, + "name":"anon", + "rotation":0, + "type":"", + "visible":true, + "width":32, + "x":417, + "y":160 + }], + "opacity":1, + "type":"objectgroup", + "visible":true, + "width":0, + "x":0, + "y":0 + }, + { + "draworder":"topdown", + "height":0, + "name":"objects", + "objects":[], + "opacity":1, + "type":"objectgroup", + "visible":true, + "width":0, + "x":0, + "y":0 + }, + { + "draworder":"topdown", + "height":0, + "name":"gates", + "objects":[ + { + "height":19, + "id":9, + "name":"room5", + "rotation":0, + "type":"", + "visible":true, + "width":20, + "x":54, + "y":56 + }, + { + "height":18.5, + "id":12, + "name":"room2", + "rotation":0, + "type":"", + "visible":true, + "width":19, + "x":55, + "y":374 + }, + { + "height":20.5, + "id":13, + "name":"room3", + "rotation":0, + "type":"", + "visible":true, + "width":21, + "x":325, + "y":196.5 + }], + "opacity":1, + "type":"objectgroup", + "visible":true, + "width":0, + "x":0, + "y":0 + }], + "nextobjectid":17, + "orientation":"orthogonal", + "renderorder":"left-down", + "tileheight":32, + "tilesets":[ + { + "firstgid":1, + "source":"..\/..\/..\/tilemap\/tile-set-dungeon.tsx" + }], + "tilewidth":32, + "version":1, + "width":18 +} \ No newline at end of file diff --git a/ready2use/assets/map/room2.json b/ready2use/assets/map/room2.json new file mode 100644 index 0000000..9684aec --- /dev/null +++ b/ready2use/assets/map/room2.json @@ -0,0 +1,106 @@ +{ "height":14, + "layers":[ + { + "data":[2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 2, 2, 1, 1, 2, 2, 2, 2, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 2, 2, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 2, 1, 1, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 2, 2, 2, 2, 1, 1, 1, 2, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 2, 2, 1, 1, 1, 1, 2, 2, 1, 1, 1, 1, 2, 1, 1, 1, 66, 1, 2, 2, 1, 1, 1, 2, 2, 2, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 2, 2, 1, 1, 2, 2, 2, 2, 1, 1, 1, 1, 2, 2, 2, 2, 1, 66, 2, 2, 1, 1, 2, 1, 1, 2, 1, 1, 1, 1, 2, 1, 1, 1, 66, 1, 2, 2, 1, 1, 2, 2, 2, 2, 2, 2, 194, 2, 2, 66, 66, 66, 2, 1, 2, 2, 1, 1, 1, 1, 1, 1, 1, 66, 1, 1, 1, 1, 2, 66, 66, 1, 2, 2, 1, 1, 2, 2, 1, 1, 1, 1, 1, 66, 1, 66, 66, 66, 66, 66, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2], + "height":14, + "name":"decors1", + "opacity":1, + "type":"tilelayer", + "visible":true, + "width":18, + "x":0, + "y":0 + }, + { + "draworder":"topdown", + "height":0, + "name":"characters", + "objects":[ + { + "height":22, + "id":17, + "name":"anon", + "rotation":0, + "type":"", + "visible":true, + "width":21, + "x":279, + "y":180 + }], + "opacity":1, + "type":"objectgroup", + "visible":true, + "width":0, + "x":0, + "y":0 + }, + { + "draworder":"topdown", + "height":0, + "name":"objects", + "objects":[ + { + "height":20, + "id":18, + "name":"Upload Ring", + "rotation":0, + "type":"ring", + "visible":true, + "width":21, + "x":280, + "y":218 + }], + "opacity":1, + "type":"objectgroup", + "visible":true, + "width":0, + "x":0, + "y":0 + }, + { + "draworder":"topdown", + "height":0, + "name":"gates", + "objects":[ + { + "height":19, + "id":9, + "name":"room1", + "rotation":0, + "type":"", + "visible":true, + "width":23, + "x":53, + "y":57 + }, + { + "height":15.5, + "id":13, + "name":"room3", + "rotation":0, + "type":"", + "visible":true, + "width":19, + "x":501, + "y":55.5 + }], + "opacity":1, + "type":"objectgroup", + "visible":true, + "width":0, + "x":0, + "y":0 + }], + "nextobjectid":19, + "orientation":"orthogonal", + "renderorder":"left-down", + "tileheight":32, + "tilesets":[ + { + "firstgid":1, + "source":"..\/..\/..\/tilemap\/tile-set-dungeon.tsx" + }], + "tilewidth":32, + "version":1, + "width":18 +} \ No newline at end of file diff --git a/ready2use/assets/map/room3.json b/ready2use/assets/map/room3.json new file mode 100644 index 0000000..67967e9 --- /dev/null +++ b/ready2use/assets/map/room3.json @@ -0,0 +1,95 @@ +{ "height":14, + "layers":[ + { + "data":[2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, 1, 1, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, 1, 1, 1, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 2, 1, 1, 1, 1, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 2, 0, 0, 2, 1, 1, 1, 1, 1, 1, 1, 41, 1, 1, 1, 1, 1, 1, 2, 0, 0, 2, 1, 1, 1, 1, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 2, 0, 0, 2, 1, 1, 1, 1, 2, 0, 0, 2, 1, 1, 1, 1, 1, 1, 2, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 2, 0, 0, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 0, 0, 0, 0, 0, 0, 2, 1, 1, 1, 1, 1, 1, 2, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, 1, 1, 1, 1, 1, 41, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, 1, 1, 1, 1, 1, 2, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0], + "height":14, + "name":"decors1", + "opacity":1, + "type":"tilelayer", + "visible":true, + "width":18, + "x":0, + "y":0 + }, + { + "draworder":"topdown", + "height":0, + "name":"characters", + "objects":[], + "opacity":1, + "type":"objectgroup", + "visible":true, + "width":0, + "x":0, + "y":0 + }, + { + "draworder":"topdown", + "height":0, + "name":"objects", + "objects":[], + "opacity":1, + "type":"objectgroup", + "visible":true, + "width":0, + "x":0, + "y":0 + }, + { + "draworder":"topdown", + "height":0, + "name":"gates", + "objects":[ + { + "height":18, + "id":9, + "name":"room1", + "rotation":0, + "type":"", + "visible":true, + "width":21, + "x":42, + "y":261 + }, + { + "height":19.5, + "id":13, + "name":"room2", + "rotation":0, + "type":"", + "visible":true, + "width":19, + "x":390, + "y":382 + }, + { + "height":19.5, + "id":17, + "name":"room5", + "rotation":0, + "type":"", + "visible":true, + "width":20, + "x":385, + "y":116.5 + }], + "opacity":1, + "type":"objectgroup", + "visible":true, + "width":0, + "x":0, + "y":0 + }], + "nextobjectid":19, + "orientation":"orthogonal", + "renderorder":"left-down", + "tileheight":32, + "tilesets":[ + { + "firstgid":1, + "source":"..\/..\/..\/tilemap\/tile-set-dungeon.tsx" + }], + "tilewidth":32, + "version":1, + "width":18 +} \ No newline at end of file diff --git a/ready2use/assets/map/room5.json b/ready2use/assets/map/room5.json new file mode 100644 index 0000000..7a55974 --- /dev/null +++ b/ready2use/assets/map/room5.json @@ -0,0 +1,84 @@ +{ "height":14, + "layers":[ + { + "data":[2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 0, 0, 0, 0, 0, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 2, 1, 1, 1, 1, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 1, 1, 1, 1, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 1, 2, 2, 0, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 0, 0, 2, 1, 2, 0, 0, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 2, 2, 41, 2, 2, 0, 2, 1, 1, 1, 1, 2, 194, 2, 1, 1, 2, 0, 2, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 1, 1, 1, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 2, 2, 1, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, 1, 1, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2], + "height":14, + "name":"decors1", + "opacity":1, + "type":"tilelayer", + "visible":true, + "width":18, + "x":0, + "y":0 + }, + { + "draworder":"topdown", + "height":0, + "name":"characters", + "objects":[], + "opacity":1, + "type":"objectgroup", + "visible":true, + "width":0, + "x":0, + "y":0 + }, + { + "draworder":"topdown", + "height":0, + "name":"objects", + "objects":[], + "opacity":1, + "type":"objectgroup", + "visible":true, + "width":0, + "x":0, + "y":0 + }, + { + "draworder":"topdown", + "height":0, + "name":"gates", + "objects":[ + { + "height":19, + "id":9, + "name":"room1", + "rotation":0, + "type":"", + "visible":true, + "width":20, + "x":54, + "y":373 + }, + { + "height":17.5, + "id":13, + "name":"room3", + "rotation":0, + "type":"", + "visible":true, + "width":20, + "x":482, + "y":361 + }], + "opacity":1, + "type":"objectgroup", + "visible":true, + "width":0, + "x":0, + "y":0 + }], + "nextobjectid":19, + "orientation":"orthogonal", + "renderorder":"left-down", + "tileheight":32, + "tilesets":[ + { + "firstgid":1, + "source":"..\/..\/..\/tilemap\/tile-set-dungeon.tsx" + }], + "tilewidth":32, + "version":1, + "width":18 +} \ No newline at end of file diff --git a/ready2use/assets/textures/404.png b/ready2use/assets/textures/404.png new file mode 100644 index 0000000..153682d Binary files /dev/null and b/ready2use/assets/textures/404.png differ diff --git a/ready2use/assets/textures/anon_sprite.png b/ready2use/assets/textures/anon_sprite.png new file mode 100644 index 0000000..6456981 Binary files /dev/null and b/ready2use/assets/textures/anon_sprite.png differ diff --git a/ready2use/assets/textures/anon_sprite_dead.png b/ready2use/assets/textures/anon_sprite_dead.png new file mode 100644 index 0000000..917ec55 Binary files /dev/null and b/ready2use/assets/textures/anon_sprite_dead.png differ diff --git a/ready2use/assets/textures/cardboard_text.png b/ready2use/assets/textures/cardboard_text.png new file mode 100644 index 0000000..ff7e761 Binary files /dev/null and b/ready2use/assets/textures/cardboard_text.png differ diff --git a/ready2use/assets/textures/concrete_text.jpg b/ready2use/assets/textures/concrete_text.jpg new file mode 100644 index 0000000..65643bd Binary files /dev/null and b/ready2use/assets/textures/concrete_text.jpg differ diff --git a/ready2use/assets/textures/floor_dalle_text.jpg b/ready2use/assets/textures/floor_dalle_text.jpg new file mode 100644 index 0000000..70ed18e Binary files /dev/null and b/ready2use/assets/textures/floor_dalle_text.jpg differ diff --git a/ready2use/assets/textures/grass_text.jpg b/ready2use/assets/textures/grass_text.jpg new file mode 100644 index 0000000..ebbc29a Binary files /dev/null and b/ready2use/assets/textures/grass_text.jpg differ diff --git a/ready2use/assets/textures/panel_donations_text.png b/ready2use/assets/textures/panel_donations_text.png new file mode 100644 index 0000000..580da20 Binary files /dev/null and b/ready2use/assets/textures/panel_donations_text.png differ diff --git a/ready2use/assets/textures/panel_thanks_text.png b/ready2use/assets/textures/panel_thanks_text.png new file mode 100644 index 0000000..013ba26 Binary files /dev/null and b/ready2use/assets/textures/panel_thanks_text.png differ diff --git a/ready2use/assets/textures/prota_avatar.png b/ready2use/assets/textures/prota_avatar.png new file mode 100644 index 0000000..ca6f5c1 Binary files /dev/null and b/ready2use/assets/textures/prota_avatar.png differ diff --git a/ready2use/assets/textures/skybox2_nx.jpg b/ready2use/assets/textures/skybox2_nx.jpg new file mode 100644 index 0000000..25c9e83 Binary files /dev/null and b/ready2use/assets/textures/skybox2_nx.jpg differ diff --git a/ready2use/assets/textures/skybox2_ny.jpg b/ready2use/assets/textures/skybox2_ny.jpg new file mode 100644 index 0000000..8f52b62 Binary files /dev/null and b/ready2use/assets/textures/skybox2_ny.jpg differ diff --git a/ready2use/assets/textures/skybox2_nz.jpg b/ready2use/assets/textures/skybox2_nz.jpg new file mode 100644 index 0000000..4a874c4 Binary files /dev/null and b/ready2use/assets/textures/skybox2_nz.jpg differ diff --git a/ready2use/assets/textures/skybox2_px.jpg b/ready2use/assets/textures/skybox2_px.jpg new file mode 100644 index 0000000..bdb8c54 Binary files /dev/null and b/ready2use/assets/textures/skybox2_px.jpg differ diff --git a/ready2use/assets/textures/skybox2_py.jpg b/ready2use/assets/textures/skybox2_py.jpg new file mode 100644 index 0000000..18d3eab Binary files /dev/null and b/ready2use/assets/textures/skybox2_py.jpg differ diff --git a/ready2use/assets/textures/skybox2_pz.jpg b/ready2use/assets/textures/skybox2_pz.jpg new file mode 100644 index 0000000..00b86a9 Binary files /dev/null and b/ready2use/assets/textures/skybox2_pz.jpg differ diff --git a/ready2use/assets/textures/skybox_nx.jpg b/ready2use/assets/textures/skybox_nx.jpg new file mode 100644 index 0000000..8670ad3 Binary files /dev/null and b/ready2use/assets/textures/skybox_nx.jpg differ diff --git a/ready2use/assets/textures/skybox_ny.jpg b/ready2use/assets/textures/skybox_ny.jpg new file mode 100644 index 0000000..a2dc572 Binary files /dev/null and b/ready2use/assets/textures/skybox_ny.jpg differ diff --git a/ready2use/assets/textures/skybox_nz.jpg b/ready2use/assets/textures/skybox_nz.jpg new file mode 100644 index 0000000..41bdb7c Binary files /dev/null and b/ready2use/assets/textures/skybox_nz.jpg differ diff --git a/ready2use/assets/textures/skybox_px.jpg b/ready2use/assets/textures/skybox_px.jpg new file mode 100644 index 0000000..8293ee9 Binary files /dev/null and b/ready2use/assets/textures/skybox_px.jpg differ diff --git a/ready2use/assets/textures/skybox_py.jpg b/ready2use/assets/textures/skybox_py.jpg new file mode 100644 index 0000000..16cd7e6 Binary files /dev/null and b/ready2use/assets/textures/skybox_py.jpg differ diff --git a/ready2use/assets/textures/skybox_pz.jpg b/ready2use/assets/textures/skybox_pz.jpg new file mode 100644 index 0000000..80bb4c5 Binary files /dev/null and b/ready2use/assets/textures/skybox_pz.jpg differ diff --git a/ready2use/assets/textures/volcanic_text.jpg b/ready2use/assets/textures/volcanic_text.jpg new file mode 100644 index 0000000..c39b528 Binary files /dev/null and b/ready2use/assets/textures/volcanic_text.jpg differ diff --git a/ready2use/favicon.ico b/ready2use/favicon.ico new file mode 100644 index 0000000..46ade0c Binary files /dev/null and b/ready2use/favicon.ico differ diff --git a/ready2use/index.html b/ready2use/index.html new file mode 100644 index 0000000..0f50813 --- /dev/null +++ b/ready2use/index.html @@ -0,0 +1,24 @@ + + + + + + AnonIB💀3D + + + + + + + + + + +
+
+ +
+
+ + + diff --git a/ready2use/main.js b/ready2use/main.js new file mode 100644 index 0000000..82c3598 --- /dev/null +++ b/ready2use/main.js @@ -0,0 +1,5369 @@ +(window["webpackJsonp"] = window["webpackJsonp"] || []).push([["main"],{ + +/***/ "./src/$$_lazy_route_resource lazy recursive": +/*!**********************************************************!*\ + !*** ./src/$$_lazy_route_resource lazy namespace object ***! + \**********************************************************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +function webpackEmptyAsyncContext(req) { + // Here Promise.resolve().then() is used instead of new Promise() to prevent + // uncaught exception popping up in devtools + return Promise.resolve().then(function() { + var e = new Error("Cannot find module '" + req + "'"); + e.code = 'MODULE_NOT_FOUND'; + throw e; + }); +} +webpackEmptyAsyncContext.keys = function() { return []; }; +webpackEmptyAsyncContext.resolve = webpackEmptyAsyncContext; +module.exports = webpackEmptyAsyncContext; +webpackEmptyAsyncContext.id = "./src/$$_lazy_route_resource lazy recursive"; + +/***/ }), + +/***/ "./src/app/app.component.css": +/*!***********************************!*\ + !*** ./src/app/app.component.css ***! + \***********************************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +module.exports = "" + +/***/ }), + +/***/ "./src/app/app.component.html": +/*!************************************!*\ + !*** ./src/app/app.component.html ***! + \************************************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +module.exports = "\n\n\n" + +/***/ }), + +/***/ "./src/app/app.component.ts": +/*!**********************************!*\ + !*** ./src/app/app.component.ts ***! + \**********************************/ +/*! exports provided: AppComponent */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AppComponent", function() { return AppComponent; }); +/* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm5/core.js"); +var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; + +var AppComponent = /** @class */ (function () { + function AppComponent() { + this.title = 'prota-angular'; + } + AppComponent = __decorate([ + Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Component"])({ + selector: 'app-root', + template: __webpack_require__(/*! ./app.component.html */ "./src/app/app.component.html"), + styles: [__webpack_require__(/*! ./app.component.css */ "./src/app/app.component.css")] + }) + ], AppComponent); + return AppComponent; +}()); + + + +/***/ }), + +/***/ "./src/app/app.module.ts": +/*!*******************************!*\ + !*** ./src/app/app.module.ts ***! + \*******************************/ +/*! exports provided: AppModule */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AppModule", function() { return AppModule; }); +/* harmony import */ var _angular_platform_browser__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @angular/platform-browser */ "./node_modules/@angular/platform-browser/fesm5/platform-browser.js"); +/* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm5/core.js"); +/* harmony import */ var _angular_router__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @angular/router */ "./node_modules/@angular/router/fesm5/router.js"); +/* harmony import */ var _angular_forms__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @angular/forms */ "./node_modules/@angular/forms/fesm5/forms.js"); +/* harmony import */ var _angular_common_http__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @angular/common/http */ "./node_modules/@angular/common/fesm5/http.js"); +/* harmony import */ var _app_component__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./app.component */ "./src/app/app.component.ts"); +/* harmony import */ var _components_home_home_component__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./components/home/home.component */ "./src/app/components/home/home.component.ts"); +/* harmony import */ var _components_gl_view_gl_view_component__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./components/gl-view/gl-view.component */ "./src/app/components/gl-view/gl-view.component.ts"); +/* harmony import */ var _components_posting_ui_posting_ui_component__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./components/posting-ui/posting-ui.component */ "./src/app/components/posting-ui/posting-ui.component.ts"); +/* harmony import */ var _components_post_viewer_ui_post_viewer_ui_component__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./components/post-viewer-ui/post-viewer-ui.component */ "./src/app/components/post-viewer-ui/post-viewer-ui.component.ts"); +/* harmony import */ var _components_media_display_media_display_component__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./components/media-display/media-display.component */ "./src/app/components/media-display/media-display.component.ts"); +/* harmony import */ var _components_pin_post_ui_pin_post_ui_component__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./components/pin-post-ui/pin-post-ui.component */ "./src/app/components/pin-post-ui/pin-post-ui.component.ts"); +/* harmony import */ var _components_painting_ui_painting_ui_component__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./components/painting-ui/painting-ui.component */ "./src/app/components/painting-ui/painting-ui.component.ts"); +/* harmony import */ var _components_cmd_ui_cmd_ui_component__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./components/cmd-ui/cmd-ui.component */ "./src/app/components/cmd-ui/cmd-ui.component.ts"); +/* harmony import */ var _components_login_login_component__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./components/login/login.component */ "./src/app/components/login/login.component.ts"); +/* harmony import */ var _interfaces_player_interface_player_interface_component__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./interfaces/player-interface/player-interface.component */ "./src/app/interfaces/player-interface/player-interface.component.ts"); +/* harmony import */ var _components_admin_post_admin_post_component__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./components/admin-post/admin-post.component */ "./src/app/components/admin-post/admin-post.component.ts"); +/* harmony import */ var _components_admin_map_admin_map_component__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./components/admin-map/admin-map.component */ "./src/app/components/admin-map/admin-map.component.ts"); +/* harmony import */ var _components_tile_edit_tile_edit_component__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./components/tile-edit/tile-edit.component */ "./src/app/components/tile-edit/tile-edit.component.ts"); +/* harmony import */ var ngx_twitter_timeline__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ngx-twitter-timeline */ "./node_modules/ngx-twitter-timeline/fesm5/ngx-twitter-timeline.js"); +/* harmony import */ var _components_phone_poster_phone_poster_component__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ./components/phone-poster/phone-poster.component */ "./src/app/components/phone-poster/phone-poster.component.ts"); +/* harmony import */ var angularx_qrcode__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! angularx-qrcode */ "./node_modules/angularx-qrcode/dist/index.js"); +/* harmony import */ var _components_chat_view_chat_view_component__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ./components/chat-view/chat-view.component */ "./src/app/components/chat-view/chat-view.component.ts"); +/* harmony import */ var _components_info_view_info_view_component__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! ./components/info-view/info-view.component */ "./src/app/components/info-view/info-view.component.ts"); +/* harmony import */ var ngx_pagination__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(/*! ngx-pagination */ "./node_modules/ngx-pagination/dist/ngx-pagination.js"); +/* harmony import */ var ngx_device_detector__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(/*! ngx-device-detector */ "./node_modules/ngx-device-detector/ngx-device-detector.umd.js"); +/* harmony import */ var ngx_device_detector__WEBPACK_IMPORTED_MODULE_25___default = /*#__PURE__*/__webpack_require__.n(ngx_device_detector__WEBPACK_IMPORTED_MODULE_25__); +/* harmony import */ var _components_player_ui_player_ui_component__WEBPACK_IMPORTED_MODULE_26__ = __webpack_require__(/*! ./components/player-ui/player-ui.component */ "./src/app/components/player-ui/player-ui.component.ts"); +/* harmony import */ var _components_ad_post_ui_ad_post_ui_component__WEBPACK_IMPORTED_MODULE_27__ = __webpack_require__(/*! ./components/ad-post-ui/ad-post-ui.component */ "./src/app/components/ad-post-ui/ad-post-ui.component.ts"); +var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; + + + + + + + + + + + + + + + + + + + + + + + + + + + + +var appRoutes = [ + { path: '', + pathMatch: 'full', + component: _components_home_home_component__WEBPACK_IMPORTED_MODULE_6__["HomeComponent"] + }, + { path: 'admin-post', component: _components_admin_post_admin_post_component__WEBPACK_IMPORTED_MODULE_16__["AdminPostComponent"] }, + { path: 'admin-map', component: _components_admin_map_admin_map_component__WEBPACK_IMPORTED_MODULE_17__["AdminMapComponent"] }, + //{ path: 'home', component: HomeComponent }, + { path: 'admin', component: _components_login_login_component__WEBPACK_IMPORTED_MODULE_14__["LoginComponent"] }, + { path: 'gl-view', component: _components_gl_view_gl_view_component__WEBPACK_IMPORTED_MODULE_7__["GlViewComponent"] }, + { path: 'ch/:map', component: _components_gl_view_gl_view_component__WEBPACK_IMPORTED_MODULE_7__["GlViewComponent"], }, + { path: 'painting', component: _components_painting_ui_painting_ui_component__WEBPACK_IMPORTED_MODULE_12__["PaintingUiComponent"] }, + { path: 'phone-poster/:id/:key/:canvas', component: _components_phone_poster_phone_poster_component__WEBPACK_IMPORTED_MODULE_20__["PhonePosterComponent"] }, +]; +var AppModule = /** @class */ (function () { + function AppModule() { + } + AppModule = __decorate([ + Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["NgModule"])({ + declarations: [ + _app_component__WEBPACK_IMPORTED_MODULE_5__["AppComponent"], + _components_home_home_component__WEBPACK_IMPORTED_MODULE_6__["HomeComponent"], + _components_gl_view_gl_view_component__WEBPACK_IMPORTED_MODULE_7__["GlViewComponent"], + _components_posting_ui_posting_ui_component__WEBPACK_IMPORTED_MODULE_8__["PostingUIComponent"], + _components_post_viewer_ui_post_viewer_ui_component__WEBPACK_IMPORTED_MODULE_9__["PostViewerUiComponent"], + _components_media_display_media_display_component__WEBPACK_IMPORTED_MODULE_10__["MediaDisplayComponent"], + _components_pin_post_ui_pin_post_ui_component__WEBPACK_IMPORTED_MODULE_11__["PinPostUiComponent"], + _components_painting_ui_painting_ui_component__WEBPACK_IMPORTED_MODULE_12__["PaintingUiComponent"], + _components_cmd_ui_cmd_ui_component__WEBPACK_IMPORTED_MODULE_13__["CmdUiComponent"], + _components_login_login_component__WEBPACK_IMPORTED_MODULE_14__["LoginComponent"], + _interfaces_player_interface_player_interface_component__WEBPACK_IMPORTED_MODULE_15__["PlayerInterfaceComponent"], + _components_admin_post_admin_post_component__WEBPACK_IMPORTED_MODULE_16__["AdminPostComponent"], + _components_admin_map_admin_map_component__WEBPACK_IMPORTED_MODULE_17__["AdminMapComponent"], + _components_tile_edit_tile_edit_component__WEBPACK_IMPORTED_MODULE_18__["TileEditComponent"], + _components_phone_poster_phone_poster_component__WEBPACK_IMPORTED_MODULE_20__["PhonePosterComponent"], + _components_chat_view_chat_view_component__WEBPACK_IMPORTED_MODULE_22__["ChatViewComponent"], + _components_info_view_info_view_component__WEBPACK_IMPORTED_MODULE_23__["InfoViewComponent"], + _components_player_ui_player_ui_component__WEBPACK_IMPORTED_MODULE_26__["PlayerUiComponent"], + _components_ad_post_ui_ad_post_ui_component__WEBPACK_IMPORTED_MODULE_27__["AdPostUiComponent"] + ], + imports: [ + angularx_qrcode__WEBPACK_IMPORTED_MODULE_21__["QRCodeModule"], + _angular_platform_browser__WEBPACK_IMPORTED_MODULE_0__["BrowserModule"], + ngx_pagination__WEBPACK_IMPORTED_MODULE_24__["NgxPaginationModule"], + ngx_device_detector__WEBPACK_IMPORTED_MODULE_25__["DeviceDetectorModule"].forRoot(), + _angular_forms__WEBPACK_IMPORTED_MODULE_3__["FormsModule"], + _angular_common_http__WEBPACK_IMPORTED_MODULE_4__["HttpClientModule"], + ngx_twitter_timeline__WEBPACK_IMPORTED_MODULE_19__["NgxTwitterTimelineModule"], + _angular_router__WEBPACK_IMPORTED_MODULE_2__["RouterModule"].forRoot(appRoutes) + ], + providers: [], + bootstrap: [_app_component__WEBPACK_IMPORTED_MODULE_5__["AppComponent"]] + }) + ], AppModule); + return AppModule; +}()); + + + +/***/ }), + +/***/ "./src/app/components/ad-post-ui/ad-post-ui.component.css": +/*!****************************************************************!*\ + !*** ./src/app/components/ad-post-ui/ad-post-ui.component.css ***! + \****************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +module.exports = "#container{\n border-style : solid;\n border-width : 2px;\n border-color : rgb(60, 68, 61);\n border-radius : 3px;\n margin: 8px\n}\n\n#close-btn{\n position: absolute;\n top: 16px;\n right: 16px;\n cursor: pointer;\n}\n\n#desc{\n \n background-image: url(\"/assets/img/tool_bar_bg.png\");\n background-repeat: repeat-x;\n background-position: bottom;\n position: absolute;\n bottom: 0px;\n text-align: center;\n margin: 8px;\n right: 0px;\n color: aliceblue;\n padding-top: 20px;\n padding-right: 8px;\n padding-left: px;\n}\n\ndiv {\n max-width: 250px;\n max-height: 250px;\n overflow: hidden;\n}\n\nimg{\n max-width: 250px;\n max-height: 350px;\n}" + +/***/ }), + +/***/ "./src/app/components/ad-post-ui/ad-post-ui.component.html": +/*!*****************************************************************!*\ + !*** ./src/app/components/ad-post-ui/ad-post-ui.component.html ***! + \*****************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +module.exports = "
\n
\n\n
\n
\n {{currentDesc}} 📦🔥\n
\n
\n
\n
\n" + +/***/ }), + +/***/ "./src/app/components/ad-post-ui/ad-post-ui.component.ts": +/*!***************************************************************!*\ + !*** ./src/app/components/ad-post-ui/ad-post-ui.component.ts ***! + \***************************************************************/ +/*! exports provided: AdPostUiComponent */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AdPostUiComponent", function() { return AdPostUiComponent; }); +/* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm5/core.js"); +/* harmony import */ var src_app_services_chan_web_service__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! src/app/services/chan-web.service */ "./src/app/services/chan-web.service.ts"); +var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +var __metadata = (undefined && undefined.__metadata) || function (k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); +}; + + +var AdPostUiComponent = /** @class */ (function () { + function AdPostUiComponent(chanWebService) { + this.chanWebService = chanWebService; + this.country = "us"; + this.adIndex = 0; + this.close = new _angular_core__WEBPACK_IMPORTED_MODULE_0__["EventEmitter"](); + } + AdPostUiComponent.prototype.ngOnInit = function () { + var _this = this; + this.lang = navigator.language; + /* + if(this.lang.toLowerCase().indexOf("us")> -1){ + this.country = "us"; + } else if(this.lang.toLowerCase().indexOf("fr")> -1){ + this.country = "fr"; + }*/ + //Map made! We load the money maker + this.chanWebService.getAds().subscribe(function (ads) { + //console.log(ads); + _this.adsFiltered = new Array(); + for (var a = 0; a < ads.length; a++) { + if (ads[a].loc === _this.country) { + _this.adsFiltered.push(ads[a]); + } + } + console.log(_this.adsFiltered); + _this.adIndex = Math.floor(Math.random() * Math.floor(_this.adsFiltered.length)); + _this.displayAd(); + /*this.myInterval = setInterval(()=>{ + this.updateAd(); + }, 15000);*/ + }); + }; + AdPostUiComponent.prototype.displayAd = function () { + var ad = this.adsFiltered[this.adIndex]; + this.currentURL = ad.url; + this.currentImg = ad.picture; + this.currentDesc = ad.name; + }; + AdPostUiComponent.prototype.updateAd = function () { + this.adIndex++; + console.log(this.adsFiltered); + if (this.adIndex >= this.adsFiltered.length) + this.adIndex = 0; + if (this.adsFiltered.length > 0) + this.displayAd(); + }; + AdPostUiComponent.prototype.gotTo = function (url_) { + window.open(url_, '_blank'); + }; + __decorate([ + Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Output"])(), + __metadata("design:type", Object) + ], AdPostUiComponent.prototype, "close", void 0); + AdPostUiComponent = __decorate([ + Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Component"])({ + selector: 'app-ad-post-ui', + template: __webpack_require__(/*! ./ad-post-ui.component.html */ "./src/app/components/ad-post-ui/ad-post-ui.component.html"), + styles: [__webpack_require__(/*! ./ad-post-ui.component.css */ "./src/app/components/ad-post-ui/ad-post-ui.component.css")] + }), + __metadata("design:paramtypes", [src_app_services_chan_web_service__WEBPACK_IMPORTED_MODULE_1__["ChanWebService"]]) + ], AdPostUiComponent); + return AdPostUiComponent; +}()); + + + +/***/ }), + +/***/ "./src/app/components/admin-map/admin-map.component.css": +/*!**************************************************************!*\ + !*** ./src/app/components/admin-map/admin-map.component.css ***! + \**************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +module.exports = ".container{\n height: 100%;\n}\n\n.post-viewer-ui-message{\n\n position: relative;\n top:8px;\n bottom:18px;\n overflow : scroll;\n height: 85%;\n width: 100%;\n left: 0;\n right: 0;\n margin: auto;\n padding : 10px;\n background: rgb(247, 189, 203);\n border-style: solid;\n border-width: 1px;\n border-color: rgb(181, 134, 145);\n border-radius: 5px;\n}\n\n.ascii-art {\n font-family: monospace;\n font-family: \"Lucida Console\", monospace;\n letter-spacing: 0.2em;\n line-height: 0.8em;\n}" + +/***/ }), + +/***/ "./src/app/components/admin-map/admin-map.component.html": +/*!***************************************************************!*\ + !*** ./src/app/components/admin-map/admin-map.component.html ***! + \***************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +module.exports = "
\n Posts - Maps - Go Game!\n
\n \n
\n \n \n \n
\n ----------------------------------
\n
\n Map name: {{selectedMap.name}} ({{selectedMap.x}}, {{selectedMap.y}})
\n Map key: {{selectedMap.key}}
\n Map width: {{selectedMap.width}}
\n Map height: {{selectedMap.height}}
\n ----------------------------------
\n Door North
\n Door East
\n Door South
\n Door West
\n ----------------------------------
\n
\n \n \n \n \n
\n\n \n \n \n
\n\n
\n There's NOTHING here! ({{currentX}}, {{currentY}})\n
\n
\n
" + +/***/ }), + +/***/ "./src/app/components/admin-map/admin-map.component.ts": +/*!*************************************************************!*\ + !*** ./src/app/components/admin-map/admin-map.component.ts ***! + \*************************************************************/ +/*! exports provided: AdminMapComponent */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AdminMapComponent", function() { return AdminMapComponent; }); +/* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm5/core.js"); +/* harmony import */ var src_app_services_chan_web_service__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! src/app/services/chan-web.service */ "./src/app/services/chan-web.service.ts"); +var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +var __metadata = (undefined && undefined.__metadata) || function (k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); +}; + + +var AdminMapComponent = /** @class */ (function () { + function AdminMapComponent(chanWebService) { + this.chanWebService = chanWebService; + this.selectedTileVal = 0; + this.mapData = []; + this.mapDataLines = []; + } + AdminMapComponent.prototype.ngOnInit = function () { + var _this = this; + this.chanWebService.getAllMaps().subscribe(function (data_) { + _this.maps = data_.result; + if (_this.maps.length > 0) { + //We looking for the alpha map + _this.maps.forEach(function (map) { + if (map.name === "alpha") { + _this.selectedMapKey = map.key; + _this.onChangeMap(_this.selectedMapKey); + } + }); + } + }); + this.chanWebService.getAllTiles().subscribe(function (data_) { + _this.allTiles = data_.result; + _this.selectedTileVal = _this.allTiles[0].value; + }); + }; + AdminMapComponent.prototype.onChangeMap = function (key_) { + var _this = this; + this.selectedMapKey = key_; + this.maps.forEach(function (map) { + if (map.key == key_) { + _this.selectedMap = map; + _this.currentX = _this.selectedMap.x; + _this.currentY = _this.selectedMap.y; + //Parsing the map datas + _this.mapData = _this.selectedMap.level_data.split(","); + _this.mapDataLines = []; + var n = 0; + for (var h = 0; h < _this.selectedMap.height; h++) { + var mapDataWidth = []; + for (var w = 0; w < _this.selectedMap.width; w++) { + mapDataWidth.push(_this.mapData[n]); + n++; + } + _this.mapDataLines.push(mapDataWidth); + } + } + }); + }; + AdminMapComponent.prototype.onChangeTileBrush = function (val_) { + this.selectedTileVal = val_; + }; + AdminMapComponent.prototype.onChangeTileAt = function (x_, y_) { + console.log(this.selectedTileVal + "," + x_ + "," + y_); + var lineTemp = this.mapDataLines[y_]; + lineTemp[x_] = this.selectedTileVal.toString(); + this.mapDataLines[y_] = lineTemp; + console.log(this.mapDataLines); + }; + AdminMapComponent.prototype.saveMap = function () { + var tempNewData = ""; + for (var y = 0; y < this.mapDataLines.length; y++) { + var line = this.mapDataLines[y]; + for (var x = 0; x < line.length; x++) { + tempNewData = tempNewData + line[x] + ","; + } + } + this.selectedMap.level_data = tempNewData; + console.log(this.selectedMap); + this.chanWebService.saveMapModel(this.selectedMap).subscribe(function (data_) { + alert(JSON.stringify(data_)); + }); + }; + AdminMapComponent.prototype.moveMap = function (dir_) { + var _this = this; + switch (dir_) { + //North + case 0: + this.currentY--; + break; + //East + case 1: + this.currentX++; + break; + //South + case 2: + this.currentY++; + break; + //West + case 3: + this.currentX--; + break; + } + this.selectedMap = null; + this.maps.forEach(function (map) { + if (map.x == _this.currentX && map.y == _this.currentY) { + _this.onChangeMap(map.key); + } + }); + }; + AdminMapComponent = __decorate([ + Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Component"])({ + selector: 'app-admin-map', + template: __webpack_require__(/*! ./admin-map.component.html */ "./src/app/components/admin-map/admin-map.component.html"), + styles: [__webpack_require__(/*! ./admin-map.component.css */ "./src/app/components/admin-map/admin-map.component.css")] + }), + __metadata("design:paramtypes", [src_app_services_chan_web_service__WEBPACK_IMPORTED_MODULE_1__["ChanWebService"]]) + ], AdminMapComponent); + return AdminMapComponent; +}()); + + + +/***/ }), + +/***/ "./src/app/components/admin-post/admin-post.component.css": +/*!****************************************************************!*\ + !*** ./src/app/components/admin-post/admin-post.component.css ***! + \****************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +module.exports = ".container{\n height: 100%;\n}\n\n.post-viewer-ui-message{\n\n position: relative;\n top:8px;\n bottom:18px;\n overflow : scroll;\n height: 85%;\n /*max-width: 450px;*/\n width: 100%;\n left: 0;\n right: 0;\n margin: auto;\n padding : 10px;\n background: rgb(247, 189, 203);\n border-style: solid;\n border-width: 1px;\n border-color: rgb(181, 134, 145);\n border-radius: 5px;\n}\n\nimg{\n max-width:150px;\n max-height:150px;\n}\n\n/*\ndiv {\n margin-bottom: 8px;\n}*/\n\n::ng-deep .img-preview img, .img-preview video, .img-preview iframe, .img-preview audio {\n max-width: 600px;\n max-height: 400px;\n}" + +/***/ }), + +/***/ "./src/app/components/admin-post/admin-post.component.html": +/*!*****************************************************************!*\ + !*** ./src/app/components/admin-post/admin-post.component.html ***! + \*****************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +module.exports = "
\n Posts - Maps - Go Game!\n
\n\n --------- \n
\n N° {{post.id}} 👌
\n Player: {{post.player_id}}
\n IP: {{post.player_ip}}
\n CHAN: {{post.map_key}}
\n\n \n Url: {{post.url}}
\n Message: {{post.message}}
\n \n
\n
\n Thanks, post has been succesfuly DELETED!\n
\n
\n\n
\n\n
\n
\n
\n
\n -----------------------------------------
\n
\n \n
\n
\n" + +/***/ }), + +/***/ "./src/app/components/admin-post/admin-post.component.ts": +/*!***************************************************************!*\ + !*** ./src/app/components/admin-post/admin-post.component.ts ***! + \***************************************************************/ +/*! exports provided: AdminPostComponent */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AdminPostComponent", function() { return AdminPostComponent; }); +/* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm5/core.js"); +/* harmony import */ var src_app_services_chan_web_service__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! src/app/services/chan-web.service */ "./src/app/services/chan-web.service.ts"); +var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +var __metadata = (undefined && undefined.__metadata) || function (k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); +}; + + +var AdminPostComponent = /** @class */ (function () { + function AdminPostComponent(chanWebService) { + this.chanWebService = chanWebService; + this.posts = []; + this.valToDelete = ""; + this.p = 1; + } + AdminPostComponent.prototype.ngOnInit = function () { + this.updatePost(); + }; + AdminPostComponent.prototype.updatePost = function () { + var _this = this; + this.chanWebService.getAllPost().subscribe(function (data_) { + _this.posts = data_.result.reverse(); + }); + }; + AdminPostComponent.prototype.deletePost = function (postModel_) { + var _this = this; + this.postToDelete = postModel_; + console.log("this.postToDelete:" + this.postToDelete); + this.chanWebService.deletePost(postModel_.id, postModel_.map_key).subscribe( + //Data success + function (data) { + //alert(JSON.stringify(data)); + //this.updatePost(); + _this.posts.find(function (post_) { + return (post_.id == _this.postToDelete.id); + }).was_deleted = true; + }); + }; + AdminPostComponent.prototype.deleteVal = function () { + var _this = this; + this.chanWebService.deletePostForVal(this.valToDelete).subscribe( + //Data success + function (data) { + alert(JSON.stringify(data)); + _this.updatePost(); + }); + }; + AdminPostComponent.prototype.setBan = function (id_) { + var _this = this; + this.chanWebService.setBan(id_).subscribe( + //Data success + function (data) { + alert(JSON.stringify(data)); + _this.updatePost(); + }); + }; + AdminPostComponent.prototype.canonPost = function (id_, thread_) { + var _this = this; + this.chanWebService.canonPost(id_, thread_).subscribe( + //Data success + function (data) { + alert(JSON.stringify(data)); + _this.updatePost(); + }); + }; + AdminPostComponent.prototype.banPost = function () { + }; + AdminPostComponent = __decorate([ + Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Component"])({ + selector: 'app-admin-post', + template: __webpack_require__(/*! ./admin-post.component.html */ "./src/app/components/admin-post/admin-post.component.html"), + styles: [__webpack_require__(/*! ./admin-post.component.css */ "./src/app/components/admin-post/admin-post.component.css")] + }), + __metadata("design:paramtypes", [src_app_services_chan_web_service__WEBPACK_IMPORTED_MODULE_1__["ChanWebService"]]) + ], AdminPostComponent); + return AdminPostComponent; +}()); + + + +/***/ }), + +/***/ "./src/app/components/chat-view/chat-view.component.css": +/*!**************************************************************!*\ + !*** ./src/app/components/chat-view/chat-view.component.css ***! + \**************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +module.exports = "#container{\n display:block;\n /*height: 255px;*/\n width: 340px;\n color:white;\n padding: 8px;\n}\n\n.bgChatUI{\n margin: 4px; \n bottom: 60px;\n /*height: 200px;\n overflow-y: scroll;*/\n font-size: 12px;\n }\n\n.yourPlayer{\n color:rgb(155, 155, 155);\n }\n\n.inputChat{\n /*position: absolute;\n bottom: 0px;\n height: 50px;*/\n width: 100%;\n text-align: center;\n }\n\n.bgLineUI{\n border-radius: 5px;\n background: rgba(46, 46, 46, 0.9);\n font-size: 12px;\n padding: 5px;\n}" + +/***/ }), + +/***/ "./src/app/components/chat-view/chat-view.component.html": +/*!***************************************************************!*\ + !*** ./src/app/components/chat-view/chat-view.component.html ***! + \***************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +module.exports = "
\n
\n
\n
\n
\n gameDataModel.actions.length-6\"\n [ngStyle]=\"{'color': (action.player_id == gameDataModel.player.id) ? 'rgb(239, 147, 162)' : 'white' }\">\n #{{action.player_id}} (you){{action.value}}
\n
\n
\n
\n
\n \n \n
\n
\n" + +/***/ }), + +/***/ "./src/app/components/chat-view/chat-view.component.ts": +/*!*************************************************************!*\ + !*** ./src/app/components/chat-view/chat-view.component.ts ***! + \*************************************************************/ +/*! exports provided: ChatViewComponent */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ChatViewComponent", function() { return ChatViewComponent; }); +/* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm5/core.js"); +/* harmony import */ var _models_game_data_model__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../models/game-data.model */ "./src/app/models/game-data.model.ts"); +/* harmony import */ var src_app_services_chan_web_service__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! src/app/services/chan-web.service */ "./src/app/services/chan-web.service.ts"); +/* harmony import */ var src_app_models_action_model__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! src/app/models/action.model */ "./src/app/models/action.model.ts"); +/* harmony import */ var _services_game_uiservice_service__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../services/game-uiservice.service */ "./src/app/services/game-uiservice.service.ts"); +var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +var __metadata = (undefined && undefined.__metadata) || function (k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); +}; + + + + + +var ChatViewComponent = /** @class */ (function () { + function ChatViewComponent(chanWS, gameUIServiceService) { + this.chanWS = chanWS; + this.gameUIServiceService = gameUIServiceService; + this.gameDataModel = new _models_game_data_model__WEBPACK_IMPORTED_MODULE_1__["GameDataModel"](); + this.messageToPost = ""; + } + ChatViewComponent.prototype.ngOnInit = function () { + }; + ChatViewComponent.prototype.postMessage = function () { + var _this = this; + var action = new src_app_models_action_model__WEBPACK_IMPORTED_MODULE_3__["ActionModel"](); + action.value = this.messageToPost; + action.action = "talk"; + this.messageToPost = ""; + this.chanWS.createLog(action).subscribe( + //Data success + function (data) { + console.log(data); + _this.gameUIServiceService.forceWS(); + }); + }; + __decorate([ + Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"])(), + __metadata("design:type", _models_game_data_model__WEBPACK_IMPORTED_MODULE_1__["GameDataModel"]) + ], ChatViewComponent.prototype, "gameDataModel", void 0); + ChatViewComponent = __decorate([ + Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Component"])({ + selector: 'app-chat-view', + template: __webpack_require__(/*! ./chat-view.component.html */ "./src/app/components/chat-view/chat-view.component.html"), + styles: [__webpack_require__(/*! ./chat-view.component.css */ "./src/app/components/chat-view/chat-view.component.css")] + }), + __metadata("design:paramtypes", [src_app_services_chan_web_service__WEBPACK_IMPORTED_MODULE_2__["ChanWebService"], + _services_game_uiservice_service__WEBPACK_IMPORTED_MODULE_4__["GameUIServiceService"]]) + ], ChatViewComponent); + return ChatViewComponent; +}()); + + + +/***/ }), + +/***/ "./src/app/components/cmd-ui/cmd-ui.component.css": +/*!********************************************************!*\ + !*** ./src/app/components/cmd-ui/cmd-ui.component.css ***! + \********************************************************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +module.exports = "#commandPrompt{\n background-color: black;\n color: green;\n font-family: 'Courier New', Courier, monospace;\n text-align: left;\n height: 100%;\n padding: 2px;\n}\n\n#commandInput{\n color: black;\n background-color: green;\n width:100%;\n border: none;\n}\n\n::-webkit-input-placeholder { /* Firefox, Chrome, Opera */ \n color: white; \n}\n\n::-ms-input-placeholder { /* Firefox, Chrome, Opera */ \n color: white; \n}\n\n::placeholder { /* Firefox, Chrome, Opera */ \n color: white; \n} " + +/***/ }), + +/***/ "./src/app/components/cmd-ui/cmd-ui.component.html": +/*!*********************************************************!*\ + !*** ./src/app/components/cmd-ui/cmd-ui.component.html ***! + \*********************************************************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +module.exports = "\n
\n /dungeon/users/anon$
\n type command here_\">\n \n
\n
\n
{{reply}}
\n
\n
" + +/***/ }), + +/***/ "./src/app/components/cmd-ui/cmd-ui.component.ts": +/*!*******************************************************!*\ + !*** ./src/app/components/cmd-ui/cmd-ui.component.ts ***! + \*******************************************************/ +/*! exports provided: CmdUiComponent */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CmdUiComponent", function() { return CmdUiComponent; }); +/* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm5/core.js"); +/* harmony import */ var _services_game_uiservice_service__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../services/game-uiservice.service */ "./src/app/services/game-uiservice.service.ts"); +/* harmony import */ var _services_chan_web_service__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../services/chan-web.service */ "./src/app/services/chan-web.service.ts"); +var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +var __metadata = (undefined && undefined.__metadata) || function (k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); +}; + + + +var CmdUiComponent = /** @class */ (function () { + function CmdUiComponent(gameUIServiceService, chanWebService) { + this.gameUIServiceService = gameUIServiceService; + this.chanWebService = chanWebService; + this.commandReplies = []; + } + CmdUiComponent.prototype.ngOnInit = function () { + }; + CmdUiComponent.prototype.close = function () { + this.gameUIServiceService.changeState(_services_game_uiservice_service__WEBPACK_IMPORTED_MODULE_1__["GameUIServiceService"].STATE_GAME_RUNNING); + }; + CmdUiComponent.prototype.sendCMD = function () { + if (this.commandTyped) { + this.commandReplies.unshift(">" + this.commandTyped); + this.analysisCMD(this.commandTyped); + this.commandTyped = ""; + } + }; + /******************** + * COMMAND ANALYSIS + * ******************/ + CmdUiComponent.prototype.analysisCMD = function (cmd_) { + var cmdData = cmd_.split(" "); + if (cmdData[0] == "adminconnect" && cmdData[1]) { + this.commandReplies.unshift("#### TRY TO CONNECT ADMIN #####"); + this.connectAdmin(cmdData[1]); + } + else if (cmdData[0] == "admininit" && cmdData[1]) { + this.commandReplies.unshift("#### TRY TO INIT ADMIN #####"); + this.setAdminPassword(cmdData[1]); + } + else if (cmdData[0] == "logout" && cmdData[1]) { + this.commandReplies.unshift("#### LOGOUT #####"); + this.logout(); + } + else if (cmdData[0] == "admintest") { + this.commandReplies.unshift("#### TEST ADMIN CONNECTION #####"); + this.isAdminConnected(); + } + else { + this.commandReplies.unshift("!command not recognized!"); + } + }; + CmdUiComponent.prototype.isAdminConnected = function () { + var _this = this; + this.chanWebService.isAdminConnected().subscribe(function (data_) { + if (data_.ok) { + if (data_.result === "true") { + _this.commandReplies.unshift("***** Admin is connected *****"); + } + else { + _this.commandReplies.unshift("***** Admin is not connected *****"); + } + _this.commandReplies.unshift(data_.result); + } + else { + _this.commandReplies.unshift("!error!"); + } + }); + }; + CmdUiComponent.prototype.connectAdmin = function (password_) { + var _this = this; + this.chanWebService.connectAdmin(password_).subscribe(function (data_) { + if (data_.ok) { + _this.commandReplies.unshift("***** Admin connected *****"); + _this.commandReplies.unshift(data_.result); + } + else { + _this.commandReplies.unshift("!error!"); + } + }); + }; + CmdUiComponent.prototype.setAdminPassword = function (password_) { + var _this = this; + this.chanWebService.setAdminPassword(password_).subscribe(function (data_) { + if (data_.ok) { + _this.commandReplies.unshift("***** Set password successful *****"); + _this.commandReplies.unshift(data_.result); + } + else { + _this.commandReplies.unshift("!error!"); + } + }); + }; + CmdUiComponent.prototype.logout = function () { + var _this = this; + this.chanWebService.logout().subscribe(function (data_) { + if (data_.ok) { + _this.commandReplies.unshift("***** Logout successful *****"); + _this.commandReplies.unshift(data_.result); + } + else { + _this.commandReplies.unshift("!error!"); + } + }); + }; + CmdUiComponent = __decorate([ + Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Component"])({ + selector: 'app-cmd-ui', + template: __webpack_require__(/*! ./cmd-ui.component.html */ "./src/app/components/cmd-ui/cmd-ui.component.html"), + styles: [__webpack_require__(/*! ./cmd-ui.component.css */ "./src/app/components/cmd-ui/cmd-ui.component.css")] + }), + __metadata("design:paramtypes", [_services_game_uiservice_service__WEBPACK_IMPORTED_MODULE_1__["GameUIServiceService"], _services_chan_web_service__WEBPACK_IMPORTED_MODULE_2__["ChanWebService"]]) + ], CmdUiComponent); + return CmdUiComponent; +}()); + + + +/***/ }), + +/***/ "./src/app/components/gl-view/gl-view.component.css": +/*!**********************************************************!*\ + !*** ./src/app/components/gl-view/gl-view.component.css ***! + \**********************************************************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +module.exports = "#renderCanvas{\n width: 100%;\n height: 100%;\n}\n\n/*\nGAME UI\n*/\n\n.ui-game-container{\n z-index : 10;\n height: 100%;\n }\n\n.ui-game{\n z-index : 10;\n}\n\n.ui-game-frame{\n z-index : 11;\n height: 95%;\n width: 95%;\n }\n\n#mainUI{\n position:absolute;\n top:8px;\n left:8px;\n color: white;\n}\n\n#titleLabel{\n text-align: center;\n font-size: 1em;\n}\n\n#pointerDesc{\n\n position:absolute;\n top:20px;\n max-width : 200px;\n color: white;\n text-align: center;\n left: 0;\n right: 0;\n margin: auto;\n}\n\n#chanDisplay{\n position:absolute;\n top:10px;\n max-width :480px;\n text-align: center;\n left: 0;\n right: 0;\n margin: auto;\n color: white;\n}\n\n#pointerInteract{\n position:absolute;\n bottom:10px;\n max-width : 380px;\n color: white;\n text-align: center;\n left: 0;\n right: 0;\n margin: auto;\n}\n\n#postingUI{\n position:absolute;\n top:20px;\n /*max-width: 650px;*/\n left: 0;\n right: 0;\n margin: auto;\n text-align: left;\n}\n\n#player-bar{\n /*\n background-image: url(\"/assets/img/tool_bar_bg.png\");\n background-repeat: repeat-x;\n background-position: bottom;*/\n\n background-size: 100% 100%;\n color: rgb(206, 206, 206);\n height: 175px;\n width: 100%;\n position:absolute;\n bottom: 0px;\n right: 0px;\n left: 0px;\n margin:8px;\n}\n\n#player-bar-right{\n position:absolute;\n bottom: 0px;\n right: 0;\n padding: 11px;\n text-align: right;\n margin-right:16px;\n}\n\n#player-bar-left{\n position:absolute;\n bottom: 0px;\n left: 0;\n padding: 11px;\n text-align: left;\n}\n\n#pin-ui{\n position:absolute;\n top:0px;\n right: 0;\n max-width: 300px;\n max-height: 300px;\n text-align: right;\n}\n\n#ad-ui{\n position:absolute;\n top:0px;\n right: 0;\n max-width: 250px;\n max-height: 300px;\n text-align: right;\n}\n\n.spoil{\n width: 100%;\n background-color: rgb(71, 71, 71);\n color: rgb(71, 71, 71);\n}\n\n.pointer{\n cursor: pointer;\n}\n\n.circle:before {\n /*Put the element at the middle of the screen*/\n text-align: center;\n width: 4px;\n height: 4px;\n top:0;\n bottom: 0;\n left: 0;\n right: 0;\n margin: auto;\n content: '\\25CF';\n font-size: 10px;\n color: white;\n position:absolute;\n top:50px;\n left : 50;\n\n }\n\n.circle-hover:before {\n /*Put the element at the middle of the screen*/\n text-align: center;\n width: 4px;\n height: 4px;\n top:0;\n bottom: 0;\n left: 0;\n right: 0;\n margin: auto;\n content: '\\25CF';\n font-size: 20px;\n color: white;\n position:absolute;\n top:50px;\n left : 50;\n\n }\n\n.bgGameUI{\n border-radius: 5px;\n background: rgba(46, 46, 46, 0.9);\n font-size: 12px;\n padding: 5px;\n}\n\n.chat-ui{\n position:absolute;\n border-radius: 5px;\n background: rgba(46, 46, 46, 0.9);\n bottom:10px;\n left: 20px;\n width: 300px;\n height: 255px;\n padding: 10px; \n}\n\n.info-button-ui{\n position:absolute;\n bottom:10px;\n left: 10px;\n color: white;\n}\n\n.fullHeightInterface{\n \n height: 90%;\n /* overflow-y: auto;*/\n }\n\nbutton{\n margin: 1px 1px 4px 1px;\n }\n\n/* Trash */\n\n#gamepadCanvas{\n position:absolute;\n bottom:20px;\n right :20px;\n width: 200px;\n height: 200px;\n color: white;\n background-color: rgb(41, 41, 41);\n}\n\n.reply-underline{\n color: rgb(0, 110, 255);\n text-decoration: underline;\n}" + +/***/ }), + +/***/ "./src/app/components/gl-view/gl-view.component.html": +/*!***********************************************************!*\ + !*** ./src/app/components/gl-view/gl-view.component.html ***! + \***********************************************************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +module.exports = "
\n\n\n
\n
\n
\n
use ⌨️ {{config.key_mapping}} to move
\n
\n\n
\n\n \n \n \n \n
\n
\n \n [ /{{chan}} ~ ]\n \n
\n

~/{{gameDataModel.map[0].name}}/

\n
\n
\n\n
\n \n \n \n\n \n \n \n\n \n \n \n \n
\n\n
-1\">\n Plan to reply to >>{{reply}} 🗑️\n
\n\n
\n +{{item.name}}
\n
\n
\n\n
\n \n \n\n \n \n\n \n \n
\n\n
\n \n >\n \n \n \n
\n\n
\n \n
\n
#{{gameDataModel.player.id}} 🧠\n
\n \n
\n \n
\n \n
\n \n
Due moderation issues post is currently limited. {{gameDataModel.postsLeft}} post(s) left.
\n 🐦 Twitter - 💰 Donations \n
\n
\n
\n \n
\n \n\n
" + +/***/ }), + +/***/ "./src/app/components/gl-view/gl-view.component.ts": +/*!*********************************************************!*\ + !*** ./src/app/components/gl-view/gl-view.component.ts ***! + \*********************************************************/ +/*! exports provided: GlViewComponent */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "GlViewComponent", function() { return GlViewComponent; }); +/* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm5/core.js"); +/* harmony import */ var _angular_router__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @angular/router */ "./node_modules/@angular/router/fesm5/router.js"); +/* harmony import */ var _motor_game__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../motor/game */ "./src/app/motor/game.ts"); +/* harmony import */ var _services_game_uiservice_service__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../services/game-uiservice.service */ "./src/app/services/game-uiservice.service.ts"); +/* harmony import */ var src_app_services_chan_web_service__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! src/app/services/chan-web.service */ "./src/app/services/chan-web.service.ts"); +/* harmony import */ var src_app_services_offline_service__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! src/app/services/offline.service */ "./src/app/services/offline.service.ts"); +/* harmony import */ var src_app_models_player_model__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! src/app/models/player.model */ "./src/app/models/player.model.ts"); +/* harmony import */ var src_app_models_config_model__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! src/app/models/config.model */ "./src/app/models/config.model.ts"); +/* harmony import */ var src_app_models_game_data_model__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! src/app/models/game-data.model */ "./src/app/models/game-data.model.ts"); +/* harmony import */ var ngx_device_detector__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ngx-device-detector */ "./node_modules/ngx-device-detector/ngx-device-detector.umd.js"); +/* harmony import */ var ngx_device_detector__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(ngx_device_detector__WEBPACK_IMPORTED_MODULE_9__); +/* harmony import */ var src_environments_environment__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! src/environments/environment */ "./src/environments/environment.ts"); +var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +var __metadata = (undefined && undefined.__metadata) || function (k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); +}; + + + + + + + + + + + +var GlViewComponent = /** @class */ (function () { + function GlViewComponent(gameUIServiceService, chanWebService, offlineService, router, route, deviceService) { + var _this = this; + this.gameUIServiceService = gameUIServiceService; + this.chanWebService = chanWebService; + this.offlineService = offlineService; + this.router = router; + this.route = route; + this.deviceService = deviceService; + this.playerData = new src_app_models_player_model__WEBPACK_IMPORTED_MODULE_6__["PlayerModel"](); + this.gameDataModel = new src_app_models_game_data_model__WEBPACK_IMPORTED_MODULE_8__["GameDataModel"](); + this.config = new src_app_models_config_model__WEBPACK_IMPORTED_MODULE_7__["ConfigModel"](); + this.isMobile = false; + this.adDisplay = true; + this.currentMapKey = "alpha"; + this.clientURL = ""; + this.reply = -1; + this.router.routeReuseStrategy.shouldReuseRoute = function () { return false; }; + this.route.params.subscribe(function (params) { + _this.currentMapKey = params['map']; + console.log(_this.currentMapKey); + }); + this.clientURL = src_environments_environment__WEBPACK_IMPORTED_MODULE_10__["environment"].clientUrl; + } + GlViewComponent.prototype.ngOnInit = function () { + var _this = this; + this.clientURL = src_environments_environment__WEBPACK_IMPORTED_MODULE_10__["environment"].clientUrl; + this.chanList = this.offlineService.getChanData(); + console.log(this.chanList); + this.gameUIServiceService.changeStateEmitter.subscribe(function (state_) { + _this.changeGameState(state_); + if (state_ === _services_game_uiservice_service__WEBPACK_IMPORTED_MODULE_3__["GameUIServiceService"].STATE_NO_PLAYER) + _this.router.navigate(['/']); + }); + this.gameUIServiceService.sendInteractionsEmitter.subscribe(function (inter_) { + _this.receiveInteraction(inter_); + }); + this.gameUIServiceService.changeGameDataEmitter.subscribe(function (gameData_) { + _this.gameDataModel = gameData_; + if (_this.currentMapKey !== _this.gameDataModel.player.map_key) { + _this.currentMapKey = _this.gameDataModel.player.map_key; + _this.adDisplay = true; + } + }); + this.gameUIServiceService.changeConfigEmitter.subscribe(function (config_) { + _this.config = config_; + }); + this.isMobile = this.deviceService.isMobile(); + // Create our game class using the render canvas element + this.game = new _motor_game__WEBPACK_IMPORTED_MODULE_2__["Game"]('renderCanvas'); + //alert("desktop: "+this.deviceService.isDesktop()+" mobile:"+this.deviceService.isMobile()+" tablet: "+this.deviceService.isTablet()); + if (!this.deviceService.isDesktop()) { + this.game.activeJoystick(); + /*alert("desktop: "+this.deviceService.isDesktop+" mobile:"+this.deviceService.isDesktop+" tablet: "+ + this.deviceService.isTablet);*/ + } + this.game.setUIService(this.gameUIServiceService); + this.game.setWebService(this.chanWebService); + this.game.setOfflineService(this.offlineService); + this.game.setClientUrl(this.clientURL); + this.game.setMapKey(this.currentMapKey); + this.game.setRouter(this.router); + this.game.initGame(); + }; + GlViewComponent.prototype.ngAfterViewInit = function () { + var _this = this; + //console.log(window.screen); + this.renderCanvas.nativeElement.width = (window.screen.width); + this.renderCanvas.nativeElement.height = (window.screen.availHeight); + //console.log(JSON.stringify(window.screen)); + window.onresize = function () { + _this.renderCanvas.nativeElement.height = (window.screen.availHeight); + _this.renderCanvas.nativeElement.width = (window.screen.width); + }; + }; + GlViewComponent.prototype.changeGameState = function (state_) { + this.gameState = state_; + //console.log("this.gameState ="+this.gameState ); + }; + GlViewComponent.prototype.receiveInteraction = function (inter_) { + this.currentinteraction = inter_; + }; + /***** INTERACTION! ******/ + GlViewComponent.prototype.openUrl = function () { + //window.open(this.currentinteraction.value, "_blank"); + this.gameState = 2; + }; + GlViewComponent.prototype.openCMD = function () { + this.gameUIServiceService.changeState(_services_game_uiservice_service__WEBPACK_IMPORTED_MODULE_3__["GameUIServiceService"].STATE_CMD_UI); + }; + GlViewComponent.prototype.climbLadder = function () { + this.game.climbObject(); + }; + GlViewComponent.prototype.openDoor = function () { + this.game.openDoor(); + }; + GlViewComponent.prototype.openPostingUI = function () { + this.gameUIServiceService.changeState(_services_game_uiservice_service__WEBPACK_IMPORTED_MODULE_3__["GameUIServiceService"].STATE_POSTING_UI); + }; + GlViewComponent.prototype.openPaintingUI = function () { + this.gameUIServiceService.changeState(_services_game_uiservice_service__WEBPACK_IMPORTED_MODULE_3__["GameUIServiceService"].STATE_PAINTING_UI); + }; + GlViewComponent.prototype.openInfoUI = function () { + this.gameUIServiceService.changeState(_services_game_uiservice_service__WEBPACK_IMPORTED_MODULE_3__["GameUIServiceService"].STATE_INFO_UI); + }; + GlViewComponent.prototype.openPlayerUI = function () { + this.gameUIServiceService.changeState(_services_game_uiservice_service__WEBPACK_IMPORTED_MODULE_3__["GameUIServiceService"].STATE_PLAYER_UI); + }; + GlViewComponent.prototype.onPin = function (event_) { + if (this.pinnedPostModel != null) + this.pinnedPostModel = null; + this.pinnedPostModel = event_; + console.log(this.pinnedPostModel); + }; + GlViewComponent.prototype.unPin = function (event_) { + //console.log( "unpin"); + this.pinnedPostModel = null; + }; + GlViewComponent.prototype.closeAd = function (event_) { + this.adDisplay = false; + }; + GlViewComponent.prototype.changeMapping = function () { + this.game.switchKeyMapping(); + }; + GlViewComponent.prototype.passGate = function (val_) { + this.game.passGet(val_); + }; + GlViewComponent.prototype.getItem = function (key_) { + //console.log("get item"); + this.game.getItem(key_); + }; + GlViewComponent.prototype.addReply = function (id_) { + this.reply = id_; + }; + GlViewComponent.prototype.destroyReply = function () { + this.reply = -1; + }; + GlViewComponent.prototype.savePhoto = function () { + alert("try to write picture"); + var canvas = document.getElementById("renderCanvas"); + console.log(canvas); + //let photoUrl = canvas.getContext('2d').getImageData(0,0,600,600) + var data = canvas.toDataURL('image/png'); + //document.location.href = photoUrl; + console.log(data); + var w = window.open('about:blank', 'Screen Capture'); + w.document.write("from canvas"); + }; + GlViewComponent.prototype.gotTo = function (url_) { + window.open(url_, '_blank'); + }; + GlViewComponent.prototype.changeTalk = function (e_) { + console.log(e_); + this.game.changeTalk(e_); + }; + GlViewComponent.prototype.ngOnDestroy = function () { + /* + this.gameUIServiceService.changeStateEmitter.unsubscribe(); + this.gameUIServiceService.sendInteractionsEmitter.unsubscribe(); + this.gameUIServiceService.changeGameDataEmitter.unsubscribe(); + this.gameUIServiceService.changeConfigEmitter.unsubscribe();*/ + delete this.game; + }; + __decorate([ + Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ViewChild"])('renderCanvas'), + __metadata("design:type", _angular_core__WEBPACK_IMPORTED_MODULE_0__["ElementRef"]) + ], GlViewComponent.prototype, "renderCanvas", void 0); + __decorate([ + Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ViewChild"])('renderCanvas'), + __metadata("design:type", _angular_core__WEBPACK_IMPORTED_MODULE_0__["ElementRef"]) + ], GlViewComponent.prototype, "elementCanvas", void 0); + GlViewComponent = __decorate([ + Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Component"])({ + selector: 'app-gl-view', + template: __webpack_require__(/*! ./gl-view.component.html */ "./src/app/components/gl-view/gl-view.component.html"), + styles: [__webpack_require__(/*! ./gl-view.component.css */ "./src/app/components/gl-view/gl-view.component.css")] + }), + __metadata("design:paramtypes", [_services_game_uiservice_service__WEBPACK_IMPORTED_MODULE_3__["GameUIServiceService"], + src_app_services_chan_web_service__WEBPACK_IMPORTED_MODULE_4__["ChanWebService"], + src_app_services_offline_service__WEBPACK_IMPORTED_MODULE_5__["OfflineService"], + _angular_router__WEBPACK_IMPORTED_MODULE_1__["Router"], + _angular_router__WEBPACK_IMPORTED_MODULE_1__["ActivatedRoute"], + ngx_device_detector__WEBPACK_IMPORTED_MODULE_9__["DeviceDetectorService"]]) + ], GlViewComponent); + return GlViewComponent; +}()); + + + +/***/ }), + +/***/ "./src/app/components/home/home.component.css": +/*!****************************************************!*\ + !*** ./src/app/components/home/home.component.css ***! + \****************************************************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +module.exports = ".container{\n /*background-image: \n linear-gradient( rgba(0,0,0,.5), rgba(0, 0, 0, 0.6) ),\n url(\"/assets/img/home_bg.jpeg\");*/\n padding: 25px;\n /*overflow: scroll;*/\n -webkit-overflow-scrolling: touch;\n color: white;\n text-align: center;\n}\n\ndiv {\n margin-bottom: 8px;\n}\n\n.overlay {\n z-index: 1;\n height: 100%;\n width: 100%;\n position: fixed;\n overflow: auto;\n top: 0px;\n left: 0px;\n background: rgba(0, 0, 0, 0.7); /*can be anything, of course*/\n}\n\n#pres-screen {\n\n width : 100%;\n text-align: center;\n}\n\n#header {\n color: white;\n}\n\n#twitter {\n width:550px;\n margin: 20px auto;\n}" + +/***/ }), + +/***/ "./src/app/components/home/home.component.html": +/*!*****************************************************!*\ + !*** ./src/app/components/home/home.component.html ***! + \*****************************************************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +module.exports = "
\n
\n

AnonIB💀3D

\n 超暴力的なファイル共有3 Dゲーム
\n by Ælx Krunch
\n [ 🐦 Twitter ] [ 💴 Donations ]\n
\n\n
\n \n
\n\n \n
\n" + +/***/ }), + +/***/ "./src/app/components/home/home.component.ts": +/*!***************************************************!*\ + !*** ./src/app/components/home/home.component.ts ***! + \***************************************************/ +/*! exports provided: HomeComponent */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HomeComponent", function() { return HomeComponent; }); +/* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm5/core.js"); +/* harmony import */ var ngx_device_detector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ngx-device-detector */ "./node_modules/ngx-device-detector/ngx-device-detector.umd.js"); +/* harmony import */ var ngx_device_detector__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(ngx_device_detector__WEBPACK_IMPORTED_MODULE_1__); +/* harmony import */ var _environments_environment__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../environments/environment */ "./src/environments/environment.ts"); +/* harmony import */ var _angular_router__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @angular/router */ "./node_modules/@angular/router/fesm5/router.js"); +/* harmony import */ var src_app_services_offline_service__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! src/app/services/offline.service */ "./src/app/services/offline.service.ts"); +var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +var __metadata = (undefined && undefined.__metadata) || function (k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); +}; + + + + + +var HomeComponent = /** @class */ (function () { + function HomeComponent(deviceService, router, offlineService) { + this.deviceService = deviceService; + this.router = router; + this.offlineService = offlineService; + this.isMobile = false; + this.isTOSAccepted = false; + } + HomeComponent.prototype.ngOnInit = function () { + this.isMobile = this.deviceService.isMobile(); + var url = location.href; + if (url.indexOf(_environments_environment__WEBPACK_IMPORTED_MODULE_2__["environment"].clientUrl) < 0) { + window.location.href = _environments_environment__WEBPACK_IMPORTED_MODULE_2__["environment"].clientUrl; + } + var playerData_ = this.offlineService.getPlayerData(); + if (playerData_ != null) { + this.isTOSAccepted = true; + } + }; + HomeComponent.prototype.launchGame = function () { + this.router.navigateByUrl('/ch/alpha'); + }; + HomeComponent = __decorate([ + Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Component"])({ + selector: 'app-home', + template: __webpack_require__(/*! ./home.component.html */ "./src/app/components/home/home.component.html"), + styles: [__webpack_require__(/*! ./home.component.css */ "./src/app/components/home/home.component.css")] + }), + __metadata("design:paramtypes", [ngx_device_detector__WEBPACK_IMPORTED_MODULE_1__["DeviceDetectorService"], _angular_router__WEBPACK_IMPORTED_MODULE_3__["Router"], + src_app_services_offline_service__WEBPACK_IMPORTED_MODULE_4__["OfflineService"]]) + ], HomeComponent); + return HomeComponent; +}()); + + + +/***/ }), + +/***/ "./src/app/components/info-view/info-view.component.css": +/*!**************************************************************!*\ + !*** ./src/app/components/info-view/info-view.component.css ***! + \**************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +module.exports = ".post-ui-message{\n position:relative;\n max-width: 650px;\n left: 0;\n right: 0;\n margin: auto;\n\n padding : 10px;\n margin-bottom : 18px;\n background-color: rgb(189, 198, 247);\n border-style: solid;\n border-width: 1px;\n border-color: #a99ec7;\n border-radius: 5px;\n\n height: 100%;\n overflow-y: auto;\n}\n\n#container{\n position:relative;\n max-width: 650px;\n left: 0;\n right: 0;\n margin: auto;\n\n padding : 10px;\n margin-bottom : 18px;\n background-color: rgb(189, 198, 247);\n border-style: solid;\n border-width: 1px;\n border-color: #a99ec7;\n border-radius: 5px;\n\n height: 100%;\n overflow-y: auto;\n}\n\ndiv {\n margin-bottom: 8px;\n}\n" + +/***/ }), + +/***/ "./src/app/components/info-view/info-view.component.html": +/*!***************************************************************!*\ + !*** ./src/app/components/info-view/info-view.component.html ***! + \***************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +module.exports = "
\n\n
\n

About Protaguro$

\n
\n I am Alex Krunch, Imageboard lover since now ten years and I've created Protaguro$ (the project name will change soon)\n In response to the growing and industrialized censorship on social medias. This whole 3D world is set to work as\n an abstraction, protecting our LULZ from the outside. Soon I will make a blog explaining the whole ideology of the Project,\n and also cool technical feature I will implement, like secrets board, items management and torrenting files in game.\n\n Keep in mind it's a prototype and than bug and database reset will be a frequent thing.\n\n You can keep news of THE PROJECT here:\n https://twitter.com/alexkrunch\n\n You can also contact by mail at monsieur.krunch@gmail.com\n
\n\n
\n If you want to make a 💴 DONATION 💴 to the cause, here are the crypto address:
\n\n
\n
\n Bitcoin address:
\n bc1qwc7zaa4tfeertxwk46jv9meyup9ep9cre8l8p7
\n \n Etherum:
\n 0xEE914adbb0A83e0FD8B90E292CAc6280D26b6b66
\n
\n
\n \n
\n \n\n
\n\n
\n" + +/***/ }), + +/***/ "./src/app/components/info-view/info-view.component.ts": +/*!*************************************************************!*\ + !*** ./src/app/components/info-view/info-view.component.ts ***! + \*************************************************************/ +/*! exports provided: InfoViewComponent */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "InfoViewComponent", function() { return InfoViewComponent; }); +/* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm5/core.js"); +/* harmony import */ var src_app_services_game_uiservice_service__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! src/app/services/game-uiservice.service */ "./src/app/services/game-uiservice.service.ts"); +var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +var __metadata = (undefined && undefined.__metadata) || function (k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); +}; + + +var InfoViewComponent = /** @class */ (function () { + function InfoViewComponent(gameUIServiceService) { + this.gameUIServiceService = gameUIServiceService; + } + InfoViewComponent.prototype.ngOnInit = function () { + }; + InfoViewComponent.prototype.closeCanvas = function () { + this.gameUIServiceService.changeState(src_app_services_game_uiservice_service__WEBPACK_IMPORTED_MODULE_1__["GameUIServiceService"].STATE_GAME_RUNNING); + }; + InfoViewComponent = __decorate([ + Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Component"])({ + selector: 'app-info-view', + template: __webpack_require__(/*! ./info-view.component.html */ "./src/app/components/info-view/info-view.component.html"), + styles: [__webpack_require__(/*! ./info-view.component.css */ "./src/app/components/info-view/info-view.component.css")] + }), + __metadata("design:paramtypes", [src_app_services_game_uiservice_service__WEBPACK_IMPORTED_MODULE_1__["GameUIServiceService"]]) + ], InfoViewComponent); + return InfoViewComponent; +}()); + + + +/***/ }), + +/***/ "./src/app/components/login/login.component.css": +/*!******************************************************!*\ + !*** ./src/app/components/login/login.component.css ***! + \******************************************************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +module.exports = "#contentLogin{\n text-align: center;\n}\n\ndiv {\n margin-bottom: 8px;\n}\n\nbutton{\n margin: 1px 1px 4px 1px;\n }\n" + +/***/ }), + +/***/ "./src/app/components/login/login.component.html": +/*!*******************************************************!*\ + !*** ./src/app/components/login/login.component.html ***! + \*******************************************************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +module.exports = "
\n\n
\n Try to get a player token...\n
\n\n
\n -We do not allow CP / Non-ironical hatespeech / porn / doxxing / pirated content.
\n -You need to be +18 to access this game.
\n -Don't trust anythings written on the game, it's all fake news.
\n -Don't talk about the game.
\n -Keep in mind t's an experimental project, it will be often broke. For more information contact monsieur.krunch@gmail.com,\n or check my twitter account, @AlexKrunch🚬
\n \n
\n\n
\n
\n
\n ID\n
\n \n
\n
\n
\n Token\n
\n \n
\n
\n or
\n
\n
\n \n
\n
\n\n
\n What you get..
\n Player ID #{{playerData.id}} 🧠
\n Player token {{playerData.player_key}}\n
\n \n \n \n
\n\n
" + +/***/ }), + +/***/ "./src/app/components/login/login.component.ts": +/*!*****************************************************!*\ + !*** ./src/app/components/login/login.component.ts ***! + \*****************************************************/ +/*! exports provided: LoginComponent */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LoginComponent", function() { return LoginComponent; }); +/* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm5/core.js"); +/* harmony import */ var _angular_router__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @angular/router */ "./node_modules/@angular/router/fesm5/router.js"); +/* harmony import */ var src_app_services_chan_web_service__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! src/app/services/chan-web.service */ "./src/app/services/chan-web.service.ts"); +/* harmony import */ var src_app_services_offline_service__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! src/app/services/offline.service */ "./src/app/services/offline.service.ts"); +var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +var __metadata = (undefined && undefined.__metadata) || function (k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); +}; + + + + +var LoginComponent = /** @class */ (function () { + function LoginComponent(chanWebService, offlineService, router) { + this.chanWebService = chanWebService; + this.offlineService = offlineService; + this.router = router; + this.isLoading = false; + this.isTOSAccepted = false; + } + LoginComponent.prototype.ngOnInit = function () { + var playerData_ = this.offlineService.getPlayerData(); + if (playerData_ != null) { + this.anonId = playerData_.id; + this.anonToken = playerData_.player_key; + this.isTOSAccepted = true; + } + }; + //Call the WS + LoginComponent.prototype.createUser = function () { + var _this = this; + console.log("createUser"); + this.isLoading = true; + this.chanWebService.createUser(this.anonId, this.anonToken, this.password, "").subscribe( + //Data success + function (data) { + _this.isLoading = false; + if (data.ok) { + _this.playerData = data.result.player; + _this.offlineService.savePlayer(_this.playerData); + } + else { + _this.errorWs = data.error; + } + }); + }; + //Call the WS + LoginComponent.prototype.createNewUser = function () { + this.anonId = 0; + this.anonToken = ""; + this.createUser(); + }; + LoginComponent.prototype.validAndLaunchGame = function () { + this.router.navigateByUrl('/ch/alpha'); + }; + LoginComponent.prototype.validAndLaunchAdmin = function () { + this.router.navigateByUrl('/admin-post'); + }; + LoginComponent.prototype.acceptTOS = function () { + this.isTOSAccepted = true; + }; + LoginComponent = __decorate([ + Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Component"])({ + selector: 'app-login', + template: __webpack_require__(/*! ./login.component.html */ "./src/app/components/login/login.component.html"), + styles: [__webpack_require__(/*! ./login.component.css */ "./src/app/components/login/login.component.css")] + }), + __metadata("design:paramtypes", [src_app_services_chan_web_service__WEBPACK_IMPORTED_MODULE_2__["ChanWebService"], src_app_services_offline_service__WEBPACK_IMPORTED_MODULE_3__["OfflineService"], + _angular_router__WEBPACK_IMPORTED_MODULE_1__["Router"]]) + ], LoginComponent); + return LoginComponent; +}()); + + + +/***/ }), + +/***/ "./src/app/components/media-display/media-display.component.css": +/*!**********************************************************************!*\ + !*** ./src/app/components/media-display/media-display.component.css ***! + \**********************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +module.exports = "" + +/***/ }), + +/***/ "./src/app/components/media-display/media-display.component.html": +/*!***********************************************************************!*\ + !*** ./src/app/components/media-display/media-display.component.html ***! + \***********************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +module.exports = "
\n\n\n\n\n\n\n\n
\n" + +/***/ }), + +/***/ "./src/app/components/media-display/media-display.component.ts": +/*!*********************************************************************!*\ + !*** ./src/app/components/media-display/media-display.component.ts ***! + \*********************************************************************/ +/*! exports provided: MediaDisplayComponent */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MediaDisplayComponent", function() { return MediaDisplayComponent; }); +/* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm5/core.js"); +/* harmony import */ var src_app_utils_urlParser__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! src/app/utils/urlParser */ "./src/app/utils/urlParser.ts"); +/* harmony import */ var _angular_platform_browser__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @angular/platform-browser */ "./node_modules/@angular/platform-browser/fesm5/platform-browser.js"); +var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +var __metadata = (undefined && undefined.__metadata) || function (k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); +}; + + + +var MediaDisplayComponent = /** @class */ (function () { + function MediaDisplayComponent(sanitizer) { + this.sanitizer = sanitizer; + } + MediaDisplayComponent.prototype.ngOnInit = function () { + if (this.url != null) { + this.urlParse = new src_app_utils_urlParser__WEBPACK_IMPORTED_MODULE_1__["UrlParser"](this.url); + this.safeTubeURL = this.urlParse.getSafeTubeURL(this.sanitizer); + } + }; + __decorate([ + Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"])(), + __metadata("design:type", String) + ], MediaDisplayComponent.prototype, "url", void 0); + MediaDisplayComponent = __decorate([ + Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Component"])({ + selector: 'app-media-display', + template: __webpack_require__(/*! ./media-display.component.html */ "./src/app/components/media-display/media-display.component.html"), + styles: [__webpack_require__(/*! ./media-display.component.css */ "./src/app/components/media-display/media-display.component.css")] + }), + __metadata("design:paramtypes", [_angular_platform_browser__WEBPACK_IMPORTED_MODULE_2__["DomSanitizer"]]) + ], MediaDisplayComponent); + return MediaDisplayComponent; +}()); + + + +/***/ }), + +/***/ "./src/app/components/painting-ui/painting-ui.component.css": +/*!******************************************************************!*\ + !*** ./src/app/components/painting-ui/painting-ui.component.css ***! + \******************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +module.exports = ".post-ui-message{\n position:relative;\n /*max-width: 480px;*/\n left: 0;\n right: 0;\n margin: auto;\n padding : 10px;\n margin-bottom : 18px;\n background: rgb(189, 198, 247);\n border-style: solid;\n border-width: 1px;\n border-color: #a99ec7;\n border-radius: 5px;\n height: 95%;\n overflow-y: auto;\n}\n\n#canvas-right{\n width: 460px;\n position:absolute;\n}\n\n#tool-right{\n position:absolute;\n width: 480px;\n height: 100%;\n left: 480px;\n top: 0px;\n}\n\ntextarea\n{\n width: 220px;\n margin: 0;\n}\n\n#painting-board {\n width: 460px;\n height: 460px;\n /*background-color: whitesmoke;*/\n background-image:\n url(\"/assets/img/grid.png\");\n\n}\n\n#brush-size{\n position: relative;\n background-color: black;\n width: 10px;\n height: 10px;\n}\n\nbutton{\n margin: 1px 1px 4px 1px;\n}" + +/***/ }), + +/***/ "./src/app/components/painting-ui/painting-ui.component.html": +/*!*******************************************************************!*\ + !*** ./src/app/components/painting-ui/painting-ui.component.html ***! + \*******************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +module.exports = "
\n\n
\n\n \n\n
\n\n
\n\n\n\n
\n\n\n
\n\n
\nPick a color:
\n\n
\n
\n
\n\n
= 0\" >reply to >>{{ reply }} 🗑️
\nMessage:
\n
\n\n\n\n
\n\n
" + +/***/ }), + +/***/ "./src/app/components/painting-ui/painting-ui.component.ts": +/*!*****************************************************************!*\ + !*** ./src/app/components/painting-ui/painting-ui.component.ts ***! + \*****************************************************************/ +/*! exports provided: PaintingUiComponent */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PaintingUiComponent", function() { return PaintingUiComponent; }); +/* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm5/core.js"); +/* harmony import */ var _services_game_uiservice_service__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../services/game-uiservice.service */ "./src/app/services/game-uiservice.service.ts"); +/* harmony import */ var src_app_models_post_model__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! src/app/models/post.model */ "./src/app/models/post.model.ts"); +/* harmony import */ var src_app_services_chan_web_service__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! src/app/services/chan-web.service */ "./src/app/services/chan-web.service.ts"); +/* harmony import */ var ngx_device_detector__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ngx-device-detector */ "./node_modules/ngx-device-detector/ngx-device-detector.umd.js"); +/* harmony import */ var ngx_device_detector__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(ngx_device_detector__WEBPACK_IMPORTED_MODULE_4__); +/* harmony import */ var pepjs__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! pepjs */ "./node_modules/pepjs/dist/pep.js"); +/* harmony import */ var pepjs__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(pepjs__WEBPACK_IMPORTED_MODULE_5__); +var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +var __metadata = (undefined && undefined.__metadata) || function (k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); +}; + + + + + + +var PaintingUiComponent = /** @class */ (function () { + function PaintingUiComponent(gameUIServiceService, chanWebService, deviceService) { + this.gameUIServiceService = gameUIServiceService; + this.chanWebService = chanWebService; + this.deviceService = deviceService; + this.onDestroyReply = new _angular_core__WEBPACK_IMPORTED_MODULE_0__["EventEmitter"](); + this.isLoading = false; + this.canvasPercent = 0; + this.isFinalExport = false; + /***************** + * EVENT DEALING WITH PAINTING + *****************/ + this.clickX = new Array(); + this.clickY = new Array(); + this.clickDrag = new Array(); + this.clickDurationCurrent = 0; + this.clickDurationList = new Array(); + //Colors + this.colorRed = "#df4b26"; + this.colorPink = "#ff8cd4"; + this.colorBlack = "#000000"; + this.colorPurple = "#cb3594"; + this.colorGreen = "#659b41"; + this.colorYellow = "#ffcf33"; + this.colorBrown = "#986928"; + this.colorBlue = "#0066ff"; + this.colorWhite = "#ffffff"; + this.curColor = this.colorRed; + this.clickColor = new Array(); + this.selectedColor = "#000000"; + this.clickSize = new Array(); + this.strokeSize = 10; + } + PaintingUiComponent.prototype.ngOnInit = function () { + var _this = this; + this.postModel = new src_app_models_post_model__WEBPACK_IMPORTED_MODULE_2__["PostModel"](); + this.postModel.map_key = ""; + this.postModel.canvas_key = this.canvasKey; + this.postModel.message = ""; + this.postModel.graffiti = true; + this.postModel.reply = this.reply; + if (this.urlBgPicture != null) { + this.imageBg = new Image(); + this.imageBg.crossOrigin = "Anonymous"; + this.imageBg.src = this.urlBgPicture; + console.log('this.urlBgPicture: ' + this.urlBgPicture); + this.imageBg.onload = function () { + _this.redraw(); + }; + } + //is Mobile? We need to make teh mouse move with pepjs + // if(!this.deviceService.isDesktop()){ + this.elementCanvas.nativeElement.addEventListener("pointerdown", function (event_) { + _this.paint = true; + _this.canvasMouseDown(event_); + }); + this.elementCanvas.nativeElement.addEventListener("pointermove", function (event_) { + _this.canvasMouseMove(event_); + }); + this.elementCanvas.nativeElement.addEventListener("pointerup", function (event_) { + _this.canvasMouseUp(event_); + }); + //} + }; + PaintingUiComponent.prototype.ngAfterViewInit = function () { + this.context = this.elementCanvas.nativeElement.getContext('2d'); + }; + PaintingUiComponent.prototype.closeCanvas = function () { + this.gameUIServiceService.changeState(_services_game_uiservice_service__WEBPACK_IMPORTED_MODULE_1__["GameUIServiceService"].STATE_GAME_RUNNING); + }; + PaintingUiComponent.prototype.getImg = function () { + var data = this.elementCanvas.nativeElement.toDataURL("image/png"); + data += "snffch"; + return data; + }; + PaintingUiComponent.prototype.dataURItoBlob = function (dataURI) { + var byteString = window.atob(dataURI); + var arrayBuffer = new ArrayBuffer(byteString.length); + var int8Array = new Uint8Array(arrayBuffer); + for (var i = 0; i < byteString.length; i++) { + int8Array[i] = byteString.charCodeAt(i); + } + var blob = new Blob([int8Array], { type: 'image/jpeg' }); + return blob; + }; + PaintingUiComponent.prototype.sendImg = function () { + var _this = this; + if ((this.clickX.length + this.clickY.length) < 200) { + alert("It's doesn't looks like a big drawing :( "); + return; + } + this.isFinalExport = true; + this.redraw(); + this.chanWebService.createAndUploadPaint(this.postModel, this.getImg()).subscribe( + //Data success + function (data) { + //console.log("data:"+data); + var postStuffResponse = data; + if (postStuffResponse.ok) { + //console.log("result "+JSON.stringify( postStuffResponse)); + _this.destroyReply(); + _this.closeCanvas(); + _this.gameUIServiceService.forceWS(); + _this.gameUIServiceService.changeState(_services_game_uiservice_service__WEBPACK_IMPORTED_MODULE_1__["GameUIServiceService"].STATE_GAME_RUNNING); + } + _this.isLoading = false; + _this.isFinalExport = false; + }, function (error) { + //console.log(JSON.stringify(error)); + _this.isLoading = false; + _this.isFinalExport = false; + _this.redraw(); + }); + }; + PaintingUiComponent.prototype.canvasMouseDown = function (event_) { + var mouseX = event_.offsetX + (event_.offsetX * this.canvasPercent); + var mouseY = event_.offsetY + (event_.offsetY * this.canvasPercent); + this.paint = true; + this.addClick(mouseX, mouseY, false); + this.redraw(); + }; + PaintingUiComponent.prototype.canvasMouseUp = function (event_) { + this.paint = false; + this.clickDurationList.push(this.clickDurationCurrent); + this.clickDurationCurrent = 0; + }; + PaintingUiComponent.prototype.canvasMouseMove = function (event_) { + if (this.paint) { + var mouseX = event_.offsetX + (event_.offsetX * this.canvasPercent); + var mouseY = event_.offsetY + (event_.offsetY * this.canvasPercent); + this.addClick(mouseX, mouseY, true); + this.redraw(); + this.clickDurationCurrent += 1; + } + }; + PaintingUiComponent.prototype.addClick = function (x, y, dragging) { + this.clickX.push(x); + this.clickY.push(y); + this.clickDrag.push(dragging); + //console.log(this.selectedColor); + this.clickColor.push(this.curColor); + this.clickSize.push(this.strokeSize); + }; + PaintingUiComponent.prototype.redraw = function () { + this.context.clearRect(0, 0, this.context.canvas.width, this.context.canvas.height); // Clears the canvas + this.context.lineJoin = "round"; + this.context.lineWidth = 10; + //set bg image if it exist + if (this.imageBg && !this.isFinalExport) { + var ratio = void 0; + var newWidth = void 0; + var newHeight = void 0; + var newX = 0; + var newY = 0; + if (this.imageBg.height > this.imageBg.width) { + ratio = this.elementCanvas.nativeElement.height / this.imageBg.height; + newWidth = this.imageBg.width * ratio; + newHeight = this.imageBg.height * ratio; + newX = (newWidth - this.elementCanvas.nativeElement.width) * (-0.5); + } + else { + ratio = this.elementCanvas.nativeElement.width / this.imageBg.width; + newWidth = this.imageBg.width * ratio; + newHeight = this.imageBg.height * ratio; + newY = (newHeight - this.elementCanvas.nativeElement.height) * (-0.5); + } + this.context.drawImage(this.imageBg, newX, newY, newWidth, newHeight); + } + for (var i = 0; i < this.clickX.length; i++) { + this.context.beginPath(); + if (this.clickDrag[i] && i > 0) { + this.context.moveTo(this.clickX[i - 1], this.clickY[i - 1]); + } + else { + this.context.moveTo(this.clickX[i], this.clickY[i]); + } + this.context.lineTo(this.clickX[i], this.clickY[i]); + this.context.closePath(); + this.context.strokeStyle = this.clickColor[i]; + this.context.lineWidth = this.clickSize[i]; + this.context.stroke(); + } + }; + /***************** + * DEALING with painting style + *****************/ + PaintingUiComponent.prototype.changeColor = function (color_) { + this.curColor = color_; + }; + PaintingUiComponent.prototype.clear = function () { + if (this.clickDurationList.length > 0) { + var lastDuration = this.clickDurationList.pop(); + this.clickColor = this.clickColor.slice(0, this.clickColor.length - lastDuration - 1); + this.clickX = this.clickX.slice(0, this.clickX.length - lastDuration - 1); + this.clickY = this.clickY.slice(0, this.clickY.length - lastDuration - 1); + this.clickDrag = this.clickDrag.slice(0, this.clickDrag.length - lastDuration - 1); + this.clickSize = this.clickSize.slice(0, this.clickSize.length - lastDuration - 1); + this.redraw(); + } + }; + PaintingUiComponent.prototype.destroyReply = function () { + this.reply = -1; + this.onDestroyReply.emit(-1); + }; + __decorate([ + Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"])(), + __metadata("design:type", String) + ], PaintingUiComponent.prototype, "canvasKey", void 0); + __decorate([ + Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"])(), + __metadata("design:type", String) + ], PaintingUiComponent.prototype, "urlBgPicture", void 0); + __decorate([ + Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"])(), + __metadata("design:type", Number) + ], PaintingUiComponent.prototype, "reply", void 0); + __decorate([ + Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Output"])(), + __metadata("design:type", Object) + ], PaintingUiComponent.prototype, "onDestroyReply", void 0); + __decorate([ + Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ViewChild"])('paintingCanvas'), + __metadata("design:type", _angular_core__WEBPACK_IMPORTED_MODULE_0__["ElementRef"]) + ], PaintingUiComponent.prototype, "elementCanvas", void 0); + PaintingUiComponent = __decorate([ + Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Component"])({ + selector: 'app-painting-ui', + template: __webpack_require__(/*! ./painting-ui.component.html */ "./src/app/components/painting-ui/painting-ui.component.html"), + styles: [__webpack_require__(/*! ./painting-ui.component.css */ "./src/app/components/painting-ui/painting-ui.component.css")] + }), + __metadata("design:paramtypes", [_services_game_uiservice_service__WEBPACK_IMPORTED_MODULE_1__["GameUIServiceService"], src_app_services_chan_web_service__WEBPACK_IMPORTED_MODULE_3__["ChanWebService"], + ngx_device_detector__WEBPACK_IMPORTED_MODULE_4__["DeviceDetectorService"]]) + ], PaintingUiComponent); + return PaintingUiComponent; +}()); + + + +/***/ }), + +/***/ "./src/app/components/phone-poster/phone-poster.component.css": +/*!********************************************************************!*\ + !*** ./src/app/components/phone-poster/phone-poster.component.css ***! + \********************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +module.exports = "#container{\n position: absolute;\n margin: auto;\n max-width: 650px;\n left: 0;\n right: 0;\n height: 100%;\n}" + +/***/ }), + +/***/ "./src/app/components/phone-poster/phone-poster.component.html": +/*!*********************************************************************!*\ + !*** ./src/app/components/phone-poster/phone-poster.component.html ***! + \*********************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +module.exports = "" + +/***/ }), + +/***/ "./src/app/components/phone-poster/phone-poster.component.ts": +/*!*******************************************************************!*\ + !*** ./src/app/components/phone-poster/phone-poster.component.ts ***! + \*******************************************************************/ +/*! exports provided: PhonePosterComponent */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PhonePosterComponent", function() { return PhonePosterComponent; }); +/* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm5/core.js"); +/* harmony import */ var _angular_router__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @angular/router */ "./node_modules/@angular/router/fesm5/router.js"); +/* harmony import */ var src_app_models_player_model__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! src/app/models/player.model */ "./src/app/models/player.model.ts"); +/* harmony import */ var src_app_services_offline_service__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! src/app/services/offline.service */ "./src/app/services/offline.service.ts"); +var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +var __metadata = (undefined && undefined.__metadata) || function (k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); +}; + + + + +var PhonePosterComponent = /** @class */ (function () { + function PhonePosterComponent(offlineService, route) { + var _this = this; + this.offlineService = offlineService; + this.route = route; + this.route.params.subscribe(function (params) { + _this.playerId = params['id']; + _this.playerKey = params['key']; + _this.canvasKey = params['canvas']; + //set the player model, at it to offline + _this.playerModel = new src_app_models_player_model__WEBPACK_IMPORTED_MODULE_2__["PlayerModel"](); + _this.playerModel.id = Number(_this.playerId); + _this.playerModel.player_key = _this.playerKey; + _this.offlineService.savePlayer(_this.playerModel); + }); + } + PhonePosterComponent.prototype.ngOnInit = function () { + }; + PhonePosterComponent = __decorate([ + Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Component"])({ + selector: 'app-phone-poster', + template: __webpack_require__(/*! ./phone-poster.component.html */ "./src/app/components/phone-poster/phone-poster.component.html"), + styles: [__webpack_require__(/*! ./phone-poster.component.css */ "./src/app/components/phone-poster/phone-poster.component.css")] + }), + __metadata("design:paramtypes", [src_app_services_offline_service__WEBPACK_IMPORTED_MODULE_3__["OfflineService"], _angular_router__WEBPACK_IMPORTED_MODULE_1__["ActivatedRoute"]]) + ], PhonePosterComponent); + return PhonePosterComponent; +}()); + + + +/***/ }), + +/***/ "./src/app/components/pin-post-ui/pin-post-ui.component.css": +/*!******************************************************************!*\ + !*** ./src/app/components/pin-post-ui/pin-post-ui.component.css ***! + \******************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +module.exports = "::ng-deep .img-pin img, .img-pin video, .img-pin iframe, .img-pin audio {\n max-width: 300px;\n max-height: 300px;\n}" + +/***/ }), + +/***/ "./src/app/components/pin-post-ui/pin-post-ui.component.html": +/*!*******************************************************************!*\ + !*** ./src/app/components/pin-post-ui/pin-post-ui.component.html ***! + \*******************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +module.exports = "
\n\n\n
" + +/***/ }), + +/***/ "./src/app/components/pin-post-ui/pin-post-ui.component.ts": +/*!*****************************************************************!*\ + !*** ./src/app/components/pin-post-ui/pin-post-ui.component.ts ***! + \*****************************************************************/ +/*! exports provided: PinPostUiComponent */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PinPostUiComponent", function() { return PinPostUiComponent; }); +/* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm5/core.js"); +/* harmony import */ var _models_post_model__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../models/post.model */ "./src/app/models/post.model.ts"); +var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +var __metadata = (undefined && undefined.__metadata) || function (k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); +}; + + +var PinPostUiComponent = /** @class */ (function () { + function PinPostUiComponent() { + this.close = new _angular_core__WEBPACK_IMPORTED_MODULE_0__["EventEmitter"](); + } + PinPostUiComponent.prototype.ngOnInit = function () { + }; + PinPostUiComponent.prototype.ngOnChanges = function (changes) { + if (changes != null && changes.postModel != null) { + this.postModel = changes.postModel.currentValue; + } + }; + PinPostUiComponent.prototype.closePost = function () { + this.close.emit(); + }; + __decorate([ + Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"])(), + __metadata("design:type", _models_post_model__WEBPACK_IMPORTED_MODULE_1__["PostModel"]) + ], PinPostUiComponent.prototype, "postModel", void 0); + __decorate([ + Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Output"])(), + __metadata("design:type", Object) + ], PinPostUiComponent.prototype, "close", void 0); + PinPostUiComponent = __decorate([ + Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Component"])({ + selector: 'app-pin-post-ui', + template: __webpack_require__(/*! ./pin-post-ui.component.html */ "./src/app/components/pin-post-ui/pin-post-ui.component.html"), + styles: [__webpack_require__(/*! ./pin-post-ui.component.css */ "./src/app/components/pin-post-ui/pin-post-ui.component.css")] + }), + __metadata("design:paramtypes", []) + ], PinPostUiComponent); + return PinPostUiComponent; +}()); + + + +/***/ }), + +/***/ "./src/app/components/player-ui/player-ui.component.css": +/*!**************************************************************!*\ + !*** ./src/app/components/player-ui/player-ui.component.css ***! + \**************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +module.exports = ".post-viewer-ui-message{\n position:relative;\n /*max-width: 650px;*/\n left: 0;\n right: 0;\n margin: auto;\n padding : 10px;\n margin-bottom : 18px;\n background: rgb(247, 189, 225);\n border-style: solid;\n border-width: 1px;\n border-color: #c79eb7;\n border-radius: 5px;\n height: 95%;\n width: 100%;\n overflow-y: auto;\n }\n\n.spoil{\n width: 100%;\n background-color: rgb(71, 71, 71);\n color: rgb(71, 71, 71);\n}" + +/***/ }), + +/***/ "./src/app/components/player-ui/player-ui.component.html": +/*!***************************************************************!*\ + !*** ./src/app/components/player-ui/player-ui.component.html ***! + \***************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +module.exports = "
\n \n
You are 👺 #{{gameDataModel.player.id}} 🧠\n 💉 HP: {{gameDataModel.player.hp}}%
\n
token 🗝️ {{gameDataModel.player.player_key}}
\n If you want to play on the new machine, just copy and past this ID and Token and enter them when you reconnect.\n
\n
🎒 inventory, the items you own
\n ------------------------------------------
\n
\n 💍 {{item.name}}\n quantity: {{item.value}}
\n action: {{item.action}}
\n description: {{item.description}}
\n
\n ------------------------------------------
\n\n \n
" + +/***/ }), + +/***/ "./src/app/components/player-ui/player-ui.component.ts": +/*!*************************************************************!*\ + !*** ./src/app/components/player-ui/player-ui.component.ts ***! + \*************************************************************/ +/*! exports provided: PlayerUiComponent */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PlayerUiComponent", function() { return PlayerUiComponent; }); +/* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm5/core.js"); +/* harmony import */ var _models_game_data_model__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../models/game-data.model */ "./src/app/models/game-data.model.ts"); +/* harmony import */ var src_app_services_game_uiservice_service__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! src/app/services/game-uiservice.service */ "./src/app/services/game-uiservice.service.ts"); +var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +var __metadata = (undefined && undefined.__metadata) || function (k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); +}; + + + +var PlayerUiComponent = /** @class */ (function () { + function PlayerUiComponent(gameUIServiceService) { + this.gameUIServiceService = gameUIServiceService; + } + PlayerUiComponent.prototype.ngOnInit = function () { + }; + PlayerUiComponent.prototype.close = function () { + this.gameUIServiceService.changeState(src_app_services_game_uiservice_service__WEBPACK_IMPORTED_MODULE_2__["GameUIServiceService"].STATE_GAME_RUNNING); + }; + __decorate([ + Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"])(), + __metadata("design:type", _models_game_data_model__WEBPACK_IMPORTED_MODULE_1__["GameDataModel"]) + ], PlayerUiComponent.prototype, "gameDataModel", void 0); + PlayerUiComponent = __decorate([ + Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Component"])({ + selector: 'app-player-ui', + template: __webpack_require__(/*! ./player-ui.component.html */ "./src/app/components/player-ui/player-ui.component.html"), + styles: [__webpack_require__(/*! ./player-ui.component.css */ "./src/app/components/player-ui/player-ui.component.css")] + }), + __metadata("design:paramtypes", [src_app_services_game_uiservice_service__WEBPACK_IMPORTED_MODULE_2__["GameUIServiceService"]]) + ], PlayerUiComponent); + return PlayerUiComponent; +}()); + + + +/***/ }), + +/***/ "./src/app/components/post-viewer-ui/post-viewer-ui.component.css": +/*!************************************************************************!*\ + !*** ./src/app/components/post-viewer-ui/post-viewer-ui.component.css ***! + \************************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +module.exports = ".post-viewer-ui-message{\n position:relative;\n /*max-width: 650px;*/\n left: 0;\n right: 0;\n margin: auto;\n padding : 10px;\n margin-bottom : 18px;\n background: rgb(189, 198, 247);\n border-style: solid;\n border-width: 1px;\n border-color: #a99ec7;\n border-radius: 5px;\n height: 95%;\n width: 100%;\n overflow-y: auto;\n }\n\ndiv {\n margin-bottom: 8px;\n}\n\n#message-ascii {\n max-width: 650px;\n font-family: monospace;\n white-space: pre;\n}\n\n::ng-deep .img-preview img, .img-preview video, .img-preview iframe, .img-preview audio {\n max-width: 600px;\n max-height: 400px;\n}\n\nbutton{\n margin: 1px 1px 4px 1px;\n }" + +/***/ }), + +/***/ "./src/app/components/post-viewer-ui/post-viewer-ui.component.html": +/*!*************************************************************************!*\ + !*** ./src/app/components/post-viewer-ui/post-viewer-ui.component.html ***! + \*************************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +module.exports = "
\n\n
\n >>{{postModel.id}} Δ, by #{{postModel.player_id}}
\n
= 0\" >Reply to >>{{ postModel.reply }}
\n
{{postModel.message}}
\n
\n \n \n
\n URL: {{postModel.url}}
\n To report content, write to monsieur.krunch@gmail.com, mentionning the ID of the post.
\n
\n -----------------------------------------------------
\n
\n \n \n \n \n
\n
\n\n
\n >>{{post.id}} Δ by #{{post.player_id}}
\n
= 0\" >Reply to >>{{ post.reply }}
\n
{{post.message}}
\n
\n \n
\n URL: {{post.url}}
\n To report content, write to monsieur.krunch@gmail.com, mentionning the ID of the post.
\n
\n -----------------------------------------------------
\n
\n \n \n \n \n
\n
\n\n
" + +/***/ }), + +/***/ "./src/app/components/post-viewer-ui/post-viewer-ui.component.ts": +/*!***********************************************************************!*\ + !*** ./src/app/components/post-viewer-ui/post-viewer-ui.component.ts ***! + \***********************************************************************/ +/*! exports provided: PostViewerUiComponent */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PostViewerUiComponent", function() { return PostViewerUiComponent; }); +/* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm5/core.js"); +/* harmony import */ var _models_post_model__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../models/post.model */ "./src/app/models/post.model.ts"); +/* harmony import */ var _services_game_uiservice_service__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../services/game-uiservice.service */ "./src/app/services/game-uiservice.service.ts"); +/* harmony import */ var src_app_utils_urlParser__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! src/app/utils/urlParser */ "./src/app/utils/urlParser.ts"); +/* harmony import */ var src_app_services_chan_web_service__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! src/app/services/chan-web.service */ "./src/app/services/chan-web.service.ts"); +/* harmony import */ var _models_game_data_model__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../models/game-data.model */ "./src/app/models/game-data.model.ts"); +/* harmony import */ var _interfaces_player_interface_player_interface_component__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../interfaces/player-interface/player-interface.component */ "./src/app/interfaces/player-interface/player-interface.component.ts"); +var __extends = (undefined && undefined.__extends) || (function () { + var extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +var __metadata = (undefined && undefined.__metadata) || function (k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); +}; + + + + + + + +var PostViewerUiComponent = /** @class */ (function (_super) { + __extends(PostViewerUiComponent, _super); + function PostViewerUiComponent(gameUIServiceService, chanWebService) { + var _this = _super.call(this) || this; + _this.gameUIServiceService = gameUIServiceService; + _this.chanWebService = chanWebService; + _this.pin = new _angular_core__WEBPACK_IMPORTED_MODULE_0__["EventEmitter"](); + _this.onReply = new _angular_core__WEBPACK_IMPORTED_MODULE_0__["EventEmitter"](); + _this.postModelList = []; + return _this; + } + PostViewerUiComponent.prototype.ngOnInit = function () { + var _this = this; + if (this.postModel) { + this.imgValue = new src_app_utils_urlParser__WEBPACK_IMPORTED_MODULE_3__["UrlParser"](this.postModel.url).getImage(); + this.chanWebService.getReplyPostList(this.postModel.id).subscribe(function (data_) { + console.log(data_); + if (data_.result) { + if (data_.result.length && data_.result.length > 0) { + if (data_.result[0].id != null) + _this.postModelList = data_.result; + } + } + }); + } + }; + PostViewerUiComponent.prototype.ngOnChanges = function (changes) { + if (changes != null && changes.postModel != null) { + this.postModel = changes.postModel.currentValue; + if (this.postModel != null || this.postModel != undefined) + this.imgValue = new src_app_utils_urlParser__WEBPACK_IMPORTED_MODULE_3__["UrlParser"](this.postModel.url).getImage(); + } + }; + PostViewerUiComponent.prototype.closePost = function () { + this.gameUIServiceService.changeState(_services_game_uiservice_service__WEBPACK_IMPORTED_MODULE_2__["GameUIServiceService"].STATE_GAME_RUNNING); + }; + PostViewerUiComponent.prototype.pinPost = function (postModel_) { + this.pin.emit(postModel_); + }; + PostViewerUiComponent.prototype.deletePost = function (postModel_) { + var _this = this; + this.postToDelete = postModel_; + console.log("this.postToDelete:" + this.postToDelete); + this.chanWebService.deletePost(postModel_.id, postModel_.map_key).subscribe( + //Data success + function (data) { + _this.gameUIServiceService.deletePost(_this.postToDelete); + _this.gameUIServiceService.forceWS(); + _this.gameUIServiceService.changeState(_services_game_uiservice_service__WEBPACK_IMPORTED_MODULE_2__["GameUIServiceService"].STATE_GAME_RUNNING); + }); + }; + PostViewerUiComponent.prototype.canonPost = function (id_, thread_) { + var _this = this; + this.chanWebService.canonPost(id_, thread_).subscribe( + //Data success + function (data) { + _this.gameUIServiceService.forceWS(); + _this.gameUIServiceService.changeState(_services_game_uiservice_service__WEBPACK_IMPORTED_MODULE_2__["GameUIServiceService"].STATE_GAME_RUNNING); + }); + }; + PostViewerUiComponent.prototype.banPost = function () { + }; + PostViewerUiComponent.prototype.setPostUrlToFile = function (id_) { + this.chanWebService.setPostUrlToFile(id_).subscribe( + //Data success + function (data) { + alert(data); + }); + }; + PostViewerUiComponent.prototype.reply = function (postModel_) { + console.log(postModel_.id); + this.onReply.emit(postModel_.id); + this.gameUIServiceService.changeState(_services_game_uiservice_service__WEBPACK_IMPORTED_MODULE_2__["GameUIServiceService"].STATE_GAME_RUNNING); + }; + __decorate([ + Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"])(), + __metadata("design:type", _models_post_model__WEBPACK_IMPORTED_MODULE_1__["PostModel"]) + ], PostViewerUiComponent.prototype, "postModel", void 0); + __decorate([ + Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"])(), + __metadata("design:type", _models_game_data_model__WEBPACK_IMPORTED_MODULE_5__["GameDataModel"]) + ], PostViewerUiComponent.prototype, "gameData", void 0); + __decorate([ + Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Output"])(), + __metadata("design:type", Object) + ], PostViewerUiComponent.prototype, "pin", void 0); + __decorate([ + Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Output"])(), + __metadata("design:type", Object) + ], PostViewerUiComponent.prototype, "onReply", void 0); + PostViewerUiComponent = __decorate([ + Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Component"])({ + selector: 'app-post-viewer-ui', + template: __webpack_require__(/*! ./post-viewer-ui.component.html */ "./src/app/components/post-viewer-ui/post-viewer-ui.component.html"), + styles: [__webpack_require__(/*! ./post-viewer-ui.component.css */ "./src/app/components/post-viewer-ui/post-viewer-ui.component.css")] + }), + __metadata("design:paramtypes", [_services_game_uiservice_service__WEBPACK_IMPORTED_MODULE_2__["GameUIServiceService"], src_app_services_chan_web_service__WEBPACK_IMPORTED_MODULE_4__["ChanWebService"]]) + ], PostViewerUiComponent); + return PostViewerUiComponent; +}(_interfaces_player_interface_player_interface_component__WEBPACK_IMPORTED_MODULE_6__["PlayerInterfaceComponent"])); + + + +/***/ }), + +/***/ "./src/app/components/posting-ui/posting-ui.component.css": +/*!****************************************************************!*\ + !*** ./src/app/components/posting-ui/posting-ui.component.css ***! + \****************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +module.exports = ".post-ui-message{\n position:relative;\n max-width: 650px;\n left: 0;\n right: 0;\n margin: auto;\n\n padding : 10px;\n margin-bottom : 18px;\n background-color: rgb(189, 198, 247);\n border-style: solid;\n border-width: 1px;\n border-color: #a99ec7;\n border-radius: 5px;\n\n height: 100%;\n overflow-y: auto;\n }\n\ndiv {\n margin-bottom: 8px;\n}\n\ntextarea\n{\n width: 100%;\n margin: 0;\n}\n\n.post-message {\n padding : 10px;\n margin-bottom : 18px;\n background: rgb(228, 221, 221);\n border-style: solid;\n border-width: 1px;\n border-color: rgb(131, 123, 123);\n border-radius: 5px;\n}\n\n.img-preview{\n max-width: 200px;\n max-height: 200px;\n}\n\n.post-torrent-info{\n font-family: 'Courier New', Courier, monospace;\n font-size: small;\n padding : 8px;\n color: white;\n background:rgb(70, 61, 56);\n border-radius: 5px;\n}\n\n.post-message img {\n max-width: 650px;\n width: 100%;\n height: auto;\n}\n\n.post-message video {\n max-width: 650px;\n width: 100%;\n height: auto;\n}\n\n.post-message audio {\n max-width: 650px;\n width: 100%;\n}\n\nbutton{\n margin: 1px 1px 4px 1px;\n }" + +/***/ }), + +/***/ "./src/app/components/posting-ui/posting-ui.component.html": +/*!*****************************************************************!*\ + !*** ./src/app/components/posting-ui/posting-ui.component.html ***! + \*****************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +module.exports = "
\n\n
\n \n
= 0\" >reply to >>{{ reply }} 🗑️
\n Message:
\n \n
\n\n
\n Host on chan
\n
\n
\n
\n \n\n
\n File URL:
\n
\n
\n \n
\n File From the computer:
\n
\n\n Open phone posting link!
\n
\n\n
\n\n \n \n \n\n
\n\n
\n Posting in progress..\n
\n
\n
\n
\n\n
\n Your message has been posted! thanks for your contribution!\n
\n\n \n\n
\n" + +/***/ }), + +/***/ "./src/app/components/posting-ui/posting-ui.component.ts": +/*!***************************************************************!*\ + !*** ./src/app/components/posting-ui/posting-ui.component.ts ***! + \***************************************************************/ +/*! exports provided: PostingUIComponent */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PostingUIComponent", function() { return PostingUIComponent; }); +/* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm5/core.js"); +/* harmony import */ var _services_game_uiservice_service__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../services/game-uiservice.service */ "./src/app/services/game-uiservice.service.ts"); +/* harmony import */ var _models_post_model__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../models/post.model */ "./src/app/models/post.model.ts"); +/* harmony import */ var src_app_services_chan_web_service__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! src/app/services/chan-web.service */ "./src/app/services/chan-web.service.ts"); +/* harmony import */ var src_app_utils_urlParser__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! src/app/utils/urlParser */ "./src/app/utils/urlParser.ts"); +/* harmony import */ var _interfaces_player_interface_player_interface_component__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../interfaces/player-interface/player-interface.component */ "./src/app/interfaces/player-interface/player-interface.component.ts"); +/* harmony import */ var _angular_router__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @angular/router */ "./node_modules/@angular/router/fesm5/router.js"); +/* harmony import */ var src_app_services_offline_service__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! src/app/services/offline.service */ "./src/app/services/offline.service.ts"); +/* harmony import */ var _angular_platform_browser__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @angular/platform-browser */ "./node_modules/@angular/platform-browser/fesm5/platform-browser.js"); +/* harmony import */ var _environments_environment__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../../environments/environment */ "./src/environments/environment.ts"); +var __extends = (undefined && undefined.__extends) || (function () { + var extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +var __metadata = (undefined && undefined.__metadata) || function (k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); +}; +var __param = (undefined && undefined.__param) || function (paramIndex, decorator) { + return function (target, key) { decorator(target, key, paramIndex); } +}; + + + + + + + + + + +var PostingUIComponent = /** @class */ (function (_super) { + __extends(PostingUIComponent, _super); + function PostingUIComponent(gameUIServiceService, chanWebService, router, offlineService, document) { + var _this = _super.call(this) || this; + _this.gameUIServiceService = gameUIServiceService; + _this.chanWebService = chanWebService; + _this.router = router; + _this.offlineService = offlineService; + _this.document = document; + _this.onDestroyReply = new _angular_core__WEBPACK_IMPORTED_MODULE_0__["EventEmitter"](); + _this.isLoading = false; + _this.postingFinished = false; + _this.hostFile = false; + return _this; + } + PostingUIComponent.prototype.ngOnInit = function () { + this.postModel = new _models_post_model__WEBPACK_IMPORTED_MODULE_2__["PostModel"](); + this.urlParse = new src_app_utils_urlParser__WEBPACK_IMPORTED_MODULE_4__["UrlParser"](this.postModel.url); + this.postModel.canvas_key = this.canvasKey; + this.postModel.reply = this.reply; + }; + PostingUIComponent.prototype.ngOnChanges = function (changes) { + if (this.postModel != null && changes.canvasKey != null) + this.postModel.canvas_key = changes.canvasKey.currentValue; + if (this.isPhonePosting) + this.hostFile = true; + }; + PostingUIComponent.prototype.changeHost = function (val_) { + this.hostFile = val_; + }; + PostingUIComponent.prototype.preview = function (files) { + var _this = this; + if (files.length === 0) + return; + var mimeType = files[0].type; + if (mimeType.match(/image\/*/) == null) { + alert("Only images are supported."); + return; + } + var reader = new FileReader(); + this.imagePath = files; + reader.readAsDataURL(files[0]); + reader.onload = function (_event) { + //console.log(reader.result.toString()); + _this.fileBase64Url = reader.result.toString(); + }; + }; + PostingUIComponent.prototype.sendPost = function () { + var _this = this; + //this.gameUIServiceService.sendPost(this.postModel); + console.log(this.file); + if (this.fileBase64Url == null && !this.postModel.url && !this.postModel.message) { + alert("It's doesn't looks like a big post :( "); + return; + } + this.isLoading = true; + //Use this. + if (this.hostFile) { + //To host + this.chanWebService.createAndUploadPaint(this.postModel, this.fileBase64Url).subscribe( + //Data success + function (data) { + var postStuffResponse = data; + if (postStuffResponse.ok) { + _this.destroyReply(); + //console.log("result "+JSON.stringify( postStuffResponse)); + _this.gameUIServiceService.forceWS(); + _this.gameUIServiceService.changeState(_services_game_uiservice_service__WEBPACK_IMPORTED_MODULE_1__["GameUIServiceService"].STATE_GAME_RUNNING); + } + _this.isLoading = false; + _this.postingFinished = true; + }, function (error) { + console.log(JSON.stringify(error)); + _this.isLoading = false; + }); + } + else { + //Not hosting + this.chanWebService.createPost(this.postModel).subscribe( + //Data success + function (data) { + var postStuffResponse = data; + if (postStuffResponse.ok) { + //console.log("result "+JSON.stringify( postStuffResponse)); + _this.destroyReply(); + //We clean the fields + _this.postModel.url = ""; + _this.postModel.message = ""; + _this.gameUIServiceService.forceWS(); + _this.gameUIServiceService.changeState(_services_game_uiservice_service__WEBPACK_IMPORTED_MODULE_1__["GameUIServiceService"].STATE_GAME_RUNNING); + } + _this.isLoading = false; + _this.postingFinished = true; + }, function (error) { + console.log(JSON.stringify(error)); + _this.isLoading = false; + }); + } + }; + PostingUIComponent.prototype.cancelPost = function () { + this.gameUIServiceService.changeState(_services_game_uiservice_service__WEBPACK_IMPORTED_MODULE_1__["GameUIServiceService"].STATE_GAME_RUNNING); + }; + PostingUIComponent.prototype.getPhoneLink = function () { + var playerModel = this.offlineService.getPlayerData(); + var phonePostingUrl = _environments_environment__WEBPACK_IMPORTED_MODULE_9__["environment"].clientUrl + "phone-poster/" + playerModel.id + "/" + playerModel.player_key + "/" + this.postModel.canvas_key; + return phonePostingUrl; + }; + PostingUIComponent.prototype.destroyReply = function () { + console.log("destroyReply()"); + this.reply = -1; + this.onDestroyReply.emit(-1); + }; + __decorate([ + Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"])(), + __metadata("design:type", String) + ], PostingUIComponent.prototype, "canvasKey", void 0); + __decorate([ + Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"])(), + __metadata("design:type", Number) + ], PostingUIComponent.prototype, "reply", void 0); + __decorate([ + Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Output"])(), + __metadata("design:type", Object) + ], PostingUIComponent.prototype, "onDestroyReply", void 0); + PostingUIComponent = __decorate([ + Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Component"])({ + selector: 'app-posting-ui', + template: __webpack_require__(/*! ./posting-ui.component.html */ "./src/app/components/posting-ui/posting-ui.component.html"), + styles: [__webpack_require__(/*! ./posting-ui.component.css */ "./src/app/components/posting-ui/posting-ui.component.css")] + }), + __param(4, Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Inject"])(_angular_platform_browser__WEBPACK_IMPORTED_MODULE_8__["DOCUMENT"])), + __metadata("design:paramtypes", [_services_game_uiservice_service__WEBPACK_IMPORTED_MODULE_1__["GameUIServiceService"], + src_app_services_chan_web_service__WEBPACK_IMPORTED_MODULE_3__["ChanWebService"], + _angular_router__WEBPACK_IMPORTED_MODULE_6__["Router"], + src_app_services_offline_service__WEBPACK_IMPORTED_MODULE_7__["OfflineService"], + Document]) + ], PostingUIComponent); + return PostingUIComponent; +}(_interfaces_player_interface_player_interface_component__WEBPACK_IMPORTED_MODULE_5__["PlayerInterfaceComponent"])); + + + +/***/ }), + +/***/ "./src/app/components/tile-edit/tile-edit.component.css": +/*!**************************************************************!*\ + !*** ./src/app/components/tile-edit/tile-edit.component.css ***! + \**************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +module.exports = ".disable-select {\n user-select: none; /* supported by Chrome and Opera */\n -webkit-user-select: none; /* Safari */\n -khtml-user-select: none; /* Konqueror HTML */\n -moz-user-select: none; /* Firefox */\n -ms-user-select: none; /* Internet Explorer/Edge */\n}" + +/***/ }), + +/***/ "./src/app/components/tile-edit/tile-edit.component.html": +/*!***************************************************************!*\ + !*** ./src/app/components/tile-edit/tile-edit.component.html ***! + \***************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +module.exports = "{{tileDisplay}}\n" + +/***/ }), + +/***/ "./src/app/components/tile-edit/tile-edit.component.ts": +/*!*************************************************************!*\ + !*** ./src/app/components/tile-edit/tile-edit.component.ts ***! + \*************************************************************/ +/*! exports provided: TileEditComponent */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TileEditComponent", function() { return TileEditComponent; }); +/* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm5/core.js"); +var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +var __metadata = (undefined && undefined.__metadata) || function (k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); +}; + +var TileEditComponent = /** @class */ (function () { + function TileEditComponent() { + this.valueChange = new _angular_core__WEBPACK_IMPORTED_MODULE_0__["EventEmitter"](); + this.allTiles = []; + this.tileDisplay = ""; + } + TileEditComponent.prototype.ngOnInit = function () { + }; + TileEditComponent.prototype.paint = function () { + //this.tileValue = this.tileBrush; + this.valueChange.emit({ x: this.x, y: this.y }); + //this.updateDisplay(); + }; + TileEditComponent.prototype.ngOnChanges = function () { + this.updateDisplay(); + }; + TileEditComponent.prototype.updateDisplay = function () { + var _this = this; + if (this.allTiles != null) { + this.allTiles.forEach(function (tile) { + if (tile.value == _this.tileValue) { + _this.tileDisplay = tile.display; + return; + } + }); + } + }; + __decorate([ + Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"])(), + __metadata("design:type", Object) + ], TileEditComponent.prototype, "tileValue", void 0); + __decorate([ + Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"])(), + __metadata("design:type", Object) + ], TileEditComponent.prototype, "tileBrush", void 0); + __decorate([ + Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"])(), + __metadata("design:type", Object) + ], TileEditComponent.prototype, "x", void 0); + __decorate([ + Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"])(), + __metadata("design:type", Object) + ], TileEditComponent.prototype, "y", void 0); + __decorate([ + Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Output"])(), + __metadata("design:type", Object) + ], TileEditComponent.prototype, "valueChange", void 0); + __decorate([ + Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"])(), + __metadata("design:type", Array) + ], TileEditComponent.prototype, "allTiles", void 0); + TileEditComponent = __decorate([ + Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Component"])({ + selector: 'app-tile-edit', + template: __webpack_require__(/*! ./tile-edit.component.html */ "./src/app/components/tile-edit/tile-edit.component.html"), + styles: [__webpack_require__(/*! ./tile-edit.component.css */ "./src/app/components/tile-edit/tile-edit.component.css")] + }), + __metadata("design:paramtypes", []) + ], TileEditComponent); + return TileEditComponent; +}()); + + + +/***/ }), + +/***/ "./src/app/interfaces/player-interface/player-interface.component.css": +/*!****************************************************************************!*\ + !*** ./src/app/interfaces/player-interface/player-interface.component.css ***! + \****************************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +module.exports = "" + +/***/ }), + +/***/ "./src/app/interfaces/player-interface/player-interface.component.html": +/*!*****************************************************************************!*\ + !*** ./src/app/interfaces/player-interface/player-interface.component.html ***! + \*****************************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +module.exports = "" + +/***/ }), + +/***/ "./src/app/interfaces/player-interface/player-interface.component.ts": +/*!***************************************************************************!*\ + !*** ./src/app/interfaces/player-interface/player-interface.component.ts ***! + \***************************************************************************/ +/*! exports provided: PlayerInterfaceComponent */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PlayerInterfaceComponent", function() { return PlayerInterfaceComponent; }); +/* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm5/core.js"); +/* harmony import */ var src_app_utils_constants__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! src/app/utils/constants */ "./src/app/utils/constants.ts"); +/* harmony import */ var _models_game_data_model__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../models/game-data.model */ "./src/app/models/game-data.model.ts"); +var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +var __metadata = (undefined && undefined.__metadata) || function (k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); +}; + + + +var PlayerInterfaceComponent = /** @class */ (function () { + function PlayerInterfaceComponent() { + this.gameDataModel = new _models_game_data_model__WEBPACK_IMPORTED_MODULE_2__["GameDataModel"](); + } + PlayerInterfaceComponent.prototype.ngOnInit = function () { + if (this.gameDataModel == null) + this.gameDataModel = new _models_game_data_model__WEBPACK_IMPORTED_MODULE_2__["GameDataModel"](); + }; + //test + PlayerInterfaceComponent.prototype.canDelete = function () { + if (this.gameDataModel.player.is_admin) + return true; + for (var _i = 0, _a = this.gameDataModel.itemsPlayer; _i < _a.length; _i++) { + var item = _a[_i]; + if (item.action.toLowerCase().indexOf(src_app_utils_constants__WEBPACK_IMPORTED_MODULE_1__["Constants"].ITEM_KEY_DELETE_SPONGE) >= 0) + return true; + } + return false; + }; + PlayerInterfaceComponent.prototype.canFav = function () { + if (this.gameDataModel.player.is_admin) + return true; + for (var _i = 0, _a = this.gameDataModel.itemsPlayer; _i < _a.length; _i++) { + var item = _a[_i]; + if (item.action.toLowerCase().indexOf(src_app_utils_constants__WEBPACK_IMPORTED_MODULE_1__["Constants"].ITEM_KEY_VARNISH) >= 0) + return true; + } + return false; + }; + PlayerInterfaceComponent.prototype.canUpload = function () { + if (this.gameDataModel.player.is_admin || this.isPhonePosting) + return true; + for (var _i = 0, _a = this.gameDataModel.itemsPlayer; _i < _a.length; _i++) { + var item = _a[_i]; + if (item.action.toLowerCase().indexOf(src_app_utils_constants__WEBPACK_IMPORTED_MODULE_1__["Constants"].ITEM_KEY_UPLOAD_RING) >= 0) + return true; + } + return false; + }; + PlayerInterfaceComponent.prototype.isAdmin = function () { + if (this.gameDataModel.player.is_admin) + return true; + return false; + }; + __decorate([ + Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"])(), + __metadata("design:type", _models_game_data_model__WEBPACK_IMPORTED_MODULE_2__["GameDataModel"]) + ], PlayerInterfaceComponent.prototype, "gameDataModel", void 0); + __decorate([ + Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"])(), + __metadata("design:type", Boolean) + ], PlayerInterfaceComponent.prototype, "isPhonePosting", void 0); + PlayerInterfaceComponent = __decorate([ + Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Component"])({ + selector: 'app-player-interface', + template: __webpack_require__(/*! ./player-interface.component.html */ "./src/app/interfaces/player-interface/player-interface.component.html"), + styles: [__webpack_require__(/*! ./player-interface.component.css */ "./src/app/interfaces/player-interface/player-interface.component.css")] + }), + __metadata("design:paramtypes", []) + ], PlayerInterfaceComponent); + return PlayerInterfaceComponent; +}()); + + + +/***/ }), + +/***/ "./src/app/models/action.model.ts": +/*!****************************************!*\ + !*** ./src/app/models/action.model.ts ***! + \****************************************/ +/*! exports provided: ActionModel */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ActionModel", function() { return ActionModel; }); +var ActionModel = /** @class */ (function () { + function ActionModel() { + } + return ActionModel; +}()); + + + +/***/ }), + +/***/ "./src/app/models/config.model.ts": +/*!****************************************!*\ + !*** ./src/app/models/config.model.ts ***! + \****************************************/ +/*! exports provided: ConfigModel */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ConfigModel", function() { return ConfigModel; }); +var ConfigModel = /** @class */ (function () { + function ConfigModel() { + } + return ConfigModel; +}()); + + + +/***/ }), + +/***/ "./src/app/models/game-data.model.ts": +/*!*******************************************!*\ + !*** ./src/app/models/game-data.model.ts ***! + \*******************************************/ +/*! exports provided: GameDataModel */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "GameDataModel", function() { return GameDataModel; }); +/* harmony import */ var _player_model__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./player.model */ "./src/app/models/player.model.ts"); + +var GameDataModel = /** @class */ (function () { + function GameDataModel() { + this.player = new _player_model__WEBPACK_IMPORTED_MODULE_0__["PlayerModel"](); + this.itemsPlayer = []; + } + return GameDataModel; +}()); + + + +/***/ }), + +/***/ "./src/app/models/interaction-model.ts": +/*!*********************************************!*\ + !*** ./src/app/models/interaction-model.ts ***! + \*********************************************/ +/*! exports provided: InteractionModel */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "InteractionModel", function() { return InteractionModel; }); +var InteractionModel = /** @class */ (function () { + function InteractionModel() { + } + Object.defineProperty(InteractionModel, "TYPE_NONE", { + get: function () { return 0; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(InteractionModel, "TYPE_CANVAS_FULL", { + get: function () { return 1; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(InteractionModel, "TYPE_CANVAS_VIRGIN", { + get: function () { return 2; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(InteractionModel, "TYPE_CLIMB_LADDER", { + get: function () { return 3; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(InteractionModel, "TYPE_OPEN_DOOR", { + get: function () { return 4; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(InteractionModel, "TYPE_GET_ITEM", { + get: function () { return 5; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(InteractionModel, "TYPE_PASS_GATE", { + get: function () { return 6; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(InteractionModel, "TYPE_PANEL", { + get: function () { return 7; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(InteractionModel, "TYPE_CANVAS_TO_GRAFF", { + get: function () { return 8; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(InteractionModel, "TYPE_AD", { + get: function () { return 9; }, + enumerable: true, + configurable: true + }); + return InteractionModel; +}()); + + + +/***/ }), + +/***/ "./src/app/models/player.model.ts": +/*!****************************************!*\ + !*** ./src/app/models/player.model.ts ***! + \****************************************/ +/*! exports provided: PlayerModel */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PlayerModel", function() { return PlayerModel; }); +var PlayerModel = /** @class */ (function () { + function PlayerModel() { + } + return PlayerModel; +}()); + + + +/***/ }), + +/***/ "./src/app/models/post.model.ts": +/*!**************************************!*\ + !*** ./src/app/models/post.model.ts ***! + \**************************************/ +/*! exports provided: PostModel */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PostModel", function() { return PostModel; }); +var PostModel = /** @class */ (function () { + function PostModel() { + this.map_key = ""; + this.message = ""; + this.url = ""; + this.preview = ""; + this.nsfw = false; + this.graffiti = false; + this.is_canon = false; + this.was_deleted = false; + } + return PostModel; +}()); + + + +/***/ }), + +/***/ "./src/app/motor/canvasPlane.ts": +/*!**************************************!*\ + !*** ./src/app/motor/canvasPlane.ts ***! + \**************************************/ +/*! exports provided: CanvasPlane */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CanvasPlane", function() { return CanvasPlane; }); +/* harmony import */ var babylonjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! babylonjs */ "./node_modules/babylonjs/babylon.js"); +/* harmony import */ var babylonjs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(babylonjs__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var _game__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./game */ "./src/app/motor/game.ts"); +/* harmony import */ var _mapMaker__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./mapMaker */ "./src/app/motor/mapMaker.ts"); +/* harmony import */ var _models_post_model__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../models/post.model */ "./src/app/models/post.model.ts"); +/* harmony import */ var _utils_urlParser__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../utils/urlParser */ "./src/app/utils/urlParser.ts"); + + + + + +var CanvasPlane = /** @class */ (function () { + function CanvasPlane(objType_, dictKey, size, x, y, z, dir) { + this.objType = "canvas"; + this.isVirgin = true; + this.font_size = 70; + this.font = "bold " + this.font_size + "px Arial"; + this.canvasScale = 900; + //Manage diff percentage of size + this.objType = objType_; + this.sizeCanvas = size; + var scaling = (objType_ === "canvas") ? 0.9 : 1; + this.sizeCanvas = this.sizeCanvas * scaling; + this.dictKey = this.objType + "_" + dictKey + "_" + dir; + this.gameInstance = _game__WEBPACK_IMPORTED_MODULE_1__["Game"].getInstance(); + this.mapInstance = _mapMaker__WEBPACK_IMPORTED_MODULE_2__["MapMaker"].getInstance(); + this.planeMesh = babylonjs__WEBPACK_IMPORTED_MODULE_0__["MeshBuilder"].CreatePlane(this.dictKey, { size: this.sizeCanvas }, this.gameInstance.scene); + this.planeMesh.position.y = (size * 0.5) + y; + if (this.objType == "canvas") { + this.mapInstance.registerNewCanvas(this.dictKey, this); + } + else { + this.mapInstance.registerNewAd(this.dictKey, this); + } + //Determine the orientation of the canvas + //let dir = this.mapInstance.getCanvasOrientation( this.tileCoordonates[0], this.tileCoordonates[1]); + //console.log("TILE DIR= "+dir); + var canvasX; + var canvasY; + var canvasZ; + var canvasAngle; + var gapToTheWall = 0.1; + /* + canvasX = x; + canvasY = (size * -0.5) - (size * 0.1) + y;*/ + switch (dir) { + case this.mapInstance.DIR_N: + canvasX = x; + canvasZ = (size * -0.5) - gapToTheWall + z; + canvasAngle = 0; + break; + case this.mapInstance.DIR_E: + canvasX = (size * -0.5) - gapToTheWall + x; + canvasZ = z; + canvasAngle = (Math.PI / 180) * 90; + break; + case this.mapInstance.DIR_S: + canvasX = x; + canvasZ = (size * 0.5) + gapToTheWall + z; + canvasAngle = (Math.PI / 180) * 180; + break; + case this.mapInstance.DIR_W: + canvasX = (size * 0.5) + gapToTheWall + x; + canvasZ = z; + canvasAngle = (Math.PI / 180) * 270; + break; + } + this.planeMesh.position.x = canvasX; + this.planeMesh.position.z = canvasZ; + this.planeMesh.rotate(BABYLON.Axis.Y, canvasAngle, BABYLON.Space.WORLD); + var mat = new babylonjs__WEBPACK_IMPORTED_MODULE_0__["StandardMaterial"]("matCanvas", this.gameInstance.scene); + mat.alpha = 0; + this.planeMesh.material = mat; + this.planeMesh.visibility = 0; + this.planeMesh.material.freeze(); + this.planeMesh.freezeWorldMatrix(); + this.postModel = new _models_post_model__WEBPACK_IMPORTED_MODULE_3__["PostModel"](); + this.postModel.canvas_key = this.dictKey; + } + /* + private displayUI: GUI.Rectangle; + private uiAdvancedTexture: GUI.AdvancedDynamicTexture; + private label : GUI.TextBlock;*/ + CanvasPlane.prototype.setPostData = function (postModel_) { + var _this = this; + this.initTextureObject(); + /* if(postModel_.graffiti) { + this.postModelGraffiti = postModel_; + } else {*/ + this.postModel = postModel_; + //} + var postImageUrl = this.postModel.url; + if (this.postModel.preview == null || this.postModel.preview.length === 0) { + postImageUrl = new _utils_urlParser__WEBPACK_IMPORTED_MODULE_4__["UrlParser"](postModel_.url).getImage(); + } + else { + postImageUrl = this.postModel.preview; + } + //Launch picture loading + if (postImageUrl.length > 0) { + if (postModel_.graffiti) { + this.postImageGraffiti = new Image(); + this.postImageGraffiti.crossOrigin = "anonymous"; + this.postImageGraffiti.src = postImageUrl; + this.postImageGraffiti.onload = function (event_) { + _this.imgLoaded(); + }; + this.postImageGraffiti.onerror = function (event_) { + _this.textureNonDynamic = new babylonjs__WEBPACK_IMPORTED_MODULE_0__["Texture"]("./assets/textures/404.png", _this.gameInstance.scene); + _this.mat.diffuseTexture = _this.textureNonDynamic; + _this.mat.diffuseTexture.hasAlpha = true; + _this.planeMesh.material = _this.mat; + _this.planeMesh.material.freeze(); + }; + } + else { + this.postImage = new Image(); + this.postImage.crossOrigin = "anonymous"; + this.postImage.src = postImageUrl; + this.postImage.onload = function (event_) { + _this.imgLoaded(); + }; + this.postImage.onerror = function (event_) { + _this.textureNonDynamic = new babylonjs__WEBPACK_IMPORTED_MODULE_0__["Texture"]("./assets/textures/404.png", _this.gameInstance.scene); + _this.mat.diffuseTexture = _this.textureNonDynamic; + _this.mat.diffuseTexture.hasAlpha = true; + _this.planeMesh.material = _this.mat; + _this.planeMesh.material.freeze(); + }; + } + } + else { + //this.texture.drawText(this.postModel.message, null, null, this.font, "#ffffff", "#00000000", true); + /* + this.texture.drawText(this.postModel.message, null, this.canvasScale *0.5, this.font, "#ffffff", "#00000000", true); + this.texture.drawText(this.postModel.message, null, (this.canvasScale *0.5) -4, this.font, "#000000", "#00000000", true);*/ + } + this.planeMesh.visibility = 1; + this.isVirgin = false; + this.gameInstance.cleanLastMesh(); + //Add text as UI? + if (this.postModel.message) { + this.texture.drawText(this.postModel.message, null, this.canvasScale * 0.5, this.font, "#7F7F7F", "#00000000", true); + this.texture.drawText(this.postModel.message, null, (this.canvasScale * 0.5) - 4, this.font, "#ffffff", "#00000000", true); + } + }; + //Dealing with post img loaded + CanvasPlane.prototype.imgLoaded = function () { + var ratio; + var newWidth; + var newHeight; + var newX = 0; + var newY = 0; + if (this.postImage != null) { + if (this.postImage.height > this.postImage.width) { + ratio = (this.objType === "canvas") ? this.canvasScale / this.postImage.height : this.canvasScale / this.postImage.width; + newWidth = this.postImage.width * ratio; + newHeight = this.postImage.height * ratio; + newX = (newWidth - this.canvasScale) * (-0.5); + } + else { + ratio = (this.objType === "canvas") ? this.canvasScale / this.postImage.width : this.canvasScale / this.postImage.height; + newWidth = this.postImage.width * ratio; + newHeight = this.postImage.height * ratio; + newY = (newHeight - this.canvasScale) * (-0.5); + } + this.textureContext.drawImage(this.postImage, newX, newY, newWidth, newHeight); + } + //If graffiti + if (this.postImageGraffiti != null) { + ratio = this.canvasScale / this.postImageGraffiti.width; + console.log("ratio= " + ratio); + newWidth = this.postImageGraffiti.width * ratio; + newHeight = this.postImageGraffiti.height * ratio; + //newY = (newHeight - this.canvasScale) * (-0.5); + this.textureContext.drawImage(this.postImageGraffiti, 0, 0, newWidth, newHeight); + } + if (this.postModel.url.toLocaleLowerCase().indexOf(".gif") > 0) { + this.texture.drawText(".GIF", null, this.canvasScale * 0.5, this.font, "#000000", "#00000000", true); + this.texture.drawText(".GIF", null, (this.canvasScale * 0.5) - 4, this.font, "#ffffff", "#00000000", true); + } + else if (new _utils_urlParser__WEBPACK_IMPORTED_MODULE_4__["UrlParser"](this.postModel.url).getUrlType() === _utils_urlParser__WEBPACK_IMPORTED_MODULE_4__["UrlParser"].TYPE_YOUTUBE) { + this.texture.drawText(">VID", null, this.canvasScale * 0.5, this.font, "#000000", "#00000000", true); + this.texture.drawText(">VID", null, (this.canvasScale * 0.5) - 4, this.font, "#ffffff", "#00000000", true); + } + else if (this.postModel.message) { + this.texture.drawText(this.postModel.message, null, this.canvasScale * 0.5, this.font, "#7F7F7F", "#00000000", true); + this.texture.drawText(this.postModel.message, null, (this.canvasScale * 0.5) - 4, this.font, "#ffffff", "#00000000", true); + } + /* else if(this.postModelGraffiti && this.postModelGraffiti.message) { + this.texture.drawText(this.postModelGraffiti.message, null, this.canvasScale *0.5, this.font, "#7F7F7F", "#00000000", true); + this.texture.drawText(this.postModelGraffiti.message, null, (this.canvasScale *0.5) -4, this.font, "#ffffff", "#00000000", true); + + }*/ + if (this.postModel.is_canon) { + this.texture.drawText("Δ", (newX) + 8, (newY) + 80, this.font, "#000000", "#00000000", true); + //mat.emissiveColor = new BABYLON.Color3(1, 1, 1); + } + this.texture.update(); + this.planeMesh.material = this.mat; + this.planeMesh.material.freeze(); + }; + CanvasPlane.prototype.initTextureObject = function () { + this.planeMesh.material.unfreeze(); + if (this.mat == null) { + this.mat = new babylonjs__WEBPACK_IMPORTED_MODULE_0__["StandardMaterial"]("mat", this.gameInstance.scene); + this.texture = new BABYLON.DynamicTexture("DynamicText", { width: this.canvasScale, height: this.canvasScale }, this.gameInstance.scene, false); + this.texture.hasAlpha = true; + this.textureContext = this.texture.getContext(); + this.mat.diffuseTexture = this.texture; + this.planeMesh.material = this.mat; + } + }; + CanvasPlane.prototype.deletePostData = function () { + //console.log("deletePostData= "+this.postModel.url+"; canvas_key: "+this.postModel.canvas_key); + this.postModel = new _models_post_model__WEBPACK_IMPORTED_MODULE_3__["PostModel"](); + this.postModel.canvas_key = this.dictKey; + this.isVirgin = true; + var mat = new babylonjs__WEBPACK_IMPORTED_MODULE_0__["StandardMaterial"]("matCanvas", this.gameInstance.scene); + mat.alpha = 0; + this.planeMesh.material.unfreeze(); + this.planeMesh.material = mat; + this.planeMesh.material.freeze(); + }; + CanvasPlane.prototype.setInterfaceVisible = function (val_) { + /* + //if(this.displayUI != null){ + + //this.displayUI.isVisible = val_; + if(this.postModel != null && this.postModel.message && this.uiAdvancedTexture != null){ + + if(val_){ + + //this.uiAdvancedTexture.addControl(this.displayUI); + //this.uiAdvancedTexture.addControl(this.label); + this.displayUI.isVisible = true; + + } else { + + //this.uiAdvancedTexture.removeControl(this.displayUI); + //this.uiAdvancedTexture.removeControl(this.label); + this.displayUI.isVisible = false; + + } + } + //} + */ + }; + return CanvasPlane; +}()); + + + +/***/ }), + +/***/ "./src/app/motor/door.ts": +/*!*******************************!*\ + !*** ./src/app/motor/door.ts ***! + \*******************************/ +/*! exports provided: Door */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Door", function() { return Door; }); +/* harmony import */ var babylonjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! babylonjs */ "./node_modules/babylonjs/babylon.js"); +/* harmony import */ var babylonjs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(babylonjs__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var _game__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./game */ "./src/app/motor/game.ts"); +/* harmony import */ var _mapMaker__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./mapMaker */ "./src/app/motor/mapMaker.ts"); + + + +var Door = /** @class */ (function () { + function Door(dictKey, size, x, y, z, secret_) { + this.objType = "door"; + this.doorOpen = false; + this.clooseDoorDelay = 600000; + this.isSecret = false; + this.sizeCanvas = size; + this.isSecret = secret_; + this.dictKey = this.objType + "_" + dictKey; + this.gameInstance = _game__WEBPACK_IMPORTED_MODULE_1__["Game"].getInstance(); + this.mapInstance = _mapMaker__WEBPACK_IMPORTED_MODULE_2__["MapMaker"].getInstance(); + this.closedY = size * 0.5 + y; + this.openedY = -size * 0.5 + y; + this.doorMesh = babylonjs__WEBPACK_IMPORTED_MODULE_0__["MeshBuilder"].CreateBox(this.dictKey, { size: this.sizeCanvas }, this.gameInstance.scene); + this.doorMesh.checkCollisions = true; + var mat = new babylonjs__WEBPACK_IMPORTED_MODULE_0__["StandardMaterial"]("matBoxDoor", this.gameInstance.scene); + if (!this.isSecret) { + mat.diffuseColor = BABYLON.Color3.Green(); + } + else { + var textureBox = new babylonjs__WEBPACK_IMPORTED_MODULE_0__["Texture"]("./assets/textures/concrete_text.jpg", this.gameInstance.scene); + mat.diffuseTexture = textureBox; + } + mat.freeze(); + this.doorMesh.material = mat; + this.doorMesh.position.y = this.closedY + y; + this.doorMesh.position.x = x; + this.doorMesh.position.z = z; + this.mapInstance.registerNewDoor(this.dictKey, this); + } + Door.prototype.openDoor = function () { + this.doorOpen = true; + this.updateDoor(); + /* + this.closeDoorInterval = setInterval(() => { + this.closeDoor(); + clearInterval( this.closeDoorInterval); + }, this.clooseDoorDelay );*/ + this.doorMesh.dispose(); + }; + Door.prototype.closeDoor = function () { + this.doorOpen = false; + this.updateDoor(); + }; + Door.prototype.updateDoor = function () { + console.log("open door this.doorMesh.position.y=" + this.doorMesh.position.y); + this.doorMesh.position.y = (this.doorOpen) ? this.openedY : this.closedY; + console.log("open door this.doorMesh.position.y=" + this.doorMesh.position.y); + }; + return Door; +}()); + + + +/***/ }), + +/***/ "./src/app/motor/game.ts": +/*!*******************************!*\ + !*** ./src/app/motor/game.ts ***! + \*******************************/ +/*! exports provided: Game */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Game", function() { return Game; }); +/* harmony import */ var babylonjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! babylonjs */ "./node_modules/babylonjs/babylon.js"); +/* harmony import */ var babylonjs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(babylonjs__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var babylonjs_gui__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! babylonjs-gui */ "./node_modules/babylonjs-gui/babylon.gui.min.js"); +/* harmony import */ var babylonjs_gui__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(babylonjs_gui__WEBPACK_IMPORTED_MODULE_1__); +/* harmony import */ var _mapMaker__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./mapMaker */ "./src/app/motor/mapMaker.ts"); +/* harmony import */ var _playerMotor__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./playerMotor */ "./src/app/motor/playerMotor.ts"); +/* harmony import */ var _services_game_uiservice_service__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../services/game-uiservice.service */ "./src/app/services/game-uiservice.service.ts"); +/* harmony import */ var _models_interaction_model__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../models/interaction-model */ "./src/app/models/interaction-model.ts"); +/* harmony import */ var _gameUtils__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./gameUtils */ "./src/app/motor/gameUtils.ts"); +/* harmony import */ var _utils_helpers__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../utils/helpers */ "./src/app/utils/helpers.ts"); + + + + + + + + +var Game = /** @class */ (function () { + function Game(canvasElement) { + var _this = this; + this.postListRequestDelay = 10000; + //private postListRequestDelay : number = 60000; + this.mapChanging = false; + this.mapKey = ""; + this.clientUrl = ""; + this.mapKeyOld = ""; + this.activateJoystick = false; + this.interactionDelay = 18; + this.interactionTimer = 0; + this.isError = false; + this.isPostLoaded = false; + this.isFirstLaunch = true; // test if player axist at first launch + this.playerName = ""; + this.playerTalk = ""; + //Set the instance + Game.instance = this; + this.canvas = document.getElementById(canvasElement); + this.engine = new babylonjs__WEBPACK_IMPORTED_MODULE_0__["Engine"](this.canvas, true, null, false); + // Listen for browser/canvas resize events + window.addEventListener("resize", function () { + _this.engine.resize(); + }); + } + Game.getInstance = function () { + return Game.instance; + }; + Game.prototype.setUIService = function (service_) { + var _this = this; + this.gameUIServiceService = service_; + this.gameUIServiceService.postArtCanvasEmitter.subscribe(function (post_) { + _this.postArtCanvas(post_); + }); + this.gameUIServiceService.forceWSEmitter.subscribe(function () { + _this.getPostList(); + }); + this.gameUIServiceService.deletePostEmitter.subscribe(function (post_) { + console.log("deletePostEmitter:" + post_); + _this.deletePost(post_); + }); + }; + Game.prototype.setOfflineService = function (service_) { + this.offlineService = service_; + }; + Game.prototype.setWebService = function (service_) { + this.chanWebService = service_; + }; + Game.prototype.setRouter = function (router_) { + this.router = router_; + }; + Game.prototype.setMapKey = function (mapKey_) { + this.mapKey = mapKey_; + }; + Game.prototype.setClientUrl = function (clientUrl_) { + this.clientUrl = clientUrl_; + }; + Game.prototype.initGame = function () { + var _this = this; + console.log("initGame() "); + //we get the player profile + var playerMod = this.offlineService.getPlayerData(); + this.playerModel = playerMod; + this.chanWebService.createUser(playerMod.id, playerMod.player_key, "", this.mapKey).subscribe( + //Data success + function (data) { + _this.gameResponse = data; + if (_this.gameResponse.ok) { + _this.playerModel = _this.gameResponse.result.player; + _this.offlineService.saveChan(_this.playerModel.map_key); + _this.setMapKey(_this.playerModel.map_key); + _this.offlineService.savePlayer(_this.playerModel); + //Launch the game + _this.createScene(); + _this.run(); + //Get the playerData + if (_this.postListRequestInterval == null) { + _this.postListRequestInterval = setInterval(function () { + _this.getPostList(); + }, _this.postListRequestDelay); + } + _this.getPostList(); + } + else { + alert("Profile not found!"); + } + }); + }; + Game.prototype.createScene = function () { + console.log("createScene()"); + if (this.scene != null) + this.scene.dispose(); + // We need a scene to create all our geometry and babylonjs items in + this.scene = new babylonjs__WEBPACK_IMPORTED_MODULE_0__["Scene"](this.engine); + this.playerMotor = _playerMotor__WEBPACK_IMPORTED_MODULE_3__["PlayerMotor"].getInstance(); + this.playerMotor.initMotor(); + if (this.activateJoystick) + this.playerMotor.activeJoystick(); + if (!this.mapMaker) { + this.mapMaker = new _mapMaker__WEBPACK_IMPORTED_MODULE_2__["MapMaker"](); + } + this.mapMaker.loadMapData(this.gameResponse.result.map[0]); + this.initAtmosphere(); + this.initOptimisation(); + }; + /************************ + * SCENE VISUAL STUFF + * ligth / optimization / ground / skybox + * and other shit + ***********************/ + Game.prototype.initAtmosphere = function () { + //Scene atmoshpere + this.scene.clearColor = new babylonjs__WEBPACK_IMPORTED_MODULE_0__["Color4"](226 / 255, 244 / 255, 1); + this.scene.ambientColor = new babylonjs__WEBPACK_IMPORTED_MODULE_0__["Color3"](0.3, 0.3, 0.3); + this.scene.autoClear = false; // Color buffer + this.scene.autoClearDepthAndStencil = false; + // Hemispheric light to enlight the scene + this.hLight = new babylonjs__WEBPACK_IMPORTED_MODULE_0__["HemisphericLight"]("hemi", new babylonjs__WEBPACK_IMPORTED_MODULE_0__["Vector3"](0, 0.5, 0), this.scene); + this.hLight.intensity = 0.85; + this.pLight = new BABYLON.PointLight("pointLight", new BABYLON.Vector3(1, 450, 1), this.scene); + this.pLight.intensity = 1.5; + //texture + this.ground = babylonjs__WEBPACK_IMPORTED_MODULE_0__["Mesh"].CreateGround("ground", 1000, 1000, 2, this.scene); + this.ground.checkCollisions = true; + this.ground.position.y = -0.1; + var mat = new babylonjs__WEBPACK_IMPORTED_MODULE_0__["StandardMaterial"]("matVolcano", this.scene); + var texture = new babylonjs__WEBPACK_IMPORTED_MODULE_0__["Texture"]("./assets/textures/volcanic_text.jpg", this.scene); + mat.diffuseTexture = texture; + this.ground.material = mat; + //Set UIManager + this.uiAdvancedTexture = babylonjs_gui__WEBPACK_IMPORTED_MODULE_1__["AdvancedDynamicTexture"].CreateFullscreenUI("UI"); + var skybox = BABYLON.MeshBuilder.CreateBox("skyBox", { size: 1000.0 }, this.scene); + var skyboxMaterial = new BABYLON.StandardMaterial("skyBox", this.scene); + skyboxMaterial.backFaceCulling = false; + skyboxMaterial.reflectionTexture = new BABYLON.CubeTexture("./assets/textures/skybox", this.scene); + skyboxMaterial.reflectionTexture.coordinatesMode = BABYLON.Texture.SKYBOX_MODE; + skyboxMaterial.diffuseColor = new BABYLON.Color3(0, 0, 0); + skyboxMaterial.specularColor = new BABYLON.Color3(0, 0, 0); + skybox.material = skyboxMaterial; + }; + Game.prototype.setShadow = function (mesh_) { + /* + if(this.shadowGenerator == null){ + this.shadowGenerator = new BABYLON.ShadowGenerator(256, this.pLight); + //this.shadowGenerator.useBlurExponentialShadowMap = true; + this.shadowGenerator.filteringQuality = BABYLON.ShadowGenerator.QUALITY_LOW; + } + + this.shadowGenerator.getShadowMap().renderList.push(mesh_); + mesh_.receiveShadows = true;*/ + }; + Game.prototype.initOptimisation = function () { + //Optimization + this.scene.blockMaterialDirtyMechanism = true; + /* + BABYLON.SceneOptimizer.OptimizeAsync(this.scene, BABYLON.SceneOptimizerOptions.LowDegradationAllowed(), + ()=> { + // On success + }, ()=> { + // FPS target not reached + });*/ + }; + //Render process + Game.prototype.run = function () { + var _this = this; + this.engine.runRenderLoop(function () { + if (_this.scene != null) { + _this.scene.render(); + _this.renderInteraction(); + } + }); + }; + Game.prototype.cleanLastMesh = function () { + this.nameLastMesh = ""; + if (this.lastCanvas != null) + this.lastCanvas.setInterfaceVisible(false); + }; + Game.prototype.renderInteraction = function () { + if (this.interactionTimer <= 0) { + var width = this.scene.getEngine().getRenderWidth(); + var height = this.scene.getEngine().getRenderHeight(); + var pickInfo = this.scene.pick(width / 2, height / 2, null, false, this.camera); + //Get info on the pointed object + if (pickInfo.hit && this.nameLastMesh !== pickInfo.pickedMesh.name) { + var newInter = new _models_interaction_model__WEBPACK_IMPORTED_MODULE_5__["InteractionModel"](); + newInter.type = _models_interaction_model__WEBPACK_IMPORTED_MODULE_5__["InteractionModel"].TYPE_NONE; + this.meshToClimb = null; + this.doorToOpen = null; + this.mapMaker.cleanLines(); + this.nameLastMesh = pickInfo.pickedMesh.name; + newInter.description = pickInfo.pickedMesh.name; + if (pickInfo.pickedMesh.name !== undefined) { + if (pickInfo.pickedMesh.name.indexOf("canvas") >= 0) { + var canvas = this.mapMaker.getCanvasByKey(pickInfo.pickedMesh.name); + if (canvas != null) { + if (canvas.isVirgin) { + newInter.type = _models_interaction_model__WEBPACK_IMPORTED_MODULE_5__["InteractionModel"].TYPE_CANVAS_VIRGIN; + /* + } else if(canvas.postModelGraffiti == null){ + newInter.type = InteractionModel.TYPE_CANVAS_TO_GRAFF; + this.mapMaker.drawlines(canvas.dictKey);*/ + } + else { + newInter.type = _models_interaction_model__WEBPACK_IMPORTED_MODULE_5__["InteractionModel"].TYPE_CANVAS_FULL; + this.mapMaker.drawlines(canvas.dictKey); + this.mapMaker.displayUI(canvas.dictKey); + } + //newInter.type = (canvas.isVirgin)? InteractionModel.TYPE_CANVAS_VIRGIN : InteractionModel.TYPE_CANVAS_FULL; + newInter.value = canvas.postModel; + this.cleanLastMesh(); + canvas.setInterfaceVisible(true); + this.lastCanvas = canvas; + } + } + else if (pickInfo.pickedMesh.name.toLowerCase().indexOf("ladder") >= 0) { + newInter.type = _models_interaction_model__WEBPACK_IMPORTED_MODULE_5__["InteractionModel"].TYPE_CLIMB_LADDER; + this.meshToClimb = pickInfo.pickedMesh; + /* + } else if(pickInfo.pickedMesh.name.toLowerCase().indexOf("advertisement") >= 0){ + + let canvas = this.mapMaker.getAdByKey(pickInfo.pickedMesh.name); + if(canvas != null){ + newInter.type = InteractionModel.TYPE_AD; + newInter.value = canvas.postModel; + this.cleanLastMesh(); + canvas.setInterfaceVisible(true); + this.lastCanvas = canvas; + }*/ + } + else if (pickInfo.pickedMesh.name.toLowerCase().indexOf("door") >= 0) { + //console.log("pick gate"+pickInfo.pickedMesh.name); + var door = this.mapMaker.getDoorByKey(pickInfo.pickedMesh.name); + newInter.type = _models_interaction_model__WEBPACK_IMPORTED_MODULE_5__["InteractionModel"].TYPE_OPEN_DOOR; + this.doorToOpen = door; + } + else if (pickInfo.pickedMesh.name.toLowerCase().indexOf("item") >= 0) { + //console.log(pickInfo.pickedMesh.name); + var item = this.mapMaker.getItemByKey(pickInfo.pickedMesh.name); + if (item != null && item.itemModel != null) { + newInter.type = _models_interaction_model__WEBPACK_IMPORTED_MODULE_5__["InteractionModel"].TYPE_GET_ITEM; + newInter.value = item.itemModel; + this.itemToGet = item; + } + } + else if (pickInfo.pickedMesh.name.toLowerCase().indexOf("gate") >= 0) { + var gate = this.mapMaker.getGateByKey(pickInfo.pickedMesh.name); + newInter.type = _models_interaction_model__WEBPACK_IMPORTED_MODULE_5__["InteractionModel"].TYPE_PASS_GATE; + newInter.value = gate.gateKey; + this.gateTopass = gate; + } + /*else if(pickInfo.pickedMesh.name.toLowerCase().indexOf("panel") >= 0){ + newInter.type = InteractionModel.TYPE_PANEL; + newInter.value = "http://snuffchan.com/blog/donations/"; + //this.panel = gate; + }*/ + } + this.nameLastMesh = pickInfo.pickedMesh.name; + this.gameUIServiceService.sendInteraction(newInter); + } + this.interactionTimer = this.interactionDelay; + } + else { + this.interactionTimer--; + } + }; + //Climb obj + Game.prototype.climbObject = function () { + this.camera.position.x = this.meshToClimb.position.x; + this.camera.position.z = this.meshToClimb.position.z; + this.camera.position.y = this.meshToClimb.position.y + _mapMaker__WEBPACK_IMPORTED_MODULE_2__["MapMaker"].TILE_SIZE; + }; + //Climb obj + Game.prototype.openDoor = function () { + //console.log(this.doorToOpen); + //console.log(this.nameLastMesh ); + this.nameLastMesh = ""; + this.doorToOpen.openDoor(); + }; + //Post + Game.prototype.postArtCanvas = function (canvas_) { + console.log(canvas_); + this.mapMaker.setPictureOnCanvas(canvas_); + }; + Game.prototype.switchKeyMapping = function () { + _gameUtils__WEBPACK_IMPORTED_MODULE_6__["GameUtils"].switchKeyMapping(this); + }; + Game.prototype.activeJoystick = function () { + this.activateJoystick = true; + if (this.playerMotor != null) + this.playerMotor.activeJoystick(); + }; + Game.prototype.getPostList = function () { + var _this = this; + if (!this.mapChanging) { + var playerTempModel = this.playerMotor.getPlayerPos(); + this.chanWebService.getMapPostList(playerTempModel.position_x, playerTempModel.position_y, this.playerModel.name, this.playerTalk).subscribe( + //Data success + function (data) { + var gameResponse = data; + if (gameResponse.ok) { + if (_utils_helpers__WEBPACK_IMPORTED_MODULE_7__["Helpers"].isPT()) { + var postsLeft = gameResponse.result.postsLeft - 18; + if (postsLeft < 0) + postsLeft = 0; + gameResponse.result.postsLeft = postsLeft; + } + _this.updateGameData(gameResponse.result); + _this.mapMaker.updateNonStaticData(gameResponse.result); + _this.isFirstLaunch = false; + } + else { + _this.isError = true; + _this.errorMessage = "Unknown error."; + } + }, function (error) { + //console.log(JSON.stringify(error)); + _this.isError = true; + if (_this.isFirstLaunch) { + _this.gameUIServiceService.changeState(_services_game_uiservice_service__WEBPACK_IMPORTED_MODULE_4__["GameUIServiceService"].STATE_NO_PLAYER); + } + _this.errorMessage = JSON.stringify(error); + }); + } + }; + Game.prototype.updateGameData = function (gameDataModel_) { + console.log("updateGameData()"); + this.gameDataModel = gameDataModel_; + this.mapMaker.updateNonStaticData(this.gameDataModel); + this.gameUIServiceService.updateGameData(this.gameDataModel); + //Update the player + this.playerModel = this.gameDataModel.player; + /* + if(this.playerModel.map_key != this.mapKey){ + this.generateMap(this.playerModel.map_key); + this.mapMaker.loadMapData(this.gameDataModel.map[0]); + this.mapKey = this.playerModel.map_key; + }*/ + this.items = this.gameDataModel.itemsPlayer; + this.offlineService.savePlayer(this.playerModel); + this.isPostLoaded = true; + this.isError = false; + }; + Game.prototype.passGet = function (getName_) { + var _this = this; + //this.playerMotor.savePlayerRotation(); + this.mapChanging = true; + this.chanWebService.changeMapRandom((getName_ === "secret")).subscribe(function (data_) { + if (data_.ok) { + //this.createScene(); + _this.scene.dispose(); + _this.mapMaker = null; + delete _this.mapMaker; + _this.offlineService.saveChan(data_.result.player.map_key); + //this.router.navigateByUrl('/ch/'+data_.result.player.map_key); + window.location.href = _this.clientUrl + '/ch/' + data_.result.player.map_key; + //console.log("change to :"+data_.result.player.map_key); + //this.updateGameData(data_.result); + } + }); + }; + Game.prototype.getItem = function (key_) { + var _this = this; + this.chanWebService.getItem(key_).subscribe(function (data_) { + if (data_.ok) { + _this.updateGameData(data_.result); + } + }); + }; + Game.prototype.deletePost = function (post_) { + var canvas = this.mapMaker.getCanvasByKey(post_.canvas_key); + if (canvas != null) { + console.log("Post found and deleted= " + post_); + canvas.deletePostData(); + } + }; + Game.prototype.changeName = function (name_) { + this.playerName = name_; + }; + Game.prototype.changeTalk = function (talk_) { + this.playerTalk = talk_; + }; + return Game; +}()); + + + +/***/ }), + +/***/ "./src/app/motor/gameUtils.ts": +/*!************************************!*\ + !*** ./src/app/motor/gameUtils.ts ***! + \************************************/ +/*! exports provided: GameUtils */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "GameUtils", function() { return GameUtils; }); +var GameUtils = /** @class */ (function () { + function GameUtils() { + } + //Doc for https://en.wikipedia.org/wiki/QWERTY + //Key code list https://www.cambiaresearch.com/articles/15/javascript-char-codes-key-codes + GameUtils.setKeyBoardMapping = function (gameInstance_) { + var conf_ = gameInstance_.offlineService.getConfig(); + if (conf_.key_mapping == null) { + var language = navigator.language; + GameUtils.setKeyMappingFromLang(gameInstance_, language); + } + else { + GameUtils.setKeyForMapping(gameInstance_, conf_.key_mapping); + } + }; + GameUtils.setKeyMappingFromLang = function (gameInstance_, lang_) { + if (lang_.toLowerCase().indexOf("fr") >= 0) { + GameUtils.setKeyForMapping(gameInstance_, "ZSQD"); + } + else { + GameUtils.setKeyForMapping(gameInstance_, "WSAD"); + } + }; + GameUtils.setKeyForMapping = function (gameInstance_, mapping_) { + console.log("setKeyMapping() lang_= " + mapping_); + var config = gameInstance_.offlineService.getConfig(); + if (mapping_ === "ZSQD") { + //If Azerty + gameInstance_.camera.keysUp = [90]; // Z + gameInstance_.camera.keysDown = [83]; // S + gameInstance_.camera.keysLeft = [81]; // Q + gameInstance_.camera.keysRight = [68]; // D + } + else { + //If Qwerty + gameInstance_.camera.keysUp = [87]; // w + gameInstance_.camera.keysDown = [83]; // S + gameInstance_.camera.keysLeft = [65]; // A + gameInstance_.camera.keysRight = [68]; // D + } + config.key_mapping = mapping_; + gameInstance_.offlineService.saveConfig(config); + gameInstance_.gameUIServiceService.updateConfigData(config); + //gameInstance_.offlineService.saveKeyboard(lang_.toLowerCase()); + }; + GameUtils.switchKeyMapping = function (gameInstance_) { + var conf_ = gameInstance_.offlineService.getConfig(); + if (conf_.key_mapping == null) { + var language = navigator.language; + GameUtils.setKeyMappingFromLang(gameInstance_, language); + } + else { + if (conf_.key_mapping === "ZSQD") + GameUtils.setKeyForMapping(gameInstance_, "WSAD"); + if (conf_.key_mapping === "WSAD") + GameUtils.setKeyForMapping(gameInstance_, "ZSQD"); + } + }; + return GameUtils; +}()); + + + +/***/ }), + +/***/ "./src/app/motor/gate.ts": +/*!*******************************!*\ + !*** ./src/app/motor/gate.ts ***! + \*******************************/ +/*! exports provided: Gate */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Gate", function() { return Gate; }); +/* harmony import */ var babylonjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! babylonjs */ "./node_modules/babylonjs/babylon.js"); +/* harmony import */ var babylonjs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(babylonjs__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var _game__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./game */ "./src/app/motor/game.ts"); +/* harmony import */ var _mapMaker__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./mapMaker */ "./src/app/motor/mapMaker.ts"); + + + +var Gate = /** @class */ (function () { + function Gate(dictKey, size, x, y, z, key_) { + this.objType = "gate"; + this.dictKey = this.objType + "_" + dictKey; + this.gateKey = key_; + this.gameInstance = _game__WEBPACK_IMPORTED_MODULE_1__["Game"].getInstance(); + this.mapInstance = _mapMaker__WEBPACK_IMPORTED_MODULE_2__["MapMaker"].getInstance(); + this.doorMesh = babylonjs__WEBPACK_IMPORTED_MODULE_0__["MeshBuilder"].CreateBox(this.dictKey, { size: size }, this.gameInstance.scene); + this.doorMesh.checkCollisions = true; + var mat = new babylonjs__WEBPACK_IMPORTED_MODULE_0__["StandardMaterial"]("matGateDoor", this.gameInstance.scene); + mat.diffuseColor = BABYLON.Color3.Red(); + mat.freeze(); + this.doorMesh.material = mat; + this.doorMesh.position.y = y; + this.doorMesh.position.x = x; + this.doorMesh.position.z = z; + this.mapInstance.registerNewGate(this.dictKey, this); + } + return Gate; +}()); + + + +/***/ }), + +/***/ "./src/app/motor/item.ts": +/*!*******************************!*\ + !*** ./src/app/motor/item.ts ***! + \*******************************/ +/*! exports provided: Item */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Item", function() { return Item; }); +/* harmony import */ var babylonjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! babylonjs */ "./node_modules/babylonjs/babylon.js"); +/* harmony import */ var babylonjs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(babylonjs__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var _game__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./game */ "./src/app/motor/game.ts"); +/* harmony import */ var _mapMaker__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./mapMaker */ "./src/app/motor/mapMaker.ts"); + + + +var Item = /** @class */ (function () { + function Item(type_, itemModel_, size_, x, y) { + this.objType = "item"; + this.itemModel = itemModel_; + this.objType = type_; + this.dictKey = this.objType + "_" + this.itemModel.name + "_" + itemModel_.key; + this.gameInstance = _game__WEBPACK_IMPORTED_MODULE_1__["Game"].getInstance(); + this.mapInstance = _mapMaker__WEBPACK_IMPORTED_MODULE_2__["MapMaker"].getInstance(); + this.itemMesh = babylonjs__WEBPACK_IMPORTED_MODULE_0__["MeshBuilder"].CreateBox(this.dictKey, { height: size_ * 3, width: size_, depth: size_ }, this.gameInstance.scene); + this.itemMesh.checkCollisions = false; + this.itemMesh.visibility = 0; + this.itemMesh.position.y = (size_) * 0.5; + this.itemMesh.position.x = x; + this.itemMesh.position.z = y; + this.itemMesh.visibility = 0; + /*let mat = new StandardMaterial("matBoxItem", this.gameInstance.scene); + mat.diffuseColor = BABYLON.Color3.Random(); + mat.freeze(); + this.itemMesh.material = mat;*/ + //if(this.objType.toLowerCase().indexOf('gate') >= 0 ) this.itemMesh.visibility = 0.2; + //sprite + this.spriteManagerPlayer = new babylonjs__WEBPACK_IMPORTED_MODULE_0__["SpriteManager"]("itemManager", "./assets/textures/cardboard_text.png", 1, { width: 288, height: 288 }, this.gameInstance.scene); + this.sprite = new babylonjs__WEBPACK_IMPORTED_MODULE_0__["Sprite"]("item" + itemModel_.id, this.spriteManagerPlayer); + this.sprite.width = 6; + this.sprite.height = 6; + this.sprite.position.x = x; + this.sprite.position.z = y; + this.sprite.position.y = 3; + this.mapInstance.registerNewItem(this.dictKey, this); + } + Item.prototype.clean = function () { + this.spriteManagerPlayer.dispose(); + if (this.itemMesh != null) + this.itemMesh.dispose(); + this.sprite.dispose(); + this.spriteManagerPlayer = null; + this.itemMesh = null; + this.sprite = null; + }; + return Item; +}()); + + + +/***/ }), + +/***/ "./src/app/motor/mapMaker.ts": +/*!***********************************!*\ + !*** ./src/app/motor/mapMaker.ts ***! + \***********************************/ +/*! exports provided: MapMaker */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MapMaker", function() { return MapMaker; }); +/* harmony import */ var _tile__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./tile */ "./src/app/motor/tile.ts"); +/* harmony import */ var _game__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./game */ "./src/app/motor/game.ts"); +/* harmony import */ var _item__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./item */ "./src/app/motor/item.ts"); +/* harmony import */ var _playerMotor__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./playerMotor */ "./src/app/motor/playerMotor.ts"); +/* harmony import */ var _models_player_model__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../models/player.model */ "./src/app/models/player.model.ts"); +/* harmony import */ var _playerMesh__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./playerMesh */ "./src/app/motor/playerMesh.ts"); + + + + + + +var MapMaker = /** @class */ (function () { + function MapMaker() { + this.items = []; + this.anonList = []; + this.itemMesh = []; + this.TileGroundMeshes = []; + this.TileWallMeshes = []; + this.DIR_N = 0; + this.DIR_E = 1; + this.DIR_S = 2; + this.DIR_W = 3; + //Canvas PLane dictionnary + this.canvasDict = {}; + this.advertisementDict = {}; + this.doorDict = {}; + this.gateDict = {}; + this.itemDict = {}; + this.gameInstance = _game__WEBPACK_IMPORTED_MODULE_1__["Game"].getInstance(); + MapMaker._instance = this; + } + Object.defineProperty(MapMaker, "TILE_SIZE", { + get: function () { return 10; }, + enumerable: true, + configurable: true + }); + MapMaker.getInstance = function () { + return this._instance; + }; + MapMaker.prototype.loadMapData = function (map_) { + _tile__WEBPACK_IMPORTED_MODULE_0__["Tile"].meshGrassInstance = null; + _tile__WEBPACK_IMPORTED_MODULE_0__["Tile"].meshGroundInstance = null; + _tile__WEBPACK_IMPORTED_MODULE_0__["Tile"].meshWallInstance = null; + this.mapModel = map_; + this.buildMap(); + }; + MapMaker.prototype.cleanMap = function () { + this.TileGroundMeshes = []; + this.TileWallMeshes = []; + this.canvasDict = {}; + this.advertisementDict = {}; + this.doorDict = {}; + this.gateDict = {}; + this.itemDict = {}; + }; + MapMaker.prototype.buildMap = function () { + this.cleanMap(); + //console.log("buildMap="+ this.mapModel ); + this.mapData = this.getMapData(); + var x = 0; + var y = 0; + var l = 0; //layer + var playerPos = { x: -1, y: -1 }; + //Generate a layer + for (var n = 0; n < this.mapData.length; n++) { + //console.log(this.mapData[n]); + if (parseInt(this.mapData[n]) != _tile__WEBPACK_IMPORTED_MODULE_0__["Tile"].TILE_GATES && parseInt(this.mapData[n]) != _tile__WEBPACK_IMPORTED_MODULE_0__["Tile"].TILE_GATES_SECRET) { + new _tile__WEBPACK_IMPORTED_MODULE_0__["Tile"](this.mapData[n], MapMaker.TILE_SIZE, x, l, y, null); + if (parseInt(this.mapData[n]) === _tile__WEBPACK_IMPORTED_MODULE_0__["Tile"].TILE_START) { + playerPos.x = x; + playerPos.y = y; + } + } + else if (parseInt(this.mapData[n]) == _tile__WEBPACK_IMPORTED_MODULE_0__["Tile"].TILE_GATES) { + console.log("x: " + x + "; y:" + y + "; width:" + this.mapModel.width + "; heihgt: " + this.mapModel.height); + /* + let key = ""; + if(y == 0){ + key = this.mapModel.door_key_n; + } else if(x == this.mapModel.width-1){ + key = this.mapModel.door_key_e; + } else if(y == this.mapModel.height-1){ + key = this.mapModel.door_key_s; + } else if(x == 0){ + key = this.mapModel.door_key_w; + }*/ + //console.log("GATE x: "+x+"; y:"+y+"; width:"+this.mapModel.width+"; heihgt: "+ this.mapModel.height+" key:"+key); + //Managing gates + new _tile__WEBPACK_IMPORTED_MODULE_0__["Tile"](this.mapData[n], MapMaker.TILE_SIZE, x, l, y, "???"); + } + else if (parseInt(this.mapData[n]) == _tile__WEBPACK_IMPORTED_MODULE_0__["Tile"].TILE_GATES_SECRET) { + //Managing gates + new _tile__WEBPACK_IMPORTED_MODULE_0__["Tile"](this.mapData[n], MapMaker.TILE_SIZE, x, l, y, "secret"); + } + //console.log("new tile-> type:"+this.tileDict[n]+" x:"+x+"y:"+y); + x += 1; + if (x >= this.mapModel.width) { + x = 0; + y += 1; + } + } + var player = new _models_player_model__WEBPACK_IMPORTED_MODULE_4__["PlayerModel"](); + if (this.gameData != null) + player = this.gameData.player; + player.position_x = playerPos.x; + player.position_y = playerPos.y; + _playerMotor__WEBPACK_IMPORTED_MODULE_3__["PlayerMotor"].getInstance().setPlayerPos(player); + if (this.gameData != null) + this.updateNonStaticData(this.gameData); + }; + /******************** + * UPDATE NON STATIC DATA + * players, items and others + ********************/ + MapMaker.prototype.updateNonStaticData = function (gameData_) { + this.itemDict = {}; + this.gameData = gameData_; + //Post + //Update teh posts DATA + if (this.gameData.posts != undefined) { + this.posts = this.gameData.posts; + for (var _i = 0, _a = this.gameData.posts; _i < _a.length; _i++) { + var post = _a[_i]; + if (post !== null && post.canvas_key !== null) { + var canvas = this.getCanvasByKey(post.canvas_key); + if (canvas != null && canvas.isVirgin) { + //if(post.graffiti && canvas.postModelGraffiti == null){ + canvas.setPostData(post); + /* + } else if(!post.graffiti && canvas.postModel.id == null){ + canvas.setPostData(post); + }*/ + } + } + } + } + //items + this.itemMesh.forEach(function (item_) { + if (item_ != null && item_ != undefined) { + item_.clean(); + item_ = null; + } + }); + this.itemMesh = []; + this.items = this.gameData.itemsMap; + for (var i = 0; i < this.items.length; i++) { + var itemModel = this.items[i]; + var itemMesh = new _item__WEBPACK_IMPORTED_MODULE_2__["Item"]("item", itemModel, MapMaker.TILE_SIZE * 0.2, itemModel.x * MapMaker.TILE_SIZE, itemModel.y * MapMaker.TILE_SIZE); + this.itemMesh.push(itemMesh); + } + //PLayers + /* + this.anonList.forEach((playerMesh: PlayerMesh) =>{ + playerMesh.clean(); + playerMesh = null; + }); + + let anonListNew = []; + let anonListOld = this.anonList; + let characters = this.gameData.players; + + for(let c = 0; c < characters.length; c++){ + let chara: PlayerModel = characters[c]; + let anon: PlayerMesh = null; + //Is this anon exist? + for(let a= 0; a { + //playerMesh.dispose(); + playerMesh.clean(); + playerMesh = null; + }); + + this.anonList = anonListNew;*/ + this.anonList.forEach(function (playerMesh) { + //playerMesh.dispose(); + playerMesh.clean(); + playerMesh = null; + }); + this.anonList = []; + var characters = this.gameData.players; + for (var c = 0; c < characters.length; c++) { + var chara = characters[c]; + var anon = new _playerMesh__WEBPACK_IMPORTED_MODULE_5__["PlayerMesh"]("player", chara, MapMaker.TILE_SIZE); + this.anonList.push(anon); + } + }; + MapMaker.prototype.drawlines = function (key_) { + var currentPost = this.canvasDict[key_].postModel; + if (this.linesReplyFrom != null) + this.linesReplyFrom.dispose(); + if (this.linesReplyTo != null) + this.linesReplyTo.dispose(); + //https://doc.babylonjs.com/babylon101/parametric_shapes + var pointsTo = []; + var pointsFrom = []; + pointsTo.push(this.canvasDict[key_].planeMesh.position); + pointsFrom.push(this.canvasDict[key_].planeMesh.position); + for (var keyDict in this.canvasDict) { + var canvas = this.canvasDict[keyDict]; + if (!canvas.isVirgin) { + var found = false; + if (canvas.postModel.id === currentPost.reply) { + pointsTo.push(canvas.planeMesh.position); + found = true; + } + else if (canvas.postModel.reply === currentPost.id) { + pointsFrom.push(canvas.planeMesh.position); + found = true; + } + if (found) { + for (var keyDict2 in this.canvasDict) { + var canvas2 = this.canvasDict[keyDict2]; + if (!canvas2.isVirgin) { + if (canvas2.postModel.id === canvas.postModel.reply) { + pointsTo.push(canvas2.planeMesh.position); + } + else if (canvas2.postModel.reply === canvas.postModel.id) { + pointsFrom.push(canvas2.planeMesh.position); + } + } + } + } + } + } + this.linesReplyTo = BABYLON.MeshBuilder.CreateLines("lines", { points: pointsTo }, this.gameInstance.scene); + this.linesReplyFrom = BABYLON.MeshBuilder.CreateLines("lines", { points: pointsFrom }, this.gameInstance.scene); + /* + this.linesReplyTo.Color4 = BABYLON.Color3.Blue; + this.linesReplyFrom.Color4 = BABYLON.Color3.Green; + */ + }; + MapMaker.prototype.cleanLines = function () { + if (this.linesReplyFrom != null) + this.linesReplyFrom.dispose(); + if (this.linesReplyTo != null) + this.linesReplyTo.dispose(); + }; + MapMaker.prototype.displayUI = function (key_) { + /* + //To hard for memory + let canvas: CanvasPlane = this.canvasDict[key_]; + + if( this.cubeUI == null){ + this.cubeUI = MeshBuilder.CreateBox("meshUI", {size: MapMaker.TILE_SIZE *0.5}, this.gameInstance.scene); + //this.cubeUI.visibility = 0; + } + + this.cubeUI.position.y = MapMaker.TILE_SIZE *0.5; + this.cubeUI.position.x = canvas.planeMesh.position.x * MapMaker.TILE_SIZE; + this.cubeUI.position.z = canvas.planeMesh.position.z * MapMaker.TILE_SIZE; + + if(this.uiAdvancedTexture == null){ + this.uiAdvancedTexture = BABYLON.GUI.AdvancedDynamicTexture.CreateFullscreenUI("UI"); + this.rectUI = new BABYLON.GUI.Rectangle(); + + this.rectUI.fontFamily = "Courier New, Courier, monospace"; + this.rectUI.cornerRadius = 10; + this.rectUI.color = "Grey"; + this.rectUI.background = "#161616"; + this.uiAdvancedTexture.addControl(this.rectUI); + this.label = new BABYLON.GUI.TextBlock(); + this.rectUI.addControl(this.label); + this.rectUI.linkWithMesh(this.cubeUI); + this.rectUI.linkOffsetY = 0; + this.rectUI.linkOffsetX = 0; + this.rectUI.width = 0.2; + this.rectUI.height = 0.3; + } + + this.label.text = canvas.postModel.message; + */ + }; + MapMaker.prototype.clearUI = function () { + }; + /******************** + * UTILS + ********************/ + //Get potential Canvas orientation + MapMaker.prototype.getCanvasOrientation = function (x, z) { + var potentialDir = []; + if (this.getTileAt(x, z - 1) === '0') + potentialDir.push(this.DIR_N); + if (this.getTileAt(x + 1, z) === '0') + potentialDir.push(this.DIR_E); + if (this.getTileAt(x, z + 1) === '0') + potentialDir.push(this.DIR_S); + if (this.getTileAt(x - 1, z) === '0') + potentialDir.push(this.DIR_W); + if (potentialDir.length === 0) { + //console.log("NO ORIENTATION FOUND"); + return -1; + } + //We choose a random direction + var indexChoosed = Math.floor(Math.random() * potentialDir.length); + return potentialDir[indexChoosed]; + }; + //Return the value of a tile + MapMaker.prototype.getTileAt = function (x, y) { + //Out of bounds + if (x < 0 || x > this.mapModel.width || y < 0 || y > this.mapModel.height) + return -1; + var indexTile = (y * this.mapModel.width) + x; + return this.mapData[indexTile]; + }; + MapMaker.prototype.registerNewCanvas = function (key_, canvas_) { + if (this.canvasDict[key_] === undefined) + this.canvasDict[key_] = canvas_; + }; + MapMaker.prototype.registerNewAd = function (key_, canvas_) { + if (this.advertisementDict[key_] === undefined) + this.advertisementDict[key_] = canvas_; + }; + MapMaker.prototype.registerNewDoor = function (key_, door_) { + if (this.doorDict[key_] === undefined) + this.doorDict[key_] = door_; + }; + MapMaker.prototype.registerNewItem = function (key_, item_) { + if (this.itemDict[key_] === undefined) + this.itemDict[key_] = item_; + }; + MapMaker.prototype.getCanvasByKey = function (key_) { + return this.canvasDict[key_]; + }; + MapMaker.prototype.registerNewGate = function (key_, gate_) { + this.gateDict[key_] = gate_; + }; + MapMaker.prototype.getDoorByKey = function (key_) { + return this.doorDict[key_]; + }; + MapMaker.prototype.getAdByKey = function (key_) { + return this.advertisementDict[key_]; + }; + MapMaker.prototype.getGateByKey = function (key_) { + return this.gateDict[key_]; + }; + MapMaker.prototype.getItemByKey = function (key_) { + return this.itemDict[key_]; + }; + MapMaker.prototype.setPictureOnCanvas = function (post_) { + var canvas = this.canvasDict[post_.canvas_key]; + console.log(this.canvasDict); + if (canvas !== undefined) { + console.log("canvas to change: " + post_.canvas_key + "; to post url: " + post_.url); + canvas.setPostData(post_); + } + else { + console.log("no canvas"); + } + }; + /******************** + * PERF MAnAGEMENT + ********************/ + MapMaker.prototype.addMeshToCluster = function (mesh_, type_) { + switch (type_) { + case _tile__WEBPACK_IMPORTED_MODULE_0__["Tile"].TILE_GROUND: + this.TileGroundMeshes.push(mesh_); + break; + case _tile__WEBPACK_IMPORTED_MODULE_0__["Tile"].TILE_WALL: + this.TileWallMeshes.push(type_); + break; + } + }; + MapMaker.prototype.createClusters = function () { + BABYLON.Mesh.MergeMeshes(this.TileWallMeshes); + BABYLON.Mesh.MergeMeshes(this.TileGroundMeshes); + }; + /******************** + * PARSING MAP + ********************/ + MapMaker.prototype.getMapData = function () { + return this.mapModel.level_data.split(","); + }; + return MapMaker; +}()); + + + +/***/ }), + +/***/ "./src/app/motor/playerMesh.ts": +/*!*************************************!*\ + !*** ./src/app/motor/playerMesh.ts ***! + \*************************************/ +/*! exports provided: PlayerMesh */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PlayerMesh", function() { return PlayerMesh; }); +/* harmony import */ var babylonjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! babylonjs */ "./node_modules/babylonjs/babylon.js"); +/* harmony import */ var babylonjs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(babylonjs__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var _game__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./game */ "./src/app/motor/game.ts"); +/* harmony import */ var _mapMaker__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./mapMaker */ "./src/app/motor/mapMaker.ts"); + +//import * as GUI from 'babylonjs-gui'; + + +var PlayerMesh = /** @class */ (function () { + function PlayerMesh(type_, playerModel_, size_) { + this.objType = "player"; + this.size = size_; + this.playerModel = playerModel_; + this.objType = type_; + this.gameInstance = _game__WEBPACK_IMPORTED_MODULE_1__["Game"].getInstance(); + this.mapInstance = _mapMaker__WEBPACK_IMPORTED_MODULE_2__["MapMaker"].getInstance(); + if (this.playerModel.hp < 1) { + this.spriteManagerPlayer = new babylonjs__WEBPACK_IMPORTED_MODULE_0__["SpriteManager"]("playerManager", "./assets/textures/anon_sprite_dead.png", 1, { width: 288, height: 288 }, this.gameInstance.scene); + this.sprite = new babylonjs__WEBPACK_IMPORTED_MODULE_0__["Sprite"]("player_" + playerModel_.id, this.spriteManagerPlayer); + } + else { + this.spriteManagerPlayer = new babylonjs__WEBPACK_IMPORTED_MODULE_0__["SpriteManager"]("playerManager", "./assets/textures/anon_sprite.png", 1, { width: 290, height: 290 }, this.gameInstance.scene); + this.sprite = new babylonjs__WEBPACK_IMPORTED_MODULE_0__["Sprite"]("player_" + playerModel_.id, this.spriteManagerPlayer); + } + this.sprite.width = 6; + this.sprite.height = 6; + this.sprite.position.x = this.playerModel.position_x * size_; + this.sprite.position.z = this.playerModel.position_y * size_; + this.sprite.position.y = 3; + //Display player UI + this.playerMesh = babylonjs__WEBPACK_IMPORTED_MODULE_0__["MeshBuilder"].CreateBox(this.dictKey + "_" + playerModel_.id, { size: size_ * 0.5 }, this.gameInstance.scene); + this.playerMesh.position.y = size_ * 0.5; + this.playerMesh.position.x = this.playerModel.position_x * size_; + this.playerMesh.position.z = this.playerModel.position_y * size_; + this.playerMesh.visibility = 0; + /* + this.uiAdvancedTexture = BABYLON.GUI.AdvancedDynamicTexture.CreateFullscreenUI("UI"); + this.uiAdvancedTexture.is3D = false; + this.rectUI = new BABYLON.GUI.Rectangle(); + this.rectUI.width = 0.1; + this.rectUI.height = 0.05; + this.rectUI.fontFamily = "Courier New, Courier, monospace"; + this.rectUI.cornerRadius = 10; + this.rectUI.color = "Grey"; + this.rectUI.background = "#161616"; + this.uiAdvancedTexture.addControl(this.rectUI); + this.label = new BABYLON.GUI.TextBlock(); + this.label.text = "#"+this.playerModel.id+"\n💬"+this.playerModel.talk; + this.rectUI.addControl(this.label); + this.rectUI.linkWithMesh( this.playerMesh); + this.rectUI.linkOffsetY = -60; + this.rectUI.linkOffsetX = 0; + this.uiAdvancedTexture.freeze = true;*/ + return this; + } + PlayerMesh.prototype.updatePlayerModel = function (model_) { + this.playerModel = model_; + var y = this.size * 0.5; + var x = this.playerModel.position_x * this.size; + var z = this.playerModel.position_y * this.size; + //this.playerMesh.locallyTranslate(new BABYLON.Vector3(x, y, z)); + var ySprite = 3; + if (this.sprite != null) { + this.sprite.position.x = x; + this.sprite.position.z = z; + this.sprite.position.y = ySprite; + } + if (this.playerMesh != null) { + this.playerMesh.position.x = x; + this.playerMesh.position.y = y; + this.playerMesh.position.z = z; + } + //this.label.text = "#"+this.playerModel.id+"\n💬"+this.playerModel.talk; + }; + PlayerMesh.prototype.clean = function () { + this.spriteManagerPlayer.dispose(); + if (this.playerMesh != null) + this.playerMesh.dispose(); + this.sprite.dispose(); + this.spriteManagerPlayer = null; + this.playerMesh = null; + this.sprite = null; + /* + this.rectUI.dispose(); + this.label.dispose(); + this.uiAdvancedTexture.dispose();*/ + }; + return PlayerMesh; +}()); + + + +/***/ }), + +/***/ "./src/app/motor/playerMotor.ts": +/*!**************************************!*\ + !*** ./src/app/motor/playerMotor.ts ***! + \**************************************/ +/*! exports provided: PlayerMotor */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PlayerMotor", function() { return PlayerMotor; }); +/* harmony import */ var _game__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./game */ "./src/app/motor/game.ts"); +/* harmony import */ var _gameUtils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./gameUtils */ "./src/app/motor/gameUtils.ts"); +/* harmony import */ var _utils_helpers__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../utils/helpers */ "./src/app/utils/helpers.ts"); +/* harmony import */ var _services_game_uiservice_service__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../services/game-uiservice.service */ "./src/app/services/game-uiservice.service.ts"); +/* harmony import */ var _models_player_model__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../models/player.model */ "./src/app/models/player.model.ts"); +/* harmony import */ var _mapMaker__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./mapMaker */ "./src/app/motor/mapMaker.ts"); + + + + + + +var PlayerMotor = /** @class */ (function () { + function PlayerMotor() { + //Properties for cam + this.playerHeight = 4; // The player eyes height + this.speed = 1; + this.inertia = 0.9; + this.angularSensibility = 1000; + this.angularSensibilityMobile = 13000; + this.joystickMoveSpeedY = 18; + this.joystickMoveSpeedX = 0.9; + this.isJoystick = false; + } + PlayerMotor.getInstance = function () { + return this._instance || (this._instance = new this()); + }; + PlayerMotor.prototype.initMotor = function () { + var _this = this; + this.gameInstance = _game__WEBPACK_IMPORTED_MODULE_0__["Game"].getInstance(); + this.gameInstance.gameUIServiceService.changeStateEmitter.subscribe(function (state_) { + console.log(state_); + if (state_ === _services_game_uiservice_service__WEBPACK_IMPORTED_MODULE_3__["GameUIServiceService"].STATE_GAME_RUNNING) { + _this.activateMotion(true); + } + else { + _this.activateMotion(false); + } + }); + this.gameInstance.camera = new BABYLON.FreeCamera('freeCamera', new BABYLON.Vector3(0, 5, -10), this.gameInstance.scene); + this.activateMotion(true); + }; + PlayerMotor.prototype.activateMotion = function (val_) { + if (val_) { + //Free cam + this.gameInstance.camera.attachControl(this.gameInstance.scene.getEngine().getRenderingCanvas()); + // Activate gravity ! + //https://doc.babylonjs.com/babylon101/cameras,_mesh_collisions_and_gravity + this.gameInstance.scene.gravity = new BABYLON.Vector3(0, -0.7, 0); + this.gameInstance.camera.applyGravity = true; + this.gameInstance.camera.ellipsoid = new BABYLON.Vector3(2.5, this.playerHeight, 2.5); + this.gameInstance.camera.ellipsoidOffset = new BABYLON.Vector3(0, this.playerHeight, 0); + this.gameInstance.camera.checkCollisions = true; + _gameUtils__WEBPACK_IMPORTED_MODULE_1__["GameUtils"].setKeyBoardMapping(this.gameInstance); + this.gameInstance.camera.speed = this.speed; + this.gameInstance.camera.inertia = this.inertia; + this.gameInstance.camera.angularSensibility = (_utils_helpers__WEBPACK_IMPORTED_MODULE_2__["Helpers"].isMobile()) ? this.angularSensibilityMobile : this.angularSensibility; + } + else { + this.gameInstance.camera.detachControl(this.gameInstance.scene.getEngine().getRenderingCanvas()); + } + }; + /******************* + * PLACE THE PLAYER + ******************/ + PlayerMotor.prototype.setPlayerPos = function (playerData_) { + //console.log(this.playerRotation ); + this.playerModel = playerData_; + //convert teh X + y in position + //console.log("playerPosY= "+this.playerModel.position_x+"; playerPosX= "+this.playerModel.position_y); + //Placing the player + this.gameInstance.camera.position.x = this.playerModel.position_x * _mapMaker__WEBPACK_IMPORTED_MODULE_5__["MapMaker"].TILE_SIZE; + this.gameInstance.camera.position.z = this.playerModel.position_y * _mapMaker__WEBPACK_IMPORTED_MODULE_5__["MapMaker"].TILE_SIZE; + if (this.playerRotation != null) + this.gameInstance.camera.rotation = this.playerRotation; + }; + PlayerMotor.prototype.savePlayerRotation = function () { + //We memorize the player rotation + this.playerRotation = this.gameInstance.camera.rotation; + }; + PlayerMotor.prototype.getPlayerPos = function () { + if (this.playerModel == null) { + this.playerModel = new _models_player_model__WEBPACK_IMPORTED_MODULE_4__["PlayerModel"](); + this.playerModel.position_x = -1; + this.playerModel.position_y = -1; + } + else { + this.playerModel.position_x = this.gameInstance.camera.position.x / _mapMaker__WEBPACK_IMPORTED_MODULE_5__["MapMaker"].TILE_SIZE; + this.playerModel.position_y = this.gameInstance.camera.position.z / _mapMaker__WEBPACK_IMPORTED_MODULE_5__["MapMaker"].TILE_SIZE; + } + return this.playerModel; + }; + PlayerMotor.prototype.activeJoystick = function () { + var _this = this; + this.isJoystick = true; + var rightJoystick = new BABYLON.VirtualJoystick(false); + this.gameInstance.scene.onBeforeRenderObservable.add(function () { + if (rightJoystick.pressed) { + //OLD position + var moveY = rightJoystick.deltaPosition.y * (_this.gameInstance.engine.getDeltaTime() / 1000) * _this.joystickMoveSpeedY; + _this.gameInstance.camera.position.z += moveY * Math.cos(_this.gameInstance.camera.rotation.y); + _this.gameInstance.camera.position.x += moveY * Math.sin(_this.gameInstance.camera.rotation.y); + var moveX = rightJoystick.deltaPosition.x * (_this.gameInstance.engine.getDeltaTime() / 1000) * _this.joystickMoveSpeedX; + _this.gameInstance.camera.rotation.y += moveX; + } + }); + }; + return PlayerMotor; +}()); + + + +/***/ }), + +/***/ "./src/app/motor/tile.ts": +/*!*******************************!*\ + !*** ./src/app/motor/tile.ts ***! + \*******************************/ +/*! exports provided: Tile */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Tile", function() { return Tile; }); +/* harmony import */ var babylonjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! babylonjs */ "./node_modules/babylonjs/babylon.js"); +/* harmony import */ var babylonjs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(babylonjs__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var _game__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./game */ "./src/app/motor/game.ts"); +/* harmony import */ var _mapMaker__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./mapMaker */ "./src/app/motor/mapMaker.ts"); +/* harmony import */ var _canvasPlane__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./canvasPlane */ "./src/app/motor/canvasPlane.ts"); +/* harmony import */ var _door__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./door */ "./src/app/motor/door.ts"); +/* harmony import */ var _gate__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./gate */ "./src/app/motor/gate.ts"); + + + + + + + +var Tile = /** @class */ (function () { + function Tile(type_, size, x, y, z, val_) { + var type = parseInt(type_); + this.tileCoordonates = [x, y, z]; + x = x * size; + y = y * size; + z = z * size; + this.gameInstance = _game__WEBPACK_IMPORTED_MODULE_1__["Game"].getInstance(); + this.mapInstance = _mapMaker__WEBPACK_IMPORTED_MODULE_2__["MapMaker"].getInstance(); + if (type === Tile.TILE_WALL) { + this.box = this.getMeshWall(size); + this.box.position.y = size * 0.5 + y; + this.box.position.x = x; + this.box.position.z = z; + new _canvasPlane__WEBPACK_IMPORTED_MODULE_3__["CanvasPlane"]("canvas", this.tileCoordonates[0] + "_" + this.tileCoordonates[1] + "_" + this.tileCoordonates[2], size, x, y, z, this.mapInstance.DIR_N); + new _canvasPlane__WEBPACK_IMPORTED_MODULE_3__["CanvasPlane"]("canvas", this.tileCoordonates[0] + "_" + this.tileCoordonates[1] + "_" + this.tileCoordonates[2], size, x, y, z, this.mapInstance.DIR_E); + new _canvasPlane__WEBPACK_IMPORTED_MODULE_3__["CanvasPlane"]("canvas", this.tileCoordonates[0] + "_" + this.tileCoordonates[1] + "_" + this.tileCoordonates[2], size, x, y, z, this.mapInstance.DIR_S); + new _canvasPlane__WEBPACK_IMPORTED_MODULE_3__["CanvasPlane"]("canvas", this.tileCoordonates[0] + "_" + this.tileCoordonates[1] + "_" + this.tileCoordonates[2], size, x, y, z, this.mapInstance.DIR_W); + } + else if (type === Tile.TILE_GROUND || type === Tile.TILE_START) { + this.box = this.getMeshGround(size, "./assets/textures/floor_dalle_text.jpg"); + this.box.position.y = -size * 0.5 + y; + this.box.position.x = x; + this.box.position.z = z; + this.mapInstance.addMeshToCluster(this.box, type); + } + else if (type === Tile.TILE_GRASS) { + this.box = this.getMeshGrass(size, "./assets/textures/grass_text.jpg"); + this.box.position.y = -size * 0.5 + y; + this.box.position.x = x; + this.box.position.z = z; + this.mapInstance.addMeshToCluster(this.box, type); + } + else if (type === Tile.TILE_LADDER) { + console.log("GOT LADDER!"); + this.box = this.getMeshLadder(size); + this.box.position.y = size * 0.5 + y; + this.box.position.x = x; + this.box.position.z = z; + this.mapInstance.addMeshToCluster(this.box, type); + } + else if (type === Tile.TILE_GATES || type === Tile.TILE_GATES_SECRET) { + console.log("GOT GATES!"); + //Create the ground + this.box = this.getMeshGround(size, "./assets/textures/floor_dalle_text.jpg"); + this.box.position.y = -size * 0.5 + y; + this.box.position.x = x; + this.box.position.z = z; + this.mapInstance.addMeshToCluster(this.box, Tile.TILE_GROUND); + this.door = this.getMeshGate(size, x, y, z, val_); + this.door.position.y = size * 0.5 + y; + this.door.position.x = x; + this.door.position.z = z; + } + else if (type === Tile.TILE_DOOR) { + console.log("GOT DOOR!"); + //Create the ground + this.box = this.getMeshGround(size, "./assets/textures/floor_dalle_text.jpg"); + this.box.position.y = -size * 0.5 + y; + this.box.position.x = x; + this.box.position.z = z; + this.mapInstance.addMeshToCluster(this.box, Tile.TILE_GROUND); + this.door = this.getMeshDoor(size, x, y, z, false); + this.door.position.y = size * 0.5 + y; + this.door.position.x = x; + this.door.position.z = z; + } + else if (type === Tile.TILE_DOOR_SECRET) { + console.log("GOT DOOR!"); + //Create the ground + this.box = this.getMeshGround(size, "./assets/textures/floor_dalle_text.jpg"); + this.box.position.y = -size * 0.5 + y; + this.box.position.x = x; + this.box.position.z = z; + this.mapInstance.addMeshToCluster(this.box, Tile.TILE_GROUND); + this.door = this.getMeshDoor(size, x, y, z, true); + this.door.position.y = size * 0.5 + y; + this.door.position.x = x; + this.door.position.z = z; + } + else { + console.log("type not found! type " + type); + } + /* + + this.gameInstance.shadowGen.getShadowMap().renderList.push( this.box ); + this.box.receiveShadows = true;*/ + } + Object.defineProperty(Tile, "TILE_EMPTY", { + get: function () { return -1; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(Tile, "TILE_GROUND", { + get: function () { return 0; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(Tile, "TILE_WALL", { + get: function () { return 1; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(Tile, "TILE_GATES", { + get: function () { return 3; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(Tile, "TILE_DOOR", { + get: function () { return 4; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(Tile, "TILE_DOOR_SECRET", { + get: function () { return 5; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(Tile, "TILE_LADDER", { + get: function () { return 66; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(Tile, "TILE_GRASS", { + get: function () { return 7; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(Tile, "TILE_START", { + //public static get TILE_ADVERTISEMENT():number { return 12; } + get: function () { return 13; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(Tile, "TILE_GATES_SECRET", { + get: function () { return 14; }, + enumerable: true, + configurable: true + }); + Tile.prototype.getMeshGround = function (size_, text_) { + if (!Tile.meshGroundInstance) { + var mesh = babylonjs__WEBPACK_IMPORTED_MODULE_0__["MeshBuilder"].CreateBox("groundTile", { size: size_ }, this.gameInstance.scene); + mesh.checkCollisions = true; + var mat = new babylonjs__WEBPACK_IMPORTED_MODULE_0__["StandardMaterial"]("matGround", this.gameInstance.scene); + var textureBox = new babylonjs__WEBPACK_IMPORTED_MODULE_0__["Texture"](text_, this.gameInstance.scene); + mat.diffuseTexture = textureBox; + mat.diffuseTexture.scale(1 / 4); + mesh.material = mat; + Tile.meshGroundInstance = mesh; + this.gameInstance.setShadow(mesh); + mat.freeze(); + mesh.convertToUnIndexedMesh(); + mesh.freezeWorldMatrix(); + } + return Tile.meshGroundInstance.clone("Box Ground"); + }; + Tile.prototype.getMeshGrass = function (size_, text_) { + if (!Tile.meshGrassInstance) { + var mesh = babylonjs__WEBPACK_IMPORTED_MODULE_0__["MeshBuilder"].CreateBox("grassTile", { size: size_ }, this.gameInstance.scene); + mesh.checkCollisions = true; + var mat = new babylonjs__WEBPACK_IMPORTED_MODULE_0__["StandardMaterial"]("matGrass", this.gameInstance.scene); + var textureBox = new babylonjs__WEBPACK_IMPORTED_MODULE_0__["Texture"](text_, this.gameInstance.scene); + mat.diffuseTexture = textureBox; + mat.diffuseTexture.scale(1 / 4); + mesh.material = mat; + Tile.meshGrassInstance = mesh; + this.gameInstance.setShadow(mesh); + mat.freeze(); + mesh.convertToUnIndexedMesh(); + mesh.freezeWorldMatrix(); + } + return Tile.meshGrassInstance.clone("Box Grass"); + }; + Tile.prototype.getMeshWall = function (size_) { + if (!Tile.meshWallInstance) { + var mesh = babylonjs__WEBPACK_IMPORTED_MODULE_0__["MeshBuilder"].CreateBox("myBox", { size: size_ }, this.gameInstance.scene); + mesh.checkCollisions = true; + var mat = new babylonjs__WEBPACK_IMPORTED_MODULE_0__["StandardMaterial"]("matBox", this.gameInstance.scene); + var textureBox = new babylonjs__WEBPACK_IMPORTED_MODULE_0__["Texture"]("./assets/textures/concrete_text.jpg", this.gameInstance.scene); + mat.diffuseTexture = textureBox; + mesh.material = mat; + Tile.meshWallInstance = mesh; + this.gameInstance.setShadow(mesh); + mat.freeze(); + mesh.convertToUnIndexedMesh(); + mesh.freezeWorldMatrix(); + } + return Tile.meshWallInstance.clone("groundTile"); + }; + /* + getMeshAd(size_){ + + let mesh = MeshBuilder.CreateBox("myBox", {size: size_}, this.gameInstance.scene); + mesh.checkCollisions = true; + let mat = new StandardMaterial("matBoxLadder", this.gameInstance.scene); + mat.diffuseColor = BABYLON.Color3.Black(); + mesh.material = mat; + mesh.convertToUnIndexedMesh(); + mat.freeze(); + + return mesh; + }*/ + Tile.prototype.getMeshLadder = function (size_) { + var mesh = babylonjs__WEBPACK_IMPORTED_MODULE_0__["MeshBuilder"].CreateBox("ladder", { size: size_ }, this.gameInstance.scene); + mesh.checkCollisions = true; + var mat = new babylonjs__WEBPACK_IMPORTED_MODULE_0__["StandardMaterial"]("matBoxLadder", this.gameInstance.scene); + mat.diffuseColor = babylonjs__WEBPACK_IMPORTED_MODULE_0__["Color3"].Red(); + mesh.material = mat; + mesh.convertToUnIndexedMesh(); + mat.freeze(); + return mesh; + }; + Tile.prototype.getMeshDoor = function (size_, x_, y_, z_, secret_) { + var door = new _door__WEBPACK_IMPORTED_MODULE_4__["Door"](this.tileCoordonates[0] + "_" + this.tileCoordonates[1] + "_" + this.tileCoordonates[2], size_, x_, y_, z_, secret_); + return door.doorMesh; + }; + Tile.prototype.getMeshGate = function (size_, x_, y_, z_, key_) { + var gate = new _gate__WEBPACK_IMPORTED_MODULE_5__["Gate"](this.tileCoordonates[0] + "_" + this.tileCoordonates[1] + "_" + this.tileCoordonates[2], size_, x_, y_, z_, key_); + return gate.doorMesh; + }; + return Tile; +}()); + + + +/***/ }), + +/***/ "./src/app/services/chan-web.service.ts": +/*!**********************************************!*\ + !*** ./src/app/services/chan-web.service.ts ***! + \**********************************************/ +/*! exports provided: ChanWebService */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ChanWebService", function() { return ChanWebService; }); +/* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm5/core.js"); +/* harmony import */ var _environments_environment__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../environments/environment */ "./src/environments/environment.ts"); +/* harmony import */ var _angular_common_http__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @angular/common/http */ "./node_modules/@angular/common/fesm5/http.js"); +/* harmony import */ var _offline_service__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./offline.service */ "./src/app/services/offline.service.ts"); +var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +var __metadata = (undefined && undefined.__metadata) || function (k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); +}; + + + + +var ChanWebService = /** @class */ (function () { + //playerData : PlayerModel; + function ChanWebService(http, offlineService) { + this.http = http; + this.offlineService = offlineService; + this.serverUrl = _environments_environment__WEBPACK_IMPORTED_MODULE_1__["environment"].apiUrl; + } + /*********************** + * CHAN/POST WEBSERVICE + **********************/ + //Init the server URL for the WS + ChanWebService.prototype.setServerUrl = function (url) { + this.serverUrl = url; + }; + //Get thread posts list + ChanWebService.prototype.getMapPostList = function (playerX_, playerY_, name_, talk_) { + var body = new _angular_common_http__WEBPACK_IMPORTED_MODULE_2__["HttpParams"](); + body = this.addPlayerParams(body); + body = body.append('action', 'getMapPosts'); + body = body.append('position_x', playerX_); + body = body.append('position_y', playerY_); + body = body.append('name', name_); + body = body.append('talk', talk_); + return this.http.post(this.serverUrl + 'ChanWebService.php', body); + }; + //Get thread posts list + ChanWebService.prototype.getCanvasPostList = function (mapKey, canvasKey) { + var body = new _angular_common_http__WEBPACK_IMPORTED_MODULE_2__["HttpParams"](); + body = this.addPlayerParams(body); + body = body.append('action', 'getPostsByCanvas'); + body = body.append('map_key', mapKey); + body = body.append('canvas_key', canvasKey); + return this.http.post(this.serverUrl + 'ChanWebService.php', body); + }; + //Get thread posts list + ChanWebService.prototype.getReplyPostList = function (id_) { + var body = new _angular_common_http__WEBPACK_IMPORTED_MODULE_2__["HttpParams"](); + body = this.addPlayerParams(body); + body = body.append('action', 'getReplies'); + body = body.append('post_id', id_); + return this.http.post(this.serverUrl + 'ChanWebService.php', body); + }; + //Create post + ChanWebService.prototype.createPost = function (post_) { + var body = new _angular_common_http__WEBPACK_IMPORTED_MODULE_2__["HttpParams"](); + body = this.addPlayerParams(body); + body = body.append('action', 'createPost'); + body = body.append('url', post_.url); + body = body.append('message', post_.message); + body = body.append('canvas_key', post_.canvas_key); + body = body.append('map_key', post_.map_key); + body = body.append('reply', post_.reply.toString()); + //body = body.set('action' , 'createThread'); + return this.http.post(this.serverUrl + 'ChanWebService.php', body); + }; + ChanWebService.prototype.createLog = function (action_) { + var body = new _angular_common_http__WEBPACK_IMPORTED_MODULE_2__["HttpParams"](); + body = this.addPlayerParams(body); + body = body.append('action', 'setAction'); + body = body.append('player_action', action_.action); + body = body.append('value', action_.value); + return this.http.post(this.serverUrl + 'ChanWebService.php', body); + }; + ChanWebService.prototype.createAndUploadPaint = function (post_, imageData_) { + var body = new _angular_common_http__WEBPACK_IMPORTED_MODULE_2__["HttpParams"](); + body = this.addPlayerParams(body); + body = body.append('action', 'createPost'); + body = body.append('message', post_.message); + body = body.append('canvas_key', post_.canvas_key); + body = body.append('map_key', post_.map_key); + body = body.append('reply', post_.reply.toString()); + body = body.append('image_data', imageData_); + body = body.append('graffiti', post_.graffiti.toString()); + var headers = new _angular_common_http__WEBPACK_IMPORTED_MODULE_2__["HttpHeaders"](); + headers.append("Content-Type", "application/x-www-form-urlencoded"); + //http://j-query.blogspot.com/2011/02/save-base64-encoded-canvas-image-to-png.html + //body = body.set('action' , 'createThread'); + return this.http.post(this.serverUrl + 'ChanWebService.php', body); + }; + /*********************** + * PLAYER WEBSERVICE + **********************/ + //Get thread posts list + /*setMap(mapKey){ + + let body = new HttpParams(); + body = this.addPlayerParams(body); + body = body.append('map_key', mapKey); + body = body.append('action', 'changeMapPlayer'); + return this.http.post(this.serverUrl+'ChanWebService.php',body); + + }*/ + ChanWebService.prototype.changeMapPlayerName = function (mapName) { + var body = new _angular_common_http__WEBPACK_IMPORTED_MODULE_2__["HttpParams"](); + body = this.addPlayerParams(body); + body = body.append('map_name', mapName); + body = body.append('action', 'changeMapPlayerName'); + return this.http.post(this.serverUrl + 'ChanWebService.php', body); + }; + ChanWebService.prototype.changeMapRandom = function (isSecret_) { + var body = new _angular_common_http__WEBPACK_IMPORTED_MODULE_2__["HttpParams"](); + body = this.addPlayerParams(body); + body = body.append('secret', isSecret_); + body = body.append('action', 'changeMapRandom'); + return this.http.post(this.serverUrl + 'ChanWebService.php', body); + }; + ChanWebService.prototype.getItem = function (itemKey) { + var body = new _angular_common_http__WEBPACK_IMPORTED_MODULE_2__["HttpParams"](); + body = this.addPlayerParams(body); + body = body.append('item_key', itemKey); + body = body.append('action', 'setPlayerItem'); + return this.http.post(this.serverUrl + 'ChanWebService.php', body); + }; + ChanWebService.prototype.addPlayerParams = function (body_) { + var playerData = this.offlineService.getPlayerData(); + body_ = body_.append('player_id', playerData.id.toString()); + body_ = body_.append('player_key', playerData.player_key); + return body_; + }; + ChanWebService.prototype.createUser = function (anonId, anonToken, password, mapKey) { + var body = new _angular_common_http__WEBPACK_IMPORTED_MODULE_2__["HttpParams"](); + body = body.append('action', 'initPlayer'); + if (anonId) + body = body.append('player_id', anonId); + if (anonToken) + body = body.append('player_key', anonToken); + if (password) + body = body.append('player_password', password); + if (mapKey) + body = body.append('map_key', mapKey); + return this.http.post(this.serverUrl + 'ChanWebService.php', body); + }; + ChanWebService.prototype.getAds = function () { + return this.http.get('./assets/amaz/amaz.json'); + }; + /*********************** + * ADMIN WEBSERVICE + **********************/ + ChanWebService.prototype.deletePost = function (postId_, threadId_) { + var body = new _angular_common_http__WEBPACK_IMPORTED_MODULE_2__["HttpParams"](); + body = this.addPlayerParams(body); + body = body.append('action', 'deletePost'); + body = body.append('post_id', postId_.toString()); + body = body.append('map_key', threadId_); + return this.http.post(this.serverUrl + 'ChanWebService.php', body); + }; + ChanWebService.prototype.setPostUrlToFile = function (postId_) { + var body = new _angular_common_http__WEBPACK_IMPORTED_MODULE_2__["HttpParams"](); + body = this.addPlayerParams(body); + body = body.append('action', 'setPostUrlToFile'); + body = body.append('post_id', postId_.toString()); + return this.http.post(this.serverUrl + 'ChanWebService.php', body); + }; + ChanWebService.prototype.deletePostForVal = function (val_) { + var body = new _angular_common_http__WEBPACK_IMPORTED_MODULE_2__["HttpParams"](); + body = this.addPlayerParams(body); + body = body.append('action', 'deletePostForVal'); + body = body.append('val', val_); + return this.http.post(this.serverUrl + 'ChanWebService.php', body); + }; + ChanWebService.prototype.setBan = function (id_) { + var body = new _angular_common_http__WEBPACK_IMPORTED_MODULE_2__["HttpParams"](); + body = this.addPlayerParams(body); + body = body.append('action', 'setBan'); + body = body.append('post_id', id_); + return this.http.post(this.serverUrl + 'ChanWebService.php', body); + }; + ChanWebService.prototype.canonPost = function (postId_, threadId_) { + var body = new _angular_common_http__WEBPACK_IMPORTED_MODULE_2__["HttpParams"](); + body = this.addPlayerParams(body); + body = body.append('action', 'setPostCanon'); + body = body.append('post_id', postId_.toString()); + body = body.append('map_key', threadId_); + return this.http.post(this.serverUrl + 'ChanWebService.php', body); + }; + ChanWebService.prototype.isAdminConnected = function () { + var body = new _angular_common_http__WEBPACK_IMPORTED_MODULE_2__["HttpParams"](); + body = body.append('action', 'testAdminSession'); + return this.http.post(this.serverUrl + 'ChanWebService.php', body); + }; + ChanWebService.prototype.connectAdmin = function (password_) { + var body = new _angular_common_http__WEBPACK_IMPORTED_MODULE_2__["HttpParams"](); + body = body.append('action', 'validAdmin'); + body = body.append('password', password_); + return this.http.post(this.serverUrl + 'ChanWebService.php', body); + }; + ChanWebService.prototype.setAdminPassword = function (password_) { + var body = new _angular_common_http__WEBPACK_IMPORTED_MODULE_2__["HttpParams"](); + body = body.append('action', 'setAdminPassword'); + body = body.append('password', password_); + return this.http.post(this.serverUrl + 'ChanWebService.php', body); + }; + ChanWebService.prototype.logout = function () { + var body = new _angular_common_http__WEBPACK_IMPORTED_MODULE_2__["HttpParams"](); + body = body.append('action', 'unLog'); + return this.http.post(this.serverUrl + 'ChanWebService.php', body); + }; + ChanWebService.prototype.getAllPost = function () { + var body = new _angular_common_http__WEBPACK_IMPORTED_MODULE_2__["HttpParams"](); + body = this.addPlayerParams(body); + body = body.append('action', 'getAllPost'); + return this.http.post(this.serverUrl + 'ChanWebService.php', body); + }; + ChanWebService.prototype.getAllMaps = function () { + var body = new _angular_common_http__WEBPACK_IMPORTED_MODULE_2__["HttpParams"](); + body = this.addPlayerParams(body); + body = body.append('action', 'getAllMaps'); + return this.http.post(this.serverUrl + 'ChanWebService.php', body); + }; + ChanWebService.prototype.getAllTiles = function () { + var body = new _angular_common_http__WEBPACK_IMPORTED_MODULE_2__["HttpParams"](); + body = this.addPlayerParams(body); + body = body.append('action', 'getAllTiles'); + return this.http.post(this.serverUrl + 'ChanWebService.php', body); + }; + ChanWebService.prototype.saveMapModel = function (map_) { + var body = new _angular_common_http__WEBPACK_IMPORTED_MODULE_2__["HttpParams"](); + body = this.addPlayerParams(body); + body = body.append('action', 'saveMapModel'); + body = body.append('id', map_.id.toString()); + body = body.append('key', map_.key); + body = body.append('name', map_.name); + body = body.append('theme', map_.theme); + body = body.append('x', map_.x.toString()); + body = body.append('y', map_.y.toString()); + body = body.append('door_key_n', map_.door_key_n); + body = body.append('door_key_e', map_.door_key_e); + body = body.append('door_key_s', map_.door_key_s); + body = body.append('door_key_w', map_.door_key_w); + body = body.append('level_data', map_.level_data); + body = body.append('height', map_.height.toString()); + body = body.append('width', map_.width.toString()); + return this.http.post(this.serverUrl + 'ChanWebService.php', body); + }; + ChanWebService = __decorate([ + Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Injectable"])({ + providedIn: 'root' + }), + __metadata("design:paramtypes", [_angular_common_http__WEBPACK_IMPORTED_MODULE_2__["HttpClient"], _offline_service__WEBPACK_IMPORTED_MODULE_3__["OfflineService"]]) + ], ChanWebService); + return ChanWebService; +}()); + + + +/***/ }), + +/***/ "./src/app/services/game-uiservice.service.ts": +/*!****************************************************!*\ + !*** ./src/app/services/game-uiservice.service.ts ***! + \****************************************************/ +/*! exports provided: GameUIServiceService */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "GameUIServiceService", function() { return GameUIServiceService; }); +/* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm5/core.js"); +var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +var __metadata = (undefined && undefined.__metadata) || function (k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); +}; + +var GameUIServiceService = /** @class */ (function () { + function GameUIServiceService() { + this.changeStateEmitter = new _angular_core__WEBPACK_IMPORTED_MODULE_0__["EventEmitter"](); + //public changePlayerDataEmitter = new EventEmitter(); + //public changeItemsDataEmitter = new EventEmitter(); + this.changeGameDataEmitter = new _angular_core__WEBPACK_IMPORTED_MODULE_0__["EventEmitter"](); + this.changeConfigEmitter = new _angular_core__WEBPACK_IMPORTED_MODULE_0__["EventEmitter"](); + this.sendInteractionsEmitter = new _angular_core__WEBPACK_IMPORTED_MODULE_0__["EventEmitter"](); + this.postArtCanvasEmitter = new _angular_core__WEBPACK_IMPORTED_MODULE_0__["EventEmitter"](); + this.deletePostEmitter = new _angular_core__WEBPACK_IMPORTED_MODULE_0__["EventEmitter"](); + this.forceWSEmitter = new _angular_core__WEBPACK_IMPORTED_MODULE_0__["EventEmitter"](); + this.gameState = GameUIServiceService_1.STATE_GAME_RUNNING; + } + GameUIServiceService_1 = GameUIServiceService; + Object.defineProperty(GameUIServiceService, "STATE_GAME_RUNNING", { + get: function () { return 0; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(GameUIServiceService, "STATE_POSTING_UI", { + get: function () { return 1; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(GameUIServiceService, "STATE_POST_VIEWER_UI", { + get: function () { return 2; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(GameUIServiceService, "STATE_POSTING_LOADING", { + get: function () { return 3; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(GameUIServiceService, "STATE_PAINTING_UI", { + get: function () { return 4; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(GameUIServiceService, "STATE_CMD_UI", { + get: function () { return 5; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(GameUIServiceService, "STATE_INFO_UI", { + get: function () { return 6; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(GameUIServiceService, "STATE_ITEMS_UI", { + get: function () { return 7; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(GameUIServiceService, "STATE_NO_PLAYER", { + get: function () { return 8; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(GameUIServiceService, "STATE_PLAYER_UI", { + get: function () { return 9; }, + enumerable: true, + configurable: true + }); + GameUIServiceService.prototype.changeState = function (state_) { + this.gameState = state_; + this.changeStateEmitter.emit(this.gameState); + }; + GameUIServiceService.prototype.sendInteraction = function (interact_) { + this.sendInteractionsEmitter.emit(interact_); + }; + GameUIServiceService.prototype.sendPost = function (post_) { + this.postArtCanvasEmitter.emit(post_); + }; + GameUIServiceService.prototype.updateGameData = function (gameData_) { + this.changeGameDataEmitter.emit(gameData_); + }; + /* + public updatePlayerData(playerData_ : PlayerModel){ + this.changePlayerDataEmitter.emit( playerData_); + } + + public updateItemsData(itemsData){ + console.log(itemsData); + this.changeItemsDataEmitter.emit( {items: itemsData}); + }*/ + GameUIServiceService.prototype.updateConfigData = function (config_) { + this.changeConfigEmitter.emit(config_); + }; + GameUIServiceService.prototype.forceWS = function () { + this.forceWSEmitter.emit(); + }; + GameUIServiceService.prototype.deletePost = function (post_) { + this.deletePostEmitter.emit(post_); + }; + GameUIServiceService = GameUIServiceService_1 = __decorate([ + Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Injectable"])({ + providedIn: 'root' + }), + __metadata("design:paramtypes", []) + ], GameUIServiceService); + return GameUIServiceService; + var GameUIServiceService_1; +}()); + + + +/***/ }), + +/***/ "./src/app/services/offline.service.ts": +/*!*********************************************!*\ + !*** ./src/app/services/offline.service.ts ***! + \*********************************************/ +/*! exports provided: OfflineService */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "OfflineService", function() { return OfflineService; }); +/* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm5/core.js"); +/* harmony import */ var _models_player_model__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../models/player.model */ "./src/app/models/player.model.ts"); +/* harmony import */ var _models_config_model__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../models/config.model */ "./src/app/models/config.model.ts"); +var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +var __metadata = (undefined && undefined.__metadata) || function (k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); +}; + + + +var OfflineService = /** @class */ (function () { + function OfflineService() { + this.PLAYER_KEY = "player_one_data2"; + this.PLAYER_NAME_KEY = "player_name"; + this.KEYBOARD_KEY = "keyboard"; + this.CONFIG_KEY = "config_key"; + this.CHAN_KEY = "CHAN_KEY3"; + } + OfflineService.prototype.getPlayerData = function () { + var data = localStorage.getItem(this.PLAYER_KEY); + if (data != null) + return JSON.parse(data); + return new _models_player_model__WEBPACK_IMPORTED_MODULE_1__["PlayerModel"](); + }; + OfflineService.prototype.savePlayer = function (player_) { + return localStorage.setItem(this.PLAYER_KEY, JSON.stringify(player_)); + }; + OfflineService.prototype.getPlayerName = function () { + var data = localStorage.getItem(this.PLAYER_NAME_KEY); + if (data != null) + return data; + var name = Math.random().toString(36).substr(2, 9); + this.savePlayerName(name); + return name; + }; + OfflineService.prototype.savePlayerName = function (playerName_) { + return localStorage.setItem(this.PLAYER_NAME_KEY, JSON.stringify(playerName_)); + }; + OfflineService.prototype.getConfig = function () { + var data = localStorage.getItem(this.CONFIG_KEY); + console.log("getConfig" + data); + if (data != null) + return JSON.parse(data); + return new _models_config_model__WEBPACK_IMPORTED_MODULE_2__["ConfigModel"](); + }; + OfflineService.prototype.saveConfig = function (config_) { + localStorage.setItem(this.CONFIG_KEY, JSON.stringify(config_)); + }; + OfflineService.prototype.getChanData = function () { + var data = localStorage.getItem(this.CHAN_KEY); + if (data != null) + return JSON.parse(data); + return ['alpha']; + }; + OfflineService.prototype.saveChan = function (chan_) { + var listChan = this.getChanData(); + for (var c = 0; c < listChan.length; c++) { + if (listChan[c] == chan_) + return; + } + listChan.push(chan_); + return localStorage.setItem(this.CHAN_KEY, JSON.stringify(listChan)); + }; + OfflineService = __decorate([ + Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Injectable"])({ + providedIn: 'root' + }), + __metadata("design:paramtypes", []) + ], OfflineService); + return OfflineService; +}()); + + + +/***/ }), + +/***/ "./src/app/utils/constants.ts": +/*!************************************!*\ + !*** ./src/app/utils/constants.ts ***! + \************************************/ +/*! exports provided: Constants */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Constants", function() { return Constants; }); +var Constants = /** @class */ (function () { + function Constants() { + } + Object.defineProperty(Constants, "ITEM_KEY_UPLOAD_RING", { + get: function () { return "upload"; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(Constants, "ITEM_KEY_DELETE_SPONGE", { + get: function () { return "post delete"; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(Constants, "ITEM_KEY_VARNISH", { + get: function () { return "varnish powder"; }, + enumerable: true, + configurable: true + }); + return Constants; +}()); + + + +/***/ }), + +/***/ "./src/app/utils/helpers.ts": +/*!**********************************!*\ + !*** ./src/app/utils/helpers.ts ***! + \**********************************/ +/*! exports provided: Helpers */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Helpers", function() { return Helpers; }); +var Helpers = /** @class */ (function () { + function Helpers() { + } + /** + * Determine the mobile operating system. + * This function returns one of 'iOS', 'Android', 'Windows Phone', or 'unknown'. + * + * @returns {Boolean} + */ + Helpers.isMobile = function () { + var userAgent = navigator.userAgent || navigator.vendor; + // Windows Phone must come first because its UA also contains "Android" + if (/windows phone/i.test(userAgent)) { + return true; + } + if (/android/i.test(userAgent)) { + return true; + } + // iOS detection from: http://stackoverflow.com/a/9039885/177710 + if (/iPad|iPhone|iPod/.test(userAgent)) { + return true; + } + return false; + }; + Helpers.antiWord = function (message_) { + return message_.replace(/nigger/ig, 'noggel'); + }; + Helpers.isPT = function () { + var lang = navigator.language; + return (lang.toLowerCase().indexOf('pt') > -1 || lang.toLowerCase().indexOf('BR') > -1); + }; + return Helpers; +}()); + + + +/***/ }), + +/***/ "./src/app/utils/urlParser.ts": +/*!************************************!*\ + !*** ./src/app/utils/urlParser.ts ***! + \************************************/ +/*! exports provided: UrlParser */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "UrlParser", function() { return UrlParser; }); +var UrlParser = /** @class */ (function () { + function UrlParser(url_) { + this.type = 0; + this.url = url_; + this.type = this.getUrlType(); + return this; + } + Object.defineProperty(UrlParser, "TYPE_LINK", { + get: function () { return 0; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(UrlParser, "TYPE_IMG", { + get: function () { return 1; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(UrlParser, "TYPE_IMG_GIF", { + get: function () { return 2; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(UrlParser, "TYPE_MOVIE", { + get: function () { return 3; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(UrlParser, "TYPE_YOUTUBE", { + get: function () { return 4; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(UrlParser, "TYPE_MP3", { + get: function () { return 5; }, + enumerable: true, + configurable: true + }); + UrlParser.prototype.setUrl = function (url_) { + this.url = url_; + this.type = this.getUrlType(); + return this; + }; + UrlParser.prototype.getUrlType = function () { + if (this.url != undefined) { + var tempUrl = this.url.toLowerCase(); + if (tempUrl.indexOf("png") > -1 || tempUrl.indexOf("jpg") > -1 || tempUrl.indexOf("jpeg") > -1 || tempUrl.indexOf("webp") > -1) { + return UrlParser.TYPE_IMG; + } + else if (tempUrl.indexOf("gif") > -1) { + return UrlParser.TYPE_IMG_GIF; + } + else if (tempUrl.indexOf(".mp4") > -1 || tempUrl.indexOf(".webm") > -1) { + return UrlParser.TYPE_MOVIE; + } + else if (tempUrl.indexOf("youtube.com") > -1 || tempUrl.indexOf("youtu.be") > -1) { + return UrlParser.TYPE_YOUTUBE; + } + else if (tempUrl.indexOf("mp3") > -1) { + return UrlParser.TYPE_MP3; + } + } + return UrlParser.TYPE_LINK; + }; + UrlParser.prototype.getYoutubeId = function () { + var regExp = /^.*(youtu\.be\/|v\/|u\/\w\/|embed\/|watch\?v=|\&v=)([^#\&\?]*).*/; + var match = this.url.match(regExp); + if (match && match[2].length == 11) { + return match[2]; + } + else { + return ""; + } + }; + UrlParser.prototype.getImage = function () { + if (this.type === UrlParser.TYPE_YOUTUBE) { + //get the preview + return "https://img.youtube.com/vi/" + this.getYoutubeId() + "/hqdefault.jpg"; + } + return this.url; + }; + UrlParser.prototype.getSafeTubeURL = function (sanitizer_) { + var tmpURl; + if (this.type === UrlParser.TYPE_YOUTUBE) { + //get the preview + tmpURl = "https://www.youtube.com/embed/" + this.getYoutubeId(); + return sanitizer_.bypassSecurityTrustResourceUrl(tmpURl); + } + return this.url; + }; + return UrlParser; +}()); + + + +/***/ }), + +/***/ "./src/environments/environment.ts": +/*!*****************************************!*\ + !*** ./src/environments/environment.ts ***! + \*****************************************/ +/*! exports provided: environment */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "environment", function() { return environment; }); +// This file can be replaced during build by using the `fileReplacements` array. +// `ng build --prod` replaces `environment.ts` with `environment.prod.ts`. +// The list of file replacements can be found in `angular.json`. +var environment = { + production: false, + apiUrl: 'http://localhost:8888/srv/php/', + clientUrl: '/', +}; +/* + * For easier debugging in development mode, you can import the following file + * to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`. + * + * This import should be commented out in production mode because it will have a negative impact + * on performance if an error is thrown. + */ +// import 'zone.js/dist/zone-error'; // Included with Angular CLI. + + +/***/ }), + +/***/ "./src/main.ts": +/*!*********************!*\ + !*** ./src/main.ts ***! + \*********************/ +/*! no exports provided */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm5/core.js"); +/* harmony import */ var _angular_platform_browser_dynamic__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @angular/platform-browser-dynamic */ "./node_modules/@angular/platform-browser-dynamic/fesm5/platform-browser-dynamic.js"); +/* harmony import */ var _app_app_module__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./app/app.module */ "./src/app/app.module.ts"); +/* harmony import */ var _environments_environment__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./environments/environment */ "./src/environments/environment.ts"); + + + + +if (_environments_environment__WEBPACK_IMPORTED_MODULE_3__["environment"].production) { + Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["enableProdMode"])(); +} +Object(_angular_platform_browser_dynamic__WEBPACK_IMPORTED_MODULE_1__["platformBrowserDynamic"])().bootstrapModule(_app_app_module__WEBPACK_IMPORTED_MODULE_2__["AppModule"]) + .catch(function (err) { return console.error(err); }); + + +/***/ }), + +/***/ 0: +/*!***************************!*\ + !*** multi ./src/main.ts ***! + \***************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +module.exports = __webpack_require__(/*! /Users/alexandre/Desktop/Alexandre/projetZ/wip/SITEZ/Marquis/Protagoras/ProtagurOS/src/main.ts */"./src/main.ts"); + + +/***/ }) + +},[[0,"runtime","vendor"]]]); +//# sourceMappingURL=main.js.map \ No newline at end of file diff --git a/ready2use/main.js.map b/ready2use/main.js.map new file mode 100644 index 0000000..aa170f0 --- /dev/null +++ b/ready2use/main.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["webpack:///./src/$_lazy_route_resource lazy namespace object","webpack:///./src/app/app.component.css","webpack:///./src/app/app.component.html","webpack:///./src/app/app.component.ts","webpack:///./src/app/app.module.ts","webpack:///./src/app/components/ad-post-ui/ad-post-ui.component.css","webpack:///./src/app/components/ad-post-ui/ad-post-ui.component.html","webpack:///./src/app/components/ad-post-ui/ad-post-ui.component.ts","webpack:///./src/app/components/admin-map/admin-map.component.css","webpack:///./src/app/components/admin-map/admin-map.component.html","webpack:///./src/app/components/admin-map/admin-map.component.ts","webpack:///./src/app/components/admin-post/admin-post.component.css","webpack:///./src/app/components/admin-post/admin-post.component.html","webpack:///./src/app/components/admin-post/admin-post.component.ts","webpack:///./src/app/components/chat-view/chat-view.component.css","webpack:///./src/app/components/chat-view/chat-view.component.html","webpack:///./src/app/components/chat-view/chat-view.component.ts","webpack:///./src/app/components/cmd-ui/cmd-ui.component.css","webpack:///./src/app/components/cmd-ui/cmd-ui.component.html","webpack:///./src/app/components/cmd-ui/cmd-ui.component.ts","webpack:///./src/app/components/gl-view/gl-view.component.css","webpack:///./src/app/components/gl-view/gl-view.component.html","webpack:///./src/app/components/gl-view/gl-view.component.ts","webpack:///./src/app/components/home/home.component.css","webpack:///./src/app/components/home/home.component.html","webpack:///./src/app/components/home/home.component.ts","webpack:///./src/app/components/info-view/info-view.component.css","webpack:///./src/app/components/info-view/info-view.component.html","webpack:///./src/app/components/info-view/info-view.component.ts","webpack:///./src/app/components/login/login.component.css","webpack:///./src/app/components/login/login.component.html","webpack:///./src/app/components/login/login.component.ts","webpack:///./src/app/components/media-display/media-display.component.css","webpack:///./src/app/components/media-display/media-display.component.html","webpack:///./src/app/components/media-display/media-display.component.ts","webpack:///./src/app/components/painting-ui/painting-ui.component.css","webpack:///./src/app/components/painting-ui/painting-ui.component.html","webpack:///./src/app/components/painting-ui/painting-ui.component.ts","webpack:///./src/app/components/phone-poster/phone-poster.component.css","webpack:///./src/app/components/phone-poster/phone-poster.component.html","webpack:///./src/app/components/phone-poster/phone-poster.component.ts","webpack:///./src/app/components/pin-post-ui/pin-post-ui.component.css","webpack:///./src/app/components/pin-post-ui/pin-post-ui.component.html","webpack:///./src/app/components/pin-post-ui/pin-post-ui.component.ts","webpack:///./src/app/components/player-ui/player-ui.component.css","webpack:///./src/app/components/player-ui/player-ui.component.html","webpack:///./src/app/components/player-ui/player-ui.component.ts","webpack:///./src/app/components/post-viewer-ui/post-viewer-ui.component.css","webpack:///./src/app/components/post-viewer-ui/post-viewer-ui.component.html","webpack:///./src/app/components/post-viewer-ui/post-viewer-ui.component.ts","webpack:///./src/app/components/posting-ui/posting-ui.component.css","webpack:///./src/app/components/posting-ui/posting-ui.component.html","webpack:///./src/app/components/posting-ui/posting-ui.component.ts","webpack:///./src/app/components/tile-edit/tile-edit.component.css","webpack:///./src/app/components/tile-edit/tile-edit.component.html","webpack:///./src/app/components/tile-edit/tile-edit.component.ts","webpack:///./src/app/interfaces/player-interface/player-interface.component.css","webpack:///./src/app/interfaces/player-interface/player-interface.component.html","webpack:///./src/app/interfaces/player-interface/player-interface.component.ts","webpack:///./src/app/models/action.model.ts","webpack:///./src/app/models/config.model.ts","webpack:///./src/app/models/game-data.model.ts","webpack:///./src/app/models/interaction-model.ts","webpack:///./src/app/models/player.model.ts","webpack:///./src/app/models/post.model.ts","webpack:///./src/app/motor/canvasPlane.ts","webpack:///./src/app/motor/door.ts","webpack:///./src/app/motor/game.ts","webpack:///./src/app/motor/gameUtils.ts","webpack:///./src/app/motor/gate.ts","webpack:///./src/app/motor/item.ts","webpack:///./src/app/motor/mapMaker.ts","webpack:///./src/app/motor/playerMesh.ts","webpack:///./src/app/motor/playerMotor.ts","webpack:///./src/app/motor/tile.ts","webpack:///./src/app/services/chan-web.service.ts","webpack:///./src/app/services/game-uiservice.service.ts","webpack:///./src/app/services/offline.service.ts","webpack:///./src/app/utils/constants.ts","webpack:///./src/app/utils/helpers.ts","webpack:///./src/app/utils/urlParser.ts","webpack:///./src/environments/environment.ts","webpack:///./src/main.ts"],"names":[],"mappings":";;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;AACF;AACA,4CAA4C,WAAW;AACvD;AACA;AACA,4E;;;;;;;;;;;ACZA,mB;;;;;;;;;;;ACAA,wD;;;;;;;;;;;;;;;;;;;;;ACA0C;AAO1C;IALA;QAME,UAAK,GAAG,eAAe,CAAC;IAC1B,CAAC;IAFY,YAAY;QALxB,+DAAS,CAAC;YACT,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AC,EAAC;YACrC,iBAAiB;YACjB,MAAM,CAAC,6BAA6B,GAAC,IAAI,CAAC,YAAY,EAAE,GAAC,gBAAgB,CAAC;QAC9E,CAAC;QAED,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC;IACpB,CAAC;IAEM,kCAAc,GAArB,UAAsB,UAAyB;QAC3C,IAAI,MAAM,CAAC;QACX,EAAE,EAAC,IAAI,CAAC,IAAI,KAAK,SAAS,CAAC,YAAY,CAAC,EAAC;YACrC,iBAAiB;YACjB,MAAM,GAAI,gCAAgC,GAAC,IAAI,CAAC,YAAY,EAAE,CAAC;YAChE,MAAM,CAAC,UAAU,CAAC,8BAA8B,CAAC,MAAM,CAAC,CAAC;QAC5D,CAAC;QAED,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC;IACpB,CAAC;IACL,gBAAC;AAAD,CAAC;;;;;;;;;;;;;;AC5ED;AAAA;AAAA,gFAAgF;AAChF,0EAA0E;AAC1E,gEAAgE;AAEzD,IAAM,WAAW,GAAG;IACzB,UAAU,EAAE,KAAK;IACjB,MAAM,EAAE,gCAAgC;IACxC,SAAS,EAAE,GAAG;CACf,CAAC;AAEF;;;;;;GAMG;AACH,mEAAmE;;;;;;;;;;;;;ACjBnE;AAAA;AAAA;AAAA;AAAA;AAA+C;AAC4B;AAE9B;AACY;AAEzD,EAAE,CAAC,CAAC,qEAAW,CAAC,UAAU,CAAC,CAAC,CAAC;IAC3B,oEAAc,EAAE,CAAC;AACnB,CAAC;AAED,gGAAsB,EAAE,CAAC,eAAe,CAAC,yDAAS,CAAC;KAChD,KAAK,CAAC,aAAG,IAAI,cAAO,CAAC,KAAK,CAAC,GAAG,CAAC,EAAlB,CAAkB,CAAC,CAAC","file":"main.js","sourcesContent":["function webpackEmptyAsyncContext(req) {\n\t// Here Promise.resolve().then() is used instead of new Promise() to prevent\n\t// uncaught exception popping up in devtools\n\treturn Promise.resolve().then(function() {\n\t\tvar e = new Error(\"Cannot find module '\" + req + \"'\");\n\t\te.code = 'MODULE_NOT_FOUND';\n\t\tthrow e;\n\t});\n}\nwebpackEmptyAsyncContext.keys = function() { return []; };\nwebpackEmptyAsyncContext.resolve = webpackEmptyAsyncContext;\nmodule.exports = webpackEmptyAsyncContext;\nwebpackEmptyAsyncContext.id = \"./src/$$_lazy_route_resource lazy recursive\";","module.exports = \"\"","module.exports = \"\\n\\n\\n\"","import { Component } from '@angular/core';\n\n@Component({\n selector: 'app-root',\n templateUrl: './app.component.html',\n styleUrls: ['./app.component.css']\n})\nexport class AppComponent {\n title = 'prota-angular';\n}\n","import { BrowserModule } from '@angular/platform-browser';\nimport { NgModule } from '@angular/core';\nimport { RouterModule, Routes } from '@angular/router';\nimport { FormsModule } from '@angular/forms';\nimport { HttpClientModule} from '@angular/common/http';\n\nimport { AppComponent } from './app.component';\nimport { HomeComponent } from './components/home/home.component';\nimport { GlViewComponent } from './components/gl-view/gl-view.component';\nimport { PostingUIComponent } from './components/posting-ui/posting-ui.component';\nimport { PostViewerUiComponent } from './components/post-viewer-ui/post-viewer-ui.component';\nimport { MediaDisplayComponent } from './components/media-display/media-display.component';\nimport { PinPostUiComponent } from './components/pin-post-ui/pin-post-ui.component';\nimport { PaintingUiComponent } from './components/painting-ui/painting-ui.component';\nimport { CmdUiComponent } from './components/cmd-ui/cmd-ui.component';\nimport { LoginComponent } from './components/login/login.component';\nimport { PlayerInterfaceComponent } from './interfaces/player-interface/player-interface.component';\nimport { AdminPostComponent } from './components/admin-post/admin-post.component';\nimport { AdminMapComponent } from './components/admin-map/admin-map.component';\nimport { TileEditComponent } from './components/tile-edit/tile-edit.component';\nimport { NgxTwitterTimelineModule } from 'ngx-twitter-timeline';\nimport { PhonePosterComponent } from './components/phone-poster/phone-poster.component';\nimport { QRCodeModule } from 'angularx-qrcode';\nimport { ChatViewComponent } from './components/chat-view/chat-view.component';\nimport { InfoViewComponent } from './components/info-view/info-view.component';\nimport {NgxPaginationModule} from 'ngx-pagination';\nimport { DeviceDetectorModule } from 'ngx-device-detector';\nimport { PlayerUiComponent } from './components/player-ui/player-ui.component';\nimport { AdPostUiComponent } from './components/ad-post-ui/ad-post-ui.component';\n\nconst appRoutes: Routes = [\n { path: '',\n pathMatch: 'full',\n component: HomeComponent \n },\n { path: 'admin-post', component: AdminPostComponent },\n { path: 'admin-map', component: AdminMapComponent },\n //{ path: 'home', component: HomeComponent },\n { path: 'admin', component: LoginComponent },\n { path: 'gl-view', component: GlViewComponent },\n { path: 'ch/:map', component: GlViewComponent,},\n { path: 'painting', component: PaintingUiComponent },\n { path: 'phone-poster/:id/:key/:canvas', component: PhonePosterComponent },\n];\n\n@NgModule({\n declarations: [\n AppComponent,\n HomeComponent,\n GlViewComponent,\n PostingUIComponent,\n PostViewerUiComponent,\n MediaDisplayComponent,\n PinPostUiComponent,\n PaintingUiComponent,\n CmdUiComponent,\n LoginComponent,\n PlayerInterfaceComponent,\n AdminPostComponent,\n AdminMapComponent,\n TileEditComponent,\n PhonePosterComponent,\n ChatViewComponent,\n InfoViewComponent,\n PlayerUiComponent,\n AdPostUiComponent\n ],\n imports: [\n QRCodeModule,\n BrowserModule,\n NgxPaginationModule,\n DeviceDetectorModule.forRoot(),\n FormsModule,\n HttpClientModule,\n NgxTwitterTimelineModule,\n RouterModule.forRoot(\n appRoutes,\n )\n ],\n providers: [],\n bootstrap: [AppComponent]\n})\nexport class AppModule { }\n","module.exports = \"#container{\\n border-style : solid;\\n border-width : 2px;\\n border-color : rgb(60, 68, 61);\\n border-radius : 3px;\\n margin: 8px\\n}\\n\\n#close-btn{\\n position: absolute;\\n top: 16px;\\n right: 16px;\\n cursor: pointer;\\n}\\n\\n#desc{\\n \\n background-image: url(\\\"/assets/img/tool_bar_bg.png\\\");\\n background-repeat: repeat-x;\\n background-position: bottom;\\n position: absolute;\\n bottom: 0px;\\n text-align: center;\\n margin: 8px;\\n right: 0px;\\n color: aliceblue;\\n padding-top: 20px;\\n padding-right: 8px;\\n padding-left: px;\\n}\\n\\ndiv {\\n max-width: 250px;\\n max-height: 250px;\\n overflow: hidden;\\n}\\n\\nimg{\\n max-width: 250px;\\n max-height: 350px;\\n}\"","module.exports = \"\\n\"","import { Component, OnInit, Output,EventEmitter } from '@angular/core';\nimport { ChanWebService } from 'src/app/services/chan-web.service';\nimport {AdvertisementModel} from '../../models/advertisement.model';\n\n@Component({\n selector: 'app-ad-post-ui',\n templateUrl: './ad-post-ui.component.html',\n styleUrls: ['./ad-post-ui.component.css']\n})\nexport class AdPostUiComponent implements OnInit {\n\n lang: string;\n country: string= \"us\";\n\n currentURL: string;\n currentImg: string;\n currentDesc: string;\n currentAlt: string;\n\n myInterval;\n adsFiltered: AdvertisementModel[];\n adIndex = 0;\n\n @Output() close = new EventEmitter();\n\n constructor( private chanWebService: ChanWebService) { }\n\n ngOnInit() {\n this.lang = navigator.language;\n\n /*\n if(this.lang.toLowerCase().indexOf(\"us\")> -1){\n this.country = \"us\";\n } else if(this.lang.toLowerCase().indexOf(\"fr\")> -1){\n this.country = \"fr\";\n }*/\n\n //Map made! We load the money maker\n this.chanWebService.getAds().subscribe( (ads: AdvertisementModel[]) =>{\n //console.log(ads);\n\n this.adsFiltered = new Array();\n for(let a = 0; a < ads.length; a++){\n if(ads[a].loc === this.country){\n this.adsFiltered.push(ads[a]);\n }\n }\n console.log( this.adsFiltered);\n this.adIndex = Math.floor(Math.random() * Math.floor(this.adsFiltered.length));\n this. displayAd();\n /*this.myInterval = setInterval(()=>{\n this.updateAd();\n }, 15000);*/\n });\n }\n\n displayAd(){\n let ad : AdvertisementModel = this.adsFiltered[this.adIndex];\n this.currentURL = ad.url;\n this.currentImg = ad.picture;\n this.currentDesc = ad.name;\n }\n\n updateAd(){\n this.adIndex ++;\n console.log(this.adsFiltered);\n if( this.adIndex >= this.adsFiltered.length) this.adIndex = 0;\n if(this.adsFiltered.length > 0) this.displayAd();\n }\n\n gotTo(url_){\n window.open(url_, '_blank');\n }\n\n\n}\n","module.exports = \".container{\\n height: 100%;\\n}\\n\\n.post-viewer-ui-message{\\n\\n position: relative;\\n top:8px;\\n bottom:18px;\\n overflow : scroll;\\n height: 85%;\\n width: 100%;\\n left: 0;\\n right: 0;\\n margin: auto;\\n padding : 10px;\\n background: rgb(247, 189, 203);\\n border-style: solid;\\n border-width: 1px;\\n border-color: rgb(181, 134, 145);\\n border-radius: 5px;\\n}\\n\\n.ascii-art {\\n font-family: monospace;\\n font-family: \\\"Lucida Console\\\", monospace;\\n letter-spacing: 0.2em;\\n line-height: 0.8em;\\n}\"","module.exports = \"
\\n Posts - Maps - Go Game!\\n
\\n \\n
\\n \\n \\n \\n
\\n ----------------------------------
\\n
\\n Map name: {{selectedMap.name}} ({{selectedMap.x}}, {{selectedMap.y}})
\\n Map key: {{selectedMap.key}}
\\n Map width: {{selectedMap.width}}
\\n Map height: {{selectedMap.height}}
\\n ----------------------------------
\\n Door North
\\n Door East
\\n Door South
\\n Door West
\\n ----------------------------------
\\n
\\n \\n \\n \\n \\n
\\n\\n \\n \\n \\n
\\n\\n
\\n There's NOTHING here! ({{currentX}}, {{currentY}})\\n
\\n
\\n
\"","import { Component, OnInit } from '@angular/core';\nimport { MapModel } from 'src/app/models/map.model';\nimport { AllMapResponseModel }from 'src/app/models/all-map.response.model';\nimport { ChanWebService } from 'src/app/services/chan-web.service';\nimport { AllTilesResponseModel } from 'src/app/models/all-tiles.response.model';\nimport { TileModel } from 'src/app/models/tile.model';\nimport {GenericResponseModel} from '../../models/generic.response.model';\n\n@Component({\n selector: 'app-admin-map',\n templateUrl: './admin-map.component.html',\n styleUrls: ['./admin-map.component.css']\n})\nexport class AdminMapComponent implements OnInit {\n\n maps: MapModel[];\n selectedMapKey: any;\n selectedTileVal: number =0;\n selectedMap: MapModel;\n mapData: string[] = [];\n allTiles: TileModel[];\n\n mapDataLines: string[][] = [];\n\n constructor(private chanWebService: ChanWebService) { }\n\n ngOnInit() {\n\n this.chanWebService.getAllMaps().subscribe( (data_: AllMapResponseModel) =>{\n this.maps = data_.result;\n if( this.maps.length > 0){\n\n //We looking for the alpha map\n this.maps.forEach(map => {\n if(map.name === \"alpha\"){\n this.selectedMapKey = map.key;\n this.onChangeMap(this.selectedMapKey);\n }\n });\n } \n });\n\n this.chanWebService.getAllTiles().subscribe( (data_: AllTilesResponseModel) =>{\n \n this.allTiles = data_.result;\n this.selectedTileVal = this.allTiles[0].value;\n\n });\n }\n\n onChangeMap(key_){\n\n this.selectedMapKey = key_;\n\n this.maps.forEach(map => {\n if(map.key == key_) {\n this.selectedMap = map;\n\n this.currentX = this.selectedMap.x;\n this.currentY = this.selectedMap.y;\n\n //Parsing the map datas\n this.mapData = this.selectedMap.level_data.split(\",\");\n this.mapDataLines = [];\n\n let n =0;\n for(let h = 0; h < this.selectedMap.height; h++){\n let mapDataWidth = [];\n for(let w = 0; w < this.selectedMap.width; w++){\n mapDataWidth.push(this.mapData[n]);\n n ++;\n }\n this.mapDataLines.push(mapDataWidth);\n }\n\n }\n });\n }\n\n onChangeTileBrush(val_){\n this.selectedTileVal = val_;\n }\n\n onChangeTileAt(x_,y_){\n console.log( this.selectedTileVal +\",\"+x_+\",\"+y_);\n let lineTemp = this.mapDataLines[y_]; \n lineTemp[x_] = this.selectedTileVal.toString() ;\n this.mapDataLines[y_] = lineTemp;\n console.log( this.mapDataLines);\n }\n\n saveMap(){\n let tempNewData : string = \"\" ;\n for(let y= 0; y < this.mapDataLines.length; y++){\n let line = this.mapDataLines[y];\n for(let x= 0; x < line.length; x++){\n tempNewData = tempNewData+line[x]+\",\";\n }\n }\n \n this.selectedMap.level_data = tempNewData ;\n console.log( this.selectedMap);\n this.chanWebService.saveMapModel( this.selectedMap ).subscribe( (data_: any) => {\n alert(JSON.stringify(data_));\n });\n\n }\n\n currentX: number;\n currentY: number;\n moveMap(dir_){\n\n switch(dir_){\n //North\n case 0:\n this.currentY --;\n break;\n\n //East\n case 1:\n this.currentX ++;\n break;\n\n //South\n case 2:\n this.currentY ++;\n break;\n\n //West\n case 3:\n this.currentX --;\n break;\n }\n\n this.selectedMap = null;\n\n this.maps.forEach(map => {\n if(map.x == this.currentX && map.y == this.currentY){\n this.onChangeMap(map.key);\n }\n });\n }\n\n}\n","module.exports = \".container{\\n height: 100%;\\n}\\n\\n.post-viewer-ui-message{\\n\\n position: relative;\\n top:8px;\\n bottom:18px;\\n overflow : scroll;\\n height: 85%;\\n /*max-width: 450px;*/\\n width: 100%;\\n left: 0;\\n right: 0;\\n margin: auto;\\n padding : 10px;\\n background: rgb(247, 189, 203);\\n border-style: solid;\\n border-width: 1px;\\n border-color: rgb(181, 134, 145);\\n border-radius: 5px;\\n}\\n\\nimg{\\n max-width:150px;\\n max-height:150px;\\n}\\n\\n/*\\ndiv {\\n margin-bottom: 8px;\\n}*/\\n\\n::ng-deep .img-preview img, .img-preview video, .img-preview iframe, .img-preview audio {\\n max-width: 600px;\\n max-height: 400px;\\n}\"","module.exports = \"
\\n Posts - Maps - Go Game!\\n
\\n\\n --------- \\n
\\n N° {{post.id}} 👌
\\n Player: {{post.player_id}}
\\n IP: {{post.player_ip}}
\\n CHAN: {{post.map_key}}
\\n\\n \\n Url: {{post.url}}
\\n Message: {{post.message}}
\\n \\n
\\n
\\n Thanks, post has been succesfuly DELETED!\\n
\\n
\\n\\n
\\n\\n
\\n
\\n
\\n
\\n -----------------------------------------
\\n
\\n \\n
\\n
\\n\"","import { Component, OnInit } from '@angular/core';\nimport { ChanWebService } from 'src/app/services/chan-web.service';\nimport { AllPostResponseModel } from 'src/app/models/all-post.response.model';\nimport { PostModel } from 'src/app/models/post.model';\nimport {GenericResponseModel} from 'src/app/models/generic.response.model'\n\n\n@Component({\n selector: 'app-admin-post',\n templateUrl: './admin-post.component.html',\n styleUrls: ['./admin-post.component.css']\n})\nexport class AdminPostComponent implements OnInit {\n\n public posts: PostModel[] = [];\n valToDelete: string = \"\";\n p: number = 1;\n\n constructor(private chanWebService: ChanWebService) { }\n\n ngOnInit() {\n this.updatePost();\n }\n\n updatePost(){\n this.chanWebService.getAllPost().subscribe( (data_: AllPostResponseModel) =>{\n this.posts = data_.result.reverse();\n })\n }\n\n private postToDelete;\n \n deletePost(postModel_){\n\n this.postToDelete = postModel_;\n console.log(\"this.postToDelete:\"+this.postToDelete);\n this.chanWebService.deletePost(postModel_.id,postModel_.map_key).subscribe(\n //Data success\n (data : GenericResponseModel) => {\n //alert(JSON.stringify(data));\n //this.updatePost();\n this.posts.find((post_)=>{\n return (post_.id == this.postToDelete.id);\n }).was_deleted = true;\n\n });\n }\n\n deleteVal(){\n this.chanWebService.deletePostForVal(this.valToDelete).subscribe(\n //Data success\n (data : GenericResponseModel) => {\n alert(JSON.stringify(data));\n this.updatePost();\n });\n }\n\n setBan(id_){\n this.chanWebService.setBan(id_).subscribe(\n //Data success\n (data : GenericResponseModel) => {\n alert(JSON.stringify(data));\n this.updatePost();\n });\n }\n\n canonPost(id_, thread_){\n this.chanWebService.canonPost(id_, thread_).subscribe(\n //Data success\n (data : GenericResponseModel) => {\n alert(JSON.stringify(data));\n this.updatePost();\n });\n }\n\n banPost(){\n \n }\n\n}\n","module.exports = \"#container{\\n display:block;\\n /*height: 255px;*/\\n width: 340px;\\n color:white;\\n padding: 8px;\\n}\\n\\n.bgChatUI{\\n margin: 4px; \\n bottom: 60px;\\n /*height: 200px;\\n overflow-y: scroll;*/\\n font-size: 12px;\\n }\\n\\n.yourPlayer{\\n color:rgb(155, 155, 155);\\n }\\n\\n.inputChat{\\n /*position: absolute;\\n bottom: 0px;\\n height: 50px;*/\\n width: 100%;\\n text-align: center;\\n }\\n\\n.bgLineUI{\\n border-radius: 5px;\\n background: rgba(46, 46, 46, 0.9);\\n font-size: 12px;\\n padding: 5px;\\n}\"","module.exports = \"
\\n
\\n
\\n
\\n
\\n gameDataModel.actions.length-6\\\"\\n [ngStyle]=\\\"{'color': (action.player_id == gameDataModel.player.id) ? 'rgb(239, 147, 162)' : 'white' }\\\">\\n #{{action.player_id}} (you){{action.value}}
\\n
\\n
\\n
\\n
\\n \\n \\n
\\n
\\n\"","import { Component, OnInit ,Input} from '@angular/core';\nimport { GameDataModel } from '../../models/game-data.model';\nimport { ChanWebService } from 'src/app/services/chan-web.service';\nimport { post } from 'selenium-webdriver/http';\nimport { ActionModel } from 'src/app/models/action.model';\nimport {GameUIServiceService} from '../../services/game-uiservice.service'\nimport { Helpers } from 'src/app/utils/helpers';\n\n@Component({\n selector: 'app-chat-view',\n templateUrl: './chat-view.component.html',\n styleUrls: ['./chat-view.component.css']\n})\nexport class ChatViewComponent implements OnInit {\n\n @Input() gameDataModel: GameDataModel = new GameDataModel();\n messageToPost: string = \"\";\n\n constructor(private chanWS: ChanWebService,\n private gameUIServiceService : GameUIServiceService,) { }\n\n ngOnInit() {\n\n }\n\n postMessage(){\n let action = new ActionModel();\n action.value = this.messageToPost;\n action.action = \"talk\";\n this.messageToPost = \"\";\n this.chanWS.createLog(action).subscribe(\n //Data success\n (data : any) => {\n console.log(data);\n this.gameUIServiceService.forceWS();\n \n }\n );\n \n }\n\n}\n","module.exports = \"#commandPrompt{\\n background-color: black;\\n color: green;\\n font-family: 'Courier New', Courier, monospace;\\n text-align: left;\\n height: 100%;\\n padding: 2px;\\n}\\n\\n#commandInput{\\n color: black;\\n background-color: green;\\n width:100%;\\n border: none;\\n}\\n\\n::-webkit-input-placeholder { /* Firefox, Chrome, Opera */ \\n color: white; \\n}\\n\\n::-ms-input-placeholder { /* Firefox, Chrome, Opera */ \\n color: white; \\n}\\n\\n::placeholder { /* Firefox, Chrome, Opera */ \\n color: white; \\n} \"","module.exports = \"\\n
\\n /dungeon/users/anon$
\\n type command here_\\\">\\n \\n
\\n
\\n
{{reply}}
\\n
\\n
\"","import { Component, OnInit } from '@angular/core';\nimport {GameUIServiceService} from '../../services/game-uiservice.service'\nimport {ChanWebService} from '../../services/chan-web.service'\nimport { GenericResponseModel } from 'src/app/models/generic.response.model';\nimport{ AdminResponseModel} from '../../models/admin.response.model';\n\n@Component({\n selector: 'app-cmd-ui',\n templateUrl: './cmd-ui.component.html',\n styleUrls: ['./cmd-ui.component.css']\n})\nexport class CmdUiComponent implements OnInit {\n\n commandTyped: string;\n commandReplies: string[] = [];\n\n constructor(private gameUIServiceService : GameUIServiceService, private chanWebService: ChanWebService) { }\n\n ngOnInit() {\n }\n\n close(){\n this.gameUIServiceService.changeState(GameUIServiceService.STATE_GAME_RUNNING);\n }\n\n sendCMD(){\n if(this.commandTyped) {\n this.commandReplies.unshift(\">\"+this.commandTyped);\n this.analysisCMD(this.commandTyped);\n this.commandTyped = \"\";\n }\n }\n /********************\n * COMMAND ANALYSIS\n * ******************/\n\n analysisCMD(cmd_){\n let cmdData = cmd_.split(\" \");\n if(cmdData[0] == \"adminconnect\" && cmdData[1]){\n\n this.commandReplies.unshift(\"#### TRY TO CONNECT ADMIN #####\");\n this.connectAdmin(cmdData[1]);\n\n }else if(cmdData[0] == \"admininit\" && cmdData[1]){\n\n this.commandReplies.unshift(\"#### TRY TO INIT ADMIN #####\");\n this.setAdminPassword(cmdData[1]);\n\n }else if(cmdData[0] == \"logout\" && cmdData[1]){\n\n this.commandReplies.unshift(\"#### LOGOUT #####\");\n this.logout();\n\n }else if(cmdData[0] == \"admintest\"){\n\n this.commandReplies.unshift(\"#### TEST ADMIN CONNECTION #####\");\n this.isAdminConnected();\n\n } else {\n this.commandReplies.unshift(\"!command not recognized!\");\n }\n }\n \n isAdminConnected(){\n this.chanWebService.isAdminConnected().subscribe( (data_: AdminResponseModel) => {\n if(data_.ok) {\n\n if(data_.result === \"true\"){\n this.commandReplies.unshift(\"***** Admin is connected *****\");\n } else {\n this.commandReplies.unshift(\"***** Admin is not connected *****\");\n }\n \n this.commandReplies.unshift(data_.result);\n } else {\n this.commandReplies.unshift(\"!error!\");\n }\n })\n }\n \n connectAdmin(password_){\n this.chanWebService.connectAdmin(password_).subscribe( (data_: AdminResponseModel) => {\n if(data_.ok) {\n this.commandReplies.unshift(\"***** Admin connected *****\");\n this.commandReplies.unshift(data_.result);\n } else {\n this.commandReplies.unshift(\"!error!\");\n }\n })\n }\n \n setAdminPassword(password_){\n this.chanWebService.setAdminPassword(password_).subscribe( (data_: AdminResponseModel) => {\n if(data_.ok) {\n this.commandReplies.unshift(\"***** Set password successful *****\");\n this.commandReplies.unshift(data_.result);\n } else {\n this.commandReplies.unshift(\"!error!\");\n }\n })\n }\n \n logout(){\n this.chanWebService.logout().subscribe( (data_: AdminResponseModel) => {\n if(data_.ok) {\n this.commandReplies.unshift(\"***** Logout successful *****\");\n this.commandReplies.unshift(data_.result);\n } else {\n this.commandReplies.unshift(\"!error!\");\n }\n })\n }\n\n}\n","module.exports = \"#renderCanvas{\\n width: 100%;\\n height: 100%;\\n}\\n\\n/*\\nGAME UI\\n*/\\n\\n.ui-game-container{\\n z-index : 10;\\n height: 100%;\\n }\\n\\n.ui-game{\\n z-index : 10;\\n}\\n\\n.ui-game-frame{\\n z-index : 11;\\n height: 95%;\\n width: 95%;\\n }\\n\\n#mainUI{\\n position:absolute;\\n top:8px;\\n left:8px;\\n color: white;\\n}\\n\\n#titleLabel{\\n text-align: center;\\n font-size: 1em;\\n}\\n\\n#pointerDesc{\\n\\n position:absolute;\\n top:20px;\\n max-width : 200px;\\n color: white;\\n text-align: center;\\n left: 0;\\n right: 0;\\n margin: auto;\\n}\\n\\n#chanDisplay{\\n position:absolute;\\n top:10px;\\n max-width :480px;\\n text-align: center;\\n left: 0;\\n right: 0;\\n margin: auto;\\n color: white;\\n}\\n\\n#pointerInteract{\\n position:absolute;\\n bottom:10px;\\n max-width : 380px;\\n color: white;\\n text-align: center;\\n left: 0;\\n right: 0;\\n margin: auto;\\n}\\n\\n#postingUI{\\n position:absolute;\\n top:20px;\\n /*max-width: 650px;*/\\n left: 0;\\n right: 0;\\n margin: auto;\\n text-align: left;\\n}\\n\\n#player-bar{\\n /*\\n background-image: url(\\\"/assets/img/tool_bar_bg.png\\\");\\n background-repeat: repeat-x;\\n background-position: bottom;*/\\n\\n background-size: 100% 100%;\\n color: rgb(206, 206, 206);\\n height: 175px;\\n width: 100%;\\n position:absolute;\\n bottom: 0px;\\n right: 0px;\\n left: 0px;\\n margin:8px;\\n}\\n\\n#player-bar-right{\\n position:absolute;\\n bottom: 0px;\\n right: 0;\\n padding: 11px;\\n text-align: right;\\n margin-right:16px;\\n}\\n\\n#player-bar-left{\\n position:absolute;\\n bottom: 0px;\\n left: 0;\\n padding: 11px;\\n text-align: left;\\n}\\n\\n#pin-ui{\\n position:absolute;\\n top:0px;\\n right: 0;\\n max-width: 300px;\\n max-height: 300px;\\n text-align: right;\\n}\\n\\n#ad-ui{\\n position:absolute;\\n top:0px;\\n right: 0;\\n max-width: 250px;\\n max-height: 300px;\\n text-align: right;\\n}\\n\\n.spoil{\\n width: 100%;\\n background-color: rgb(71, 71, 71);\\n color: rgb(71, 71, 71);\\n}\\n\\n.pointer{\\n cursor: pointer;\\n}\\n\\n.circle:before {\\n /*Put the element at the middle of the screen*/\\n text-align: center;\\n width: 4px;\\n height: 4px;\\n top:0;\\n bottom: 0;\\n left: 0;\\n right: 0;\\n margin: auto;\\n content: '\\\\25CF';\\n font-size: 10px;\\n color: white;\\n position:absolute;\\n top:50px;\\n left : 50;\\n\\n }\\n\\n.circle-hover:before {\\n /*Put the element at the middle of the screen*/\\n text-align: center;\\n width: 4px;\\n height: 4px;\\n top:0;\\n bottom: 0;\\n left: 0;\\n right: 0;\\n margin: auto;\\n content: '\\\\25CF';\\n font-size: 20px;\\n color: white;\\n position:absolute;\\n top:50px;\\n left : 50;\\n\\n }\\n\\n.bgGameUI{\\n border-radius: 5px;\\n background: rgba(46, 46, 46, 0.9);\\n font-size: 12px;\\n padding: 5px;\\n}\\n\\n.chat-ui{\\n position:absolute;\\n border-radius: 5px;\\n background: rgba(46, 46, 46, 0.9);\\n bottom:10px;\\n left: 20px;\\n width: 300px;\\n height: 255px;\\n padding: 10px; \\n}\\n\\n.info-button-ui{\\n position:absolute;\\n bottom:10px;\\n left: 10px;\\n color: white;\\n}\\n\\n.fullHeightInterface{\\n \\n height: 90%;\\n /* overflow-y: auto;*/\\n }\\n\\nbutton{\\n margin: 1px 1px 4px 1px;\\n }\\n\\n/* Trash */\\n\\n#gamepadCanvas{\\n position:absolute;\\n bottom:20px;\\n right :20px;\\n width: 200px;\\n height: 200px;\\n color: white;\\n background-color: rgb(41, 41, 41);\\n}\\n\\n.reply-underline{\\n color: rgb(0, 110, 255);\\n text-decoration: underline;\\n}\"","module.exports = \"
\\n\\n\\n
\\n
\\n
\\n
use ⌨️ {{config.key_mapping}} to move
\\n
\\n\\n
\\n\\n \\n \\n \\n \\n
\\n
\\n \\n [ /{{chan}} ~ ]\\n \\n
\\n

~/{{gameDataModel.map[0].name}}/

\\n
\\n
\\n\\n
\\n \\n \\n \\n\\n \\n \\n \\n\\n \\n \\n \\n \\n
\\n\\n
-1\\\">\\n Plan to reply to >>{{reply}} 🗑️\\n
\\n\\n
\\n +{{item.name}}
\\n
\\n
\\n\\n
\\n \\n \\n\\n \\n \\n\\n \\n \\n
\\n\\n
\\n \\n >\\n \\n \\n \\n
\\n\\n
\\n \\n
\\n
#{{gameDataModel.player.id}} 🧠\\n
\\n \\n
\\n \\n
\\n \\n
\\n \\n
Due moderation issues post is currently limited. {{gameDataModel.postsLeft}} post(s) left.
\\n 🐦 Twitter - 💰 Donations \\n
\\n
\\n
\\n \\n
\\n \\n\\n
\"","import { Component, OnInit, ElementRef, ViewChild, HostListener } from '@angular/core';\nimport { Router, ActivatedRoute } from '@angular/router';\nimport { Game } from '../../motor/game';\nimport { GameUIServiceService } from '../../services/game-uiservice.service'\nimport { InteractionModel } from '../../models/interaction-model';\nimport { ChanWebService } from 'src/app/services/chan-web.service';\nimport { OfflineService } from 'src/app/services/offline.service';\nimport { PostModel } from '../../models/post.model';\nimport { PlayerModel } from 'src/app/models/player.model';\nimport { ConfigModel } from 'src/app/models/config.model';\nimport { GameDataModel } from 'src/app/models/game-data.model';\nimport { DeviceDetectorService } from 'ngx-device-detector';\nimport { environment } from 'src/environments/environment';\n\n@Component({\n selector: 'app-gl-view',\n templateUrl: './gl-view.component.html',\n styleUrls: ['./gl-view.component.css']\n})\nexport class GlViewComponent implements OnInit {\n\n public gameState : number;\n public currentinteraction: InteractionModel;\n public pinnedPostModel : PostModel;\n public playerData : PlayerModel = new PlayerModel();\n public gameDataModel : GameDataModel = new GameDataModel();\n public config : ConfigModel = new ConfigModel();\n public game : Game;\n public isMobile: boolean = false;\n public adDisplay: boolean = true;\n\n public currentMapKey: string = \"alpha\";\n public clientURL: string = \"\";\n public chanList: string[];\n\n public reply: number = -1;\n\n constructor(private gameUIServiceService : GameUIServiceService,\n private chanWebService: ChanWebService,\n private offlineService: OfflineService,\n private router: Router,\n private route: ActivatedRoute,\n private deviceService: DeviceDetectorService) {\n\n this.router.routeReuseStrategy.shouldReuseRoute = () => false;\n this.route.params.subscribe( params => {\n this.currentMapKey = params['map'];\n console.log(this.currentMapKey);\n });\n\n this.clientURL = environment.clientUrl;\n }\n\n ngOnInit() {\n\n this.clientURL = environment.clientUrl;\n this.chanList = this.offlineService.getChanData();\n console.log( this.chanList);\n\n this.gameUIServiceService.changeStateEmitter.subscribe( (state_)=> {\n this.changeGameState(state_);\n if(state_ === GameUIServiceService.STATE_NO_PLAYER) this.router.navigate(['/']);\n });\n\n this.gameUIServiceService.sendInteractionsEmitter.subscribe( (inter_)=> {\n this.receiveInteraction(inter_ );\n });\n\n \n this.gameUIServiceService.changeGameDataEmitter.subscribe( (gameData_: GameDataModel)=> {\n this.gameDataModel = gameData_;\n\n if(this.currentMapKey !== this.gameDataModel.player.map_key){\n this.currentMapKey = this.gameDataModel.player.map_key;\n this.adDisplay = true;\n }\n \n });\n\n this.gameUIServiceService.changeConfigEmitter.subscribe( (config_: ConfigModel)=> {\n this.config =config_;\n });\n\n this.isMobile = this.deviceService.isMobile();\n\n\n // Create our game class using the render canvas element\n this.game = new Game('renderCanvas');\n //alert(\"desktop: \"+this.deviceService.isDesktop()+\" mobile:\"+this.deviceService.isMobile()+\" tablet: \"+this.deviceService.isTablet());\n if(!this.deviceService.isDesktop()){\n this.game.activeJoystick();\n /*alert(\"desktop: \"+this.deviceService.isDesktop+\" mobile:\"+this.deviceService.isDesktop+\" tablet: \"+\n this.deviceService.isTablet);*/\n } \n \n this.game.setUIService(this.gameUIServiceService);\n this.game.setWebService(this.chanWebService); \n this.game.setOfflineService(this.offlineService); \n this.game.setClientUrl( this.clientURL );\n this.game.setMapKey(this.currentMapKey);\n this.game.setRouter(this.router);\n this.game.initGame();\n }\n\n @ViewChild('renderCanvas') renderCanvas: ElementRef;\n\n ngAfterViewInit(): void {\n \n //console.log(window.screen);\n this.renderCanvas.nativeElement.width = (window.screen.width);\n this.renderCanvas.nativeElement.height = (window.screen.availHeight);\n //console.log(JSON.stringify(window.screen));\n\n window.onresize = ()=>{\n this.renderCanvas.nativeElement.height = (window.screen.availHeight);\n this.renderCanvas.nativeElement.width = (window.screen.width);\n }\n}\n\n \n\n changeGameState(state_: number){\n this.gameState = state_;\n //console.log(\"this.gameState =\"+this.gameState );\n }\n\n receiveInteraction(inter_ : InteractionModel){\n this.currentinteraction = inter_;\n }\n\n /***** INTERACTION! ******/\n openUrl(){\n //window.open(this.currentinteraction.value, \"_blank\");\n this.gameState = 2;\n }\n\n openCMD(){\n this.gameUIServiceService.changeState(GameUIServiceService.STATE_CMD_UI);\n }\n\n climbLadder(){\n this.game.climbObject();\n }\n\n openDoor(){\n this.game.openDoor();\n }\n\n openPostingUI(){\n this.gameUIServiceService.changeState(GameUIServiceService.STATE_POSTING_UI);\n }\n\n openPaintingUI(){\n this.gameUIServiceService.changeState(GameUIServiceService.STATE_PAINTING_UI);\n }\n\n openInfoUI(){\n this.gameUIServiceService.changeState(GameUIServiceService.STATE_INFO_UI);\n }\n\n openPlayerUI(){\n this.gameUIServiceService.changeState(GameUIServiceService.STATE_PLAYER_UI);\n }\n\n onPin(event_){\n if(this.pinnedPostModel != null) this.pinnedPostModel = null;\n this.pinnedPostModel = event_;\n console.log( this.pinnedPostModel );\n }\n\n unPin(event_){\n //console.log( \"unpin\");\n this.pinnedPostModel = null\n }\n\n closeAd(event_){\n this.adDisplay = false;\n }\n\n changeMapping(){\n this.game.switchKeyMapping();\n }\n\n passGate(val_){\n this.game.passGet(val_);\n }\n\n getItem(key_){\n //console.log(\"get item\");\n this.game.getItem(key_);\n }\n\n addReply(id_){\n this.reply = id_;\n }\n\n destroyReply(){\n this.reply = -1;\n }\n\n @ViewChild('renderCanvas') elementCanvas:ElementRef;\n savePhoto(){\n\n alert(\"try to write picture\");\n let canvas = document.getElementById(\"renderCanvas\") as HTMLCanvasElement;\n console.log(canvas);\n \n //let photoUrl = canvas.getContext('2d').getImageData(0,0,600,600)\n let data = canvas.toDataURL('image/png');\n \n //document.location.href = photoUrl;\n console.log(data);\n let w=window.open('about:blank','Screen Capture');\n w.document.write(\"from canvas\");\n\n }\n\n gotTo(url_){\n window.open(url_, '_blank');\n }\n\n changeTalk(e_){\n console.log(e_);\n this.game.changeTalk(e_);\n }\n\n\n ngOnDestroy(){\n /*\n this.gameUIServiceService.changeStateEmitter.unsubscribe();\n this.gameUIServiceService.sendInteractionsEmitter.unsubscribe();\n this.gameUIServiceService.changeGameDataEmitter.unsubscribe();\n this.gameUIServiceService.changeConfigEmitter.unsubscribe();*/\n delete this.game;\n\n }\n}\n","module.exports = \".container{\\n /*background-image: \\n linear-gradient( rgba(0,0,0,.5), rgba(0, 0, 0, 0.6) ),\\n url(\\\"/assets/img/home_bg.jpeg\\\");*/\\n padding: 25px;\\n /*overflow: scroll;*/\\n -webkit-overflow-scrolling: touch;\\n color: white;\\n text-align: center;\\n}\\n\\ndiv {\\n margin-bottom: 8px;\\n}\\n\\n.overlay {\\n z-index: 1;\\n height: 100%;\\n width: 100%;\\n position: fixed;\\n overflow: auto;\\n top: 0px;\\n left: 0px;\\n background: rgba(0, 0, 0, 0.7); /*can be anything, of course*/\\n}\\n\\n#pres-screen {\\n\\n width : 100%;\\n text-align: center;\\n}\\n\\n#header {\\n color: white;\\n}\\n\\n#twitter {\\n width:550px;\\n margin: 20px auto;\\n}\"","module.exports = \"
\\n
\\n

AnonIB💀3D

\\n 超暴力的なファイル共有3 Dゲーム
\\n by Ælx Krunch
\\n [ 🐦 Twitter ] [ 💴 Donations ]\\n
\\n\\n
\\n \\n
\\n\\n \\n
\\n\"","import { Component, OnInit } from '@angular/core';\nimport { DeviceDetectorService } from 'ngx-device-detector';\nimport { environment } from '../../../environments/environment';\nimport {Router} from '@angular/router';\nimport { OfflineService } from 'src/app/services/offline.service';\n\n@Component({\n selector: 'app-home',\n templateUrl: './home.component.html',\n styleUrls: ['./home.component.css']\n})\nexport class HomeComponent implements OnInit {\n\n public isMobile:boolean = false;\n public isTOSAccepted: boolean = false;\n \n constructor(public deviceService: DeviceDetectorService, private router: Router,\n private offlineService: OfflineService) { }\n\n ngOnInit() {\n this.isMobile = this.deviceService.isMobile();\n let url = location.href;\n if(url.indexOf(environment.clientUrl) < 0){\n window.location.href = environment.clientUrl;\n }\n\n let playerData_ = this.offlineService.getPlayerData();\n if(playerData_ != null){\n this.isTOSAccepted = true;\n }\n }\n\n launchGame(){\n this.router.navigateByUrl('/ch/alpha');\n }\n\n}\n","module.exports = \".post-ui-message{\\n position:relative;\\n max-width: 650px;\\n left: 0;\\n right: 0;\\n margin: auto;\\n\\n padding : 10px;\\n margin-bottom : 18px;\\n background-color: rgb(189, 198, 247);\\n border-style: solid;\\n border-width: 1px;\\n border-color: #a99ec7;\\n border-radius: 5px;\\n\\n height: 100%;\\n overflow-y: auto;\\n}\\n\\n#container{\\n position:relative;\\n max-width: 650px;\\n left: 0;\\n right: 0;\\n margin: auto;\\n\\n padding : 10px;\\n margin-bottom : 18px;\\n background-color: rgb(189, 198, 247);\\n border-style: solid;\\n border-width: 1px;\\n border-color: #a99ec7;\\n border-radius: 5px;\\n\\n height: 100%;\\n overflow-y: auto;\\n}\\n\\ndiv {\\n margin-bottom: 8px;\\n}\\n\"","module.exports = \"
\\n\\n
\\n

About Protaguro$

\\n
\\n I am Alex Krunch, Imageboard lover since now ten years and I've created Protaguro$ (the project name will change soon)\\n In response to the growing and industrialized censorship on social medias. This whole 3D world is set to work as\\n an abstraction, protecting our LULZ from the outside. Soon I will make a blog explaining the whole ideology of the Project,\\n and also cool technical feature I will implement, like secrets board, items management and torrenting files in game.\\n\\n Keep in mind it's a prototype and than bug and database reset will be a frequent thing.\\n\\n You can keep news of THE PROJECT here:\\n https://twitter.com/alexkrunch\\n\\n You can also contact by mail at monsieur.krunch@gmail.com\\n
\\n\\n
\\n If you want to make a 💴 DONATION 💴 to the cause, here are the crypto address:
\\n\\n
\\n
\\n Bitcoin address:
\\n bc1qwc7zaa4tfeertxwk46jv9meyup9ep9cre8l8p7
\\n \\n Etherum:
\\n 0xEE914adbb0A83e0FD8B90E292CAc6280D26b6b66
\\n
\\n
\\n \\n
\\n \\n\\n
\\n\\n
\\n\"","import { Component, OnInit } from '@angular/core';\nimport { GameUIServiceService } from 'src/app/services/game-uiservice.service';\n\n@Component({\n selector: 'app-info-view',\n templateUrl: './info-view.component.html',\n styleUrls: ['./info-view.component.css']\n})\nexport class InfoViewComponent implements OnInit {\n\n constructor(private gameUIServiceService: GameUIServiceService) { }\n\n ngOnInit() {\n }\n\n closeCanvas(){\n this.gameUIServiceService.changeState(GameUIServiceService.STATE_GAME_RUNNING);\n }\n\n}\n","module.exports = \"#contentLogin{\\n text-align: center;\\n}\\n\\ndiv {\\n margin-bottom: 8px;\\n}\\n\\nbutton{\\n margin: 1px 1px 4px 1px;\\n }\\n\"","module.exports = \"
\\n\\n
\\n Try to get a player token...\\n
\\n\\n
\\n -We do not allow CP / Non-ironical hatespeech / porn / doxxing / pirated content.
\\n -You need to be +18 to access this game.
\\n -Don't trust anythings written on the game, it's all fake news.
\\n -Don't talk about the game.
\\n -Keep in mind t's an experimental project, it will be often broke. For more information contact monsieur.krunch@gmail.com,\\n or check my twitter account, @AlexKrunch🚬
\\n \\n
\\n\\n
\\n
\\n
\\n ID\\n
\\n \\n
\\n
\\n
\\n Token\\n
\\n \\n
\\n
\\n or
\\n
\\n
\\n \\n
\\n
\\n\\n
\\n What you get..
\\n Player ID #{{playerData.id}} 🧠
\\n Player token {{playerData.player_key}}\\n
\\n \\n \\n \\n
\\n\\n
\"","import { Component, OnInit } from '@angular/core';\nimport {Router} from '@angular/router';\nimport { ChanWebService } from 'src/app/services/chan-web.service';\nimport { OfflineService } from 'src/app/services/offline.service';\nimport { PlayerResponseModel } from '../../models/player.response.model';\nimport { PlayerModel } from '../../models/player.model';\nimport { GameDataResponseModel } from 'src/app/models/game-data.response.model';\n\n@Component({\n selector: 'app-login',\n templateUrl: './login.component.html',\n styleUrls: ['./login.component.css']\n})\nexport class LoginComponent implements OnInit {\n\n anonId: number;\n anonToken: string;\n password: string;\n\n errorWs: string;\n isLoading: boolean = false;\n isTOSAccepted: boolean = false;\n playerData: PlayerModel; \n\n constructor(private chanWebService: ChanWebService, private offlineService: OfflineService,\n private router: Router) { }\n\n ngOnInit() {\n\n let playerData_ = this.offlineService.getPlayerData();\n if(playerData_ != null){\n this.anonId = playerData_.id;\n this.anonToken = playerData_.player_key;\n this.isTOSAccepted = true;\n }\n\n }\n\n //Call the WS\n createUser(){\n console.log(\"createUser\");\n this.isLoading = true;\n this.chanWebService.createUser( this.anonId, this.anonToken, this.password, \"\" ).subscribe(\n //Data success\n (data : GameDataResponseModel) => {\n this.isLoading = false;\n if(data.ok){\n this.playerData = data.result.player;\n this.offlineService.savePlayer(this.playerData);\n } else {\n this.errorWs = data.error;\n }\n }\n );\n }\n\n //Call the WS\n createNewUser(){\n \n this.anonId = 0;\n this.anonToken =\"\";\n\n this.createUser();\n }\n\n validAndLaunchGame(){\n this.router.navigateByUrl('/ch/alpha');\n }\n\n validAndLaunchAdmin(){\n this.router.navigateByUrl('/admin-post');\n }\n\n acceptTOS(){\n this.isTOSAccepted = true;\n }\n\n}\n","module.exports = \"\"","module.exports = \"
\\n\\n\\n\\n\\n\\n\\n\\n
\\n\"","import { Component, OnInit, Input } from '@angular/core';\nimport { UrlParser } from 'src/app/utils/urlParser';\nimport { DomSanitizer } from '@angular/platform-browser';\n\n@Component({\n selector: 'app-media-display',\n templateUrl: './media-display.component.html',\n styleUrls: ['./media-display.component.css']\n})\nexport class MediaDisplayComponent implements OnInit {\n\n @Input() url : string;\n urlParse : UrlParser;\n safeTubeURL;\n\n constructor(private sanitizer : DomSanitizer) { }\n\n ngOnInit() {\n if(this.url != null){\n this.urlParse = new UrlParser(this.url);\n this.safeTubeURL = this.urlParse.getSafeTubeURL(this.sanitizer);\n }\n }\n\n}\n","module.exports = \".post-ui-message{\\n position:relative;\\n /*max-width: 480px;*/\\n left: 0;\\n right: 0;\\n margin: auto;\\n padding : 10px;\\n margin-bottom : 18px;\\n background: rgb(189, 198, 247);\\n border-style: solid;\\n border-width: 1px;\\n border-color: #a99ec7;\\n border-radius: 5px;\\n height: 95%;\\n overflow-y: auto;\\n}\\n\\n#canvas-right{\\n width: 460px;\\n position:absolute;\\n}\\n\\n#tool-right{\\n position:absolute;\\n width: 480px;\\n height: 100%;\\n left: 480px;\\n top: 0px;\\n}\\n\\ntextarea\\n{\\n width: 220px;\\n margin: 0;\\n}\\n\\n#painting-board {\\n width: 460px;\\n height: 460px;\\n /*background-color: whitesmoke;*/\\n background-image:\\n url(\\\"/assets/img/grid.png\\\");\\n\\n}\\n\\n#brush-size{\\n position: relative;\\n background-color: black;\\n width: 10px;\\n height: 10px;\\n}\\n\\nbutton{\\n margin: 1px 1px 4px 1px;\\n}\"","module.exports = \"
\\n\\n
\\n\\n \\n\\n
\\n\\n
\\n\\n\\n\\n
\\n\\n\\n
\\n\\n
\\nPick a color:
\\n\\n
\\n
\\n
\\n\\n
= 0\\\" >reply to >>{{ reply }} 🗑️
\\nMessage:
\\n
\\n\\n\\n\\n
\\n\\n
\"","import { Component, OnInit, Input, ViewChild,ElementRef, Output, EventEmitter } from '@angular/core';\nimport {GameUIServiceService} from '../../services/game-uiservice.service'\nimport { InteractionModel } from '../../models/interaction-model';\nimport { PostModel } from 'src/app/models/post.model';\nimport { ChanWebService } from 'src/app/services/chan-web.service';\nimport { PostStuffResponseModel } from '../../models/postStuff.response.model';\nimport { DeviceDetectorService } from 'ngx-device-detector';\nimport 'pepjs'\nimport { Size } from 'babylonjs';\n\n@Component({\n selector: 'app-painting-ui',\n templateUrl: './painting-ui.component.html',\n styleUrls: ['./painting-ui.component.css']\n})\nexport class PaintingUiComponent implements OnInit {\n\n @Input() canvasKey: string;\n @Input() urlBgPicture: string;\n @Input() reply: number;\n @Output() onDestroyReply = new EventEmitter();\n @ViewChild('paintingCanvas') elementCanvas:ElementRef;\n\n public imageBg;\n public context: CanvasRenderingContext2D;\n public isLoading : boolean = false;\n postModel: PostModel;\n private canvasPercent = 0;\n private isFinalExport: boolean = false;\n\n\n constructor(private gameUIServiceService : GameUIServiceService, private chanWebService: ChanWebService,\n private deviceService: DeviceDetectorService) { }\n\n ngOnInit() {\n\n this.postModel = new PostModel();\n this.postModel.map_key = \"\";\n this.postModel.canvas_key = this.canvasKey;\n this.postModel.message = \"\";\n this.postModel.graffiti = true;\n this.postModel.reply = this.reply;\n\n if(this.urlBgPicture != null){\n this.imageBg = new Image();\n this.imageBg.crossOrigin = \"Anonymous\";\n this.imageBg.src = this.urlBgPicture;\n console.log('this.urlBgPicture: '+this.urlBgPicture);\n this.imageBg.onload = () => {\n this.redraw();\n };\n }\n \n //is Mobile? We need to make teh mouse move with pepjs\n // if(!this.deviceService.isDesktop()){\n\n this.elementCanvas.nativeElement.addEventListener( \"pointerdown\", ( event_ ) => {\n this.paint = true;\n this.canvasMouseDown( event_ );\n });\n\n this.elementCanvas.nativeElement.addEventListener( \"pointermove\", ( event_ ) => {\n this.canvasMouseMove( event_ );\n });\n\n this.elementCanvas.nativeElement.addEventListener( \"pointerup\", ( event_ ) => {\n this.canvasMouseUp( event_ );\n });\n\n //}\n }\n\n ngAfterViewInit(): void {\n this.context = (this.elementCanvas.nativeElement).getContext('2d');\n }\n\n closeCanvas(){\n this.gameUIServiceService.changeState(GameUIServiceService.STATE_GAME_RUNNING);\n }\n \n getImg(){\n let data: string = this.elementCanvas.nativeElement.toDataURL(\"image/png\");\n data += \"snffch\";\n return data;\n }\n\n dataURItoBlob(dataURI) {\n const byteString = window.atob(dataURI);\n const arrayBuffer = new ArrayBuffer(byteString.length);\n const int8Array = new Uint8Array(arrayBuffer);\n for (let i = 0; i < byteString.length; i++) {\n int8Array[i] = byteString.charCodeAt(i);\n }\n const blob = new Blob([int8Array], { type: 'image/jpeg' }); \n return blob;\n }\n\n\n\n sendImg(){\n\n if( (this.clickX.length +this.clickY.length) < 200){\n alert(\"It's doesn't looks like a big drawing :( \");\n return;\n } \n\n this.isFinalExport = true;\n this.redraw();\n\n this.chanWebService.createAndUploadPaint( this.postModel, this.getImg() ).subscribe(\n //Data success\n (data : PostStuffResponseModel) => {\n //console.log(\"data:\"+data);\n let postStuffResponse : PostStuffResponseModel = data;\n if( postStuffResponse.ok ) {\n\n //console.log(\"result \"+JSON.stringify( postStuffResponse));\n this.destroyReply();\n this.closeCanvas();\n this.gameUIServiceService.forceWS();\n this.gameUIServiceService.changeState(GameUIServiceService.STATE_GAME_RUNNING);\n\n }\n this.isLoading = false;\n this.isFinalExport = false;\n \n },\n error => {\n //console.log(JSON.stringify(error));\n this.isLoading = false;\n this.isFinalExport = false;\n this.redraw();\n }\n );\n\n \n }\n\n /*****************\n * EVENT DEALING WITH PAINTING\n *****************/\n\n clickX = new Array();\n clickY = new Array();\n clickDrag = new Array();\n paint;\n\n clickDurationCurrent = 0;\n clickDurationList = new Array();\n\n //Colors\n colorRed = \"#df4b26\";\n colorPink = \"#ff8cd4\";\n colorBlack = \"#000000\";\n colorPurple = \"#cb3594\";\n colorGreen = \"#659b41\";\n colorYellow = \"#ffcf33\";\n colorBrown = \"#986928\";\n colorBlue = \"#0066ff\";\n colorWhite = \"#ffffff\";\n curColor = this.colorRed;\n clickColor = new Array();\n\n selectedColor = \"#000000\";\n\n clickSize = new Array();\n strokeSize: number = 10;\n\n canvasMouseDown( event_ ){\n\n let mouseX = event_.offsetX + (event_.offsetX * this.canvasPercent);\n let mouseY = event_.offsetY + (event_.offsetY* this.canvasPercent); \n this.paint = true;\n this.addClick(mouseX , mouseY , false);\n this.redraw();\n\n }\n\n canvasMouseUp( event_ ){\n this.paint = false;\n this.clickDurationList.push(this.clickDurationCurrent);\n this.clickDurationCurrent = 0;\n }\n\n canvasMouseMove( event_ ){\n\n if(this.paint){\n let mouseX = event_.offsetX + (event_.offsetX* this.canvasPercent);\n let mouseY = event_.offsetY + (event_.offsetY* this.canvasPercent);\n this.addClick(mouseX , mouseY, true);\n this.redraw();\n this.clickDurationCurrent += 1;\n }\n }\n\n addClick(x, y, dragging){\n\n this.clickX.push(x);\n this.clickY.push(y);\n this.clickDrag.push(dragging);\n //console.log(this.selectedColor);\n this.clickColor.push(this.curColor);\n this.clickSize.push(this.strokeSize);\n }\n\n redraw(){\n\n this.context.clearRect(0, 0, this.context.canvas.width, this.context.canvas.height); // Clears the canvas\n this.context.lineJoin = \"round\";\n this.context.lineWidth = 10;\n\n //set bg image if it exist\n \n if(this.imageBg && !this.isFinalExport){\n\n let ratio;\n let newWidth;\n let newHeight;\n let newX = 0;\n let newY = 0;\n\n if(this.imageBg.height > this.imageBg.width) {\n\n ratio = this.elementCanvas.nativeElement.height / this.imageBg.height;\n newWidth = this.imageBg.width * ratio;\n newHeight = this.imageBg.height * ratio;\n newX = (newWidth - this.elementCanvas.nativeElement.width) * (-0.5);\n\n } else {\n\n ratio = this.elementCanvas.nativeElement.width / this.imageBg.width;\n newWidth = this.imageBg.width * ratio;\n newHeight = this.imageBg.height * ratio;\n newY = (newHeight - this.elementCanvas.nativeElement.height ) * (-0.5);\n\n }\n\n this.context.drawImage(this.imageBg, newX, newY,newWidth, newHeight );\n }\n \n for(var i=0; i < this.clickX.length; i++) {\n this.context.beginPath();\n if(this.clickDrag[i] && i > 0){\n this.context.moveTo(this.clickX[i-1], this.clickY[i-1]);\n }else{\n this.context.moveTo(this.clickX[i], this.clickY[i]);\n }\n this.context.lineTo(this.clickX[i], this.clickY[i]);\n this.context.closePath();\n this.context.strokeStyle = this.clickColor[i];\n this.context.lineWidth = this.clickSize[i];\n this.context.stroke();\n }\n }\n\n /*****************\n * DEALING with painting style\n *****************/\n\n changeColor(color_){\n this.curColor = color_;\n }\n\n clear(){\n \n if(this.clickDurationList.length > 0){\n let lastDuration = this.clickDurationList.pop();\n this.clickColor = this.clickColor.slice(0, this.clickColor.length-lastDuration-1);\n this.clickX = this.clickX.slice(0, this.clickX.length-lastDuration-1);\n this.clickY = this.clickY.slice(0, this.clickY.length-lastDuration-1);\n this.clickDrag = this.clickDrag.slice(0, this.clickDrag.length-lastDuration-1);\n this.clickSize = this.clickSize.slice(0, this.clickSize.length-lastDuration-1);\n this.redraw();\n }\n \n }\n\n destroyReply(){\n this.reply = -1;\n this.onDestroyReply.emit(-1);\n }\n\n}\n","module.exports = \"#container{\\n position: absolute;\\n margin: auto;\\n max-width: 650px;\\n left: 0;\\n right: 0;\\n height: 100%;\\n}\"","module.exports = \"\"","import { Component, OnInit } from '@angular/core';\nimport { ChanWebService } from 'src/app/services/chan-web.service';\nimport {ActivatedRoute} from \"@angular/router\";\nimport { PlayerInterfaceComponent } from 'src/app/interfaces/player-interface/player-interface.component';\nimport { PlayerModel } from 'src/app/models/player.model';\nimport { OfflineService } from 'src/app/services/offline.service';\n\n@Component({\n selector: 'app-phone-poster',\n templateUrl: './phone-poster.component.html',\n styleUrls: ['./phone-poster.component.css']\n})\nexport class PhonePosterComponent implements OnInit {\n\n public playerId: string;\n public playerKey: string;\n public playerModel: PlayerModel;\n public canvasKey: string;\n\n constructor(private offlineService : OfflineService, private route: ActivatedRoute) {\n this.route.params.subscribe( params => {\n this.playerId = params['id'];\n this.playerKey = params['key'];\n this.canvasKey = params['canvas'];\n\n //set the player model, at it to offline\n this.playerModel = new PlayerModel();\n this.playerModel.id = Number(this.playerId);\n this.playerModel.player_key = this.playerKey;\n this.offlineService.savePlayer( this.playerModel);\n });\n }\n\n ngOnInit() {\n\n }\n\n}\n","module.exports = \"::ng-deep .img-pin img, .img-pin video, .img-pin iframe, .img-pin audio {\\n max-width: 300px;\\n max-height: 300px;\\n}\"","module.exports = \"
\\n\\n\\n
\"","import { Component, EventEmitter, OnInit, Input, Output } from '@angular/core';\nimport {PostModel} from '../../models/post.model';\n\n@Component({\n selector: 'app-pin-post-ui',\n templateUrl: './pin-post-ui.component.html',\n styleUrls: ['./pin-post-ui.component.css']\n})\nexport class PinPostUiComponent implements OnInit {\n\n @Input() postModel: PostModel;\n @Output() close = new EventEmitter();\n\n constructor() { }\n\n ngOnInit() {\n\n }\n\n ngOnChanges(changes: any) {\n\n if(changes != null && changes.postModel != null){\n this.postModel = changes.postModel.currentValue;\n }\n\n }\n\n closePost(){\n this.close.emit();\n }\n\n}\n","module.exports = \".post-viewer-ui-message{\\n position:relative;\\n /*max-width: 650px;*/\\n left: 0;\\n right: 0;\\n margin: auto;\\n padding : 10px;\\n margin-bottom : 18px;\\n background: rgb(247, 189, 225);\\n border-style: solid;\\n border-width: 1px;\\n border-color: #c79eb7;\\n border-radius: 5px;\\n height: 95%;\\n width: 100%;\\n overflow-y: auto;\\n }\\n\\n.spoil{\\n width: 100%;\\n background-color: rgb(71, 71, 71);\\n color: rgb(71, 71, 71);\\n}\"","module.exports = \"
\\n \\n
You are 👺 #{{gameDataModel.player.id}} 🧠\\n 💉 HP: {{gameDataModel.player.hp}}%
\\n
token 🗝️ {{gameDataModel.player.player_key}}
\\n If you want to play on the new machine, just copy and past this ID and Token and enter them when you reconnect.\\n
\\n
🎒 inventory, the items you own
\\n ------------------------------------------
\\n
\\n 💍 {{item.name}}\\n quantity: {{item.value}}
\\n action: {{item.action}}
\\n description: {{item.description}}
\\n
\\n ------------------------------------------
\\n\\n \\n
\"","import { Component, OnInit, Input } from '@angular/core';\nimport { GameDataModel } from '../../models/game-data.model';\nimport { GameUIServiceService } from 'src/app/services/game-uiservice.service';\n\n@Component({\n selector: 'app-player-ui',\n templateUrl: './player-ui.component.html',\n styleUrls: ['./player-ui.component.css']\n})\nexport class PlayerUiComponent implements OnInit {\n\n @Input() gameDataModel: GameDataModel;\n\n constructor(private gameUIServiceService: GameUIServiceService) { }\n\n ngOnInit() {\n }\n\n close(){\n this.gameUIServiceService.changeState(GameUIServiceService.STATE_GAME_RUNNING);\n }\n\n}\n","module.exports = \".post-viewer-ui-message{\\n position:relative;\\n /*max-width: 650px;*/\\n left: 0;\\n right: 0;\\n margin: auto;\\n padding : 10px;\\n margin-bottom : 18px;\\n background: rgb(189, 198, 247);\\n border-style: solid;\\n border-width: 1px;\\n border-color: #a99ec7;\\n border-radius: 5px;\\n height: 95%;\\n width: 100%;\\n overflow-y: auto;\\n }\\n\\ndiv {\\n margin-bottom: 8px;\\n}\\n\\n#message-ascii {\\n max-width: 650px;\\n font-family: monospace;\\n white-space: pre;\\n}\\n\\n::ng-deep .img-preview img, .img-preview video, .img-preview iframe, .img-preview audio {\\n max-width: 600px;\\n max-height: 400px;\\n}\\n\\nbutton{\\n margin: 1px 1px 4px 1px;\\n }\"","module.exports = \"
\\n\\n
\\n >>{{postModel.id}} Δ, by #{{postModel.player_id}}
\\n
= 0\\\" >Reply to >>{{ postModel.reply }}
\\n
{{postModel.message}}
\\n
\\n \\n \\n
\\n URL: {{postModel.url}}
\\n To report content, write to monsieur.krunch@gmail.com, mentionning the ID of the post.
\\n
\\n -----------------------------------------------------
\\n
\\n \\n \\n \\n \\n
\\n
\\n\\n
\\n >>{{post.id}} Δ by #{{post.player_id}}
\\n
= 0\\\" >Reply to >>{{ post.reply }}
\\n
{{post.message}}
\\n
\\n \\n
\\n URL: {{post.url}}
\\n To report content, write to monsieur.krunch@gmail.com, mentionning the ID of the post.
\\n
\\n -----------------------------------------------------
\\n
\\n \\n \\n \\n \\n
\\n
\\n\\n
\"","import { Component, OnInit, Input, EventEmitter, Output} from '@angular/core';\nimport {PostModel} from '../../models/post.model';\nimport {GameUIServiceService} from '../../services/game-uiservice.service'\nimport { UrlParser } from 'src/app/utils/urlParser';\nimport { ChanWebService } from 'src/app/services/chan-web.service';\nimport { GenericResponseModel } from 'src/app/models/generic.response.model';\nimport { PostListResponseModel } from 'src/app/models/post-list.response.model';\nimport { GameDataModel } from '../../models/game-data.model';\nimport { PlayerInterfaceComponent } from '../../interfaces/player-interface/player-interface.component';\n\n@Component({\n selector: 'app-post-viewer-ui',\n templateUrl: './post-viewer-ui.component.html',\n styleUrls: ['./post-viewer-ui.component.css']\n})\nexport class PostViewerUiComponent extends PlayerInterfaceComponent implements OnInit {\n\n @Input() postModel: PostModel;\n @Input() gameData: GameDataModel;\n @Output() pin = new EventEmitter();\n @Output() onReply = new EventEmitter();\n imgValue : string;\n urlParse : UrlParser;\n postModelList: PostModel[] = [];\n\n constructor(private gameUIServiceService : GameUIServiceService, private chanWebService : ChanWebService ) {\n super();\n }\n\n ngOnInit() {\n\n if(this.postModel){\n this.imgValue = new UrlParser(this.postModel.url).getImage();\n this.chanWebService.getReplyPostList(this.postModel.id).subscribe( (data_: PostListResponseModel) =>{\n console.log(data_);\n if(data_.result){\n if(data_.result.length && data_.result.length >0){\n if(data_.result[0].id != null) this.postModelList = data_.result;\n }\n\n }\n })\n } \n }\n\n ngOnChanges(changes: any) {\n\n if(changes != null && changes.postModel != null){\n this.postModel = changes.postModel.currentValue;\n if(this.postModel != null || this.postModel != undefined) this.imgValue = new UrlParser(this.postModel.url).getImage();\n }\n\n }\n\n closePost(){\n this.gameUIServiceService.changeState(GameUIServiceService.STATE_GAME_RUNNING);\n }\n\n pinPost(postModel_){\n this.pin.emit(postModel_);\n }\n\n private postToDelete;\n deletePost(postModel_){\n\n this.postToDelete = postModel_;\n console.log(\"this.postToDelete:\"+this.postToDelete);\n this.chanWebService.deletePost(postModel_.id,postModel_.map_key).subscribe(\n //Data success\n (data : GenericResponseModel) => {\n this.gameUIServiceService.deletePost( this.postToDelete);\n this.gameUIServiceService.forceWS();\n this.gameUIServiceService.changeState(GameUIServiceService.STATE_GAME_RUNNING);\n });\n }\n\n canonPost(id_, thread_){\n this.chanWebService.canonPost(id_, thread_).subscribe(\n //Data success\n (data : GenericResponseModel) => {\n this.gameUIServiceService.forceWS();\n this.gameUIServiceService.changeState(GameUIServiceService.STATE_GAME_RUNNING);\n });\n }\n\n banPost(){\n \n }\n\n setPostUrlToFile(id_){\n this.chanWebService.setPostUrlToFile(id_).subscribe(\n //Data success\n (data : GenericResponseModel) => {\n alert(data);\n });\n }\n\n reply(postModel_: PostModel){\n console.log(postModel_.id);\n this.onReply.emit(postModel_.id);\n this.gameUIServiceService.changeState(GameUIServiceService.STATE_GAME_RUNNING);\n }\n\n}\n","module.exports = \".post-ui-message{\\n position:relative;\\n max-width: 650px;\\n left: 0;\\n right: 0;\\n margin: auto;\\n\\n padding : 10px;\\n margin-bottom : 18px;\\n background-color: rgb(189, 198, 247);\\n border-style: solid;\\n border-width: 1px;\\n border-color: #a99ec7;\\n border-radius: 5px;\\n\\n height: 100%;\\n overflow-y: auto;\\n }\\n\\ndiv {\\n margin-bottom: 8px;\\n}\\n\\ntextarea\\n{\\n width: 100%;\\n margin: 0;\\n}\\n\\n.post-message {\\n padding : 10px;\\n margin-bottom : 18px;\\n background: rgb(228, 221, 221);\\n border-style: solid;\\n border-width: 1px;\\n border-color: rgb(131, 123, 123);\\n border-radius: 5px;\\n}\\n\\n.img-preview{\\n max-width: 200px;\\n max-height: 200px;\\n}\\n\\n.post-torrent-info{\\n font-family: 'Courier New', Courier, monospace;\\n font-size: small;\\n padding : 8px;\\n color: white;\\n background:rgb(70, 61, 56);\\n border-radius: 5px;\\n}\\n\\n.post-message img {\\n max-width: 650px;\\n width: 100%;\\n height: auto;\\n}\\n\\n.post-message video {\\n max-width: 650px;\\n width: 100%;\\n height: auto;\\n}\\n\\n.post-message audio {\\n max-width: 650px;\\n width: 100%;\\n}\\n\\nbutton{\\n margin: 1px 1px 4px 1px;\\n }\"","module.exports = \"
\\n\\n
\\n \\n
= 0\\\" >reply to >>{{ reply }} 🗑️
\\n Message:
\\n \\n
\\n\\n
\\n Host on chan
\\n
\\n
\\n
\\n \\n\\n
\\n File URL:
\\n
\\n
\\n \\n
\\n File From the computer:
\\n
\\n\\n Open phone posting link!
\\n
\\n\\n
\\n\\n \\n \\n \\n\\n
\\n\\n
\\n Posting in progress..\\n
\\n
\\n
\\n
\\n\\n
\\n Your message has been posted! thanks for your contribution!\\n
\\n\\n \\n\\n
\\n\"","import { Component, OnInit, Input, Inject, EventEmitter, Output} from '@angular/core';\nimport {GameUIServiceService} from '../../services/game-uiservice.service'\nimport {PostModel} from '../../models/post.model';\nimport {PostStuffResponseModel} from '../../models/postStuff.response.model';\nimport { ChanWebService } from 'src/app/services/chan-web.service';\nimport { UrlParser } from 'src/app/utils/urlParser';\nimport { PlayerInterfaceComponent } from '../../interfaces/player-interface/player-interface.component';\nimport { Router } from '@angular/router'; \nimport { OfflineService } from 'src/app/services/offline.service';\nimport { PlayerModel } from 'src/app/models/player.model';\nimport {DOCUMENT} from '@angular/platform-browser';\nimport { environment } from '../../../environments/environment';\n\n\n@Component({\n selector: 'app-posting-ui',\n templateUrl: './posting-ui.component.html',\n styleUrls: ['./posting-ui.component.css']\n})\nexport class PostingUIComponent extends PlayerInterfaceComponent implements OnInit {\n\n @Input() canvasKey: string;\n @Input() reply: number;\n @Output() onDestroyReply = new EventEmitter();\n\n public postModel: PostModel;\n isLoading: boolean = false;\n postingFinished: boolean = false;\n hostFile: boolean = false;\n urlParse: UrlParser;\n\n //For files\n file;\n imagePath;\n fileBase64Url;\n\n constructor(private gameUIServiceService : GameUIServiceService,\n private chanWebService: ChanWebService,\n private router : Router,\n private offlineService: OfflineService,\n @Inject(DOCUMENT) private document: Document) {\n super();\n }\n\n ngOnInit() {\n this.postModel = new PostModel();\n this.urlParse = new UrlParser(this.postModel.url);\n this.postModel.canvas_key = this.canvasKey;\n this.postModel.reply = this.reply;\n }\n\n ngOnChanges(changes: any) {\n\n if(this.postModel != null && changes.canvasKey != null) this.postModel.canvas_key = changes.canvasKey.currentValue;\n if(this.isPhonePosting) this.hostFile = true;\n\n }\n\n changeHost(val_:boolean){\n this.hostFile = val_;\n }\n\n preview(files) {\n if (files.length === 0)\n return;\n \n var mimeType = files[0].type;\n if (mimeType.match(/image\\/*/) == null) {\n alert( \"Only images are supported.\");\n return;\n }\n \n var reader = new FileReader();\n this.imagePath = files;\n reader.readAsDataURL(files[0]); \n reader.onload = (_event) => { \n //console.log(reader.result.toString());\n this.fileBase64Url = reader.result.toString(); \n }\n }\n\n sendPost(){\n //this.gameUIServiceService.sendPost(this.postModel);\n console.log(this.file);\n\n if(this.fileBase64Url == null && !this.postModel.url && !this.postModel.message){\n alert(\"It's doesn't looks like a big post :( \");\n return;\n }\n \n this.isLoading = true;\n\n //Use this.\n if(this.hostFile) {\n\n //To host\n this.chanWebService.createAndUploadPaint( this.postModel, this.fileBase64Url ).subscribe(\n //Data success\n (data : PostStuffResponseModel) => {\n \n let postStuffResponse : PostStuffResponseModel = data;\n if( postStuffResponse.ok ) {\n this.destroyReply();\n //console.log(\"result \"+JSON.stringify( postStuffResponse));\n this.gameUIServiceService.forceWS();\n this.gameUIServiceService.changeState(GameUIServiceService.STATE_GAME_RUNNING);\n\n }\n this.isLoading = false;\n this.postingFinished = true;\n \n },\n error => {\n console.log(JSON.stringify(error));\n this.isLoading = false;\n }\n );\n\n } else {\n //Not hosting\n this.chanWebService.createPost( this.postModel ).subscribe(\n //Data success\n (data : PostStuffResponseModel) => {\n \n let postStuffResponse : PostStuffResponseModel = data;\n if( postStuffResponse.ok ) {\n \n //console.log(\"result \"+JSON.stringify( postStuffResponse));\n this.destroyReply();\n //We clean the fields\n this.postModel.url = \"\";\n this.postModel.message = \"\";\n this.gameUIServiceService.forceWS();\n this.gameUIServiceService.changeState(GameUIServiceService.STATE_GAME_RUNNING);\n }\n this.isLoading = false;\n this.postingFinished = true;\n \n },\n error => {\n console.log(JSON.stringify(error));\n this.isLoading = false;\n }\n );\n }\n \n\n }\n\n cancelPost(){\n this.gameUIServiceService.changeState(GameUIServiceService.STATE_GAME_RUNNING);\n }\n\n getPhoneLink(){\n let playerModel: PlayerModel = this.offlineService.getPlayerData();\n let phonePostingUrl = environment.clientUrl+\"phone-poster/\"+playerModel.id+\"/\"+playerModel.player_key+\"/\"+this.postModel.canvas_key;\n return phonePostingUrl;\n }\n\n destroyReply(){\n console.log(\"destroyReply()\");\n this.reply = -1;\n this.onDestroyReply.emit(-1);\n }\n}\n","module.exports = \".disable-select {\\n user-select: none; /* supported by Chrome and Opera */\\n -webkit-user-select: none; /* Safari */\\n -khtml-user-select: none; /* Konqueror HTML */\\n -moz-user-select: none; /* Firefox */\\n -ms-user-select: none; /* Internet Explorer/Edge */\\n}\"","module.exports = \"{{tileDisplay}}\\n\"","import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';\nimport { TileModel } from 'src/app/models/tile.model';\n\n@Component({\n selector: 'app-tile-edit',\n templateUrl: './tile-edit.component.html',\n styleUrls: ['./tile-edit.component.css']\n})\nexport class TileEditComponent implements OnInit {\n\n @Input() tileValue;\n @Input() tileBrush;\n \n @Input() x;\n @Input() y;\n @Output() valueChange = new EventEmitter();\n\n @Input() allTiles: TileModel[] = [];\n public tileDisplay: string = \"\";\n\n constructor() { }\n\n ngOnInit() {\n }\n\n paint(){\n //this.tileValue = this.tileBrush;\n this.valueChange.emit( {x: this.x, y:this.y});\n //this.updateDisplay();\n }\n \n ngOnChanges(){\n this.updateDisplay();\n }\n\n updateDisplay(){\n if(this.allTiles != null) {\n this.allTiles.forEach(tile => {\n if(tile.value == this.tileValue){\n this.tileDisplay = tile.display;\n return;\n }\n });\n }\n }\n}\n","module.exports = \"\"","module.exports = \"\"","import { Component, OnInit, Input } from '@angular/core';\nimport { PlayerModel } from 'src/app/models/player.model';\nimport ItemModel from 'src/app/models/item.model';\nimport {Constants} from 'src/app/utils/constants';\nimport { GameDataModel } from '../../models/game-data.model';\n\n@Component({\n selector: 'app-player-interface',\n templateUrl: './player-interface.component.html',\n styleUrls: ['./player-interface.component.css']\n})\nexport class PlayerInterfaceComponent implements OnInit {\n\n @Input() gameDataModel: GameDataModel = new GameDataModel();\n @Input() isPhonePosting: boolean;\n\n constructor() { }\n\n ngOnInit() {\n if( this.gameDataModel == null) this.gameDataModel = new GameDataModel();\n }\n\n\n //test\n canDelete(){\n\n if(this.gameDataModel.player.is_admin) return true;\n\n for (let item of this.gameDataModel.itemsPlayer) {\n if(item.action.toLowerCase().indexOf(Constants.ITEM_KEY_DELETE_SPONGE) >= 0 ) return true;\n }\n\n return false;\n\n }\n\n canFav(){\n \n if(this.gameDataModel.player.is_admin) return true;\n\n for (let item of this.gameDataModel.itemsPlayer) {\n if(item.action.toLowerCase().indexOf(Constants.ITEM_KEY_VARNISH) >= 0 ) return true;\n }\n\n return false;\n\n }\n\n canUpload(){\n\n if(this.gameDataModel.player.is_admin || this.isPhonePosting) return true;\n\n for (let item of this.gameDataModel.itemsPlayer) {\n if(item.action.toLowerCase().indexOf(Constants.ITEM_KEY_UPLOAD_RING) >= 0 ) return true;\n }\n\n return false;\n }\n\n isAdmin(){\n if(this.gameDataModel.player.is_admin) return true;\n\n return false;\n }\n\n}\n","export class ActionModel {\n\n id: number;\n last_action: number;\n name: string;\n player_id: number;\n value: string;\n action: string;\n\n \n}","export class ConfigModel {\n\n //Adding all stuff than are not stored Offline\n public key_mapping: string;\n public server_url: string;\n\n}","import { PostModel } from './post.model';\nimport { PlayerModel } from './player.model';\nimport ItemModel from './item.model';\nimport {MapModel} from './map.model';\nimport {ActionModel} from './action.model';\n\nexport class GameDataModel {\n\n player: PlayerModel = new PlayerModel();\n players: PlayerModel[];\n posts: PostModel[];\n postsLeft: number;\n itemsPlayer: ItemModel[]= [];\n itemsMap: ItemModel[];\n map: MapModel[];\n actions: ActionModel[];\n \n}","export class InteractionModel {\n\n public description: string;\n public value: any;\n public type: number;\n\n public static get TYPE_NONE():number { return 0; }\n public static get TYPE_CANVAS_FULL():number { return 1; }\n public static get TYPE_CANVAS_VIRGIN():number { return 2; }\n public static get TYPE_CLIMB_LADDER():number { return 3; }\n public static get TYPE_OPEN_DOOR():number { return 4; }\n public static get TYPE_GET_ITEM():number { return 5; }\n public static get TYPE_PASS_GATE():number { return 6; }\n public static get TYPE_PANEL():number { return 7; }\n public static get TYPE_CANVAS_TO_GRAFF():number { return 8; }\n public static get TYPE_AD():number { return 9; }\n\n}","import ItemModel from './item.model';\n\nexport class PlayerModel {\n\n public id: number;\n public name: string;\n public talk: string;\n public is_admin: boolean;\n public player_key: string;\n public map_key: string;\n public last_action: number;\n public hp: number;\n public position_x: number;\n public position_y: number;\n public position_z: number;\n\n}","export class PostModel {\n\n id: number;\n reply: number;\n player_id: number;\n player_name: string;\n name: string;\n key: string;\n canvas_key: string;\n date: number;\n map_key: string = \"\";\n message: string = \"\";\n url: string = \"\";\n preview: string = \"\";\n nsfw: boolean = false;\n graffiti: boolean = false;\n is_canon: boolean = false;\n\n magnet: string;\n torrent: string;\n hash: string;\n player_ip: string;\n\n was_deleted: boolean = false;\n\n}","import {\n Engine, Scene,FreeCamera, Light,\n DirectionalLight, HemisphericLight, ShadowGenerator,\n Color4, Color3Gradient,\n Mesh, VideoTexture,\n Vector3, MeshBuilder,\n ArcRotateCamera, StandardMaterial, Texture,\n Color3, SpriteManager, Sprite\n } from 'babylonjs';\n\n import * as GUI from 'babylonjs-gui';\n\nimport { Game } from \"./game\";\nimport { MapMaker } from \"./mapMaker\";\nimport { PostModel } from '../models/post.model';\nimport { UrlParser } from '../utils/urlParser';\n\nexport class CanvasPlane {\n\n public objType : String = \"canvas\";\n private gameInstance : Game;\n private mapInstance : MapMaker;\n public dictKey : string;\n public sizeCanvas: number;\n\n public planeMesh: Mesh;\n public planeMeshGraffiti: Mesh;\n\n public isVirgin : boolean = true;\n\n constructor(objType_, dictKey, size, x, y, z, dir){\n\n //Manage diff percentage of size\n this.objType = objType_;\n this.sizeCanvas = size;\n let scaling: number = (objType_ === \"canvas\")? 0.9 : 1;\n this.sizeCanvas = this.sizeCanvas * scaling;\n this.dictKey = this.objType+\"_\"+dictKey+\"_\"+dir;\n this.gameInstance = Game.getInstance();\n this.mapInstance = MapMaker.getInstance();\n\n this.planeMesh = MeshBuilder.CreatePlane( this.dictKey, {size: this.sizeCanvas}, this.gameInstance.scene);\n this.planeMesh.position.y = (size * 0.5) +y;\n\n if(this.objType == \"canvas\"){\n this.mapInstance.registerNewCanvas(this.dictKey ,this);\n } else {\n this.mapInstance.registerNewAd(this.dictKey ,this);\n } \n\n //Determine the orientation of the canvas\n //let dir = this.mapInstance.getCanvasOrientation( this.tileCoordonates[0], this.tileCoordonates[1]);\n //console.log(\"TILE DIR= \"+dir);\n let canvasX: number;\n let canvasY: number;\n let canvasZ: number;\n let canvasAngle: number;\n let gapToTheWall = 0.1;\n /*\n canvasX = x;\n canvasY = (size * -0.5) - (size * 0.1) + y;*/\n \n switch(dir){\n\n case this.mapInstance.DIR_N:\n canvasX = x;\n canvasZ = (size * -0.5) - gapToTheWall + z;\n canvasAngle = 0;\n break;\n\n case this.mapInstance.DIR_E:\n canvasX = (size * -0.5) - gapToTheWall + x;\n canvasZ = z;\n canvasAngle = (Math.PI/180) * 90;\n break;\n\n case this.mapInstance.DIR_S:\n canvasX = x;\n canvasZ = (size * 0.5) + gapToTheWall + z;\n canvasAngle = (Math.PI/180) * 180;\n break;\n\n case this.mapInstance.DIR_W:\n canvasX = (size * 0.5) + gapToTheWall + x;\n canvasZ = z;\n canvasAngle = (Math.PI/180)*270;\n break;\n }\n\n this.planeMesh.position.x = canvasX;\n this.planeMesh.position.z = canvasZ;\n this.planeMesh.rotate(BABYLON.Axis.Y, canvasAngle, BABYLON.Space.WORLD);\n\n let mat = new StandardMaterial(\"matCanvas\", this.gameInstance.scene);\n mat.alpha = 0;\n this.planeMesh.material = mat;\n this.planeMesh.visibility = 0;\n this.planeMesh.material.freeze();\n this.planeMesh.freezeWorldMatrix();\n\n this.postModel = new PostModel();\n this.postModel.canvas_key = this.dictKey;\n \n }\n\n public postModel: PostModel;\n public postModelGraffiti: PostModel;\n private textureContext;\n private texture : BABYLON.DynamicTexture;\n private textureNonDynamic : BABYLON.Texture;\n\n private font_size = 70;\n private font = \"bold \" + this.font_size + \"px Arial\";\n private canvasScale = 900;\n\n //private postImageUrl: string;\n private postImage: HTMLImageElement;\n\n private postImageGraffitiUrl: string;\n private postImageGraffiti: HTMLImageElement;\n\n private mat: StandardMaterial;\n\n /*\n private displayUI: GUI.Rectangle;\n private uiAdvancedTexture: GUI.AdvancedDynamicTexture;\n private label : GUI.TextBlock;*/\n\n setPostData(postModel_: PostModel){\n\n this.initTextureObject();\n\n /* if(postModel_.graffiti) {\n this.postModelGraffiti = postModel_;\n } else {*/\n this.postModel = postModel_;\n //}\n\n let postImageUrl = this.postModel.url;\n\n if(this.postModel.preview == null || this.postModel.preview.length === 0){\n postImageUrl = new UrlParser(postModel_.url).getImage();\n } else {\n postImageUrl = this.postModel.preview;\n }\n\n //Launch picture loading\n if( postImageUrl.length > 0){\n\n if( postModel_.graffiti ){\n\n this.postImageGraffiti = new Image();\n this.postImageGraffiti.crossOrigin = \"anonymous\";\n this.postImageGraffiti.src = postImageUrl;\n this.postImageGraffiti.onload = (event_) => {\n this.imgLoaded();\n }\n\n this.postImageGraffiti.onerror = (event_) => {\n \n this.textureNonDynamic = new Texture(\"./assets/textures/404.png\", this.gameInstance.scene);\n this.mat.diffuseTexture = this.textureNonDynamic;\n this.mat.diffuseTexture.hasAlpha = true;\n this.planeMesh.material = this.mat;\n this.planeMesh.material.freeze();\n }\n\n\n } else {\n\n this.postImage = new Image();\n this.postImage.crossOrigin = \"anonymous\";\n this.postImage.src = postImageUrl;\n this.postImage.onload = (event_) => {\n this.imgLoaded();\n }\n\n this.postImage.onerror = (event_) => {\n\n this.textureNonDynamic = new Texture(\"./assets/textures/404.png\", this.gameInstance.scene);\n this.mat.diffuseTexture = this.textureNonDynamic;\n this.mat.diffuseTexture.hasAlpha = true;\n this.planeMesh.material = this.mat;\n this.planeMesh.material.freeze();\n }\n \n }\n \n \n \n } else {\n //this.texture.drawText(this.postModel.message, null, null, this.font, \"#ffffff\", \"#00000000\", true);\n /*\n this.texture.drawText(this.postModel.message, null, this.canvasScale *0.5, this.font, \"#ffffff\", \"#00000000\", true);\n this.texture.drawText(this.postModel.message, null, (this.canvasScale *0.5) -4, this.font, \"#000000\", \"#00000000\", true);*/\n }\n\n this.planeMesh.visibility = 1;\n this.isVirgin = false;\n this.gameInstance.cleanLastMesh();\n\n //Add text as UI?\n \n if(this.postModel.message) {\n this.texture.drawText(this.postModel.message, null, this.canvasScale *0.5, this.font, \"#7F7F7F\", \"#00000000\", true);\n this.texture.drawText(this.postModel.message, null, (this.canvasScale *0.5) -4, this.font, \"#ffffff\", \"#00000000\", true);\n }\n }\n\n //Dealing with post img loaded\n public imgLoaded(){\n\n\n let ratio;\n let newWidth;\n let newHeight;\n let newX = 0;\n let newY = 0;\n\n if(this.postImage != null){\n if(this.postImage.height > this.postImage.width) {\n\n \n ratio = (this.objType === \"canvas\")? this.canvasScale / this.postImage.height :this.canvasScale / this.postImage.width;\n newWidth = this.postImage.width * ratio;\n newHeight = this.postImage.height * ratio;\n newX = (newWidth - this.canvasScale) * (-0.5);\n\n } else {\n\n ratio = (this.objType === \"canvas\")? this.canvasScale / this.postImage.width: this.canvasScale / this.postImage.height;\n newWidth = this.postImage.width * ratio;\n newHeight = this.postImage.height * ratio;\n newY = (newHeight - this.canvasScale) * (-0.5);\n\n }\n\n this.textureContext.drawImage(this.postImage,newX, newY,newWidth, newHeight);\n }\n \n //If graffiti\n if(this.postImageGraffiti != null) {\n\n ratio = this.canvasScale / this.postImageGraffiti.width;\n console.log(\"ratio= \"+ratio);\n newWidth = this.postImageGraffiti.width * ratio;\n newHeight = this.postImageGraffiti.height * ratio;\n //newY = (newHeight - this.canvasScale) * (-0.5);\n\n this.textureContext.drawImage(this.postImageGraffiti,0, 0,newWidth, newHeight);\n }\n\n if(this.postModel.url.toLocaleLowerCase().indexOf(\".gif\") > 0 ){\n\n this.texture.drawText(\".GIF\", null, this.canvasScale *0.5, this.font, \"#000000\", \"#00000000\", true);\n this.texture.drawText(\".GIF\", null, (this.canvasScale *0.5) -4, this.font, \"#ffffff\", \"#00000000\", true);\n\n } else if(new UrlParser(this.postModel.url).getUrlType() === UrlParser.TYPE_YOUTUBE) {\n\n this.texture.drawText(\">VID\", null, this.canvasScale *0.5, this.font, \"#000000\", \"#00000000\", true);\n this.texture.drawText(\">VID\", null, (this.canvasScale *0.5) -4, this.font, \"#ffffff\", \"#00000000\", true);\n\n } else if(this.postModel.message) {\n \n this.texture.drawText(this.postModel.message, null, this.canvasScale *0.5, this.font, \"#7F7F7F\", \"#00000000\", true);\n this.texture.drawText(this.postModel.message, null, (this.canvasScale *0.5) -4, this.font, \"#ffffff\", \"#00000000\", true);\n \n \n }\n /* else if(this.postModelGraffiti && this.postModelGraffiti.message) {\n this.texture.drawText(this.postModelGraffiti.message, null, this.canvasScale *0.5, this.font, \"#7F7F7F\", \"#00000000\", true);\n this.texture.drawText(this.postModelGraffiti.message, null, (this.canvasScale *0.5) -4, this.font, \"#ffffff\", \"#00000000\", true);\n\n }*/\n\n if(this.postModel.is_canon){\n this.texture.drawText(\"Δ\",(newX) + 8, (newY) + 80, this.font, \"#000000\", \"#00000000\", true);\n //mat.emissiveColor = new BABYLON.Color3(1, 1, 1);\n }\n \n this.texture.update();\n this.planeMesh.material = this.mat;\n this.planeMesh.material.freeze();\n }\n\n private initTextureObject(){\n\n this.planeMesh.material.unfreeze();\n\n if( this.mat == null){\n this.mat = new StandardMaterial(\"mat\", this.gameInstance.scene);\n this.texture = new BABYLON.DynamicTexture(\"DynamicText\",{width:this.canvasScale, height:this.canvasScale}, this.gameInstance.scene,false);\n this.texture.hasAlpha = true;\n this.textureContext = this.texture.getContext();\n this.mat.diffuseTexture = this.texture;\n this.planeMesh.material = this.mat;\n }\n }\n\n\n public deletePostData(){\n //console.log(\"deletePostData= \"+this.postModel.url+\"; canvas_key: \"+this.postModel.canvas_key);\n this.postModel = new PostModel();\n this.postModel.canvas_key = this.dictKey;\n this.isVirgin = true;\n let mat = new StandardMaterial(\"matCanvas\", this.gameInstance.scene);\n mat.alpha = 0;\n this.planeMesh.material.unfreeze();\n this.planeMesh.material = mat;\n this.planeMesh.material.freeze();\n }\n\n public setInterfaceVisible(val_){\n /*\n //if(this.displayUI != null){\n \n //this.displayUI.isVisible = val_;\n if(this.postModel != null && this.postModel.message && this.uiAdvancedTexture != null){\n\n if(val_){\n\n //this.uiAdvancedTexture.addControl(this.displayUI);\n //this.uiAdvancedTexture.addControl(this.label);\n this.displayUI.isVisible = true;\n \n } else {\n \n //this.uiAdvancedTexture.removeControl(this.displayUI);\n //this.uiAdvancedTexture.removeControl(this.label);\n this.displayUI.isVisible = false;\n \n }\n }\n //}\n */\n }\n\n}","import {\n Engine, Scene,FreeCamera, Light,\n DirectionalLight, HemisphericLight, ShadowGenerator,\n Color4, Color3Gradient,\n Mesh, VideoTexture,\n Vector3, MeshBuilder,\n ArcRotateCamera, StandardMaterial, Texture,\n Color3, SpriteManager, Sprite\n } from 'babylonjs';\n\nimport { Game } from \"./game\";\nimport { MapMaker } from \"./mapMaker\";\n\nexport class Door {\n\n public objType : String = \"door\";\n private gameInstance : Game;\n private mapInstance : MapMaker;\n public doorMesh: Mesh;\n\n public dictKey : string;\n public sizeCanvas: number;\n public doorOpen = false;\n\n public openedY: number;\n public closedY: number;\n\n public closeDoorInterval;\n public clooseDoorDelay = 600000;\n public isSecret: boolean = false;\n\n constructor(dictKey, size, x, y, z, secret_){\n\n this.sizeCanvas = size;\n this.isSecret = secret_;\n\n this.dictKey = this.objType+\"_\"+dictKey;\n this.gameInstance = Game.getInstance();\n this.mapInstance = MapMaker.getInstance();\n\n this.closedY = size * 0.5 + y;\n this.openedY = -size * 0.5 + y;\n\n this.doorMesh = MeshBuilder.CreateBox( this.dictKey, {size: this.sizeCanvas}, this.gameInstance.scene);\n this.doorMesh.checkCollisions = true;\n \n let mat = new StandardMaterial(\"matBoxDoor\", this.gameInstance.scene);\n if(!this.isSecret){\n \n mat.diffuseColor = BABYLON.Color3.Green();\n }else {\n let textureBox = new Texture(\"./assets/textures/concrete_text.jpg\", this.gameInstance.scene);\n mat.diffuseTexture = textureBox;\n }\n mat.freeze();\n this.doorMesh.material = mat;\n\n this.doorMesh.position.y = this.closedY + y;\n this.doorMesh.position.x = x;\n this.doorMesh.position.z = z;\n\n this.mapInstance.registerNewDoor(this.dictKey ,this);\n\n }\n\n public openDoor(){\n this.doorOpen = true;\n this.updateDoor();\n /*\n this.closeDoorInterval = setInterval(() => {\n this.closeDoor();\n clearInterval( this.closeDoorInterval);\n }, this.clooseDoorDelay );*/\n\n this.doorMesh.dispose();\n }\n\n public closeDoor(){\n this.doorOpen = false;\n this.updateDoor();\n }\n\n public updateDoor(){\n console.log(\"open door this.doorMesh.position.y=\"+ this.doorMesh.position.y);\n this.doorMesh.position.y = (this.doorOpen)? this.openedY:this.closedY;\n console.log(\"open door this.doorMesh.position.y=\"+ this.doorMesh.position.y);\n }\n}","import {\n Engine, Scene,FreeCamera, Light,\n DirectionalLight, HemisphericLight, ShadowGenerator,\n Color4, Color3Gradient, Mesh, AbstractMesh,\n Vector3, MeshBuilder, ArcRotateCamera,\n StandardMaterial, Texture, Color3, PointLight,\n} from 'babylonjs'\n\nimport * as GUI from 'babylonjs-gui';\n\nimport {\n GradientMaterial\n}from 'babylonjs-materials'\n\nimport { MapMaker } from \"./mapMaker\";\nimport { PlayerMotor } from \"./playerMotor\";\nimport { Door } from \"./door\";\nimport { GameUIServiceService } from '../services/game-uiservice.service'\nimport { ChanWebService }from '../services/chan-web.service'\nimport { OfflineService }from '../services/offline.service'\nimport { Router} from '@angular/router';\nimport { InteractionModel } from '../models/interaction-model';\n\n//Chan data\nimport{ GameDataResponseModel } from '../models/game-data.response.model';\nimport{ PlayerResponseModel } from '../models/player.response.model';\nimport { GameDataModel } from '../models/game-data.model';\nimport { PostModel } from \"../models/post.model\";\nimport { Item } from './item';\nimport { Gate } from './gate';\nimport { GameUtils} from './gameUtils';\nimport { PlayerModel } from '../models/player.model';\nimport { CanvasPlane } from './canvasPlane';\nimport ItemModel from '../models/item.model';\nimport {Helpers} from '../utils/helpers';\n\nexport class Game {\n\n //Singleton data\n private static instance: Game;\n public canvas: HTMLCanvasElement;\n public engine: Engine;\n public scene: Scene;\n public camera: FreeCamera;\n private dLight: DirectionalLight;\n private hLight: HemisphericLight;\n private pLight: PointLight;\n public shadowGen: ShadowGenerator;\n private mapMaker : MapMaker;\n private playerMotor : PlayerMotor;\n public gameUIServiceService : GameUIServiceService;\n public offlineService : OfflineService;\n public chanWebService : ChanWebService;\n public router : Router;\n private ground: BABYLON.Mesh;\n public uiAdvancedTexture : GUI.AdvancedDynamicTexture;\n private postListRequestInterval;\n private postListRequestDelay : number = 10000;\n //private postListRequestDelay : number = 60000;\n\n private mapChanging = false;\n\n private playerModel :PlayerModel;\n private gameResponse : GameDataResponseModel;\n\n public mapKey = \"\";\n public clientUrl = \"\";\n public mapKeyOld = \"\";\n public activateJoystick = false;\n\n static getInstance() {\n return Game.instance;\n }\n\n constructor(canvasElement : string) {\n\n //Set the instance\n Game.instance = this;\n this.canvas = document.getElementById(canvasElement);\n this.engine = new Engine(this.canvas, true, null, false);\n // Listen for browser/canvas resize events\n window.addEventListener(\"resize\", ()=> {\n this.engine.resize();\n });\n \n }\n\n setUIService(service_ : GameUIServiceService){\n this.gameUIServiceService = service_;\n this.gameUIServiceService.postArtCanvasEmitter.subscribe((post_) =>{\n this.postArtCanvas(post_);\n })\n\n this.gameUIServiceService.forceWSEmitter.subscribe(() =>{\n this.getPostList();\n })\n\n this.gameUIServiceService.deletePostEmitter.subscribe((post_) =>{\n console.log(\"deletePostEmitter:\"+post_);\n this.deletePost(post_);\n })\n }\n\n setOfflineService(service_: OfflineService){\n this.offlineService = service_;\n }\n\n setWebService(service_ : ChanWebService){\n this.chanWebService = service_;\n }\n\n setRouter(router_){\n this.router = router_;\n }\n\n setMapKey(mapKey_){\n this.mapKey = mapKey_;\n }\n\n setClientUrl(clientUrl_){\n this.clientUrl = clientUrl_;\n }\n\n initGame() {\n\n console.log( \"initGame() \");\n //we get the player profile\n let playerMod: PlayerModel = this.offlineService.getPlayerData();\n\n this.playerModel = playerMod;\n this.chanWebService.createUser(playerMod.id, playerMod.player_key, \"\", this.mapKey).subscribe(\n //Data success\n (data : GameDataResponseModel) => {\n\n this.gameResponse = data;\n\n if( this.gameResponse.ok ) {\n\n this.playerModel = this.gameResponse.result.player;\n this.offlineService.saveChan( this.playerModel.map_key );\n this.setMapKey(this.playerModel.map_key);\n this.offlineService.savePlayer( this.playerModel );\n\n //Launch the game\n this.createScene();\n this.run();\n \n //Get the playerData\n if(this.postListRequestInterval == null){\n this.postListRequestInterval = setInterval(() => {\n this.getPostList();\n }, this.postListRequestDelay );\n }\n this.getPostList();\n\n } else {\n alert(\"Profile not found!\");\n }\n \n },\n );\n \n }\n\n createScene() {\n console.log(\"createScene()\");\n if( this.scene != null) this.scene.dispose();\n // We need a scene to create all our geometry and babylonjs items in\n this.scene = new Scene(this.engine);\n this.playerMotor = PlayerMotor.getInstance();\n this.playerMotor.initMotor();\n if(this.activateJoystick) this.playerMotor.activeJoystick();\n if(!this.mapMaker){\n this.mapMaker = new MapMaker();\n }\n this.mapMaker.loadMapData( this.gameResponse.result.map[0]);\n\n this.initAtmosphere();\n this.initOptimisation();\n \n }\n\n /************************\n * SCENE VISUAL STUFF\n * ligth / optimization / ground / skybox\n * and other shit\n ***********************/\n\n initAtmosphere(){\n\n //Scene atmoshpere\n this.scene.clearColor = new Color4(226/255, 244/255, 1);\n this.scene.ambientColor = new Color3(0.3, 0.3, 0.3);\n\n this.scene.autoClear = false; // Color buffer\n this.scene.autoClearDepthAndStencil = false;\n\n\n // Hemispheric light to enlight the scene\n this.hLight = new HemisphericLight(\"hemi\", new Vector3(0, 0.5, 0), this.scene);\n this.hLight.intensity = 0.85;\n\n this.pLight = new BABYLON.PointLight(\"pointLight\", new BABYLON.Vector3(1, 450, 1), this.scene);\n this.pLight.intensity = 1.5;\n\n //texture\n this.ground = Mesh.CreateGround(\"ground\", 1000, 1000, 2, this.scene);\n this.ground.checkCollisions = true;\n this.ground.position.y = - 0.1;\n\n let mat = new StandardMaterial(\"matVolcano\", this.scene);\n let texture = new Texture(\"./assets/textures/volcanic_text.jpg\", this.scene);\n mat.diffuseTexture = texture;\n this.ground.material = mat;\n\n //Set UIManager\n this.uiAdvancedTexture = GUI.AdvancedDynamicTexture.CreateFullscreenUI(\"UI\");\n\n\n let skybox = BABYLON.MeshBuilder.CreateBox(\"skyBox\", {size:1000.0}, this.scene);\n let skyboxMaterial = new BABYLON.StandardMaterial(\"skyBox\", this.scene);\n skyboxMaterial.backFaceCulling = false;\n skyboxMaterial.reflectionTexture = new BABYLON.CubeTexture(\"./assets/textures/skybox\", this.scene);\n skyboxMaterial.reflectionTexture.coordinatesMode = BABYLON.Texture.SKYBOX_MODE;\n skyboxMaterial.diffuseColor = new BABYLON.Color3(0, 0, 0);\n skyboxMaterial.specularColor = new BABYLON.Color3(0, 0, 0);\n skybox.material = skyboxMaterial;\n }\n\n private shadowGenerator: BABYLON.ShadowGenerator;\n\n public setShadow(mesh_ : Mesh){\n /*\n if(this.shadowGenerator == null){\n this.shadowGenerator = new BABYLON.ShadowGenerator(256, this.pLight);\n //this.shadowGenerator.useBlurExponentialShadowMap = true;\n this.shadowGenerator.filteringQuality = BABYLON.ShadowGenerator.QUALITY_LOW;\n }\n\n this.shadowGenerator.getShadowMap().renderList.push(mesh_);\n mesh_.receiveShadows = true;*/\n }\n\n initOptimisation(){\n //Optimization\n this.scene.blockMaterialDirtyMechanism = true;\n /*\n BABYLON.SceneOptimizer.OptimizeAsync(this.scene, BABYLON.SceneOptimizerOptions.LowDegradationAllowed(),\n ()=> {\n // On success\n }, ()=> {\n // FPS target not reached\n });*/\n }\n\n //Render process\n run() : void {\n this.engine.runRenderLoop(()=> {\n if(this.scene != null){\n this.scene.render();\n this.renderInteraction();\n }\n });\n }\n\n /************************\n * EXECUTE INTERACTION\n ***********************/\n\n //Render Interaction\n private nameLastMesh: string;\n private meshToClimb: AbstractMesh;\n private doorToOpen: Door;\n private itemToGet: Item;\n private gateTopass: Gate;\n private lastCanvas: CanvasPlane;\n\n public cleanLastMesh(){\n this.nameLastMesh = \"\";\n if(this.lastCanvas != null) this.lastCanvas.setInterfaceVisible(false);\n }\n\n interactionDelay: number = 18;\n interactionTimer: number = 0;\n\n renderInteraction(){\n\n if(this.interactionTimer <=0) {\n\n let width = this.scene.getEngine().getRenderWidth();\n let height = this.scene.getEngine().getRenderHeight();\n let pickInfo = this.scene.pick(width / 2, height / 2, null, false, this.camera);\n\n //Get info on the pointed object\n if (pickInfo.hit && this.nameLastMesh !== pickInfo.pickedMesh.name) {\n\n let newInter : InteractionModel = new InteractionModel();\n newInter.type = InteractionModel.TYPE_NONE;\n this.meshToClimb = null;\n this.doorToOpen = null;\n\n this.mapMaker.cleanLines();\n\n this.nameLastMesh = pickInfo.pickedMesh.name;\n newInter.description = pickInfo.pickedMesh.name;\n if(pickInfo.pickedMesh.name !== undefined){\n\n if (pickInfo.pickedMesh.name.indexOf(\"canvas\") >= 0) {\n\n let canvas = this.mapMaker.getCanvasByKey(pickInfo.pickedMesh.name);\n if(canvas != null){\n\n if(canvas.isVirgin){\n newInter.type = InteractionModel.TYPE_CANVAS_VIRGIN;\n /*\n } else if(canvas.postModelGraffiti == null){\n newInter.type = InteractionModel.TYPE_CANVAS_TO_GRAFF;\n this.mapMaker.drawlines(canvas.dictKey);*/\n } else {\n newInter.type = InteractionModel.TYPE_CANVAS_FULL;\n this.mapMaker.drawlines(canvas.dictKey);\n this.mapMaker.displayUI(canvas.dictKey);\n\n }\n //newInter.type = (canvas.isVirgin)? InteractionModel.TYPE_CANVAS_VIRGIN : InteractionModel.TYPE_CANVAS_FULL;\n newInter.value = canvas.postModel;\n this.cleanLastMesh();\n canvas.setInterfaceVisible(true);\n this.lastCanvas = canvas;\n }\n\n } else if(pickInfo.pickedMesh.name.toLowerCase().indexOf(\"ladder\") >= 0){\n newInter.type = InteractionModel.TYPE_CLIMB_LADDER;\n this.meshToClimb = pickInfo.pickedMesh;\n\n /*\n } else if(pickInfo.pickedMesh.name.toLowerCase().indexOf(\"advertisement\") >= 0){\n\n let canvas = this.mapMaker.getAdByKey(pickInfo.pickedMesh.name);\n if(canvas != null){\n newInter.type = InteractionModel.TYPE_AD;\n newInter.value = canvas.postModel;\n this.cleanLastMesh();\n canvas.setInterfaceVisible(true);\n this.lastCanvas = canvas;\n }*/\n\n } else if(pickInfo.pickedMesh.name.toLowerCase().indexOf(\"door\") >= 0){\n\n //console.log(\"pick gate\"+pickInfo.pickedMesh.name);\n let door: Door = this.mapMaker.getDoorByKey(pickInfo.pickedMesh.name);\n newInter.type = InteractionModel.TYPE_OPEN_DOOR;\n this.doorToOpen = door;\n\n } else if(pickInfo.pickedMesh.name.toLowerCase().indexOf(\"item\") >= 0){\n\n //console.log(pickInfo.pickedMesh.name);\n let item: Item = this.mapMaker.getItemByKey(pickInfo.pickedMesh.name);\n if( item != null && item.itemModel != null){\n newInter.type = InteractionModel.TYPE_GET_ITEM;\n newInter.value = item.itemModel;\n this.itemToGet = item;\n }\n \n }else if(pickInfo.pickedMesh.name.toLowerCase().indexOf(\"gate\") >= 0){\n\n let gate: Gate = this.mapMaker.getGateByKey(pickInfo.pickedMesh.name);\n newInter.type = InteractionModel.TYPE_PASS_GATE;\n newInter.value = gate.gateKey;\n this.gateTopass = gate;\n\n }\n /*else if(pickInfo.pickedMesh.name.toLowerCase().indexOf(\"panel\") >= 0){\n newInter.type = InteractionModel.TYPE_PANEL;\n newInter.value = \"http://snuffchan.com/blog/donations/\";\n //this.panel = gate;\n }*/\n\n }\n\n this.nameLastMesh = pickInfo.pickedMesh.name;\n this.gameUIServiceService.sendInteraction(newInter);\n }\n\n this.interactionTimer = this.interactionDelay;\n\n } else {\n this.interactionTimer --;\n }\n }\n\n //Climb obj\n climbObject(){\n this.camera.position.x = this.meshToClimb.position.x;\n this.camera.position.z = this.meshToClimb.position.z;\n this.camera.position.y = this.meshToClimb.position.y + MapMaker.TILE_SIZE;\n }\n\n //Climb obj\n openDoor(){\n //console.log(this.doorToOpen);\n //console.log(this.nameLastMesh );\n this.nameLastMesh = \"\";\n this.doorToOpen.openDoor();\n }\n\n //Post\n postArtCanvas(canvas_: PostModel){\n console.log(canvas_);\n this.mapMaker.setPictureOnCanvas(canvas_);\n }\n \n\n public switchKeyMapping(){\n GameUtils.switchKeyMapping(this);\n }\n\n public activeJoystick(){\n this.activateJoystick = true;\n if(this.playerMotor != null) this.playerMotor.activeJoystick();\n }\n\n /************************\n * WEB SERVICE MANAGEMENT\n ***********************/\n\n private gameDataModel : GameDataModel;\n private posts : PostModel[];\n private items : ItemModel[];\n private isError : boolean = false;\n private errorMessage : string;\n private isPostLoaded : boolean = false;\n private isFirstLaunch : boolean = true; // test if player axist at first launch\n\n public getPostList(){\n\n if(!this.mapChanging){\n let playerTempModel = this.playerMotor.getPlayerPos();\n this.chanWebService.getMapPostList( playerTempModel.position_x, playerTempModel.position_y, this.playerModel.name, this.playerTalk).subscribe(\n //Data success\n (data : GameDataResponseModel) => {\n\n let gameResponse : GameDataResponseModel = data;\n\n if( gameResponse.ok ) {\n\n if(Helpers.isPT()){\n let postsLeft = gameResponse.result.postsLeft - 18;\n if(postsLeft < 0) postsLeft= 0;\n gameResponse.result.postsLeft = postsLeft;\n }\n\n this.updateGameData(gameResponse.result);\n this.mapMaker.updateNonStaticData(gameResponse.result);\n this.isFirstLaunch = false;\n\n } else {\n\n this.isError = true;\n this.errorMessage = \"Unknown error.\";\n }\n },\n error => {\n //console.log(JSON.stringify(error));\n this.isError = true;\n if(this.isFirstLaunch){\n this.gameUIServiceService.changeState(GameUIServiceService.STATE_NO_PLAYER);\n }\n this.errorMessage = JSON.stringify(error);\n \n }\n );\n }\n }\n\n \n public updateGameData(gameDataModel_){\n console.log(\"updateGameData()\");\n this.gameDataModel = gameDataModel_;\n this.mapMaker.updateNonStaticData( this.gameDataModel );\n this.gameUIServiceService.updateGameData(this.gameDataModel);\n\n //Update the player\n this.playerModel = this.gameDataModel.player;\n /*\n if(this.playerModel.map_key != this.mapKey){\n this.generateMap(this.playerModel.map_key);\n this.mapMaker.loadMapData(this.gameDataModel.map[0]);\n this.mapKey = this.playerModel.map_key;\n }*/\n\n this.items = this.gameDataModel.itemsPlayer;\n this.offlineService.savePlayer( this.playerModel);\n this.isPostLoaded = true;\n this.isError = false;\n }\n\n public passGet(getName_){\n //this.playerMotor.savePlayerRotation();\n this.mapChanging = true;\n this.chanWebService.changeMapRandom( (getName_ === \"secret\") ).subscribe((data_: GameDataResponseModel) =>{\n if(data_.ok){\n //this.createScene();\n this.scene.dispose();\n this.mapMaker = null;\n delete this.mapMaker;\n this.offlineService.saveChan(data_.result.player.map_key);\n //this.router.navigateByUrl('/ch/'+data_.result.player.map_key);\n window.location.href = this.clientUrl+'/ch/'+data_.result.player.map_key;\n //console.log(\"change to :\"+data_.result.player.map_key);\n //this.updateGameData(data_.result);\n }\n })\n }\n\n public getItem(key_){\n this.chanWebService.getItem(key_).subscribe(data_ =>{\n if(data_.ok){\n this.updateGameData(data_.result);\n }\n })\n }\n\n public deletePost(post_){\n \n let canvas: CanvasPlane = this.mapMaker.getCanvasByKey(post_.canvas_key);\n if(canvas != null){\n console.log(\"Post found and deleted= \"+post_);\n canvas.deletePostData();\n }\n }\n\n private playerName = \"\" ;\n public changeName(name_){\n this.playerName = name_;\n }\n\n private playerTalk = \"\" ;\n public changeTalk(talk_){\n this.playerTalk = talk_;\n }\n\n /*\n public changeMapForPlayer(mapKey_){\n this.chanWebService.setMap(mapKey_).subscribe((data_)=>{\n console.log(data_);\n })\n }*/\n\n }","import {MapModel} from '../models/map.model';\nimport { Game } from \"./game\";\nimport { ConfigModel } from '../models/config.model';\n\nexport class GameUtils {\n\n //Doc for https://en.wikipedia.org/wiki/QWERTY\n //Key code list https://www.cambiaresearch.com/articles/15/javascript-char-codes-key-codes\n \n public static setKeyBoardMapping(gameInstance_ : Game){\n\n let conf_: ConfigModel = gameInstance_.offlineService.getConfig();\n if( conf_.key_mapping == null ) {\n let language : string = navigator.language;\n GameUtils.setKeyMappingFromLang(gameInstance_, language);\n } else {\n GameUtils.setKeyForMapping(gameInstance_ , conf_.key_mapping);\n }\n\n }\n\n public static setKeyMappingFromLang(gameInstance_ : Game, lang_ :string){\n\n if(lang_.toLowerCase().indexOf(\"fr\") >= 0){\n GameUtils.setKeyForMapping(gameInstance_, \"ZSQD\");\n } else {\n GameUtils.setKeyForMapping(gameInstance_, \"WSAD\");\n }\n \n }\n\n public static setKeyForMapping(gameInstance_ : Game, mapping_ :string){\n console.log(\"setKeyMapping() lang_= \"+mapping_);\n\n let config : ConfigModel = gameInstance_.offlineService.getConfig();\n\n if(mapping_ === \"ZSQD\"){\n //If Azerty\n gameInstance_.camera.keysUp = [90]; // Z\n gameInstance_.camera.keysDown = [83]; // S\n gameInstance_.camera.keysLeft = [81]; // Q\n gameInstance_.camera.keysRight = [68]; // D\n } else {\n //If Qwerty\n gameInstance_.camera.keysUp = [87]; // w\n gameInstance_.camera.keysDown = [83]; // S\n gameInstance_.camera.keysLeft = [65]; // A\n gameInstance_.camera.keysRight = [68]; // D\n \n }\n \n config.key_mapping = mapping_;\n gameInstance_.offlineService.saveConfig(config);\n gameInstance_.gameUIServiceService.updateConfigData(config);\n //gameInstance_.offlineService.saveKeyboard(lang_.toLowerCase());\n }\n\n public static switchKeyMapping(gameInstance_ : Game){\n\n let conf_: ConfigModel = gameInstance_.offlineService.getConfig();\n if( conf_.key_mapping == null ) {\n let language : string = navigator.language;\n GameUtils.setKeyMappingFromLang(gameInstance_, language);\n } else {\n if( conf_.key_mapping === \"ZSQD\") GameUtils.setKeyForMapping(gameInstance_ , \"WSAD\");\n if( conf_.key_mapping === \"WSAD\") GameUtils.setKeyForMapping(gameInstance_ , \"ZSQD\");\n \n }\n }\n\n}","import {\n Engine, Scene,FreeCamera, Light,\n DirectionalLight, HemisphericLight, ShadowGenerator,\n Color4, Color3Gradient,\n Mesh, VideoTexture,\n Vector3, MeshBuilder,\n ArcRotateCamera, StandardMaterial, Texture,\n Color3, SpriteManager, Sprite\n } from 'babylonjs';\n\nimport { Game } from \"./game\";\nimport { MapMaker } from \"./mapMaker\";\n\nexport class Gate {\n\n public objType : String = \"gate\";\n private gameInstance : Game;\n private mapInstance : MapMaker;\n public doorMesh: Mesh;\n public dictKey : string;\n\n public gateKey : string;\n\n constructor(dictKey, size, x, y, z, key_){\n\n this.dictKey = this.objType+\"_\"+dictKey;\n this.gateKey = key_;\n this.gameInstance = Game.getInstance();\n this.mapInstance = MapMaker.getInstance();\n\n this.doorMesh = MeshBuilder.CreateBox( this.dictKey, {size: size}, this.gameInstance.scene);\n this.doorMesh.checkCollisions = true;\n \n let mat = new StandardMaterial(\"matGateDoor\", this.gameInstance.scene);\n mat.diffuseColor = BABYLON.Color3.Red();\n \n \n mat.freeze();\n this.doorMesh.material = mat;\n\n this.doorMesh.position.y = y;\n this.doorMesh.position.x = x;\n this.doorMesh.position.z = z;\n\n this.mapInstance.registerNewGate(this.dictKey ,this);\n\n }\n}","import {\n Engine, Scene,FreeCamera, Light,\n DirectionalLight, HemisphericLight, ShadowGenerator,\n Color4, Color3Gradient,\n Mesh, VideoTexture,\n Vector3, MeshBuilder,\n ArcRotateCamera, StandardMaterial, Texture,\n Color3, SpriteManager, Sprite\n } from 'babylonjs';\n\nimport { Game } from \"./game\";\nimport { MapMaker } from \"./mapMaker\";\nimport ItemModel from '../models/item.model';\n\nexport class Item {\n\n public objType : String = \"item\";\n private gameInstance : Game;\n private mapInstance : MapMaker;\n public itemMesh: Mesh;\n public dictKey : string;\n public itemModel : ItemModel;\n\n public spriteManagerPlayer : SpriteManager;\n public sprite : Sprite;\n\n constructor(type_, itemModel_, size_, x, y){\n\n this.itemModel = itemModel_;\n\n this.objType = type_;\n this.dictKey = this.objType+\"_\"+this.itemModel.name+\"_\"+itemModel_.key;\n this.gameInstance = Game.getInstance();\n this.mapInstance = MapMaker.getInstance();\n \n \n this.itemMesh = MeshBuilder.CreateBox( this.dictKey, {height: size_*3, width: size_, depth: size_}, this.gameInstance.scene);\n this.itemMesh.checkCollisions = false;\n this.itemMesh.visibility = 0;\n this.itemMesh.position.y = (size_) *0.5;\n this.itemMesh.position.x = x;\n this.itemMesh.position.z = y;\n this.itemMesh.visibility = 0;\n \n /*let mat = new StandardMaterial(\"matBoxItem\", this.gameInstance.scene);\n mat.diffuseColor = BABYLON.Color3.Random();\n mat.freeze();\n this.itemMesh.material = mat;*/\n //if(this.objType.toLowerCase().indexOf('gate') >= 0 ) this.itemMesh.visibility = 0.2;\n \n\n //sprite\n this.spriteManagerPlayer = new SpriteManager(\"itemManager\",\"./assets/textures/cardboard_text.png\", 1, {width: 288, height: 288}, this.gameInstance.scene);\n this.sprite = new Sprite(\"item\"+itemModel_.id, this.spriteManagerPlayer);\n\n this.sprite.width = 6;\n this.sprite.height = 6;\n\n this.sprite.position.x = x;\n this.sprite.position.z = y;\n this.sprite.position.y = 3;\n\n\n this.mapInstance.registerNewItem(this.dictKey ,this);\n\n }\n\n public clean(){\n\n this.spriteManagerPlayer.dispose();\n if(this.itemMesh != null)this.itemMesh.dispose();\n this.sprite.dispose();\n\n this.spriteManagerPlayer = null;\n this.itemMesh = null;\n this.sprite = null;\n\n }\n\n}","import {\n Engine, Scene,FreeCamera, Light,\n DirectionalLight, HemisphericLight, ShadowGenerator,\n Color4, Color3Gradient,\n Mesh,\n Vector3, MeshBuilder,\n ArcRotateCamera, StandardMaterial, Texture,\n Color3, SpriteManager, Sprite, Layer\n } from 'babylonjs';\n \n import { Tile } from \"./tile\";\n import { Game } from \"./game\";\n import { CanvasPlane } from \"./canvasPlane\";\n import { Door } from \"./door\";\n import { Item } from \"./item\";\n import { Gate } from \"./gate\";\n import { PostModel } from '../models/post.model';\n import { MapModel } from '../models/map.model';\n import { GameUtils, } from './gameUtils';\nimport ItemModel from '../models/item.model';\nimport { GameDataModel } from '../models/game-data.model';\nimport {PlayerMotor} from './playerMotor';\nimport { PlayerModel } from '../models/player.model';\nimport { PlayerMesh } from './playerMesh';\n\nimport * as GUI from 'babylonjs-gui';\nimport { AdvertisementModel } from '../models/advertisement.model';\n\nexport class MapMaker {\n\n private gameInstance : Game;\n private static _instance : MapMaker;\n\n public static get TILE_SIZE():number { return 10; }\n\n //Game data\n private mapModel : MapModel;\n private mapData : string[];\n\n public gameData: GameDataModel;\n\n public players: any[];\n public posts: PostModel[];\n public items: ItemModel[] = [];\n\n public anonList: PlayerMesh[] = [];\n public itemMesh: Item[] = [];\n\n public TileGroundMeshes : Mesh[] = [];\n public TileWallMeshes : Mesh[] = [];\n\n public DIR_N = 0;\n public DIR_E = 1;\n public DIR_S = 2;\n public DIR_W = 3;\n\n //Canvas PLane dictionnary\n public canvasDict: { [id: string] : CanvasPlane; } = {};\n public advertisementDict: { [id: string] : CanvasPlane; } = {};\n public doorDict: { [id: string] : Door; } = {};\n public gateDict: { [id: string] : Gate; } = {};\n public itemDict: { [id: string] : Item; } = {};\n\n static getInstance() {\n return this._instance;\n }\n\n constructor() {\n\n this.gameInstance = Game.getInstance();\n MapMaker._instance = this;\n }\n\n loadMapData(map_: MapModel){\n \n Tile.meshGrassInstance = null;\n Tile.meshGroundInstance = null;\n Tile.meshWallInstance = null;\n\n this.mapModel = map_;\n this.buildMap();\n }\n\n cleanMap(){\n \n this.TileGroundMeshes = [];\n this.TileWallMeshes = [];\n this.canvasDict = {};\n this.advertisementDict = {};\n this.doorDict = {};\n this.gateDict = {};\n this.itemDict = {};\n\n }\n\n buildMap(){\n this.cleanMap();\n //console.log(\"buildMap=\"+ this.mapModel );\n this.mapData = this.getMapData();\n\n let x = 0;\n let y = 0;\n let l = 0; //layer\n\n let playerPos = {x: -1, y: -1};\n\n //Generate a layer\n for(let n = 0; n < this.mapData.length; n++){\n //console.log(this.mapData[n]);\n if(parseInt(this.mapData[n]) != Tile.TILE_GATES && parseInt(this.mapData[n]) != Tile.TILE_GATES_SECRET){\n new Tile(this.mapData[n] , MapMaker.TILE_SIZE,x,l,y, null);\n\n if(parseInt(this.mapData[n]) === Tile.TILE_START){\n playerPos.x = x;\n playerPos.y = y;\n } \n } else if(parseInt(this.mapData[n]) == Tile.TILE_GATES) {\n\n console.log(\"x: \"+x+\"; y:\"+y+\"; width:\"+this.mapModel.width+\"; heihgt: \"+ this.mapModel.height);\n /*\n let key = \"\";\n if(y == 0){\n key = this.mapModel.door_key_n;\n } else if(x == this.mapModel.width-1){\n key = this.mapModel.door_key_e;\n } else if(y == this.mapModel.height-1){\n key = this.mapModel.door_key_s;\n } else if(x == 0){\n key = this.mapModel.door_key_w;\n }*/\n\n //console.log(\"GATE x: \"+x+\"; y:\"+y+\"; width:\"+this.mapModel.width+\"; heihgt: \"+ this.mapModel.height+\" key:\"+key);\n\n //Managing gates\n new Tile(this.mapData[n], MapMaker.TILE_SIZE,x,l,y, \"???\");\n\n }else if(parseInt(this.mapData[n]) == Tile.TILE_GATES_SECRET) {\n //Managing gates\n new Tile(this.mapData[n], MapMaker.TILE_SIZE,x,l,y, \"secret\");\n }\n //console.log(\"new tile-> type:\"+this.tileDict[n]+\" x:\"+x+\"y:\"+y);\n x += 1;\n if(x >= this.mapModel.width){\n x = 0;\n y += 1;\n } \n\n }\n\n let player = new PlayerModel();\n if(this.gameData != null) \n player = this.gameData.player;\n player.position_x = playerPos.x;\n player.position_y = playerPos.y;\n \n PlayerMotor.getInstance().setPlayerPos(player);\n\n if(this.gameData != null) this.updateNonStaticData(this.gameData);\n\n }\n\n /********************\n * UPDATE NON STATIC DATA\n * players, items and others\n ********************/\n updateNonStaticData(gameData_ :GameDataModel){\n\n this.itemDict = {};\n\n this.gameData = gameData_;\n\n //Post\n //Update teh posts DATA\n if(this.gameData.posts != undefined){\n this.posts = this.gameData.posts;\n for (let post of this.gameData.posts) {\n if(post !== null && post.canvas_key !== null){\n let canvas = this.getCanvasByKey(post.canvas_key);\n\n if(canvas!= null && canvas.isVirgin){\n //if(post.graffiti && canvas.postModelGraffiti == null){\n canvas.setPostData(post);\n /*\n } else if(!post.graffiti && canvas.postModel.id == null){\n canvas.setPostData(post);\n }*/\n }\n }\n }\n }\n\n //items\n this.itemMesh.forEach((item_: Item) =>{\n if(item_ != null && item_ != undefined){\n item_.clean();\n item_ = null;\n }\n });\n this.itemMesh = [];\n this.items = this.gameData.itemsMap;\n\n for(let i = 0; i < this.items.length; i++){\n let itemModel: ItemModel = this.items[i];\n let itemMesh = new Item(\"item\",itemModel, MapMaker.TILE_SIZE*0.2, itemModel.x * MapMaker.TILE_SIZE ,itemModel.y * MapMaker.TILE_SIZE);\n this.itemMesh.push(itemMesh);\n\n }\n\n //PLayers\n /*\n this.anonList.forEach((playerMesh: PlayerMesh) =>{\n playerMesh.clean();\n playerMesh = null;\n });\n\n let anonListNew = [];\n let anonListOld = this.anonList;\n let characters = this.gameData.players;\n\n for(let c = 0; c < characters.length; c++){\n let chara: PlayerModel = characters[c];\n let anon: PlayerMesh = null;\n //Is this anon exist?\n for(let a= 0; a {\n //playerMesh.dispose();\n playerMesh.clean();\n playerMesh = null;\n });\n\n this.anonList = anonListNew;*/\n\n this.anonList.forEach((playerMesh: PlayerMesh) =>{\n //playerMesh.dispose();\n playerMesh.clean();\n playerMesh = null;\n });\n this.anonList = [];\n\n let characters = this.gameData.players;\n for(let c = 0; c < characters.length; c++){\n let chara: PlayerModel = characters[c];\n let anon: PlayerMesh = new PlayerMesh(\"player\",chara, MapMaker.TILE_SIZE);\n this.anonList.push(anon);\n }\n\n\n }\n\n /********************\n * MANAGE UI\n ********************/\n\n private linesReplyTo;\n private linesReplyFrom;\n\n drawlines(key_){\n\n let currentPost = this.canvasDict[key_].postModel;\n if(this.linesReplyFrom != null) this.linesReplyFrom.dispose();\n if(this.linesReplyTo != null) this.linesReplyTo.dispose();\n\n\n //https://doc.babylonjs.com/babylon101/parametric_shapes\n let pointsTo = [];\n let pointsFrom = [];\n\n pointsTo.push( this.canvasDict[key_].planeMesh.position);\n pointsFrom.push( this.canvasDict[key_].planeMesh.position);\n\n for (let keyDict in this.canvasDict) {\n let canvas : CanvasPlane = this.canvasDict[keyDict];\n if (!canvas.isVirgin) {\n let found = false;\n if(canvas.postModel.id === currentPost.reply){\n pointsTo.push(canvas.planeMesh.position);\n found = true;\n } else if(canvas.postModel.reply === currentPost.id){\n pointsFrom.push(canvas.planeMesh.position);\n found = true;\n }\n\n if(found){\n for (let keyDict2 in this.canvasDict) {\n let canvas2 : CanvasPlane = this.canvasDict[keyDict2];\n if (!canvas2.isVirgin) {\n if(canvas2.postModel.id === canvas.postModel.reply){\n pointsTo.push(canvas2.planeMesh.position);\n }else if(canvas2.postModel.reply === canvas.postModel.id){\n pointsFrom.push(canvas2.planeMesh.position);\n }\n }\n }\n }\n }\n }\n this.linesReplyTo = BABYLON.MeshBuilder.CreateLines(\"lines\", {points: pointsTo}, this.gameInstance.scene);\n this.linesReplyFrom = BABYLON.MeshBuilder.CreateLines(\"lines\", {points: pointsFrom}, this.gameInstance.scene);\n /*\n this.linesReplyTo.Color4 = BABYLON.Color3.Blue;\n this.linesReplyFrom.Color4 = BABYLON.Color3.Green;\n */\n\n }\n\n cleanLines(){\n if(this.linesReplyFrom != null) this.linesReplyFrom.dispose();\n if(this.linesReplyTo != null) this.linesReplyTo.dispose();\n }\n\n private cubeUI: Mesh;\n private uiAdvancedTexture: any;\n private rectUI: BABYLON.GUI.Rectangle;\n private label: BABYLON.GUI.TextBlock;\n\n displayUI(key_){\n\n /*\n //To hard for memory\n let canvas: CanvasPlane = this.canvasDict[key_];\n\n if( this.cubeUI == null){\n this.cubeUI = MeshBuilder.CreateBox(\"meshUI\", {size: MapMaker.TILE_SIZE *0.5}, this.gameInstance.scene);\n //this.cubeUI.visibility = 0; \n } \n\n this.cubeUI.position.y = MapMaker.TILE_SIZE *0.5;\n this.cubeUI.position.x = canvas.planeMesh.position.x * MapMaker.TILE_SIZE;\n this.cubeUI.position.z = canvas.planeMesh.position.z * MapMaker.TILE_SIZE;\n\n if(this.uiAdvancedTexture == null){\n this.uiAdvancedTexture = BABYLON.GUI.AdvancedDynamicTexture.CreateFullscreenUI(\"UI\");\n this.rectUI = new BABYLON.GUI.Rectangle();\n \n this.rectUI.fontFamily = \"Courier New, Courier, monospace\";\n this.rectUI.cornerRadius = 10;\n this.rectUI.color = \"Grey\";\n this.rectUI.background = \"#161616\";\n this.uiAdvancedTexture.addControl(this.rectUI);\n this.label = new BABYLON.GUI.TextBlock();\n this.rectUI.addControl(this.label);\n this.rectUI.linkWithMesh(this.cubeUI); \n this.rectUI.linkOffsetY = 0;\n this.rectUI.linkOffsetX = 0;\n this.rectUI.width = 0.2;\n this.rectUI.height = 0.3;\n }\n\n this.label.text = canvas.postModel.message;\n */\n }\n\n clearUI(){\n \n }\n\n /********************\n * UTILS\n ********************/\n\n\n //Get potential Canvas orientation\n public getCanvasOrientation( x, z){\n\n let potentialDir: Number[] = [];\n if( this.getTileAt(x,z-1) === '0') potentialDir.push(this.DIR_N);\n if( this.getTileAt(x+1,z) === '0' ) potentialDir.push(this.DIR_E);\n if( this.getTileAt(x,z+1) === '0' ) potentialDir.push(this.DIR_S);\n if( this.getTileAt(x-1,z) === '0' ) potentialDir.push(this.DIR_W);\n\n if(potentialDir.length === 0) {\n //console.log(\"NO ORIENTATION FOUND\");\n return -1;\n }\n //We choose a random direction\n let indexChoosed = Math.floor(Math.random() * potentialDir.length);\n return potentialDir[indexChoosed];\n\n }\n\n //Return the value of a tile\n public getTileAt( x, y ){\n\n //Out of bounds\n if(x < 0 || x > this.mapModel.width || y< 0 || y > this.mapModel.height) return -1;\n let indexTile = (y*this.mapModel.width )+ x;\n return this.mapData[indexTile];\n\n }\n\n public registerNewCanvas(key_,canvas_){\n if( this.canvasDict[key_] === undefined) this.canvasDict[key_] = canvas_;\n }\n\n public registerNewAd(key_,canvas_){\n if( this.advertisementDict[key_] === undefined) this.advertisementDict[key_] = canvas_;\n }\n\n public registerNewDoor(key_,door_){\n if( this.doorDict[key_] === undefined) this.doorDict[key_] = door_;\n }\n\n public registerNewItem(key_,item_){\n if( this.itemDict[key_] === undefined) this.itemDict[key_] = item_;\n }\n\n public getCanvasByKey(key_){\n return this.canvasDict[key_];\n }\n\n public registerNewGate(key_,gate_){\n this.gateDict[key_] = gate_;\n }\n\n public getDoorByKey(key_){\n return this.doorDict[key_];\n }\n\n public getAdByKey(key_){\n return this.advertisementDict[key_];\n }\n\n public getGateByKey(key_){\n return this.gateDict[key_];\n }\n\n public getItemByKey(key_){\n return this.itemDict[key_];\n }\n\n public setPictureOnCanvas(post_: PostModel){\n let canvas = this.canvasDict[post_.canvas_key];\n console.log(this.canvasDict);\n if(canvas !== undefined){\n console.log(\"canvas to change: \"+post_.canvas_key+\"; to post url: \"+post_.url);\n canvas.setPostData(post_);\n } else {\n console.log(\"no canvas\");\n }\n }\n\n /********************\n * PERF MAnAGEMENT\n ********************/\n\n public addMeshToCluster(mesh_,type_){\n switch(type_){\n\n case Tile.TILE_GROUND: \n this.TileGroundMeshes.push(mesh_);\n break;\n\n case Tile.TILE_WALL: \n this.TileWallMeshes.push(type_);\n break;\n }\n }\n\n public createClusters(){\n BABYLON.Mesh.MergeMeshes(this.TileWallMeshes);\n BABYLON.Mesh.MergeMeshes(this.TileGroundMeshes);\n }\n\n /********************\n * PARSING MAP\n ********************/\n \n public getMapData(){\n return this.mapModel.level_data.split(\",\");\n }\n\n /*\n public getTileMapScaling(val_){\n val_ = (val_/this.mapModel.width)* MapMaker.TILE_SIZE;\n return val_;\n }*/\n\n }","import {\n Engine, Scene,FreeCamera, Light,\n DirectionalLight, HemisphericLight, ShadowGenerator,\n Color4, Color3Gradient,\n Mesh, VideoTexture,\n Vector3, MeshBuilder,\n ArcRotateCamera, StandardMaterial, Texture,\n Color3, SpriteManager, Sprite\n } from 'babylonjs';\n\n//import * as GUI from 'babylonjs-gui';\n\nimport { Game } from \"./game\";\nimport { MapMaker } from \"./mapMaker\";\nimport { PlayerModel } from '../models/player.model';\n\nexport class PlayerMesh {\n\n public objType : String = \"player\";\n private gameInstance : Game;\n private mapInstance : MapMaker;\n public playerMesh: Mesh;\n public dictKey : string;\n public playerModel : PlayerModel;\n\n public spriteManagerPlayer : SpriteManager;\n public sprite : Sprite;\n\n public uiAdvancedTexture: any;\n public rectUI: BABYLON.GUI.Rectangle;\n public label: BABYLON.GUI.TextBlock;\n public size;\n\n\n constructor(type_, playerModel_: PlayerModel, size_,){\n\n this.size = size_;\n\n this.playerModel = playerModel_;\n this.objType = type_;\n this.gameInstance = Game.getInstance();\n this.mapInstance = MapMaker.getInstance();\n\n if(this.playerModel.hp < 1 ){\n this.spriteManagerPlayer = new SpriteManager(\"playerManager\",\"./assets/textures/anon_sprite_dead.png\", 1, {width: 288, height: 288}, this.gameInstance.scene);\n this.sprite = new Sprite(\"player_\"+playerModel_.id, this.spriteManagerPlayer);\n } else {\n this.spriteManagerPlayer = new SpriteManager(\"playerManager\",\"./assets/textures/anon_sprite.png\", 1, {width: 290, height: 290}, this.gameInstance.scene);\n this.sprite = new Sprite(\"player_\"+playerModel_.id, this.spriteManagerPlayer);\n }\n \n\n this.sprite.width = 6;\n this.sprite.height = 6;\n\n this.sprite.position.x = this.playerModel .position_x * size_;\n this.sprite.position.z = this.playerModel .position_y * size_;\n this.sprite.position.y = 3;\n\n //Display player UI\n this.playerMesh = MeshBuilder.CreateBox( this.dictKey+\"_\"+playerModel_.id, {size: size_*0.5}, this.gameInstance.scene); \n this.playerMesh.position.y = size_ *0.5;\n this.playerMesh.position.x = this.playerModel.position_x * size_;\n this.playerMesh.position.z = this.playerModel.position_y * size_;\n this.playerMesh.visibility = 0;\n\n /*\n this.uiAdvancedTexture = BABYLON.GUI.AdvancedDynamicTexture.CreateFullscreenUI(\"UI\");\n this.uiAdvancedTexture.is3D = false;\n this.rectUI = new BABYLON.GUI.Rectangle();\n this.rectUI.width = 0.1;\n this.rectUI.height = 0.05;\n this.rectUI.fontFamily = \"Courier New, Courier, monospace\";\n this.rectUI.cornerRadius = 10;\n this.rectUI.color = \"Grey\";\n this.rectUI.background = \"#161616\";\n this.uiAdvancedTexture.addControl(this.rectUI);\n this.label = new BABYLON.GUI.TextBlock();\n this.label.text = \"#\"+this.playerModel.id+\"\\n💬\"+this.playerModel.talk;\n this.rectUI.addControl(this.label);\n this.rectUI.linkWithMesh( this.playerMesh); \n this.rectUI.linkOffsetY = -60;\n this.rectUI.linkOffsetX = 0;\n this.uiAdvancedTexture.freeze = true;*/\n\n return this;\n\n }\n\n public updatePlayerModel(model_: PlayerModel){\n\n this.playerModel = model_;\n let y = this.size *0.5;\n let x = this.playerModel.position_x * this.size ;\n let z = this.playerModel.position_y * this.size ;\n\n //this.playerMesh.locallyTranslate(new BABYLON.Vector3(x, y, z));\n \n let ySprite = 3;\n\n if(this.sprite != null){\n this.sprite.position.x = x;\n this.sprite.position.z = z;\n this.sprite.position.y = ySprite;\n }\n\n if(this.playerMesh != null){\n this.playerMesh.position.x = x;\n this.playerMesh.position.y = y;\n this.playerMesh.position.z = z;\n }\n\n //this.label.text = \"#\"+this.playerModel.id+\"\\n💬\"+this.playerModel.talk;\n }\n\n public clean(){\n\n this.spriteManagerPlayer.dispose();\n if(this.playerMesh != null) this.playerMesh.dispose();\n this.sprite.dispose();\n\n this.spriteManagerPlayer = null;\n this.playerMesh = null;\n this.sprite = null;\n /*\n this.rectUI.dispose();\n this.label.dispose();\n this.uiAdvancedTexture.dispose();*/\n\n }\n\n}","import {\n Engine, Scene,FreeCamera, Light,\n DirectionalLight, HemisphericLight, ShadowGenerator,\n Color4, Color3Gradient, Mesh,\n Vector3, MeshBuilder, ArcRotateCamera,\n StandardMaterial, Texture, Color3\n} from 'babylonjs'\n\nimport { Game } from \"./game\";\nimport { GameUtils } from \"./gameUtils\";\nimport { Helpers } from \"../utils/helpers\";\nimport { GameUIServiceService } from '../services/game-uiservice.service';\nimport { PlayerModel } from '../models/player.model';\nimport { MapMaker } from './mapMaker';\n\nexport class PlayerMotor {\n\n private gameInstance : Game;\n private static _instance : PlayerMotor;\n public playerBox : BABYLON.Mesh;\n\n //Properties for cam\n private playerHeight = 4; // The player eyes height\n private speed = 1;\n private inertia = 0.9;\n private angularSensibility = 1000;\n private angularSensibilityMobile = 13000;\n public playerModel : PlayerModel;\n\n private playerRotation;\n private joystickMoveSpeedY = 18;\n private joystickMoveSpeedX = 0.9;\n private isJoystick = false;\n\n static getInstance() {\n return this._instance || (this._instance = new this());\n }\n\n constructor() {\n\n }\n\n initMotor(){\n this.gameInstance = Game.getInstance();\n this.gameInstance.gameUIServiceService.changeStateEmitter.subscribe((state_)=>{\n console.log(state_);\n if(state_ === GameUIServiceService.STATE_GAME_RUNNING) {\n this.activateMotion(true);\n } else {\n this.activateMotion(false);\n }\n });\n\n this.gameInstance.camera = new BABYLON.FreeCamera('freeCamera', new BABYLON.Vector3(0, 5,-10), this.gameInstance.scene);\n this.activateMotion(true);\n }\n\n activateMotion(val_: boolean){\n if(val_){\n\n //Free cam\n this.gameInstance.camera.attachControl(this.gameInstance.scene.getEngine().getRenderingCanvas());\n\n // Activate gravity !\n //https://doc.babylonjs.com/babylon101/cameras,_mesh_collisions_and_gravity\n this.gameInstance.scene.gravity = new BABYLON.Vector3(0, -0.7, 0);\n this.gameInstance.camera.applyGravity = true;\n\n this.gameInstance.camera.ellipsoid = new BABYLON.Vector3(2.5, this.playerHeight, 2.5);\n this.gameInstance.camera.ellipsoidOffset = new BABYLON.Vector3(0, this.playerHeight, 0);\n this.gameInstance.camera.checkCollisions = true;\n \n GameUtils.setKeyBoardMapping(this.gameInstance);\n\n this.gameInstance.camera.speed = this.speed;\n this.gameInstance.camera.inertia = this.inertia;\n this.gameInstance.camera.angularSensibility = ( Helpers.isMobile())? this.angularSensibilityMobile : this.angularSensibility;\n\n } else {\n this.gameInstance.camera.detachControl(this.gameInstance.scene.getEngine().getRenderingCanvas());\n }\n }\n\n /*******************\n * PLACE THE PLAYER\n ******************/\n\n setPlayerPos(playerData_){\n\n //console.log(this.playerRotation );\n this.playerModel = playerData_;\n\n //convert teh X + y in position\n //console.log(\"playerPosY= \"+this.playerModel.position_x+\"; playerPosX= \"+this.playerModel.position_y);\n\n //Placing the player\n this.gameInstance.camera.position.x = this.playerModel.position_x * MapMaker.TILE_SIZE;\n this.gameInstance.camera.position.z = this.playerModel.position_y * MapMaker.TILE_SIZE;\n\n if(this.playerRotation != null) this.gameInstance.camera.rotation = this.playerRotation;\n }\n\n savePlayerRotation(){\n //We memorize the player rotation\n this.playerRotation = this.gameInstance.camera.rotation;\n }\n\n getPlayerPos(){\n\n if(this.playerModel == null){\n this.playerModel = new PlayerModel();\n this.playerModel.position_x = -1;\n this.playerModel.position_y = -1;\n } else {\n this.playerModel.position_x = this.gameInstance.camera.position.x / MapMaker.TILE_SIZE;\n this.playerModel.position_y = this.gameInstance.camera.position.z / MapMaker.TILE_SIZE;\n }\n \n\n return this.playerModel;\n }\n \n public activeJoystick(){\n\n this.isJoystick = true;\n let rightJoystick = new BABYLON.VirtualJoystick(false);\n \n this.gameInstance.scene.onBeforeRenderObservable.add(()=>{\n if(rightJoystick.pressed){\n\n //OLD position\n let moveY = rightJoystick.deltaPosition.y * (this.gameInstance.engine.getDeltaTime()/1000) * this.joystickMoveSpeedY;\n \n this.gameInstance.camera.position.z += moveY * Math.cos( this.gameInstance.camera.rotation.y );\n this.gameInstance.camera.position.x += moveY * Math.sin( this.gameInstance.camera.rotation.y );\n\n let moveX = rightJoystick.deltaPosition.x * (this.gameInstance.engine.getDeltaTime()/1000) * this.joystickMoveSpeedX;\n this.gameInstance.camera.rotation.y += moveX;\n }\n });\n \n }\n}","import {\n Engine, Scene,FreeCamera, Light,\n DirectionalLight, HemisphericLight, ShadowGenerator,\n Color4, Color3Gradient,\n Mesh,\n Vector3, MeshBuilder,\n ArcRotateCamera, StandardMaterial, Texture,\n Color3, SpriteManager, Sprite\n } from 'babylonjs';\n\n import * as BABYLON from 'babylonjs';\n\nimport { Game } from \"./game\";\nimport { MapMaker } from \"./mapMaker\";\nimport { CanvasPlane } from \"./canvasPlane\";\nimport { Door } from './door';\nimport { Gate } from './gate';\n\n\nexport class Tile {\n\n public static get TILE_EMPTY():number { return -1; }\n public static get TILE_GROUND():number { return 0; }\n public static get TILE_WALL():number { return 1; }\n public static get TILE_GATES():number { return 3; }\n public static get TILE_DOOR():number { return 4; }\n public static get TILE_DOOR_SECRET():number { return 5; }\n public static get TILE_LADDER():number { return 66; }\n public static get TILE_GRASS():number { return 7; }\n //public static get TILE_ADVERTISEMENT():number { return 12; }\n public static get TILE_START():number { return 13; }\n public static get TILE_GATES_SECRET():number { return 14; }\n \n\n public static meshGroundInstance: Mesh;\n public static meshGrassInstance: Mesh;\n public static meshWallInstance: Mesh;\n\n private gameInstance : Game;\n private mapInstance : MapMaker;\n private box : BABYLON.Mesh;\n private door : BABYLON.Mesh;\n\n //Type of tile\n private tileCoordonates: number[];\n\n constructor(type_, size, x: number,y: number,z: number, val_: string) {\n\n let type = parseInt(type_);\n this.tileCoordonates = [x, y, z];\n x = x*size;\n y = y*size;\n z = z*size;\n\n this.gameInstance = Game.getInstance();\n this.mapInstance = MapMaker.getInstance();\n\n if(type === Tile.TILE_WALL){\n\n this.box = this.getMeshWall(size);\n this.box.position.y = size * 0.5 + y;\n this.box.position.x = x;\n this.box.position.z = z;\n\n new CanvasPlane(\"canvas\",this.tileCoordonates[0]+\"_\"+this.tileCoordonates[1]+\"_\"+this.tileCoordonates[2], size, x, y, z, this.mapInstance.DIR_N);\n new CanvasPlane(\"canvas\",this.tileCoordonates[0]+\"_\"+this.tileCoordonates[1]+\"_\"+this.tileCoordonates[2], size, x, y, z, this.mapInstance.DIR_E);\n new CanvasPlane(\"canvas\",this.tileCoordonates[0]+\"_\"+this.tileCoordonates[1]+\"_\"+this.tileCoordonates[2], size, x, y, z, this.mapInstance.DIR_S);\n new CanvasPlane(\"canvas\",this.tileCoordonates[0]+\"_\"+this.tileCoordonates[1]+\"_\"+this.tileCoordonates[2], size, x, y, z, this.mapInstance.DIR_W);\n\n } else if(type === Tile.TILE_GROUND || type === Tile.TILE_START) {\n\n this.box = this.getMeshGround(size,\"./assets/textures/floor_dalle_text.jpg\");\n this.box.position.y = -size * 0.5 + y;\n this.box.position.x = x;\n this.box.position.z = z;\n this.mapInstance.addMeshToCluster(this.box,type);\n \n } else if(type === Tile.TILE_GRASS) {\n\n this.box = this.getMeshGrass(size,\"./assets/textures/grass_text.jpg\");\n this.box.position.y = -size * 0.5 + y;\n this.box.position.x = x;\n this.box.position.z = z;\n this.mapInstance.addMeshToCluster(this.box,type);\n\n } else if(type === Tile.TILE_LADDER) {\n\n console.log(\"GOT LADDER!\");\n this.box = this.getMeshLadder(size);\n this.box.position.y = size * 0.5 + y;\n this.box.position.x = x;\n this.box.position.z = z;\n this.mapInstance.addMeshToCluster(this.box,type);\n\n } else if(type === Tile.TILE_GATES || type === Tile.TILE_GATES_SECRET) {\n console.log(\"GOT GATES!\");\n\n //Create the ground\n this.box = this.getMeshGround(size, \"./assets/textures/floor_dalle_text.jpg\");\n this.box.position.y = -size * 0.5 + y;\n this.box.position.x = x;\n this.box.position.z = z;\n this.mapInstance.addMeshToCluster(this.box,Tile.TILE_GROUND);\n\n this.door = this.getMeshGate(size,x,y,z,val_);\n this.door.position.y = size * 0.5 + y;\n this.door.position.x = x;\n this.door.position.z = z;\n\n } else if(type === Tile.TILE_DOOR) {\n console.log(\"GOT DOOR!\");\n\n //Create the ground\n this.box = this.getMeshGround(size, \"./assets/textures/floor_dalle_text.jpg\");\n this.box.position.y = -size * 0.5 + y;\n this.box.position.x = x;\n this.box.position.z = z;\n this.mapInstance.addMeshToCluster(this.box,Tile.TILE_GROUND);\n\n this.door = this.getMeshDoor(size,x,y,z,false);\n this.door.position.y = size * 0.5 + y;\n this.door.position.x = x;\n this.door.position.z = z;\n\n } else if(type === Tile.TILE_DOOR_SECRET) {\n console.log(\"GOT DOOR!\");\n \n //Create the ground\n this.box = this.getMeshGround(size,\"./assets/textures/floor_dalle_text.jpg\");\n this.box.position.y = -size * 0.5 + y;\n this.box.position.x = x;\n this.box.position.z = z;\n this.mapInstance.addMeshToCluster(this.box,Tile.TILE_GROUND);\n \n this.door = this.getMeshDoor(size,x,y,z,true);\n this.door.position.y = size * 0.5 + y;\n this.door.position.x = x;\n this.door.position.z = z;\n } else {\n console.log(\"type not found! type \"+type);\n }\n \n\n /*\n \n this.gameInstance.shadowGen.getShadowMap().renderList.push( this.box );\n this.box.receiveShadows = true;*/\n }\n\n getMeshGround(size_,text_){\n\n if(!Tile.meshGroundInstance){\n\n let mesh = BABYLON.MeshBuilder.CreateBox(\"groundTile\", {size: size_}, this.gameInstance.scene);\n mesh.checkCollisions = true;\n \n let mat = new StandardMaterial(\"matGround\", this.gameInstance.scene);\n let textureBox = new Texture(text_, this.gameInstance.scene);\n mat.diffuseTexture = textureBox;\n mat.diffuseTexture.scale(1/4) ;\n mesh.material = mat;\n Tile.meshGroundInstance = mesh;\n this.gameInstance.setShadow(mesh);\n mat.freeze();\n mesh.convertToUnIndexedMesh();\n mesh.freezeWorldMatrix();\n }\n\n return Tile.meshGroundInstance.clone(\"Box Ground\");\n }\n\n getMeshGrass(size_,text_){\n\n if(!Tile.meshGrassInstance){\n\n let mesh = BABYLON.MeshBuilder.CreateBox(\"grassTile\", {size: size_}, this.gameInstance.scene);\n mesh.checkCollisions = true;\n \n let mat = new StandardMaterial(\"matGrass\", this.gameInstance.scene);\n let textureBox = new Texture(text_, this.gameInstance.scene);\n mat.diffuseTexture = textureBox;\n mat.diffuseTexture.scale(1/4) ;\n mesh.material = mat;\n Tile.meshGrassInstance = mesh;\n this.gameInstance.setShadow(mesh);\n mat.freeze();\n mesh.convertToUnIndexedMesh();\n mesh.freezeWorldMatrix();\n }\n\n return Tile.meshGrassInstance.clone(\"Box Grass\");\n }\n\n\n getMeshWall(size_){\n\n if(!Tile.meshWallInstance ){\n\n let mesh = MeshBuilder.CreateBox(\"myBox\", {size: size_}, this.gameInstance.scene);\n mesh.checkCollisions = true;\n let mat = new StandardMaterial(\"matBox\", this.gameInstance.scene);\n let textureBox = new Texture(\"./assets/textures/concrete_text.jpg\", this.gameInstance.scene);\n mat.diffuseTexture = textureBox;\n mesh.material = mat;\n Tile.meshWallInstance = mesh;\n this.gameInstance.setShadow(mesh);\n mat.freeze();\n mesh.convertToUnIndexedMesh();\n mesh.freezeWorldMatrix();\n \n }\n\n return Tile.meshWallInstance.clone(\"groundTile\");\n }\n /*\n getMeshAd(size_){\n\n let mesh = MeshBuilder.CreateBox(\"myBox\", {size: size_}, this.gameInstance.scene);\n mesh.checkCollisions = true;\n let mat = new StandardMaterial(\"matBoxLadder\", this.gameInstance.scene);\n mat.diffuseColor = BABYLON.Color3.Black();\n mesh.material = mat;\n mesh.convertToUnIndexedMesh();\n mat.freeze();\n\n return mesh;\n }*/\n\n getMeshLadder(size_){\n let mesh = MeshBuilder.CreateBox(\"ladder\", {size: size_}, this.gameInstance.scene);\n mesh.checkCollisions = true;\n let mat = new StandardMaterial(\"matBoxLadder\", this.gameInstance.scene);\n mat.diffuseColor = BABYLON.Color3.Red();\n mesh.material = mat;\n mesh.convertToUnIndexedMesh();\n mat.freeze();\n return mesh;\n }\n\n getMeshDoor(size_,x_,y_,z_, secret_){\n let door = new Door(this.tileCoordonates[0]+\"_\"+this.tileCoordonates[1]+\"_\"+this.tileCoordonates[2], size_, x_, y_, z_, secret_);\n return door.doorMesh;\n }\n\n getMeshGate(size_,x_,y_,z_, key_){\n let gate = new Gate(this.tileCoordonates[0]+\"_\"+this.tileCoordonates[1]+\"_\"+this.tileCoordonates[2], size_, x_, y_, z_,key_);\n return gate.doorMesh;\n }\n\n}","import { Injectable } from '@angular/core';\nimport { environment } from '../../environments/environment';\nimport { HttpClient, HttpParams, HttpHeaders } from '@angular/common/http';\nimport{ GameDataResponseModel } from '../models/game-data.response.model';\nimport{ PostStuffResponseModel } from '../models/postStuff.response.model';\nimport{ AdminResponseModel} from '../models/admin.response.model';\nimport{ GenericResponseModel } from '../models/generic.response.model';\nimport{ PostListResponseModel} from '../models/post-list.response.model';\n\nimport { PostModel } from '../models/post.model';\nimport { ActionModel } from '../models/action.model';\nimport { AllPostResponseModel } from '../models/all-post.response.model'\nimport { AllMapResponseModel } from '../models/all-map.response.model'\nimport { PlayerResponseModel } from '../models/player.response.model';\nimport {AllTilesResponseModel} from '../models/all-tiles.response.model';\nimport { PlayerModel } from '../models/player.model';\nimport { MapModel } from '../models/map.model';\nimport { OfflineService } from './offline.service';\nimport { AdvertisementModel } from '../models/advertisement.model';\n\n\n@Injectable({\n providedIn: 'root'\n})\nexport class ChanWebService {\n\n serverUrl : string = environment.apiUrl;\n //playerData : PlayerModel;\n\n constructor(private http:HttpClient, private offlineService: OfflineService) {}\n\n/***********************\n * CHAN/POST WEBSERVICE\n **********************/\n\n //Init the server URL for the WS\n setServerUrl( url ){\n this.serverUrl = url;\n }\n\n //Get thread posts list\n getMapPostList(playerX_, playerY_, name_, talk_){\n let body = new HttpParams();\n body = this.addPlayerParams(body);\n body = body.append('action', 'getMapPosts');\n body = body.append('position_x', playerX_);\n body = body.append('position_y', playerY_);\n body = body.append('name', name_);\n body = body.append('talk', talk_);\n return this.http.post(this.serverUrl+'ChanWebService.php',body);\n }\n\n//Get thread posts list\ngetCanvasPostList(mapKey, canvasKey){\n let body = new HttpParams();\n body = this.addPlayerParams(body);\n body = body.append('action', 'getPostsByCanvas');\n body = body.append('map_key', mapKey);\n body = body.append('canvas_key', canvasKey);\n return this.http.post(this.serverUrl+'ChanWebService.php',body);\n}\n\n//Get thread posts list\ngetReplyPostList(id_){\n let body = new HttpParams();\n body = this.addPlayerParams(body);\n body = body.append('action', 'getReplies');\n body = body.append('post_id', id_);\n return this.http.post(this.serverUrl+'ChanWebService.php',body);\n}\n\n//Create post\ncreatePost(post_ : PostModel){\n\n let body = new HttpParams();\n body = this.addPlayerParams(body);\n body = body.append('action', 'createPost');\n body = body.append('url', post_.url);\n body = body.append('message', post_.message);\n body = body.append('canvas_key', post_.canvas_key);\n body = body.append('map_key', post_.map_key);\n body = body.append('reply', post_.reply.toString());\n\n //body = body.set('action' , 'createThread');\n return this.http.post(this.serverUrl+'ChanWebService.php',body);\n\n}\n\ncreateLog(action_: ActionModel){\n let body = new HttpParams();\n body = this.addPlayerParams(body);\n body = body.append('action', 'setAction');\n body = body.append('player_action', action_.action);\n body = body.append('value', action_.value);\n return this.http.post(this.serverUrl+'ChanWebService.php',body);\n}\n\ncreateAndUploadPaint(post_ : PostModel, imageData_ ){\n \n let body = new HttpParams();\n body = this.addPlayerParams(body);\n body = body.append('action', 'createPost');\n body = body.append('message', post_.message);\n body = body.append('canvas_key', post_.canvas_key);\n body = body.append('map_key', post_.map_key);\n body = body.append('reply', post_.reply.toString());\n body = body.append('image_data', imageData_);\n body = body.append('graffiti', post_.graffiti.toString());\n\n let headers = new HttpHeaders();\n headers.append(\"Content-Type\", \"application/x-www-form-urlencoded\");\n\n //http://j-query.blogspot.com/2011/02/save-base64-encoded-canvas-image-to-png.html\n\n //body = body.set('action' , 'createThread');\n return this.http.post(this.serverUrl+'ChanWebService.php',body);\n}\n\n/***********************\n * PLAYER WEBSERVICE\n **********************/\n\n//Get thread posts list\n/*setMap(mapKey){\n\n let body = new HttpParams();\n body = this.addPlayerParams(body);\n body = body.append('map_key', mapKey);\n body = body.append('action', 'changeMapPlayer');\n return this.http.post(this.serverUrl+'ChanWebService.php',body);\n\n}*/\n\nchangeMapPlayerName(mapName){\n\n let body = new HttpParams();\n body = this.addPlayerParams(body);\n body = body.append('map_name', mapName);\n body = body.append('action', 'changeMapPlayerName');\n return this.http.post(this.serverUrl+'ChanWebService.php',body);\n\n}\n\nchangeMapRandom(isSecret_){\n\n let body = new HttpParams();\n body = this.addPlayerParams(body);\n body = body.append('secret', isSecret_);\n body = body.append('action', 'changeMapRandom');\n return this.http.post(this.serverUrl+'ChanWebService.php',body);\n\n}\n\ngetItem(itemKey){\n\n let body = new HttpParams();\n body = this.addPlayerParams(body);\n body = body.append('item_key', itemKey);\n body = body.append('action', 'setPlayerItem');\n return this.http.post(this.serverUrl+'ChanWebService.php',body);\n\n}\n\naddPlayerParams(body_: HttpParams){\n let playerData: PlayerModel = this.offlineService.getPlayerData();\n body_ = body_.append('player_id',playerData.id.toString());\n body_ = body_.append('player_key',playerData.player_key);\n return body_;\n}\n\ncreateUser(anonId, anonToken, password, mapKey){\n let body = new HttpParams();\n body = body.append('action', 'initPlayer');\n if(anonId) body = body.append('player_id', anonId);\n if(anonToken) body = body.append('player_key', anonToken);\n if(password) body = body.append('player_password', password);\n if(mapKey) body = body.append('map_key', mapKey);\n return this.http.post(this.serverUrl+'ChanWebService.php',body);\n}\n\n\ngetAds(){\n return this.http.get('./assets/amaz/amaz.json');\n}\n\n/***********************\n * ADMIN WEBSERVICE\n **********************/\n\ndeletePost(postId_,threadId_){\n let body = new HttpParams();\n body = this.addPlayerParams(body);\n body = body.append('action', 'deletePost');\n body = body.append('post_id', postId_.toString());\n body = body.append('map_key', threadId_);\n\n return this.http.post(this.serverUrl+'ChanWebService.php',body);\n }\n\n\n \n setPostUrlToFile(postId_){\n let body = new HttpParams();\n body = this.addPlayerParams(body);\n body = body.append('action', 'setPostUrlToFile');\n body = body.append('post_id', postId_.toString());\n\n return this.http.post(this.serverUrl+'ChanWebService.php',body);\n }\n\n deletePostForVal(val_){\n let body = new HttpParams();\n body = this.addPlayerParams(body);\n body = body.append('action', 'deletePostForVal');\n body = body.append('val',val_);\n\n return this.http.post(this.serverUrl+'ChanWebService.php',body);\n }\n\n setBan(id_){\n let body = new HttpParams();\n body = this.addPlayerParams(body);\n body = body.append('action', 'setBan');\n body = body.append('post_id',id_);\n\n return this.http.post(this.serverUrl+'ChanWebService.php',body);\n }\n\n canonPost(postId_,threadId_){\n let body = new HttpParams();\n body = this.addPlayerParams(body);\n body = body.append('action', 'setPostCanon');\n body = body.append('post_id', postId_.toString());\n body = body.append('map_key', threadId_);\n\n return this.http.post(this.serverUrl+'ChanWebService.php',body);\n }\n\n isAdminConnected(){\n let body = new HttpParams();\n body = body.append('action', 'testAdminSession');\n return this.http.post(this.serverUrl+'ChanWebService.php',body);\n }\n\n connectAdmin(password_){\n let body = new HttpParams();\n body = body.append('action', 'validAdmin');\n body = body.append('password', password_);\n return this.http.post(this.serverUrl+'ChanWebService.php',body);\n }\n\n setAdminPassword(password_){\n let body = new HttpParams();\n body = body.append('action', 'setAdminPassword');\n body = body.append('password', password_);\n return this.http.post(this.serverUrl+'ChanWebService.php',body);\n }\n\n logout(){\n let body = new HttpParams();\n body = body.append('action', 'unLog');\n return this.http.post(this.serverUrl+'ChanWebService.php',body);\n }\n\n getAllPost(){\n let body = new HttpParams();\n body = this.addPlayerParams(body);\n body = body.append('action', 'getAllPost');\n return this.http.post(this.serverUrl+'ChanWebService.php',body);\n }\n\n getAllMaps(){\n let body = new HttpParams();\n body = this.addPlayerParams(body);\n body = body.append('action', 'getAllMaps');\n return this.http.post(this.serverUrl+'ChanWebService.php',body);\n }\n\ngetAllTiles(){\n let body = new HttpParams();\n body = this.addPlayerParams(body);\n body = body.append('action', 'getAllTiles');\n return this.http.post(this.serverUrl+'ChanWebService.php',body);\n}\n\nsaveMapModel(map_: MapModel){\n let body = new HttpParams();\n body = this.addPlayerParams(body);\n body = body.append('action', 'saveMapModel');\n\n body = body.append('id', map_.id.toString());\n body = body.append('key', map_.key);\n body = body.append('name', map_.name);\n body = body.append('theme', map_.theme);\n body = body.append('x', map_.x.toString());\n body = body.append('y', map_.y.toString());\n body = body.append('door_key_n', map_.door_key_n);\n body = body.append('door_key_e', map_.door_key_e);\n body = body.append('door_key_s', map_.door_key_s);\n body = body.append('door_key_w', map_.door_key_w);\n\n body = body.append('level_data', map_.level_data);\n\n body = body.append('height', map_.height.toString());\n body = body.append('width', map_.width.toString());\n\n return this.http.post(this.serverUrl+'ChanWebService.php',body);\n}\n\n\n}\n","import { Injectable, EventEmitter } from '@angular/core';\nimport { InteractionModel } from '../models/interaction-model';\nimport { PlayerModel } from '../models/player.model';\nimport { PostModel} from '../models/post.model';\nimport { ConfigModel } from '../models/config.model';\nimport ItemModel from '../models/item.model';\nimport { GameDataModel } from '../models/game-data.model';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class GameUIServiceService {\n\n public changeStateEmitter = new EventEmitter();\n //public changePlayerDataEmitter = new EventEmitter();\n //public changeItemsDataEmitter = new EventEmitter();\n public changeGameDataEmitter = new EventEmitter();\n public changeConfigEmitter = new EventEmitter();\n public sendInteractionsEmitter = new EventEmitter();\n public postArtCanvasEmitter = new EventEmitter();\n public deletePostEmitter = new EventEmitter();\n\n public static get STATE_GAME_RUNNING():number { return 0; }\n public static get STATE_POSTING_UI():number { return 1; }\n public static get STATE_POST_VIEWER_UI():number { return 2; }\n public static get STATE_POSTING_LOADING():number { return 3; }\n public static get STATE_PAINTING_UI():number { return 4; }\n public static get STATE_CMD_UI():number { return 5; }\n public static get STATE_INFO_UI():number { return 6; }\n public static get STATE_ITEMS_UI():number { return 7; }\n public static get STATE_NO_PLAYER():number { return 8; }\n public static get STATE_PLAYER_UI():number { return 9; }\n\n public forceWSEmitter = new EventEmitter();\n\n\n private gameState : number =  GameUIServiceService.STATE_GAME_RUNNING;\n\n constructor() {\n\n }\n\n public changeState( state_ : number){\n this.gameState = state_;\n this.changeStateEmitter.emit( this.gameState);\n }\n\n public sendInteraction(interact_ : InteractionModel){\n this.sendInteractionsEmitter.emit( interact_);\n }\n\n public sendPost(post_ : PostModel){\n this.postArtCanvasEmitter.emit( post_);\n }\n\n public updateGameData(gameData_ : GameDataModel){\n this.changeGameDataEmitter.emit( gameData_ );\n }\n\n /*\n public updatePlayerData(playerData_ : PlayerModel){\n this.changePlayerDataEmitter.emit( playerData_);\n }\n\n public updateItemsData(itemsData){\n console.log(itemsData);\n this.changeItemsDataEmitter.emit( {items: itemsData});\n }*/\n\n public updateConfigData(config_ : ConfigModel){\n this.changeConfigEmitter.emit( config_);\n }\n\n public forceWS(){\n this.forceWSEmitter.emit();\n }\n\n public deletePost(post_){\n this.deletePostEmitter.emit(post_);\n }\n\n}\n","import { Injectable } from '@angular/core';\nimport { PlayerModel } from '../models/player.model';\nimport * as localforage from \"localforage\";\nimport { ConfigModel } from '../models/config.model';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class OfflineService {\n\n PLAYER_KEY: string = \"player_one_data2\";\n PLAYER_NAME_KEY: string = \"player_name\";\n KEYBOARD_KEY: string = \"keyboard\";\n CONFIG_KEY: string = \"config_key\";\n CHAN_KEY: string = \"CHAN_KEY3\";\n\n constructor() {\n }\n\n getPlayerData(){\n let data = localStorage.getItem(this.PLAYER_KEY);\n if(data != null ) return JSON.parse(data);\n return new PlayerModel();\n }\n\n savePlayer(player_ : PlayerModel){\n return localStorage.setItem(this.PLAYER_KEY, JSON.stringify(player_));\n }\n\n getPlayerName(){\n let data = localStorage.getItem(this.PLAYER_NAME_KEY);\n if(data != null ) return data;\n let name = Math.random().toString(36).substr(2, 9);\n this.savePlayerName(name);\n return name;\n }\n\n savePlayerName(playerName_){\n return localStorage.setItem(this.PLAYER_NAME_KEY, JSON.stringify(playerName_));\n }\n\n getConfig(){\n let data = localStorage.getItem(this.CONFIG_KEY);\n console.log(\"getConfig\"+data);\n if(data != null ) return JSON.parse(data);\n return new ConfigModel();\n }\n\n saveConfig(config_: ConfigModel){\n localStorage.setItem(this.CONFIG_KEY, JSON.stringify(config_));\n }\n\n getChanData(){\n let data = localStorage.getItem(this.CHAN_KEY);\n if(data != null ) return JSON.parse(data);\n return ['alpha'];\n }\n\n saveChan(chan_ : string){\n let listChan: string[] = this.getChanData();\n for(let c = 0; c < listChan.length; c++){\n if(listChan[c] == chan_) return;\n }\n listChan.push(chan_);\n return localStorage.setItem(this.CHAN_KEY, JSON.stringify(listChan));\n }\n \n /*\n getKeyboard(){\n return localStorage.getItem(this.KEYBOARD_KEY);\n }\n\n saveKeyboard(keyboard_){\n console.log(\"saveKeyboard()\"+keyboard_);\n return localStorage.setItem(this.KEYBOARD_KEY, keyboard_);\n }*/\n}\n","export class Constants{\n\n public static get ITEM_KEY_UPLOAD_RING():string { return \"upload\"; }\n public static get ITEM_KEY_DELETE_SPONGE():string { return \"post delete\"; }\n public static get ITEM_KEY_VARNISH():string { return \"varnish powder\"; } \n\n}","export class Helpers {\n\n /**\n * Determine the mobile operating system.\n * This function returns one of 'iOS', 'Android', 'Windows Phone', or 'unknown'.\n *\n * @returns {Boolean}\n */\n\n public static isMobile() {\n\n let userAgent = navigator.userAgent || navigator.vendor ;\n \n // Windows Phone must come first because its UA also contains \"Android\"\n if (/windows phone/i.test(userAgent)) {\n return true;\n }\n \n if (/android/i.test(userAgent)) {\n return true;\n }\n \n // iOS detection from: http://stackoverflow.com/a/9039885/177710\n if (/iPad|iPhone|iPod/.test(userAgent) ) {\n return true;\n }\n \n return false;\n }\n\n public static antiWord(message_){\n return message_.replace(/nigger/ig, 'noggel');\n }\n\n public static isPT(){\n let lang = navigator.language ; \n return (lang.toLowerCase().indexOf('pt') > -1 || lang.toLowerCase().indexOf('BR') > -1);\n }\n\n}","import { DomSanitizer } from '@angular/platform-browser';\n\nexport class UrlParser {\n\n public url: string;\n public type: number = 0;\n\n public static get TYPE_LINK():number { return 0; }\n public static get TYPE_IMG():number { return 1; }\n public static get TYPE_IMG_GIF():number { return 2; }\n public static get TYPE_MOVIE():number { return 3; }\n public static get TYPE_YOUTUBE():number { return 4; }\n public static get TYPE_MP3():number { return 5; }\n\n constructor(url_ : string){\n this.url = url_;\n this.type = this.getUrlType();\n return this;\n }\n\n public setUrl(url_: string){\n this.url = url_;\n this.type = this.getUrlType();\n return this;\n }\n\n public getUrlType(){\n\n if(this.url != undefined){\n let tempUrl = this.url.toLowerCase();\n if(tempUrl.indexOf(\"png\") > -1 || tempUrl.indexOf(\"jpg\") > -1 || tempUrl.indexOf(\"jpeg\") > -1 || tempUrl.indexOf(\"webp\") > -1 ){\n return UrlParser.TYPE_IMG;\n } else if(tempUrl.indexOf(\"gif\") > -1 ){\n return UrlParser.TYPE_IMG_GIF;\n } else if(tempUrl.indexOf(\".mp4\") > -1 || tempUrl.indexOf(\".webm\") > -1 ){\n return UrlParser.TYPE_MOVIE;\n } else if(tempUrl.indexOf(\"youtube.com\") > -1 || tempUrl.indexOf(\"youtu.be\") > -1 ){\n return UrlParser.TYPE_YOUTUBE;\n } else if(tempUrl.indexOf(\"mp3\") > -1){\n return UrlParser.TYPE_MP3;\n }\n }\n\n return UrlParser.TYPE_LINK;\n }\n\n public getYoutubeId(){\n let regExp = /^.*(youtu\\.be\\/|v\\/|u\\/\\w\\/|embed\\/|watch\\?v=|\\&v=)([^#\\&\\?]*).*/;\n let match = this.url.match(regExp);\n if (match && match[2].length == 11) {\n return match[2];\n } else {\n return \"\";\n }\n }\n\n public getImage(){\n\n if(this.type === UrlParser.TYPE_YOUTUBE){\n //get the preview\n return \"https://img.youtube.com/vi/\"+this.getYoutubeId()+\"/hqdefault.jpg\";\n }\n\n return this.url;\n }\n\n public getSafeTubeURL(sanitizer_ : DomSanitizer){\n let tmpURl;\n if(this.type === UrlParser.TYPE_YOUTUBE){\n //get the preview\n tmpURl = \"https://www.youtube.com/embed/\"+this.getYoutubeId();\n return sanitizer_.bypassSecurityTrustResourceUrl(tmpURl);\n }\n\n return this.url;\n }\n}","// This file can be replaced during build by using the `fileReplacements` array.\n// `ng build --prod` replaces `environment.ts` with `environment.prod.ts`.\n// The list of file replacements can be found in `angular.json`.\n\nexport const environment = {\n production: false,\n apiUrl: 'http://localhost:8888/srv/php/',\n clientUrl: '/',\n};\n\n/*\n * For easier debugging in development mode, you can import the following file\n * to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`.\n *\n * This import should be commented out in production mode because it will have a negative impact\n * on performance if an error is thrown.\n */\n// import 'zone.js/dist/zone-error'; // Included with Angular CLI.\n","import { enableProdMode } from '@angular/core';\nimport { platformBrowserDynamic } from '@angular/platform-browser-dynamic';\n\nimport { AppModule } from './app/app.module';\nimport { environment } from './environments/environment';\n\nif (environment.production) {\n enableProdMode();\n}\n\nplatformBrowserDynamic().bootstrapModule(AppModule)\n .catch(err => console.error(err));\n\n"],"sourceRoot":""} \ No newline at end of file diff --git a/ready2use/polyfills.js b/ready2use/polyfills.js new file mode 100644 index 0000000..62fdbc9 --- /dev/null +++ b/ready2use/polyfills.js @@ -0,0 +1,5781 @@ +(window["webpackJsonp"] = window["webpackJsonp"] || []).push([["polyfills"],{ + +/***/ "./node_modules/core-js/es7/reflect.js": +/*!*********************************************!*\ + !*** ./node_modules/core-js/es7/reflect.js ***! + \*********************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +__webpack_require__(/*! ../modules/es7.reflect.define-metadata */ "./node_modules/core-js/modules/es7.reflect.define-metadata.js"); +__webpack_require__(/*! ../modules/es7.reflect.delete-metadata */ "./node_modules/core-js/modules/es7.reflect.delete-metadata.js"); +__webpack_require__(/*! ../modules/es7.reflect.get-metadata */ "./node_modules/core-js/modules/es7.reflect.get-metadata.js"); +__webpack_require__(/*! ../modules/es7.reflect.get-metadata-keys */ "./node_modules/core-js/modules/es7.reflect.get-metadata-keys.js"); +__webpack_require__(/*! ../modules/es7.reflect.get-own-metadata */ "./node_modules/core-js/modules/es7.reflect.get-own-metadata.js"); +__webpack_require__(/*! ../modules/es7.reflect.get-own-metadata-keys */ "./node_modules/core-js/modules/es7.reflect.get-own-metadata-keys.js"); +__webpack_require__(/*! ../modules/es7.reflect.has-metadata */ "./node_modules/core-js/modules/es7.reflect.has-metadata.js"); +__webpack_require__(/*! ../modules/es7.reflect.has-own-metadata */ "./node_modules/core-js/modules/es7.reflect.has-own-metadata.js"); +__webpack_require__(/*! ../modules/es7.reflect.metadata */ "./node_modules/core-js/modules/es7.reflect.metadata.js"); +module.exports = __webpack_require__(/*! ../modules/_core */ "./node_modules/core-js/modules/_core.js").Reflect; + + +/***/ }), + +/***/ "./node_modules/core-js/modules/_a-function.js": +/*!*****************************************************!*\ + !*** ./node_modules/core-js/modules/_a-function.js ***! + \*****************************************************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +module.exports = function (it) { + if (typeof it != 'function') throw TypeError(it + ' is not a function!'); + return it; +}; + + +/***/ }), + +/***/ "./node_modules/core-js/modules/_an-instance.js": +/*!******************************************************!*\ + !*** ./node_modules/core-js/modules/_an-instance.js ***! + \******************************************************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +module.exports = function (it, Constructor, name, forbiddenField) { + if (!(it instanceof Constructor) || (forbiddenField !== undefined && forbiddenField in it)) { + throw TypeError(name + ': incorrect invocation!'); + } return it; +}; + + +/***/ }), + +/***/ "./node_modules/core-js/modules/_an-object.js": +/*!****************************************************!*\ + !*** ./node_modules/core-js/modules/_an-object.js ***! + \****************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +var isObject = __webpack_require__(/*! ./_is-object */ "./node_modules/core-js/modules/_is-object.js"); +module.exports = function (it) { + if (!isObject(it)) throw TypeError(it + ' is not an object!'); + return it; +}; + + +/***/ }), + +/***/ "./node_modules/core-js/modules/_array-from-iterable.js": +/*!**************************************************************!*\ + !*** ./node_modules/core-js/modules/_array-from-iterable.js ***! + \**************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +var forOf = __webpack_require__(/*! ./_for-of */ "./node_modules/core-js/modules/_for-of.js"); + +module.exports = function (iter, ITERATOR) { + var result = []; + forOf(iter, false, result.push, result, ITERATOR); + return result; +}; + + +/***/ }), + +/***/ "./node_modules/core-js/modules/_array-includes.js": +/*!*********************************************************!*\ + !*** ./node_modules/core-js/modules/_array-includes.js ***! + \*********************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +// false -> Array#indexOf +// true -> Array#includes +var toIObject = __webpack_require__(/*! ./_to-iobject */ "./node_modules/core-js/modules/_to-iobject.js"); +var toLength = __webpack_require__(/*! ./_to-length */ "./node_modules/core-js/modules/_to-length.js"); +var toAbsoluteIndex = __webpack_require__(/*! ./_to-absolute-index */ "./node_modules/core-js/modules/_to-absolute-index.js"); +module.exports = function (IS_INCLUDES) { + return function ($this, el, fromIndex) { + var O = toIObject($this); + var length = toLength(O.length); + var index = toAbsoluteIndex(fromIndex, length); + var value; + // Array#includes uses SameValueZero equality algorithm + // eslint-disable-next-line no-self-compare + if (IS_INCLUDES && el != el) while (length > index) { + value = O[index++]; + // eslint-disable-next-line no-self-compare + if (value != value) return true; + // Array#indexOf ignores holes, Array#includes - not + } else for (;length > index; index++) if (IS_INCLUDES || index in O) { + if (O[index] === el) return IS_INCLUDES || index || 0; + } return !IS_INCLUDES && -1; + }; +}; + + +/***/ }), + +/***/ "./node_modules/core-js/modules/_array-methods.js": +/*!********************************************************!*\ + !*** ./node_modules/core-js/modules/_array-methods.js ***! + \********************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +// 0 -> Array#forEach +// 1 -> Array#map +// 2 -> Array#filter +// 3 -> Array#some +// 4 -> Array#every +// 5 -> Array#find +// 6 -> Array#findIndex +var ctx = __webpack_require__(/*! ./_ctx */ "./node_modules/core-js/modules/_ctx.js"); +var IObject = __webpack_require__(/*! ./_iobject */ "./node_modules/core-js/modules/_iobject.js"); +var toObject = __webpack_require__(/*! ./_to-object */ "./node_modules/core-js/modules/_to-object.js"); +var toLength = __webpack_require__(/*! ./_to-length */ "./node_modules/core-js/modules/_to-length.js"); +var asc = __webpack_require__(/*! ./_array-species-create */ "./node_modules/core-js/modules/_array-species-create.js"); +module.exports = function (TYPE, $create) { + var IS_MAP = TYPE == 1; + var IS_FILTER = TYPE == 2; + var IS_SOME = TYPE == 3; + var IS_EVERY = TYPE == 4; + var IS_FIND_INDEX = TYPE == 6; + var NO_HOLES = TYPE == 5 || IS_FIND_INDEX; + var create = $create || asc; + return function ($this, callbackfn, that) { + var O = toObject($this); + var self = IObject(O); + var f = ctx(callbackfn, that, 3); + var length = toLength(self.length); + var index = 0; + var result = IS_MAP ? create($this, length) : IS_FILTER ? create($this, 0) : undefined; + var val, res; + for (;length > index; index++) if (NO_HOLES || index in self) { + val = self[index]; + res = f(val, index, O); + if (TYPE) { + if (IS_MAP) result[index] = res; // map + else if (res) switch (TYPE) { + case 3: return true; // some + case 5: return val; // find + case 6: return index; // findIndex + case 2: result.push(val); // filter + } else if (IS_EVERY) return false; // every + } + } + return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : result; + }; +}; + + +/***/ }), + +/***/ "./node_modules/core-js/modules/_array-species-constructor.js": +/*!********************************************************************!*\ + !*** ./node_modules/core-js/modules/_array-species-constructor.js ***! + \********************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +var isObject = __webpack_require__(/*! ./_is-object */ "./node_modules/core-js/modules/_is-object.js"); +var isArray = __webpack_require__(/*! ./_is-array */ "./node_modules/core-js/modules/_is-array.js"); +var SPECIES = __webpack_require__(/*! ./_wks */ "./node_modules/core-js/modules/_wks.js")('species'); + +module.exports = function (original) { + var C; + if (isArray(original)) { + C = original.constructor; + // cross-realm fallback + if (typeof C == 'function' && (C === Array || isArray(C.prototype))) C = undefined; + if (isObject(C)) { + C = C[SPECIES]; + if (C === null) C = undefined; + } + } return C === undefined ? Array : C; +}; + + +/***/ }), + +/***/ "./node_modules/core-js/modules/_array-species-create.js": +/*!***************************************************************!*\ + !*** ./node_modules/core-js/modules/_array-species-create.js ***! + \***************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +// 9.4.2.3 ArraySpeciesCreate(originalArray, length) +var speciesConstructor = __webpack_require__(/*! ./_array-species-constructor */ "./node_modules/core-js/modules/_array-species-constructor.js"); + +module.exports = function (original, length) { + return new (speciesConstructor(original))(length); +}; + + +/***/ }), + +/***/ "./node_modules/core-js/modules/_classof.js": +/*!**************************************************!*\ + !*** ./node_modules/core-js/modules/_classof.js ***! + \**************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +// getting tag from 19.1.3.6 Object.prototype.toString() +var cof = __webpack_require__(/*! ./_cof */ "./node_modules/core-js/modules/_cof.js"); +var TAG = __webpack_require__(/*! ./_wks */ "./node_modules/core-js/modules/_wks.js")('toStringTag'); +// ES3 wrong here +var ARG = cof(function () { return arguments; }()) == 'Arguments'; + +// fallback for IE11 Script Access Denied error +var tryGet = function (it, key) { + try { + return it[key]; + } catch (e) { /* empty */ } +}; + +module.exports = function (it) { + var O, T, B; + return it === undefined ? 'Undefined' : it === null ? 'Null' + // @@toStringTag case + : typeof (T = tryGet(O = Object(it), TAG)) == 'string' ? T + // builtinTag case + : ARG ? cof(O) + // ES3 arguments fallback + : (B = cof(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : B; +}; + + +/***/ }), + +/***/ "./node_modules/core-js/modules/_cof.js": +/*!**********************************************!*\ + !*** ./node_modules/core-js/modules/_cof.js ***! + \**********************************************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +var toString = {}.toString; + +module.exports = function (it) { + return toString.call(it).slice(8, -1); +}; + + +/***/ }), + +/***/ "./node_modules/core-js/modules/_collection-strong.js": +/*!************************************************************!*\ + !*** ./node_modules/core-js/modules/_collection-strong.js ***! + \************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +var dP = __webpack_require__(/*! ./_object-dp */ "./node_modules/core-js/modules/_object-dp.js").f; +var create = __webpack_require__(/*! ./_object-create */ "./node_modules/core-js/modules/_object-create.js"); +var redefineAll = __webpack_require__(/*! ./_redefine-all */ "./node_modules/core-js/modules/_redefine-all.js"); +var ctx = __webpack_require__(/*! ./_ctx */ "./node_modules/core-js/modules/_ctx.js"); +var anInstance = __webpack_require__(/*! ./_an-instance */ "./node_modules/core-js/modules/_an-instance.js"); +var forOf = __webpack_require__(/*! ./_for-of */ "./node_modules/core-js/modules/_for-of.js"); +var $iterDefine = __webpack_require__(/*! ./_iter-define */ "./node_modules/core-js/modules/_iter-define.js"); +var step = __webpack_require__(/*! ./_iter-step */ "./node_modules/core-js/modules/_iter-step.js"); +var setSpecies = __webpack_require__(/*! ./_set-species */ "./node_modules/core-js/modules/_set-species.js"); +var DESCRIPTORS = __webpack_require__(/*! ./_descriptors */ "./node_modules/core-js/modules/_descriptors.js"); +var fastKey = __webpack_require__(/*! ./_meta */ "./node_modules/core-js/modules/_meta.js").fastKey; +var validate = __webpack_require__(/*! ./_validate-collection */ "./node_modules/core-js/modules/_validate-collection.js"); +var SIZE = DESCRIPTORS ? '_s' : 'size'; + +var getEntry = function (that, key) { + // fast case + var index = fastKey(key); + var entry; + if (index !== 'F') return that._i[index]; + // frozen object case + for (entry = that._f; entry; entry = entry.n) { + if (entry.k == key) return entry; + } +}; + +module.exports = { + getConstructor: function (wrapper, NAME, IS_MAP, ADDER) { + var C = wrapper(function (that, iterable) { + anInstance(that, C, NAME, '_i'); + that._t = NAME; // collection type + that._i = create(null); // index + that._f = undefined; // first entry + that._l = undefined; // last entry + that[SIZE] = 0; // size + if (iterable != undefined) forOf(iterable, IS_MAP, that[ADDER], that); + }); + redefineAll(C.prototype, { + // 23.1.3.1 Map.prototype.clear() + // 23.2.3.2 Set.prototype.clear() + clear: function clear() { + for (var that = validate(this, NAME), data = that._i, entry = that._f; entry; entry = entry.n) { + entry.r = true; + if (entry.p) entry.p = entry.p.n = undefined; + delete data[entry.i]; + } + that._f = that._l = undefined; + that[SIZE] = 0; + }, + // 23.1.3.3 Map.prototype.delete(key) + // 23.2.3.4 Set.prototype.delete(value) + 'delete': function (key) { + var that = validate(this, NAME); + var entry = getEntry(that, key); + if (entry) { + var next = entry.n; + var prev = entry.p; + delete that._i[entry.i]; + entry.r = true; + if (prev) prev.n = next; + if (next) next.p = prev; + if (that._f == entry) that._f = next; + if (that._l == entry) that._l = prev; + that[SIZE]--; + } return !!entry; + }, + // 23.2.3.6 Set.prototype.forEach(callbackfn, thisArg = undefined) + // 23.1.3.5 Map.prototype.forEach(callbackfn, thisArg = undefined) + forEach: function forEach(callbackfn /* , that = undefined */) { + validate(this, NAME); + var f = ctx(callbackfn, arguments.length > 1 ? arguments[1] : undefined, 3); + var entry; + while (entry = entry ? entry.n : this._f) { + f(entry.v, entry.k, this); + // revert to the last existing entry + while (entry && entry.r) entry = entry.p; + } + }, + // 23.1.3.7 Map.prototype.has(key) + // 23.2.3.7 Set.prototype.has(value) + has: function has(key) { + return !!getEntry(validate(this, NAME), key); + } + }); + if (DESCRIPTORS) dP(C.prototype, 'size', { + get: function () { + return validate(this, NAME)[SIZE]; + } + }); + return C; + }, + def: function (that, key, value) { + var entry = getEntry(that, key); + var prev, index; + // change existing entry + if (entry) { + entry.v = value; + // create new entry + } else { + that._l = entry = { + i: index = fastKey(key, true), // <- index + k: key, // <- key + v: value, // <- value + p: prev = that._l, // <- previous entry + n: undefined, // <- next entry + r: false // <- removed + }; + if (!that._f) that._f = entry; + if (prev) prev.n = entry; + that[SIZE]++; + // add to index + if (index !== 'F') that._i[index] = entry; + } return that; + }, + getEntry: getEntry, + setStrong: function (C, NAME, IS_MAP) { + // add .keys, .values, .entries, [@@iterator] + // 23.1.3.4, 23.1.3.8, 23.1.3.11, 23.1.3.12, 23.2.3.5, 23.2.3.8, 23.2.3.10, 23.2.3.11 + $iterDefine(C, NAME, function (iterated, kind) { + this._t = validate(iterated, NAME); // target + this._k = kind; // kind + this._l = undefined; // previous + }, function () { + var that = this; + var kind = that._k; + var entry = that._l; + // revert to the last existing entry + while (entry && entry.r) entry = entry.p; + // get next entry + if (!that._t || !(that._l = entry = entry ? entry.n : that._t._f)) { + // or finish the iteration + that._t = undefined; + return step(1); + } + // return step by kind + if (kind == 'keys') return step(0, entry.k); + if (kind == 'values') return step(0, entry.v); + return step(0, [entry.k, entry.v]); + }, IS_MAP ? 'entries' : 'values', !IS_MAP, true); + + // add [@@species], 23.1.2.2, 23.2.2.2 + setSpecies(NAME); + } +}; + + +/***/ }), + +/***/ "./node_modules/core-js/modules/_collection-weak.js": +/*!**********************************************************!*\ + !*** ./node_modules/core-js/modules/_collection-weak.js ***! + \**********************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +var redefineAll = __webpack_require__(/*! ./_redefine-all */ "./node_modules/core-js/modules/_redefine-all.js"); +var getWeak = __webpack_require__(/*! ./_meta */ "./node_modules/core-js/modules/_meta.js").getWeak; +var anObject = __webpack_require__(/*! ./_an-object */ "./node_modules/core-js/modules/_an-object.js"); +var isObject = __webpack_require__(/*! ./_is-object */ "./node_modules/core-js/modules/_is-object.js"); +var anInstance = __webpack_require__(/*! ./_an-instance */ "./node_modules/core-js/modules/_an-instance.js"); +var forOf = __webpack_require__(/*! ./_for-of */ "./node_modules/core-js/modules/_for-of.js"); +var createArrayMethod = __webpack_require__(/*! ./_array-methods */ "./node_modules/core-js/modules/_array-methods.js"); +var $has = __webpack_require__(/*! ./_has */ "./node_modules/core-js/modules/_has.js"); +var validate = __webpack_require__(/*! ./_validate-collection */ "./node_modules/core-js/modules/_validate-collection.js"); +var arrayFind = createArrayMethod(5); +var arrayFindIndex = createArrayMethod(6); +var id = 0; + +// fallback for uncaught frozen keys +var uncaughtFrozenStore = function (that) { + return that._l || (that._l = new UncaughtFrozenStore()); +}; +var UncaughtFrozenStore = function () { + this.a = []; +}; +var findUncaughtFrozen = function (store, key) { + return arrayFind(store.a, function (it) { + return it[0] === key; + }); +}; +UncaughtFrozenStore.prototype = { + get: function (key) { + var entry = findUncaughtFrozen(this, key); + if (entry) return entry[1]; + }, + has: function (key) { + return !!findUncaughtFrozen(this, key); + }, + set: function (key, value) { + var entry = findUncaughtFrozen(this, key); + if (entry) entry[1] = value; + else this.a.push([key, value]); + }, + 'delete': function (key) { + var index = arrayFindIndex(this.a, function (it) { + return it[0] === key; + }); + if (~index) this.a.splice(index, 1); + return !!~index; + } +}; + +module.exports = { + getConstructor: function (wrapper, NAME, IS_MAP, ADDER) { + var C = wrapper(function (that, iterable) { + anInstance(that, C, NAME, '_i'); + that._t = NAME; // collection type + that._i = id++; // collection id + that._l = undefined; // leak store for uncaught frozen objects + if (iterable != undefined) forOf(iterable, IS_MAP, that[ADDER], that); + }); + redefineAll(C.prototype, { + // 23.3.3.2 WeakMap.prototype.delete(key) + // 23.4.3.3 WeakSet.prototype.delete(value) + 'delete': function (key) { + if (!isObject(key)) return false; + var data = getWeak(key); + if (data === true) return uncaughtFrozenStore(validate(this, NAME))['delete'](key); + return data && $has(data, this._i) && delete data[this._i]; + }, + // 23.3.3.4 WeakMap.prototype.has(key) + // 23.4.3.4 WeakSet.prototype.has(value) + has: function has(key) { + if (!isObject(key)) return false; + var data = getWeak(key); + if (data === true) return uncaughtFrozenStore(validate(this, NAME)).has(key); + return data && $has(data, this._i); + } + }); + return C; + }, + def: function (that, key, value) { + var data = getWeak(anObject(key), true); + if (data === true) uncaughtFrozenStore(that).set(key, value); + else data[that._i] = value; + return that; + }, + ufstore: uncaughtFrozenStore +}; + + +/***/ }), + +/***/ "./node_modules/core-js/modules/_collection.js": +/*!*****************************************************!*\ + !*** ./node_modules/core-js/modules/_collection.js ***! + \*****************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +var global = __webpack_require__(/*! ./_global */ "./node_modules/core-js/modules/_global.js"); +var $export = __webpack_require__(/*! ./_export */ "./node_modules/core-js/modules/_export.js"); +var redefine = __webpack_require__(/*! ./_redefine */ "./node_modules/core-js/modules/_redefine.js"); +var redefineAll = __webpack_require__(/*! ./_redefine-all */ "./node_modules/core-js/modules/_redefine-all.js"); +var meta = __webpack_require__(/*! ./_meta */ "./node_modules/core-js/modules/_meta.js"); +var forOf = __webpack_require__(/*! ./_for-of */ "./node_modules/core-js/modules/_for-of.js"); +var anInstance = __webpack_require__(/*! ./_an-instance */ "./node_modules/core-js/modules/_an-instance.js"); +var isObject = __webpack_require__(/*! ./_is-object */ "./node_modules/core-js/modules/_is-object.js"); +var fails = __webpack_require__(/*! ./_fails */ "./node_modules/core-js/modules/_fails.js"); +var $iterDetect = __webpack_require__(/*! ./_iter-detect */ "./node_modules/core-js/modules/_iter-detect.js"); +var setToStringTag = __webpack_require__(/*! ./_set-to-string-tag */ "./node_modules/core-js/modules/_set-to-string-tag.js"); +var inheritIfRequired = __webpack_require__(/*! ./_inherit-if-required */ "./node_modules/core-js/modules/_inherit-if-required.js"); + +module.exports = function (NAME, wrapper, methods, common, IS_MAP, IS_WEAK) { + var Base = global[NAME]; + var C = Base; + var ADDER = IS_MAP ? 'set' : 'add'; + var proto = C && C.prototype; + var O = {}; + var fixMethod = function (KEY) { + var fn = proto[KEY]; + redefine(proto, KEY, + KEY == 'delete' ? function (a) { + return IS_WEAK && !isObject(a) ? false : fn.call(this, a === 0 ? 0 : a); + } : KEY == 'has' ? function has(a) { + return IS_WEAK && !isObject(a) ? false : fn.call(this, a === 0 ? 0 : a); + } : KEY == 'get' ? function get(a) { + return IS_WEAK && !isObject(a) ? undefined : fn.call(this, a === 0 ? 0 : a); + } : KEY == 'add' ? function add(a) { fn.call(this, a === 0 ? 0 : a); return this; } + : function set(a, b) { fn.call(this, a === 0 ? 0 : a, b); return this; } + ); + }; + if (typeof C != 'function' || !(IS_WEAK || proto.forEach && !fails(function () { + new C().entries().next(); + }))) { + // create collection constructor + C = common.getConstructor(wrapper, NAME, IS_MAP, ADDER); + redefineAll(C.prototype, methods); + meta.NEED = true; + } else { + var instance = new C(); + // early implementations not supports chaining + var HASNT_CHAINING = instance[ADDER](IS_WEAK ? {} : -0, 1) != instance; + // V8 ~ Chromium 40- weak-collections throws on primitives, but should return false + var THROWS_ON_PRIMITIVES = fails(function () { instance.has(1); }); + // most early implementations doesn't supports iterables, most modern - not close it correctly + var ACCEPT_ITERABLES = $iterDetect(function (iter) { new C(iter); }); // eslint-disable-line no-new + // for early implementations -0 and +0 not the same + var BUGGY_ZERO = !IS_WEAK && fails(function () { + // V8 ~ Chromium 42- fails only with 5+ elements + var $instance = new C(); + var index = 5; + while (index--) $instance[ADDER](index, index); + return !$instance.has(-0); + }); + if (!ACCEPT_ITERABLES) { + C = wrapper(function (target, iterable) { + anInstance(target, C, NAME); + var that = inheritIfRequired(new Base(), target, C); + if (iterable != undefined) forOf(iterable, IS_MAP, that[ADDER], that); + return that; + }); + C.prototype = proto; + proto.constructor = C; + } + if (THROWS_ON_PRIMITIVES || BUGGY_ZERO) { + fixMethod('delete'); + fixMethod('has'); + IS_MAP && fixMethod('get'); + } + if (BUGGY_ZERO || HASNT_CHAINING) fixMethod(ADDER); + // weak collections should not contains .clear method + if (IS_WEAK && proto.clear) delete proto.clear; + } + + setToStringTag(C, NAME); + + O[NAME] = C; + $export($export.G + $export.W + $export.F * (C != Base), O); + + if (!IS_WEAK) common.setStrong(C, NAME, IS_MAP); + + return C; +}; + + +/***/ }), + +/***/ "./node_modules/core-js/modules/_core.js": +/*!***********************************************!*\ + !*** ./node_modules/core-js/modules/_core.js ***! + \***********************************************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +var core = module.exports = { version: '2.6.5' }; +if (typeof __e == 'number') __e = core; // eslint-disable-line no-undef + + +/***/ }), + +/***/ "./node_modules/core-js/modules/_ctx.js": +/*!**********************************************!*\ + !*** ./node_modules/core-js/modules/_ctx.js ***! + \**********************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +// optional / simple context binding +var aFunction = __webpack_require__(/*! ./_a-function */ "./node_modules/core-js/modules/_a-function.js"); +module.exports = function (fn, that, length) { + aFunction(fn); + if (that === undefined) return fn; + switch (length) { + case 1: return function (a) { + return fn.call(that, a); + }; + case 2: return function (a, b) { + return fn.call(that, a, b); + }; + case 3: return function (a, b, c) { + return fn.call(that, a, b, c); + }; + } + return function (/* ...args */) { + return fn.apply(that, arguments); + }; +}; + + +/***/ }), + +/***/ "./node_modules/core-js/modules/_defined.js": +/*!**************************************************!*\ + !*** ./node_modules/core-js/modules/_defined.js ***! + \**************************************************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +// 7.2.1 RequireObjectCoercible(argument) +module.exports = function (it) { + if (it == undefined) throw TypeError("Can't call method on " + it); + return it; +}; + + +/***/ }), + +/***/ "./node_modules/core-js/modules/_descriptors.js": +/*!******************************************************!*\ + !*** ./node_modules/core-js/modules/_descriptors.js ***! + \******************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +// Thank's IE8 for his funny defineProperty +module.exports = !__webpack_require__(/*! ./_fails */ "./node_modules/core-js/modules/_fails.js")(function () { + return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7; +}); + + +/***/ }), + +/***/ "./node_modules/core-js/modules/_dom-create.js": +/*!*****************************************************!*\ + !*** ./node_modules/core-js/modules/_dom-create.js ***! + \*****************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +var isObject = __webpack_require__(/*! ./_is-object */ "./node_modules/core-js/modules/_is-object.js"); +var document = __webpack_require__(/*! ./_global */ "./node_modules/core-js/modules/_global.js").document; +// typeof document.createElement is 'object' in old IE +var is = isObject(document) && isObject(document.createElement); +module.exports = function (it) { + return is ? document.createElement(it) : {}; +}; + + +/***/ }), + +/***/ "./node_modules/core-js/modules/_enum-bug-keys.js": +/*!********************************************************!*\ + !*** ./node_modules/core-js/modules/_enum-bug-keys.js ***! + \********************************************************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +// IE 8- don't enum bug keys +module.exports = ( + 'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf' +).split(','); + + +/***/ }), + +/***/ "./node_modules/core-js/modules/_export.js": +/*!*************************************************!*\ + !*** ./node_modules/core-js/modules/_export.js ***! + \*************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +var global = __webpack_require__(/*! ./_global */ "./node_modules/core-js/modules/_global.js"); +var core = __webpack_require__(/*! ./_core */ "./node_modules/core-js/modules/_core.js"); +var hide = __webpack_require__(/*! ./_hide */ "./node_modules/core-js/modules/_hide.js"); +var redefine = __webpack_require__(/*! ./_redefine */ "./node_modules/core-js/modules/_redefine.js"); +var ctx = __webpack_require__(/*! ./_ctx */ "./node_modules/core-js/modules/_ctx.js"); +var PROTOTYPE = 'prototype'; + +var $export = function (type, name, source) { + var IS_FORCED = type & $export.F; + var IS_GLOBAL = type & $export.G; + var IS_STATIC = type & $export.S; + var IS_PROTO = type & $export.P; + var IS_BIND = type & $export.B; + var target = IS_GLOBAL ? global : IS_STATIC ? global[name] || (global[name] = {}) : (global[name] || {})[PROTOTYPE]; + var exports = IS_GLOBAL ? core : core[name] || (core[name] = {}); + var expProto = exports[PROTOTYPE] || (exports[PROTOTYPE] = {}); + var key, own, out, exp; + if (IS_GLOBAL) source = name; + for (key in source) { + // contains in native + own = !IS_FORCED && target && target[key] !== undefined; + // export native or passed + out = (own ? target : source)[key]; + // bind timers to global for call from export context + exp = IS_BIND && own ? ctx(out, global) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out; + // extend global + if (target) redefine(target, key, out, type & $export.U); + // export + if (exports[key] != out) hide(exports, key, exp); + if (IS_PROTO && expProto[key] != out) expProto[key] = out; + } +}; +global.core = core; +// type bitmap +$export.F = 1; // forced +$export.G = 2; // global +$export.S = 4; // static +$export.P = 8; // proto +$export.B = 16; // bind +$export.W = 32; // wrap +$export.U = 64; // safe +$export.R = 128; // real proto method for `library` +module.exports = $export; + + +/***/ }), + +/***/ "./node_modules/core-js/modules/_fails.js": +/*!************************************************!*\ + !*** ./node_modules/core-js/modules/_fails.js ***! + \************************************************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +module.exports = function (exec) { + try { + return !!exec(); + } catch (e) { + return true; + } +}; + + +/***/ }), + +/***/ "./node_modules/core-js/modules/_for-of.js": +/*!*************************************************!*\ + !*** ./node_modules/core-js/modules/_for-of.js ***! + \*************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +var ctx = __webpack_require__(/*! ./_ctx */ "./node_modules/core-js/modules/_ctx.js"); +var call = __webpack_require__(/*! ./_iter-call */ "./node_modules/core-js/modules/_iter-call.js"); +var isArrayIter = __webpack_require__(/*! ./_is-array-iter */ "./node_modules/core-js/modules/_is-array-iter.js"); +var anObject = __webpack_require__(/*! ./_an-object */ "./node_modules/core-js/modules/_an-object.js"); +var toLength = __webpack_require__(/*! ./_to-length */ "./node_modules/core-js/modules/_to-length.js"); +var getIterFn = __webpack_require__(/*! ./core.get-iterator-method */ "./node_modules/core-js/modules/core.get-iterator-method.js"); +var BREAK = {}; +var RETURN = {}; +var exports = module.exports = function (iterable, entries, fn, that, ITERATOR) { + var iterFn = ITERATOR ? function () { return iterable; } : getIterFn(iterable); + var f = ctx(fn, that, entries ? 2 : 1); + var index = 0; + var length, step, iterator, result; + if (typeof iterFn != 'function') throw TypeError(iterable + ' is not iterable!'); + // fast case for arrays with default iterator + if (isArrayIter(iterFn)) for (length = toLength(iterable.length); length > index; index++) { + result = entries ? f(anObject(step = iterable[index])[0], step[1]) : f(iterable[index]); + if (result === BREAK || result === RETURN) return result; + } else for (iterator = iterFn.call(iterable); !(step = iterator.next()).done;) { + result = call(iterator, f, step.value, entries); + if (result === BREAK || result === RETURN) return result; + } +}; +exports.BREAK = BREAK; +exports.RETURN = RETURN; + + +/***/ }), + +/***/ "./node_modules/core-js/modules/_function-to-string.js": +/*!*************************************************************!*\ + !*** ./node_modules/core-js/modules/_function-to-string.js ***! + \*************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +module.exports = __webpack_require__(/*! ./_shared */ "./node_modules/core-js/modules/_shared.js")('native-function-to-string', Function.toString); + + +/***/ }), + +/***/ "./node_modules/core-js/modules/_global.js": +/*!*************************************************!*\ + !*** ./node_modules/core-js/modules/_global.js ***! + \*************************************************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028 +var global = module.exports = typeof window != 'undefined' && window.Math == Math + ? window : typeof self != 'undefined' && self.Math == Math ? self + // eslint-disable-next-line no-new-func + : Function('return this')(); +if (typeof __g == 'number') __g = global; // eslint-disable-line no-undef + + +/***/ }), + +/***/ "./node_modules/core-js/modules/_has.js": +/*!**********************************************!*\ + !*** ./node_modules/core-js/modules/_has.js ***! + \**********************************************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +var hasOwnProperty = {}.hasOwnProperty; +module.exports = function (it, key) { + return hasOwnProperty.call(it, key); +}; + + +/***/ }), + +/***/ "./node_modules/core-js/modules/_hide.js": +/*!***********************************************!*\ + !*** ./node_modules/core-js/modules/_hide.js ***! + \***********************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +var dP = __webpack_require__(/*! ./_object-dp */ "./node_modules/core-js/modules/_object-dp.js"); +var createDesc = __webpack_require__(/*! ./_property-desc */ "./node_modules/core-js/modules/_property-desc.js"); +module.exports = __webpack_require__(/*! ./_descriptors */ "./node_modules/core-js/modules/_descriptors.js") ? function (object, key, value) { + return dP.f(object, key, createDesc(1, value)); +} : function (object, key, value) { + object[key] = value; + return object; +}; + + +/***/ }), + +/***/ "./node_modules/core-js/modules/_html.js": +/*!***********************************************!*\ + !*** ./node_modules/core-js/modules/_html.js ***! + \***********************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +var document = __webpack_require__(/*! ./_global */ "./node_modules/core-js/modules/_global.js").document; +module.exports = document && document.documentElement; + + +/***/ }), + +/***/ "./node_modules/core-js/modules/_ie8-dom-define.js": +/*!*********************************************************!*\ + !*** ./node_modules/core-js/modules/_ie8-dom-define.js ***! + \*********************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +module.exports = !__webpack_require__(/*! ./_descriptors */ "./node_modules/core-js/modules/_descriptors.js") && !__webpack_require__(/*! ./_fails */ "./node_modules/core-js/modules/_fails.js")(function () { + return Object.defineProperty(__webpack_require__(/*! ./_dom-create */ "./node_modules/core-js/modules/_dom-create.js")('div'), 'a', { get: function () { return 7; } }).a != 7; +}); + + +/***/ }), + +/***/ "./node_modules/core-js/modules/_inherit-if-required.js": +/*!**************************************************************!*\ + !*** ./node_modules/core-js/modules/_inherit-if-required.js ***! + \**************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +var isObject = __webpack_require__(/*! ./_is-object */ "./node_modules/core-js/modules/_is-object.js"); +var setPrototypeOf = __webpack_require__(/*! ./_set-proto */ "./node_modules/core-js/modules/_set-proto.js").set; +module.exports = function (that, target, C) { + var S = target.constructor; + var P; + if (S !== C && typeof S == 'function' && (P = S.prototype) !== C.prototype && isObject(P) && setPrototypeOf) { + setPrototypeOf(that, P); + } return that; +}; + + +/***/ }), + +/***/ "./node_modules/core-js/modules/_iobject.js": +/*!**************************************************!*\ + !*** ./node_modules/core-js/modules/_iobject.js ***! + \**************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +// fallback for non-array-like ES3 and non-enumerable old V8 strings +var cof = __webpack_require__(/*! ./_cof */ "./node_modules/core-js/modules/_cof.js"); +// eslint-disable-next-line no-prototype-builtins +module.exports = Object('z').propertyIsEnumerable(0) ? Object : function (it) { + return cof(it) == 'String' ? it.split('') : Object(it); +}; + + +/***/ }), + +/***/ "./node_modules/core-js/modules/_is-array-iter.js": +/*!********************************************************!*\ + !*** ./node_modules/core-js/modules/_is-array-iter.js ***! + \********************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +// check on default Array iterator +var Iterators = __webpack_require__(/*! ./_iterators */ "./node_modules/core-js/modules/_iterators.js"); +var ITERATOR = __webpack_require__(/*! ./_wks */ "./node_modules/core-js/modules/_wks.js")('iterator'); +var ArrayProto = Array.prototype; + +module.exports = function (it) { + return it !== undefined && (Iterators.Array === it || ArrayProto[ITERATOR] === it); +}; + + +/***/ }), + +/***/ "./node_modules/core-js/modules/_is-array.js": +/*!***************************************************!*\ + !*** ./node_modules/core-js/modules/_is-array.js ***! + \***************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +// 7.2.2 IsArray(argument) +var cof = __webpack_require__(/*! ./_cof */ "./node_modules/core-js/modules/_cof.js"); +module.exports = Array.isArray || function isArray(arg) { + return cof(arg) == 'Array'; +}; + + +/***/ }), + +/***/ "./node_modules/core-js/modules/_is-object.js": +/*!****************************************************!*\ + !*** ./node_modules/core-js/modules/_is-object.js ***! + \****************************************************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +module.exports = function (it) { + return typeof it === 'object' ? it !== null : typeof it === 'function'; +}; + + +/***/ }), + +/***/ "./node_modules/core-js/modules/_iter-call.js": +/*!****************************************************!*\ + !*** ./node_modules/core-js/modules/_iter-call.js ***! + \****************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +// call something on iterator step with safe closing on error +var anObject = __webpack_require__(/*! ./_an-object */ "./node_modules/core-js/modules/_an-object.js"); +module.exports = function (iterator, fn, value, entries) { + try { + return entries ? fn(anObject(value)[0], value[1]) : fn(value); + // 7.4.6 IteratorClose(iterator, completion) + } catch (e) { + var ret = iterator['return']; + if (ret !== undefined) anObject(ret.call(iterator)); + throw e; + } +}; + + +/***/ }), + +/***/ "./node_modules/core-js/modules/_iter-create.js": +/*!******************************************************!*\ + !*** ./node_modules/core-js/modules/_iter-create.js ***! + \******************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +var create = __webpack_require__(/*! ./_object-create */ "./node_modules/core-js/modules/_object-create.js"); +var descriptor = __webpack_require__(/*! ./_property-desc */ "./node_modules/core-js/modules/_property-desc.js"); +var setToStringTag = __webpack_require__(/*! ./_set-to-string-tag */ "./node_modules/core-js/modules/_set-to-string-tag.js"); +var IteratorPrototype = {}; + +// 25.1.2.1.1 %IteratorPrototype%[@@iterator]() +__webpack_require__(/*! ./_hide */ "./node_modules/core-js/modules/_hide.js")(IteratorPrototype, __webpack_require__(/*! ./_wks */ "./node_modules/core-js/modules/_wks.js")('iterator'), function () { return this; }); + +module.exports = function (Constructor, NAME, next) { + Constructor.prototype = create(IteratorPrototype, { next: descriptor(1, next) }); + setToStringTag(Constructor, NAME + ' Iterator'); +}; + + +/***/ }), + +/***/ "./node_modules/core-js/modules/_iter-define.js": +/*!******************************************************!*\ + !*** ./node_modules/core-js/modules/_iter-define.js ***! + \******************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +var LIBRARY = __webpack_require__(/*! ./_library */ "./node_modules/core-js/modules/_library.js"); +var $export = __webpack_require__(/*! ./_export */ "./node_modules/core-js/modules/_export.js"); +var redefine = __webpack_require__(/*! ./_redefine */ "./node_modules/core-js/modules/_redefine.js"); +var hide = __webpack_require__(/*! ./_hide */ "./node_modules/core-js/modules/_hide.js"); +var Iterators = __webpack_require__(/*! ./_iterators */ "./node_modules/core-js/modules/_iterators.js"); +var $iterCreate = __webpack_require__(/*! ./_iter-create */ "./node_modules/core-js/modules/_iter-create.js"); +var setToStringTag = __webpack_require__(/*! ./_set-to-string-tag */ "./node_modules/core-js/modules/_set-to-string-tag.js"); +var getPrototypeOf = __webpack_require__(/*! ./_object-gpo */ "./node_modules/core-js/modules/_object-gpo.js"); +var ITERATOR = __webpack_require__(/*! ./_wks */ "./node_modules/core-js/modules/_wks.js")('iterator'); +var BUGGY = !([].keys && 'next' in [].keys()); // Safari has buggy iterators w/o `next` +var FF_ITERATOR = '@@iterator'; +var KEYS = 'keys'; +var VALUES = 'values'; + +var returnThis = function () { return this; }; + +module.exports = function (Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED) { + $iterCreate(Constructor, NAME, next); + var getMethod = function (kind) { + if (!BUGGY && kind in proto) return proto[kind]; + switch (kind) { + case KEYS: return function keys() { return new Constructor(this, kind); }; + case VALUES: return function values() { return new Constructor(this, kind); }; + } return function entries() { return new Constructor(this, kind); }; + }; + var TAG = NAME + ' Iterator'; + var DEF_VALUES = DEFAULT == VALUES; + var VALUES_BUG = false; + var proto = Base.prototype; + var $native = proto[ITERATOR] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT]; + var $default = $native || getMethod(DEFAULT); + var $entries = DEFAULT ? !DEF_VALUES ? $default : getMethod('entries') : undefined; + var $anyNative = NAME == 'Array' ? proto.entries || $native : $native; + var methods, key, IteratorPrototype; + // Fix native + if ($anyNative) { + IteratorPrototype = getPrototypeOf($anyNative.call(new Base())); + if (IteratorPrototype !== Object.prototype && IteratorPrototype.next) { + // Set @@toStringTag to native iterators + setToStringTag(IteratorPrototype, TAG, true); + // fix for some old engines + if (!LIBRARY && typeof IteratorPrototype[ITERATOR] != 'function') hide(IteratorPrototype, ITERATOR, returnThis); + } + } + // fix Array#{values, @@iterator}.name in V8 / FF + if (DEF_VALUES && $native && $native.name !== VALUES) { + VALUES_BUG = true; + $default = function values() { return $native.call(this); }; + } + // Define iterator + if ((!LIBRARY || FORCED) && (BUGGY || VALUES_BUG || !proto[ITERATOR])) { + hide(proto, ITERATOR, $default); + } + // Plug for library + Iterators[NAME] = $default; + Iterators[TAG] = returnThis; + if (DEFAULT) { + methods = { + values: DEF_VALUES ? $default : getMethod(VALUES), + keys: IS_SET ? $default : getMethod(KEYS), + entries: $entries + }; + if (FORCED) for (key in methods) { + if (!(key in proto)) redefine(proto, key, methods[key]); + } else $export($export.P + $export.F * (BUGGY || VALUES_BUG), NAME, methods); + } + return methods; +}; + + +/***/ }), + +/***/ "./node_modules/core-js/modules/_iter-detect.js": +/*!******************************************************!*\ + !*** ./node_modules/core-js/modules/_iter-detect.js ***! + \******************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +var ITERATOR = __webpack_require__(/*! ./_wks */ "./node_modules/core-js/modules/_wks.js")('iterator'); +var SAFE_CLOSING = false; + +try { + var riter = [7][ITERATOR](); + riter['return'] = function () { SAFE_CLOSING = true; }; + // eslint-disable-next-line no-throw-literal + Array.from(riter, function () { throw 2; }); +} catch (e) { /* empty */ } + +module.exports = function (exec, skipClosing) { + if (!skipClosing && !SAFE_CLOSING) return false; + var safe = false; + try { + var arr = [7]; + var iter = arr[ITERATOR](); + iter.next = function () { return { done: safe = true }; }; + arr[ITERATOR] = function () { return iter; }; + exec(arr); + } catch (e) { /* empty */ } + return safe; +}; + + +/***/ }), + +/***/ "./node_modules/core-js/modules/_iter-step.js": +/*!****************************************************!*\ + !*** ./node_modules/core-js/modules/_iter-step.js ***! + \****************************************************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +module.exports = function (done, value) { + return { value: value, done: !!done }; +}; + + +/***/ }), + +/***/ "./node_modules/core-js/modules/_iterators.js": +/*!****************************************************!*\ + !*** ./node_modules/core-js/modules/_iterators.js ***! + \****************************************************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +module.exports = {}; + + +/***/ }), + +/***/ "./node_modules/core-js/modules/_library.js": +/*!**************************************************!*\ + !*** ./node_modules/core-js/modules/_library.js ***! + \**************************************************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +module.exports = false; + + +/***/ }), + +/***/ "./node_modules/core-js/modules/_meta.js": +/*!***********************************************!*\ + !*** ./node_modules/core-js/modules/_meta.js ***! + \***********************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +var META = __webpack_require__(/*! ./_uid */ "./node_modules/core-js/modules/_uid.js")('meta'); +var isObject = __webpack_require__(/*! ./_is-object */ "./node_modules/core-js/modules/_is-object.js"); +var has = __webpack_require__(/*! ./_has */ "./node_modules/core-js/modules/_has.js"); +var setDesc = __webpack_require__(/*! ./_object-dp */ "./node_modules/core-js/modules/_object-dp.js").f; +var id = 0; +var isExtensible = Object.isExtensible || function () { + return true; +}; +var FREEZE = !__webpack_require__(/*! ./_fails */ "./node_modules/core-js/modules/_fails.js")(function () { + return isExtensible(Object.preventExtensions({})); +}); +var setMeta = function (it) { + setDesc(it, META, { value: { + i: 'O' + ++id, // object ID + w: {} // weak collections IDs + } }); +}; +var fastKey = function (it, create) { + // return primitive with prefix + if (!isObject(it)) return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it; + if (!has(it, META)) { + // can't set metadata to uncaught frozen object + if (!isExtensible(it)) return 'F'; + // not necessary to add metadata + if (!create) return 'E'; + // add missing metadata + setMeta(it); + // return object ID + } return it[META].i; +}; +var getWeak = function (it, create) { + if (!has(it, META)) { + // can't set metadata to uncaught frozen object + if (!isExtensible(it)) return true; + // not necessary to add metadata + if (!create) return false; + // add missing metadata + setMeta(it); + // return hash weak collections IDs + } return it[META].w; +}; +// add metadata on freeze-family methods calling +var onFreeze = function (it) { + if (FREEZE && meta.NEED && isExtensible(it) && !has(it, META)) setMeta(it); + return it; +}; +var meta = module.exports = { + KEY: META, + NEED: false, + fastKey: fastKey, + getWeak: getWeak, + onFreeze: onFreeze +}; + + +/***/ }), + +/***/ "./node_modules/core-js/modules/_metadata.js": +/*!***************************************************!*\ + !*** ./node_modules/core-js/modules/_metadata.js ***! + \***************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +var Map = __webpack_require__(/*! ./es6.map */ "./node_modules/core-js/modules/es6.map.js"); +var $export = __webpack_require__(/*! ./_export */ "./node_modules/core-js/modules/_export.js"); +var shared = __webpack_require__(/*! ./_shared */ "./node_modules/core-js/modules/_shared.js")('metadata'); +var store = shared.store || (shared.store = new (__webpack_require__(/*! ./es6.weak-map */ "./node_modules/core-js/modules/es6.weak-map.js"))()); + +var getOrCreateMetadataMap = function (target, targetKey, create) { + var targetMetadata = store.get(target); + if (!targetMetadata) { + if (!create) return undefined; + store.set(target, targetMetadata = new Map()); + } + var keyMetadata = targetMetadata.get(targetKey); + if (!keyMetadata) { + if (!create) return undefined; + targetMetadata.set(targetKey, keyMetadata = new Map()); + } return keyMetadata; +}; +var ordinaryHasOwnMetadata = function (MetadataKey, O, P) { + var metadataMap = getOrCreateMetadataMap(O, P, false); + return metadataMap === undefined ? false : metadataMap.has(MetadataKey); +}; +var ordinaryGetOwnMetadata = function (MetadataKey, O, P) { + var metadataMap = getOrCreateMetadataMap(O, P, false); + return metadataMap === undefined ? undefined : metadataMap.get(MetadataKey); +}; +var ordinaryDefineOwnMetadata = function (MetadataKey, MetadataValue, O, P) { + getOrCreateMetadataMap(O, P, true).set(MetadataKey, MetadataValue); +}; +var ordinaryOwnMetadataKeys = function (target, targetKey) { + var metadataMap = getOrCreateMetadataMap(target, targetKey, false); + var keys = []; + if (metadataMap) metadataMap.forEach(function (_, key) { keys.push(key); }); + return keys; +}; +var toMetaKey = function (it) { + return it === undefined || typeof it == 'symbol' ? it : String(it); +}; +var exp = function (O) { + $export($export.S, 'Reflect', O); +}; + +module.exports = { + store: store, + map: getOrCreateMetadataMap, + has: ordinaryHasOwnMetadata, + get: ordinaryGetOwnMetadata, + set: ordinaryDefineOwnMetadata, + keys: ordinaryOwnMetadataKeys, + key: toMetaKey, + exp: exp +}; + + +/***/ }), + +/***/ "./node_modules/core-js/modules/_object-assign.js": +/*!********************************************************!*\ + !*** ./node_modules/core-js/modules/_object-assign.js ***! + \********************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +// 19.1.2.1 Object.assign(target, source, ...) +var getKeys = __webpack_require__(/*! ./_object-keys */ "./node_modules/core-js/modules/_object-keys.js"); +var gOPS = __webpack_require__(/*! ./_object-gops */ "./node_modules/core-js/modules/_object-gops.js"); +var pIE = __webpack_require__(/*! ./_object-pie */ "./node_modules/core-js/modules/_object-pie.js"); +var toObject = __webpack_require__(/*! ./_to-object */ "./node_modules/core-js/modules/_to-object.js"); +var IObject = __webpack_require__(/*! ./_iobject */ "./node_modules/core-js/modules/_iobject.js"); +var $assign = Object.assign; + +// should work with symbols and should have deterministic property order (V8 bug) +module.exports = !$assign || __webpack_require__(/*! ./_fails */ "./node_modules/core-js/modules/_fails.js")(function () { + var A = {}; + var B = {}; + // eslint-disable-next-line no-undef + var S = Symbol(); + var K = 'abcdefghijklmnopqrst'; + A[S] = 7; + K.split('').forEach(function (k) { B[k] = k; }); + return $assign({}, A)[S] != 7 || Object.keys($assign({}, B)).join('') != K; +}) ? function assign(target, source) { // eslint-disable-line no-unused-vars + var T = toObject(target); + var aLen = arguments.length; + var index = 1; + var getSymbols = gOPS.f; + var isEnum = pIE.f; + while (aLen > index) { + var S = IObject(arguments[index++]); + var keys = getSymbols ? getKeys(S).concat(getSymbols(S)) : getKeys(S); + var length = keys.length; + var j = 0; + var key; + while (length > j) if (isEnum.call(S, key = keys[j++])) T[key] = S[key]; + } return T; +} : $assign; + + +/***/ }), + +/***/ "./node_modules/core-js/modules/_object-create.js": +/*!********************************************************!*\ + !*** ./node_modules/core-js/modules/_object-create.js ***! + \********************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +// 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties]) +var anObject = __webpack_require__(/*! ./_an-object */ "./node_modules/core-js/modules/_an-object.js"); +var dPs = __webpack_require__(/*! ./_object-dps */ "./node_modules/core-js/modules/_object-dps.js"); +var enumBugKeys = __webpack_require__(/*! ./_enum-bug-keys */ "./node_modules/core-js/modules/_enum-bug-keys.js"); +var IE_PROTO = __webpack_require__(/*! ./_shared-key */ "./node_modules/core-js/modules/_shared-key.js")('IE_PROTO'); +var Empty = function () { /* empty */ }; +var PROTOTYPE = 'prototype'; + +// Create object with fake `null` prototype: use iframe Object with cleared prototype +var createDict = function () { + // Thrash, waste and sodomy: IE GC bug + var iframe = __webpack_require__(/*! ./_dom-create */ "./node_modules/core-js/modules/_dom-create.js")('iframe'); + var i = enumBugKeys.length; + var lt = '<'; + var gt = '>'; + var iframeDocument; + iframe.style.display = 'none'; + __webpack_require__(/*! ./_html */ "./node_modules/core-js/modules/_html.js").appendChild(iframe); + iframe.src = 'javascript:'; // eslint-disable-line no-script-url + // createDict = iframe.contentWindow.Object; + // html.removeChild(iframe); + iframeDocument = iframe.contentWindow.document; + iframeDocument.open(); + iframeDocument.write(lt + 'script' + gt + 'document.F=Object' + lt + '/script' + gt); + iframeDocument.close(); + createDict = iframeDocument.F; + while (i--) delete createDict[PROTOTYPE][enumBugKeys[i]]; + return createDict(); +}; + +module.exports = Object.create || function create(O, Properties) { + var result; + if (O !== null) { + Empty[PROTOTYPE] = anObject(O); + result = new Empty(); + Empty[PROTOTYPE] = null; + // add "__proto__" for Object.getPrototypeOf polyfill + result[IE_PROTO] = O; + } else result = createDict(); + return Properties === undefined ? result : dPs(result, Properties); +}; + + +/***/ }), + +/***/ "./node_modules/core-js/modules/_object-dp.js": +/*!****************************************************!*\ + !*** ./node_modules/core-js/modules/_object-dp.js ***! + \****************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +var anObject = __webpack_require__(/*! ./_an-object */ "./node_modules/core-js/modules/_an-object.js"); +var IE8_DOM_DEFINE = __webpack_require__(/*! ./_ie8-dom-define */ "./node_modules/core-js/modules/_ie8-dom-define.js"); +var toPrimitive = __webpack_require__(/*! ./_to-primitive */ "./node_modules/core-js/modules/_to-primitive.js"); +var dP = Object.defineProperty; + +exports.f = __webpack_require__(/*! ./_descriptors */ "./node_modules/core-js/modules/_descriptors.js") ? Object.defineProperty : function defineProperty(O, P, Attributes) { + anObject(O); + P = toPrimitive(P, true); + anObject(Attributes); + if (IE8_DOM_DEFINE) try { + return dP(O, P, Attributes); + } catch (e) { /* empty */ } + if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported!'); + if ('value' in Attributes) O[P] = Attributes.value; + return O; +}; + + +/***/ }), + +/***/ "./node_modules/core-js/modules/_object-dps.js": +/*!*****************************************************!*\ + !*** ./node_modules/core-js/modules/_object-dps.js ***! + \*****************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +var dP = __webpack_require__(/*! ./_object-dp */ "./node_modules/core-js/modules/_object-dp.js"); +var anObject = __webpack_require__(/*! ./_an-object */ "./node_modules/core-js/modules/_an-object.js"); +var getKeys = __webpack_require__(/*! ./_object-keys */ "./node_modules/core-js/modules/_object-keys.js"); + +module.exports = __webpack_require__(/*! ./_descriptors */ "./node_modules/core-js/modules/_descriptors.js") ? Object.defineProperties : function defineProperties(O, Properties) { + anObject(O); + var keys = getKeys(Properties); + var length = keys.length; + var i = 0; + var P; + while (length > i) dP.f(O, P = keys[i++], Properties[P]); + return O; +}; + + +/***/ }), + +/***/ "./node_modules/core-js/modules/_object-gopd.js": +/*!******************************************************!*\ + !*** ./node_modules/core-js/modules/_object-gopd.js ***! + \******************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +var pIE = __webpack_require__(/*! ./_object-pie */ "./node_modules/core-js/modules/_object-pie.js"); +var createDesc = __webpack_require__(/*! ./_property-desc */ "./node_modules/core-js/modules/_property-desc.js"); +var toIObject = __webpack_require__(/*! ./_to-iobject */ "./node_modules/core-js/modules/_to-iobject.js"); +var toPrimitive = __webpack_require__(/*! ./_to-primitive */ "./node_modules/core-js/modules/_to-primitive.js"); +var has = __webpack_require__(/*! ./_has */ "./node_modules/core-js/modules/_has.js"); +var IE8_DOM_DEFINE = __webpack_require__(/*! ./_ie8-dom-define */ "./node_modules/core-js/modules/_ie8-dom-define.js"); +var gOPD = Object.getOwnPropertyDescriptor; + +exports.f = __webpack_require__(/*! ./_descriptors */ "./node_modules/core-js/modules/_descriptors.js") ? gOPD : function getOwnPropertyDescriptor(O, P) { + O = toIObject(O); + P = toPrimitive(P, true); + if (IE8_DOM_DEFINE) try { + return gOPD(O, P); + } catch (e) { /* empty */ } + if (has(O, P)) return createDesc(!pIE.f.call(O, P), O[P]); +}; + + +/***/ }), + +/***/ "./node_modules/core-js/modules/_object-gops.js": +/*!******************************************************!*\ + !*** ./node_modules/core-js/modules/_object-gops.js ***! + \******************************************************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +exports.f = Object.getOwnPropertySymbols; + + +/***/ }), + +/***/ "./node_modules/core-js/modules/_object-gpo.js": +/*!*****************************************************!*\ + !*** ./node_modules/core-js/modules/_object-gpo.js ***! + \*****************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +// 19.1.2.9 / 15.2.3.2 Object.getPrototypeOf(O) +var has = __webpack_require__(/*! ./_has */ "./node_modules/core-js/modules/_has.js"); +var toObject = __webpack_require__(/*! ./_to-object */ "./node_modules/core-js/modules/_to-object.js"); +var IE_PROTO = __webpack_require__(/*! ./_shared-key */ "./node_modules/core-js/modules/_shared-key.js")('IE_PROTO'); +var ObjectProto = Object.prototype; + +module.exports = Object.getPrototypeOf || function (O) { + O = toObject(O); + if (has(O, IE_PROTO)) return O[IE_PROTO]; + if (typeof O.constructor == 'function' && O instanceof O.constructor) { + return O.constructor.prototype; + } return O instanceof Object ? ObjectProto : null; +}; + + +/***/ }), + +/***/ "./node_modules/core-js/modules/_object-keys-internal.js": +/*!***************************************************************!*\ + !*** ./node_modules/core-js/modules/_object-keys-internal.js ***! + \***************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +var has = __webpack_require__(/*! ./_has */ "./node_modules/core-js/modules/_has.js"); +var toIObject = __webpack_require__(/*! ./_to-iobject */ "./node_modules/core-js/modules/_to-iobject.js"); +var arrayIndexOf = __webpack_require__(/*! ./_array-includes */ "./node_modules/core-js/modules/_array-includes.js")(false); +var IE_PROTO = __webpack_require__(/*! ./_shared-key */ "./node_modules/core-js/modules/_shared-key.js")('IE_PROTO'); + +module.exports = function (object, names) { + var O = toIObject(object); + var i = 0; + var result = []; + var key; + for (key in O) if (key != IE_PROTO) has(O, key) && result.push(key); + // Don't enum bug & hidden keys + while (names.length > i) if (has(O, key = names[i++])) { + ~arrayIndexOf(result, key) || result.push(key); + } + return result; +}; + + +/***/ }), + +/***/ "./node_modules/core-js/modules/_object-keys.js": +/*!******************************************************!*\ + !*** ./node_modules/core-js/modules/_object-keys.js ***! + \******************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +// 19.1.2.14 / 15.2.3.14 Object.keys(O) +var $keys = __webpack_require__(/*! ./_object-keys-internal */ "./node_modules/core-js/modules/_object-keys-internal.js"); +var enumBugKeys = __webpack_require__(/*! ./_enum-bug-keys */ "./node_modules/core-js/modules/_enum-bug-keys.js"); + +module.exports = Object.keys || function keys(O) { + return $keys(O, enumBugKeys); +}; + + +/***/ }), + +/***/ "./node_modules/core-js/modules/_object-pie.js": +/*!*****************************************************!*\ + !*** ./node_modules/core-js/modules/_object-pie.js ***! + \*****************************************************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +exports.f = {}.propertyIsEnumerable; + + +/***/ }), + +/***/ "./node_modules/core-js/modules/_property-desc.js": +/*!********************************************************!*\ + !*** ./node_modules/core-js/modules/_property-desc.js ***! + \********************************************************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +module.exports = function (bitmap, value) { + return { + enumerable: !(bitmap & 1), + configurable: !(bitmap & 2), + writable: !(bitmap & 4), + value: value + }; +}; + + +/***/ }), + +/***/ "./node_modules/core-js/modules/_redefine-all.js": +/*!*******************************************************!*\ + !*** ./node_modules/core-js/modules/_redefine-all.js ***! + \*******************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +var redefine = __webpack_require__(/*! ./_redefine */ "./node_modules/core-js/modules/_redefine.js"); +module.exports = function (target, src, safe) { + for (var key in src) redefine(target, key, src[key], safe); + return target; +}; + + +/***/ }), + +/***/ "./node_modules/core-js/modules/_redefine.js": +/*!***************************************************!*\ + !*** ./node_modules/core-js/modules/_redefine.js ***! + \***************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +var global = __webpack_require__(/*! ./_global */ "./node_modules/core-js/modules/_global.js"); +var hide = __webpack_require__(/*! ./_hide */ "./node_modules/core-js/modules/_hide.js"); +var has = __webpack_require__(/*! ./_has */ "./node_modules/core-js/modules/_has.js"); +var SRC = __webpack_require__(/*! ./_uid */ "./node_modules/core-js/modules/_uid.js")('src'); +var $toString = __webpack_require__(/*! ./_function-to-string */ "./node_modules/core-js/modules/_function-to-string.js"); +var TO_STRING = 'toString'; +var TPL = ('' + $toString).split(TO_STRING); + +__webpack_require__(/*! ./_core */ "./node_modules/core-js/modules/_core.js").inspectSource = function (it) { + return $toString.call(it); +}; + +(module.exports = function (O, key, val, safe) { + var isFunction = typeof val == 'function'; + if (isFunction) has(val, 'name') || hide(val, 'name', key); + if (O[key] === val) return; + if (isFunction) has(val, SRC) || hide(val, SRC, O[key] ? '' + O[key] : TPL.join(String(key))); + if (O === global) { + O[key] = val; + } else if (!safe) { + delete O[key]; + hide(O, key, val); + } else if (O[key]) { + O[key] = val; + } else { + hide(O, key, val); + } +// add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative +})(Function.prototype, TO_STRING, function toString() { + return typeof this == 'function' && this[SRC] || $toString.call(this); +}); + + +/***/ }), + +/***/ "./node_modules/core-js/modules/_set-proto.js": +/*!****************************************************!*\ + !*** ./node_modules/core-js/modules/_set-proto.js ***! + \****************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +// Works with __proto__ only. Old v8 can't work with null proto objects. +/* eslint-disable no-proto */ +var isObject = __webpack_require__(/*! ./_is-object */ "./node_modules/core-js/modules/_is-object.js"); +var anObject = __webpack_require__(/*! ./_an-object */ "./node_modules/core-js/modules/_an-object.js"); +var check = function (O, proto) { + anObject(O); + if (!isObject(proto) && proto !== null) throw TypeError(proto + ": can't set as prototype!"); +}; +module.exports = { + set: Object.setPrototypeOf || ('__proto__' in {} ? // eslint-disable-line + function (test, buggy, set) { + try { + set = __webpack_require__(/*! ./_ctx */ "./node_modules/core-js/modules/_ctx.js")(Function.call, __webpack_require__(/*! ./_object-gopd */ "./node_modules/core-js/modules/_object-gopd.js").f(Object.prototype, '__proto__').set, 2); + set(test, []); + buggy = !(test instanceof Array); + } catch (e) { buggy = true; } + return function setPrototypeOf(O, proto) { + check(O, proto); + if (buggy) O.__proto__ = proto; + else set(O, proto); + return O; + }; + }({}, false) : undefined), + check: check +}; + + +/***/ }), + +/***/ "./node_modules/core-js/modules/_set-species.js": +/*!******************************************************!*\ + !*** ./node_modules/core-js/modules/_set-species.js ***! + \******************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +var global = __webpack_require__(/*! ./_global */ "./node_modules/core-js/modules/_global.js"); +var dP = __webpack_require__(/*! ./_object-dp */ "./node_modules/core-js/modules/_object-dp.js"); +var DESCRIPTORS = __webpack_require__(/*! ./_descriptors */ "./node_modules/core-js/modules/_descriptors.js"); +var SPECIES = __webpack_require__(/*! ./_wks */ "./node_modules/core-js/modules/_wks.js")('species'); + +module.exports = function (KEY) { + var C = global[KEY]; + if (DESCRIPTORS && C && !C[SPECIES]) dP.f(C, SPECIES, { + configurable: true, + get: function () { return this; } + }); +}; + + +/***/ }), + +/***/ "./node_modules/core-js/modules/_set-to-string-tag.js": +/*!************************************************************!*\ + !*** ./node_modules/core-js/modules/_set-to-string-tag.js ***! + \************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +var def = __webpack_require__(/*! ./_object-dp */ "./node_modules/core-js/modules/_object-dp.js").f; +var has = __webpack_require__(/*! ./_has */ "./node_modules/core-js/modules/_has.js"); +var TAG = __webpack_require__(/*! ./_wks */ "./node_modules/core-js/modules/_wks.js")('toStringTag'); + +module.exports = function (it, tag, stat) { + if (it && !has(it = stat ? it : it.prototype, TAG)) def(it, TAG, { configurable: true, value: tag }); +}; + + +/***/ }), + +/***/ "./node_modules/core-js/modules/_shared-key.js": +/*!*****************************************************!*\ + !*** ./node_modules/core-js/modules/_shared-key.js ***! + \*****************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +var shared = __webpack_require__(/*! ./_shared */ "./node_modules/core-js/modules/_shared.js")('keys'); +var uid = __webpack_require__(/*! ./_uid */ "./node_modules/core-js/modules/_uid.js"); +module.exports = function (key) { + return shared[key] || (shared[key] = uid(key)); +}; + + +/***/ }), + +/***/ "./node_modules/core-js/modules/_shared.js": +/*!*************************************************!*\ + !*** ./node_modules/core-js/modules/_shared.js ***! + \*************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +var core = __webpack_require__(/*! ./_core */ "./node_modules/core-js/modules/_core.js"); +var global = __webpack_require__(/*! ./_global */ "./node_modules/core-js/modules/_global.js"); +var SHARED = '__core-js_shared__'; +var store = global[SHARED] || (global[SHARED] = {}); + +(module.exports = function (key, value) { + return store[key] || (store[key] = value !== undefined ? value : {}); +})('versions', []).push({ + version: core.version, + mode: __webpack_require__(/*! ./_library */ "./node_modules/core-js/modules/_library.js") ? 'pure' : 'global', + copyright: '© 2019 Denis Pushkarev (zloirock.ru)' +}); + + +/***/ }), + +/***/ "./node_modules/core-js/modules/_to-absolute-index.js": +/*!************************************************************!*\ + !*** ./node_modules/core-js/modules/_to-absolute-index.js ***! + \************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +var toInteger = __webpack_require__(/*! ./_to-integer */ "./node_modules/core-js/modules/_to-integer.js"); +var max = Math.max; +var min = Math.min; +module.exports = function (index, length) { + index = toInteger(index); + return index < 0 ? max(index + length, 0) : min(index, length); +}; + + +/***/ }), + +/***/ "./node_modules/core-js/modules/_to-integer.js": +/*!*****************************************************!*\ + !*** ./node_modules/core-js/modules/_to-integer.js ***! + \*****************************************************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +// 7.1.4 ToInteger +var ceil = Math.ceil; +var floor = Math.floor; +module.exports = function (it) { + return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it); +}; + + +/***/ }), + +/***/ "./node_modules/core-js/modules/_to-iobject.js": +/*!*****************************************************!*\ + !*** ./node_modules/core-js/modules/_to-iobject.js ***! + \*****************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +// to indexed object, toObject with fallback for non-array-like ES3 strings +var IObject = __webpack_require__(/*! ./_iobject */ "./node_modules/core-js/modules/_iobject.js"); +var defined = __webpack_require__(/*! ./_defined */ "./node_modules/core-js/modules/_defined.js"); +module.exports = function (it) { + return IObject(defined(it)); +}; + + +/***/ }), + +/***/ "./node_modules/core-js/modules/_to-length.js": +/*!****************************************************!*\ + !*** ./node_modules/core-js/modules/_to-length.js ***! + \****************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +// 7.1.15 ToLength +var toInteger = __webpack_require__(/*! ./_to-integer */ "./node_modules/core-js/modules/_to-integer.js"); +var min = Math.min; +module.exports = function (it) { + return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991 +}; + + +/***/ }), + +/***/ "./node_modules/core-js/modules/_to-object.js": +/*!****************************************************!*\ + !*** ./node_modules/core-js/modules/_to-object.js ***! + \****************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +// 7.1.13 ToObject(argument) +var defined = __webpack_require__(/*! ./_defined */ "./node_modules/core-js/modules/_defined.js"); +module.exports = function (it) { + return Object(defined(it)); +}; + + +/***/ }), + +/***/ "./node_modules/core-js/modules/_to-primitive.js": +/*!*******************************************************!*\ + !*** ./node_modules/core-js/modules/_to-primitive.js ***! + \*******************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +// 7.1.1 ToPrimitive(input [, PreferredType]) +var isObject = __webpack_require__(/*! ./_is-object */ "./node_modules/core-js/modules/_is-object.js"); +// instead of the ES6 spec version, we didn't implement @@toPrimitive case +// and the second argument - flag - preferred type is a string +module.exports = function (it, S) { + if (!isObject(it)) return it; + var fn, val; + if (S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val; + if (typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it))) return val; + if (!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val; + throw TypeError("Can't convert object to primitive value"); +}; + + +/***/ }), + +/***/ "./node_modules/core-js/modules/_uid.js": +/*!**********************************************!*\ + !*** ./node_modules/core-js/modules/_uid.js ***! + \**********************************************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +var id = 0; +var px = Math.random(); +module.exports = function (key) { + return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36)); +}; + + +/***/ }), + +/***/ "./node_modules/core-js/modules/_validate-collection.js": +/*!**************************************************************!*\ + !*** ./node_modules/core-js/modules/_validate-collection.js ***! + \**************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +var isObject = __webpack_require__(/*! ./_is-object */ "./node_modules/core-js/modules/_is-object.js"); +module.exports = function (it, TYPE) { + if (!isObject(it) || it._t !== TYPE) throw TypeError('Incompatible receiver, ' + TYPE + ' required!'); + return it; +}; + + +/***/ }), + +/***/ "./node_modules/core-js/modules/_wks.js": +/*!**********************************************!*\ + !*** ./node_modules/core-js/modules/_wks.js ***! + \**********************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +var store = __webpack_require__(/*! ./_shared */ "./node_modules/core-js/modules/_shared.js")('wks'); +var uid = __webpack_require__(/*! ./_uid */ "./node_modules/core-js/modules/_uid.js"); +var Symbol = __webpack_require__(/*! ./_global */ "./node_modules/core-js/modules/_global.js").Symbol; +var USE_SYMBOL = typeof Symbol == 'function'; + +var $exports = module.exports = function (name) { + return store[name] || (store[name] = + USE_SYMBOL && Symbol[name] || (USE_SYMBOL ? Symbol : uid)('Symbol.' + name)); +}; + +$exports.store = store; + + +/***/ }), + +/***/ "./node_modules/core-js/modules/core.get-iterator-method.js": +/*!******************************************************************!*\ + !*** ./node_modules/core-js/modules/core.get-iterator-method.js ***! + \******************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +var classof = __webpack_require__(/*! ./_classof */ "./node_modules/core-js/modules/_classof.js"); +var ITERATOR = __webpack_require__(/*! ./_wks */ "./node_modules/core-js/modules/_wks.js")('iterator'); +var Iterators = __webpack_require__(/*! ./_iterators */ "./node_modules/core-js/modules/_iterators.js"); +module.exports = __webpack_require__(/*! ./_core */ "./node_modules/core-js/modules/_core.js").getIteratorMethod = function (it) { + if (it != undefined) return it[ITERATOR] + || it['@@iterator'] + || Iterators[classof(it)]; +}; + + +/***/ }), + +/***/ "./node_modules/core-js/modules/es6.map.js": +/*!*************************************************!*\ + !*** ./node_modules/core-js/modules/es6.map.js ***! + \*************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +var strong = __webpack_require__(/*! ./_collection-strong */ "./node_modules/core-js/modules/_collection-strong.js"); +var validate = __webpack_require__(/*! ./_validate-collection */ "./node_modules/core-js/modules/_validate-collection.js"); +var MAP = 'Map'; + +// 23.1 Map Objects +module.exports = __webpack_require__(/*! ./_collection */ "./node_modules/core-js/modules/_collection.js")(MAP, function (get) { + return function Map() { return get(this, arguments.length > 0 ? arguments[0] : undefined); }; +}, { + // 23.1.3.6 Map.prototype.get(key) + get: function get(key) { + var entry = strong.getEntry(validate(this, MAP), key); + return entry && entry.v; + }, + // 23.1.3.9 Map.prototype.set(key, value) + set: function set(key, value) { + return strong.def(validate(this, MAP), key === 0 ? 0 : key, value); + } +}, strong, true); + + +/***/ }), + +/***/ "./node_modules/core-js/modules/es6.set.js": +/*!*************************************************!*\ + !*** ./node_modules/core-js/modules/es6.set.js ***! + \*************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +var strong = __webpack_require__(/*! ./_collection-strong */ "./node_modules/core-js/modules/_collection-strong.js"); +var validate = __webpack_require__(/*! ./_validate-collection */ "./node_modules/core-js/modules/_validate-collection.js"); +var SET = 'Set'; + +// 23.2 Set Objects +module.exports = __webpack_require__(/*! ./_collection */ "./node_modules/core-js/modules/_collection.js")(SET, function (get) { + return function Set() { return get(this, arguments.length > 0 ? arguments[0] : undefined); }; +}, { + // 23.2.3.1 Set.prototype.add(value) + add: function add(value) { + return strong.def(validate(this, SET), value = value === 0 ? 0 : value, value); + } +}, strong); + + +/***/ }), + +/***/ "./node_modules/core-js/modules/es6.weak-map.js": +/*!******************************************************!*\ + !*** ./node_modules/core-js/modules/es6.weak-map.js ***! + \******************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +var global = __webpack_require__(/*! ./_global */ "./node_modules/core-js/modules/_global.js"); +var each = __webpack_require__(/*! ./_array-methods */ "./node_modules/core-js/modules/_array-methods.js")(0); +var redefine = __webpack_require__(/*! ./_redefine */ "./node_modules/core-js/modules/_redefine.js"); +var meta = __webpack_require__(/*! ./_meta */ "./node_modules/core-js/modules/_meta.js"); +var assign = __webpack_require__(/*! ./_object-assign */ "./node_modules/core-js/modules/_object-assign.js"); +var weak = __webpack_require__(/*! ./_collection-weak */ "./node_modules/core-js/modules/_collection-weak.js"); +var isObject = __webpack_require__(/*! ./_is-object */ "./node_modules/core-js/modules/_is-object.js"); +var validate = __webpack_require__(/*! ./_validate-collection */ "./node_modules/core-js/modules/_validate-collection.js"); +var NATIVE_WEAK_MAP = __webpack_require__(/*! ./_validate-collection */ "./node_modules/core-js/modules/_validate-collection.js"); +var IS_IE11 = !global.ActiveXObject && 'ActiveXObject' in global; +var WEAK_MAP = 'WeakMap'; +var getWeak = meta.getWeak; +var isExtensible = Object.isExtensible; +var uncaughtFrozenStore = weak.ufstore; +var InternalMap; + +var wrapper = function (get) { + return function WeakMap() { + return get(this, arguments.length > 0 ? arguments[0] : undefined); + }; +}; + +var methods = { + // 23.3.3.3 WeakMap.prototype.get(key) + get: function get(key) { + if (isObject(key)) { + var data = getWeak(key); + if (data === true) return uncaughtFrozenStore(validate(this, WEAK_MAP)).get(key); + return data ? data[this._i] : undefined; + } + }, + // 23.3.3.5 WeakMap.prototype.set(key, value) + set: function set(key, value) { + return weak.def(validate(this, WEAK_MAP), key, value); + } +}; + +// 23.3 WeakMap Objects +var $WeakMap = module.exports = __webpack_require__(/*! ./_collection */ "./node_modules/core-js/modules/_collection.js")(WEAK_MAP, wrapper, methods, weak, true, true); + +// IE11 WeakMap frozen keys fix +if (NATIVE_WEAK_MAP && IS_IE11) { + InternalMap = weak.getConstructor(wrapper, WEAK_MAP); + assign(InternalMap.prototype, methods); + meta.NEED = true; + each(['delete', 'has', 'get', 'set'], function (key) { + var proto = $WeakMap.prototype; + var method = proto[key]; + redefine(proto, key, function (a, b) { + // store frozen objects on internal weakmap shim + if (isObject(a) && !isExtensible(a)) { + if (!this._f) this._f = new InternalMap(); + var result = this._f[key](a, b); + return key == 'set' ? this : result; + // store all the rest on native weakmap + } return method.call(this, a, b); + }); + }); +} + + +/***/ }), + +/***/ "./node_modules/core-js/modules/es7.reflect.define-metadata.js": +/*!*********************************************************************!*\ + !*** ./node_modules/core-js/modules/es7.reflect.define-metadata.js ***! + \*********************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +var metadata = __webpack_require__(/*! ./_metadata */ "./node_modules/core-js/modules/_metadata.js"); +var anObject = __webpack_require__(/*! ./_an-object */ "./node_modules/core-js/modules/_an-object.js"); +var toMetaKey = metadata.key; +var ordinaryDefineOwnMetadata = metadata.set; + +metadata.exp({ defineMetadata: function defineMetadata(metadataKey, metadataValue, target, targetKey) { + ordinaryDefineOwnMetadata(metadataKey, metadataValue, anObject(target), toMetaKey(targetKey)); +} }); + + +/***/ }), + +/***/ "./node_modules/core-js/modules/es7.reflect.delete-metadata.js": +/*!*********************************************************************!*\ + !*** ./node_modules/core-js/modules/es7.reflect.delete-metadata.js ***! + \*********************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +var metadata = __webpack_require__(/*! ./_metadata */ "./node_modules/core-js/modules/_metadata.js"); +var anObject = __webpack_require__(/*! ./_an-object */ "./node_modules/core-js/modules/_an-object.js"); +var toMetaKey = metadata.key; +var getOrCreateMetadataMap = metadata.map; +var store = metadata.store; + +metadata.exp({ deleteMetadata: function deleteMetadata(metadataKey, target /* , targetKey */) { + var targetKey = arguments.length < 3 ? undefined : toMetaKey(arguments[2]); + var metadataMap = getOrCreateMetadataMap(anObject(target), targetKey, false); + if (metadataMap === undefined || !metadataMap['delete'](metadataKey)) return false; + if (metadataMap.size) return true; + var targetMetadata = store.get(target); + targetMetadata['delete'](targetKey); + return !!targetMetadata.size || store['delete'](target); +} }); + + +/***/ }), + +/***/ "./node_modules/core-js/modules/es7.reflect.get-metadata-keys.js": +/*!***********************************************************************!*\ + !*** ./node_modules/core-js/modules/es7.reflect.get-metadata-keys.js ***! + \***********************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +var Set = __webpack_require__(/*! ./es6.set */ "./node_modules/core-js/modules/es6.set.js"); +var from = __webpack_require__(/*! ./_array-from-iterable */ "./node_modules/core-js/modules/_array-from-iterable.js"); +var metadata = __webpack_require__(/*! ./_metadata */ "./node_modules/core-js/modules/_metadata.js"); +var anObject = __webpack_require__(/*! ./_an-object */ "./node_modules/core-js/modules/_an-object.js"); +var getPrototypeOf = __webpack_require__(/*! ./_object-gpo */ "./node_modules/core-js/modules/_object-gpo.js"); +var ordinaryOwnMetadataKeys = metadata.keys; +var toMetaKey = metadata.key; + +var ordinaryMetadataKeys = function (O, P) { + var oKeys = ordinaryOwnMetadataKeys(O, P); + var parent = getPrototypeOf(O); + if (parent === null) return oKeys; + var pKeys = ordinaryMetadataKeys(parent, P); + return pKeys.length ? oKeys.length ? from(new Set(oKeys.concat(pKeys))) : pKeys : oKeys; +}; + +metadata.exp({ getMetadataKeys: function getMetadataKeys(target /* , targetKey */) { + return ordinaryMetadataKeys(anObject(target), arguments.length < 2 ? undefined : toMetaKey(arguments[1])); +} }); + + +/***/ }), + +/***/ "./node_modules/core-js/modules/es7.reflect.get-metadata.js": +/*!******************************************************************!*\ + !*** ./node_modules/core-js/modules/es7.reflect.get-metadata.js ***! + \******************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +var metadata = __webpack_require__(/*! ./_metadata */ "./node_modules/core-js/modules/_metadata.js"); +var anObject = __webpack_require__(/*! ./_an-object */ "./node_modules/core-js/modules/_an-object.js"); +var getPrototypeOf = __webpack_require__(/*! ./_object-gpo */ "./node_modules/core-js/modules/_object-gpo.js"); +var ordinaryHasOwnMetadata = metadata.has; +var ordinaryGetOwnMetadata = metadata.get; +var toMetaKey = metadata.key; + +var ordinaryGetMetadata = function (MetadataKey, O, P) { + var hasOwn = ordinaryHasOwnMetadata(MetadataKey, O, P); + if (hasOwn) return ordinaryGetOwnMetadata(MetadataKey, O, P); + var parent = getPrototypeOf(O); + return parent !== null ? ordinaryGetMetadata(MetadataKey, parent, P) : undefined; +}; + +metadata.exp({ getMetadata: function getMetadata(metadataKey, target /* , targetKey */) { + return ordinaryGetMetadata(metadataKey, anObject(target), arguments.length < 3 ? undefined : toMetaKey(arguments[2])); +} }); + + +/***/ }), + +/***/ "./node_modules/core-js/modules/es7.reflect.get-own-metadata-keys.js": +/*!***************************************************************************!*\ + !*** ./node_modules/core-js/modules/es7.reflect.get-own-metadata-keys.js ***! + \***************************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +var metadata = __webpack_require__(/*! ./_metadata */ "./node_modules/core-js/modules/_metadata.js"); +var anObject = __webpack_require__(/*! ./_an-object */ "./node_modules/core-js/modules/_an-object.js"); +var ordinaryOwnMetadataKeys = metadata.keys; +var toMetaKey = metadata.key; + +metadata.exp({ getOwnMetadataKeys: function getOwnMetadataKeys(target /* , targetKey */) { + return ordinaryOwnMetadataKeys(anObject(target), arguments.length < 2 ? undefined : toMetaKey(arguments[1])); +} }); + + +/***/ }), + +/***/ "./node_modules/core-js/modules/es7.reflect.get-own-metadata.js": +/*!**********************************************************************!*\ + !*** ./node_modules/core-js/modules/es7.reflect.get-own-metadata.js ***! + \**********************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +var metadata = __webpack_require__(/*! ./_metadata */ "./node_modules/core-js/modules/_metadata.js"); +var anObject = __webpack_require__(/*! ./_an-object */ "./node_modules/core-js/modules/_an-object.js"); +var ordinaryGetOwnMetadata = metadata.get; +var toMetaKey = metadata.key; + +metadata.exp({ getOwnMetadata: function getOwnMetadata(metadataKey, target /* , targetKey */) { + return ordinaryGetOwnMetadata(metadataKey, anObject(target) + , arguments.length < 3 ? undefined : toMetaKey(arguments[2])); +} }); + + +/***/ }), + +/***/ "./node_modules/core-js/modules/es7.reflect.has-metadata.js": +/*!******************************************************************!*\ + !*** ./node_modules/core-js/modules/es7.reflect.has-metadata.js ***! + \******************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +var metadata = __webpack_require__(/*! ./_metadata */ "./node_modules/core-js/modules/_metadata.js"); +var anObject = __webpack_require__(/*! ./_an-object */ "./node_modules/core-js/modules/_an-object.js"); +var getPrototypeOf = __webpack_require__(/*! ./_object-gpo */ "./node_modules/core-js/modules/_object-gpo.js"); +var ordinaryHasOwnMetadata = metadata.has; +var toMetaKey = metadata.key; + +var ordinaryHasMetadata = function (MetadataKey, O, P) { + var hasOwn = ordinaryHasOwnMetadata(MetadataKey, O, P); + if (hasOwn) return true; + var parent = getPrototypeOf(O); + return parent !== null ? ordinaryHasMetadata(MetadataKey, parent, P) : false; +}; + +metadata.exp({ hasMetadata: function hasMetadata(metadataKey, target /* , targetKey */) { + return ordinaryHasMetadata(metadataKey, anObject(target), arguments.length < 3 ? undefined : toMetaKey(arguments[2])); +} }); + + +/***/ }), + +/***/ "./node_modules/core-js/modules/es7.reflect.has-own-metadata.js": +/*!**********************************************************************!*\ + !*** ./node_modules/core-js/modules/es7.reflect.has-own-metadata.js ***! + \**********************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +var metadata = __webpack_require__(/*! ./_metadata */ "./node_modules/core-js/modules/_metadata.js"); +var anObject = __webpack_require__(/*! ./_an-object */ "./node_modules/core-js/modules/_an-object.js"); +var ordinaryHasOwnMetadata = metadata.has; +var toMetaKey = metadata.key; + +metadata.exp({ hasOwnMetadata: function hasOwnMetadata(metadataKey, target /* , targetKey */) { + return ordinaryHasOwnMetadata(metadataKey, anObject(target) + , arguments.length < 3 ? undefined : toMetaKey(arguments[2])); +} }); + + +/***/ }), + +/***/ "./node_modules/core-js/modules/es7.reflect.metadata.js": +/*!**************************************************************!*\ + !*** ./node_modules/core-js/modules/es7.reflect.metadata.js ***! + \**************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +var $metadata = __webpack_require__(/*! ./_metadata */ "./node_modules/core-js/modules/_metadata.js"); +var anObject = __webpack_require__(/*! ./_an-object */ "./node_modules/core-js/modules/_an-object.js"); +var aFunction = __webpack_require__(/*! ./_a-function */ "./node_modules/core-js/modules/_a-function.js"); +var toMetaKey = $metadata.key; +var ordinaryDefineOwnMetadata = $metadata.set; + +$metadata.exp({ metadata: function metadata(metadataKey, metadataValue) { + return function decorator(target, targetKey) { + ordinaryDefineOwnMetadata( + metadataKey, metadataValue, + (targetKey !== undefined ? anObject : aFunction)(target), + toMetaKey(targetKey) + ); + }; +} }); + + +/***/ }), + +/***/ "./node_modules/zone.js/dist/zone.js": +/*!*******************************************!*\ + !*** ./node_modules/zone.js/dist/zone.js ***! + \*******************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +/** +* @license +* Copyright Google Inc. All Rights Reserved. +* +* Use of this source code is governed by an MIT-style license that can be +* found in the LICENSE file at https://angular.io/license +*/ +(function (global, factory) { + true ? factory() : + undefined; +}(this, (function () { 'use strict'; + +/** + * @license + * Copyright Google Inc. All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ +var Zone$1 = (function (global) { + var performance = global['performance']; + function mark(name) { + performance && performance['mark'] && performance['mark'](name); + } + function performanceMeasure(name, label) { + performance && performance['measure'] && performance['measure'](name, label); + } + mark('Zone'); + var checkDuplicate = global[('__zone_symbol__forceDuplicateZoneCheck')] === true; + if (global['Zone']) { + // if global['Zone'] already exists (maybe zone.js was already loaded or + // some other lib also registered a global object named Zone), we may need + // to throw an error, but sometimes user may not want this error. + // For example, + // we have two web pages, page1 includes zone.js, page2 doesn't. + // and the 1st time user load page1 and page2, everything work fine, + // but when user load page2 again, error occurs because global['Zone'] already exists. + // so we add a flag to let user choose whether to throw this error or not. + // By default, if existing Zone is from zone.js, we will not throw the error. + if (checkDuplicate || typeof global['Zone'].__symbol__ !== 'function') { + throw new Error('Zone already loaded.'); + } + else { + return global['Zone']; + } + } + var Zone = /** @class */ (function () { + function Zone(parent, zoneSpec) { + this._parent = parent; + this._name = zoneSpec ? zoneSpec.name || 'unnamed' : ''; + this._properties = zoneSpec && zoneSpec.properties || {}; + this._zoneDelegate = + new ZoneDelegate(this, this._parent && this._parent._zoneDelegate, zoneSpec); + } + Zone.assertZonePatched = function () { + if (global['Promise'] !== patches['ZoneAwarePromise']) { + throw new Error('Zone.js has detected that ZoneAwarePromise `(window|global).Promise` ' + + 'has been overwritten.\n' + + 'Most likely cause is that a Promise polyfill has been loaded ' + + 'after Zone.js (Polyfilling Promise api is not necessary when zone.js is loaded. ' + + 'If you must load one, do so before loading zone.js.)'); + } + }; + Object.defineProperty(Zone, "root", { + get: function () { + var zone = Zone.current; + while (zone.parent) { + zone = zone.parent; + } + return zone; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(Zone, "current", { + get: function () { + return _currentZoneFrame.zone; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(Zone, "currentTask", { + get: function () { + return _currentTask; + }, + enumerable: true, + configurable: true + }); + Zone.__load_patch = function (name, fn) { + if (patches.hasOwnProperty(name)) { + if (checkDuplicate) { + throw Error('Already loaded patch: ' + name); + } + } + else if (!global['__Zone_disable_' + name]) { + var perfName = 'Zone:' + name; + mark(perfName); + patches[name] = fn(global, Zone, _api); + performanceMeasure(perfName, perfName); + } + }; + Object.defineProperty(Zone.prototype, "parent", { + get: function () { + return this._parent; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(Zone.prototype, "name", { + get: function () { + return this._name; + }, + enumerable: true, + configurable: true + }); + Zone.prototype.get = function (key) { + var zone = this.getZoneWith(key); + if (zone) + return zone._properties[key]; + }; + Zone.prototype.getZoneWith = function (key) { + var current = this; + while (current) { + if (current._properties.hasOwnProperty(key)) { + return current; + } + current = current._parent; + } + return null; + }; + Zone.prototype.fork = function (zoneSpec) { + if (!zoneSpec) + throw new Error('ZoneSpec required!'); + return this._zoneDelegate.fork(this, zoneSpec); + }; + Zone.prototype.wrap = function (callback, source) { + if (typeof callback !== 'function') { + throw new Error('Expecting function got: ' + callback); + } + var _callback = this._zoneDelegate.intercept(this, callback, source); + var zone = this; + return function () { + return zone.runGuarded(_callback, this, arguments, source); + }; + }; + Zone.prototype.run = function (callback, applyThis, applyArgs, source) { + _currentZoneFrame = { parent: _currentZoneFrame, zone: this }; + try { + return this._zoneDelegate.invoke(this, callback, applyThis, applyArgs, source); + } + finally { + _currentZoneFrame = _currentZoneFrame.parent; + } + }; + Zone.prototype.runGuarded = function (callback, applyThis, applyArgs, source) { + if (applyThis === void 0) { applyThis = null; } + _currentZoneFrame = { parent: _currentZoneFrame, zone: this }; + try { + try { + return this._zoneDelegate.invoke(this, callback, applyThis, applyArgs, source); + } + catch (error) { + if (this._zoneDelegate.handleError(this, error)) { + throw error; + } + } + } + finally { + _currentZoneFrame = _currentZoneFrame.parent; + } + }; + Zone.prototype.runTask = function (task, applyThis, applyArgs) { + if (task.zone != this) { + throw new Error('A task can only be run in the zone of creation! (Creation: ' + + (task.zone || NO_ZONE).name + '; Execution: ' + this.name + ')'); + } + // https://github.com/angular/zone.js/issues/778, sometimes eventTask + // will run in notScheduled(canceled) state, we should not try to + // run such kind of task but just return + if (task.state === notScheduled && (task.type === eventTask || task.type === macroTask)) { + return; + } + var reEntryGuard = task.state != running; + reEntryGuard && task._transitionTo(running, scheduled); + task.runCount++; + var previousTask = _currentTask; + _currentTask = task; + _currentZoneFrame = { parent: _currentZoneFrame, zone: this }; + try { + if (task.type == macroTask && task.data && !task.data.isPeriodic) { + task.cancelFn = undefined; + } + try { + return this._zoneDelegate.invokeTask(this, task, applyThis, applyArgs); + } + catch (error) { + if (this._zoneDelegate.handleError(this, error)) { + throw error; + } + } + } + finally { + // if the task's state is notScheduled or unknown, then it has already been cancelled + // we should not reset the state to scheduled + if (task.state !== notScheduled && task.state !== unknown) { + if (task.type == eventTask || (task.data && task.data.isPeriodic)) { + reEntryGuard && task._transitionTo(scheduled, running); + } + else { + task.runCount = 0; + this._updateTaskCount(task, -1); + reEntryGuard && + task._transitionTo(notScheduled, running, notScheduled); + } + } + _currentZoneFrame = _currentZoneFrame.parent; + _currentTask = previousTask; + } + }; + Zone.prototype.scheduleTask = function (task) { + if (task.zone && task.zone !== this) { + // check if the task was rescheduled, the newZone + // should not be the children of the original zone + var newZone = this; + while (newZone) { + if (newZone === task.zone) { + throw Error("can not reschedule task to " + this.name + " which is descendants of the original zone " + task.zone.name); + } + newZone = newZone.parent; + } + } + task._transitionTo(scheduling, notScheduled); + var zoneDelegates = []; + task._zoneDelegates = zoneDelegates; + task._zone = this; + try { + task = this._zoneDelegate.scheduleTask(this, task); + } + catch (err) { + // should set task's state to unknown when scheduleTask throw error + // because the err may from reschedule, so the fromState maybe notScheduled + task._transitionTo(unknown, scheduling, notScheduled); + // TODO: @JiaLiPassion, should we check the result from handleError? + this._zoneDelegate.handleError(this, err); + throw err; + } + if (task._zoneDelegates === zoneDelegates) { + // we have to check because internally the delegate can reschedule the task. + this._updateTaskCount(task, 1); + } + if (task.state == scheduling) { + task._transitionTo(scheduled, scheduling); + } + return task; + }; + Zone.prototype.scheduleMicroTask = function (source, callback, data, customSchedule) { + return this.scheduleTask(new ZoneTask(microTask, source, callback, data, customSchedule, undefined)); + }; + Zone.prototype.scheduleMacroTask = function (source, callback, data, customSchedule, customCancel) { + return this.scheduleTask(new ZoneTask(macroTask, source, callback, data, customSchedule, customCancel)); + }; + Zone.prototype.scheduleEventTask = function (source, callback, data, customSchedule, customCancel) { + return this.scheduleTask(new ZoneTask(eventTask, source, callback, data, customSchedule, customCancel)); + }; + Zone.prototype.cancelTask = function (task) { + if (task.zone != this) + throw new Error('A task can only be cancelled in the zone of creation! (Creation: ' + + (task.zone || NO_ZONE).name + '; Execution: ' + this.name + ')'); + task._transitionTo(canceling, scheduled, running); + try { + this._zoneDelegate.cancelTask(this, task); + } + catch (err) { + // if error occurs when cancelTask, transit the state to unknown + task._transitionTo(unknown, canceling); + this._zoneDelegate.handleError(this, err); + throw err; + } + this._updateTaskCount(task, -1); + task._transitionTo(notScheduled, canceling); + task.runCount = 0; + return task; + }; + Zone.prototype._updateTaskCount = function (task, count) { + var zoneDelegates = task._zoneDelegates; + if (count == -1) { + task._zoneDelegates = null; + } + for (var i = 0; i < zoneDelegates.length; i++) { + zoneDelegates[i]._updateTaskCount(task.type, count); + } + }; + Zone.__symbol__ = __symbol__; + return Zone; + }()); + var DELEGATE_ZS = { + name: '', + onHasTask: function (delegate, _, target, hasTaskState) { return delegate.hasTask(target, hasTaskState); }, + onScheduleTask: function (delegate, _, target, task) { + return delegate.scheduleTask(target, task); + }, + onInvokeTask: function (delegate, _, target, task, applyThis, applyArgs) { + return delegate.invokeTask(target, task, applyThis, applyArgs); + }, + onCancelTask: function (delegate, _, target, task) { return delegate.cancelTask(target, task); } + }; + var ZoneDelegate = /** @class */ (function () { + function ZoneDelegate(zone, parentDelegate, zoneSpec) { + this._taskCounts = { 'microTask': 0, 'macroTask': 0, 'eventTask': 0 }; + this.zone = zone; + this._parentDelegate = parentDelegate; + this._forkZS = zoneSpec && (zoneSpec && zoneSpec.onFork ? zoneSpec : parentDelegate._forkZS); + this._forkDlgt = zoneSpec && (zoneSpec.onFork ? parentDelegate : parentDelegate._forkDlgt); + this._forkCurrZone = zoneSpec && (zoneSpec.onFork ? this.zone : parentDelegate.zone); + this._interceptZS = + zoneSpec && (zoneSpec.onIntercept ? zoneSpec : parentDelegate._interceptZS); + this._interceptDlgt = + zoneSpec && (zoneSpec.onIntercept ? parentDelegate : parentDelegate._interceptDlgt); + this._interceptCurrZone = + zoneSpec && (zoneSpec.onIntercept ? this.zone : parentDelegate.zone); + this._invokeZS = zoneSpec && (zoneSpec.onInvoke ? zoneSpec : parentDelegate._invokeZS); + this._invokeDlgt = + zoneSpec && (zoneSpec.onInvoke ? parentDelegate : parentDelegate._invokeDlgt); + this._invokeCurrZone = zoneSpec && (zoneSpec.onInvoke ? this.zone : parentDelegate.zone); + this._handleErrorZS = + zoneSpec && (zoneSpec.onHandleError ? zoneSpec : parentDelegate._handleErrorZS); + this._handleErrorDlgt = + zoneSpec && (zoneSpec.onHandleError ? parentDelegate : parentDelegate._handleErrorDlgt); + this._handleErrorCurrZone = + zoneSpec && (zoneSpec.onHandleError ? this.zone : parentDelegate.zone); + this._scheduleTaskZS = + zoneSpec && (zoneSpec.onScheduleTask ? zoneSpec : parentDelegate._scheduleTaskZS); + this._scheduleTaskDlgt = zoneSpec && + (zoneSpec.onScheduleTask ? parentDelegate : parentDelegate._scheduleTaskDlgt); + this._scheduleTaskCurrZone = + zoneSpec && (zoneSpec.onScheduleTask ? this.zone : parentDelegate.zone); + this._invokeTaskZS = + zoneSpec && (zoneSpec.onInvokeTask ? zoneSpec : parentDelegate._invokeTaskZS); + this._invokeTaskDlgt = + zoneSpec && (zoneSpec.onInvokeTask ? parentDelegate : parentDelegate._invokeTaskDlgt); + this._invokeTaskCurrZone = + zoneSpec && (zoneSpec.onInvokeTask ? this.zone : parentDelegate.zone); + this._cancelTaskZS = + zoneSpec && (zoneSpec.onCancelTask ? zoneSpec : parentDelegate._cancelTaskZS); + this._cancelTaskDlgt = + zoneSpec && (zoneSpec.onCancelTask ? parentDelegate : parentDelegate._cancelTaskDlgt); + this._cancelTaskCurrZone = + zoneSpec && (zoneSpec.onCancelTask ? this.zone : parentDelegate.zone); + this._hasTaskZS = null; + this._hasTaskDlgt = null; + this._hasTaskDlgtOwner = null; + this._hasTaskCurrZone = null; + var zoneSpecHasTask = zoneSpec && zoneSpec.onHasTask; + var parentHasTask = parentDelegate && parentDelegate._hasTaskZS; + if (zoneSpecHasTask || parentHasTask) { + // If we need to report hasTask, than this ZS needs to do ref counting on tasks. In such + // a case all task related interceptors must go through this ZD. We can't short circuit it. + this._hasTaskZS = zoneSpecHasTask ? zoneSpec : DELEGATE_ZS; + this._hasTaskDlgt = parentDelegate; + this._hasTaskDlgtOwner = this; + this._hasTaskCurrZone = zone; + if (!zoneSpec.onScheduleTask) { + this._scheduleTaskZS = DELEGATE_ZS; + this._scheduleTaskDlgt = parentDelegate; + this._scheduleTaskCurrZone = this.zone; + } + if (!zoneSpec.onInvokeTask) { + this._invokeTaskZS = DELEGATE_ZS; + this._invokeTaskDlgt = parentDelegate; + this._invokeTaskCurrZone = this.zone; + } + if (!zoneSpec.onCancelTask) { + this._cancelTaskZS = DELEGATE_ZS; + this._cancelTaskDlgt = parentDelegate; + this._cancelTaskCurrZone = this.zone; + } + } + } + ZoneDelegate.prototype.fork = function (targetZone, zoneSpec) { + return this._forkZS ? this._forkZS.onFork(this._forkDlgt, this.zone, targetZone, zoneSpec) : + new Zone(targetZone, zoneSpec); + }; + ZoneDelegate.prototype.intercept = function (targetZone, callback, source) { + return this._interceptZS ? + this._interceptZS.onIntercept(this._interceptDlgt, this._interceptCurrZone, targetZone, callback, source) : + callback; + }; + ZoneDelegate.prototype.invoke = function (targetZone, callback, applyThis, applyArgs, source) { + return this._invokeZS ? this._invokeZS.onInvoke(this._invokeDlgt, this._invokeCurrZone, targetZone, callback, applyThis, applyArgs, source) : + callback.apply(applyThis, applyArgs); + }; + ZoneDelegate.prototype.handleError = function (targetZone, error) { + return this._handleErrorZS ? + this._handleErrorZS.onHandleError(this._handleErrorDlgt, this._handleErrorCurrZone, targetZone, error) : + true; + }; + ZoneDelegate.prototype.scheduleTask = function (targetZone, task) { + var returnTask = task; + if (this._scheduleTaskZS) { + if (this._hasTaskZS) { + returnTask._zoneDelegates.push(this._hasTaskDlgtOwner); + } + returnTask = this._scheduleTaskZS.onScheduleTask(this._scheduleTaskDlgt, this._scheduleTaskCurrZone, targetZone, task); + if (!returnTask) + returnTask = task; + } + else { + if (task.scheduleFn) { + task.scheduleFn(task); + } + else if (task.type == microTask) { + scheduleMicroTask(task); + } + else { + throw new Error('Task is missing scheduleFn.'); + } + } + return returnTask; + }; + ZoneDelegate.prototype.invokeTask = function (targetZone, task, applyThis, applyArgs) { + return this._invokeTaskZS ? this._invokeTaskZS.onInvokeTask(this._invokeTaskDlgt, this._invokeTaskCurrZone, targetZone, task, applyThis, applyArgs) : + task.callback.apply(applyThis, applyArgs); + }; + ZoneDelegate.prototype.cancelTask = function (targetZone, task) { + var value; + if (this._cancelTaskZS) { + value = this._cancelTaskZS.onCancelTask(this._cancelTaskDlgt, this._cancelTaskCurrZone, targetZone, task); + } + else { + if (!task.cancelFn) { + throw Error('Task is not cancelable'); + } + value = task.cancelFn(task); + } + return value; + }; + ZoneDelegate.prototype.hasTask = function (targetZone, isEmpty) { + // hasTask should not throw error so other ZoneDelegate + // can still trigger hasTask callback + try { + this._hasTaskZS && + this._hasTaskZS.onHasTask(this._hasTaskDlgt, this._hasTaskCurrZone, targetZone, isEmpty); + } + catch (err) { + this.handleError(targetZone, err); + } + }; + ZoneDelegate.prototype._updateTaskCount = function (type, count) { + var counts = this._taskCounts; + var prev = counts[type]; + var next = counts[type] = prev + count; + if (next < 0) { + throw new Error('More tasks executed then were scheduled.'); + } + if (prev == 0 || next == 0) { + var isEmpty = { + microTask: counts['microTask'] > 0, + macroTask: counts['macroTask'] > 0, + eventTask: counts['eventTask'] > 0, + change: type + }; + this.hasTask(this.zone, isEmpty); + } + }; + return ZoneDelegate; + }()); + var ZoneTask = /** @class */ (function () { + function ZoneTask(type, source, callback, options, scheduleFn, cancelFn) { + this._zone = null; + this.runCount = 0; + this._zoneDelegates = null; + this._state = 'notScheduled'; + this.type = type; + this.source = source; + this.data = options; + this.scheduleFn = scheduleFn; + this.cancelFn = cancelFn; + this.callback = callback; + var self = this; + // TODO: @JiaLiPassion options should have interface + if (type === eventTask && options && options.useG) { + this.invoke = ZoneTask.invokeTask; + } + else { + this.invoke = function () { + return ZoneTask.invokeTask.call(global, self, this, arguments); + }; + } + } + ZoneTask.invokeTask = function (task, target, args) { + if (!task) { + task = this; + } + _numberOfNestedTaskFrames++; + try { + task.runCount++; + return task.zone.runTask(task, target, args); + } + finally { + if (_numberOfNestedTaskFrames == 1) { + drainMicroTaskQueue(); + } + _numberOfNestedTaskFrames--; + } + }; + Object.defineProperty(ZoneTask.prototype, "zone", { + get: function () { + return this._zone; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(ZoneTask.prototype, "state", { + get: function () { + return this._state; + }, + enumerable: true, + configurable: true + }); + ZoneTask.prototype.cancelScheduleRequest = function () { + this._transitionTo(notScheduled, scheduling); + }; + ZoneTask.prototype._transitionTo = function (toState, fromState1, fromState2) { + if (this._state === fromState1 || this._state === fromState2) { + this._state = toState; + if (toState == notScheduled) { + this._zoneDelegates = null; + } + } + else { + throw new Error(this.type + " '" + this.source + "': can not transition to '" + toState + "', expecting state '" + fromState1 + "'" + (fromState2 ? ' or \'' + fromState2 + '\'' : '') + ", was '" + this._state + "'."); + } + }; + ZoneTask.prototype.toString = function () { + if (this.data && typeof this.data.handleId !== 'undefined') { + return this.data.handleId.toString(); + } + else { + return Object.prototype.toString.call(this); + } + }; + // add toJSON method to prevent cyclic error when + // call JSON.stringify(zoneTask) + ZoneTask.prototype.toJSON = function () { + return { + type: this.type, + state: this.state, + source: this.source, + zone: this.zone.name, + runCount: this.runCount + }; + }; + return ZoneTask; + }()); + ////////////////////////////////////////////////////// + ////////////////////////////////////////////////////// + /// MICROTASK QUEUE + ////////////////////////////////////////////////////// + ////////////////////////////////////////////////////// + var symbolSetTimeout = __symbol__('setTimeout'); + var symbolPromise = __symbol__('Promise'); + var symbolThen = __symbol__('then'); + var _microTaskQueue = []; + var _isDrainingMicrotaskQueue = false; + var nativeMicroTaskQueuePromise; + function scheduleMicroTask(task) { + // if we are not running in any task, and there has not been anything scheduled + // we must bootstrap the initial task creation by manually scheduling the drain + if (_numberOfNestedTaskFrames === 0 && _microTaskQueue.length === 0) { + // We are not running in Task, so we need to kickstart the microtask queue. + if (!nativeMicroTaskQueuePromise) { + if (global[symbolPromise]) { + nativeMicroTaskQueuePromise = global[symbolPromise].resolve(0); + } + } + if (nativeMicroTaskQueuePromise) { + var nativeThen = nativeMicroTaskQueuePromise[symbolThen]; + if (!nativeThen) { + // native Promise is not patchable, we need to use `then` directly + // issue 1078 + nativeThen = nativeMicroTaskQueuePromise['then']; + } + nativeThen.call(nativeMicroTaskQueuePromise, drainMicroTaskQueue); + } + else { + global[symbolSetTimeout](drainMicroTaskQueue, 0); + } + } + task && _microTaskQueue.push(task); + } + function drainMicroTaskQueue() { + if (!_isDrainingMicrotaskQueue) { + _isDrainingMicrotaskQueue = true; + while (_microTaskQueue.length) { + var queue = _microTaskQueue; + _microTaskQueue = []; + for (var i = 0; i < queue.length; i++) { + var task = queue[i]; + try { + task.zone.runTask(task, null, null); + } + catch (error) { + _api.onUnhandledError(error); + } + } + } + _api.microtaskDrainDone(); + _isDrainingMicrotaskQueue = false; + } + } + ////////////////////////////////////////////////////// + ////////////////////////////////////////////////////// + /// BOOTSTRAP + ////////////////////////////////////////////////////// + ////////////////////////////////////////////////////// + var NO_ZONE = { name: 'NO ZONE' }; + var notScheduled = 'notScheduled', scheduling = 'scheduling', scheduled = 'scheduled', running = 'running', canceling = 'canceling', unknown = 'unknown'; + var microTask = 'microTask', macroTask = 'macroTask', eventTask = 'eventTask'; + var patches = {}; + var _api = { + symbol: __symbol__, + currentZoneFrame: function () { return _currentZoneFrame; }, + onUnhandledError: noop, + microtaskDrainDone: noop, + scheduleMicroTask: scheduleMicroTask, + showUncaughtError: function () { return !Zone[__symbol__('ignoreConsoleErrorUncaughtError')]; }, + patchEventTarget: function () { return []; }, + patchOnProperties: noop, + patchMethod: function () { return noop; }, + bindArguments: function () { return []; }, + patchThen: function () { return noop; }, + setNativePromise: function (NativePromise) { + // sometimes NativePromise.resolve static function + // is not ready yet, (such as core-js/es6.promise) + // so we need to check here. + if (NativePromise && typeof NativePromise.resolve === 'function') { + nativeMicroTaskQueuePromise = NativePromise.resolve(0); + } + }, + }; + var _currentZoneFrame = { parent: null, zone: new Zone(null, null) }; + var _currentTask = null; + var _numberOfNestedTaskFrames = 0; + function noop() { } + function __symbol__(name) { + return '__zone_symbol__' + name; + } + performanceMeasure('Zone', 'Zone'); + return global['Zone'] = Zone; +})(typeof window !== 'undefined' && window || typeof self !== 'undefined' && self || global); + +var __values = (undefined && undefined.__values) || function (o) { + var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0; + if (m) return m.call(o); + return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; +}; +Zone.__load_patch('ZoneAwarePromise', function (global, Zone, api) { + var ObjectGetOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; + var ObjectDefineProperty = Object.defineProperty; + function readableObjectToString(obj) { + if (obj && obj.toString === Object.prototype.toString) { + var className = obj.constructor && obj.constructor.name; + return (className ? className : '') + ': ' + JSON.stringify(obj); + } + return obj ? obj.toString() : Object.prototype.toString.call(obj); + } + var __symbol__ = api.symbol; + var _uncaughtPromiseErrors = []; + var symbolPromise = __symbol__('Promise'); + var symbolThen = __symbol__('then'); + var creationTrace = '__creationTrace__'; + api.onUnhandledError = function (e) { + if (api.showUncaughtError()) { + var rejection = e && e.rejection; + if (rejection) { + console.error('Unhandled Promise rejection:', rejection instanceof Error ? rejection.message : rejection, '; Zone:', e.zone.name, '; Task:', e.task && e.task.source, '; Value:', rejection, rejection instanceof Error ? rejection.stack : undefined); + } + else { + console.error(e); + } + } + }; + api.microtaskDrainDone = function () { + while (_uncaughtPromiseErrors.length) { + var _loop_1 = function () { + var uncaughtPromiseError = _uncaughtPromiseErrors.shift(); + try { + uncaughtPromiseError.zone.runGuarded(function () { + throw uncaughtPromiseError; + }); + } + catch (error) { + handleUnhandledRejection(error); + } + }; + while (_uncaughtPromiseErrors.length) { + _loop_1(); + } + } + }; + var UNHANDLED_PROMISE_REJECTION_HANDLER_SYMBOL = __symbol__('unhandledPromiseRejectionHandler'); + function handleUnhandledRejection(e) { + api.onUnhandledError(e); + try { + var handler = Zone[UNHANDLED_PROMISE_REJECTION_HANDLER_SYMBOL]; + if (handler && typeof handler === 'function') { + handler.call(this, e); + } + } + catch (err) { + } + } + function isThenable(value) { + return value && value.then; + } + function forwardResolution(value) { + return value; + } + function forwardRejection(rejection) { + return ZoneAwarePromise.reject(rejection); + } + var symbolState = __symbol__('state'); + var symbolValue = __symbol__('value'); + var symbolFinally = __symbol__('finally'); + var symbolParentPromiseValue = __symbol__('parentPromiseValue'); + var symbolParentPromiseState = __symbol__('parentPromiseState'); + var source = 'Promise.then'; + var UNRESOLVED = null; + var RESOLVED = true; + var REJECTED = false; + var REJECTED_NO_CATCH = 0; + function makeResolver(promise, state) { + return function (v) { + try { + resolvePromise(promise, state, v); + } + catch (err) { + resolvePromise(promise, false, err); + } + // Do not return value or you will break the Promise spec. + }; + } + var once = function () { + var wasCalled = false; + return function wrapper(wrappedFunction) { + return function () { + if (wasCalled) { + return; + } + wasCalled = true; + wrappedFunction.apply(null, arguments); + }; + }; + }; + var TYPE_ERROR = 'Promise resolved with itself'; + var CURRENT_TASK_TRACE_SYMBOL = __symbol__('currentTaskTrace'); + // Promise Resolution + function resolvePromise(promise, state, value) { + var onceWrapper = once(); + if (promise === value) { + throw new TypeError(TYPE_ERROR); + } + if (promise[symbolState] === UNRESOLVED) { + // should only get value.then once based on promise spec. + var then = null; + try { + if (typeof value === 'object' || typeof value === 'function') { + then = value && value.then; + } + } + catch (err) { + onceWrapper(function () { + resolvePromise(promise, false, err); + })(); + return promise; + } + // if (value instanceof ZoneAwarePromise) { + if (state !== REJECTED && value instanceof ZoneAwarePromise && + value.hasOwnProperty(symbolState) && value.hasOwnProperty(symbolValue) && + value[symbolState] !== UNRESOLVED) { + clearRejectedNoCatch(value); + resolvePromise(promise, value[symbolState], value[symbolValue]); + } + else if (state !== REJECTED && typeof then === 'function') { + try { + then.call(value, onceWrapper(makeResolver(promise, state)), onceWrapper(makeResolver(promise, false))); + } + catch (err) { + onceWrapper(function () { + resolvePromise(promise, false, err); + })(); + } + } + else { + promise[symbolState] = state; + var queue = promise[symbolValue]; + promise[symbolValue] = value; + if (promise[symbolFinally] === symbolFinally) { + // the promise is generated by Promise.prototype.finally + if (state === RESOLVED) { + // the state is resolved, should ignore the value + // and use parent promise value + promise[symbolState] = promise[symbolParentPromiseState]; + promise[symbolValue] = promise[symbolParentPromiseValue]; + } + } + // record task information in value when error occurs, so we can + // do some additional work such as render longStackTrace + if (state === REJECTED && value instanceof Error) { + // check if longStackTraceZone is here + var trace = Zone.currentTask && Zone.currentTask.data && + Zone.currentTask.data[creationTrace]; + if (trace) { + // only keep the long stack trace into error when in longStackTraceZone + ObjectDefineProperty(value, CURRENT_TASK_TRACE_SYMBOL, { configurable: true, enumerable: false, writable: true, value: trace }); + } + } + for (var i = 0; i < queue.length;) { + scheduleResolveOrReject(promise, queue[i++], queue[i++], queue[i++], queue[i++]); + } + if (queue.length == 0 && state == REJECTED) { + promise[symbolState] = REJECTED_NO_CATCH; + try { + // try to print more readable error log + throw new Error('Uncaught (in promise): ' + readableObjectToString(value) + + (value && value.stack ? '\n' + value.stack : '')); + } + catch (err) { + var error_1 = err; + error_1.rejection = value; + error_1.promise = promise; + error_1.zone = Zone.current; + error_1.task = Zone.currentTask; + _uncaughtPromiseErrors.push(error_1); + api.scheduleMicroTask(); // to make sure that it is running + } + } + } + } + // Resolving an already resolved promise is a noop. + return promise; + } + var REJECTION_HANDLED_HANDLER = __symbol__('rejectionHandledHandler'); + function clearRejectedNoCatch(promise) { + if (promise[symbolState] === REJECTED_NO_CATCH) { + // if the promise is rejected no catch status + // and queue.length > 0, means there is a error handler + // here to handle the rejected promise, we should trigger + // windows.rejectionhandled eventHandler or nodejs rejectionHandled + // eventHandler + try { + var handler = Zone[REJECTION_HANDLED_HANDLER]; + if (handler && typeof handler === 'function') { + handler.call(this, { rejection: promise[symbolValue], promise: promise }); + } + } + catch (err) { + } + promise[symbolState] = REJECTED; + for (var i = 0; i < _uncaughtPromiseErrors.length; i++) { + if (promise === _uncaughtPromiseErrors[i].promise) { + _uncaughtPromiseErrors.splice(i, 1); + } + } + } + } + function scheduleResolveOrReject(promise, zone, chainPromise, onFulfilled, onRejected) { + clearRejectedNoCatch(promise); + var promiseState = promise[symbolState]; + var delegate = promiseState ? + (typeof onFulfilled === 'function') ? onFulfilled : forwardResolution : + (typeof onRejected === 'function') ? onRejected : forwardRejection; + zone.scheduleMicroTask(source, function () { + try { + var parentPromiseValue = promise[symbolValue]; + var isFinallyPromise = chainPromise && symbolFinally === chainPromise[symbolFinally]; + if (isFinallyPromise) { + // if the promise is generated from finally call, keep parent promise's state and value + chainPromise[symbolParentPromiseValue] = parentPromiseValue; + chainPromise[symbolParentPromiseState] = promiseState; + } + // should not pass value to finally callback + var value = zone.run(delegate, undefined, isFinallyPromise && delegate !== forwardRejection && delegate !== forwardResolution ? + [] : + [parentPromiseValue]); + resolvePromise(chainPromise, true, value); + } + catch (error) { + // if error occurs, should always return this error + resolvePromise(chainPromise, false, error); + } + }, chainPromise); + } + var ZONE_AWARE_PROMISE_TO_STRING = 'function ZoneAwarePromise() { [native code] }'; + var ZoneAwarePromise = /** @class */ (function () { + function ZoneAwarePromise(executor) { + var promise = this; + if (!(promise instanceof ZoneAwarePromise)) { + throw new Error('Must be an instanceof Promise.'); + } + promise[symbolState] = UNRESOLVED; + promise[symbolValue] = []; // queue; + try { + executor && executor(makeResolver(promise, RESOLVED), makeResolver(promise, REJECTED)); + } + catch (error) { + resolvePromise(promise, false, error); + } + } + ZoneAwarePromise.toString = function () { + return ZONE_AWARE_PROMISE_TO_STRING; + }; + ZoneAwarePromise.resolve = function (value) { + return resolvePromise(new this(null), RESOLVED, value); + }; + ZoneAwarePromise.reject = function (error) { + return resolvePromise(new this(null), REJECTED, error); + }; + ZoneAwarePromise.race = function (values) { + var e_1, _a; + var resolve; + var reject; + var promise = new this(function (res, rej) { + resolve = res; + reject = rej; + }); + function onResolve(value) { + promise && (promise = null || resolve(value)); + } + function onReject(error) { + promise && (promise = null || reject(error)); + } + try { + for (var values_1 = __values(values), values_1_1 = values_1.next(); !values_1_1.done; values_1_1 = values_1.next()) { + var value = values_1_1.value; + if (!isThenable(value)) { + value = this.resolve(value); + } + value.then(onResolve, onReject); + } + } + catch (e_1_1) { e_1 = { error: e_1_1 }; } + finally { + try { + if (values_1_1 && !values_1_1.done && (_a = values_1.return)) _a.call(values_1); + } + finally { if (e_1) throw e_1.error; } + } + return promise; + }; + ZoneAwarePromise.all = function (values) { + var e_2, _a; + var resolve; + var reject; + var promise = new this(function (res, rej) { + resolve = res; + reject = rej; + }); + // Start at 2 to prevent prematurely resolving if .then is called immediately. + var unresolvedCount = 2; + var valueIndex = 0; + var resolvedValues = []; + var _loop_2 = function (value) { + if (!isThenable(value)) { + value = this_1.resolve(value); + } + var curValueIndex = valueIndex; + value.then(function (value) { + resolvedValues[curValueIndex] = value; + unresolvedCount--; + if (unresolvedCount === 0) { + resolve(resolvedValues); + } + }, reject); + unresolvedCount++; + valueIndex++; + }; + var this_1 = this; + try { + for (var values_2 = __values(values), values_2_1 = values_2.next(); !values_2_1.done; values_2_1 = values_2.next()) { + var value = values_2_1.value; + _loop_2(value); + } + } + catch (e_2_1) { e_2 = { error: e_2_1 }; } + finally { + try { + if (values_2_1 && !values_2_1.done && (_a = values_2.return)) _a.call(values_2); + } + finally { if (e_2) throw e_2.error; } + } + // Make the unresolvedCount zero-based again. + unresolvedCount -= 2; + if (unresolvedCount === 0) { + resolve(resolvedValues); + } + return promise; + }; + ZoneAwarePromise.prototype.then = function (onFulfilled, onRejected) { + var chainPromise = new this.constructor(null); + var zone = Zone.current; + if (this[symbolState] == UNRESOLVED) { + this[symbolValue].push(zone, chainPromise, onFulfilled, onRejected); + } + else { + scheduleResolveOrReject(this, zone, chainPromise, onFulfilled, onRejected); + } + return chainPromise; + }; + ZoneAwarePromise.prototype.catch = function (onRejected) { + return this.then(null, onRejected); + }; + ZoneAwarePromise.prototype.finally = function (onFinally) { + var chainPromise = new this.constructor(null); + chainPromise[symbolFinally] = symbolFinally; + var zone = Zone.current; + if (this[symbolState] == UNRESOLVED) { + this[symbolValue].push(zone, chainPromise, onFinally, onFinally); + } + else { + scheduleResolveOrReject(this, zone, chainPromise, onFinally, onFinally); + } + return chainPromise; + }; + return ZoneAwarePromise; + }()); + // Protect against aggressive optimizers dropping seemingly unused properties. + // E.g. Closure Compiler in advanced mode. + ZoneAwarePromise['resolve'] = ZoneAwarePromise.resolve; + ZoneAwarePromise['reject'] = ZoneAwarePromise.reject; + ZoneAwarePromise['race'] = ZoneAwarePromise.race; + ZoneAwarePromise['all'] = ZoneAwarePromise.all; + var NativePromise = global[symbolPromise] = global['Promise']; + var ZONE_AWARE_PROMISE = Zone.__symbol__('ZoneAwarePromise'); + var desc = ObjectGetOwnPropertyDescriptor(global, 'Promise'); + if (!desc || desc.configurable) { + desc && delete desc.writable; + desc && delete desc.value; + if (!desc) { + desc = { configurable: true, enumerable: true }; + } + desc.get = function () { + // if we already set ZoneAwarePromise, use patched one + // otherwise return native one. + return global[ZONE_AWARE_PROMISE] ? global[ZONE_AWARE_PROMISE] : global[symbolPromise]; + }; + desc.set = function (NewNativePromise) { + if (NewNativePromise === ZoneAwarePromise) { + // if the NewNativePromise is ZoneAwarePromise + // save to global + global[ZONE_AWARE_PROMISE] = NewNativePromise; + } + else { + // if the NewNativePromise is not ZoneAwarePromise + // for example: after load zone.js, some library just + // set es6-promise to global, if we set it to global + // directly, assertZonePatched will fail and angular + // will not loaded, so we just set the NewNativePromise + // to global[symbolPromise], so the result is just like + // we load ES6 Promise before zone.js + global[symbolPromise] = NewNativePromise; + if (!NewNativePromise.prototype[symbolThen]) { + patchThen(NewNativePromise); + } + api.setNativePromise(NewNativePromise); + } + }; + ObjectDefineProperty(global, 'Promise', desc); + } + global['Promise'] = ZoneAwarePromise; + var symbolThenPatched = __symbol__('thenPatched'); + function patchThen(Ctor) { + var proto = Ctor.prototype; + var prop = ObjectGetOwnPropertyDescriptor(proto, 'then'); + if (prop && (prop.writable === false || !prop.configurable)) { + // check Ctor.prototype.then propertyDescriptor is writable or not + // in meteor env, writable is false, we should ignore such case + return; + } + var originalThen = proto.then; + // Keep a reference to the original method. + proto[symbolThen] = originalThen; + Ctor.prototype.then = function (onResolve, onReject) { + var _this = this; + var wrapped = new ZoneAwarePromise(function (resolve, reject) { + originalThen.call(_this, resolve, reject); + }); + return wrapped.then(onResolve, onReject); + }; + Ctor[symbolThenPatched] = true; + } + api.patchThen = patchThen; + if (NativePromise) { + patchThen(NativePromise); + } + // This is not part of public API, but it is useful for tests, so we expose it. + Promise[Zone.__symbol__('uncaughtPromiseErrors')] = _uncaughtPromiseErrors; + return ZoneAwarePromise; +}); + +/** + * @license + * Copyright Google Inc. All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ +Zone.__load_patch('fetch', function (global, Zone, api) { + var fetch = global['fetch']; + var ZoneAwarePromise = global.Promise; + var symbolThenPatched = api.symbol('thenPatched'); + var fetchTaskScheduling = api.symbol('fetchTaskScheduling'); + var fetchTaskAborting = api.symbol('fetchTaskAborting'); + if (typeof fetch !== 'function') { + return; + } + var OriginalAbortController = global['AbortController']; + var supportAbort = typeof OriginalAbortController === 'function'; + var abortNative = null; + if (supportAbort) { + global['AbortController'] = function () { + var abortController = new OriginalAbortController(); + var signal = abortController.signal; + signal.abortController = abortController; + return abortController; + }; + abortNative = api.patchMethod(OriginalAbortController.prototype, 'abort', function (delegate) { return function (self, args) { + if (self.task) { + return self.task.zone.cancelTask(self.task); + } + return delegate.apply(self, args); + }; }); + } + var placeholder = function () { }; + global['fetch'] = function () { + var _this = this; + var args = Array.prototype.slice.call(arguments); + var options = args.length > 1 ? args[1] : null; + var signal = options && options.signal; + return new Promise(function (res, rej) { + var task = Zone.current.scheduleMacroTask('fetch', placeholder, args, function () { + var fetchPromise; + var zone = Zone.current; + try { + zone[fetchTaskScheduling] = true; + fetchPromise = fetch.apply(_this, args); + } + catch (error) { + rej(error); + return; + } + finally { + zone[fetchTaskScheduling] = false; + } + if (!(fetchPromise instanceof ZoneAwarePromise)) { + var ctor = fetchPromise.constructor; + if (!ctor[symbolThenPatched]) { + api.patchThen(ctor); + } + } + fetchPromise.then(function (resource) { + if (task.state !== 'notScheduled') { + task.invoke(); + } + res(resource); + }, function (error) { + if (task.state !== 'notScheduled') { + task.invoke(); + } + rej(error); + }); + }, function () { + if (!supportAbort) { + rej('No AbortController supported, can not cancel fetch'); + return; + } + if (signal && signal.abortController && !signal.aborted && + typeof signal.abortController.abort === 'function' && abortNative) { + try { + Zone.current[fetchTaskAborting] = true; + abortNative.call(signal.abortController); + } + finally { + Zone.current[fetchTaskAborting] = false; + } + } + else { + rej('cancel fetch need a AbortController.signal'); + } + }); + if (signal && signal.abortController) { + signal.abortController.task = task; + } + }); + }; +}); + +/** + * @license + * Copyright Google Inc. All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ +/** + * Suppress closure compiler errors about unknown 'Zone' variable + * @fileoverview + * @suppress {undefinedVars,globalThis,missingRequire} + */ +// issue #989, to reduce bundle size, use short name +/** Object.getOwnPropertyDescriptor */ +var ObjectGetOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; +/** Object.defineProperty */ +var ObjectDefineProperty = Object.defineProperty; +/** Object.getPrototypeOf */ +var ObjectGetPrototypeOf = Object.getPrototypeOf; +/** Object.create */ +var ObjectCreate = Object.create; +/** Array.prototype.slice */ +var ArraySlice = Array.prototype.slice; +/** addEventListener string const */ +var ADD_EVENT_LISTENER_STR = 'addEventListener'; +/** removeEventListener string const */ +var REMOVE_EVENT_LISTENER_STR = 'removeEventListener'; +/** zoneSymbol addEventListener */ +var ZONE_SYMBOL_ADD_EVENT_LISTENER = Zone.__symbol__(ADD_EVENT_LISTENER_STR); +/** zoneSymbol removeEventListener */ +var ZONE_SYMBOL_REMOVE_EVENT_LISTENER = Zone.__symbol__(REMOVE_EVENT_LISTENER_STR); +/** true string const */ +var TRUE_STR = 'true'; +/** false string const */ +var FALSE_STR = 'false'; +/** __zone_symbol__ string const */ +var ZONE_SYMBOL_PREFIX = '__zone_symbol__'; +function wrapWithCurrentZone(callback, source) { + return Zone.current.wrap(callback, source); +} +function scheduleMacroTaskWithCurrentZone(source, callback, data, customSchedule, customCancel) { + return Zone.current.scheduleMacroTask(source, callback, data, customSchedule, customCancel); +} +var zoneSymbol = Zone.__symbol__; +var isWindowExists = typeof window !== 'undefined'; +var internalWindow = isWindowExists ? window : undefined; +var _global = isWindowExists && internalWindow || typeof self === 'object' && self || global; +var REMOVE_ATTRIBUTE = 'removeAttribute'; +var NULL_ON_PROP_VALUE = [null]; +function bindArguments(args, source) { + for (var i = args.length - 1; i >= 0; i--) { + if (typeof args[i] === 'function') { + args[i] = wrapWithCurrentZone(args[i], source + '_' + i); + } + } + return args; +} +function patchPrototype(prototype, fnNames) { + var source = prototype.constructor['name']; + var _loop_1 = function (i) { + var name_1 = fnNames[i]; + var delegate = prototype[name_1]; + if (delegate) { + var prototypeDesc = ObjectGetOwnPropertyDescriptor(prototype, name_1); + if (!isPropertyWritable(prototypeDesc)) { + return "continue"; + } + prototype[name_1] = (function (delegate) { + var patched = function () { + return delegate.apply(this, bindArguments(arguments, source + '.' + name_1)); + }; + attachOriginToPatched(patched, delegate); + return patched; + })(delegate); + } + }; + for (var i = 0; i < fnNames.length; i++) { + _loop_1(i); + } +} +function isPropertyWritable(propertyDesc) { + if (!propertyDesc) { + return true; + } + if (propertyDesc.writable === false) { + return false; + } + return !(typeof propertyDesc.get === 'function' && typeof propertyDesc.set === 'undefined'); +} +var isWebWorker = (typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope); +// Make sure to access `process` through `_global` so that WebPack does not accidentally browserify +// this code. +var isNode = (!('nw' in _global) && typeof _global.process !== 'undefined' && + {}.toString.call(_global.process) === '[object process]'); +var isBrowser = !isNode && !isWebWorker && !!(isWindowExists && internalWindow['HTMLElement']); +// we are in electron of nw, so we are both browser and nodejs +// Make sure to access `process` through `_global` so that WebPack does not accidentally browserify +// this code. +var isMix = typeof _global.process !== 'undefined' && + {}.toString.call(_global.process) === '[object process]' && !isWebWorker && + !!(isWindowExists && internalWindow['HTMLElement']); +var zoneSymbolEventNames = {}; +var wrapFn = function (event) { + // https://github.com/angular/zone.js/issues/911, in IE, sometimes + // event will be undefined, so we need to use window.event + event = event || _global.event; + if (!event) { + return; + } + var eventNameSymbol = zoneSymbolEventNames[event.type]; + if (!eventNameSymbol) { + eventNameSymbol = zoneSymbolEventNames[event.type] = zoneSymbol('ON_PROPERTY' + event.type); + } + var target = this || event.target || _global; + var listener = target[eventNameSymbol]; + var result; + if (isBrowser && target === internalWindow && event.type === 'error') { + // window.onerror have different signiture + // https://developer.mozilla.org/en-US/docs/Web/API/GlobalEventHandlers/onerror#window.onerror + // and onerror callback will prevent default when callback return true + var errorEvent = event; + result = listener && + listener.call(this, errorEvent.message, errorEvent.filename, errorEvent.lineno, errorEvent.colno, errorEvent.error); + if (result === true) { + event.preventDefault(); + } + } + else { + result = listener && listener.apply(this, arguments); + if (result != undefined && !result) { + event.preventDefault(); + } + } + return result; +}; +function patchProperty(obj, prop, prototype) { + var desc = ObjectGetOwnPropertyDescriptor(obj, prop); + if (!desc && prototype) { + // when patch window object, use prototype to check prop exist or not + var prototypeDesc = ObjectGetOwnPropertyDescriptor(prototype, prop); + if (prototypeDesc) { + desc = { enumerable: true, configurable: true }; + } + } + // if the descriptor not exists or is not configurable + // just return + if (!desc || !desc.configurable) { + return; + } + var onPropPatchedSymbol = zoneSymbol('on' + prop + 'patched'); + if (obj.hasOwnProperty(onPropPatchedSymbol) && obj[onPropPatchedSymbol]) { + return; + } + // A property descriptor cannot have getter/setter and be writable + // deleting the writable and value properties avoids this error: + // + // TypeError: property descriptors must not specify a value or be writable when a + // getter or setter has been specified + delete desc.writable; + delete desc.value; + var originalDescGet = desc.get; + var originalDescSet = desc.set; + // substr(2) cuz 'onclick' -> 'click', etc + var eventName = prop.substr(2); + var eventNameSymbol = zoneSymbolEventNames[eventName]; + if (!eventNameSymbol) { + eventNameSymbol = zoneSymbolEventNames[eventName] = zoneSymbol('ON_PROPERTY' + eventName); + } + desc.set = function (newValue) { + // in some of windows's onproperty callback, this is undefined + // so we need to check it + var target = this; + if (!target && obj === _global) { + target = _global; + } + if (!target) { + return; + } + var previousValue = target[eventNameSymbol]; + if (previousValue) { + target.removeEventListener(eventName, wrapFn); + } + // issue #978, when onload handler was added before loading zone.js + // we should remove it with originalDescSet + if (originalDescSet) { + originalDescSet.apply(target, NULL_ON_PROP_VALUE); + } + if (typeof newValue === 'function') { + target[eventNameSymbol] = newValue; + target.addEventListener(eventName, wrapFn, false); + } + else { + target[eventNameSymbol] = null; + } + }; + // The getter would return undefined for unassigned properties but the default value of an + // unassigned property is null + desc.get = function () { + // in some of windows's onproperty callback, this is undefined + // so we need to check it + var target = this; + if (!target && obj === _global) { + target = _global; + } + if (!target) { + return null; + } + var listener = target[eventNameSymbol]; + if (listener) { + return listener; + } + else if (originalDescGet) { + // result will be null when use inline event attribute, + // such as + // because the onclick function is internal raw uncompiled handler + // the onclick will be evaluated when first time event was triggered or + // the property is accessed, https://github.com/angular/zone.js/issues/525 + // so we should use original native get to retrieve the handler + var value = originalDescGet && originalDescGet.call(this); + if (value) { + desc.set.call(this, value); + if (typeof target[REMOVE_ATTRIBUTE] === 'function') { + target.removeAttribute(prop); + } + return value; + } + } + return null; + }; + ObjectDefineProperty(obj, prop, desc); + obj[onPropPatchedSymbol] = true; +} +function patchOnProperties(obj, properties, prototype) { + if (properties) { + for (var i = 0; i < properties.length; i++) { + patchProperty(obj, 'on' + properties[i], prototype); + } + } + else { + var onProperties = []; + for (var prop in obj) { + if (prop.substr(0, 2) == 'on') { + onProperties.push(prop); + } + } + for (var j = 0; j < onProperties.length; j++) { + patchProperty(obj, onProperties[j], prototype); + } + } +} +var originalInstanceKey = zoneSymbol('originalInstance'); +// wrap some native API on `window` +function patchClass(className) { + var OriginalClass = _global[className]; + if (!OriginalClass) + return; + // keep original class in global + _global[zoneSymbol(className)] = OriginalClass; + _global[className] = function () { + var a = bindArguments(arguments, className); + switch (a.length) { + case 0: + this[originalInstanceKey] = new OriginalClass(); + break; + case 1: + this[originalInstanceKey] = new OriginalClass(a[0]); + break; + case 2: + this[originalInstanceKey] = new OriginalClass(a[0], a[1]); + break; + case 3: + this[originalInstanceKey] = new OriginalClass(a[0], a[1], a[2]); + break; + case 4: + this[originalInstanceKey] = new OriginalClass(a[0], a[1], a[2], a[3]); + break; + default: + throw new Error('Arg list too long.'); + } + }; + // attach original delegate to patched function + attachOriginToPatched(_global[className], OriginalClass); + var instance = new OriginalClass(function () { }); + var prop; + for (prop in instance) { + // https://bugs.webkit.org/show_bug.cgi?id=44721 + if (className === 'XMLHttpRequest' && prop === 'responseBlob') + continue; + (function (prop) { + if (typeof instance[prop] === 'function') { + _global[className].prototype[prop] = function () { + return this[originalInstanceKey][prop].apply(this[originalInstanceKey], arguments); + }; + } + else { + ObjectDefineProperty(_global[className].prototype, prop, { + set: function (fn) { + if (typeof fn === 'function') { + this[originalInstanceKey][prop] = wrapWithCurrentZone(fn, className + '.' + prop); + // keep callback in wrapped function so we can + // use it in Function.prototype.toString to return + // the native one. + attachOriginToPatched(this[originalInstanceKey][prop], fn); + } + else { + this[originalInstanceKey][prop] = fn; + } + }, + get: function () { + return this[originalInstanceKey][prop]; + } + }); + } + }(prop)); + } + for (prop in OriginalClass) { + if (prop !== 'prototype' && OriginalClass.hasOwnProperty(prop)) { + _global[className][prop] = OriginalClass[prop]; + } + } +} +function copySymbolProperties(src, dest) { + if (typeof Object.getOwnPropertySymbols !== 'function') { + return; + } + var symbols = Object.getOwnPropertySymbols(src); + symbols.forEach(function (symbol) { + var desc = Object.getOwnPropertyDescriptor(src, symbol); + Object.defineProperty(dest, symbol, { + get: function () { + return src[symbol]; + }, + set: function (value) { + if (desc && (!desc.writable || typeof desc.set !== 'function')) { + // if src[symbol] is not writable or not have a setter, just return + return; + } + src[symbol] = value; + }, + enumerable: desc ? desc.enumerable : true, + configurable: desc ? desc.configurable : true + }); + }); +} +var shouldCopySymbolProperties = false; + +function patchMethod(target, name, patchFn) { + var proto = target; + while (proto && !proto.hasOwnProperty(name)) { + proto = ObjectGetPrototypeOf(proto); + } + if (!proto && target[name]) { + // somehow we did not find it, but we can see it. This happens on IE for Window properties. + proto = target; + } + var delegateName = zoneSymbol(name); + var delegate = null; + if (proto && !(delegate = proto[delegateName])) { + delegate = proto[delegateName] = proto[name]; + // check whether proto[name] is writable + // some property is readonly in safari, such as HtmlCanvasElement.prototype.toBlob + var desc = proto && ObjectGetOwnPropertyDescriptor(proto, name); + if (isPropertyWritable(desc)) { + var patchDelegate_1 = patchFn(delegate, delegateName, name); + proto[name] = function () { + return patchDelegate_1(this, arguments); + }; + attachOriginToPatched(proto[name], delegate); + if (shouldCopySymbolProperties) { + copySymbolProperties(delegate, proto[name]); + } + } + } + return delegate; +} +// TODO: @JiaLiPassion, support cancel task later if necessary +function patchMacroTask(obj, funcName, metaCreator) { + var setNative = null; + function scheduleTask(task) { + var data = task.data; + data.args[data.cbIdx] = function () { + task.invoke.apply(this, arguments); + }; + setNative.apply(data.target, data.args); + return task; + } + setNative = patchMethod(obj, funcName, function (delegate) { return function (self, args) { + var meta = metaCreator(self, args); + if (meta.cbIdx >= 0 && typeof args[meta.cbIdx] === 'function') { + return scheduleMacroTaskWithCurrentZone(meta.name, args[meta.cbIdx], meta, scheduleTask); + } + else { + // cause an error by calling it directly. + return delegate.apply(self, args); + } + }; }); +} + +function attachOriginToPatched(patched, original) { + patched[zoneSymbol('OriginalDelegate')] = original; +} +var isDetectedIEOrEdge = false; +var ieOrEdge = false; +function isIE() { + try { + var ua = internalWindow.navigator.userAgent; + if (ua.indexOf('MSIE ') !== -1 || ua.indexOf('Trident/') !== -1) { + return true; + } + } + catch (error) { + } + return false; +} +function isIEOrEdge() { + if (isDetectedIEOrEdge) { + return ieOrEdge; + } + isDetectedIEOrEdge = true; + try { + var ua = internalWindow.navigator.userAgent; + if (ua.indexOf('MSIE ') !== -1 || ua.indexOf('Trident/') !== -1 || ua.indexOf('Edge/') !== -1) { + ieOrEdge = true; + } + return ieOrEdge; + } + catch (error) { + } +} + +/** + * @license + * Copyright Google Inc. All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ +// override Function.prototype.toString to make zone.js patched function +// look like native function +Zone.__load_patch('toString', function (global) { + // patch Func.prototype.toString to let them look like native + var originalFunctionToString = Function.prototype.toString; + var ORIGINAL_DELEGATE_SYMBOL = zoneSymbol('OriginalDelegate'); + var PROMISE_SYMBOL = zoneSymbol('Promise'); + var ERROR_SYMBOL = zoneSymbol('Error'); + var newFunctionToString = function toString() { + if (typeof this === 'function') { + var originalDelegate = this[ORIGINAL_DELEGATE_SYMBOL]; + if (originalDelegate) { + if (typeof originalDelegate === 'function') { + return originalFunctionToString.apply(this[ORIGINAL_DELEGATE_SYMBOL], arguments); + } + else { + return Object.prototype.toString.call(originalDelegate); + } + } + if (this === Promise) { + var nativePromise = global[PROMISE_SYMBOL]; + if (nativePromise) { + return originalFunctionToString.apply(nativePromise, arguments); + } + } + if (this === Error) { + var nativeError = global[ERROR_SYMBOL]; + if (nativeError) { + return originalFunctionToString.apply(nativeError, arguments); + } + } + } + return originalFunctionToString.apply(this, arguments); + }; + newFunctionToString[ORIGINAL_DELEGATE_SYMBOL] = originalFunctionToString; + Function.prototype.toString = newFunctionToString; + // patch Object.prototype.toString to let them look like native + var originalObjectToString = Object.prototype.toString; + var PROMISE_OBJECT_TO_STRING = '[object Promise]'; + Object.prototype.toString = function () { + if (this instanceof Promise) { + return PROMISE_OBJECT_TO_STRING; + } + return originalObjectToString.apply(this, arguments); + }; +}); + +/** + * @license + * Copyright Google Inc. All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ +/** + * @fileoverview + * @suppress {missingRequire} + */ +var passiveSupported = false; +if (typeof window !== 'undefined') { + try { + var options = Object.defineProperty({}, 'passive', { + get: function () { + passiveSupported = true; + } + }); + window.addEventListener('test', options, options); + window.removeEventListener('test', options, options); + } + catch (err) { + passiveSupported = false; + } +} +// an identifier to tell ZoneTask do not create a new invoke closure +var OPTIMIZED_ZONE_EVENT_TASK_DATA = { + useG: true +}; +var zoneSymbolEventNames$1 = {}; +var globalSources = {}; +var EVENT_NAME_SYMBOL_REGX = /^__zone_symbol__(\w+)(true|false)$/; +var IMMEDIATE_PROPAGATION_SYMBOL = ('__zone_symbol__propagationStopped'); +function patchEventTarget(_global, apis, patchOptions) { + var ADD_EVENT_LISTENER = (patchOptions && patchOptions.add) || ADD_EVENT_LISTENER_STR; + var REMOVE_EVENT_LISTENER = (patchOptions && patchOptions.rm) || REMOVE_EVENT_LISTENER_STR; + var LISTENERS_EVENT_LISTENER = (patchOptions && patchOptions.listeners) || 'eventListeners'; + var REMOVE_ALL_LISTENERS_EVENT_LISTENER = (patchOptions && patchOptions.rmAll) || 'removeAllListeners'; + var zoneSymbolAddEventListener = zoneSymbol(ADD_EVENT_LISTENER); + var ADD_EVENT_LISTENER_SOURCE = '.' + ADD_EVENT_LISTENER + ':'; + var PREPEND_EVENT_LISTENER = 'prependListener'; + var PREPEND_EVENT_LISTENER_SOURCE = '.' + PREPEND_EVENT_LISTENER + ':'; + var invokeTask = function (task, target, event) { + // for better performance, check isRemoved which is set + // by removeEventListener + if (task.isRemoved) { + return; + } + var delegate = task.callback; + if (typeof delegate === 'object' && delegate.handleEvent) { + // create the bind version of handleEvent when invoke + task.callback = function (event) { return delegate.handleEvent(event); }; + task.originalDelegate = delegate; + } + // invoke static task.invoke + task.invoke(task, target, [event]); + var options = task.options; + if (options && typeof options === 'object' && options.once) { + // if options.once is true, after invoke once remove listener here + // only browser need to do this, nodejs eventEmitter will cal removeListener + // inside EventEmitter.once + var delegate_1 = task.originalDelegate ? task.originalDelegate : task.callback; + target[REMOVE_EVENT_LISTENER].call(target, event.type, delegate_1, options); + } + }; + // global shared zoneAwareCallback to handle all event callback with capture = false + var globalZoneAwareCallback = function (event) { + // https://github.com/angular/zone.js/issues/911, in IE, sometimes + // event will be undefined, so we need to use window.event + event = event || _global.event; + if (!event) { + return; + } + // event.target is needed for Samsung TV and SourceBuffer + // || global is needed https://github.com/angular/zone.js/issues/190 + var target = this || event.target || _global; + var tasks = target[zoneSymbolEventNames$1[event.type][FALSE_STR]]; + if (tasks) { + // invoke all tasks which attached to current target with given event.type and capture = false + // for performance concern, if task.length === 1, just invoke + if (tasks.length === 1) { + invokeTask(tasks[0], target, event); + } + else { + // https://github.com/angular/zone.js/issues/836 + // copy the tasks array before invoke, to avoid + // the callback will remove itself or other listener + var copyTasks = tasks.slice(); + for (var i = 0; i < copyTasks.length; i++) { + if (event && event[IMMEDIATE_PROPAGATION_SYMBOL] === true) { + break; + } + invokeTask(copyTasks[i], target, event); + } + } + } + }; + // global shared zoneAwareCallback to handle all event callback with capture = true + var globalZoneAwareCaptureCallback = function (event) { + // https://github.com/angular/zone.js/issues/911, in IE, sometimes + // event will be undefined, so we need to use window.event + event = event || _global.event; + if (!event) { + return; + } + // event.target is needed for Samsung TV and SourceBuffer + // || global is needed https://github.com/angular/zone.js/issues/190 + var target = this || event.target || _global; + var tasks = target[zoneSymbolEventNames$1[event.type][TRUE_STR]]; + if (tasks) { + // invoke all tasks which attached to current target with given event.type and capture = false + // for performance concern, if task.length === 1, just invoke + if (tasks.length === 1) { + invokeTask(tasks[0], target, event); + } + else { + // https://github.com/angular/zone.js/issues/836 + // copy the tasks array before invoke, to avoid + // the callback will remove itself or other listener + var copyTasks = tasks.slice(); + for (var i = 0; i < copyTasks.length; i++) { + if (event && event[IMMEDIATE_PROPAGATION_SYMBOL] === true) { + break; + } + invokeTask(copyTasks[i], target, event); + } + } + } + }; + function patchEventTargetMethods(obj, patchOptions) { + if (!obj) { + return false; + } + var useGlobalCallback = true; + if (patchOptions && patchOptions.useG !== undefined) { + useGlobalCallback = patchOptions.useG; + } + var validateHandler = patchOptions && patchOptions.vh; + var checkDuplicate = true; + if (patchOptions && patchOptions.chkDup !== undefined) { + checkDuplicate = patchOptions.chkDup; + } + var returnTarget = false; + if (patchOptions && patchOptions.rt !== undefined) { + returnTarget = patchOptions.rt; + } + var proto = obj; + while (proto && !proto.hasOwnProperty(ADD_EVENT_LISTENER)) { + proto = ObjectGetPrototypeOf(proto); + } + if (!proto && obj[ADD_EVENT_LISTENER]) { + // somehow we did not find it, but we can see it. This happens on IE for Window properties. + proto = obj; + } + if (!proto) { + return false; + } + if (proto[zoneSymbolAddEventListener]) { + return false; + } + var eventNameToString = patchOptions && patchOptions.eventNameToString; + // a shared global taskData to pass data for scheduleEventTask + // so we do not need to create a new object just for pass some data + var taskData = {}; + var nativeAddEventListener = proto[zoneSymbolAddEventListener] = proto[ADD_EVENT_LISTENER]; + var nativeRemoveEventListener = proto[zoneSymbol(REMOVE_EVENT_LISTENER)] = + proto[REMOVE_EVENT_LISTENER]; + var nativeListeners = proto[zoneSymbol(LISTENERS_EVENT_LISTENER)] = + proto[LISTENERS_EVENT_LISTENER]; + var nativeRemoveAllListeners = proto[zoneSymbol(REMOVE_ALL_LISTENERS_EVENT_LISTENER)] = + proto[REMOVE_ALL_LISTENERS_EVENT_LISTENER]; + var nativePrependEventListener; + if (patchOptions && patchOptions.prepend) { + nativePrependEventListener = proto[zoneSymbol(patchOptions.prepend)] = + proto[patchOptions.prepend]; + } + function checkIsPassive(task) { + if (!passiveSupported && typeof taskData.options !== 'boolean' && + typeof taskData.options !== 'undefined' && taskData.options !== null) { + // options is a non-null non-undefined object + // passive is not supported + // don't pass options as object + // just pass capture as a boolean + task.options = !!taskData.options.capture; + taskData.options = task.options; + } + } + var customScheduleGlobal = function (task) { + // if there is already a task for the eventName + capture, + // just return, because we use the shared globalZoneAwareCallback here. + if (taskData.isExisting) { + return; + } + checkIsPassive(task); + return nativeAddEventListener.call(taskData.target, taskData.eventName, taskData.capture ? globalZoneAwareCaptureCallback : globalZoneAwareCallback, taskData.options); + }; + var customCancelGlobal = function (task) { + // if task is not marked as isRemoved, this call is directly + // from Zone.prototype.cancelTask, we should remove the task + // from tasksList of target first + if (!task.isRemoved) { + var symbolEventNames = zoneSymbolEventNames$1[task.eventName]; + var symbolEventName = void 0; + if (symbolEventNames) { + symbolEventName = symbolEventNames[task.capture ? TRUE_STR : FALSE_STR]; + } + var existingTasks = symbolEventName && task.target[symbolEventName]; + if (existingTasks) { + for (var i = 0; i < existingTasks.length; i++) { + var existingTask = existingTasks[i]; + if (existingTask === task) { + existingTasks.splice(i, 1); + // set isRemoved to data for faster invokeTask check + task.isRemoved = true; + if (existingTasks.length === 0) { + // all tasks for the eventName + capture have gone, + // remove globalZoneAwareCallback and remove the task cache from target + task.allRemoved = true; + task.target[symbolEventName] = null; + } + break; + } + } + } + } + // if all tasks for the eventName + capture have gone, + // we will really remove the global event callback, + // if not, return + if (!task.allRemoved) { + return; + } + return nativeRemoveEventListener.call(task.target, task.eventName, task.capture ? globalZoneAwareCaptureCallback : globalZoneAwareCallback, task.options); + }; + var customScheduleNonGlobal = function (task) { + checkIsPassive(task); + return nativeAddEventListener.call(taskData.target, taskData.eventName, task.invoke, taskData.options); + }; + var customSchedulePrepend = function (task) { + return nativePrependEventListener.call(taskData.target, taskData.eventName, task.invoke, taskData.options); + }; + var customCancelNonGlobal = function (task) { + return nativeRemoveEventListener.call(task.target, task.eventName, task.invoke, task.options); + }; + var customSchedule = useGlobalCallback ? customScheduleGlobal : customScheduleNonGlobal; + var customCancel = useGlobalCallback ? customCancelGlobal : customCancelNonGlobal; + var compareTaskCallbackVsDelegate = function (task, delegate) { + var typeOfDelegate = typeof delegate; + return (typeOfDelegate === 'function' && task.callback === delegate) || + (typeOfDelegate === 'object' && task.originalDelegate === delegate); + }; + var compare = (patchOptions && patchOptions.diff) ? patchOptions.diff : compareTaskCallbackVsDelegate; + var blackListedEvents = Zone[Zone.__symbol__('BLACK_LISTED_EVENTS')]; + var makeAddListener = function (nativeListener, addSource, customScheduleFn, customCancelFn, returnTarget, prepend) { + if (returnTarget === void 0) { returnTarget = false; } + if (prepend === void 0) { prepend = false; } + return function () { + var target = this || _global; + var eventName = arguments[0]; + var delegate = arguments[1]; + if (!delegate) { + return nativeListener.apply(this, arguments); + } + if (isNode && eventName === 'uncaughtException') { + // don't patch uncaughtException of nodejs to prevent endless loop + return nativeListener.apply(this, arguments); + } + // don't create the bind delegate function for handleEvent + // case here to improve addEventListener performance + // we will create the bind delegate when invoke + var isHandleEvent = false; + if (typeof delegate !== 'function') { + if (!delegate.handleEvent) { + return nativeListener.apply(this, arguments); + } + isHandleEvent = true; + } + if (validateHandler && !validateHandler(nativeListener, delegate, target, arguments)) { + return; + } + var options = arguments[2]; + if (blackListedEvents) { + // check black list + for (var i = 0; i < blackListedEvents.length; i++) { + if (eventName === blackListedEvents[i]) { + return nativeListener.apply(this, arguments); + } + } + } + var capture; + var once = false; + if (options === undefined) { + capture = false; + } + else if (options === true) { + capture = true; + } + else if (options === false) { + capture = false; + } + else { + capture = options ? !!options.capture : false; + once = options ? !!options.once : false; + } + var zone = Zone.current; + var symbolEventNames = zoneSymbolEventNames$1[eventName]; + var symbolEventName; + if (!symbolEventNames) { + // the code is duplicate, but I just want to get some better performance + var falseEventName = (eventNameToString ? eventNameToString(eventName) : eventName) + FALSE_STR; + var trueEventName = (eventNameToString ? eventNameToString(eventName) : eventName) + TRUE_STR; + var symbol = ZONE_SYMBOL_PREFIX + falseEventName; + var symbolCapture = ZONE_SYMBOL_PREFIX + trueEventName; + zoneSymbolEventNames$1[eventName] = {}; + zoneSymbolEventNames$1[eventName][FALSE_STR] = symbol; + zoneSymbolEventNames$1[eventName][TRUE_STR] = symbolCapture; + symbolEventName = capture ? symbolCapture : symbol; + } + else { + symbolEventName = symbolEventNames[capture ? TRUE_STR : FALSE_STR]; + } + var existingTasks = target[symbolEventName]; + var isExisting = false; + if (existingTasks) { + // already have task registered + isExisting = true; + if (checkDuplicate) { + for (var i = 0; i < existingTasks.length; i++) { + if (compare(existingTasks[i], delegate)) { + // same callback, same capture, same event name, just return + return; + } + } + } + } + else { + existingTasks = target[symbolEventName] = []; + } + var source; + var constructorName = target.constructor['name']; + var targetSource = globalSources[constructorName]; + if (targetSource) { + source = targetSource[eventName]; + } + if (!source) { + source = constructorName + addSource + + (eventNameToString ? eventNameToString(eventName) : eventName); + } + // do not create a new object as task.data to pass those things + // just use the global shared one + taskData.options = options; + if (once) { + // if addEventListener with once options, we don't pass it to + // native addEventListener, instead we keep the once setting + // and handle ourselves. + taskData.options.once = false; + } + taskData.target = target; + taskData.capture = capture; + taskData.eventName = eventName; + taskData.isExisting = isExisting; + var data = useGlobalCallback ? OPTIMIZED_ZONE_EVENT_TASK_DATA : undefined; + // keep taskData into data to allow onScheduleEventTask to access the task information + if (data) { + data.taskData = taskData; + } + var task = zone.scheduleEventTask(source, delegate, data, customScheduleFn, customCancelFn); + // should clear taskData.target to avoid memory leak + // issue, https://github.com/angular/angular/issues/20442 + taskData.target = null; + // need to clear up taskData because it is a global object + if (data) { + data.taskData = null; + } + // have to save those information to task in case + // application may call task.zone.cancelTask() directly + if (once) { + options.once = true; + } + if (!(!passiveSupported && typeof task.options === 'boolean')) { + // if not support passive, and we pass an option object + // to addEventListener, we should save the options to task + task.options = options; + } + task.target = target; + task.capture = capture; + task.eventName = eventName; + if (isHandleEvent) { + // save original delegate for compare to check duplicate + task.originalDelegate = delegate; + } + if (!prepend) { + existingTasks.push(task); + } + else { + existingTasks.unshift(task); + } + if (returnTarget) { + return target; + } + }; + }; + proto[ADD_EVENT_LISTENER] = makeAddListener(nativeAddEventListener, ADD_EVENT_LISTENER_SOURCE, customSchedule, customCancel, returnTarget); + if (nativePrependEventListener) { + proto[PREPEND_EVENT_LISTENER] = makeAddListener(nativePrependEventListener, PREPEND_EVENT_LISTENER_SOURCE, customSchedulePrepend, customCancel, returnTarget, true); + } + proto[REMOVE_EVENT_LISTENER] = function () { + var target = this || _global; + var eventName = arguments[0]; + var options = arguments[2]; + var capture; + if (options === undefined) { + capture = false; + } + else if (options === true) { + capture = true; + } + else if (options === false) { + capture = false; + } + else { + capture = options ? !!options.capture : false; + } + var delegate = arguments[1]; + if (!delegate) { + return nativeRemoveEventListener.apply(this, arguments); + } + if (validateHandler && + !validateHandler(nativeRemoveEventListener, delegate, target, arguments)) { + return; + } + var symbolEventNames = zoneSymbolEventNames$1[eventName]; + var symbolEventName; + if (symbolEventNames) { + symbolEventName = symbolEventNames[capture ? TRUE_STR : FALSE_STR]; + } + var existingTasks = symbolEventName && target[symbolEventName]; + if (existingTasks) { + for (var i = 0; i < existingTasks.length; i++) { + var existingTask = existingTasks[i]; + if (compare(existingTask, delegate)) { + existingTasks.splice(i, 1); + // set isRemoved to data for faster invokeTask check + existingTask.isRemoved = true; + if (existingTasks.length === 0) { + // all tasks for the eventName + capture have gone, + // remove globalZoneAwareCallback and remove the task cache from target + existingTask.allRemoved = true; + target[symbolEventName] = null; + } + existingTask.zone.cancelTask(existingTask); + if (returnTarget) { + return target; + } + return; + } + } + } + // issue 930, didn't find the event name or callback + // from zone kept existingTasks, the callback maybe + // added outside of zone, we need to call native removeEventListener + // to try to remove it. + return nativeRemoveEventListener.apply(this, arguments); + }; + proto[LISTENERS_EVENT_LISTENER] = function () { + var target = this || _global; + var eventName = arguments[0]; + var listeners = []; + var tasks = findEventTasks(target, eventNameToString ? eventNameToString(eventName) : eventName); + for (var i = 0; i < tasks.length; i++) { + var task = tasks[i]; + var delegate = task.originalDelegate ? task.originalDelegate : task.callback; + listeners.push(delegate); + } + return listeners; + }; + proto[REMOVE_ALL_LISTENERS_EVENT_LISTENER] = function () { + var target = this || _global; + var eventName = arguments[0]; + if (!eventName) { + var keys = Object.keys(target); + for (var i = 0; i < keys.length; i++) { + var prop = keys[i]; + var match = EVENT_NAME_SYMBOL_REGX.exec(prop); + var evtName = match && match[1]; + // in nodejs EventEmitter, removeListener event is + // used for monitoring the removeListener call, + // so just keep removeListener eventListener until + // all other eventListeners are removed + if (evtName && evtName !== 'removeListener') { + this[REMOVE_ALL_LISTENERS_EVENT_LISTENER].call(this, evtName); + } + } + // remove removeListener listener finally + this[REMOVE_ALL_LISTENERS_EVENT_LISTENER].call(this, 'removeListener'); + } + else { + var symbolEventNames = zoneSymbolEventNames$1[eventName]; + if (symbolEventNames) { + var symbolEventName = symbolEventNames[FALSE_STR]; + var symbolCaptureEventName = symbolEventNames[TRUE_STR]; + var tasks = target[symbolEventName]; + var captureTasks = target[symbolCaptureEventName]; + if (tasks) { + var removeTasks = tasks.slice(); + for (var i = 0; i < removeTasks.length; i++) { + var task = removeTasks[i]; + var delegate = task.originalDelegate ? task.originalDelegate : task.callback; + this[REMOVE_EVENT_LISTENER].call(this, eventName, delegate, task.options); + } + } + if (captureTasks) { + var removeTasks = captureTasks.slice(); + for (var i = 0; i < removeTasks.length; i++) { + var task = removeTasks[i]; + var delegate = task.originalDelegate ? task.originalDelegate : task.callback; + this[REMOVE_EVENT_LISTENER].call(this, eventName, delegate, task.options); + } + } + } + } + if (returnTarget) { + return this; + } + }; + // for native toString patch + attachOriginToPatched(proto[ADD_EVENT_LISTENER], nativeAddEventListener); + attachOriginToPatched(proto[REMOVE_EVENT_LISTENER], nativeRemoveEventListener); + if (nativeRemoveAllListeners) { + attachOriginToPatched(proto[REMOVE_ALL_LISTENERS_EVENT_LISTENER], nativeRemoveAllListeners); + } + if (nativeListeners) { + attachOriginToPatched(proto[LISTENERS_EVENT_LISTENER], nativeListeners); + } + return true; + } + var results = []; + for (var i = 0; i < apis.length; i++) { + results[i] = patchEventTargetMethods(apis[i], patchOptions); + } + return results; +} +function findEventTasks(target, eventName) { + var foundTasks = []; + for (var prop in target) { + var match = EVENT_NAME_SYMBOL_REGX.exec(prop); + var evtName = match && match[1]; + if (evtName && (!eventName || evtName === eventName)) { + var tasks = target[prop]; + if (tasks) { + for (var i = 0; i < tasks.length; i++) { + foundTasks.push(tasks[i]); + } + } + } + } + return foundTasks; +} +function patchEventPrototype(global, api) { + var Event = global['Event']; + if (Event && Event.prototype) { + api.patchMethod(Event.prototype, 'stopImmediatePropagation', function (delegate) { return function (self, args) { + self[IMMEDIATE_PROPAGATION_SYMBOL] = true; + // we need to call the native stopImmediatePropagation + // in case in some hybrid application, some part of + // application will be controlled by zone, some are not + delegate && delegate.apply(self, args); + }; }); + } +} + +/** + * @license + * Copyright Google Inc. All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ +/** + * @fileoverview + * @suppress {missingRequire} + */ +var taskSymbol = zoneSymbol('zoneTask'); +function patchTimer(window, setName, cancelName, nameSuffix) { + var setNative = null; + var clearNative = null; + setName += nameSuffix; + cancelName += nameSuffix; + var tasksByHandleId = {}; + function scheduleTask(task) { + var data = task.data; + function timer() { + try { + task.invoke.apply(this, arguments); + } + finally { + // issue-934, task will be cancelled + // even it is a periodic task such as + // setInterval + if (!(task.data && task.data.isPeriodic)) { + if (typeof data.handleId === 'number') { + // in non-nodejs env, we remove timerId + // from local cache + delete tasksByHandleId[data.handleId]; + } + else if (data.handleId) { + // Node returns complex objects as handleIds + // we remove task reference from timer object + data.handleId[taskSymbol] = null; + } + } + } + } + data.args[0] = timer; + data.handleId = setNative.apply(window, data.args); + return task; + } + function clearTask(task) { + return clearNative(task.data.handleId); + } + setNative = + patchMethod(window, setName, function (delegate) { return function (self, args) { + if (typeof args[0] === 'function') { + var options = { + isPeriodic: nameSuffix === 'Interval', + delay: (nameSuffix === 'Timeout' || nameSuffix === 'Interval') ? args[1] || 0 : + undefined, + args: args + }; + var task = scheduleMacroTaskWithCurrentZone(setName, args[0], options, scheduleTask, clearTask); + if (!task) { + return task; + } + // Node.js must additionally support the ref and unref functions. + var handle = task.data.handleId; + if (typeof handle === 'number') { + // for non nodejs env, we save handleId: task + // mapping in local cache for clearTimeout + tasksByHandleId[handle] = task; + } + else if (handle) { + // for nodejs env, we save task + // reference in timerId Object for clearTimeout + handle[taskSymbol] = task; + } + // check whether handle is null, because some polyfill or browser + // may return undefined from setTimeout/setInterval/setImmediate/requestAnimationFrame + if (handle && handle.ref && handle.unref && typeof handle.ref === 'function' && + typeof handle.unref === 'function') { + task.ref = handle.ref.bind(handle); + task.unref = handle.unref.bind(handle); + } + if (typeof handle === 'number' || handle) { + return handle; + } + return task; + } + else { + // cause an error by calling it directly. + return delegate.apply(window, args); + } + }; }); + clearNative = + patchMethod(window, cancelName, function (delegate) { return function (self, args) { + var id = args[0]; + var task; + if (typeof id === 'number') { + // non nodejs env. + task = tasksByHandleId[id]; + } + else { + // nodejs env. + task = id && id[taskSymbol]; + // other environments. + if (!task) { + task = id; + } + } + if (task && typeof task.type === 'string') { + if (task.state !== 'notScheduled' && + (task.cancelFn && task.data.isPeriodic || task.runCount === 0)) { + if (typeof id === 'number') { + delete tasksByHandleId[id]; + } + else if (id) { + id[taskSymbol] = null; + } + // Do not cancel already canceled functions + task.zone.cancelTask(task); + } + } + else { + // cause an error by calling it directly. + delegate.apply(window, args); + } + }; }); +} + +/** + * @license + * Copyright Google Inc. All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ +/* + * This is necessary for Chrome and Chrome mobile, to enable + * things like redefining `createdCallback` on an element. + */ +var _defineProperty = Object[zoneSymbol('defineProperty')] = Object.defineProperty; +var _getOwnPropertyDescriptor = Object[zoneSymbol('getOwnPropertyDescriptor')] = + Object.getOwnPropertyDescriptor; +var _create = Object.create; +var unconfigurablesKey = zoneSymbol('unconfigurables'); +function propertyPatch() { + Object.defineProperty = function (obj, prop, desc) { + if (isUnconfigurable(obj, prop)) { + throw new TypeError('Cannot assign to read only property \'' + prop + '\' of ' + obj); + } + var originalConfigurableFlag = desc.configurable; + if (prop !== 'prototype') { + desc = rewriteDescriptor(obj, prop, desc); + } + return _tryDefineProperty(obj, prop, desc, originalConfigurableFlag); + }; + Object.defineProperties = function (obj, props) { + Object.keys(props).forEach(function (prop) { + Object.defineProperty(obj, prop, props[prop]); + }); + return obj; + }; + Object.create = function (obj, proto) { + if (typeof proto === 'object' && !Object.isFrozen(proto)) { + Object.keys(proto).forEach(function (prop) { + proto[prop] = rewriteDescriptor(obj, prop, proto[prop]); + }); + } + return _create(obj, proto); + }; + Object.getOwnPropertyDescriptor = function (obj, prop) { + var desc = _getOwnPropertyDescriptor(obj, prop); + if (desc && isUnconfigurable(obj, prop)) { + desc.configurable = false; + } + return desc; + }; +} +function _redefineProperty(obj, prop, desc) { + var originalConfigurableFlag = desc.configurable; + desc = rewriteDescriptor(obj, prop, desc); + return _tryDefineProperty(obj, prop, desc, originalConfigurableFlag); +} +function isUnconfigurable(obj, prop) { + return obj && obj[unconfigurablesKey] && obj[unconfigurablesKey][prop]; +} +function rewriteDescriptor(obj, prop, desc) { + // issue-927, if the desc is frozen, don't try to change the desc + if (!Object.isFrozen(desc)) { + desc.configurable = true; + } + if (!desc.configurable) { + // issue-927, if the obj is frozen, don't try to set the desc to obj + if (!obj[unconfigurablesKey] && !Object.isFrozen(obj)) { + _defineProperty(obj, unconfigurablesKey, { writable: true, value: {} }); + } + if (obj[unconfigurablesKey]) { + obj[unconfigurablesKey][prop] = true; + } + } + return desc; +} +function _tryDefineProperty(obj, prop, desc, originalConfigurableFlag) { + try { + return _defineProperty(obj, prop, desc); + } + catch (error) { + if (desc.configurable) { + // In case of errors, when the configurable flag was likely set by rewriteDescriptor(), let's + // retry with the original flag value + if (typeof originalConfigurableFlag == 'undefined') { + delete desc.configurable; + } + else { + desc.configurable = originalConfigurableFlag; + } + try { + return _defineProperty(obj, prop, desc); + } + catch (error) { + var descJson = null; + try { + descJson = JSON.stringify(desc); + } + catch (error) { + descJson = desc.toString(); + } + console.log("Attempting to configure '" + prop + "' with descriptor '" + descJson + "' on object '" + obj + "' and got error, giving up: " + error); + } + } + else { + throw error; + } + } +} + +/** + * @license + * Copyright Google Inc. All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ +// we have to patch the instance since the proto is non-configurable +function apply(api, _global) { + var WS = _global.WebSocket; + // On Safari window.EventTarget doesn't exist so need to patch WS add/removeEventListener + // On older Chrome, no need since EventTarget was already patched + if (!_global.EventTarget) { + patchEventTarget(_global, [WS.prototype]); + } + _global.WebSocket = function (x, y) { + var socket = arguments.length > 1 ? new WS(x, y) : new WS(x); + var proxySocket; + var proxySocketProto; + // Safari 7.0 has non-configurable own 'onmessage' and friends properties on the socket instance + var onmessageDesc = ObjectGetOwnPropertyDescriptor(socket, 'onmessage'); + if (onmessageDesc && onmessageDesc.configurable === false) { + proxySocket = ObjectCreate(socket); + // socket have own property descriptor 'onopen', 'onmessage', 'onclose', 'onerror' + // but proxySocket not, so we will keep socket as prototype and pass it to + // patchOnProperties method + proxySocketProto = socket; + [ADD_EVENT_LISTENER_STR, REMOVE_EVENT_LISTENER_STR, 'send', 'close'].forEach(function (propName) { + proxySocket[propName] = function () { + var args = ArraySlice.call(arguments); + if (propName === ADD_EVENT_LISTENER_STR || propName === REMOVE_EVENT_LISTENER_STR) { + var eventName = args.length > 0 ? args[0] : undefined; + if (eventName) { + var propertySymbol = Zone.__symbol__('ON_PROPERTY' + eventName); + socket[propertySymbol] = proxySocket[propertySymbol]; + } + } + return socket[propName].apply(socket, args); + }; + }); + } + else { + // we can patch the real socket + proxySocket = socket; + } + patchOnProperties(proxySocket, ['close', 'error', 'message', 'open'], proxySocketProto); + return proxySocket; + }; + var globalWebSocket = _global['WebSocket']; + for (var prop in WS) { + globalWebSocket[prop] = WS[prop]; + } +} + +/** + * @license + * Copyright Google Inc. All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ +/** + * @fileoverview + * @suppress {globalThis} + */ +var globalEventHandlersEventNames = [ + 'abort', + 'animationcancel', + 'animationend', + 'animationiteration', + 'auxclick', + 'beforeinput', + 'blur', + 'cancel', + 'canplay', + 'canplaythrough', + 'change', + 'compositionstart', + 'compositionupdate', + 'compositionend', + 'cuechange', + 'click', + 'close', + 'contextmenu', + 'curechange', + 'dblclick', + 'drag', + 'dragend', + 'dragenter', + 'dragexit', + 'dragleave', + 'dragover', + 'drop', + 'durationchange', + 'emptied', + 'ended', + 'error', + 'focus', + 'focusin', + 'focusout', + 'gotpointercapture', + 'input', + 'invalid', + 'keydown', + 'keypress', + 'keyup', + 'load', + 'loadstart', + 'loadeddata', + 'loadedmetadata', + 'lostpointercapture', + 'mousedown', + 'mouseenter', + 'mouseleave', + 'mousemove', + 'mouseout', + 'mouseover', + 'mouseup', + 'mousewheel', + 'orientationchange', + 'pause', + 'play', + 'playing', + 'pointercancel', + 'pointerdown', + 'pointerenter', + 'pointerleave', + 'pointerlockchange', + 'mozpointerlockchange', + 'webkitpointerlockerchange', + 'pointerlockerror', + 'mozpointerlockerror', + 'webkitpointerlockerror', + 'pointermove', + 'pointout', + 'pointerover', + 'pointerup', + 'progress', + 'ratechange', + 'reset', + 'resize', + 'scroll', + 'seeked', + 'seeking', + 'select', + 'selectionchange', + 'selectstart', + 'show', + 'sort', + 'stalled', + 'submit', + 'suspend', + 'timeupdate', + 'volumechange', + 'touchcancel', + 'touchmove', + 'touchstart', + 'touchend', + 'transitioncancel', + 'transitionend', + 'waiting', + 'wheel' +]; +var documentEventNames = [ + 'afterscriptexecute', 'beforescriptexecute', 'DOMContentLoaded', 'freeze', 'fullscreenchange', + 'mozfullscreenchange', 'webkitfullscreenchange', 'msfullscreenchange', 'fullscreenerror', + 'mozfullscreenerror', 'webkitfullscreenerror', 'msfullscreenerror', 'readystatechange', + 'visibilitychange', 'resume' +]; +var windowEventNames = [ + 'absolutedeviceorientation', + 'afterinput', + 'afterprint', + 'appinstalled', + 'beforeinstallprompt', + 'beforeprint', + 'beforeunload', + 'devicelight', + 'devicemotion', + 'deviceorientation', + 'deviceorientationabsolute', + 'deviceproximity', + 'hashchange', + 'languagechange', + 'message', + 'mozbeforepaint', + 'offline', + 'online', + 'paint', + 'pageshow', + 'pagehide', + 'popstate', + 'rejectionhandled', + 'storage', + 'unhandledrejection', + 'unload', + 'userproximity', + 'vrdisplyconnected', + 'vrdisplaydisconnected', + 'vrdisplaypresentchange' +]; +var htmlElementEventNames = [ + 'beforecopy', 'beforecut', 'beforepaste', 'copy', 'cut', 'paste', 'dragstart', 'loadend', + 'animationstart', 'search', 'transitionrun', 'transitionstart', 'webkitanimationend', + 'webkitanimationiteration', 'webkitanimationstart', 'webkittransitionend' +]; +var mediaElementEventNames = ['encrypted', 'waitingforkey', 'msneedkey', 'mozinterruptbegin', 'mozinterruptend']; +var ieElementEventNames = [ + 'activate', + 'afterupdate', + 'ariarequest', + 'beforeactivate', + 'beforedeactivate', + 'beforeeditfocus', + 'beforeupdate', + 'cellchange', + 'controlselect', + 'dataavailable', + 'datasetchanged', + 'datasetcomplete', + 'errorupdate', + 'filterchange', + 'layoutcomplete', + 'losecapture', + 'move', + 'moveend', + 'movestart', + 'propertychange', + 'resizeend', + 'resizestart', + 'rowenter', + 'rowexit', + 'rowsdelete', + 'rowsinserted', + 'command', + 'compassneedscalibration', + 'deactivate', + 'help', + 'mscontentzoom', + 'msmanipulationstatechanged', + 'msgesturechange', + 'msgesturedoubletap', + 'msgestureend', + 'msgesturehold', + 'msgesturestart', + 'msgesturetap', + 'msgotpointercapture', + 'msinertiastart', + 'mslostpointercapture', + 'mspointercancel', + 'mspointerdown', + 'mspointerenter', + 'mspointerhover', + 'mspointerleave', + 'mspointermove', + 'mspointerout', + 'mspointerover', + 'mspointerup', + 'pointerout', + 'mssitemodejumplistitemremoved', + 'msthumbnailclick', + 'stop', + 'storagecommit' +]; +var webglEventNames = ['webglcontextrestored', 'webglcontextlost', 'webglcontextcreationerror']; +var formEventNames = ['autocomplete', 'autocompleteerror']; +var detailEventNames = ['toggle']; +var frameEventNames = ['load']; +var frameSetEventNames = ['blur', 'error', 'focus', 'load', 'resize', 'scroll', 'messageerror']; +var marqueeEventNames = ['bounce', 'finish', 'start']; +var XMLHttpRequestEventNames = [ + 'loadstart', 'progress', 'abort', 'error', 'load', 'progress', 'timeout', 'loadend', + 'readystatechange' +]; +var IDBIndexEventNames = ['upgradeneeded', 'complete', 'abort', 'success', 'error', 'blocked', 'versionchange', 'close']; +var websocketEventNames = ['close', 'error', 'open', 'message']; +var workerEventNames = ['error', 'message']; +var eventNames = globalEventHandlersEventNames.concat(webglEventNames, formEventNames, detailEventNames, documentEventNames, windowEventNames, htmlElementEventNames, ieElementEventNames); +function filterProperties(target, onProperties, ignoreProperties) { + if (!ignoreProperties || ignoreProperties.length === 0) { + return onProperties; + } + var tip = ignoreProperties.filter(function (ip) { return ip.target === target; }); + if (!tip || tip.length === 0) { + return onProperties; + } + var targetIgnoreProperties = tip[0].ignoreProperties; + return onProperties.filter(function (op) { return targetIgnoreProperties.indexOf(op) === -1; }); +} +function patchFilteredProperties(target, onProperties, ignoreProperties, prototype) { + // check whether target is available, sometimes target will be undefined + // because different browser or some 3rd party plugin. + if (!target) { + return; + } + var filteredProperties = filterProperties(target, onProperties, ignoreProperties); + patchOnProperties(target, filteredProperties, prototype); +} +function propertyDescriptorPatch(api, _global) { + if (isNode && !isMix) { + return; + } + var supportsWebSocket = typeof WebSocket !== 'undefined'; + if (canPatchViaPropertyDescriptor()) { + var ignoreProperties = _global['__Zone_ignore_on_properties']; + // for browsers that we can patch the descriptor: Chrome & Firefox + if (isBrowser) { + var internalWindow = window; + var ignoreErrorProperties = isIE ? [{ target: internalWindow, ignoreProperties: ['error'] }] : []; + // in IE/Edge, onProp not exist in window object, but in WindowPrototype + // so we need to pass WindowPrototype to check onProp exist or not + patchFilteredProperties(internalWindow, eventNames.concat(['messageerror']), ignoreProperties ? ignoreProperties.concat(ignoreErrorProperties) : ignoreProperties, ObjectGetPrototypeOf(internalWindow)); + patchFilteredProperties(Document.prototype, eventNames, ignoreProperties); + if (typeof internalWindow['SVGElement'] !== 'undefined') { + patchFilteredProperties(internalWindow['SVGElement'].prototype, eventNames, ignoreProperties); + } + patchFilteredProperties(Element.prototype, eventNames, ignoreProperties); + patchFilteredProperties(HTMLElement.prototype, eventNames, ignoreProperties); + patchFilteredProperties(HTMLMediaElement.prototype, mediaElementEventNames, ignoreProperties); + patchFilteredProperties(HTMLFrameSetElement.prototype, windowEventNames.concat(frameSetEventNames), ignoreProperties); + patchFilteredProperties(HTMLBodyElement.prototype, windowEventNames.concat(frameSetEventNames), ignoreProperties); + patchFilteredProperties(HTMLFrameElement.prototype, frameEventNames, ignoreProperties); + patchFilteredProperties(HTMLIFrameElement.prototype, frameEventNames, ignoreProperties); + var HTMLMarqueeElement_1 = internalWindow['HTMLMarqueeElement']; + if (HTMLMarqueeElement_1) { + patchFilteredProperties(HTMLMarqueeElement_1.prototype, marqueeEventNames, ignoreProperties); + } + var Worker_1 = internalWindow['Worker']; + if (Worker_1) { + patchFilteredProperties(Worker_1.prototype, workerEventNames, ignoreProperties); + } + } + patchFilteredProperties(XMLHttpRequest.prototype, XMLHttpRequestEventNames, ignoreProperties); + var XMLHttpRequestEventTarget_1 = _global['XMLHttpRequestEventTarget']; + if (XMLHttpRequestEventTarget_1) { + patchFilteredProperties(XMLHttpRequestEventTarget_1 && XMLHttpRequestEventTarget_1.prototype, XMLHttpRequestEventNames, ignoreProperties); + } + if (typeof IDBIndex !== 'undefined') { + patchFilteredProperties(IDBIndex.prototype, IDBIndexEventNames, ignoreProperties); + patchFilteredProperties(IDBRequest.prototype, IDBIndexEventNames, ignoreProperties); + patchFilteredProperties(IDBOpenDBRequest.prototype, IDBIndexEventNames, ignoreProperties); + patchFilteredProperties(IDBDatabase.prototype, IDBIndexEventNames, ignoreProperties); + patchFilteredProperties(IDBTransaction.prototype, IDBIndexEventNames, ignoreProperties); + patchFilteredProperties(IDBCursor.prototype, IDBIndexEventNames, ignoreProperties); + } + if (supportsWebSocket) { + patchFilteredProperties(WebSocket.prototype, websocketEventNames, ignoreProperties); + } + } + else { + // Safari, Android browsers (Jelly Bean) + patchViaCapturingAllTheEvents(); + patchClass('XMLHttpRequest'); + if (supportsWebSocket) { + apply(api, _global); + } + } +} +function canPatchViaPropertyDescriptor() { + if ((isBrowser || isMix) && !ObjectGetOwnPropertyDescriptor(HTMLElement.prototype, 'onclick') && + typeof Element !== 'undefined') { + // WebKit https://bugs.webkit.org/show_bug.cgi?id=134364 + // IDL interface attributes are not configurable + var desc = ObjectGetOwnPropertyDescriptor(Element.prototype, 'onclick'); + if (desc && !desc.configurable) + return false; + } + var ON_READY_STATE_CHANGE = 'onreadystatechange'; + var XMLHttpRequestPrototype = XMLHttpRequest.prototype; + var xhrDesc = ObjectGetOwnPropertyDescriptor(XMLHttpRequestPrototype, ON_READY_STATE_CHANGE); + // add enumerable and configurable here because in opera + // by default XMLHttpRequest.prototype.onreadystatechange is undefined + // without adding enumerable and configurable will cause onreadystatechange + // non-configurable + // and if XMLHttpRequest.prototype.onreadystatechange is undefined, + // we should set a real desc instead a fake one + if (xhrDesc) { + ObjectDefineProperty(XMLHttpRequestPrototype, ON_READY_STATE_CHANGE, { + enumerable: true, + configurable: true, + get: function () { + return true; + } + }); + var req = new XMLHttpRequest(); + var result = !!req.onreadystatechange; + // restore original desc + ObjectDefineProperty(XMLHttpRequestPrototype, ON_READY_STATE_CHANGE, xhrDesc || {}); + return result; + } + else { + var SYMBOL_FAKE_ONREADYSTATECHANGE_1 = zoneSymbol('fake'); + ObjectDefineProperty(XMLHttpRequestPrototype, ON_READY_STATE_CHANGE, { + enumerable: true, + configurable: true, + get: function () { + return this[SYMBOL_FAKE_ONREADYSTATECHANGE_1]; + }, + set: function (value) { + this[SYMBOL_FAKE_ONREADYSTATECHANGE_1] = value; + } + }); + var req = new XMLHttpRequest(); + var detectFunc = function () { }; + req.onreadystatechange = detectFunc; + var result = req[SYMBOL_FAKE_ONREADYSTATECHANGE_1] === detectFunc; + req.onreadystatechange = null; + return result; + } +} +var unboundKey = zoneSymbol('unbound'); +// Whenever any eventListener fires, we check the eventListener target and all parents +// for `onwhatever` properties and replace them with zone-bound functions +// - Chrome (for now) +function patchViaCapturingAllTheEvents() { + var _loop_1 = function (i) { + var property = eventNames[i]; + var onproperty = 'on' + property; + self.addEventListener(property, function (event) { + var elt = event.target, bound, source; + if (elt) { + source = elt.constructor['name'] + '.' + onproperty; + } + else { + source = 'unknown.' + onproperty; + } + while (elt) { + if (elt[onproperty] && !elt[onproperty][unboundKey]) { + bound = wrapWithCurrentZone(elt[onproperty], source); + bound[unboundKey] = elt[onproperty]; + elt[onproperty] = bound; + } + elt = elt.parentElement; + } + }, true); + }; + for (var i = 0; i < eventNames.length; i++) { + _loop_1(i); + } +} + +/** + * @license + * Copyright Google Inc. All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ +function eventTargetPatch(_global, api) { + var WTF_ISSUE_555 = 'Anchor,Area,Audio,BR,Base,BaseFont,Body,Button,Canvas,Content,DList,Directory,Div,Embed,FieldSet,Font,Form,Frame,FrameSet,HR,Head,Heading,Html,IFrame,Image,Input,Keygen,LI,Label,Legend,Link,Map,Marquee,Media,Menu,Meta,Meter,Mod,OList,Object,OptGroup,Option,Output,Paragraph,Pre,Progress,Quote,Script,Select,Source,Span,Style,TableCaption,TableCell,TableCol,Table,TableRow,TableSection,TextArea,Title,Track,UList,Unknown,Video'; + var NO_EVENT_TARGET = 'ApplicationCache,EventSource,FileReader,InputMethodContext,MediaController,MessagePort,Node,Performance,SVGElementInstance,SharedWorker,TextTrack,TextTrackCue,TextTrackList,WebKitNamedFlow,Window,Worker,WorkerGlobalScope,XMLHttpRequest,XMLHttpRequestEventTarget,XMLHttpRequestUpload,IDBRequest,IDBOpenDBRequest,IDBDatabase,IDBTransaction,IDBCursor,DBIndex,WebSocket' + .split(','); + var EVENT_TARGET = 'EventTarget'; + var apis = []; + var isWtf = _global['wtf']; + var WTF_ISSUE_555_ARRAY = WTF_ISSUE_555.split(','); + if (isWtf) { + // Workaround for: https://github.com/google/tracing-framework/issues/555 + apis = WTF_ISSUE_555_ARRAY.map(function (v) { return 'HTML' + v + 'Element'; }).concat(NO_EVENT_TARGET); + } + else if (_global[EVENT_TARGET]) { + apis.push(EVENT_TARGET); + } + else { + // Note: EventTarget is not available in all browsers, + // if it's not available, we instead patch the APIs in the IDL that inherit from EventTarget + apis = NO_EVENT_TARGET; + } + var isDisableIECheck = _global['__Zone_disable_IE_check'] || false; + var isEnableCrossContextCheck = _global['__Zone_enable_cross_context_check'] || false; + var ieOrEdge = isIEOrEdge(); + var ADD_EVENT_LISTENER_SOURCE = '.addEventListener:'; + var FUNCTION_WRAPPER = '[object FunctionWrapper]'; + var BROWSER_TOOLS = 'function __BROWSERTOOLS_CONSOLE_SAFEFUNC() { [native code] }'; + // predefine all __zone_symbol__ + eventName + true/false string + for (var i = 0; i < eventNames.length; i++) { + var eventName = eventNames[i]; + var falseEventName = eventName + FALSE_STR; + var trueEventName = eventName + TRUE_STR; + var symbol = ZONE_SYMBOL_PREFIX + falseEventName; + var symbolCapture = ZONE_SYMBOL_PREFIX + trueEventName; + zoneSymbolEventNames$1[eventName] = {}; + zoneSymbolEventNames$1[eventName][FALSE_STR] = symbol; + zoneSymbolEventNames$1[eventName][TRUE_STR] = symbolCapture; + } + // predefine all task.source string + for (var i = 0; i < WTF_ISSUE_555.length; i++) { + var target = WTF_ISSUE_555_ARRAY[i]; + var targets = globalSources[target] = {}; + for (var j = 0; j < eventNames.length; j++) { + var eventName = eventNames[j]; + targets[eventName] = target + ADD_EVENT_LISTENER_SOURCE + eventName; + } + } + var checkIEAndCrossContext = function (nativeDelegate, delegate, target, args) { + if (!isDisableIECheck && ieOrEdge) { + if (isEnableCrossContextCheck) { + try { + var testString = delegate.toString(); + if ((testString === FUNCTION_WRAPPER || testString == BROWSER_TOOLS)) { + nativeDelegate.apply(target, args); + return false; + } + } + catch (error) { + nativeDelegate.apply(target, args); + return false; + } + } + else { + var testString = delegate.toString(); + if ((testString === FUNCTION_WRAPPER || testString == BROWSER_TOOLS)) { + nativeDelegate.apply(target, args); + return false; + } + } + } + else if (isEnableCrossContextCheck) { + try { + delegate.toString(); + } + catch (error) { + nativeDelegate.apply(target, args); + return false; + } + } + return true; + }; + var apiTypes = []; + for (var i = 0; i < apis.length; i++) { + var type = _global[apis[i]]; + apiTypes.push(type && type.prototype); + } + // vh is validateHandler to check event handler + // is valid or not(for security check) + patchEventTarget(_global, apiTypes, { vh: checkIEAndCrossContext }); + api.patchEventTarget = patchEventTarget; + return true; +} +function patchEvent(global, api) { + patchEventPrototype(global, api); +} + +/** + * @license + * Copyright Google Inc. All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ +function patchCallbacks(target, targetName, method, callbacks) { + var symbol = Zone.__symbol__(method); + if (target[symbol]) { + return; + } + var nativeDelegate = target[symbol] = target[method]; + target[method] = function (name, opts, options) { + if (opts && opts.prototype) { + callbacks.forEach(function (callback) { + var source = targetName + "." + method + "::" + callback; + var prototype = opts.prototype; + if (prototype.hasOwnProperty(callback)) { + var descriptor = ObjectGetOwnPropertyDescriptor(prototype, callback); + if (descriptor && descriptor.value) { + descriptor.value = wrapWithCurrentZone(descriptor.value, source); + _redefineProperty(opts.prototype, callback, descriptor); + } + else if (prototype[callback]) { + prototype[callback] = wrapWithCurrentZone(prototype[callback], source); + } + } + else if (prototype[callback]) { + prototype[callback] = wrapWithCurrentZone(prototype[callback], source); + } + }); + } + return nativeDelegate.call(target, name, opts, options); + }; + attachOriginToPatched(target[method], nativeDelegate); +} +function registerElementPatch(_global) { + if ((!isBrowser && !isMix) || !('registerElement' in _global.document)) { + return; + } + var callbacks = ['createdCallback', 'attachedCallback', 'detachedCallback', 'attributeChangedCallback']; + patchCallbacks(document, 'Document', 'registerElement', callbacks); +} +function patchCustomElements(_global) { + if ((!isBrowser && !isMix) || !('customElements' in _global)) { + return; + } + var callbacks = ['connectedCallback', 'disconnectedCallback', 'adoptedCallback', 'attributeChangedCallback']; + patchCallbacks(_global.customElements, 'customElements', 'define', callbacks); +} + +/** + * @license + * Copyright Google Inc. All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ +/** + * @fileoverview + * @suppress {missingRequire} + */ +Zone.__load_patch('util', function (global, Zone, api) { + api.patchOnProperties = patchOnProperties; + api.patchMethod = patchMethod; + api.bindArguments = bindArguments; +}); +Zone.__load_patch('timers', function (global) { + var set = 'set'; + var clear = 'clear'; + patchTimer(global, set, clear, 'Timeout'); + patchTimer(global, set, clear, 'Interval'); + patchTimer(global, set, clear, 'Immediate'); +}); +Zone.__load_patch('requestAnimationFrame', function (global) { + patchTimer(global, 'request', 'cancel', 'AnimationFrame'); + patchTimer(global, 'mozRequest', 'mozCancel', 'AnimationFrame'); + patchTimer(global, 'webkitRequest', 'webkitCancel', 'AnimationFrame'); +}); +Zone.__load_patch('blocking', function (global, Zone) { + var blockingMethods = ['alert', 'prompt', 'confirm']; + for (var i = 0; i < blockingMethods.length; i++) { + var name_1 = blockingMethods[i]; + patchMethod(global, name_1, function (delegate, symbol, name) { + return function (s, args) { + return Zone.current.run(delegate, global, args, name); + }; + }); + } +}); +Zone.__load_patch('EventTarget', function (global, Zone, api) { + // load blackListEvents from global + var SYMBOL_BLACK_LISTED_EVENTS = Zone.__symbol__('BLACK_LISTED_EVENTS'); + if (global[SYMBOL_BLACK_LISTED_EVENTS]) { + Zone[SYMBOL_BLACK_LISTED_EVENTS] = global[SYMBOL_BLACK_LISTED_EVENTS]; + } + patchEvent(global, api); + eventTargetPatch(global, api); + // patch XMLHttpRequestEventTarget's addEventListener/removeEventListener + var XMLHttpRequestEventTarget = global['XMLHttpRequestEventTarget']; + if (XMLHttpRequestEventTarget && XMLHttpRequestEventTarget.prototype) { + api.patchEventTarget(global, [XMLHttpRequestEventTarget.prototype]); + } + patchClass('MutationObserver'); + patchClass('WebKitMutationObserver'); + patchClass('IntersectionObserver'); + patchClass('FileReader'); +}); +Zone.__load_patch('on_property', function (global, Zone, api) { + propertyDescriptorPatch(api, global); + propertyPatch(); +}); +Zone.__load_patch('customElements', function (global, Zone, api) { + registerElementPatch(global); + patchCustomElements(global); +}); +Zone.__load_patch('canvas', function (global) { + var HTMLCanvasElement = global['HTMLCanvasElement']; + if (typeof HTMLCanvasElement !== 'undefined' && HTMLCanvasElement.prototype && + HTMLCanvasElement.prototype.toBlob) { + patchMacroTask(HTMLCanvasElement.prototype, 'toBlob', function (self, args) { + return { name: 'HTMLCanvasElement.toBlob', target: self, cbIdx: 0, args: args }; + }); + } +}); +Zone.__load_patch('XHR', function (global, Zone) { + // Treat XMLHttpRequest as a macrotask. + patchXHR(global); + var XHR_TASK = zoneSymbol('xhrTask'); + var XHR_SYNC = zoneSymbol('xhrSync'); + var XHR_LISTENER = zoneSymbol('xhrListener'); + var XHR_SCHEDULED = zoneSymbol('xhrScheduled'); + var XHR_URL = zoneSymbol('xhrURL'); + var XHR_ERROR_BEFORE_SCHEDULED = zoneSymbol('xhrErrorBeforeScheduled'); + function patchXHR(window) { + var XMLHttpRequestPrototype = XMLHttpRequest.prototype; + function findPendingTask(target) { + return target[XHR_TASK]; + } + var oriAddListener = XMLHttpRequestPrototype[ZONE_SYMBOL_ADD_EVENT_LISTENER]; + var oriRemoveListener = XMLHttpRequestPrototype[ZONE_SYMBOL_REMOVE_EVENT_LISTENER]; + if (!oriAddListener) { + var XMLHttpRequestEventTarget_1 = window['XMLHttpRequestEventTarget']; + if (XMLHttpRequestEventTarget_1) { + var XMLHttpRequestEventTargetPrototype = XMLHttpRequestEventTarget_1.prototype; + oriAddListener = XMLHttpRequestEventTargetPrototype[ZONE_SYMBOL_ADD_EVENT_LISTENER]; + oriRemoveListener = XMLHttpRequestEventTargetPrototype[ZONE_SYMBOL_REMOVE_EVENT_LISTENER]; + } + } + var READY_STATE_CHANGE = 'readystatechange'; + var SCHEDULED = 'scheduled'; + function scheduleTask(task) { + var data = task.data; + var target = data.target; + target[XHR_SCHEDULED] = false; + target[XHR_ERROR_BEFORE_SCHEDULED] = false; + // remove existing event listener + var listener = target[XHR_LISTENER]; + if (!oriAddListener) { + oriAddListener = target[ZONE_SYMBOL_ADD_EVENT_LISTENER]; + oriRemoveListener = target[ZONE_SYMBOL_REMOVE_EVENT_LISTENER]; + } + if (listener) { + oriRemoveListener.call(target, READY_STATE_CHANGE, listener); + } + var newListener = target[XHR_LISTENER] = function () { + if (target.readyState === target.DONE) { + // sometimes on some browsers XMLHttpRequest will fire onreadystatechange with + // readyState=4 multiple times, so we need to check task state here + if (!data.aborted && target[XHR_SCHEDULED] && task.state === SCHEDULED) { + // check whether the xhr has registered onload listener + // if that is the case, the task should invoke after all + // onload listeners finish. + var loadTasks = target['__zone_symbol__loadfalse']; + if (loadTasks && loadTasks.length > 0) { + var oriInvoke_1 = task.invoke; + task.invoke = function () { + // need to load the tasks again, because in other + // load listener, they may remove themselves + var loadTasks = target['__zone_symbol__loadfalse']; + for (var i = 0; i < loadTasks.length; i++) { + if (loadTasks[i] === task) { + loadTasks.splice(i, 1); + } + } + if (!data.aborted && task.state === SCHEDULED) { + oriInvoke_1.call(task); + } + }; + loadTasks.push(task); + } + else { + task.invoke(); + } + } + else if (!data.aborted && target[XHR_SCHEDULED] === false) { + // error occurs when xhr.send() + target[XHR_ERROR_BEFORE_SCHEDULED] = true; + } + } + }; + oriAddListener.call(target, READY_STATE_CHANGE, newListener); + var storedTask = target[XHR_TASK]; + if (!storedTask) { + target[XHR_TASK] = task; + } + sendNative.apply(target, data.args); + target[XHR_SCHEDULED] = true; + return task; + } + function placeholderCallback() { } + function clearTask(task) { + var data = task.data; + // Note - ideally, we would call data.target.removeEventListener here, but it's too late + // to prevent it from firing. So instead, we store info for the event listener. + data.aborted = true; + return abortNative.apply(data.target, data.args); + } + var openNative = patchMethod(XMLHttpRequestPrototype, 'open', function () { return function (self, args) { + self[XHR_SYNC] = args[2] == false; + self[XHR_URL] = args[1]; + return openNative.apply(self, args); + }; }); + var XMLHTTPREQUEST_SOURCE = 'XMLHttpRequest.send'; + var fetchTaskAborting = zoneSymbol('fetchTaskAborting'); + var fetchTaskScheduling = zoneSymbol('fetchTaskScheduling'); + var sendNative = patchMethod(XMLHttpRequestPrototype, 'send', function () { return function (self, args) { + if (Zone.current[fetchTaskScheduling] === true) { + // a fetch is scheduling, so we are using xhr to polyfill fetch + // and because we already schedule macroTask for fetch, we should + // not schedule a macroTask for xhr again + return sendNative.apply(self, args); + } + if (self[XHR_SYNC]) { + // if the XHR is sync there is no task to schedule, just execute the code. + return sendNative.apply(self, args); + } + else { + var options = { target: self, url: self[XHR_URL], isPeriodic: false, args: args, aborted: false }; + var task = scheduleMacroTaskWithCurrentZone(XMLHTTPREQUEST_SOURCE, placeholderCallback, options, scheduleTask, clearTask); + if (self && self[XHR_ERROR_BEFORE_SCHEDULED] === true && !options.aborted && + task.state === SCHEDULED) { + // xhr request throw error when send + // we should invoke task instead of leaving a scheduled + // pending macroTask + task.invoke(); + } + } + }; }); + var abortNative = patchMethod(XMLHttpRequestPrototype, 'abort', function () { return function (self, args) { + var task = findPendingTask(self); + if (task && typeof task.type == 'string') { + // If the XHR has already completed, do nothing. + // If the XHR has already been aborted, do nothing. + // Fix #569, call abort multiple times before done will cause + // macroTask task count be negative number + if (task.cancelFn == null || (task.data && task.data.aborted)) { + return; + } + task.zone.cancelTask(task); + } + else if (Zone.current[fetchTaskAborting] === true) { + // the abort is called from fetch polyfill, we need to call native abort of XHR. + return abortNative.apply(self, args); + } + // Otherwise, we are trying to abort an XHR which has not yet been sent, so there is no + // task + // to cancel. Do nothing. + }; }); + } +}); +Zone.__load_patch('geolocation', function (global) { + /// GEO_LOCATION + if (global['navigator'] && global['navigator'].geolocation) { + patchPrototype(global['navigator'].geolocation, ['getCurrentPosition', 'watchPosition']); + } +}); +Zone.__load_patch('PromiseRejectionEvent', function (global, Zone) { + // handle unhandled promise rejection + function findPromiseRejectionHandler(evtName) { + return function (e) { + var eventTasks = findEventTasks(global, evtName); + eventTasks.forEach(function (eventTask) { + // windows has added unhandledrejection event listener + // trigger the event listener + var PromiseRejectionEvent = global['PromiseRejectionEvent']; + if (PromiseRejectionEvent) { + var evt = new PromiseRejectionEvent(evtName, { promise: e.promise, reason: e.rejection }); + eventTask.invoke(evt); + } + }); + }; + } + if (global['PromiseRejectionEvent']) { + Zone[zoneSymbol('unhandledPromiseRejectionHandler')] = + findPromiseRejectionHandler('unhandledrejection'); + Zone[zoneSymbol('rejectionHandledHandler')] = + findPromiseRejectionHandler('rejectionhandled'); + } +}); + +/** + * @license + * Copyright Google Inc. All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ + +}))); + + +/***/ }), + +/***/ "./src/polyfills.ts": +/*!**************************!*\ + !*** ./src/polyfills.ts ***! + \**************************/ +/*! no exports provided */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony import */ var core_js_es7_reflect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core-js/es7/reflect */ "./node_modules/core-js/es7/reflect.js"); +/* harmony import */ var core_js_es7_reflect__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_es7_reflect__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var zone_js_dist_zone__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! zone.js/dist/zone */ "./node_modules/zone.js/dist/zone.js"); +/* harmony import */ var zone_js_dist_zone__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(zone_js_dist_zone__WEBPACK_IMPORTED_MODULE_1__); +/** + * This file includes polyfills needed by Angular and is loaded before the app. + * You can add your own extra polyfills to this file. + * + * This file is divided into 2 sections: + * 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers. + * 2. Application imports. Files imported after ZoneJS that should be loaded before your main + * file. + * + * The current setup is for so-called "evergreen" browsers; the last versions of browsers that + * automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera), + * Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile. + * + * Learn more in https://angular.io/docs/ts/latest/guide/browser-support.html + */ +/*************************************************************************************************** + * BROWSER POLYFILLS + */ +/** IE9, IE10 and IE11 requires all of the following polyfills. **/ +// import 'core-js/es6/symbol'; +// import 'core-js/es6/object'; +// import 'core-js/es6/function'; +// import 'core-js/es6/parse-int'; +// import 'core-js/es6/parse-float'; +// import 'core-js/es6/number'; +// import 'core-js/es6/math'; +// import 'core-js/es6/string'; +// import 'core-js/es6/date'; +// import 'core-js/es6/array'; +// import 'core-js/es6/regexp'; +// import 'core-js/es6/map'; +// import 'core-js/es6/weak-map'; +// import 'core-js/es6/set'; +/** IE10 and IE11 requires the following for NgClass support on SVG elements */ +// import 'classlist.js'; // Run `npm install --save classlist.js`. +/** IE10 and IE11 requires the following for the Reflect API. */ +// import 'core-js/es6/reflect'; +/** Evergreen browsers require these. **/ +// Used for reflect-metadata in JIT. If you use AOT (and only Angular decorators), you can remove. + +/** + * Web Animations `@angular/platform-browser/animations` + * Only required if AnimationBuilder is used within the application and using IE/Edge or Safari. + * Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0). + **/ +// import 'web-animations-js'; // Run `npm install --save web-animations-js`. +/** + * By default, zone.js will patch all possible macroTask and DomEvents + * user can disable parts of macroTask/DomEvents patch by setting following flags + */ +// (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame +// (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick +// (window as any).__zone_symbol__BLACK_LISTED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames +/* +* in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js +* with the following flag, it will bypass `zone.js` patch for IE/Edge +*/ +// (window as any).__Zone_enable_cross_context_check = true; +/*************************************************************************************************** + * Zone JS is required by default for Angular itself. + */ + // Included with Angular CLI. +/*************************************************************************************************** + * APPLICATION IMPORTS + */ + + +/***/ }), + +/***/ 1: +/*!********************************!*\ + !*** multi ./src/polyfills.ts ***! + \********************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +module.exports = __webpack_require__(/*! /Users/alexandre/Desktop/Alexandre/projetZ/wip/SITEZ/Marquis/Protagoras/ProtagurOS/src/polyfills.ts */"./src/polyfills.ts"); + + +/***/ }) + +},[[1,"runtime"]]]); +//# sourceMappingURL=polyfills.js.map \ No newline at end of file diff --git a/ready2use/polyfills.js.map b/ready2use/polyfills.js.map new file mode 100644 index 0000000..8d97420 --- /dev/null +++ b/ready2use/polyfills.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["webpack:///./node_modules/core-js/es7/reflect.js","webpack:///./node_modules/core-js/modules/_a-function.js","webpack:///./node_modules/core-js/modules/_an-instance.js","webpack:///./node_modules/core-js/modules/_an-object.js","webpack:///./node_modules/core-js/modules/_array-from-iterable.js","webpack:///./node_modules/core-js/modules/_array-includes.js","webpack:///./node_modules/core-js/modules/_array-methods.js","webpack:///./node_modules/core-js/modules/_array-species-constructor.js","webpack:///./node_modules/core-js/modules/_array-species-create.js","webpack:///./node_modules/core-js/modules/_classof.js","webpack:///./node_modules/core-js/modules/_cof.js","webpack:///./node_modules/core-js/modules/_collection-strong.js","webpack:///./node_modules/core-js/modules/_collection-weak.js","webpack:///./node_modules/core-js/modules/_collection.js","webpack:///./node_modules/core-js/modules/_core.js","webpack:///./node_modules/core-js/modules/_ctx.js","webpack:///./node_modules/core-js/modules/_defined.js","webpack:///./node_modules/core-js/modules/_descriptors.js","webpack:///./node_modules/core-js/modules/_dom-create.js","webpack:///./node_modules/core-js/modules/_enum-bug-keys.js","webpack:///./node_modules/core-js/modules/_export.js","webpack:///./node_modules/core-js/modules/_fails.js","webpack:///./node_modules/core-js/modules/_for-of.js","webpack:///./node_modules/core-js/modules/_function-to-string.js","webpack:///./node_modules/core-js/modules/_global.js","webpack:///./node_modules/core-js/modules/_has.js","webpack:///./node_modules/core-js/modules/_hide.js","webpack:///./node_modules/core-js/modules/_html.js","webpack:///./node_modules/core-js/modules/_ie8-dom-define.js","webpack:///./node_modules/core-js/modules/_inherit-if-required.js","webpack:///./node_modules/core-js/modules/_iobject.js","webpack:///./node_modules/core-js/modules/_is-array-iter.js","webpack:///./node_modules/core-js/modules/_is-array.js","webpack:///./node_modules/core-js/modules/_is-object.js","webpack:///./node_modules/core-js/modules/_iter-call.js","webpack:///./node_modules/core-js/modules/_iter-create.js","webpack:///./node_modules/core-js/modules/_iter-define.js","webpack:///./node_modules/core-js/modules/_iter-detect.js","webpack:///./node_modules/core-js/modules/_iter-step.js","webpack:///./node_modules/core-js/modules/_iterators.js","webpack:///./node_modules/core-js/modules/_library.js","webpack:///./node_modules/core-js/modules/_meta.js","webpack:///./node_modules/core-js/modules/_metadata.js","webpack:///./node_modules/core-js/modules/_object-assign.js","webpack:///./node_modules/core-js/modules/_object-create.js","webpack:///./node_modules/core-js/modules/_object-dp.js","webpack:///./node_modules/core-js/modules/_object-dps.js","webpack:///./node_modules/core-js/modules/_object-gopd.js","webpack:///./node_modules/core-js/modules/_object-gops.js","webpack:///./node_modules/core-js/modules/_object-gpo.js","webpack:///./node_modules/core-js/modules/_object-keys-internal.js","webpack:///./node_modules/core-js/modules/_object-keys.js","webpack:///./node_modules/core-js/modules/_object-pie.js","webpack:///./node_modules/core-js/modules/_property-desc.js","webpack:///./node_modules/core-js/modules/_redefine-all.js","webpack:///./node_modules/core-js/modules/_redefine.js","webpack:///./node_modules/core-js/modules/_set-proto.js","webpack:///./node_modules/core-js/modules/_set-species.js","webpack:///./node_modules/core-js/modules/_set-to-string-tag.js","webpack:///./node_modules/core-js/modules/_shared-key.js","webpack:///./node_modules/core-js/modules/_shared.js","webpack:///./node_modules/core-js/modules/_to-absolute-index.js","webpack:///./node_modules/core-js/modules/_to-integer.js","webpack:///./node_modules/core-js/modules/_to-iobject.js","webpack:///./node_modules/core-js/modules/_to-length.js","webpack:///./node_modules/core-js/modules/_to-object.js","webpack:///./node_modules/core-js/modules/_to-primitive.js","webpack:///./node_modules/core-js/modules/_uid.js","webpack:///./node_modules/core-js/modules/_validate-collection.js","webpack:///./node_modules/core-js/modules/_wks.js","webpack:///./node_modules/core-js/modules/core.get-iterator-method.js","webpack:///./node_modules/core-js/modules/es6.map.js","webpack:///./node_modules/core-js/modules/es6.set.js","webpack:///./node_modules/core-js/modules/es6.weak-map.js","webpack:///./node_modules/core-js/modules/es7.reflect.define-metadata.js","webpack:///./node_modules/core-js/modules/es7.reflect.delete-metadata.js","webpack:///./node_modules/core-js/modules/es7.reflect.get-metadata-keys.js","webpack:///./node_modules/core-js/modules/es7.reflect.get-metadata.js","webpack:///./node_modules/core-js/modules/es7.reflect.get-own-metadata-keys.js","webpack:///./node_modules/core-js/modules/es7.reflect.get-own-metadata.js","webpack:///./node_modules/core-js/modules/es7.reflect.has-metadata.js","webpack:///./node_modules/core-js/modules/es7.reflect.has-own-metadata.js","webpack:///./node_modules/core-js/modules/es7.reflect.metadata.js","webpack:///./node_modules/zone.js/dist/zone.js","webpack:///./src/polyfills.ts"],"names":[],"mappings":";;;;;;;;;AAAA,mBAAO,CAAC,6GAAwC;AAChD,mBAAO,CAAC,6GAAwC;AAChD,mBAAO,CAAC,uGAAqC;AAC7C,mBAAO,CAAC,iHAA0C;AAClD,mBAAO,CAAC,+GAAyC;AACjD,mBAAO,CAAC,yHAA8C;AACtD,mBAAO,CAAC,uGAAqC;AAC7C,mBAAO,CAAC,+GAAyC;AACjD,mBAAO,CAAC,+FAAiC;AACzC,iBAAiB,mBAAO,CAAC,iEAAkB;;;;;;;;;;;;ACT3C;AACA;AACA;AACA;;;;;;;;;;;;ACHA;AACA;AACA;AACA,GAAG;AACH;;;;;;;;;;;;ACJA,eAAe,mBAAO,CAAC,kEAAc;AACrC;AACA;AACA;AACA;;;;;;;;;;;;ACJA,YAAY,mBAAO,CAAC,4DAAW;;AAE/B;AACA;AACA;AACA;AACA;;;;;;;;;;;;ACNA;AACA;AACA,gBAAgB,mBAAO,CAAC,oEAAe;AACvC,eAAe,mBAAO,CAAC,kEAAc;AACrC,sBAAsB,mBAAO,CAAC,kFAAsB;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK,YAAY,eAAe;AAChC;AACA,KAAK;AACL;AACA;;;;;;;;;;;;ACtBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU,mBAAO,CAAC,sDAAQ;AAC1B,cAAc,mBAAO,CAAC,8DAA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,cAAc,mBAAO,CAAC,wDAAS;AAC/B,eAAe,mBAAO,CAAC,sFAAwB;AAC/C;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,OAAO;AAC9B;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,qBAAqB;AACrB,6BAA6B;AAC7B,0BAA0B;AAC1B,0BAA0B;AAC1B,qBAAqB;AACrB;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,8EAA8E,OAAO;AACrF;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL,GAAG;AACH;AACA;AACA;AACA;AACA;AACA,yCAAyC;AACzC,qBAAqB;AACrB,0BAA0B;AAC1B,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;;;;;;;;;;;;AC/Ia;AACb,kBAAkB,mBAAO,CAAC,wEAAiB;AAC3C,cAAc,mBAAO,CAAC,wDAAS;AAC/B,eAAe,mBAAO,CAAC,kEAAc;AACrC,eAAe,mBAAO,CAAC,kEAAc;AACrC,iBAAiB,mBAAO,CAAC,sEAAgB;AACzC,YAAY,mBAAO,CAAC,4DAAW;AAC/B,wBAAwB,mBAAO,CAAC,0EAAkB;AAClD,WAAW,mBAAO,CAAC,sDAAQ;AAC3B,eAAe,mBAAO,CAAC,sFAAwB;AAC/C;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,qBAAqB;AACrB,qBAAqB;AACrB,0BAA0B;AAC1B;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;;;;;;;;;;;;;ACpFa;AACb,aAAa,mBAAO,CAAC,4DAAW;AAChC,cAAc,mBAAO,CAAC,4DAAW;AACjC,eAAe,mBAAO,CAAC,gEAAa;AACpC,kBAAkB,mBAAO,CAAC,wEAAiB;AAC3C,WAAW,mBAAO,CAAC,wDAAS;AAC5B,YAAY,mBAAO,CAAC,4DAAW;AAC/B,iBAAiB,mBAAO,CAAC,sEAAgB;AACzC,eAAe,mBAAO,CAAC,kEAAc;AACrC,YAAY,mBAAO,CAAC,0DAAU;AAC9B,kBAAkB,mBAAO,CAAC,sEAAgB;AAC1C,qBAAqB,mBAAO,CAAC,kFAAsB;AACnD,wBAAwB,mBAAO,CAAC,sFAAwB;;AAExD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA,OAAO;AACP;AACA,OAAO,mCAAmC,gCAAgC,aAAa;AACvF,8BAA8B,mCAAmC,aAAa;AAC9E;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA,qDAAqD;AACrD;AACA,kDAAkD,iBAAiB,EAAE;AACrE;AACA,wDAAwD,aAAa,EAAE,EAAE;AACzE;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AAC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;AAC3D,iCAAiC,aAAa;AAC9C;AACA,GAAG,YAAY;AACf;AACA;;;;;;;;;;;;ACrBA;AACA,UAAU;AACV;;;;;;;;;;;;ACFA;;;;;;;;;;;;ACAA;;;;;;;;;;;;ACAA,WAAW,mBAAO,CAAC,sDAAQ;AAC3B,eAAe,mBAAO,CAAC,kEAAc;AACrC,UAAU,mBAAO,CAAC,sDAAQ;AAC1B,cAAc,mBAAO,CAAC,kEAAc;AACpC;AACA;AACA;AACA;AACA,cAAc,mBAAO,CAAC,0DAAU;AAChC,iDAAiD;AACjD,CAAC;AACD;AACA,qBAAqB;AACrB;AACA,SAAS;AACT,GAAG,EAAE;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;ACpDA,UAAU,mBAAO,CAAC,4DAAW;AAC7B,cAAc,mBAAO,CAAC,4DAAW;AACjC,aAAa,mBAAO,CAAC,4DAAW;AAChC,iDAAiD,mBAAO,CAAC,sEAAgB;;AAEzE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0DAA0D,gBAAgB,EAAE;AAC5E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;AClDa;AACb;AACA,cAAc,mBAAO,CAAC,sEAAgB;AACtC,WAAW,mBAAO,CAAC,sEAAgB;AACnC,UAAU,mBAAO,CAAC,oEAAe;AACjC,eAAe,mBAAO,CAAC,kEAAc;AACrC,cAAc,mBAAO,CAAC,8DAAY;AAClC;;AAEA;AACA,6BAA6B,mBAAO,CAAC,0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;AACA;;AAEA,cAAc;AACd;AACA;AACA,CAAC,EAAE;;;;;;;;;;;;ACRH,eAAe,mBAAO,CAAC,gEAAa;AACpC,eAAe,mBAAO,CAAC,kEAAc;AACrC,qBAAqB,mBAAO,CAAC,oEAAe;AAC5C;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,cAAc;AACd;AACA,CAAC,EAAE;;;;;;;;;;;;ACfH,eAAe,mBAAO,CAAC,gEAAa;AACpC,eAAe,mBAAO,CAAC,kEAAc;AACrC;AACA;;AAEA,cAAc;AACd;AACA;AACA,CAAC,EAAE;;;;;;;;;;;;ACRH,gBAAgB,mBAAO,CAAC,gEAAa;AACrC,eAAe,mBAAO,CAAC,kEAAc;AACrC,gBAAgB,mBAAO,CAAC,oEAAe;AACvC;AACA;;AAEA,eAAe;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,EAAE;;;;;;;;;;;;ACdH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,KAA4D;AAC7D,CAAC,SACW;AACZ,CAAC,qBAAqB;;AAEtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iCAAiC;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC,kBAAkB;AACzD,iCAAiC;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oDAAoD;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iCAAiC;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oDAAoD;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,0BAA0B;AACrD;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,iEAAiE,+CAA+C,EAAE;AAClH;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT,4DAA4D,0CAA0C;AACtG;AACA;AACA;AACA,gCAAgC;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,kBAAkB;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB;AACnB;AACA;AACA;AACA;AACA;AACA,uCAAuC,0BAA0B,EAAE;AACnE;AACA;AACA;AACA,wCAAwC,6DAA6D,EAAE;AACvG,uCAAuC,WAAW,EAAE;AACpD;AACA,kCAAkC,aAAa,EAAE;AACjD,oCAAoC,WAAW,EAAE;AACjD,gCAAgC,aAAa,EAAE;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,6BAA6B;AAC7B;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4HAA4H,wBAAwB,oCAAoC;AACxL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gFAAgF,sEAAsE;AACtJ;AACA;AACA,+BAA+B,kBAAkB;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gDAAgD;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wCAAwC,oDAAoD;AAC5F;AACA;AACA;AACA;AACA;AACA,2BAA2B,mCAAmC;AAC9D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,qEAAqE,gBAAgB;AACrF;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sCAAsC;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mFAAmF,kBAAkB;AACrG;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,QAAQ,gBAAgB;AACnD;AACA;AACA;AACA;AACA,yBAAyB,0BAA0B;AACnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA,mFAAmF,kBAAkB;AACrG;AACA;AACA;AACA;AACA,2BAA2B,QAAQ,gBAAgB;AACnD;AACA;AACA;AACA;AACA,yBAAyB,0BAA0B;AACnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uGAAuG;AACvG;AACA;AACA;AACA;AACA,UAAU,EAAE;AACZ;AACA,mCAAmC;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA,iBAAiB;AACjB,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,SAAS;AACT;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iCAAiC,QAAQ;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,mBAAmB,oBAAoB;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+CAA+C;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,uBAAuB;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,yBAAyB;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kDAAkD,EAAE;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA,iBAAiB;AACjB;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,SAAS;AACT,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gEAAgE;AAChE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,EAAE;AACR;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA,8CAA8C;AAC9C;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8CAA8C,oCAAoC;AAClF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,sBAAsB;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,sBAAsB;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mCAAmC,0BAA0B;AAC7D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0CAA0C,sBAAsB;AAChE,qCAAqC,iBAAiB;AACtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mCAAmC,8BAA8B;AACjE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC,0BAA0B;AACjE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,0BAA0B;AACzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,kBAAkB;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,iBAAiB;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC,wBAAwB;AAC/D;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC,wBAAwB;AAC/D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,iBAAiB;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,kBAAkB;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0FAA0F;AAC1F;AACA;AACA;AACA;AACA;AACA,UAAU,EAAE;AACZ;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0DAA0D;AAC1D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU,EAAE;AACZ;AACA,6DAA6D;AAC7D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU,EAAE;AACZ;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sDAAsD,0BAA0B,EAAE;AAClF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qDAAqD,6BAA6B,EAAE;AACpF;AACA;AACA;AACA;AACA,8CAA8C,kDAAkD,EAAE;AAClG;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iDAAiD,sDAAsD;AACvG;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,0FAA0F;AAC1F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,SAAS;AACT;AACA,sCAAsC;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,mBAAmB,uBAAuB;AAC1C;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qDAAqD,+BAA+B,EAAE;AACtF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qEAAqE,gBAAgB;AACrF;AACA,mBAAmB,uBAAuB;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,0BAA0B;AAC7C;AACA;AACA,uBAAuB,uBAAuB;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,iBAAiB;AACpC;AACA;AACA;AACA;AACA;AACA,yCAAyC,6BAA6B;AACtE;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA,CAAC;AACD;AACA;AACA,mBAAmB,4BAA4B;AAC/C;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA,oBAAoB;AACpB,SAAS;AACT;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+CAA+C,sBAAsB;AACrE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wCAAwC;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mFAAmF;AACnF;AACA;AACA;AACA,UAAU,EAAE;AACZ;AACA;AACA;AACA,mFAAmF;AACnF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU,EAAE;AACZ,qFAAqF;AACrF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU,EAAE;AACZ;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kEAAkE,0CAA0C;AAC5G;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC;;;;;;;;;;;;;ACjxGD;AAAA;AAAA;AAAA;AAAA;AAAA;;;;;;;;;;;;;;GAcG;AAEH;;GAEG;AAEH,mEAAmE;AACnE,+BAA+B;AAC/B,+BAA+B;AAC/B,iCAAiC;AACjC,kCAAkC;AAClC,oCAAoC;AACpC,+BAA+B;AAC/B,6BAA6B;AAC7B,+BAA+B;AAC/B,6BAA6B;AAC7B,8BAA8B;AAC9B,+BAA+B;AAC/B,4BAA4B;AAC5B,iCAAiC;AACjC,4BAA4B;AAE5B,+EAA+E;AAC/E,oEAAoE;AAEpE,gEAAgE;AAChE,gCAAgC;AAGhC,yCAAyC;AACzC,kGAAkG;AACrE;AAG7B;;;;IAII;AACJ,8EAA8E;AAE9E;;;GAGG;AAEF,sGAAsG;AACtG,iGAAiG;AACjG,sHAAsH;AAEtH;;;EAGE;AACH,4DAA4D;AAE5D;;GAEG;AACwB,CAAE,6BAA6B;AAI1D;;GAEG","file":"polyfills.js","sourcesContent":["require('../modules/es7.reflect.define-metadata');\nrequire('../modules/es7.reflect.delete-metadata');\nrequire('../modules/es7.reflect.get-metadata');\nrequire('../modules/es7.reflect.get-metadata-keys');\nrequire('../modules/es7.reflect.get-own-metadata');\nrequire('../modules/es7.reflect.get-own-metadata-keys');\nrequire('../modules/es7.reflect.has-metadata');\nrequire('../modules/es7.reflect.has-own-metadata');\nrequire('../modules/es7.reflect.metadata');\nmodule.exports = require('../modules/_core').Reflect;\n","module.exports = function (it) {\n if (typeof it != 'function') throw TypeError(it + ' is not a function!');\n return it;\n};\n","module.exports = function (it, Constructor, name, forbiddenField) {\n if (!(it instanceof Constructor) || (forbiddenField !== undefined && forbiddenField in it)) {\n throw TypeError(name + ': incorrect invocation!');\n } return it;\n};\n","var isObject = require('./_is-object');\nmodule.exports = function (it) {\n if (!isObject(it)) throw TypeError(it + ' is not an object!');\n return it;\n};\n","var forOf = require('./_for-of');\n\nmodule.exports = function (iter, ITERATOR) {\n var result = [];\n forOf(iter, false, result.push, result, ITERATOR);\n return result;\n};\n","// false -> Array#indexOf\n// true -> Array#includes\nvar toIObject = require('./_to-iobject');\nvar toLength = require('./_to-length');\nvar toAbsoluteIndex = require('./_to-absolute-index');\nmodule.exports = function (IS_INCLUDES) {\n return function ($this, el, fromIndex) {\n var O = toIObject($this);\n var length = toLength(O.length);\n var index = toAbsoluteIndex(fromIndex, length);\n var value;\n // Array#includes uses SameValueZero equality algorithm\n // eslint-disable-next-line no-self-compare\n if (IS_INCLUDES && el != el) while (length > index) {\n value = O[index++];\n // eslint-disable-next-line no-self-compare\n if (value != value) return true;\n // Array#indexOf ignores holes, Array#includes - not\n } else for (;length > index; index++) if (IS_INCLUDES || index in O) {\n if (O[index] === el) return IS_INCLUDES || index || 0;\n } return !IS_INCLUDES && -1;\n };\n};\n","// 0 -> Array#forEach\n// 1 -> Array#map\n// 2 -> Array#filter\n// 3 -> Array#some\n// 4 -> Array#every\n// 5 -> Array#find\n// 6 -> Array#findIndex\nvar ctx = require('./_ctx');\nvar IObject = require('./_iobject');\nvar toObject = require('./_to-object');\nvar toLength = require('./_to-length');\nvar asc = require('./_array-species-create');\nmodule.exports = function (TYPE, $create) {\n var IS_MAP = TYPE == 1;\n var IS_FILTER = TYPE == 2;\n var IS_SOME = TYPE == 3;\n var IS_EVERY = TYPE == 4;\n var IS_FIND_INDEX = TYPE == 6;\n var NO_HOLES = TYPE == 5 || IS_FIND_INDEX;\n var create = $create || asc;\n return function ($this, callbackfn, that) {\n var O = toObject($this);\n var self = IObject(O);\n var f = ctx(callbackfn, that, 3);\n var length = toLength(self.length);\n var index = 0;\n var result = IS_MAP ? create($this, length) : IS_FILTER ? create($this, 0) : undefined;\n var val, res;\n for (;length > index; index++) if (NO_HOLES || index in self) {\n val = self[index];\n res = f(val, index, O);\n if (TYPE) {\n if (IS_MAP) result[index] = res; // map\n else if (res) switch (TYPE) {\n case 3: return true; // some\n case 5: return val; // find\n case 6: return index; // findIndex\n case 2: result.push(val); // filter\n } else if (IS_EVERY) return false; // every\n }\n }\n return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : result;\n };\n};\n","var isObject = require('./_is-object');\nvar isArray = require('./_is-array');\nvar SPECIES = require('./_wks')('species');\n\nmodule.exports = function (original) {\n var C;\n if (isArray(original)) {\n C = original.constructor;\n // cross-realm fallback\n if (typeof C == 'function' && (C === Array || isArray(C.prototype))) C = undefined;\n if (isObject(C)) {\n C = C[SPECIES];\n if (C === null) C = undefined;\n }\n } return C === undefined ? Array : C;\n};\n","// 9.4.2.3 ArraySpeciesCreate(originalArray, length)\nvar speciesConstructor = require('./_array-species-constructor');\n\nmodule.exports = function (original, length) {\n return new (speciesConstructor(original))(length);\n};\n","// getting tag from 19.1.3.6 Object.prototype.toString()\nvar cof = require('./_cof');\nvar TAG = require('./_wks')('toStringTag');\n// ES3 wrong here\nvar ARG = cof(function () { return arguments; }()) == 'Arguments';\n\n// fallback for IE11 Script Access Denied error\nvar tryGet = function (it, key) {\n try {\n return it[key];\n } catch (e) { /* empty */ }\n};\n\nmodule.exports = function (it) {\n var O, T, B;\n return it === undefined ? 'Undefined' : it === null ? 'Null'\n // @@toStringTag case\n : typeof (T = tryGet(O = Object(it), TAG)) == 'string' ? T\n // builtinTag case\n : ARG ? cof(O)\n // ES3 arguments fallback\n : (B = cof(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : B;\n};\n","var toString = {}.toString;\n\nmodule.exports = function (it) {\n return toString.call(it).slice(8, -1);\n};\n","'use strict';\nvar dP = require('./_object-dp').f;\nvar create = require('./_object-create');\nvar redefineAll = require('./_redefine-all');\nvar ctx = require('./_ctx');\nvar anInstance = require('./_an-instance');\nvar forOf = require('./_for-of');\nvar $iterDefine = require('./_iter-define');\nvar step = require('./_iter-step');\nvar setSpecies = require('./_set-species');\nvar DESCRIPTORS = require('./_descriptors');\nvar fastKey = require('./_meta').fastKey;\nvar validate = require('./_validate-collection');\nvar SIZE = DESCRIPTORS ? '_s' : 'size';\n\nvar getEntry = function (that, key) {\n // fast case\n var index = fastKey(key);\n var entry;\n if (index !== 'F') return that._i[index];\n // frozen object case\n for (entry = that._f; entry; entry = entry.n) {\n if (entry.k == key) return entry;\n }\n};\n\nmodule.exports = {\n getConstructor: function (wrapper, NAME, IS_MAP, ADDER) {\n var C = wrapper(function (that, iterable) {\n anInstance(that, C, NAME, '_i');\n that._t = NAME; // collection type\n that._i = create(null); // index\n that._f = undefined; // first entry\n that._l = undefined; // last entry\n that[SIZE] = 0; // size\n if (iterable != undefined) forOf(iterable, IS_MAP, that[ADDER], that);\n });\n redefineAll(C.prototype, {\n // 23.1.3.1 Map.prototype.clear()\n // 23.2.3.2 Set.prototype.clear()\n clear: function clear() {\n for (var that = validate(this, NAME), data = that._i, entry = that._f; entry; entry = entry.n) {\n entry.r = true;\n if (entry.p) entry.p = entry.p.n = undefined;\n delete data[entry.i];\n }\n that._f = that._l = undefined;\n that[SIZE] = 0;\n },\n // 23.1.3.3 Map.prototype.delete(key)\n // 23.2.3.4 Set.prototype.delete(value)\n 'delete': function (key) {\n var that = validate(this, NAME);\n var entry = getEntry(that, key);\n if (entry) {\n var next = entry.n;\n var prev = entry.p;\n delete that._i[entry.i];\n entry.r = true;\n if (prev) prev.n = next;\n if (next) next.p = prev;\n if (that._f == entry) that._f = next;\n if (that._l == entry) that._l = prev;\n that[SIZE]--;\n } return !!entry;\n },\n // 23.2.3.6 Set.prototype.forEach(callbackfn, thisArg = undefined)\n // 23.1.3.5 Map.prototype.forEach(callbackfn, thisArg = undefined)\n forEach: function forEach(callbackfn /* , that = undefined */) {\n validate(this, NAME);\n var f = ctx(callbackfn, arguments.length > 1 ? arguments[1] : undefined, 3);\n var entry;\n while (entry = entry ? entry.n : this._f) {\n f(entry.v, entry.k, this);\n // revert to the last existing entry\n while (entry && entry.r) entry = entry.p;\n }\n },\n // 23.1.3.7 Map.prototype.has(key)\n // 23.2.3.7 Set.prototype.has(value)\n has: function has(key) {\n return !!getEntry(validate(this, NAME), key);\n }\n });\n if (DESCRIPTORS) dP(C.prototype, 'size', {\n get: function () {\n return validate(this, NAME)[SIZE];\n }\n });\n return C;\n },\n def: function (that, key, value) {\n var entry = getEntry(that, key);\n var prev, index;\n // change existing entry\n if (entry) {\n entry.v = value;\n // create new entry\n } else {\n that._l = entry = {\n i: index = fastKey(key, true), // <- index\n k: key, // <- key\n v: value, // <- value\n p: prev = that._l, // <- previous entry\n n: undefined, // <- next entry\n r: false // <- removed\n };\n if (!that._f) that._f = entry;\n if (prev) prev.n = entry;\n that[SIZE]++;\n // add to index\n if (index !== 'F') that._i[index] = entry;\n } return that;\n },\n getEntry: getEntry,\n setStrong: function (C, NAME, IS_MAP) {\n // add .keys, .values, .entries, [@@iterator]\n // 23.1.3.4, 23.1.3.8, 23.1.3.11, 23.1.3.12, 23.2.3.5, 23.2.3.8, 23.2.3.10, 23.2.3.11\n $iterDefine(C, NAME, function (iterated, kind) {\n this._t = validate(iterated, NAME); // target\n this._k = kind; // kind\n this._l = undefined; // previous\n }, function () {\n var that = this;\n var kind = that._k;\n var entry = that._l;\n // revert to the last existing entry\n while (entry && entry.r) entry = entry.p;\n // get next entry\n if (!that._t || !(that._l = entry = entry ? entry.n : that._t._f)) {\n // or finish the iteration\n that._t = undefined;\n return step(1);\n }\n // return step by kind\n if (kind == 'keys') return step(0, entry.k);\n if (kind == 'values') return step(0, entry.v);\n return step(0, [entry.k, entry.v]);\n }, IS_MAP ? 'entries' : 'values', !IS_MAP, true);\n\n // add [@@species], 23.1.2.2, 23.2.2.2\n setSpecies(NAME);\n }\n};\n","'use strict';\nvar redefineAll = require('./_redefine-all');\nvar getWeak = require('./_meta').getWeak;\nvar anObject = require('./_an-object');\nvar isObject = require('./_is-object');\nvar anInstance = require('./_an-instance');\nvar forOf = require('./_for-of');\nvar createArrayMethod = require('./_array-methods');\nvar $has = require('./_has');\nvar validate = require('./_validate-collection');\nvar arrayFind = createArrayMethod(5);\nvar arrayFindIndex = createArrayMethod(6);\nvar id = 0;\n\n// fallback for uncaught frozen keys\nvar uncaughtFrozenStore = function (that) {\n return that._l || (that._l = new UncaughtFrozenStore());\n};\nvar UncaughtFrozenStore = function () {\n this.a = [];\n};\nvar findUncaughtFrozen = function (store, key) {\n return arrayFind(store.a, function (it) {\n return it[0] === key;\n });\n};\nUncaughtFrozenStore.prototype = {\n get: function (key) {\n var entry = findUncaughtFrozen(this, key);\n if (entry) return entry[1];\n },\n has: function (key) {\n return !!findUncaughtFrozen(this, key);\n },\n set: function (key, value) {\n var entry = findUncaughtFrozen(this, key);\n if (entry) entry[1] = value;\n else this.a.push([key, value]);\n },\n 'delete': function (key) {\n var index = arrayFindIndex(this.a, function (it) {\n return it[0] === key;\n });\n if (~index) this.a.splice(index, 1);\n return !!~index;\n }\n};\n\nmodule.exports = {\n getConstructor: function (wrapper, NAME, IS_MAP, ADDER) {\n var C = wrapper(function (that, iterable) {\n anInstance(that, C, NAME, '_i');\n that._t = NAME; // collection type\n that._i = id++; // collection id\n that._l = undefined; // leak store for uncaught frozen objects\n if (iterable != undefined) forOf(iterable, IS_MAP, that[ADDER], that);\n });\n redefineAll(C.prototype, {\n // 23.3.3.2 WeakMap.prototype.delete(key)\n // 23.4.3.3 WeakSet.prototype.delete(value)\n 'delete': function (key) {\n if (!isObject(key)) return false;\n var data = getWeak(key);\n if (data === true) return uncaughtFrozenStore(validate(this, NAME))['delete'](key);\n return data && $has(data, this._i) && delete data[this._i];\n },\n // 23.3.3.4 WeakMap.prototype.has(key)\n // 23.4.3.4 WeakSet.prototype.has(value)\n has: function has(key) {\n if (!isObject(key)) return false;\n var data = getWeak(key);\n if (data === true) return uncaughtFrozenStore(validate(this, NAME)).has(key);\n return data && $has(data, this._i);\n }\n });\n return C;\n },\n def: function (that, key, value) {\n var data = getWeak(anObject(key), true);\n if (data === true) uncaughtFrozenStore(that).set(key, value);\n else data[that._i] = value;\n return that;\n },\n ufstore: uncaughtFrozenStore\n};\n","'use strict';\nvar global = require('./_global');\nvar $export = require('./_export');\nvar redefine = require('./_redefine');\nvar redefineAll = require('./_redefine-all');\nvar meta = require('./_meta');\nvar forOf = require('./_for-of');\nvar anInstance = require('./_an-instance');\nvar isObject = require('./_is-object');\nvar fails = require('./_fails');\nvar $iterDetect = require('./_iter-detect');\nvar setToStringTag = require('./_set-to-string-tag');\nvar inheritIfRequired = require('./_inherit-if-required');\n\nmodule.exports = function (NAME, wrapper, methods, common, IS_MAP, IS_WEAK) {\n var Base = global[NAME];\n var C = Base;\n var ADDER = IS_MAP ? 'set' : 'add';\n var proto = C && C.prototype;\n var O = {};\n var fixMethod = function (KEY) {\n var fn = proto[KEY];\n redefine(proto, KEY,\n KEY == 'delete' ? function (a) {\n return IS_WEAK && !isObject(a) ? false : fn.call(this, a === 0 ? 0 : a);\n } : KEY == 'has' ? function has(a) {\n return IS_WEAK && !isObject(a) ? false : fn.call(this, a === 0 ? 0 : a);\n } : KEY == 'get' ? function get(a) {\n return IS_WEAK && !isObject(a) ? undefined : fn.call(this, a === 0 ? 0 : a);\n } : KEY == 'add' ? function add(a) { fn.call(this, a === 0 ? 0 : a); return this; }\n : function set(a, b) { fn.call(this, a === 0 ? 0 : a, b); return this; }\n );\n };\n if (typeof C != 'function' || !(IS_WEAK || proto.forEach && !fails(function () {\n new C().entries().next();\n }))) {\n // create collection constructor\n C = common.getConstructor(wrapper, NAME, IS_MAP, ADDER);\n redefineAll(C.prototype, methods);\n meta.NEED = true;\n } else {\n var instance = new C();\n // early implementations not supports chaining\n var HASNT_CHAINING = instance[ADDER](IS_WEAK ? {} : -0, 1) != instance;\n // V8 ~ Chromium 40- weak-collections throws on primitives, but should return false\n var THROWS_ON_PRIMITIVES = fails(function () { instance.has(1); });\n // most early implementations doesn't supports iterables, most modern - not close it correctly\n var ACCEPT_ITERABLES = $iterDetect(function (iter) { new C(iter); }); // eslint-disable-line no-new\n // for early implementations -0 and +0 not the same\n var BUGGY_ZERO = !IS_WEAK && fails(function () {\n // V8 ~ Chromium 42- fails only with 5+ elements\n var $instance = new C();\n var index = 5;\n while (index--) $instance[ADDER](index, index);\n return !$instance.has(-0);\n });\n if (!ACCEPT_ITERABLES) {\n C = wrapper(function (target, iterable) {\n anInstance(target, C, NAME);\n var that = inheritIfRequired(new Base(), target, C);\n if (iterable != undefined) forOf(iterable, IS_MAP, that[ADDER], that);\n return that;\n });\n C.prototype = proto;\n proto.constructor = C;\n }\n if (THROWS_ON_PRIMITIVES || BUGGY_ZERO) {\n fixMethod('delete');\n fixMethod('has');\n IS_MAP && fixMethod('get');\n }\n if (BUGGY_ZERO || HASNT_CHAINING) fixMethod(ADDER);\n // weak collections should not contains .clear method\n if (IS_WEAK && proto.clear) delete proto.clear;\n }\n\n setToStringTag(C, NAME);\n\n O[NAME] = C;\n $export($export.G + $export.W + $export.F * (C != Base), O);\n\n if (!IS_WEAK) common.setStrong(C, NAME, IS_MAP);\n\n return C;\n};\n","var core = module.exports = { version: '2.6.5' };\nif (typeof __e == 'number') __e = core; // eslint-disable-line no-undef\n","// optional / simple context binding\nvar aFunction = require('./_a-function');\nmodule.exports = function (fn, that, length) {\n aFunction(fn);\n if (that === undefined) return fn;\n switch (length) {\n case 1: return function (a) {\n return fn.call(that, a);\n };\n case 2: return function (a, b) {\n return fn.call(that, a, b);\n };\n case 3: return function (a, b, c) {\n return fn.call(that, a, b, c);\n };\n }\n return function (/* ...args */) {\n return fn.apply(that, arguments);\n };\n};\n","// 7.2.1 RequireObjectCoercible(argument)\nmodule.exports = function (it) {\n if (it == undefined) throw TypeError(\"Can't call method on \" + it);\n return it;\n};\n","// Thank's IE8 for his funny defineProperty\nmodule.exports = !require('./_fails')(function () {\n return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7;\n});\n","var isObject = require('./_is-object');\nvar document = require('./_global').document;\n// typeof document.createElement is 'object' in old IE\nvar is = isObject(document) && isObject(document.createElement);\nmodule.exports = function (it) {\n return is ? document.createElement(it) : {};\n};\n","// IE 8- don't enum bug keys\nmodule.exports = (\n 'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf'\n).split(',');\n","var global = require('./_global');\nvar core = require('./_core');\nvar hide = require('./_hide');\nvar redefine = require('./_redefine');\nvar ctx = require('./_ctx');\nvar PROTOTYPE = 'prototype';\n\nvar $export = function (type, name, source) {\n var IS_FORCED = type & $export.F;\n var IS_GLOBAL = type & $export.G;\n var IS_STATIC = type & $export.S;\n var IS_PROTO = type & $export.P;\n var IS_BIND = type & $export.B;\n var target = IS_GLOBAL ? global : IS_STATIC ? global[name] || (global[name] = {}) : (global[name] || {})[PROTOTYPE];\n var exports = IS_GLOBAL ? core : core[name] || (core[name] = {});\n var expProto = exports[PROTOTYPE] || (exports[PROTOTYPE] = {});\n var key, own, out, exp;\n if (IS_GLOBAL) source = name;\n for (key in source) {\n // contains in native\n own = !IS_FORCED && target && target[key] !== undefined;\n // export native or passed\n out = (own ? target : source)[key];\n // bind timers to global for call from export context\n exp = IS_BIND && own ? ctx(out, global) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out;\n // extend global\n if (target) redefine(target, key, out, type & $export.U);\n // export\n if (exports[key] != out) hide(exports, key, exp);\n if (IS_PROTO && expProto[key] != out) expProto[key] = out;\n }\n};\nglobal.core = core;\n// type bitmap\n$export.F = 1; // forced\n$export.G = 2; // global\n$export.S = 4; // static\n$export.P = 8; // proto\n$export.B = 16; // bind\n$export.W = 32; // wrap\n$export.U = 64; // safe\n$export.R = 128; // real proto method for `library`\nmodule.exports = $export;\n","module.exports = function (exec) {\n try {\n return !!exec();\n } catch (e) {\n return true;\n }\n};\n","var ctx = require('./_ctx');\nvar call = require('./_iter-call');\nvar isArrayIter = require('./_is-array-iter');\nvar anObject = require('./_an-object');\nvar toLength = require('./_to-length');\nvar getIterFn = require('./core.get-iterator-method');\nvar BREAK = {};\nvar RETURN = {};\nvar exports = module.exports = function (iterable, entries, fn, that, ITERATOR) {\n var iterFn = ITERATOR ? function () { return iterable; } : getIterFn(iterable);\n var f = ctx(fn, that, entries ? 2 : 1);\n var index = 0;\n var length, step, iterator, result;\n if (typeof iterFn != 'function') throw TypeError(iterable + ' is not iterable!');\n // fast case for arrays with default iterator\n if (isArrayIter(iterFn)) for (length = toLength(iterable.length); length > index; index++) {\n result = entries ? f(anObject(step = iterable[index])[0], step[1]) : f(iterable[index]);\n if (result === BREAK || result === RETURN) return result;\n } else for (iterator = iterFn.call(iterable); !(step = iterator.next()).done;) {\n result = call(iterator, f, step.value, entries);\n if (result === BREAK || result === RETURN) return result;\n }\n};\nexports.BREAK = BREAK;\nexports.RETURN = RETURN;\n","module.exports = require('./_shared')('native-function-to-string', Function.toString);\n","// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028\nvar global = module.exports = typeof window != 'undefined' && window.Math == Math\n ? window : typeof self != 'undefined' && self.Math == Math ? self\n // eslint-disable-next-line no-new-func\n : Function('return this')();\nif (typeof __g == 'number') __g = global; // eslint-disable-line no-undef\n","var hasOwnProperty = {}.hasOwnProperty;\nmodule.exports = function (it, key) {\n return hasOwnProperty.call(it, key);\n};\n","var dP = require('./_object-dp');\nvar createDesc = require('./_property-desc');\nmodule.exports = require('./_descriptors') ? function (object, key, value) {\n return dP.f(object, key, createDesc(1, value));\n} : function (object, key, value) {\n object[key] = value;\n return object;\n};\n","var document = require('./_global').document;\nmodule.exports = document && document.documentElement;\n","module.exports = !require('./_descriptors') && !require('./_fails')(function () {\n return Object.defineProperty(require('./_dom-create')('div'), 'a', { get: function () { return 7; } }).a != 7;\n});\n","var isObject = require('./_is-object');\nvar setPrototypeOf = require('./_set-proto').set;\nmodule.exports = function (that, target, C) {\n var S = target.constructor;\n var P;\n if (S !== C && typeof S == 'function' && (P = S.prototype) !== C.prototype && isObject(P) && setPrototypeOf) {\n setPrototypeOf(that, P);\n } return that;\n};\n","// fallback for non-array-like ES3 and non-enumerable old V8 strings\nvar cof = require('./_cof');\n// eslint-disable-next-line no-prototype-builtins\nmodule.exports = Object('z').propertyIsEnumerable(0) ? Object : function (it) {\n return cof(it) == 'String' ? it.split('') : Object(it);\n};\n","// check on default Array iterator\nvar Iterators = require('./_iterators');\nvar ITERATOR = require('./_wks')('iterator');\nvar ArrayProto = Array.prototype;\n\nmodule.exports = function (it) {\n return it !== undefined && (Iterators.Array === it || ArrayProto[ITERATOR] === it);\n};\n","// 7.2.2 IsArray(argument)\nvar cof = require('./_cof');\nmodule.exports = Array.isArray || function isArray(arg) {\n return cof(arg) == 'Array';\n};\n","module.exports = function (it) {\n return typeof it === 'object' ? it !== null : typeof it === 'function';\n};\n","// call something on iterator step with safe closing on error\nvar anObject = require('./_an-object');\nmodule.exports = function (iterator, fn, value, entries) {\n try {\n return entries ? fn(anObject(value)[0], value[1]) : fn(value);\n // 7.4.6 IteratorClose(iterator, completion)\n } catch (e) {\n var ret = iterator['return'];\n if (ret !== undefined) anObject(ret.call(iterator));\n throw e;\n }\n};\n","'use strict';\nvar create = require('./_object-create');\nvar descriptor = require('./_property-desc');\nvar setToStringTag = require('./_set-to-string-tag');\nvar IteratorPrototype = {};\n\n// 25.1.2.1.1 %IteratorPrototype%[@@iterator]()\nrequire('./_hide')(IteratorPrototype, require('./_wks')('iterator'), function () { return this; });\n\nmodule.exports = function (Constructor, NAME, next) {\n Constructor.prototype = create(IteratorPrototype, { next: descriptor(1, next) });\n setToStringTag(Constructor, NAME + ' Iterator');\n};\n","'use strict';\nvar LIBRARY = require('./_library');\nvar $export = require('./_export');\nvar redefine = require('./_redefine');\nvar hide = require('./_hide');\nvar Iterators = require('./_iterators');\nvar $iterCreate = require('./_iter-create');\nvar setToStringTag = require('./_set-to-string-tag');\nvar getPrototypeOf = require('./_object-gpo');\nvar ITERATOR = require('./_wks')('iterator');\nvar BUGGY = !([].keys && 'next' in [].keys()); // Safari has buggy iterators w/o `next`\nvar FF_ITERATOR = '@@iterator';\nvar KEYS = 'keys';\nvar VALUES = 'values';\n\nvar returnThis = function () { return this; };\n\nmodule.exports = function (Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED) {\n $iterCreate(Constructor, NAME, next);\n var getMethod = function (kind) {\n if (!BUGGY && kind in proto) return proto[kind];\n switch (kind) {\n case KEYS: return function keys() { return new Constructor(this, kind); };\n case VALUES: return function values() { return new Constructor(this, kind); };\n } return function entries() { return new Constructor(this, kind); };\n };\n var TAG = NAME + ' Iterator';\n var DEF_VALUES = DEFAULT == VALUES;\n var VALUES_BUG = false;\n var proto = Base.prototype;\n var $native = proto[ITERATOR] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT];\n var $default = $native || getMethod(DEFAULT);\n var $entries = DEFAULT ? !DEF_VALUES ? $default : getMethod('entries') : undefined;\n var $anyNative = NAME == 'Array' ? proto.entries || $native : $native;\n var methods, key, IteratorPrototype;\n // Fix native\n if ($anyNative) {\n IteratorPrototype = getPrototypeOf($anyNative.call(new Base()));\n if (IteratorPrototype !== Object.prototype && IteratorPrototype.next) {\n // Set @@toStringTag to native iterators\n setToStringTag(IteratorPrototype, TAG, true);\n // fix for some old engines\n if (!LIBRARY && typeof IteratorPrototype[ITERATOR] != 'function') hide(IteratorPrototype, ITERATOR, returnThis);\n }\n }\n // fix Array#{values, @@iterator}.name in V8 / FF\n if (DEF_VALUES && $native && $native.name !== VALUES) {\n VALUES_BUG = true;\n $default = function values() { return $native.call(this); };\n }\n // Define iterator\n if ((!LIBRARY || FORCED) && (BUGGY || VALUES_BUG || !proto[ITERATOR])) {\n hide(proto, ITERATOR, $default);\n }\n // Plug for library\n Iterators[NAME] = $default;\n Iterators[TAG] = returnThis;\n if (DEFAULT) {\n methods = {\n values: DEF_VALUES ? $default : getMethod(VALUES),\n keys: IS_SET ? $default : getMethod(KEYS),\n entries: $entries\n };\n if (FORCED) for (key in methods) {\n if (!(key in proto)) redefine(proto, key, methods[key]);\n } else $export($export.P + $export.F * (BUGGY || VALUES_BUG), NAME, methods);\n }\n return methods;\n};\n","var ITERATOR = require('./_wks')('iterator');\nvar SAFE_CLOSING = false;\n\ntry {\n var riter = [7][ITERATOR]();\n riter['return'] = function () { SAFE_CLOSING = true; };\n // eslint-disable-next-line no-throw-literal\n Array.from(riter, function () { throw 2; });\n} catch (e) { /* empty */ }\n\nmodule.exports = function (exec, skipClosing) {\n if (!skipClosing && !SAFE_CLOSING) return false;\n var safe = false;\n try {\n var arr = [7];\n var iter = arr[ITERATOR]();\n iter.next = function () { return { done: safe = true }; };\n arr[ITERATOR] = function () { return iter; };\n exec(arr);\n } catch (e) { /* empty */ }\n return safe;\n};\n","module.exports = function (done, value) {\n return { value: value, done: !!done };\n};\n","module.exports = {};\n","module.exports = false;\n","var META = require('./_uid')('meta');\nvar isObject = require('./_is-object');\nvar has = require('./_has');\nvar setDesc = require('./_object-dp').f;\nvar id = 0;\nvar isExtensible = Object.isExtensible || function () {\n return true;\n};\nvar FREEZE = !require('./_fails')(function () {\n return isExtensible(Object.preventExtensions({}));\n});\nvar setMeta = function (it) {\n setDesc(it, META, { value: {\n i: 'O' + ++id, // object ID\n w: {} // weak collections IDs\n } });\n};\nvar fastKey = function (it, create) {\n // return primitive with prefix\n if (!isObject(it)) return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it;\n if (!has(it, META)) {\n // can't set metadata to uncaught frozen object\n if (!isExtensible(it)) return 'F';\n // not necessary to add metadata\n if (!create) return 'E';\n // add missing metadata\n setMeta(it);\n // return object ID\n } return it[META].i;\n};\nvar getWeak = function (it, create) {\n if (!has(it, META)) {\n // can't set metadata to uncaught frozen object\n if (!isExtensible(it)) return true;\n // not necessary to add metadata\n if (!create) return false;\n // add missing metadata\n setMeta(it);\n // return hash weak collections IDs\n } return it[META].w;\n};\n// add metadata on freeze-family methods calling\nvar onFreeze = function (it) {\n if (FREEZE && meta.NEED && isExtensible(it) && !has(it, META)) setMeta(it);\n return it;\n};\nvar meta = module.exports = {\n KEY: META,\n NEED: false,\n fastKey: fastKey,\n getWeak: getWeak,\n onFreeze: onFreeze\n};\n","var Map = require('./es6.map');\nvar $export = require('./_export');\nvar shared = require('./_shared')('metadata');\nvar store = shared.store || (shared.store = new (require('./es6.weak-map'))());\n\nvar getOrCreateMetadataMap = function (target, targetKey, create) {\n var targetMetadata = store.get(target);\n if (!targetMetadata) {\n if (!create) return undefined;\n store.set(target, targetMetadata = new Map());\n }\n var keyMetadata = targetMetadata.get(targetKey);\n if (!keyMetadata) {\n if (!create) return undefined;\n targetMetadata.set(targetKey, keyMetadata = new Map());\n } return keyMetadata;\n};\nvar ordinaryHasOwnMetadata = function (MetadataKey, O, P) {\n var metadataMap = getOrCreateMetadataMap(O, P, false);\n return metadataMap === undefined ? false : metadataMap.has(MetadataKey);\n};\nvar ordinaryGetOwnMetadata = function (MetadataKey, O, P) {\n var metadataMap = getOrCreateMetadataMap(O, P, false);\n return metadataMap === undefined ? undefined : metadataMap.get(MetadataKey);\n};\nvar ordinaryDefineOwnMetadata = function (MetadataKey, MetadataValue, O, P) {\n getOrCreateMetadataMap(O, P, true).set(MetadataKey, MetadataValue);\n};\nvar ordinaryOwnMetadataKeys = function (target, targetKey) {\n var metadataMap = getOrCreateMetadataMap(target, targetKey, false);\n var keys = [];\n if (metadataMap) metadataMap.forEach(function (_, key) { keys.push(key); });\n return keys;\n};\nvar toMetaKey = function (it) {\n return it === undefined || typeof it == 'symbol' ? it : String(it);\n};\nvar exp = function (O) {\n $export($export.S, 'Reflect', O);\n};\n\nmodule.exports = {\n store: store,\n map: getOrCreateMetadataMap,\n has: ordinaryHasOwnMetadata,\n get: ordinaryGetOwnMetadata,\n set: ordinaryDefineOwnMetadata,\n keys: ordinaryOwnMetadataKeys,\n key: toMetaKey,\n exp: exp\n};\n","'use strict';\n// 19.1.2.1 Object.assign(target, source, ...)\nvar getKeys = require('./_object-keys');\nvar gOPS = require('./_object-gops');\nvar pIE = require('./_object-pie');\nvar toObject = require('./_to-object');\nvar IObject = require('./_iobject');\nvar $assign = Object.assign;\n\n// should work with symbols and should have deterministic property order (V8 bug)\nmodule.exports = !$assign || require('./_fails')(function () {\n var A = {};\n var B = {};\n // eslint-disable-next-line no-undef\n var S = Symbol();\n var K = 'abcdefghijklmnopqrst';\n A[S] = 7;\n K.split('').forEach(function (k) { B[k] = k; });\n return $assign({}, A)[S] != 7 || Object.keys($assign({}, B)).join('') != K;\n}) ? function assign(target, source) { // eslint-disable-line no-unused-vars\n var T = toObject(target);\n var aLen = arguments.length;\n var index = 1;\n var getSymbols = gOPS.f;\n var isEnum = pIE.f;\n while (aLen > index) {\n var S = IObject(arguments[index++]);\n var keys = getSymbols ? getKeys(S).concat(getSymbols(S)) : getKeys(S);\n var length = keys.length;\n var j = 0;\n var key;\n while (length > j) if (isEnum.call(S, key = keys[j++])) T[key] = S[key];\n } return T;\n} : $assign;\n","// 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties])\nvar anObject = require('./_an-object');\nvar dPs = require('./_object-dps');\nvar enumBugKeys = require('./_enum-bug-keys');\nvar IE_PROTO = require('./_shared-key')('IE_PROTO');\nvar Empty = function () { /* empty */ };\nvar PROTOTYPE = 'prototype';\n\n// Create object with fake `null` prototype: use iframe Object with cleared prototype\nvar createDict = function () {\n // Thrash, waste and sodomy: IE GC bug\n var iframe = require('./_dom-create')('iframe');\n var i = enumBugKeys.length;\n var lt = '<';\n var gt = '>';\n var iframeDocument;\n iframe.style.display = 'none';\n require('./_html').appendChild(iframe);\n iframe.src = 'javascript:'; // eslint-disable-line no-script-url\n // createDict = iframe.contentWindow.Object;\n // html.removeChild(iframe);\n iframeDocument = iframe.contentWindow.document;\n iframeDocument.open();\n iframeDocument.write(lt + 'script' + gt + 'document.F=Object' + lt + '/script' + gt);\n iframeDocument.close();\n createDict = iframeDocument.F;\n while (i--) delete createDict[PROTOTYPE][enumBugKeys[i]];\n return createDict();\n};\n\nmodule.exports = Object.create || function create(O, Properties) {\n var result;\n if (O !== null) {\n Empty[PROTOTYPE] = anObject(O);\n result = new Empty();\n Empty[PROTOTYPE] = null;\n // add \"__proto__\" for Object.getPrototypeOf polyfill\n result[IE_PROTO] = O;\n } else result = createDict();\n return Properties === undefined ? result : dPs(result, Properties);\n};\n","var anObject = require('./_an-object');\nvar IE8_DOM_DEFINE = require('./_ie8-dom-define');\nvar toPrimitive = require('./_to-primitive');\nvar dP = Object.defineProperty;\n\nexports.f = require('./_descriptors') ? Object.defineProperty : function defineProperty(O, P, Attributes) {\n anObject(O);\n P = toPrimitive(P, true);\n anObject(Attributes);\n if (IE8_DOM_DEFINE) try {\n return dP(O, P, Attributes);\n } catch (e) { /* empty */ }\n if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported!');\n if ('value' in Attributes) O[P] = Attributes.value;\n return O;\n};\n","var dP = require('./_object-dp');\nvar anObject = require('./_an-object');\nvar getKeys = require('./_object-keys');\n\nmodule.exports = require('./_descriptors') ? Object.defineProperties : function defineProperties(O, Properties) {\n anObject(O);\n var keys = getKeys(Properties);\n var length = keys.length;\n var i = 0;\n var P;\n while (length > i) dP.f(O, P = keys[i++], Properties[P]);\n return O;\n};\n","var pIE = require('./_object-pie');\nvar createDesc = require('./_property-desc');\nvar toIObject = require('./_to-iobject');\nvar toPrimitive = require('./_to-primitive');\nvar has = require('./_has');\nvar IE8_DOM_DEFINE = require('./_ie8-dom-define');\nvar gOPD = Object.getOwnPropertyDescriptor;\n\nexports.f = require('./_descriptors') ? gOPD : function getOwnPropertyDescriptor(O, P) {\n O = toIObject(O);\n P = toPrimitive(P, true);\n if (IE8_DOM_DEFINE) try {\n return gOPD(O, P);\n } catch (e) { /* empty */ }\n if (has(O, P)) return createDesc(!pIE.f.call(O, P), O[P]);\n};\n","exports.f = Object.getOwnPropertySymbols;\n","// 19.1.2.9 / 15.2.3.2 Object.getPrototypeOf(O)\nvar has = require('./_has');\nvar toObject = require('./_to-object');\nvar IE_PROTO = require('./_shared-key')('IE_PROTO');\nvar ObjectProto = Object.prototype;\n\nmodule.exports = Object.getPrototypeOf || function (O) {\n O = toObject(O);\n if (has(O, IE_PROTO)) return O[IE_PROTO];\n if (typeof O.constructor == 'function' && O instanceof O.constructor) {\n return O.constructor.prototype;\n } return O instanceof Object ? ObjectProto : null;\n};\n","var has = require('./_has');\nvar toIObject = require('./_to-iobject');\nvar arrayIndexOf = require('./_array-includes')(false);\nvar IE_PROTO = require('./_shared-key')('IE_PROTO');\n\nmodule.exports = function (object, names) {\n var O = toIObject(object);\n var i = 0;\n var result = [];\n var key;\n for (key in O) if (key != IE_PROTO) has(O, key) && result.push(key);\n // Don't enum bug & hidden keys\n while (names.length > i) if (has(O, key = names[i++])) {\n ~arrayIndexOf(result, key) || result.push(key);\n }\n return result;\n};\n","// 19.1.2.14 / 15.2.3.14 Object.keys(O)\nvar $keys = require('./_object-keys-internal');\nvar enumBugKeys = require('./_enum-bug-keys');\n\nmodule.exports = Object.keys || function keys(O) {\n return $keys(O, enumBugKeys);\n};\n","exports.f = {}.propertyIsEnumerable;\n","module.exports = function (bitmap, value) {\n return {\n enumerable: !(bitmap & 1),\n configurable: !(bitmap & 2),\n writable: !(bitmap & 4),\n value: value\n };\n};\n","var redefine = require('./_redefine');\nmodule.exports = function (target, src, safe) {\n for (var key in src) redefine(target, key, src[key], safe);\n return target;\n};\n","var global = require('./_global');\nvar hide = require('./_hide');\nvar has = require('./_has');\nvar SRC = require('./_uid')('src');\nvar $toString = require('./_function-to-string');\nvar TO_STRING = 'toString';\nvar TPL = ('' + $toString).split(TO_STRING);\n\nrequire('./_core').inspectSource = function (it) {\n return $toString.call(it);\n};\n\n(module.exports = function (O, key, val, safe) {\n var isFunction = typeof val == 'function';\n if (isFunction) has(val, 'name') || hide(val, 'name', key);\n if (O[key] === val) return;\n if (isFunction) has(val, SRC) || hide(val, SRC, O[key] ? '' + O[key] : TPL.join(String(key)));\n if (O === global) {\n O[key] = val;\n } else if (!safe) {\n delete O[key];\n hide(O, key, val);\n } else if (O[key]) {\n O[key] = val;\n } else {\n hide(O, key, val);\n }\n// add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative\n})(Function.prototype, TO_STRING, function toString() {\n return typeof this == 'function' && this[SRC] || $toString.call(this);\n});\n","// Works with __proto__ only. Old v8 can't work with null proto objects.\n/* eslint-disable no-proto */\nvar isObject = require('./_is-object');\nvar anObject = require('./_an-object');\nvar check = function (O, proto) {\n anObject(O);\n if (!isObject(proto) && proto !== null) throw TypeError(proto + \": can't set as prototype!\");\n};\nmodule.exports = {\n set: Object.setPrototypeOf || ('__proto__' in {} ? // eslint-disable-line\n function (test, buggy, set) {\n try {\n set = require('./_ctx')(Function.call, require('./_object-gopd').f(Object.prototype, '__proto__').set, 2);\n set(test, []);\n buggy = !(test instanceof Array);\n } catch (e) { buggy = true; }\n return function setPrototypeOf(O, proto) {\n check(O, proto);\n if (buggy) O.__proto__ = proto;\n else set(O, proto);\n return O;\n };\n }({}, false) : undefined),\n check: check\n};\n","'use strict';\nvar global = require('./_global');\nvar dP = require('./_object-dp');\nvar DESCRIPTORS = require('./_descriptors');\nvar SPECIES = require('./_wks')('species');\n\nmodule.exports = function (KEY) {\n var C = global[KEY];\n if (DESCRIPTORS && C && !C[SPECIES]) dP.f(C, SPECIES, {\n configurable: true,\n get: function () { return this; }\n });\n};\n","var def = require('./_object-dp').f;\nvar has = require('./_has');\nvar TAG = require('./_wks')('toStringTag');\n\nmodule.exports = function (it, tag, stat) {\n if (it && !has(it = stat ? it : it.prototype, TAG)) def(it, TAG, { configurable: true, value: tag });\n};\n","var shared = require('./_shared')('keys');\nvar uid = require('./_uid');\nmodule.exports = function (key) {\n return shared[key] || (shared[key] = uid(key));\n};\n","var core = require('./_core');\nvar global = require('./_global');\nvar SHARED = '__core-js_shared__';\nvar store = global[SHARED] || (global[SHARED] = {});\n\n(module.exports = function (key, value) {\n return store[key] || (store[key] = value !== undefined ? value : {});\n})('versions', []).push({\n version: core.version,\n mode: require('./_library') ? 'pure' : 'global',\n copyright: '© 2019 Denis Pushkarev (zloirock.ru)'\n});\n","var toInteger = require('./_to-integer');\nvar max = Math.max;\nvar min = Math.min;\nmodule.exports = function (index, length) {\n index = toInteger(index);\n return index < 0 ? max(index + length, 0) : min(index, length);\n};\n","// 7.1.4 ToInteger\nvar ceil = Math.ceil;\nvar floor = Math.floor;\nmodule.exports = function (it) {\n return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it);\n};\n","// to indexed object, toObject with fallback for non-array-like ES3 strings\nvar IObject = require('./_iobject');\nvar defined = require('./_defined');\nmodule.exports = function (it) {\n return IObject(defined(it));\n};\n","// 7.1.15 ToLength\nvar toInteger = require('./_to-integer');\nvar min = Math.min;\nmodule.exports = function (it) {\n return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991\n};\n","// 7.1.13 ToObject(argument)\nvar defined = require('./_defined');\nmodule.exports = function (it) {\n return Object(defined(it));\n};\n","// 7.1.1 ToPrimitive(input [, PreferredType])\nvar isObject = require('./_is-object');\n// instead of the ES6 spec version, we didn't implement @@toPrimitive case\n// and the second argument - flag - preferred type is a string\nmodule.exports = function (it, S) {\n if (!isObject(it)) return it;\n var fn, val;\n if (S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val;\n if (typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it))) return val;\n if (!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val;\n throw TypeError(\"Can't convert object to primitive value\");\n};\n","var id = 0;\nvar px = Math.random();\nmodule.exports = function (key) {\n return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36));\n};\n","var isObject = require('./_is-object');\nmodule.exports = function (it, TYPE) {\n if (!isObject(it) || it._t !== TYPE) throw TypeError('Incompatible receiver, ' + TYPE + ' required!');\n return it;\n};\n","var store = require('./_shared')('wks');\nvar uid = require('./_uid');\nvar Symbol = require('./_global').Symbol;\nvar USE_SYMBOL = typeof Symbol == 'function';\n\nvar $exports = module.exports = function (name) {\n return store[name] || (store[name] =\n USE_SYMBOL && Symbol[name] || (USE_SYMBOL ? Symbol : uid)('Symbol.' + name));\n};\n\n$exports.store = store;\n","var classof = require('./_classof');\nvar ITERATOR = require('./_wks')('iterator');\nvar Iterators = require('./_iterators');\nmodule.exports = require('./_core').getIteratorMethod = function (it) {\n if (it != undefined) return it[ITERATOR]\n || it['@@iterator']\n || Iterators[classof(it)];\n};\n","'use strict';\nvar strong = require('./_collection-strong');\nvar validate = require('./_validate-collection');\nvar MAP = 'Map';\n\n// 23.1 Map Objects\nmodule.exports = require('./_collection')(MAP, function (get) {\n return function Map() { return get(this, arguments.length > 0 ? arguments[0] : undefined); };\n}, {\n // 23.1.3.6 Map.prototype.get(key)\n get: function get(key) {\n var entry = strong.getEntry(validate(this, MAP), key);\n return entry && entry.v;\n },\n // 23.1.3.9 Map.prototype.set(key, value)\n set: function set(key, value) {\n return strong.def(validate(this, MAP), key === 0 ? 0 : key, value);\n }\n}, strong, true);\n","'use strict';\nvar strong = require('./_collection-strong');\nvar validate = require('./_validate-collection');\nvar SET = 'Set';\n\n// 23.2 Set Objects\nmodule.exports = require('./_collection')(SET, function (get) {\n return function Set() { return get(this, arguments.length > 0 ? arguments[0] : undefined); };\n}, {\n // 23.2.3.1 Set.prototype.add(value)\n add: function add(value) {\n return strong.def(validate(this, SET), value = value === 0 ? 0 : value, value);\n }\n}, strong);\n","'use strict';\nvar global = require('./_global');\nvar each = require('./_array-methods')(0);\nvar redefine = require('./_redefine');\nvar meta = require('./_meta');\nvar assign = require('./_object-assign');\nvar weak = require('./_collection-weak');\nvar isObject = require('./_is-object');\nvar validate = require('./_validate-collection');\nvar NATIVE_WEAK_MAP = require('./_validate-collection');\nvar IS_IE11 = !global.ActiveXObject && 'ActiveXObject' in global;\nvar WEAK_MAP = 'WeakMap';\nvar getWeak = meta.getWeak;\nvar isExtensible = Object.isExtensible;\nvar uncaughtFrozenStore = weak.ufstore;\nvar InternalMap;\n\nvar wrapper = function (get) {\n return function WeakMap() {\n return get(this, arguments.length > 0 ? arguments[0] : undefined);\n };\n};\n\nvar methods = {\n // 23.3.3.3 WeakMap.prototype.get(key)\n get: function get(key) {\n if (isObject(key)) {\n var data = getWeak(key);\n if (data === true) return uncaughtFrozenStore(validate(this, WEAK_MAP)).get(key);\n return data ? data[this._i] : undefined;\n }\n },\n // 23.3.3.5 WeakMap.prototype.set(key, value)\n set: function set(key, value) {\n return weak.def(validate(this, WEAK_MAP), key, value);\n }\n};\n\n// 23.3 WeakMap Objects\nvar $WeakMap = module.exports = require('./_collection')(WEAK_MAP, wrapper, methods, weak, true, true);\n\n// IE11 WeakMap frozen keys fix\nif (NATIVE_WEAK_MAP && IS_IE11) {\n InternalMap = weak.getConstructor(wrapper, WEAK_MAP);\n assign(InternalMap.prototype, methods);\n meta.NEED = true;\n each(['delete', 'has', 'get', 'set'], function (key) {\n var proto = $WeakMap.prototype;\n var method = proto[key];\n redefine(proto, key, function (a, b) {\n // store frozen objects on internal weakmap shim\n if (isObject(a) && !isExtensible(a)) {\n if (!this._f) this._f = new InternalMap();\n var result = this._f[key](a, b);\n return key == 'set' ? this : result;\n // store all the rest on native weakmap\n } return method.call(this, a, b);\n });\n });\n}\n","var metadata = require('./_metadata');\nvar anObject = require('./_an-object');\nvar toMetaKey = metadata.key;\nvar ordinaryDefineOwnMetadata = metadata.set;\n\nmetadata.exp({ defineMetadata: function defineMetadata(metadataKey, metadataValue, target, targetKey) {\n ordinaryDefineOwnMetadata(metadataKey, metadataValue, anObject(target), toMetaKey(targetKey));\n} });\n","var metadata = require('./_metadata');\nvar anObject = require('./_an-object');\nvar toMetaKey = metadata.key;\nvar getOrCreateMetadataMap = metadata.map;\nvar store = metadata.store;\n\nmetadata.exp({ deleteMetadata: function deleteMetadata(metadataKey, target /* , targetKey */) {\n var targetKey = arguments.length < 3 ? undefined : toMetaKey(arguments[2]);\n var metadataMap = getOrCreateMetadataMap(anObject(target), targetKey, false);\n if (metadataMap === undefined || !metadataMap['delete'](metadataKey)) return false;\n if (metadataMap.size) return true;\n var targetMetadata = store.get(target);\n targetMetadata['delete'](targetKey);\n return !!targetMetadata.size || store['delete'](target);\n} });\n","var Set = require('./es6.set');\nvar from = require('./_array-from-iterable');\nvar metadata = require('./_metadata');\nvar anObject = require('./_an-object');\nvar getPrototypeOf = require('./_object-gpo');\nvar ordinaryOwnMetadataKeys = metadata.keys;\nvar toMetaKey = metadata.key;\n\nvar ordinaryMetadataKeys = function (O, P) {\n var oKeys = ordinaryOwnMetadataKeys(O, P);\n var parent = getPrototypeOf(O);\n if (parent === null) return oKeys;\n var pKeys = ordinaryMetadataKeys(parent, P);\n return pKeys.length ? oKeys.length ? from(new Set(oKeys.concat(pKeys))) : pKeys : oKeys;\n};\n\nmetadata.exp({ getMetadataKeys: function getMetadataKeys(target /* , targetKey */) {\n return ordinaryMetadataKeys(anObject(target), arguments.length < 2 ? undefined : toMetaKey(arguments[1]));\n} });\n","var metadata = require('./_metadata');\nvar anObject = require('./_an-object');\nvar getPrototypeOf = require('./_object-gpo');\nvar ordinaryHasOwnMetadata = metadata.has;\nvar ordinaryGetOwnMetadata = metadata.get;\nvar toMetaKey = metadata.key;\n\nvar ordinaryGetMetadata = function (MetadataKey, O, P) {\n var hasOwn = ordinaryHasOwnMetadata(MetadataKey, O, P);\n if (hasOwn) return ordinaryGetOwnMetadata(MetadataKey, O, P);\n var parent = getPrototypeOf(O);\n return parent !== null ? ordinaryGetMetadata(MetadataKey, parent, P) : undefined;\n};\n\nmetadata.exp({ getMetadata: function getMetadata(metadataKey, target /* , targetKey */) {\n return ordinaryGetMetadata(metadataKey, anObject(target), arguments.length < 3 ? undefined : toMetaKey(arguments[2]));\n} });\n","var metadata = require('./_metadata');\nvar anObject = require('./_an-object');\nvar ordinaryOwnMetadataKeys = metadata.keys;\nvar toMetaKey = metadata.key;\n\nmetadata.exp({ getOwnMetadataKeys: function getOwnMetadataKeys(target /* , targetKey */) {\n return ordinaryOwnMetadataKeys(anObject(target), arguments.length < 2 ? undefined : toMetaKey(arguments[1]));\n} });\n","var metadata = require('./_metadata');\nvar anObject = require('./_an-object');\nvar ordinaryGetOwnMetadata = metadata.get;\nvar toMetaKey = metadata.key;\n\nmetadata.exp({ getOwnMetadata: function getOwnMetadata(metadataKey, target /* , targetKey */) {\n return ordinaryGetOwnMetadata(metadataKey, anObject(target)\n , arguments.length < 3 ? undefined : toMetaKey(arguments[2]));\n} });\n","var metadata = require('./_metadata');\nvar anObject = require('./_an-object');\nvar getPrototypeOf = require('./_object-gpo');\nvar ordinaryHasOwnMetadata = metadata.has;\nvar toMetaKey = metadata.key;\n\nvar ordinaryHasMetadata = function (MetadataKey, O, P) {\n var hasOwn = ordinaryHasOwnMetadata(MetadataKey, O, P);\n if (hasOwn) return true;\n var parent = getPrototypeOf(O);\n return parent !== null ? ordinaryHasMetadata(MetadataKey, parent, P) : false;\n};\n\nmetadata.exp({ hasMetadata: function hasMetadata(metadataKey, target /* , targetKey */) {\n return ordinaryHasMetadata(metadataKey, anObject(target), arguments.length < 3 ? undefined : toMetaKey(arguments[2]));\n} });\n","var metadata = require('./_metadata');\nvar anObject = require('./_an-object');\nvar ordinaryHasOwnMetadata = metadata.has;\nvar toMetaKey = metadata.key;\n\nmetadata.exp({ hasOwnMetadata: function hasOwnMetadata(metadataKey, target /* , targetKey */) {\n return ordinaryHasOwnMetadata(metadataKey, anObject(target)\n , arguments.length < 3 ? undefined : toMetaKey(arguments[2]));\n} });\n","var $metadata = require('./_metadata');\nvar anObject = require('./_an-object');\nvar aFunction = require('./_a-function');\nvar toMetaKey = $metadata.key;\nvar ordinaryDefineOwnMetadata = $metadata.set;\n\n$metadata.exp({ metadata: function metadata(metadataKey, metadataValue) {\n return function decorator(target, targetKey) {\n ordinaryDefineOwnMetadata(\n metadataKey, metadataValue,\n (targetKey !== undefined ? anObject : aFunction)(target),\n toMetaKey(targetKey)\n );\n };\n} });\n","/**\n* @license\n* Copyright Google Inc. All Rights Reserved.\n*\n* Use of this source code is governed by an MIT-style license that can be\n* found in the LICENSE file at https://angular.io/license\n*/\n(function (global, factory) {\n\ttypeof exports === 'object' && typeof module !== 'undefined' ? factory() :\n\ttypeof define === 'function' && define.amd ? define(factory) :\n\t(factory());\n}(this, (function () { 'use strict';\n\n/**\n * @license\n * Copyright Google Inc. All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\nvar Zone$1 = (function (global) {\n var performance = global['performance'];\n function mark(name) {\n performance && performance['mark'] && performance['mark'](name);\n }\n function performanceMeasure(name, label) {\n performance && performance['measure'] && performance['measure'](name, label);\n }\n mark('Zone');\n var checkDuplicate = global[('__zone_symbol__forceDuplicateZoneCheck')] === true;\n if (global['Zone']) {\n // if global['Zone'] already exists (maybe zone.js was already loaded or\n // some other lib also registered a global object named Zone), we may need\n // to throw an error, but sometimes user may not want this error.\n // For example,\n // we have two web pages, page1 includes zone.js, page2 doesn't.\n // and the 1st time user load page1 and page2, everything work fine,\n // but when user load page2 again, error occurs because global['Zone'] already exists.\n // so we add a flag to let user choose whether to throw this error or not.\n // By default, if existing Zone is from zone.js, we will not throw the error.\n if (checkDuplicate || typeof global['Zone'].__symbol__ !== 'function') {\n throw new Error('Zone already loaded.');\n }\n else {\n return global['Zone'];\n }\n }\n var Zone = /** @class */ (function () {\n function Zone(parent, zoneSpec) {\n this._parent = parent;\n this._name = zoneSpec ? zoneSpec.name || 'unnamed' : '';\n this._properties = zoneSpec && zoneSpec.properties || {};\n this._zoneDelegate =\n new ZoneDelegate(this, this._parent && this._parent._zoneDelegate, zoneSpec);\n }\n Zone.assertZonePatched = function () {\n if (global['Promise'] !== patches['ZoneAwarePromise']) {\n throw new Error('Zone.js has detected that ZoneAwarePromise `(window|global).Promise` ' +\n 'has been overwritten.\\n' +\n 'Most likely cause is that a Promise polyfill has been loaded ' +\n 'after Zone.js (Polyfilling Promise api is not necessary when zone.js is loaded. ' +\n 'If you must load one, do so before loading zone.js.)');\n }\n };\n Object.defineProperty(Zone, \"root\", {\n get: function () {\n var zone = Zone.current;\n while (zone.parent) {\n zone = zone.parent;\n }\n return zone;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Zone, \"current\", {\n get: function () {\n return _currentZoneFrame.zone;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Zone, \"currentTask\", {\n get: function () {\n return _currentTask;\n },\n enumerable: true,\n configurable: true\n });\n Zone.__load_patch = function (name, fn) {\n if (patches.hasOwnProperty(name)) {\n if (checkDuplicate) {\n throw Error('Already loaded patch: ' + name);\n }\n }\n else if (!global['__Zone_disable_' + name]) {\n var perfName = 'Zone:' + name;\n mark(perfName);\n patches[name] = fn(global, Zone, _api);\n performanceMeasure(perfName, perfName);\n }\n };\n Object.defineProperty(Zone.prototype, \"parent\", {\n get: function () {\n return this._parent;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Zone.prototype, \"name\", {\n get: function () {\n return this._name;\n },\n enumerable: true,\n configurable: true\n });\n Zone.prototype.get = function (key) {\n var zone = this.getZoneWith(key);\n if (zone)\n return zone._properties[key];\n };\n Zone.prototype.getZoneWith = function (key) {\n var current = this;\n while (current) {\n if (current._properties.hasOwnProperty(key)) {\n return current;\n }\n current = current._parent;\n }\n return null;\n };\n Zone.prototype.fork = function (zoneSpec) {\n if (!zoneSpec)\n throw new Error('ZoneSpec required!');\n return this._zoneDelegate.fork(this, zoneSpec);\n };\n Zone.prototype.wrap = function (callback, source) {\n if (typeof callback !== 'function') {\n throw new Error('Expecting function got: ' + callback);\n }\n var _callback = this._zoneDelegate.intercept(this, callback, source);\n var zone = this;\n return function () {\n return zone.runGuarded(_callback, this, arguments, source);\n };\n };\n Zone.prototype.run = function (callback, applyThis, applyArgs, source) {\n _currentZoneFrame = { parent: _currentZoneFrame, zone: this };\n try {\n return this._zoneDelegate.invoke(this, callback, applyThis, applyArgs, source);\n }\n finally {\n _currentZoneFrame = _currentZoneFrame.parent;\n }\n };\n Zone.prototype.runGuarded = function (callback, applyThis, applyArgs, source) {\n if (applyThis === void 0) { applyThis = null; }\n _currentZoneFrame = { parent: _currentZoneFrame, zone: this };\n try {\n try {\n return this._zoneDelegate.invoke(this, callback, applyThis, applyArgs, source);\n }\n catch (error) {\n if (this._zoneDelegate.handleError(this, error)) {\n throw error;\n }\n }\n }\n finally {\n _currentZoneFrame = _currentZoneFrame.parent;\n }\n };\n Zone.prototype.runTask = function (task, applyThis, applyArgs) {\n if (task.zone != this) {\n throw new Error('A task can only be run in the zone of creation! (Creation: ' +\n (task.zone || NO_ZONE).name + '; Execution: ' + this.name + ')');\n }\n // https://github.com/angular/zone.js/issues/778, sometimes eventTask\n // will run in notScheduled(canceled) state, we should not try to\n // run such kind of task but just return\n if (task.state === notScheduled && (task.type === eventTask || task.type === macroTask)) {\n return;\n }\n var reEntryGuard = task.state != running;\n reEntryGuard && task._transitionTo(running, scheduled);\n task.runCount++;\n var previousTask = _currentTask;\n _currentTask = task;\n _currentZoneFrame = { parent: _currentZoneFrame, zone: this };\n try {\n if (task.type == macroTask && task.data && !task.data.isPeriodic) {\n task.cancelFn = undefined;\n }\n try {\n return this._zoneDelegate.invokeTask(this, task, applyThis, applyArgs);\n }\n catch (error) {\n if (this._zoneDelegate.handleError(this, error)) {\n throw error;\n }\n }\n }\n finally {\n // if the task's state is notScheduled or unknown, then it has already been cancelled\n // we should not reset the state to scheduled\n if (task.state !== notScheduled && task.state !== unknown) {\n if (task.type == eventTask || (task.data && task.data.isPeriodic)) {\n reEntryGuard && task._transitionTo(scheduled, running);\n }\n else {\n task.runCount = 0;\n this._updateTaskCount(task, -1);\n reEntryGuard &&\n task._transitionTo(notScheduled, running, notScheduled);\n }\n }\n _currentZoneFrame = _currentZoneFrame.parent;\n _currentTask = previousTask;\n }\n };\n Zone.prototype.scheduleTask = function (task) {\n if (task.zone && task.zone !== this) {\n // check if the task was rescheduled, the newZone\n // should not be the children of the original zone\n var newZone = this;\n while (newZone) {\n if (newZone === task.zone) {\n throw Error(\"can not reschedule task to \" + this.name + \" which is descendants of the original zone \" + task.zone.name);\n }\n newZone = newZone.parent;\n }\n }\n task._transitionTo(scheduling, notScheduled);\n var zoneDelegates = [];\n task._zoneDelegates = zoneDelegates;\n task._zone = this;\n try {\n task = this._zoneDelegate.scheduleTask(this, task);\n }\n catch (err) {\n // should set task's state to unknown when scheduleTask throw error\n // because the err may from reschedule, so the fromState maybe notScheduled\n task._transitionTo(unknown, scheduling, notScheduled);\n // TODO: @JiaLiPassion, should we check the result from handleError?\n this._zoneDelegate.handleError(this, err);\n throw err;\n }\n if (task._zoneDelegates === zoneDelegates) {\n // we have to check because internally the delegate can reschedule the task.\n this._updateTaskCount(task, 1);\n }\n if (task.state == scheduling) {\n task._transitionTo(scheduled, scheduling);\n }\n return task;\n };\n Zone.prototype.scheduleMicroTask = function (source, callback, data, customSchedule) {\n return this.scheduleTask(new ZoneTask(microTask, source, callback, data, customSchedule, undefined));\n };\n Zone.prototype.scheduleMacroTask = function (source, callback, data, customSchedule, customCancel) {\n return this.scheduleTask(new ZoneTask(macroTask, source, callback, data, customSchedule, customCancel));\n };\n Zone.prototype.scheduleEventTask = function (source, callback, data, customSchedule, customCancel) {\n return this.scheduleTask(new ZoneTask(eventTask, source, callback, data, customSchedule, customCancel));\n };\n Zone.prototype.cancelTask = function (task) {\n if (task.zone != this)\n throw new Error('A task can only be cancelled in the zone of creation! (Creation: ' +\n (task.zone || NO_ZONE).name + '; Execution: ' + this.name + ')');\n task._transitionTo(canceling, scheduled, running);\n try {\n this._zoneDelegate.cancelTask(this, task);\n }\n catch (err) {\n // if error occurs when cancelTask, transit the state to unknown\n task._transitionTo(unknown, canceling);\n this._zoneDelegate.handleError(this, err);\n throw err;\n }\n this._updateTaskCount(task, -1);\n task._transitionTo(notScheduled, canceling);\n task.runCount = 0;\n return task;\n };\n Zone.prototype._updateTaskCount = function (task, count) {\n var zoneDelegates = task._zoneDelegates;\n if (count == -1) {\n task._zoneDelegates = null;\n }\n for (var i = 0; i < zoneDelegates.length; i++) {\n zoneDelegates[i]._updateTaskCount(task.type, count);\n }\n };\n Zone.__symbol__ = __symbol__;\n return Zone;\n }());\n var DELEGATE_ZS = {\n name: '',\n onHasTask: function (delegate, _, target, hasTaskState) { return delegate.hasTask(target, hasTaskState); },\n onScheduleTask: function (delegate, _, target, task) {\n return delegate.scheduleTask(target, task);\n },\n onInvokeTask: function (delegate, _, target, task, applyThis, applyArgs) {\n return delegate.invokeTask(target, task, applyThis, applyArgs);\n },\n onCancelTask: function (delegate, _, target, task) { return delegate.cancelTask(target, task); }\n };\n var ZoneDelegate = /** @class */ (function () {\n function ZoneDelegate(zone, parentDelegate, zoneSpec) {\n this._taskCounts = { 'microTask': 0, 'macroTask': 0, 'eventTask': 0 };\n this.zone = zone;\n this._parentDelegate = parentDelegate;\n this._forkZS = zoneSpec && (zoneSpec && zoneSpec.onFork ? zoneSpec : parentDelegate._forkZS);\n this._forkDlgt = zoneSpec && (zoneSpec.onFork ? parentDelegate : parentDelegate._forkDlgt);\n this._forkCurrZone = zoneSpec && (zoneSpec.onFork ? this.zone : parentDelegate.zone);\n this._interceptZS =\n zoneSpec && (zoneSpec.onIntercept ? zoneSpec : parentDelegate._interceptZS);\n this._interceptDlgt =\n zoneSpec && (zoneSpec.onIntercept ? parentDelegate : parentDelegate._interceptDlgt);\n this._interceptCurrZone =\n zoneSpec && (zoneSpec.onIntercept ? this.zone : parentDelegate.zone);\n this._invokeZS = zoneSpec && (zoneSpec.onInvoke ? zoneSpec : parentDelegate._invokeZS);\n this._invokeDlgt =\n zoneSpec && (zoneSpec.onInvoke ? parentDelegate : parentDelegate._invokeDlgt);\n this._invokeCurrZone = zoneSpec && (zoneSpec.onInvoke ? this.zone : parentDelegate.zone);\n this._handleErrorZS =\n zoneSpec && (zoneSpec.onHandleError ? zoneSpec : parentDelegate._handleErrorZS);\n this._handleErrorDlgt =\n zoneSpec && (zoneSpec.onHandleError ? parentDelegate : parentDelegate._handleErrorDlgt);\n this._handleErrorCurrZone =\n zoneSpec && (zoneSpec.onHandleError ? this.zone : parentDelegate.zone);\n this._scheduleTaskZS =\n zoneSpec && (zoneSpec.onScheduleTask ? zoneSpec : parentDelegate._scheduleTaskZS);\n this._scheduleTaskDlgt = zoneSpec &&\n (zoneSpec.onScheduleTask ? parentDelegate : parentDelegate._scheduleTaskDlgt);\n this._scheduleTaskCurrZone =\n zoneSpec && (zoneSpec.onScheduleTask ? this.zone : parentDelegate.zone);\n this._invokeTaskZS =\n zoneSpec && (zoneSpec.onInvokeTask ? zoneSpec : parentDelegate._invokeTaskZS);\n this._invokeTaskDlgt =\n zoneSpec && (zoneSpec.onInvokeTask ? parentDelegate : parentDelegate._invokeTaskDlgt);\n this._invokeTaskCurrZone =\n zoneSpec && (zoneSpec.onInvokeTask ? this.zone : parentDelegate.zone);\n this._cancelTaskZS =\n zoneSpec && (zoneSpec.onCancelTask ? zoneSpec : parentDelegate._cancelTaskZS);\n this._cancelTaskDlgt =\n zoneSpec && (zoneSpec.onCancelTask ? parentDelegate : parentDelegate._cancelTaskDlgt);\n this._cancelTaskCurrZone =\n zoneSpec && (zoneSpec.onCancelTask ? this.zone : parentDelegate.zone);\n this._hasTaskZS = null;\n this._hasTaskDlgt = null;\n this._hasTaskDlgtOwner = null;\n this._hasTaskCurrZone = null;\n var zoneSpecHasTask = zoneSpec && zoneSpec.onHasTask;\n var parentHasTask = parentDelegate && parentDelegate._hasTaskZS;\n if (zoneSpecHasTask || parentHasTask) {\n // If we need to report hasTask, than this ZS needs to do ref counting on tasks. In such\n // a case all task related interceptors must go through this ZD. We can't short circuit it.\n this._hasTaskZS = zoneSpecHasTask ? zoneSpec : DELEGATE_ZS;\n this._hasTaskDlgt = parentDelegate;\n this._hasTaskDlgtOwner = this;\n this._hasTaskCurrZone = zone;\n if (!zoneSpec.onScheduleTask) {\n this._scheduleTaskZS = DELEGATE_ZS;\n this._scheduleTaskDlgt = parentDelegate;\n this._scheduleTaskCurrZone = this.zone;\n }\n if (!zoneSpec.onInvokeTask) {\n this._invokeTaskZS = DELEGATE_ZS;\n this._invokeTaskDlgt = parentDelegate;\n this._invokeTaskCurrZone = this.zone;\n }\n if (!zoneSpec.onCancelTask) {\n this._cancelTaskZS = DELEGATE_ZS;\n this._cancelTaskDlgt = parentDelegate;\n this._cancelTaskCurrZone = this.zone;\n }\n }\n }\n ZoneDelegate.prototype.fork = function (targetZone, zoneSpec) {\n return this._forkZS ? this._forkZS.onFork(this._forkDlgt, this.zone, targetZone, zoneSpec) :\n new Zone(targetZone, zoneSpec);\n };\n ZoneDelegate.prototype.intercept = function (targetZone, callback, source) {\n return this._interceptZS ?\n this._interceptZS.onIntercept(this._interceptDlgt, this._interceptCurrZone, targetZone, callback, source) :\n callback;\n };\n ZoneDelegate.prototype.invoke = function (targetZone, callback, applyThis, applyArgs, source) {\n return this._invokeZS ? this._invokeZS.onInvoke(this._invokeDlgt, this._invokeCurrZone, targetZone, callback, applyThis, applyArgs, source) :\n callback.apply(applyThis, applyArgs);\n };\n ZoneDelegate.prototype.handleError = function (targetZone, error) {\n return this._handleErrorZS ?\n this._handleErrorZS.onHandleError(this._handleErrorDlgt, this._handleErrorCurrZone, targetZone, error) :\n true;\n };\n ZoneDelegate.prototype.scheduleTask = function (targetZone, task) {\n var returnTask = task;\n if (this._scheduleTaskZS) {\n if (this._hasTaskZS) {\n returnTask._zoneDelegates.push(this._hasTaskDlgtOwner);\n }\n returnTask = this._scheduleTaskZS.onScheduleTask(this._scheduleTaskDlgt, this._scheduleTaskCurrZone, targetZone, task);\n if (!returnTask)\n returnTask = task;\n }\n else {\n if (task.scheduleFn) {\n task.scheduleFn(task);\n }\n else if (task.type == microTask) {\n scheduleMicroTask(task);\n }\n else {\n throw new Error('Task is missing scheduleFn.');\n }\n }\n return returnTask;\n };\n ZoneDelegate.prototype.invokeTask = function (targetZone, task, applyThis, applyArgs) {\n return this._invokeTaskZS ? this._invokeTaskZS.onInvokeTask(this._invokeTaskDlgt, this._invokeTaskCurrZone, targetZone, task, applyThis, applyArgs) :\n task.callback.apply(applyThis, applyArgs);\n };\n ZoneDelegate.prototype.cancelTask = function (targetZone, task) {\n var value;\n if (this._cancelTaskZS) {\n value = this._cancelTaskZS.onCancelTask(this._cancelTaskDlgt, this._cancelTaskCurrZone, targetZone, task);\n }\n else {\n if (!task.cancelFn) {\n throw Error('Task is not cancelable');\n }\n value = task.cancelFn(task);\n }\n return value;\n };\n ZoneDelegate.prototype.hasTask = function (targetZone, isEmpty) {\n // hasTask should not throw error so other ZoneDelegate\n // can still trigger hasTask callback\n try {\n this._hasTaskZS &&\n this._hasTaskZS.onHasTask(this._hasTaskDlgt, this._hasTaskCurrZone, targetZone, isEmpty);\n }\n catch (err) {\n this.handleError(targetZone, err);\n }\n };\n ZoneDelegate.prototype._updateTaskCount = function (type, count) {\n var counts = this._taskCounts;\n var prev = counts[type];\n var next = counts[type] = prev + count;\n if (next < 0) {\n throw new Error('More tasks executed then were scheduled.');\n }\n if (prev == 0 || next == 0) {\n var isEmpty = {\n microTask: counts['microTask'] > 0,\n macroTask: counts['macroTask'] > 0,\n eventTask: counts['eventTask'] > 0,\n change: type\n };\n this.hasTask(this.zone, isEmpty);\n }\n };\n return ZoneDelegate;\n }());\n var ZoneTask = /** @class */ (function () {\n function ZoneTask(type, source, callback, options, scheduleFn, cancelFn) {\n this._zone = null;\n this.runCount = 0;\n this._zoneDelegates = null;\n this._state = 'notScheduled';\n this.type = type;\n this.source = source;\n this.data = options;\n this.scheduleFn = scheduleFn;\n this.cancelFn = cancelFn;\n this.callback = callback;\n var self = this;\n // TODO: @JiaLiPassion options should have interface\n if (type === eventTask && options && options.useG) {\n this.invoke = ZoneTask.invokeTask;\n }\n else {\n this.invoke = function () {\n return ZoneTask.invokeTask.call(global, self, this, arguments);\n };\n }\n }\n ZoneTask.invokeTask = function (task, target, args) {\n if (!task) {\n task = this;\n }\n _numberOfNestedTaskFrames++;\n try {\n task.runCount++;\n return task.zone.runTask(task, target, args);\n }\n finally {\n if (_numberOfNestedTaskFrames == 1) {\n drainMicroTaskQueue();\n }\n _numberOfNestedTaskFrames--;\n }\n };\n Object.defineProperty(ZoneTask.prototype, \"zone\", {\n get: function () {\n return this._zone;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ZoneTask.prototype, \"state\", {\n get: function () {\n return this._state;\n },\n enumerable: true,\n configurable: true\n });\n ZoneTask.prototype.cancelScheduleRequest = function () {\n this._transitionTo(notScheduled, scheduling);\n };\n ZoneTask.prototype._transitionTo = function (toState, fromState1, fromState2) {\n if (this._state === fromState1 || this._state === fromState2) {\n this._state = toState;\n if (toState == notScheduled) {\n this._zoneDelegates = null;\n }\n }\n else {\n throw new Error(this.type + \" '\" + this.source + \"': can not transition to '\" + toState + \"', expecting state '\" + fromState1 + \"'\" + (fromState2 ? ' or \\'' + fromState2 + '\\'' : '') + \", was '\" + this._state + \"'.\");\n }\n };\n ZoneTask.prototype.toString = function () {\n if (this.data && typeof this.data.handleId !== 'undefined') {\n return this.data.handleId.toString();\n }\n else {\n return Object.prototype.toString.call(this);\n }\n };\n // add toJSON method to prevent cyclic error when\n // call JSON.stringify(zoneTask)\n ZoneTask.prototype.toJSON = function () {\n return {\n type: this.type,\n state: this.state,\n source: this.source,\n zone: this.zone.name,\n runCount: this.runCount\n };\n };\n return ZoneTask;\n }());\n //////////////////////////////////////////////////////\n //////////////////////////////////////////////////////\n /// MICROTASK QUEUE\n //////////////////////////////////////////////////////\n //////////////////////////////////////////////////////\n var symbolSetTimeout = __symbol__('setTimeout');\n var symbolPromise = __symbol__('Promise');\n var symbolThen = __symbol__('then');\n var _microTaskQueue = [];\n var _isDrainingMicrotaskQueue = false;\n var nativeMicroTaskQueuePromise;\n function scheduleMicroTask(task) {\n // if we are not running in any task, and there has not been anything scheduled\n // we must bootstrap the initial task creation by manually scheduling the drain\n if (_numberOfNestedTaskFrames === 0 && _microTaskQueue.length === 0) {\n // We are not running in Task, so we need to kickstart the microtask queue.\n if (!nativeMicroTaskQueuePromise) {\n if (global[symbolPromise]) {\n nativeMicroTaskQueuePromise = global[symbolPromise].resolve(0);\n }\n }\n if (nativeMicroTaskQueuePromise) {\n var nativeThen = nativeMicroTaskQueuePromise[symbolThen];\n if (!nativeThen) {\n // native Promise is not patchable, we need to use `then` directly\n // issue 1078\n nativeThen = nativeMicroTaskQueuePromise['then'];\n }\n nativeThen.call(nativeMicroTaskQueuePromise, drainMicroTaskQueue);\n }\n else {\n global[symbolSetTimeout](drainMicroTaskQueue, 0);\n }\n }\n task && _microTaskQueue.push(task);\n }\n function drainMicroTaskQueue() {\n if (!_isDrainingMicrotaskQueue) {\n _isDrainingMicrotaskQueue = true;\n while (_microTaskQueue.length) {\n var queue = _microTaskQueue;\n _microTaskQueue = [];\n for (var i = 0; i < queue.length; i++) {\n var task = queue[i];\n try {\n task.zone.runTask(task, null, null);\n }\n catch (error) {\n _api.onUnhandledError(error);\n }\n }\n }\n _api.microtaskDrainDone();\n _isDrainingMicrotaskQueue = false;\n }\n }\n //////////////////////////////////////////////////////\n //////////////////////////////////////////////////////\n /// BOOTSTRAP\n //////////////////////////////////////////////////////\n //////////////////////////////////////////////////////\n var NO_ZONE = { name: 'NO ZONE' };\n var notScheduled = 'notScheduled', scheduling = 'scheduling', scheduled = 'scheduled', running = 'running', canceling = 'canceling', unknown = 'unknown';\n var microTask = 'microTask', macroTask = 'macroTask', eventTask = 'eventTask';\n var patches = {};\n var _api = {\n symbol: __symbol__,\n currentZoneFrame: function () { return _currentZoneFrame; },\n onUnhandledError: noop,\n microtaskDrainDone: noop,\n scheduleMicroTask: scheduleMicroTask,\n showUncaughtError: function () { return !Zone[__symbol__('ignoreConsoleErrorUncaughtError')]; },\n patchEventTarget: function () { return []; },\n patchOnProperties: noop,\n patchMethod: function () { return noop; },\n bindArguments: function () { return []; },\n patchThen: function () { return noop; },\n setNativePromise: function (NativePromise) {\n // sometimes NativePromise.resolve static function\n // is not ready yet, (such as core-js/es6.promise)\n // so we need to check here.\n if (NativePromise && typeof NativePromise.resolve === 'function') {\n nativeMicroTaskQueuePromise = NativePromise.resolve(0);\n }\n },\n };\n var _currentZoneFrame = { parent: null, zone: new Zone(null, null) };\n var _currentTask = null;\n var _numberOfNestedTaskFrames = 0;\n function noop() { }\n function __symbol__(name) {\n return '__zone_symbol__' + name;\n }\n performanceMeasure('Zone', 'Zone');\n return global['Zone'] = Zone;\n})(typeof window !== 'undefined' && window || typeof self !== 'undefined' && self || global);\n\nvar __values = (undefined && undefined.__values) || function (o) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator], i = 0;\n if (m) return m.call(o);\n return {\n next: function () {\n if (o && i >= o.length) o = void 0;\n return { value: o && o[i++], done: !o };\n }\n };\n};\nZone.__load_patch('ZoneAwarePromise', function (global, Zone, api) {\n var ObjectGetOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;\n var ObjectDefineProperty = Object.defineProperty;\n function readableObjectToString(obj) {\n if (obj && obj.toString === Object.prototype.toString) {\n var className = obj.constructor && obj.constructor.name;\n return (className ? className : '') + ': ' + JSON.stringify(obj);\n }\n return obj ? obj.toString() : Object.prototype.toString.call(obj);\n }\n var __symbol__ = api.symbol;\n var _uncaughtPromiseErrors = [];\n var symbolPromise = __symbol__('Promise');\n var symbolThen = __symbol__('then');\n var creationTrace = '__creationTrace__';\n api.onUnhandledError = function (e) {\n if (api.showUncaughtError()) {\n var rejection = e && e.rejection;\n if (rejection) {\n console.error('Unhandled Promise rejection:', rejection instanceof Error ? rejection.message : rejection, '; Zone:', e.zone.name, '; Task:', e.task && e.task.source, '; Value:', rejection, rejection instanceof Error ? rejection.stack : undefined);\n }\n else {\n console.error(e);\n }\n }\n };\n api.microtaskDrainDone = function () {\n while (_uncaughtPromiseErrors.length) {\n var _loop_1 = function () {\n var uncaughtPromiseError = _uncaughtPromiseErrors.shift();\n try {\n uncaughtPromiseError.zone.runGuarded(function () {\n throw uncaughtPromiseError;\n });\n }\n catch (error) {\n handleUnhandledRejection(error);\n }\n };\n while (_uncaughtPromiseErrors.length) {\n _loop_1();\n }\n }\n };\n var UNHANDLED_PROMISE_REJECTION_HANDLER_SYMBOL = __symbol__('unhandledPromiseRejectionHandler');\n function handleUnhandledRejection(e) {\n api.onUnhandledError(e);\n try {\n var handler = Zone[UNHANDLED_PROMISE_REJECTION_HANDLER_SYMBOL];\n if (handler && typeof handler === 'function') {\n handler.call(this, e);\n }\n }\n catch (err) {\n }\n }\n function isThenable(value) {\n return value && value.then;\n }\n function forwardResolution(value) {\n return value;\n }\n function forwardRejection(rejection) {\n return ZoneAwarePromise.reject(rejection);\n }\n var symbolState = __symbol__('state');\n var symbolValue = __symbol__('value');\n var symbolFinally = __symbol__('finally');\n var symbolParentPromiseValue = __symbol__('parentPromiseValue');\n var symbolParentPromiseState = __symbol__('parentPromiseState');\n var source = 'Promise.then';\n var UNRESOLVED = null;\n var RESOLVED = true;\n var REJECTED = false;\n var REJECTED_NO_CATCH = 0;\n function makeResolver(promise, state) {\n return function (v) {\n try {\n resolvePromise(promise, state, v);\n }\n catch (err) {\n resolvePromise(promise, false, err);\n }\n // Do not return value or you will break the Promise spec.\n };\n }\n var once = function () {\n var wasCalled = false;\n return function wrapper(wrappedFunction) {\n return function () {\n if (wasCalled) {\n return;\n }\n wasCalled = true;\n wrappedFunction.apply(null, arguments);\n };\n };\n };\n var TYPE_ERROR = 'Promise resolved with itself';\n var CURRENT_TASK_TRACE_SYMBOL = __symbol__('currentTaskTrace');\n // Promise Resolution\n function resolvePromise(promise, state, value) {\n var onceWrapper = once();\n if (promise === value) {\n throw new TypeError(TYPE_ERROR);\n }\n if (promise[symbolState] === UNRESOLVED) {\n // should only get value.then once based on promise spec.\n var then = null;\n try {\n if (typeof value === 'object' || typeof value === 'function') {\n then = value && value.then;\n }\n }\n catch (err) {\n onceWrapper(function () {\n resolvePromise(promise, false, err);\n })();\n return promise;\n }\n // if (value instanceof ZoneAwarePromise) {\n if (state !== REJECTED && value instanceof ZoneAwarePromise &&\n value.hasOwnProperty(symbolState) && value.hasOwnProperty(symbolValue) &&\n value[symbolState] !== UNRESOLVED) {\n clearRejectedNoCatch(value);\n resolvePromise(promise, value[symbolState], value[symbolValue]);\n }\n else if (state !== REJECTED && typeof then === 'function') {\n try {\n then.call(value, onceWrapper(makeResolver(promise, state)), onceWrapper(makeResolver(promise, false)));\n }\n catch (err) {\n onceWrapper(function () {\n resolvePromise(promise, false, err);\n })();\n }\n }\n else {\n promise[symbolState] = state;\n var queue = promise[symbolValue];\n promise[symbolValue] = value;\n if (promise[symbolFinally] === symbolFinally) {\n // the promise is generated by Promise.prototype.finally\n if (state === RESOLVED) {\n // the state is resolved, should ignore the value\n // and use parent promise value\n promise[symbolState] = promise[symbolParentPromiseState];\n promise[symbolValue] = promise[symbolParentPromiseValue];\n }\n }\n // record task information in value when error occurs, so we can\n // do some additional work such as render longStackTrace\n if (state === REJECTED && value instanceof Error) {\n // check if longStackTraceZone is here\n var trace = Zone.currentTask && Zone.currentTask.data &&\n Zone.currentTask.data[creationTrace];\n if (trace) {\n // only keep the long stack trace into error when in longStackTraceZone\n ObjectDefineProperty(value, CURRENT_TASK_TRACE_SYMBOL, { configurable: true, enumerable: false, writable: true, value: trace });\n }\n }\n for (var i = 0; i < queue.length;) {\n scheduleResolveOrReject(promise, queue[i++], queue[i++], queue[i++], queue[i++]);\n }\n if (queue.length == 0 && state == REJECTED) {\n promise[symbolState] = REJECTED_NO_CATCH;\n try {\n // try to print more readable error log\n throw new Error('Uncaught (in promise): ' + readableObjectToString(value) +\n (value && value.stack ? '\\n' + value.stack : ''));\n }\n catch (err) {\n var error_1 = err;\n error_1.rejection = value;\n error_1.promise = promise;\n error_1.zone = Zone.current;\n error_1.task = Zone.currentTask;\n _uncaughtPromiseErrors.push(error_1);\n api.scheduleMicroTask(); // to make sure that it is running\n }\n }\n }\n }\n // Resolving an already resolved promise is a noop.\n return promise;\n }\n var REJECTION_HANDLED_HANDLER = __symbol__('rejectionHandledHandler');\n function clearRejectedNoCatch(promise) {\n if (promise[symbolState] === REJECTED_NO_CATCH) {\n // if the promise is rejected no catch status\n // and queue.length > 0, means there is a error handler\n // here to handle the rejected promise, we should trigger\n // windows.rejectionhandled eventHandler or nodejs rejectionHandled\n // eventHandler\n try {\n var handler = Zone[REJECTION_HANDLED_HANDLER];\n if (handler && typeof handler === 'function') {\n handler.call(this, { rejection: promise[symbolValue], promise: promise });\n }\n }\n catch (err) {\n }\n promise[symbolState] = REJECTED;\n for (var i = 0; i < _uncaughtPromiseErrors.length; i++) {\n if (promise === _uncaughtPromiseErrors[i].promise) {\n _uncaughtPromiseErrors.splice(i, 1);\n }\n }\n }\n }\n function scheduleResolveOrReject(promise, zone, chainPromise, onFulfilled, onRejected) {\n clearRejectedNoCatch(promise);\n var promiseState = promise[symbolState];\n var delegate = promiseState ?\n (typeof onFulfilled === 'function') ? onFulfilled : forwardResolution :\n (typeof onRejected === 'function') ? onRejected : forwardRejection;\n zone.scheduleMicroTask(source, function () {\n try {\n var parentPromiseValue = promise[symbolValue];\n var isFinallyPromise = chainPromise && symbolFinally === chainPromise[symbolFinally];\n if (isFinallyPromise) {\n // if the promise is generated from finally call, keep parent promise's state and value\n chainPromise[symbolParentPromiseValue] = parentPromiseValue;\n chainPromise[symbolParentPromiseState] = promiseState;\n }\n // should not pass value to finally callback\n var value = zone.run(delegate, undefined, isFinallyPromise && delegate !== forwardRejection && delegate !== forwardResolution ?\n [] :\n [parentPromiseValue]);\n resolvePromise(chainPromise, true, value);\n }\n catch (error) {\n // if error occurs, should always return this error\n resolvePromise(chainPromise, false, error);\n }\n }, chainPromise);\n }\n var ZONE_AWARE_PROMISE_TO_STRING = 'function ZoneAwarePromise() { [native code] }';\n var ZoneAwarePromise = /** @class */ (function () {\n function ZoneAwarePromise(executor) {\n var promise = this;\n if (!(promise instanceof ZoneAwarePromise)) {\n throw new Error('Must be an instanceof Promise.');\n }\n promise[symbolState] = UNRESOLVED;\n promise[symbolValue] = []; // queue;\n try {\n executor && executor(makeResolver(promise, RESOLVED), makeResolver(promise, REJECTED));\n }\n catch (error) {\n resolvePromise(promise, false, error);\n }\n }\n ZoneAwarePromise.toString = function () {\n return ZONE_AWARE_PROMISE_TO_STRING;\n };\n ZoneAwarePromise.resolve = function (value) {\n return resolvePromise(new this(null), RESOLVED, value);\n };\n ZoneAwarePromise.reject = function (error) {\n return resolvePromise(new this(null), REJECTED, error);\n };\n ZoneAwarePromise.race = function (values) {\n var e_1, _a;\n var resolve;\n var reject;\n var promise = new this(function (res, rej) {\n resolve = res;\n reject = rej;\n });\n function onResolve(value) {\n promise && (promise = null || resolve(value));\n }\n function onReject(error) {\n promise && (promise = null || reject(error));\n }\n try {\n for (var values_1 = __values(values), values_1_1 = values_1.next(); !values_1_1.done; values_1_1 = values_1.next()) {\n var value = values_1_1.value;\n if (!isThenable(value)) {\n value = this.resolve(value);\n }\n value.then(onResolve, onReject);\n }\n }\n catch (e_1_1) { e_1 = { error: e_1_1 }; }\n finally {\n try {\n if (values_1_1 && !values_1_1.done && (_a = values_1.return)) _a.call(values_1);\n }\n finally { if (e_1) throw e_1.error; }\n }\n return promise;\n };\n ZoneAwarePromise.all = function (values) {\n var e_2, _a;\n var resolve;\n var reject;\n var promise = new this(function (res, rej) {\n resolve = res;\n reject = rej;\n });\n // Start at 2 to prevent prematurely resolving if .then is called immediately.\n var unresolvedCount = 2;\n var valueIndex = 0;\n var resolvedValues = [];\n var _loop_2 = function (value) {\n if (!isThenable(value)) {\n value = this_1.resolve(value);\n }\n var curValueIndex = valueIndex;\n value.then(function (value) {\n resolvedValues[curValueIndex] = value;\n unresolvedCount--;\n if (unresolvedCount === 0) {\n resolve(resolvedValues);\n }\n }, reject);\n unresolvedCount++;\n valueIndex++;\n };\n var this_1 = this;\n try {\n for (var values_2 = __values(values), values_2_1 = values_2.next(); !values_2_1.done; values_2_1 = values_2.next()) {\n var value = values_2_1.value;\n _loop_2(value);\n }\n }\n catch (e_2_1) { e_2 = { error: e_2_1 }; }\n finally {\n try {\n if (values_2_1 && !values_2_1.done && (_a = values_2.return)) _a.call(values_2);\n }\n finally { if (e_2) throw e_2.error; }\n }\n // Make the unresolvedCount zero-based again.\n unresolvedCount -= 2;\n if (unresolvedCount === 0) {\n resolve(resolvedValues);\n }\n return promise;\n };\n ZoneAwarePromise.prototype.then = function (onFulfilled, onRejected) {\n var chainPromise = new this.constructor(null);\n var zone = Zone.current;\n if (this[symbolState] == UNRESOLVED) {\n this[symbolValue].push(zone, chainPromise, onFulfilled, onRejected);\n }\n else {\n scheduleResolveOrReject(this, zone, chainPromise, onFulfilled, onRejected);\n }\n return chainPromise;\n };\n ZoneAwarePromise.prototype.catch = function (onRejected) {\n return this.then(null, onRejected);\n };\n ZoneAwarePromise.prototype.finally = function (onFinally) {\n var chainPromise = new this.constructor(null);\n chainPromise[symbolFinally] = symbolFinally;\n var zone = Zone.current;\n if (this[symbolState] == UNRESOLVED) {\n this[symbolValue].push(zone, chainPromise, onFinally, onFinally);\n }\n else {\n scheduleResolveOrReject(this, zone, chainPromise, onFinally, onFinally);\n }\n return chainPromise;\n };\n return ZoneAwarePromise;\n }());\n // Protect against aggressive optimizers dropping seemingly unused properties.\n // E.g. Closure Compiler in advanced mode.\n ZoneAwarePromise['resolve'] = ZoneAwarePromise.resolve;\n ZoneAwarePromise['reject'] = ZoneAwarePromise.reject;\n ZoneAwarePromise['race'] = ZoneAwarePromise.race;\n ZoneAwarePromise['all'] = ZoneAwarePromise.all;\n var NativePromise = global[symbolPromise] = global['Promise'];\n var ZONE_AWARE_PROMISE = Zone.__symbol__('ZoneAwarePromise');\n var desc = ObjectGetOwnPropertyDescriptor(global, 'Promise');\n if (!desc || desc.configurable) {\n desc && delete desc.writable;\n desc && delete desc.value;\n if (!desc) {\n desc = { configurable: true, enumerable: true };\n }\n desc.get = function () {\n // if we already set ZoneAwarePromise, use patched one\n // otherwise return native one.\n return global[ZONE_AWARE_PROMISE] ? global[ZONE_AWARE_PROMISE] : global[symbolPromise];\n };\n desc.set = function (NewNativePromise) {\n if (NewNativePromise === ZoneAwarePromise) {\n // if the NewNativePromise is ZoneAwarePromise\n // save to global\n global[ZONE_AWARE_PROMISE] = NewNativePromise;\n }\n else {\n // if the NewNativePromise is not ZoneAwarePromise\n // for example: after load zone.js, some library just\n // set es6-promise to global, if we set it to global\n // directly, assertZonePatched will fail and angular\n // will not loaded, so we just set the NewNativePromise\n // to global[symbolPromise], so the result is just like\n // we load ES6 Promise before zone.js\n global[symbolPromise] = NewNativePromise;\n if (!NewNativePromise.prototype[symbolThen]) {\n patchThen(NewNativePromise);\n }\n api.setNativePromise(NewNativePromise);\n }\n };\n ObjectDefineProperty(global, 'Promise', desc);\n }\n global['Promise'] = ZoneAwarePromise;\n var symbolThenPatched = __symbol__('thenPatched');\n function patchThen(Ctor) {\n var proto = Ctor.prototype;\n var prop = ObjectGetOwnPropertyDescriptor(proto, 'then');\n if (prop && (prop.writable === false || !prop.configurable)) {\n // check Ctor.prototype.then propertyDescriptor is writable or not\n // in meteor env, writable is false, we should ignore such case\n return;\n }\n var originalThen = proto.then;\n // Keep a reference to the original method.\n proto[symbolThen] = originalThen;\n Ctor.prototype.then = function (onResolve, onReject) {\n var _this = this;\n var wrapped = new ZoneAwarePromise(function (resolve, reject) {\n originalThen.call(_this, resolve, reject);\n });\n return wrapped.then(onResolve, onReject);\n };\n Ctor[symbolThenPatched] = true;\n }\n api.patchThen = patchThen;\n if (NativePromise) {\n patchThen(NativePromise);\n }\n // This is not part of public API, but it is useful for tests, so we expose it.\n Promise[Zone.__symbol__('uncaughtPromiseErrors')] = _uncaughtPromiseErrors;\n return ZoneAwarePromise;\n});\n\n/**\n * @license\n * Copyright Google Inc. All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\nZone.__load_patch('fetch', function (global, Zone, api) {\n var fetch = global['fetch'];\n var ZoneAwarePromise = global.Promise;\n var symbolThenPatched = api.symbol('thenPatched');\n var fetchTaskScheduling = api.symbol('fetchTaskScheduling');\n var fetchTaskAborting = api.symbol('fetchTaskAborting');\n if (typeof fetch !== 'function') {\n return;\n }\n var OriginalAbortController = global['AbortController'];\n var supportAbort = typeof OriginalAbortController === 'function';\n var abortNative = null;\n if (supportAbort) {\n global['AbortController'] = function () {\n var abortController = new OriginalAbortController();\n var signal = abortController.signal;\n signal.abortController = abortController;\n return abortController;\n };\n abortNative = api.patchMethod(OriginalAbortController.prototype, 'abort', function (delegate) { return function (self, args) {\n if (self.task) {\n return self.task.zone.cancelTask(self.task);\n }\n return delegate.apply(self, args);\n }; });\n }\n var placeholder = function () { };\n global['fetch'] = function () {\n var _this = this;\n var args = Array.prototype.slice.call(arguments);\n var options = args.length > 1 ? args[1] : null;\n var signal = options && options.signal;\n return new Promise(function (res, rej) {\n var task = Zone.current.scheduleMacroTask('fetch', placeholder, args, function () {\n var fetchPromise;\n var zone = Zone.current;\n try {\n zone[fetchTaskScheduling] = true;\n fetchPromise = fetch.apply(_this, args);\n }\n catch (error) {\n rej(error);\n return;\n }\n finally {\n zone[fetchTaskScheduling] = false;\n }\n if (!(fetchPromise instanceof ZoneAwarePromise)) {\n var ctor = fetchPromise.constructor;\n if (!ctor[symbolThenPatched]) {\n api.patchThen(ctor);\n }\n }\n fetchPromise.then(function (resource) {\n if (task.state !== 'notScheduled') {\n task.invoke();\n }\n res(resource);\n }, function (error) {\n if (task.state !== 'notScheduled') {\n task.invoke();\n }\n rej(error);\n });\n }, function () {\n if (!supportAbort) {\n rej('No AbortController supported, can not cancel fetch');\n return;\n }\n if (signal && signal.abortController && !signal.aborted &&\n typeof signal.abortController.abort === 'function' && abortNative) {\n try {\n Zone.current[fetchTaskAborting] = true;\n abortNative.call(signal.abortController);\n }\n finally {\n Zone.current[fetchTaskAborting] = false;\n }\n }\n else {\n rej('cancel fetch need a AbortController.signal');\n }\n });\n if (signal && signal.abortController) {\n signal.abortController.task = task;\n }\n });\n };\n});\n\n/**\n * @license\n * Copyright Google Inc. All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n/**\n * Suppress closure compiler errors about unknown 'Zone' variable\n * @fileoverview\n * @suppress {undefinedVars,globalThis,missingRequire}\n */\n// issue #989, to reduce bundle size, use short name\n/** Object.getOwnPropertyDescriptor */\nvar ObjectGetOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;\n/** Object.defineProperty */\nvar ObjectDefineProperty = Object.defineProperty;\n/** Object.getPrototypeOf */\nvar ObjectGetPrototypeOf = Object.getPrototypeOf;\n/** Object.create */\nvar ObjectCreate = Object.create;\n/** Array.prototype.slice */\nvar ArraySlice = Array.prototype.slice;\n/** addEventListener string const */\nvar ADD_EVENT_LISTENER_STR = 'addEventListener';\n/** removeEventListener string const */\nvar REMOVE_EVENT_LISTENER_STR = 'removeEventListener';\n/** zoneSymbol addEventListener */\nvar ZONE_SYMBOL_ADD_EVENT_LISTENER = Zone.__symbol__(ADD_EVENT_LISTENER_STR);\n/** zoneSymbol removeEventListener */\nvar ZONE_SYMBOL_REMOVE_EVENT_LISTENER = Zone.__symbol__(REMOVE_EVENT_LISTENER_STR);\n/** true string const */\nvar TRUE_STR = 'true';\n/** false string const */\nvar FALSE_STR = 'false';\n/** __zone_symbol__ string const */\nvar ZONE_SYMBOL_PREFIX = '__zone_symbol__';\nfunction wrapWithCurrentZone(callback, source) {\n return Zone.current.wrap(callback, source);\n}\nfunction scheduleMacroTaskWithCurrentZone(source, callback, data, customSchedule, customCancel) {\n return Zone.current.scheduleMacroTask(source, callback, data, customSchedule, customCancel);\n}\nvar zoneSymbol = Zone.__symbol__;\nvar isWindowExists = typeof window !== 'undefined';\nvar internalWindow = isWindowExists ? window : undefined;\nvar _global = isWindowExists && internalWindow || typeof self === 'object' && self || global;\nvar REMOVE_ATTRIBUTE = 'removeAttribute';\nvar NULL_ON_PROP_VALUE = [null];\nfunction bindArguments(args, source) {\n for (var i = args.length - 1; i >= 0; i--) {\n if (typeof args[i] === 'function') {\n args[i] = wrapWithCurrentZone(args[i], source + '_' + i);\n }\n }\n return args;\n}\nfunction patchPrototype(prototype, fnNames) {\n var source = prototype.constructor['name'];\n var _loop_1 = function (i) {\n var name_1 = fnNames[i];\n var delegate = prototype[name_1];\n if (delegate) {\n var prototypeDesc = ObjectGetOwnPropertyDescriptor(prototype, name_1);\n if (!isPropertyWritable(prototypeDesc)) {\n return \"continue\";\n }\n prototype[name_1] = (function (delegate) {\n var patched = function () {\n return delegate.apply(this, bindArguments(arguments, source + '.' + name_1));\n };\n attachOriginToPatched(patched, delegate);\n return patched;\n })(delegate);\n }\n };\n for (var i = 0; i < fnNames.length; i++) {\n _loop_1(i);\n }\n}\nfunction isPropertyWritable(propertyDesc) {\n if (!propertyDesc) {\n return true;\n }\n if (propertyDesc.writable === false) {\n return false;\n }\n return !(typeof propertyDesc.get === 'function' && typeof propertyDesc.set === 'undefined');\n}\nvar isWebWorker = (typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope);\n// Make sure to access `process` through `_global` so that WebPack does not accidentally browserify\n// this code.\nvar isNode = (!('nw' in _global) && typeof _global.process !== 'undefined' &&\n {}.toString.call(_global.process) === '[object process]');\nvar isBrowser = !isNode && !isWebWorker && !!(isWindowExists && internalWindow['HTMLElement']);\n// we are in electron of nw, so we are both browser and nodejs\n// Make sure to access `process` through `_global` so that WebPack does not accidentally browserify\n// this code.\nvar isMix = typeof _global.process !== 'undefined' &&\n {}.toString.call(_global.process) === '[object process]' && !isWebWorker &&\n !!(isWindowExists && internalWindow['HTMLElement']);\nvar zoneSymbolEventNames = {};\nvar wrapFn = function (event) {\n // https://github.com/angular/zone.js/issues/911, in IE, sometimes\n // event will be undefined, so we need to use window.event\n event = event || _global.event;\n if (!event) {\n return;\n }\n var eventNameSymbol = zoneSymbolEventNames[event.type];\n if (!eventNameSymbol) {\n eventNameSymbol = zoneSymbolEventNames[event.type] = zoneSymbol('ON_PROPERTY' + event.type);\n }\n var target = this || event.target || _global;\n var listener = target[eventNameSymbol];\n var result;\n if (isBrowser && target === internalWindow && event.type === 'error') {\n // window.onerror have different signiture\n // https://developer.mozilla.org/en-US/docs/Web/API/GlobalEventHandlers/onerror#window.onerror\n // and onerror callback will prevent default when callback return true\n var errorEvent = event;\n result = listener &&\n listener.call(this, errorEvent.message, errorEvent.filename, errorEvent.lineno, errorEvent.colno, errorEvent.error);\n if (result === true) {\n event.preventDefault();\n }\n }\n else {\n result = listener && listener.apply(this, arguments);\n if (result != undefined && !result) {\n event.preventDefault();\n }\n }\n return result;\n};\nfunction patchProperty(obj, prop, prototype) {\n var desc = ObjectGetOwnPropertyDescriptor(obj, prop);\n if (!desc && prototype) {\n // when patch window object, use prototype to check prop exist or not\n var prototypeDesc = ObjectGetOwnPropertyDescriptor(prototype, prop);\n if (prototypeDesc) {\n desc = { enumerable: true, configurable: true };\n }\n }\n // if the descriptor not exists or is not configurable\n // just return\n if (!desc || !desc.configurable) {\n return;\n }\n var onPropPatchedSymbol = zoneSymbol('on' + prop + 'patched');\n if (obj.hasOwnProperty(onPropPatchedSymbol) && obj[onPropPatchedSymbol]) {\n return;\n }\n // A property descriptor cannot have getter/setter and be writable\n // deleting the writable and value properties avoids this error:\n //\n // TypeError: property descriptors must not specify a value or be writable when a\n // getter or setter has been specified\n delete desc.writable;\n delete desc.value;\n var originalDescGet = desc.get;\n var originalDescSet = desc.set;\n // substr(2) cuz 'onclick' -> 'click', etc\n var eventName = prop.substr(2);\n var eventNameSymbol = zoneSymbolEventNames[eventName];\n if (!eventNameSymbol) {\n eventNameSymbol = zoneSymbolEventNames[eventName] = zoneSymbol('ON_PROPERTY' + eventName);\n }\n desc.set = function (newValue) {\n // in some of windows's onproperty callback, this is undefined\n // so we need to check it\n var target = this;\n if (!target && obj === _global) {\n target = _global;\n }\n if (!target) {\n return;\n }\n var previousValue = target[eventNameSymbol];\n if (previousValue) {\n target.removeEventListener(eventName, wrapFn);\n }\n // issue #978, when onload handler was added before loading zone.js\n // we should remove it with originalDescSet\n if (originalDescSet) {\n originalDescSet.apply(target, NULL_ON_PROP_VALUE);\n }\n if (typeof newValue === 'function') {\n target[eventNameSymbol] = newValue;\n target.addEventListener(eventName, wrapFn, false);\n }\n else {\n target[eventNameSymbol] = null;\n }\n };\n // The getter would return undefined for unassigned properties but the default value of an\n // unassigned property is null\n desc.get = function () {\n // in some of windows's onproperty callback, this is undefined\n // so we need to check it\n var target = this;\n if (!target && obj === _global) {\n target = _global;\n }\n if (!target) {\n return null;\n }\n var listener = target[eventNameSymbol];\n if (listener) {\n return listener;\n }\n else if (originalDescGet) {\n // result will be null when use inline event attribute,\n // such as \n // because the onclick function is internal raw uncompiled handler\n // the onclick will be evaluated when first time event was triggered or\n // the property is accessed, https://github.com/angular/zone.js/issues/525\n // so we should use original native get to retrieve the handler\n var value = originalDescGet && originalDescGet.call(this);\n if (value) {\n desc.set.call(this, value);\n if (typeof target[REMOVE_ATTRIBUTE] === 'function') {\n target.removeAttribute(prop);\n }\n return value;\n }\n }\n return null;\n };\n ObjectDefineProperty(obj, prop, desc);\n obj[onPropPatchedSymbol] = true;\n}\nfunction patchOnProperties(obj, properties, prototype) {\n if (properties) {\n for (var i = 0; i < properties.length; i++) {\n patchProperty(obj, 'on' + properties[i], prototype);\n }\n }\n else {\n var onProperties = [];\n for (var prop in obj) {\n if (prop.substr(0, 2) == 'on') {\n onProperties.push(prop);\n }\n }\n for (var j = 0; j < onProperties.length; j++) {\n patchProperty(obj, onProperties[j], prototype);\n }\n }\n}\nvar originalInstanceKey = zoneSymbol('originalInstance');\n// wrap some native API on `window`\nfunction patchClass(className) {\n var OriginalClass = _global[className];\n if (!OriginalClass)\n return;\n // keep original class in global\n _global[zoneSymbol(className)] = OriginalClass;\n _global[className] = function () {\n var a = bindArguments(arguments, className);\n switch (a.length) {\n case 0:\n this[originalInstanceKey] = new OriginalClass();\n break;\n case 1:\n this[originalInstanceKey] = new OriginalClass(a[0]);\n break;\n case 2:\n this[originalInstanceKey] = new OriginalClass(a[0], a[1]);\n break;\n case 3:\n this[originalInstanceKey] = new OriginalClass(a[0], a[1], a[2]);\n break;\n case 4:\n this[originalInstanceKey] = new OriginalClass(a[0], a[1], a[2], a[3]);\n break;\n default:\n throw new Error('Arg list too long.');\n }\n };\n // attach original delegate to patched function\n attachOriginToPatched(_global[className], OriginalClass);\n var instance = new OriginalClass(function () { });\n var prop;\n for (prop in instance) {\n // https://bugs.webkit.org/show_bug.cgi?id=44721\n if (className === 'XMLHttpRequest' && prop === 'responseBlob')\n continue;\n (function (prop) {\n if (typeof instance[prop] === 'function') {\n _global[className].prototype[prop] = function () {\n return this[originalInstanceKey][prop].apply(this[originalInstanceKey], arguments);\n };\n }\n else {\n ObjectDefineProperty(_global[className].prototype, prop, {\n set: function (fn) {\n if (typeof fn === 'function') {\n this[originalInstanceKey][prop] = wrapWithCurrentZone(fn, className + '.' + prop);\n // keep callback in wrapped function so we can\n // use it in Function.prototype.toString to return\n // the native one.\n attachOriginToPatched(this[originalInstanceKey][prop], fn);\n }\n else {\n this[originalInstanceKey][prop] = fn;\n }\n },\n get: function () {\n return this[originalInstanceKey][prop];\n }\n });\n }\n }(prop));\n }\n for (prop in OriginalClass) {\n if (prop !== 'prototype' && OriginalClass.hasOwnProperty(prop)) {\n _global[className][prop] = OriginalClass[prop];\n }\n }\n}\nfunction copySymbolProperties(src, dest) {\n if (typeof Object.getOwnPropertySymbols !== 'function') {\n return;\n }\n var symbols = Object.getOwnPropertySymbols(src);\n symbols.forEach(function (symbol) {\n var desc = Object.getOwnPropertyDescriptor(src, symbol);\n Object.defineProperty(dest, symbol, {\n get: function () {\n return src[symbol];\n },\n set: function (value) {\n if (desc && (!desc.writable || typeof desc.set !== 'function')) {\n // if src[symbol] is not writable or not have a setter, just return\n return;\n }\n src[symbol] = value;\n },\n enumerable: desc ? desc.enumerable : true,\n configurable: desc ? desc.configurable : true\n });\n });\n}\nvar shouldCopySymbolProperties = false;\n\nfunction patchMethod(target, name, patchFn) {\n var proto = target;\n while (proto && !proto.hasOwnProperty(name)) {\n proto = ObjectGetPrototypeOf(proto);\n }\n if (!proto && target[name]) {\n // somehow we did not find it, but we can see it. This happens on IE for Window properties.\n proto = target;\n }\n var delegateName = zoneSymbol(name);\n var delegate = null;\n if (proto && !(delegate = proto[delegateName])) {\n delegate = proto[delegateName] = proto[name];\n // check whether proto[name] is writable\n // some property is readonly in safari, such as HtmlCanvasElement.prototype.toBlob\n var desc = proto && ObjectGetOwnPropertyDescriptor(proto, name);\n if (isPropertyWritable(desc)) {\n var patchDelegate_1 = patchFn(delegate, delegateName, name);\n proto[name] = function () {\n return patchDelegate_1(this, arguments);\n };\n attachOriginToPatched(proto[name], delegate);\n if (shouldCopySymbolProperties) {\n copySymbolProperties(delegate, proto[name]);\n }\n }\n }\n return delegate;\n}\n// TODO: @JiaLiPassion, support cancel task later if necessary\nfunction patchMacroTask(obj, funcName, metaCreator) {\n var setNative = null;\n function scheduleTask(task) {\n var data = task.data;\n data.args[data.cbIdx] = function () {\n task.invoke.apply(this, arguments);\n };\n setNative.apply(data.target, data.args);\n return task;\n }\n setNative = patchMethod(obj, funcName, function (delegate) { return function (self, args) {\n var meta = metaCreator(self, args);\n if (meta.cbIdx >= 0 && typeof args[meta.cbIdx] === 'function') {\n return scheduleMacroTaskWithCurrentZone(meta.name, args[meta.cbIdx], meta, scheduleTask);\n }\n else {\n // cause an error by calling it directly.\n return delegate.apply(self, args);\n }\n }; });\n}\n\nfunction attachOriginToPatched(patched, original) {\n patched[zoneSymbol('OriginalDelegate')] = original;\n}\nvar isDetectedIEOrEdge = false;\nvar ieOrEdge = false;\nfunction isIE() {\n try {\n var ua = internalWindow.navigator.userAgent;\n if (ua.indexOf('MSIE ') !== -1 || ua.indexOf('Trident/') !== -1) {\n return true;\n }\n }\n catch (error) {\n }\n return false;\n}\nfunction isIEOrEdge() {\n if (isDetectedIEOrEdge) {\n return ieOrEdge;\n }\n isDetectedIEOrEdge = true;\n try {\n var ua = internalWindow.navigator.userAgent;\n if (ua.indexOf('MSIE ') !== -1 || ua.indexOf('Trident/') !== -1 || ua.indexOf('Edge/') !== -1) {\n ieOrEdge = true;\n }\n return ieOrEdge;\n }\n catch (error) {\n }\n}\n\n/**\n * @license\n * Copyright Google Inc. All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n// override Function.prototype.toString to make zone.js patched function\n// look like native function\nZone.__load_patch('toString', function (global) {\n // patch Func.prototype.toString to let them look like native\n var originalFunctionToString = Function.prototype.toString;\n var ORIGINAL_DELEGATE_SYMBOL = zoneSymbol('OriginalDelegate');\n var PROMISE_SYMBOL = zoneSymbol('Promise');\n var ERROR_SYMBOL = zoneSymbol('Error');\n var newFunctionToString = function toString() {\n if (typeof this === 'function') {\n var originalDelegate = this[ORIGINAL_DELEGATE_SYMBOL];\n if (originalDelegate) {\n if (typeof originalDelegate === 'function') {\n return originalFunctionToString.apply(this[ORIGINAL_DELEGATE_SYMBOL], arguments);\n }\n else {\n return Object.prototype.toString.call(originalDelegate);\n }\n }\n if (this === Promise) {\n var nativePromise = global[PROMISE_SYMBOL];\n if (nativePromise) {\n return originalFunctionToString.apply(nativePromise, arguments);\n }\n }\n if (this === Error) {\n var nativeError = global[ERROR_SYMBOL];\n if (nativeError) {\n return originalFunctionToString.apply(nativeError, arguments);\n }\n }\n }\n return originalFunctionToString.apply(this, arguments);\n };\n newFunctionToString[ORIGINAL_DELEGATE_SYMBOL] = originalFunctionToString;\n Function.prototype.toString = newFunctionToString;\n // patch Object.prototype.toString to let them look like native\n var originalObjectToString = Object.prototype.toString;\n var PROMISE_OBJECT_TO_STRING = '[object Promise]';\n Object.prototype.toString = function () {\n if (this instanceof Promise) {\n return PROMISE_OBJECT_TO_STRING;\n }\n return originalObjectToString.apply(this, arguments);\n };\n});\n\n/**\n * @license\n * Copyright Google Inc. All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n/**\n * @fileoverview\n * @suppress {missingRequire}\n */\nvar passiveSupported = false;\nif (typeof window !== 'undefined') {\n try {\n var options = Object.defineProperty({}, 'passive', {\n get: function () {\n passiveSupported = true;\n }\n });\n window.addEventListener('test', options, options);\n window.removeEventListener('test', options, options);\n }\n catch (err) {\n passiveSupported = false;\n }\n}\n// an identifier to tell ZoneTask do not create a new invoke closure\nvar OPTIMIZED_ZONE_EVENT_TASK_DATA = {\n useG: true\n};\nvar zoneSymbolEventNames$1 = {};\nvar globalSources = {};\nvar EVENT_NAME_SYMBOL_REGX = /^__zone_symbol__(\\w+)(true|false)$/;\nvar IMMEDIATE_PROPAGATION_SYMBOL = ('__zone_symbol__propagationStopped');\nfunction patchEventTarget(_global, apis, patchOptions) {\n var ADD_EVENT_LISTENER = (patchOptions && patchOptions.add) || ADD_EVENT_LISTENER_STR;\n var REMOVE_EVENT_LISTENER = (patchOptions && patchOptions.rm) || REMOVE_EVENT_LISTENER_STR;\n var LISTENERS_EVENT_LISTENER = (patchOptions && patchOptions.listeners) || 'eventListeners';\n var REMOVE_ALL_LISTENERS_EVENT_LISTENER = (patchOptions && patchOptions.rmAll) || 'removeAllListeners';\n var zoneSymbolAddEventListener = zoneSymbol(ADD_EVENT_LISTENER);\n var ADD_EVENT_LISTENER_SOURCE = '.' + ADD_EVENT_LISTENER + ':';\n var PREPEND_EVENT_LISTENER = 'prependListener';\n var PREPEND_EVENT_LISTENER_SOURCE = '.' + PREPEND_EVENT_LISTENER + ':';\n var invokeTask = function (task, target, event) {\n // for better performance, check isRemoved which is set\n // by removeEventListener\n if (task.isRemoved) {\n return;\n }\n var delegate = task.callback;\n if (typeof delegate === 'object' && delegate.handleEvent) {\n // create the bind version of handleEvent when invoke\n task.callback = function (event) { return delegate.handleEvent(event); };\n task.originalDelegate = delegate;\n }\n // invoke static task.invoke\n task.invoke(task, target, [event]);\n var options = task.options;\n if (options && typeof options === 'object' && options.once) {\n // if options.once is true, after invoke once remove listener here\n // only browser need to do this, nodejs eventEmitter will cal removeListener\n // inside EventEmitter.once\n var delegate_1 = task.originalDelegate ? task.originalDelegate : task.callback;\n target[REMOVE_EVENT_LISTENER].call(target, event.type, delegate_1, options);\n }\n };\n // global shared zoneAwareCallback to handle all event callback with capture = false\n var globalZoneAwareCallback = function (event) {\n // https://github.com/angular/zone.js/issues/911, in IE, sometimes\n // event will be undefined, so we need to use window.event\n event = event || _global.event;\n if (!event) {\n return;\n }\n // event.target is needed for Samsung TV and SourceBuffer\n // || global is needed https://github.com/angular/zone.js/issues/190\n var target = this || event.target || _global;\n var tasks = target[zoneSymbolEventNames$1[event.type][FALSE_STR]];\n if (tasks) {\n // invoke all tasks which attached to current target with given event.type and capture = false\n // for performance concern, if task.length === 1, just invoke\n if (tasks.length === 1) {\n invokeTask(tasks[0], target, event);\n }\n else {\n // https://github.com/angular/zone.js/issues/836\n // copy the tasks array before invoke, to avoid\n // the callback will remove itself or other listener\n var copyTasks = tasks.slice();\n for (var i = 0; i < copyTasks.length; i++) {\n if (event && event[IMMEDIATE_PROPAGATION_SYMBOL] === true) {\n break;\n }\n invokeTask(copyTasks[i], target, event);\n }\n }\n }\n };\n // global shared zoneAwareCallback to handle all event callback with capture = true\n var globalZoneAwareCaptureCallback = function (event) {\n // https://github.com/angular/zone.js/issues/911, in IE, sometimes\n // event will be undefined, so we need to use window.event\n event = event || _global.event;\n if (!event) {\n return;\n }\n // event.target is needed for Samsung TV and SourceBuffer\n // || global is needed https://github.com/angular/zone.js/issues/190\n var target = this || event.target || _global;\n var tasks = target[zoneSymbolEventNames$1[event.type][TRUE_STR]];\n if (tasks) {\n // invoke all tasks which attached to current target with given event.type and capture = false\n // for performance concern, if task.length === 1, just invoke\n if (tasks.length === 1) {\n invokeTask(tasks[0], target, event);\n }\n else {\n // https://github.com/angular/zone.js/issues/836\n // copy the tasks array before invoke, to avoid\n // the callback will remove itself or other listener\n var copyTasks = tasks.slice();\n for (var i = 0; i < copyTasks.length; i++) {\n if (event && event[IMMEDIATE_PROPAGATION_SYMBOL] === true) {\n break;\n }\n invokeTask(copyTasks[i], target, event);\n }\n }\n }\n };\n function patchEventTargetMethods(obj, patchOptions) {\n if (!obj) {\n return false;\n }\n var useGlobalCallback = true;\n if (patchOptions && patchOptions.useG !== undefined) {\n useGlobalCallback = patchOptions.useG;\n }\n var validateHandler = patchOptions && patchOptions.vh;\n var checkDuplicate = true;\n if (patchOptions && patchOptions.chkDup !== undefined) {\n checkDuplicate = patchOptions.chkDup;\n }\n var returnTarget = false;\n if (patchOptions && patchOptions.rt !== undefined) {\n returnTarget = patchOptions.rt;\n }\n var proto = obj;\n while (proto && !proto.hasOwnProperty(ADD_EVENT_LISTENER)) {\n proto = ObjectGetPrototypeOf(proto);\n }\n if (!proto && obj[ADD_EVENT_LISTENER]) {\n // somehow we did not find it, but we can see it. This happens on IE for Window properties.\n proto = obj;\n }\n if (!proto) {\n return false;\n }\n if (proto[zoneSymbolAddEventListener]) {\n return false;\n }\n var eventNameToString = patchOptions && patchOptions.eventNameToString;\n // a shared global taskData to pass data for scheduleEventTask\n // so we do not need to create a new object just for pass some data\n var taskData = {};\n var nativeAddEventListener = proto[zoneSymbolAddEventListener] = proto[ADD_EVENT_LISTENER];\n var nativeRemoveEventListener = proto[zoneSymbol(REMOVE_EVENT_LISTENER)] =\n proto[REMOVE_EVENT_LISTENER];\n var nativeListeners = proto[zoneSymbol(LISTENERS_EVENT_LISTENER)] =\n proto[LISTENERS_EVENT_LISTENER];\n var nativeRemoveAllListeners = proto[zoneSymbol(REMOVE_ALL_LISTENERS_EVENT_LISTENER)] =\n proto[REMOVE_ALL_LISTENERS_EVENT_LISTENER];\n var nativePrependEventListener;\n if (patchOptions && patchOptions.prepend) {\n nativePrependEventListener = proto[zoneSymbol(patchOptions.prepend)] =\n proto[patchOptions.prepend];\n }\n function checkIsPassive(task) {\n if (!passiveSupported && typeof taskData.options !== 'boolean' &&\n typeof taskData.options !== 'undefined' && taskData.options !== null) {\n // options is a non-null non-undefined object\n // passive is not supported\n // don't pass options as object\n // just pass capture as a boolean\n task.options = !!taskData.options.capture;\n taskData.options = task.options;\n }\n }\n var customScheduleGlobal = function (task) {\n // if there is already a task for the eventName + capture,\n // just return, because we use the shared globalZoneAwareCallback here.\n if (taskData.isExisting) {\n return;\n }\n checkIsPassive(task);\n return nativeAddEventListener.call(taskData.target, taskData.eventName, taskData.capture ? globalZoneAwareCaptureCallback : globalZoneAwareCallback, taskData.options);\n };\n var customCancelGlobal = function (task) {\n // if task is not marked as isRemoved, this call is directly\n // from Zone.prototype.cancelTask, we should remove the task\n // from tasksList of target first\n if (!task.isRemoved) {\n var symbolEventNames = zoneSymbolEventNames$1[task.eventName];\n var symbolEventName = void 0;\n if (symbolEventNames) {\n symbolEventName = symbolEventNames[task.capture ? TRUE_STR : FALSE_STR];\n }\n var existingTasks = symbolEventName && task.target[symbolEventName];\n if (existingTasks) {\n for (var i = 0; i < existingTasks.length; i++) {\n var existingTask = existingTasks[i];\n if (existingTask === task) {\n existingTasks.splice(i, 1);\n // set isRemoved to data for faster invokeTask check\n task.isRemoved = true;\n if (existingTasks.length === 0) {\n // all tasks for the eventName + capture have gone,\n // remove globalZoneAwareCallback and remove the task cache from target\n task.allRemoved = true;\n task.target[symbolEventName] = null;\n }\n break;\n }\n }\n }\n }\n // if all tasks for the eventName + capture have gone,\n // we will really remove the global event callback,\n // if not, return\n if (!task.allRemoved) {\n return;\n }\n return nativeRemoveEventListener.call(task.target, task.eventName, task.capture ? globalZoneAwareCaptureCallback : globalZoneAwareCallback, task.options);\n };\n var customScheduleNonGlobal = function (task) {\n checkIsPassive(task);\n return nativeAddEventListener.call(taskData.target, taskData.eventName, task.invoke, taskData.options);\n };\n var customSchedulePrepend = function (task) {\n return nativePrependEventListener.call(taskData.target, taskData.eventName, task.invoke, taskData.options);\n };\n var customCancelNonGlobal = function (task) {\n return nativeRemoveEventListener.call(task.target, task.eventName, task.invoke, task.options);\n };\n var customSchedule = useGlobalCallback ? customScheduleGlobal : customScheduleNonGlobal;\n var customCancel = useGlobalCallback ? customCancelGlobal : customCancelNonGlobal;\n var compareTaskCallbackVsDelegate = function (task, delegate) {\n var typeOfDelegate = typeof delegate;\n return (typeOfDelegate === 'function' && task.callback === delegate) ||\n (typeOfDelegate === 'object' && task.originalDelegate === delegate);\n };\n var compare = (patchOptions && patchOptions.diff) ? patchOptions.diff : compareTaskCallbackVsDelegate;\n var blackListedEvents = Zone[Zone.__symbol__('BLACK_LISTED_EVENTS')];\n var makeAddListener = function (nativeListener, addSource, customScheduleFn, customCancelFn, returnTarget, prepend) {\n if (returnTarget === void 0) { returnTarget = false; }\n if (prepend === void 0) { prepend = false; }\n return function () {\n var target = this || _global;\n var eventName = arguments[0];\n var delegate = arguments[1];\n if (!delegate) {\n return nativeListener.apply(this, arguments);\n }\n if (isNode && eventName === 'uncaughtException') {\n // don't patch uncaughtException of nodejs to prevent endless loop\n return nativeListener.apply(this, arguments);\n }\n // don't create the bind delegate function for handleEvent\n // case here to improve addEventListener performance\n // we will create the bind delegate when invoke\n var isHandleEvent = false;\n if (typeof delegate !== 'function') {\n if (!delegate.handleEvent) {\n return nativeListener.apply(this, arguments);\n }\n isHandleEvent = true;\n }\n if (validateHandler && !validateHandler(nativeListener, delegate, target, arguments)) {\n return;\n }\n var options = arguments[2];\n if (blackListedEvents) {\n // check black list\n for (var i = 0; i < blackListedEvents.length; i++) {\n if (eventName === blackListedEvents[i]) {\n return nativeListener.apply(this, arguments);\n }\n }\n }\n var capture;\n var once = false;\n if (options === undefined) {\n capture = false;\n }\n else if (options === true) {\n capture = true;\n }\n else if (options === false) {\n capture = false;\n }\n else {\n capture = options ? !!options.capture : false;\n once = options ? !!options.once : false;\n }\n var zone = Zone.current;\n var symbolEventNames = zoneSymbolEventNames$1[eventName];\n var symbolEventName;\n if (!symbolEventNames) {\n // the code is duplicate, but I just want to get some better performance\n var falseEventName = (eventNameToString ? eventNameToString(eventName) : eventName) + FALSE_STR;\n var trueEventName = (eventNameToString ? eventNameToString(eventName) : eventName) + TRUE_STR;\n var symbol = ZONE_SYMBOL_PREFIX + falseEventName;\n var symbolCapture = ZONE_SYMBOL_PREFIX + trueEventName;\n zoneSymbolEventNames$1[eventName] = {};\n zoneSymbolEventNames$1[eventName][FALSE_STR] = symbol;\n zoneSymbolEventNames$1[eventName][TRUE_STR] = symbolCapture;\n symbolEventName = capture ? symbolCapture : symbol;\n }\n else {\n symbolEventName = symbolEventNames[capture ? TRUE_STR : FALSE_STR];\n }\n var existingTasks = target[symbolEventName];\n var isExisting = false;\n if (existingTasks) {\n // already have task registered\n isExisting = true;\n if (checkDuplicate) {\n for (var i = 0; i < existingTasks.length; i++) {\n if (compare(existingTasks[i], delegate)) {\n // same callback, same capture, same event name, just return\n return;\n }\n }\n }\n }\n else {\n existingTasks = target[symbolEventName] = [];\n }\n var source;\n var constructorName = target.constructor['name'];\n var targetSource = globalSources[constructorName];\n if (targetSource) {\n source = targetSource[eventName];\n }\n if (!source) {\n source = constructorName + addSource +\n (eventNameToString ? eventNameToString(eventName) : eventName);\n }\n // do not create a new object as task.data to pass those things\n // just use the global shared one\n taskData.options = options;\n if (once) {\n // if addEventListener with once options, we don't pass it to\n // native addEventListener, instead we keep the once setting\n // and handle ourselves.\n taskData.options.once = false;\n }\n taskData.target = target;\n taskData.capture = capture;\n taskData.eventName = eventName;\n taskData.isExisting = isExisting;\n var data = useGlobalCallback ? OPTIMIZED_ZONE_EVENT_TASK_DATA : undefined;\n // keep taskData into data to allow onScheduleEventTask to access the task information\n if (data) {\n data.taskData = taskData;\n }\n var task = zone.scheduleEventTask(source, delegate, data, customScheduleFn, customCancelFn);\n // should clear taskData.target to avoid memory leak\n // issue, https://github.com/angular/angular/issues/20442\n taskData.target = null;\n // need to clear up taskData because it is a global object\n if (data) {\n data.taskData = null;\n }\n // have to save those information to task in case\n // application may call task.zone.cancelTask() directly\n if (once) {\n options.once = true;\n }\n if (!(!passiveSupported && typeof task.options === 'boolean')) {\n // if not support passive, and we pass an option object\n // to addEventListener, we should save the options to task\n task.options = options;\n }\n task.target = target;\n task.capture = capture;\n task.eventName = eventName;\n if (isHandleEvent) {\n // save original delegate for compare to check duplicate\n task.originalDelegate = delegate;\n }\n if (!prepend) {\n existingTasks.push(task);\n }\n else {\n existingTasks.unshift(task);\n }\n if (returnTarget) {\n return target;\n }\n };\n };\n proto[ADD_EVENT_LISTENER] = makeAddListener(nativeAddEventListener, ADD_EVENT_LISTENER_SOURCE, customSchedule, customCancel, returnTarget);\n if (nativePrependEventListener) {\n proto[PREPEND_EVENT_LISTENER] = makeAddListener(nativePrependEventListener, PREPEND_EVENT_LISTENER_SOURCE, customSchedulePrepend, customCancel, returnTarget, true);\n }\n proto[REMOVE_EVENT_LISTENER] = function () {\n var target = this || _global;\n var eventName = arguments[0];\n var options = arguments[2];\n var capture;\n if (options === undefined) {\n capture = false;\n }\n else if (options === true) {\n capture = true;\n }\n else if (options === false) {\n capture = false;\n }\n else {\n capture = options ? !!options.capture : false;\n }\n var delegate = arguments[1];\n if (!delegate) {\n return nativeRemoveEventListener.apply(this, arguments);\n }\n if (validateHandler &&\n !validateHandler(nativeRemoveEventListener, delegate, target, arguments)) {\n return;\n }\n var symbolEventNames = zoneSymbolEventNames$1[eventName];\n var symbolEventName;\n if (symbolEventNames) {\n symbolEventName = symbolEventNames[capture ? TRUE_STR : FALSE_STR];\n }\n var existingTasks = symbolEventName && target[symbolEventName];\n if (existingTasks) {\n for (var i = 0; i < existingTasks.length; i++) {\n var existingTask = existingTasks[i];\n if (compare(existingTask, delegate)) {\n existingTasks.splice(i, 1);\n // set isRemoved to data for faster invokeTask check\n existingTask.isRemoved = true;\n if (existingTasks.length === 0) {\n // all tasks for the eventName + capture have gone,\n // remove globalZoneAwareCallback and remove the task cache from target\n existingTask.allRemoved = true;\n target[symbolEventName] = null;\n }\n existingTask.zone.cancelTask(existingTask);\n if (returnTarget) {\n return target;\n }\n return;\n }\n }\n }\n // issue 930, didn't find the event name or callback\n // from zone kept existingTasks, the callback maybe\n // added outside of zone, we need to call native removeEventListener\n // to try to remove it.\n return nativeRemoveEventListener.apply(this, arguments);\n };\n proto[LISTENERS_EVENT_LISTENER] = function () {\n var target = this || _global;\n var eventName = arguments[0];\n var listeners = [];\n var tasks = findEventTasks(target, eventNameToString ? eventNameToString(eventName) : eventName);\n for (var i = 0; i < tasks.length; i++) {\n var task = tasks[i];\n var delegate = task.originalDelegate ? task.originalDelegate : task.callback;\n listeners.push(delegate);\n }\n return listeners;\n };\n proto[REMOVE_ALL_LISTENERS_EVENT_LISTENER] = function () {\n var target = this || _global;\n var eventName = arguments[0];\n if (!eventName) {\n var keys = Object.keys(target);\n for (var i = 0; i < keys.length; i++) {\n var prop = keys[i];\n var match = EVENT_NAME_SYMBOL_REGX.exec(prop);\n var evtName = match && match[1];\n // in nodejs EventEmitter, removeListener event is\n // used for monitoring the removeListener call,\n // so just keep removeListener eventListener until\n // all other eventListeners are removed\n if (evtName && evtName !== 'removeListener') {\n this[REMOVE_ALL_LISTENERS_EVENT_LISTENER].call(this, evtName);\n }\n }\n // remove removeListener listener finally\n this[REMOVE_ALL_LISTENERS_EVENT_LISTENER].call(this, 'removeListener');\n }\n else {\n var symbolEventNames = zoneSymbolEventNames$1[eventName];\n if (symbolEventNames) {\n var symbolEventName = symbolEventNames[FALSE_STR];\n var symbolCaptureEventName = symbolEventNames[TRUE_STR];\n var tasks = target[symbolEventName];\n var captureTasks = target[symbolCaptureEventName];\n if (tasks) {\n var removeTasks = tasks.slice();\n for (var i = 0; i < removeTasks.length; i++) {\n var task = removeTasks[i];\n var delegate = task.originalDelegate ? task.originalDelegate : task.callback;\n this[REMOVE_EVENT_LISTENER].call(this, eventName, delegate, task.options);\n }\n }\n if (captureTasks) {\n var removeTasks = captureTasks.slice();\n for (var i = 0; i < removeTasks.length; i++) {\n var task = removeTasks[i];\n var delegate = task.originalDelegate ? task.originalDelegate : task.callback;\n this[REMOVE_EVENT_LISTENER].call(this, eventName, delegate, task.options);\n }\n }\n }\n }\n if (returnTarget) {\n return this;\n }\n };\n // for native toString patch\n attachOriginToPatched(proto[ADD_EVENT_LISTENER], nativeAddEventListener);\n attachOriginToPatched(proto[REMOVE_EVENT_LISTENER], nativeRemoveEventListener);\n if (nativeRemoveAllListeners) {\n attachOriginToPatched(proto[REMOVE_ALL_LISTENERS_EVENT_LISTENER], nativeRemoveAllListeners);\n }\n if (nativeListeners) {\n attachOriginToPatched(proto[LISTENERS_EVENT_LISTENER], nativeListeners);\n }\n return true;\n }\n var results = [];\n for (var i = 0; i < apis.length; i++) {\n results[i] = patchEventTargetMethods(apis[i], patchOptions);\n }\n return results;\n}\nfunction findEventTasks(target, eventName) {\n var foundTasks = [];\n for (var prop in target) {\n var match = EVENT_NAME_SYMBOL_REGX.exec(prop);\n var evtName = match && match[1];\n if (evtName && (!eventName || evtName === eventName)) {\n var tasks = target[prop];\n if (tasks) {\n for (var i = 0; i < tasks.length; i++) {\n foundTasks.push(tasks[i]);\n }\n }\n }\n }\n return foundTasks;\n}\nfunction patchEventPrototype(global, api) {\n var Event = global['Event'];\n if (Event && Event.prototype) {\n api.patchMethod(Event.prototype, 'stopImmediatePropagation', function (delegate) { return function (self, args) {\n self[IMMEDIATE_PROPAGATION_SYMBOL] = true;\n // we need to call the native stopImmediatePropagation\n // in case in some hybrid application, some part of\n // application will be controlled by zone, some are not\n delegate && delegate.apply(self, args);\n }; });\n }\n}\n\n/**\n * @license\n * Copyright Google Inc. All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n/**\n * @fileoverview\n * @suppress {missingRequire}\n */\nvar taskSymbol = zoneSymbol('zoneTask');\nfunction patchTimer(window, setName, cancelName, nameSuffix) {\n var setNative = null;\n var clearNative = null;\n setName += nameSuffix;\n cancelName += nameSuffix;\n var tasksByHandleId = {};\n function scheduleTask(task) {\n var data = task.data;\n function timer() {\n try {\n task.invoke.apply(this, arguments);\n }\n finally {\n // issue-934, task will be cancelled\n // even it is a periodic task such as\n // setInterval\n if (!(task.data && task.data.isPeriodic)) {\n if (typeof data.handleId === 'number') {\n // in non-nodejs env, we remove timerId\n // from local cache\n delete tasksByHandleId[data.handleId];\n }\n else if (data.handleId) {\n // Node returns complex objects as handleIds\n // we remove task reference from timer object\n data.handleId[taskSymbol] = null;\n }\n }\n }\n }\n data.args[0] = timer;\n data.handleId = setNative.apply(window, data.args);\n return task;\n }\n function clearTask(task) {\n return clearNative(task.data.handleId);\n }\n setNative =\n patchMethod(window, setName, function (delegate) { return function (self, args) {\n if (typeof args[0] === 'function') {\n var options = {\n isPeriodic: nameSuffix === 'Interval',\n delay: (nameSuffix === 'Timeout' || nameSuffix === 'Interval') ? args[1] || 0 :\n undefined,\n args: args\n };\n var task = scheduleMacroTaskWithCurrentZone(setName, args[0], options, scheduleTask, clearTask);\n if (!task) {\n return task;\n }\n // Node.js must additionally support the ref and unref functions.\n var handle = task.data.handleId;\n if (typeof handle === 'number') {\n // for non nodejs env, we save handleId: task\n // mapping in local cache for clearTimeout\n tasksByHandleId[handle] = task;\n }\n else if (handle) {\n // for nodejs env, we save task\n // reference in timerId Object for clearTimeout\n handle[taskSymbol] = task;\n }\n // check whether handle is null, because some polyfill or browser\n // may return undefined from setTimeout/setInterval/setImmediate/requestAnimationFrame\n if (handle && handle.ref && handle.unref && typeof handle.ref === 'function' &&\n typeof handle.unref === 'function') {\n task.ref = handle.ref.bind(handle);\n task.unref = handle.unref.bind(handle);\n }\n if (typeof handle === 'number' || handle) {\n return handle;\n }\n return task;\n }\n else {\n // cause an error by calling it directly.\n return delegate.apply(window, args);\n }\n }; });\n clearNative =\n patchMethod(window, cancelName, function (delegate) { return function (self, args) {\n var id = args[0];\n var task;\n if (typeof id === 'number') {\n // non nodejs env.\n task = tasksByHandleId[id];\n }\n else {\n // nodejs env.\n task = id && id[taskSymbol];\n // other environments.\n if (!task) {\n task = id;\n }\n }\n if (task && typeof task.type === 'string') {\n if (task.state !== 'notScheduled' &&\n (task.cancelFn && task.data.isPeriodic || task.runCount === 0)) {\n if (typeof id === 'number') {\n delete tasksByHandleId[id];\n }\n else if (id) {\n id[taskSymbol] = null;\n }\n // Do not cancel already canceled functions\n task.zone.cancelTask(task);\n }\n }\n else {\n // cause an error by calling it directly.\n delegate.apply(window, args);\n }\n }; });\n}\n\n/**\n * @license\n * Copyright Google Inc. All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n/*\n * This is necessary for Chrome and Chrome mobile, to enable\n * things like redefining `createdCallback` on an element.\n */\nvar _defineProperty = Object[zoneSymbol('defineProperty')] = Object.defineProperty;\nvar _getOwnPropertyDescriptor = Object[zoneSymbol('getOwnPropertyDescriptor')] =\n Object.getOwnPropertyDescriptor;\nvar _create = Object.create;\nvar unconfigurablesKey = zoneSymbol('unconfigurables');\nfunction propertyPatch() {\n Object.defineProperty = function (obj, prop, desc) {\n if (isUnconfigurable(obj, prop)) {\n throw new TypeError('Cannot assign to read only property \\'' + prop + '\\' of ' + obj);\n }\n var originalConfigurableFlag = desc.configurable;\n if (prop !== 'prototype') {\n desc = rewriteDescriptor(obj, prop, desc);\n }\n return _tryDefineProperty(obj, prop, desc, originalConfigurableFlag);\n };\n Object.defineProperties = function (obj, props) {\n Object.keys(props).forEach(function (prop) {\n Object.defineProperty(obj, prop, props[prop]);\n });\n return obj;\n };\n Object.create = function (obj, proto) {\n if (typeof proto === 'object' && !Object.isFrozen(proto)) {\n Object.keys(proto).forEach(function (prop) {\n proto[prop] = rewriteDescriptor(obj, prop, proto[prop]);\n });\n }\n return _create(obj, proto);\n };\n Object.getOwnPropertyDescriptor = function (obj, prop) {\n var desc = _getOwnPropertyDescriptor(obj, prop);\n if (desc && isUnconfigurable(obj, prop)) {\n desc.configurable = false;\n }\n return desc;\n };\n}\nfunction _redefineProperty(obj, prop, desc) {\n var originalConfigurableFlag = desc.configurable;\n desc = rewriteDescriptor(obj, prop, desc);\n return _tryDefineProperty(obj, prop, desc, originalConfigurableFlag);\n}\nfunction isUnconfigurable(obj, prop) {\n return obj && obj[unconfigurablesKey] && obj[unconfigurablesKey][prop];\n}\nfunction rewriteDescriptor(obj, prop, desc) {\n // issue-927, if the desc is frozen, don't try to change the desc\n if (!Object.isFrozen(desc)) {\n desc.configurable = true;\n }\n if (!desc.configurable) {\n // issue-927, if the obj is frozen, don't try to set the desc to obj\n if (!obj[unconfigurablesKey] && !Object.isFrozen(obj)) {\n _defineProperty(obj, unconfigurablesKey, { writable: true, value: {} });\n }\n if (obj[unconfigurablesKey]) {\n obj[unconfigurablesKey][prop] = true;\n }\n }\n return desc;\n}\nfunction _tryDefineProperty(obj, prop, desc, originalConfigurableFlag) {\n try {\n return _defineProperty(obj, prop, desc);\n }\n catch (error) {\n if (desc.configurable) {\n // In case of errors, when the configurable flag was likely set by rewriteDescriptor(), let's\n // retry with the original flag value\n if (typeof originalConfigurableFlag == 'undefined') {\n delete desc.configurable;\n }\n else {\n desc.configurable = originalConfigurableFlag;\n }\n try {\n return _defineProperty(obj, prop, desc);\n }\n catch (error) {\n var descJson = null;\n try {\n descJson = JSON.stringify(desc);\n }\n catch (error) {\n descJson = desc.toString();\n }\n console.log(\"Attempting to configure '\" + prop + \"' with descriptor '\" + descJson + \"' on object '\" + obj + \"' and got error, giving up: \" + error);\n }\n }\n else {\n throw error;\n }\n }\n}\n\n/**\n * @license\n * Copyright Google Inc. All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n// we have to patch the instance since the proto is non-configurable\nfunction apply(api, _global) {\n var WS = _global.WebSocket;\n // On Safari window.EventTarget doesn't exist so need to patch WS add/removeEventListener\n // On older Chrome, no need since EventTarget was already patched\n if (!_global.EventTarget) {\n patchEventTarget(_global, [WS.prototype]);\n }\n _global.WebSocket = function (x, y) {\n var socket = arguments.length > 1 ? new WS(x, y) : new WS(x);\n var proxySocket;\n var proxySocketProto;\n // Safari 7.0 has non-configurable own 'onmessage' and friends properties on the socket instance\n var onmessageDesc = ObjectGetOwnPropertyDescriptor(socket, 'onmessage');\n if (onmessageDesc && onmessageDesc.configurable === false) {\n proxySocket = ObjectCreate(socket);\n // socket have own property descriptor 'onopen', 'onmessage', 'onclose', 'onerror'\n // but proxySocket not, so we will keep socket as prototype and pass it to\n // patchOnProperties method\n proxySocketProto = socket;\n [ADD_EVENT_LISTENER_STR, REMOVE_EVENT_LISTENER_STR, 'send', 'close'].forEach(function (propName) {\n proxySocket[propName] = function () {\n var args = ArraySlice.call(arguments);\n if (propName === ADD_EVENT_LISTENER_STR || propName === REMOVE_EVENT_LISTENER_STR) {\n var eventName = args.length > 0 ? args[0] : undefined;\n if (eventName) {\n var propertySymbol = Zone.__symbol__('ON_PROPERTY' + eventName);\n socket[propertySymbol] = proxySocket[propertySymbol];\n }\n }\n return socket[propName].apply(socket, args);\n };\n });\n }\n else {\n // we can patch the real socket\n proxySocket = socket;\n }\n patchOnProperties(proxySocket, ['close', 'error', 'message', 'open'], proxySocketProto);\n return proxySocket;\n };\n var globalWebSocket = _global['WebSocket'];\n for (var prop in WS) {\n globalWebSocket[prop] = WS[prop];\n }\n}\n\n/**\n * @license\n * Copyright Google Inc. All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n/**\n * @fileoverview\n * @suppress {globalThis}\n */\nvar globalEventHandlersEventNames = [\n 'abort',\n 'animationcancel',\n 'animationend',\n 'animationiteration',\n 'auxclick',\n 'beforeinput',\n 'blur',\n 'cancel',\n 'canplay',\n 'canplaythrough',\n 'change',\n 'compositionstart',\n 'compositionupdate',\n 'compositionend',\n 'cuechange',\n 'click',\n 'close',\n 'contextmenu',\n 'curechange',\n 'dblclick',\n 'drag',\n 'dragend',\n 'dragenter',\n 'dragexit',\n 'dragleave',\n 'dragover',\n 'drop',\n 'durationchange',\n 'emptied',\n 'ended',\n 'error',\n 'focus',\n 'focusin',\n 'focusout',\n 'gotpointercapture',\n 'input',\n 'invalid',\n 'keydown',\n 'keypress',\n 'keyup',\n 'load',\n 'loadstart',\n 'loadeddata',\n 'loadedmetadata',\n 'lostpointercapture',\n 'mousedown',\n 'mouseenter',\n 'mouseleave',\n 'mousemove',\n 'mouseout',\n 'mouseover',\n 'mouseup',\n 'mousewheel',\n 'orientationchange',\n 'pause',\n 'play',\n 'playing',\n 'pointercancel',\n 'pointerdown',\n 'pointerenter',\n 'pointerleave',\n 'pointerlockchange',\n 'mozpointerlockchange',\n 'webkitpointerlockerchange',\n 'pointerlockerror',\n 'mozpointerlockerror',\n 'webkitpointerlockerror',\n 'pointermove',\n 'pointout',\n 'pointerover',\n 'pointerup',\n 'progress',\n 'ratechange',\n 'reset',\n 'resize',\n 'scroll',\n 'seeked',\n 'seeking',\n 'select',\n 'selectionchange',\n 'selectstart',\n 'show',\n 'sort',\n 'stalled',\n 'submit',\n 'suspend',\n 'timeupdate',\n 'volumechange',\n 'touchcancel',\n 'touchmove',\n 'touchstart',\n 'touchend',\n 'transitioncancel',\n 'transitionend',\n 'waiting',\n 'wheel'\n];\nvar documentEventNames = [\n 'afterscriptexecute', 'beforescriptexecute', 'DOMContentLoaded', 'freeze', 'fullscreenchange',\n 'mozfullscreenchange', 'webkitfullscreenchange', 'msfullscreenchange', 'fullscreenerror',\n 'mozfullscreenerror', 'webkitfullscreenerror', 'msfullscreenerror', 'readystatechange',\n 'visibilitychange', 'resume'\n];\nvar windowEventNames = [\n 'absolutedeviceorientation',\n 'afterinput',\n 'afterprint',\n 'appinstalled',\n 'beforeinstallprompt',\n 'beforeprint',\n 'beforeunload',\n 'devicelight',\n 'devicemotion',\n 'deviceorientation',\n 'deviceorientationabsolute',\n 'deviceproximity',\n 'hashchange',\n 'languagechange',\n 'message',\n 'mozbeforepaint',\n 'offline',\n 'online',\n 'paint',\n 'pageshow',\n 'pagehide',\n 'popstate',\n 'rejectionhandled',\n 'storage',\n 'unhandledrejection',\n 'unload',\n 'userproximity',\n 'vrdisplyconnected',\n 'vrdisplaydisconnected',\n 'vrdisplaypresentchange'\n];\nvar htmlElementEventNames = [\n 'beforecopy', 'beforecut', 'beforepaste', 'copy', 'cut', 'paste', 'dragstart', 'loadend',\n 'animationstart', 'search', 'transitionrun', 'transitionstart', 'webkitanimationend',\n 'webkitanimationiteration', 'webkitanimationstart', 'webkittransitionend'\n];\nvar mediaElementEventNames = ['encrypted', 'waitingforkey', 'msneedkey', 'mozinterruptbegin', 'mozinterruptend'];\nvar ieElementEventNames = [\n 'activate',\n 'afterupdate',\n 'ariarequest',\n 'beforeactivate',\n 'beforedeactivate',\n 'beforeeditfocus',\n 'beforeupdate',\n 'cellchange',\n 'controlselect',\n 'dataavailable',\n 'datasetchanged',\n 'datasetcomplete',\n 'errorupdate',\n 'filterchange',\n 'layoutcomplete',\n 'losecapture',\n 'move',\n 'moveend',\n 'movestart',\n 'propertychange',\n 'resizeend',\n 'resizestart',\n 'rowenter',\n 'rowexit',\n 'rowsdelete',\n 'rowsinserted',\n 'command',\n 'compassneedscalibration',\n 'deactivate',\n 'help',\n 'mscontentzoom',\n 'msmanipulationstatechanged',\n 'msgesturechange',\n 'msgesturedoubletap',\n 'msgestureend',\n 'msgesturehold',\n 'msgesturestart',\n 'msgesturetap',\n 'msgotpointercapture',\n 'msinertiastart',\n 'mslostpointercapture',\n 'mspointercancel',\n 'mspointerdown',\n 'mspointerenter',\n 'mspointerhover',\n 'mspointerleave',\n 'mspointermove',\n 'mspointerout',\n 'mspointerover',\n 'mspointerup',\n 'pointerout',\n 'mssitemodejumplistitemremoved',\n 'msthumbnailclick',\n 'stop',\n 'storagecommit'\n];\nvar webglEventNames = ['webglcontextrestored', 'webglcontextlost', 'webglcontextcreationerror'];\nvar formEventNames = ['autocomplete', 'autocompleteerror'];\nvar detailEventNames = ['toggle'];\nvar frameEventNames = ['load'];\nvar frameSetEventNames = ['blur', 'error', 'focus', 'load', 'resize', 'scroll', 'messageerror'];\nvar marqueeEventNames = ['bounce', 'finish', 'start'];\nvar XMLHttpRequestEventNames = [\n 'loadstart', 'progress', 'abort', 'error', 'load', 'progress', 'timeout', 'loadend',\n 'readystatechange'\n];\nvar IDBIndexEventNames = ['upgradeneeded', 'complete', 'abort', 'success', 'error', 'blocked', 'versionchange', 'close'];\nvar websocketEventNames = ['close', 'error', 'open', 'message'];\nvar workerEventNames = ['error', 'message'];\nvar eventNames = globalEventHandlersEventNames.concat(webglEventNames, formEventNames, detailEventNames, documentEventNames, windowEventNames, htmlElementEventNames, ieElementEventNames);\nfunction filterProperties(target, onProperties, ignoreProperties) {\n if (!ignoreProperties || ignoreProperties.length === 0) {\n return onProperties;\n }\n var tip = ignoreProperties.filter(function (ip) { return ip.target === target; });\n if (!tip || tip.length === 0) {\n return onProperties;\n }\n var targetIgnoreProperties = tip[0].ignoreProperties;\n return onProperties.filter(function (op) { return targetIgnoreProperties.indexOf(op) === -1; });\n}\nfunction patchFilteredProperties(target, onProperties, ignoreProperties, prototype) {\n // check whether target is available, sometimes target will be undefined\n // because different browser or some 3rd party plugin.\n if (!target) {\n return;\n }\n var filteredProperties = filterProperties(target, onProperties, ignoreProperties);\n patchOnProperties(target, filteredProperties, prototype);\n}\nfunction propertyDescriptorPatch(api, _global) {\n if (isNode && !isMix) {\n return;\n }\n var supportsWebSocket = typeof WebSocket !== 'undefined';\n if (canPatchViaPropertyDescriptor()) {\n var ignoreProperties = _global['__Zone_ignore_on_properties'];\n // for browsers that we can patch the descriptor: Chrome & Firefox\n if (isBrowser) {\n var internalWindow = window;\n var ignoreErrorProperties = isIE ? [{ target: internalWindow, ignoreProperties: ['error'] }] : [];\n // in IE/Edge, onProp not exist in window object, but in WindowPrototype\n // so we need to pass WindowPrototype to check onProp exist or not\n patchFilteredProperties(internalWindow, eventNames.concat(['messageerror']), ignoreProperties ? ignoreProperties.concat(ignoreErrorProperties) : ignoreProperties, ObjectGetPrototypeOf(internalWindow));\n patchFilteredProperties(Document.prototype, eventNames, ignoreProperties);\n if (typeof internalWindow['SVGElement'] !== 'undefined') {\n patchFilteredProperties(internalWindow['SVGElement'].prototype, eventNames, ignoreProperties);\n }\n patchFilteredProperties(Element.prototype, eventNames, ignoreProperties);\n patchFilteredProperties(HTMLElement.prototype, eventNames, ignoreProperties);\n patchFilteredProperties(HTMLMediaElement.prototype, mediaElementEventNames, ignoreProperties);\n patchFilteredProperties(HTMLFrameSetElement.prototype, windowEventNames.concat(frameSetEventNames), ignoreProperties);\n patchFilteredProperties(HTMLBodyElement.prototype, windowEventNames.concat(frameSetEventNames), ignoreProperties);\n patchFilteredProperties(HTMLFrameElement.prototype, frameEventNames, ignoreProperties);\n patchFilteredProperties(HTMLIFrameElement.prototype, frameEventNames, ignoreProperties);\n var HTMLMarqueeElement_1 = internalWindow['HTMLMarqueeElement'];\n if (HTMLMarqueeElement_1) {\n patchFilteredProperties(HTMLMarqueeElement_1.prototype, marqueeEventNames, ignoreProperties);\n }\n var Worker_1 = internalWindow['Worker'];\n if (Worker_1) {\n patchFilteredProperties(Worker_1.prototype, workerEventNames, ignoreProperties);\n }\n }\n patchFilteredProperties(XMLHttpRequest.prototype, XMLHttpRequestEventNames, ignoreProperties);\n var XMLHttpRequestEventTarget_1 = _global['XMLHttpRequestEventTarget'];\n if (XMLHttpRequestEventTarget_1) {\n patchFilteredProperties(XMLHttpRequestEventTarget_1 && XMLHttpRequestEventTarget_1.prototype, XMLHttpRequestEventNames, ignoreProperties);\n }\n if (typeof IDBIndex !== 'undefined') {\n patchFilteredProperties(IDBIndex.prototype, IDBIndexEventNames, ignoreProperties);\n patchFilteredProperties(IDBRequest.prototype, IDBIndexEventNames, ignoreProperties);\n patchFilteredProperties(IDBOpenDBRequest.prototype, IDBIndexEventNames, ignoreProperties);\n patchFilteredProperties(IDBDatabase.prototype, IDBIndexEventNames, ignoreProperties);\n patchFilteredProperties(IDBTransaction.prototype, IDBIndexEventNames, ignoreProperties);\n patchFilteredProperties(IDBCursor.prototype, IDBIndexEventNames, ignoreProperties);\n }\n if (supportsWebSocket) {\n patchFilteredProperties(WebSocket.prototype, websocketEventNames, ignoreProperties);\n }\n }\n else {\n // Safari, Android browsers (Jelly Bean)\n patchViaCapturingAllTheEvents();\n patchClass('XMLHttpRequest');\n if (supportsWebSocket) {\n apply(api, _global);\n }\n }\n}\nfunction canPatchViaPropertyDescriptor() {\n if ((isBrowser || isMix) && !ObjectGetOwnPropertyDescriptor(HTMLElement.prototype, 'onclick') &&\n typeof Element !== 'undefined') {\n // WebKit https://bugs.webkit.org/show_bug.cgi?id=134364\n // IDL interface attributes are not configurable\n var desc = ObjectGetOwnPropertyDescriptor(Element.prototype, 'onclick');\n if (desc && !desc.configurable)\n return false;\n }\n var ON_READY_STATE_CHANGE = 'onreadystatechange';\n var XMLHttpRequestPrototype = XMLHttpRequest.prototype;\n var xhrDesc = ObjectGetOwnPropertyDescriptor(XMLHttpRequestPrototype, ON_READY_STATE_CHANGE);\n // add enumerable and configurable here because in opera\n // by default XMLHttpRequest.prototype.onreadystatechange is undefined\n // without adding enumerable and configurable will cause onreadystatechange\n // non-configurable\n // and if XMLHttpRequest.prototype.onreadystatechange is undefined,\n // we should set a real desc instead a fake one\n if (xhrDesc) {\n ObjectDefineProperty(XMLHttpRequestPrototype, ON_READY_STATE_CHANGE, {\n enumerable: true,\n configurable: true,\n get: function () {\n return true;\n }\n });\n var req = new XMLHttpRequest();\n var result = !!req.onreadystatechange;\n // restore original desc\n ObjectDefineProperty(XMLHttpRequestPrototype, ON_READY_STATE_CHANGE, xhrDesc || {});\n return result;\n }\n else {\n var SYMBOL_FAKE_ONREADYSTATECHANGE_1 = zoneSymbol('fake');\n ObjectDefineProperty(XMLHttpRequestPrototype, ON_READY_STATE_CHANGE, {\n enumerable: true,\n configurable: true,\n get: function () {\n return this[SYMBOL_FAKE_ONREADYSTATECHANGE_1];\n },\n set: function (value) {\n this[SYMBOL_FAKE_ONREADYSTATECHANGE_1] = value;\n }\n });\n var req = new XMLHttpRequest();\n var detectFunc = function () { };\n req.onreadystatechange = detectFunc;\n var result = req[SYMBOL_FAKE_ONREADYSTATECHANGE_1] === detectFunc;\n req.onreadystatechange = null;\n return result;\n }\n}\nvar unboundKey = zoneSymbol('unbound');\n// Whenever any eventListener fires, we check the eventListener target and all parents\n// for `onwhatever` properties and replace them with zone-bound functions\n// - Chrome (for now)\nfunction patchViaCapturingAllTheEvents() {\n var _loop_1 = function (i) {\n var property = eventNames[i];\n var onproperty = 'on' + property;\n self.addEventListener(property, function (event) {\n var elt = event.target, bound, source;\n if (elt) {\n source = elt.constructor['name'] + '.' + onproperty;\n }\n else {\n source = 'unknown.' + onproperty;\n }\n while (elt) {\n if (elt[onproperty] && !elt[onproperty][unboundKey]) {\n bound = wrapWithCurrentZone(elt[onproperty], source);\n bound[unboundKey] = elt[onproperty];\n elt[onproperty] = bound;\n }\n elt = elt.parentElement;\n }\n }, true);\n };\n for (var i = 0; i < eventNames.length; i++) {\n _loop_1(i);\n }\n}\n\n/**\n * @license\n * Copyright Google Inc. All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\nfunction eventTargetPatch(_global, api) {\n var WTF_ISSUE_555 = 'Anchor,Area,Audio,BR,Base,BaseFont,Body,Button,Canvas,Content,DList,Directory,Div,Embed,FieldSet,Font,Form,Frame,FrameSet,HR,Head,Heading,Html,IFrame,Image,Input,Keygen,LI,Label,Legend,Link,Map,Marquee,Media,Menu,Meta,Meter,Mod,OList,Object,OptGroup,Option,Output,Paragraph,Pre,Progress,Quote,Script,Select,Source,Span,Style,TableCaption,TableCell,TableCol,Table,TableRow,TableSection,TextArea,Title,Track,UList,Unknown,Video';\n var NO_EVENT_TARGET = 'ApplicationCache,EventSource,FileReader,InputMethodContext,MediaController,MessagePort,Node,Performance,SVGElementInstance,SharedWorker,TextTrack,TextTrackCue,TextTrackList,WebKitNamedFlow,Window,Worker,WorkerGlobalScope,XMLHttpRequest,XMLHttpRequestEventTarget,XMLHttpRequestUpload,IDBRequest,IDBOpenDBRequest,IDBDatabase,IDBTransaction,IDBCursor,DBIndex,WebSocket'\n .split(',');\n var EVENT_TARGET = 'EventTarget';\n var apis = [];\n var isWtf = _global['wtf'];\n var WTF_ISSUE_555_ARRAY = WTF_ISSUE_555.split(',');\n if (isWtf) {\n // Workaround for: https://github.com/google/tracing-framework/issues/555\n apis = WTF_ISSUE_555_ARRAY.map(function (v) { return 'HTML' + v + 'Element'; }).concat(NO_EVENT_TARGET);\n }\n else if (_global[EVENT_TARGET]) {\n apis.push(EVENT_TARGET);\n }\n else {\n // Note: EventTarget is not available in all browsers,\n // if it's not available, we instead patch the APIs in the IDL that inherit from EventTarget\n apis = NO_EVENT_TARGET;\n }\n var isDisableIECheck = _global['__Zone_disable_IE_check'] || false;\n var isEnableCrossContextCheck = _global['__Zone_enable_cross_context_check'] || false;\n var ieOrEdge = isIEOrEdge();\n var ADD_EVENT_LISTENER_SOURCE = '.addEventListener:';\n var FUNCTION_WRAPPER = '[object FunctionWrapper]';\n var BROWSER_TOOLS = 'function __BROWSERTOOLS_CONSOLE_SAFEFUNC() { [native code] }';\n // predefine all __zone_symbol__ + eventName + true/false string\n for (var i = 0; i < eventNames.length; i++) {\n var eventName = eventNames[i];\n var falseEventName = eventName + FALSE_STR;\n var trueEventName = eventName + TRUE_STR;\n var symbol = ZONE_SYMBOL_PREFIX + falseEventName;\n var symbolCapture = ZONE_SYMBOL_PREFIX + trueEventName;\n zoneSymbolEventNames$1[eventName] = {};\n zoneSymbolEventNames$1[eventName][FALSE_STR] = symbol;\n zoneSymbolEventNames$1[eventName][TRUE_STR] = symbolCapture;\n }\n // predefine all task.source string\n for (var i = 0; i < WTF_ISSUE_555.length; i++) {\n var target = WTF_ISSUE_555_ARRAY[i];\n var targets = globalSources[target] = {};\n for (var j = 0; j < eventNames.length; j++) {\n var eventName = eventNames[j];\n targets[eventName] = target + ADD_EVENT_LISTENER_SOURCE + eventName;\n }\n }\n var checkIEAndCrossContext = function (nativeDelegate, delegate, target, args) {\n if (!isDisableIECheck && ieOrEdge) {\n if (isEnableCrossContextCheck) {\n try {\n var testString = delegate.toString();\n if ((testString === FUNCTION_WRAPPER || testString == BROWSER_TOOLS)) {\n nativeDelegate.apply(target, args);\n return false;\n }\n }\n catch (error) {\n nativeDelegate.apply(target, args);\n return false;\n }\n }\n else {\n var testString = delegate.toString();\n if ((testString === FUNCTION_WRAPPER || testString == BROWSER_TOOLS)) {\n nativeDelegate.apply(target, args);\n return false;\n }\n }\n }\n else if (isEnableCrossContextCheck) {\n try {\n delegate.toString();\n }\n catch (error) {\n nativeDelegate.apply(target, args);\n return false;\n }\n }\n return true;\n };\n var apiTypes = [];\n for (var i = 0; i < apis.length; i++) {\n var type = _global[apis[i]];\n apiTypes.push(type && type.prototype);\n }\n // vh is validateHandler to check event handler\n // is valid or not(for security check)\n patchEventTarget(_global, apiTypes, { vh: checkIEAndCrossContext });\n api.patchEventTarget = patchEventTarget;\n return true;\n}\nfunction patchEvent(global, api) {\n patchEventPrototype(global, api);\n}\n\n/**\n * @license\n * Copyright Google Inc. All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\nfunction patchCallbacks(target, targetName, method, callbacks) {\n var symbol = Zone.__symbol__(method);\n if (target[symbol]) {\n return;\n }\n var nativeDelegate = target[symbol] = target[method];\n target[method] = function (name, opts, options) {\n if (opts && opts.prototype) {\n callbacks.forEach(function (callback) {\n var source = targetName + \".\" + method + \"::\" + callback;\n var prototype = opts.prototype;\n if (prototype.hasOwnProperty(callback)) {\n var descriptor = ObjectGetOwnPropertyDescriptor(prototype, callback);\n if (descriptor && descriptor.value) {\n descriptor.value = wrapWithCurrentZone(descriptor.value, source);\n _redefineProperty(opts.prototype, callback, descriptor);\n }\n else if (prototype[callback]) {\n prototype[callback] = wrapWithCurrentZone(prototype[callback], source);\n }\n }\n else if (prototype[callback]) {\n prototype[callback] = wrapWithCurrentZone(prototype[callback], source);\n }\n });\n }\n return nativeDelegate.call(target, name, opts, options);\n };\n attachOriginToPatched(target[method], nativeDelegate);\n}\nfunction registerElementPatch(_global) {\n if ((!isBrowser && !isMix) || !('registerElement' in _global.document)) {\n return;\n }\n var callbacks = ['createdCallback', 'attachedCallback', 'detachedCallback', 'attributeChangedCallback'];\n patchCallbacks(document, 'Document', 'registerElement', callbacks);\n}\nfunction patchCustomElements(_global) {\n if ((!isBrowser && !isMix) || !('customElements' in _global)) {\n return;\n }\n var callbacks = ['connectedCallback', 'disconnectedCallback', 'adoptedCallback', 'attributeChangedCallback'];\n patchCallbacks(_global.customElements, 'customElements', 'define', callbacks);\n}\n\n/**\n * @license\n * Copyright Google Inc. All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n/**\n * @fileoverview\n * @suppress {missingRequire}\n */\nZone.__load_patch('util', function (global, Zone, api) {\n api.patchOnProperties = patchOnProperties;\n api.patchMethod = patchMethod;\n api.bindArguments = bindArguments;\n});\nZone.__load_patch('timers', function (global) {\n var set = 'set';\n var clear = 'clear';\n patchTimer(global, set, clear, 'Timeout');\n patchTimer(global, set, clear, 'Interval');\n patchTimer(global, set, clear, 'Immediate');\n});\nZone.__load_patch('requestAnimationFrame', function (global) {\n patchTimer(global, 'request', 'cancel', 'AnimationFrame');\n patchTimer(global, 'mozRequest', 'mozCancel', 'AnimationFrame');\n patchTimer(global, 'webkitRequest', 'webkitCancel', 'AnimationFrame');\n});\nZone.__load_patch('blocking', function (global, Zone) {\n var blockingMethods = ['alert', 'prompt', 'confirm'];\n for (var i = 0; i < blockingMethods.length; i++) {\n var name_1 = blockingMethods[i];\n patchMethod(global, name_1, function (delegate, symbol, name) {\n return function (s, args) {\n return Zone.current.run(delegate, global, args, name);\n };\n });\n }\n});\nZone.__load_patch('EventTarget', function (global, Zone, api) {\n // load blackListEvents from global\n var SYMBOL_BLACK_LISTED_EVENTS = Zone.__symbol__('BLACK_LISTED_EVENTS');\n if (global[SYMBOL_BLACK_LISTED_EVENTS]) {\n Zone[SYMBOL_BLACK_LISTED_EVENTS] = global[SYMBOL_BLACK_LISTED_EVENTS];\n }\n patchEvent(global, api);\n eventTargetPatch(global, api);\n // patch XMLHttpRequestEventTarget's addEventListener/removeEventListener\n var XMLHttpRequestEventTarget = global['XMLHttpRequestEventTarget'];\n if (XMLHttpRequestEventTarget && XMLHttpRequestEventTarget.prototype) {\n api.patchEventTarget(global, [XMLHttpRequestEventTarget.prototype]);\n }\n patchClass('MutationObserver');\n patchClass('WebKitMutationObserver');\n patchClass('IntersectionObserver');\n patchClass('FileReader');\n});\nZone.__load_patch('on_property', function (global, Zone, api) {\n propertyDescriptorPatch(api, global);\n propertyPatch();\n});\nZone.__load_patch('customElements', function (global, Zone, api) {\n registerElementPatch(global);\n patchCustomElements(global);\n});\nZone.__load_patch('canvas', function (global) {\n var HTMLCanvasElement = global['HTMLCanvasElement'];\n if (typeof HTMLCanvasElement !== 'undefined' && HTMLCanvasElement.prototype &&\n HTMLCanvasElement.prototype.toBlob) {\n patchMacroTask(HTMLCanvasElement.prototype, 'toBlob', function (self, args) {\n return { name: 'HTMLCanvasElement.toBlob', target: self, cbIdx: 0, args: args };\n });\n }\n});\nZone.__load_patch('XHR', function (global, Zone) {\n // Treat XMLHttpRequest as a macrotask.\n patchXHR(global);\n var XHR_TASK = zoneSymbol('xhrTask');\n var XHR_SYNC = zoneSymbol('xhrSync');\n var XHR_LISTENER = zoneSymbol('xhrListener');\n var XHR_SCHEDULED = zoneSymbol('xhrScheduled');\n var XHR_URL = zoneSymbol('xhrURL');\n var XHR_ERROR_BEFORE_SCHEDULED = zoneSymbol('xhrErrorBeforeScheduled');\n function patchXHR(window) {\n var XMLHttpRequestPrototype = XMLHttpRequest.prototype;\n function findPendingTask(target) {\n return target[XHR_TASK];\n }\n var oriAddListener = XMLHttpRequestPrototype[ZONE_SYMBOL_ADD_EVENT_LISTENER];\n var oriRemoveListener = XMLHttpRequestPrototype[ZONE_SYMBOL_REMOVE_EVENT_LISTENER];\n if (!oriAddListener) {\n var XMLHttpRequestEventTarget_1 = window['XMLHttpRequestEventTarget'];\n if (XMLHttpRequestEventTarget_1) {\n var XMLHttpRequestEventTargetPrototype = XMLHttpRequestEventTarget_1.prototype;\n oriAddListener = XMLHttpRequestEventTargetPrototype[ZONE_SYMBOL_ADD_EVENT_LISTENER];\n oriRemoveListener = XMLHttpRequestEventTargetPrototype[ZONE_SYMBOL_REMOVE_EVENT_LISTENER];\n }\n }\n var READY_STATE_CHANGE = 'readystatechange';\n var SCHEDULED = 'scheduled';\n function scheduleTask(task) {\n var data = task.data;\n var target = data.target;\n target[XHR_SCHEDULED] = false;\n target[XHR_ERROR_BEFORE_SCHEDULED] = false;\n // remove existing event listener\n var listener = target[XHR_LISTENER];\n if (!oriAddListener) {\n oriAddListener = target[ZONE_SYMBOL_ADD_EVENT_LISTENER];\n oriRemoveListener = target[ZONE_SYMBOL_REMOVE_EVENT_LISTENER];\n }\n if (listener) {\n oriRemoveListener.call(target, READY_STATE_CHANGE, listener);\n }\n var newListener = target[XHR_LISTENER] = function () {\n if (target.readyState === target.DONE) {\n // sometimes on some browsers XMLHttpRequest will fire onreadystatechange with\n // readyState=4 multiple times, so we need to check task state here\n if (!data.aborted && target[XHR_SCHEDULED] && task.state === SCHEDULED) {\n // check whether the xhr has registered onload listener\n // if that is the case, the task should invoke after all\n // onload listeners finish.\n var loadTasks = target['__zone_symbol__loadfalse'];\n if (loadTasks && loadTasks.length > 0) {\n var oriInvoke_1 = task.invoke;\n task.invoke = function () {\n // need to load the tasks again, because in other\n // load listener, they may remove themselves\n var loadTasks = target['__zone_symbol__loadfalse'];\n for (var i = 0; i < loadTasks.length; i++) {\n if (loadTasks[i] === task) {\n loadTasks.splice(i, 1);\n }\n }\n if (!data.aborted && task.state === SCHEDULED) {\n oriInvoke_1.call(task);\n }\n };\n loadTasks.push(task);\n }\n else {\n task.invoke();\n }\n }\n else if (!data.aborted && target[XHR_SCHEDULED] === false) {\n // error occurs when xhr.send()\n target[XHR_ERROR_BEFORE_SCHEDULED] = true;\n }\n }\n };\n oriAddListener.call(target, READY_STATE_CHANGE, newListener);\n var storedTask = target[XHR_TASK];\n if (!storedTask) {\n target[XHR_TASK] = task;\n }\n sendNative.apply(target, data.args);\n target[XHR_SCHEDULED] = true;\n return task;\n }\n function placeholderCallback() { }\n function clearTask(task) {\n var data = task.data;\n // Note - ideally, we would call data.target.removeEventListener here, but it's too late\n // to prevent it from firing. So instead, we store info for the event listener.\n data.aborted = true;\n return abortNative.apply(data.target, data.args);\n }\n var openNative = patchMethod(XMLHttpRequestPrototype, 'open', function () { return function (self, args) {\n self[XHR_SYNC] = args[2] == false;\n self[XHR_URL] = args[1];\n return openNative.apply(self, args);\n }; });\n var XMLHTTPREQUEST_SOURCE = 'XMLHttpRequest.send';\n var fetchTaskAborting = zoneSymbol('fetchTaskAborting');\n var fetchTaskScheduling = zoneSymbol('fetchTaskScheduling');\n var sendNative = patchMethod(XMLHttpRequestPrototype, 'send', function () { return function (self, args) {\n if (Zone.current[fetchTaskScheduling] === true) {\n // a fetch is scheduling, so we are using xhr to polyfill fetch\n // and because we already schedule macroTask for fetch, we should\n // not schedule a macroTask for xhr again\n return sendNative.apply(self, args);\n }\n if (self[XHR_SYNC]) {\n // if the XHR is sync there is no task to schedule, just execute the code.\n return sendNative.apply(self, args);\n }\n else {\n var options = { target: self, url: self[XHR_URL], isPeriodic: false, args: args, aborted: false };\n var task = scheduleMacroTaskWithCurrentZone(XMLHTTPREQUEST_SOURCE, placeholderCallback, options, scheduleTask, clearTask);\n if (self && self[XHR_ERROR_BEFORE_SCHEDULED] === true && !options.aborted &&\n task.state === SCHEDULED) {\n // xhr request throw error when send\n // we should invoke task instead of leaving a scheduled\n // pending macroTask\n task.invoke();\n }\n }\n }; });\n var abortNative = patchMethod(XMLHttpRequestPrototype, 'abort', function () { return function (self, args) {\n var task = findPendingTask(self);\n if (task && typeof task.type == 'string') {\n // If the XHR has already completed, do nothing.\n // If the XHR has already been aborted, do nothing.\n // Fix #569, call abort multiple times before done will cause\n // macroTask task count be negative number\n if (task.cancelFn == null || (task.data && task.data.aborted)) {\n return;\n }\n task.zone.cancelTask(task);\n }\n else if (Zone.current[fetchTaskAborting] === true) {\n // the abort is called from fetch polyfill, we need to call native abort of XHR.\n return abortNative.apply(self, args);\n }\n // Otherwise, we are trying to abort an XHR which has not yet been sent, so there is no\n // task\n // to cancel. Do nothing.\n }; });\n }\n});\nZone.__load_patch('geolocation', function (global) {\n /// GEO_LOCATION\n if (global['navigator'] && global['navigator'].geolocation) {\n patchPrototype(global['navigator'].geolocation, ['getCurrentPosition', 'watchPosition']);\n }\n});\nZone.__load_patch('PromiseRejectionEvent', function (global, Zone) {\n // handle unhandled promise rejection\n function findPromiseRejectionHandler(evtName) {\n return function (e) {\n var eventTasks = findEventTasks(global, evtName);\n eventTasks.forEach(function (eventTask) {\n // windows has added unhandledrejection event listener\n // trigger the event listener\n var PromiseRejectionEvent = global['PromiseRejectionEvent'];\n if (PromiseRejectionEvent) {\n var evt = new PromiseRejectionEvent(evtName, { promise: e.promise, reason: e.rejection });\n eventTask.invoke(evt);\n }\n });\n };\n }\n if (global['PromiseRejectionEvent']) {\n Zone[zoneSymbol('unhandledPromiseRejectionHandler')] =\n findPromiseRejectionHandler('unhandledrejection');\n Zone[zoneSymbol('rejectionHandledHandler')] =\n findPromiseRejectionHandler('rejectionhandled');\n }\n});\n\n/**\n * @license\n * Copyright Google Inc. All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\n})));\n","/**\n * This file includes polyfills needed by Angular and is loaded before the app.\n * You can add your own extra polyfills to this file.\n *\n * This file is divided into 2 sections:\n * 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers.\n * 2. Application imports. Files imported after ZoneJS that should be loaded before your main\n * file.\n *\n * The current setup is for so-called \"evergreen\" browsers; the last versions of browsers that\n * automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera),\n * Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile.\n *\n * Learn more in https://angular.io/docs/ts/latest/guide/browser-support.html\n */\n\n/***************************************************************************************************\n * BROWSER POLYFILLS\n */\n\n/** IE9, IE10 and IE11 requires all of the following polyfills. **/\n// import 'core-js/es6/symbol';\n// import 'core-js/es6/object';\n// import 'core-js/es6/function';\n// import 'core-js/es6/parse-int';\n// import 'core-js/es6/parse-float';\n// import 'core-js/es6/number';\n// import 'core-js/es6/math';\n// import 'core-js/es6/string';\n// import 'core-js/es6/date';\n// import 'core-js/es6/array';\n// import 'core-js/es6/regexp';\n// import 'core-js/es6/map';\n// import 'core-js/es6/weak-map';\n// import 'core-js/es6/set';\n\n/** IE10 and IE11 requires the following for NgClass support on SVG elements */\n// import 'classlist.js'; // Run `npm install --save classlist.js`.\n\n/** IE10 and IE11 requires the following for the Reflect API. */\n// import 'core-js/es6/reflect';\n\n\n/** Evergreen browsers require these. **/\n// Used for reflect-metadata in JIT. If you use AOT (and only Angular decorators), you can remove.\nimport 'core-js/es7/reflect';\n\n\n/**\n * Web Animations `@angular/platform-browser/animations`\n * Only required if AnimationBuilder is used within the application and using IE/Edge or Safari.\n * Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0).\n **/\n// import 'web-animations-js'; // Run `npm install --save web-animations-js`.\n\n/**\n * By default, zone.js will patch all possible macroTask and DomEvents\n * user can disable parts of macroTask/DomEvents patch by setting following flags\n */\n\n // (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame\n // (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick\n // (window as any).__zone_symbol__BLACK_LISTED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames\n\n /*\n * in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js\n * with the following flag, it will bypass `zone.js` patch for IE/Edge\n */\n// (window as any).__Zone_enable_cross_context_check = true;\n\n/***************************************************************************************************\n * Zone JS is required by default for Angular itself.\n */\nimport 'zone.js/dist/zone'; // Included with Angular CLI.\n\n\n\n/***************************************************************************************************\n * APPLICATION IMPORTS\n */\n"],"sourceRoot":""} \ No newline at end of file diff --git a/ready2use/runtime.js b/ready2use/runtime.js new file mode 100644 index 0000000..fd2c03c --- /dev/null +++ b/ready2use/runtime.js @@ -0,0 +1,154 @@ +/******/ (function(modules) { // webpackBootstrap +/******/ // install a JSONP callback for chunk loading +/******/ function webpackJsonpCallback(data) { +/******/ var chunkIds = data[0]; +/******/ var moreModules = data[1]; +/******/ var executeModules = data[2]; +/******/ +/******/ // add "moreModules" to the modules object, +/******/ // then flag all "chunkIds" as loaded and fire callback +/******/ var moduleId, chunkId, i = 0, resolves = []; +/******/ for(;i < chunkIds.length; i++) { +/******/ chunkId = chunkIds[i]; +/******/ if(installedChunks[chunkId]) { +/******/ resolves.push(installedChunks[chunkId][0]); +/******/ } +/******/ installedChunks[chunkId] = 0; +/******/ } +/******/ for(moduleId in moreModules) { +/******/ if(Object.prototype.hasOwnProperty.call(moreModules, moduleId)) { +/******/ modules[moduleId] = moreModules[moduleId]; +/******/ } +/******/ } +/******/ if(parentJsonpFunction) parentJsonpFunction(data); +/******/ +/******/ while(resolves.length) { +/******/ resolves.shift()(); +/******/ } +/******/ +/******/ // add entry modules from loaded chunk to deferred list +/******/ deferredModules.push.apply(deferredModules, executeModules || []); +/******/ +/******/ // run deferred modules when all chunks ready +/******/ return checkDeferredModules(); +/******/ }; +/******/ function checkDeferredModules() { +/******/ var result; +/******/ for(var i = 0; i < deferredModules.length; i++) { +/******/ var deferredModule = deferredModules[i]; +/******/ var fulfilled = true; +/******/ for(var j = 1; j < deferredModule.length; j++) { +/******/ var depId = deferredModule[j]; +/******/ if(installedChunks[depId] !== 0) fulfilled = false; +/******/ } +/******/ if(fulfilled) { +/******/ deferredModules.splice(i--, 1); +/******/ result = __webpack_require__(__webpack_require__.s = deferredModule[0]); +/******/ } +/******/ } +/******/ return result; +/******/ } +/******/ +/******/ // The module cache +/******/ var installedModules = {}; +/******/ +/******/ // object to store loaded and loading chunks +/******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched +/******/ // Promise = chunk loading, 0 = chunk loaded +/******/ var installedChunks = { +/******/ "runtime": 0 +/******/ }; +/******/ +/******/ var deferredModules = []; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) { +/******/ return installedModules[moduleId].exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ i: moduleId, +/******/ l: false, +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Flag the module as loaded +/******/ module.l = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; +/******/ +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; +/******/ +/******/ // define getter function for harmony exports +/******/ __webpack_require__.d = function(exports, name, getter) { +/******/ if(!__webpack_require__.o(exports, name)) { +/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); +/******/ } +/******/ }; +/******/ +/******/ // define __esModule on exports +/******/ __webpack_require__.r = function(exports) { +/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { +/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); +/******/ } +/******/ Object.defineProperty(exports, '__esModule', { value: true }); +/******/ }; +/******/ +/******/ // create a fake namespace object +/******/ // mode & 1: value is a module id, require it +/******/ // mode & 2: merge all properties of value into the ns +/******/ // mode & 4: return value when already ns object +/******/ // mode & 8|1: behave like require +/******/ __webpack_require__.t = function(value, mode) { +/******/ if(mode & 1) value = __webpack_require__(value); +/******/ if(mode & 8) return value; +/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; +/******/ var ns = Object.create(null); +/******/ __webpack_require__.r(ns); +/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); +/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); +/******/ return ns; +/******/ }; +/******/ +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = function(module) { +/******/ var getter = module && module.__esModule ? +/******/ function getDefault() { return module['default']; } : +/******/ function getModuleExports() { return module; }; +/******/ __webpack_require__.d(getter, 'a', getter); +/******/ return getter; +/******/ }; +/******/ +/******/ // Object.prototype.hasOwnProperty.call +/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; +/******/ +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; +/******/ +/******/ var jsonpArray = window["webpackJsonp"] = window["webpackJsonp"] || []; +/******/ var oldJsonpFunction = jsonpArray.push.bind(jsonpArray); +/******/ jsonpArray.push = webpackJsonpCallback; +/******/ jsonpArray = jsonpArray.slice(); +/******/ for(var i = 0; i < jsonpArray.length; i++) webpackJsonpCallback(jsonpArray[i]); +/******/ var parentJsonpFunction = oldJsonpFunction; +/******/ +/******/ +/******/ // run deferred modules from other chunks +/******/ checkDeferredModules(); +/******/ }) +/************************************************************************/ +/******/ ([]); +//# sourceMappingURL=runtime.js.map \ No newline at end of file diff --git a/ready2use/runtime.js.map b/ready2use/runtime.js.map new file mode 100644 index 0000000..c9491c1 --- /dev/null +++ b/ready2use/runtime.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["webpack:///webpack/bootstrap"],"names":[],"mappings":";AAAA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,gBAAQ,oBAAoB;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,yBAAiB,4BAA4B;AAC7C;AACA;AACA,0BAAkB,2BAA2B;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,kDAA0C,gCAAgC;AAC1E;AACA;;AAEA;AACA;AACA;AACA,gEAAwD,kBAAkB;AAC1E;AACA,yDAAiD,cAAc;AAC/D;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iDAAyC,iCAAiC;AAC1E,wHAAgH,mBAAmB,EAAE;AACrI;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA;AACA;AACA;AACA,wBAAgB,uBAAuB;AACvC;;;AAGA;AACA","file":"runtime.js","sourcesContent":[" \t// install a JSONP callback for chunk loading\n \tfunction webpackJsonpCallback(data) {\n \t\tvar chunkIds = data[0];\n \t\tvar moreModules = data[1];\n \t\tvar executeModules = data[2];\n\n \t\t// add \"moreModules\" to the modules object,\n \t\t// then flag all \"chunkIds\" as loaded and fire callback\n \t\tvar moduleId, chunkId, i = 0, resolves = [];\n \t\tfor(;i < chunkIds.length; i++) {\n \t\t\tchunkId = chunkIds[i];\n \t\t\tif(installedChunks[chunkId]) {\n \t\t\t\tresolves.push(installedChunks[chunkId][0]);\n \t\t\t}\n \t\t\tinstalledChunks[chunkId] = 0;\n \t\t}\n \t\tfor(moduleId in moreModules) {\n \t\t\tif(Object.prototype.hasOwnProperty.call(moreModules, moduleId)) {\n \t\t\t\tmodules[moduleId] = moreModules[moduleId];\n \t\t\t}\n \t\t}\n \t\tif(parentJsonpFunction) parentJsonpFunction(data);\n\n \t\twhile(resolves.length) {\n \t\t\tresolves.shift()();\n \t\t}\n\n \t\t// add entry modules from loaded chunk to deferred list\n \t\tdeferredModules.push.apply(deferredModules, executeModules || []);\n\n \t\t// run deferred modules when all chunks ready\n \t\treturn checkDeferredModules();\n \t};\n \tfunction checkDeferredModules() {\n \t\tvar result;\n \t\tfor(var i = 0; i < deferredModules.length; i++) {\n \t\t\tvar deferredModule = deferredModules[i];\n \t\t\tvar fulfilled = true;\n \t\t\tfor(var j = 1; j < deferredModule.length; j++) {\n \t\t\t\tvar depId = deferredModule[j];\n \t\t\t\tif(installedChunks[depId] !== 0) fulfilled = false;\n \t\t\t}\n \t\t\tif(fulfilled) {\n \t\t\t\tdeferredModules.splice(i--, 1);\n \t\t\t\tresult = __webpack_require__(__webpack_require__.s = deferredModule[0]);\n \t\t\t}\n \t\t}\n \t\treturn result;\n \t}\n\n \t// The module cache\n \tvar installedModules = {};\n\n \t// object to store loaded and loading chunks\n \t// undefined = chunk not loaded, null = chunk preloaded/prefetched\n \t// Promise = chunk loading, 0 = chunk loaded\n \tvar installedChunks = {\n \t\t\"runtime\": 0\n \t};\n\n \tvar deferredModules = [];\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \tvar jsonpArray = window[\"webpackJsonp\"] = window[\"webpackJsonp\"] || [];\n \tvar oldJsonpFunction = jsonpArray.push.bind(jsonpArray);\n \tjsonpArray.push = webpackJsonpCallback;\n \tjsonpArray = jsonpArray.slice();\n \tfor(var i = 0; i < jsonpArray.length; i++) webpackJsonpCallback(jsonpArray[i]);\n \tvar parentJsonpFunction = oldJsonpFunction;\n\n\n \t// run deferred modules from other chunks\n \tcheckDeferredModules();\n"],"sourceRoot":""} \ No newline at end of file diff --git a/ready2use/srv/css/style.css b/ready2use/srv/css/style.css new file mode 100644 index 0000000..b7a1437 --- /dev/null +++ b/ready2use/srv/css/style.css @@ -0,0 +1,60 @@ +.post-ui-message{ + padding : 10px; + margin-bottom : 18px; + background: rgb(189, 198, 247); + border-style: solid; + border-width: 1px; + border-color: #a99ec7; + border-radius: 5px; +} + +div { + margin-bottom: 8px; +} + +.ascii{ + display: inline-block; + font-family: "Lucida Console", Monaco, monospace; +} + +textarea +{ + width: 100%; + margin: 0; +} + +.post-message { + padding : 10px; + margin-bottom : 18px; + background: rgb(228, 221, 221); + border-style: solid; + border-width: 1px; + border-color: rgb(131, 123, 123); + border-radius: 5px; +} + +.post-torrent-info{ + font-family: 'Courier New', Courier, monospace; + font-size: small; + padding : 8px; + color: white; + background:rgb(70, 61, 56); + border-radius: 5px; +} + +.post-message img { + max-width: 650px; + width: 100%; + height: auto; +} + +.post-message video { + max-width: 650px; + width: 100%; + height: auto; +} + +.post-message audio { + max-width: 650px; + width: 100%; +} \ No newline at end of file diff --git a/ready2use/srv/img/.htaccess b/ready2use/srv/img/.htaccess new file mode 100755 index 0000000..d5d6eda --- /dev/null +++ b/ready2use/srv/img/.htaccess @@ -0,0 +1,6 @@ +Options +FollowSymlinks +RewriteEngine on +RewriteRule ^([a-z0-9-_]+).jpeg ?name=$1.jpeg +RewriteRule ^([a-z0-9-_]+).jpg ?name=$1.jpg +RewriteRule ^([a-z0-9-_]+).gif ?name=$1.gif +RewriteRule ^([a-z0-9-_]+).png ?name=$1.png \ No newline at end of file diff --git a/ready2use/srv/img/breadchan_preview.png b/ready2use/srv/img/breadchan_preview.png new file mode 100644 index 0000000..f5b57cf Binary files /dev/null and b/ready2use/srv/img/breadchan_preview.png differ diff --git a/ready2use/srv/img/index.php b/ready2use/srv/img/index.php new file mode 100644 index 0000000..9ecbd8e --- /dev/null +++ b/ready2use/srv/img/index.php @@ -0,0 +1,29 @@ + \ No newline at end of file diff --git a/ready2use/srv/index.html b/ready2use/srv/index.html new file mode 100644 index 0000000..20f7812 --- /dev/null +++ b/ready2use/srv/index.html @@ -0,0 +1,30 @@ + + + + + + + AnonIB-3D Server + + + + + + + + + + + + + +
+ +
+

Welcome on AnonIB-3D server-side!

+ +
+ + + \ No newline at end of file diff --git a/ready2use/srv/libs/blob-util@latest.js b/ready2use/srv/libs/blob-util@latest.js new file mode 100644 index 0000000..f1efebf --- /dev/null +++ b/ready2use/srv/libs/blob-util@latest.js @@ -0,0 +1 @@ +!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var r;r="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,r.blobUtil=e()}}(function(){return function e(r,n,t){function o(u,f){if(!n[u]){if(!r[u]){var a="function"==typeof require&&require;if(!f&&a)return a(u,!0);if(i)return i(u,!0);var c=new Error("Cannot find module '"+u+"'");throw c.code="MODULE_NOT_FOUND",c}var d=n[u]={exports:{}};r[u][0].call(d.exports,function(e){var n=r[u][1][e];return o(n?n:e)},d,d.exports,e,r,n,t)}return n[u].exports}for(var i="function"==typeof require&&require,u=0;u 1048576 ? (x / 1048576).toFixed(1) + 'Mb' : (x==1024?'1Mb': (x / 1024).toFixed(1) + 'Kb' ) + }; + // utility function to return an array of + function FILE_LIST(x){ + return ((x.files&&x.files.length) ? x.files : null) || [{ + name: x.value, + size: 0, + type: ((x.value || '').match(/[^\.]+$/i) || [''])[0] + }]; + }; + + // plugin initialization + $.fn.MultiFile = function (options) { + if (this.length == 0) return this; // quick fail + + // Handle API methods + if (typeof arguments[0] == 'string') { + // Perform API methods on individual elements + if (this.length > 1) { + var args = arguments; + return this.each(function () { + $.fn.MultiFile.apply($(this), args); + }); + }; + // Invoke API method handler (and return whatever it wants to return) + return $.fn.MultiFile[arguments[0]].apply(this, $.makeArray(arguments).slice(1) || []); + }; + + // Accept number + if (typeof options == 'number') { + options = {max: options}; + }; + + // Initialize options for this call + var options = $.extend({} /* new object */ , + $.fn.MultiFile.options /* default options */ , + options || {} /* just-in-time options */ + ); + + // Empty Element Fix!!! + // this code will automatically intercept native form submissions + // and disable empty file elements + $('form') + .not('MultiFile-intercepted') + .addClass('MultiFile-intercepted') + .submit($.fn.MultiFile.disableEmpty); + + //### http://plugins.jquery.com/node/1363 + // utility method to integrate this plugin with others... + if ($.fn.MultiFile.options.autoIntercept) { + $.fn.MultiFile.intercept($.fn.MultiFile.options.autoIntercept /* array of methods to intercept */ ); + $.fn.MultiFile.options.autoIntercept = null; /* only run this once */ + }; + + // loop through each matched element + this + .not('.MultiFile-applied') + .addClass('MultiFile-applied') + .each(function () { + //##################################################################### + // MAIN PLUGIN FUNCTIONALITY - START + //##################################################################### + + // BUG 1251 FIX: http://plugins.jquery.com/project/comments/add/1251 + // variable group_count would repeat itself on multiple calls to the plugin. + // this would cause a conflict with multiple elements + // changes scope of variable to global so id will be unique over n calls + window.MultiFile = (window.MultiFile || 0) + 1; + var group_count = window.MultiFile; + + // Copy parent attributes - Thanks to Jonas Wagner + // we will use this one to create new input elements + var MultiFile = { + e: this, + E: $(this), + clone: $(this).clone() + }; + + //=== + + //# USE CONFIGURATION + var o = $.extend({}, + $.fn.MultiFile.options, + options || {}, ($.metadata ? MultiFile.E.metadata() : ($.meta ? MultiFile.E.data() : null)) || {}, /* metadata options */ {} /* internals */ + ); + // limit number of files that can be selected? + if (!(o.max > 0) /*IsNull(MultiFile.max)*/ ) { + o.max = MultiFile.E.attr('maxlength'); + }; + if (!(o.max > 0) /*IsNull(MultiFile.max)*/ ) { + o.max = (String(MultiFile.e.className.match(/\b(max|limit)\-([0-9]+)\b/gi) || ['']).match(/[0-9]+/gi) || [''])[0]; + if (!(o.max > 0)) o.max = -1; + else o.max = String(o.max).match(/[0-9]+/gi)[0]; + }; + o.max = new Number(o.max); + // limit extensions? + o.accept = o.accept || MultiFile.E.attr('accept') || ''; + if (!o.accept) { + o.accept = (MultiFile.e.className.match(/\b(accept\-[\w\|]+)\b/gi)) || ''; + o.accept = new String(o.accept).replace(/^(accept|ext)\-/i, ''); + }; + // limit total pay load size + o.maxsize = o.maxsize>0?o.maxsize:null || MultiFile.E.data('maxsize') || 0; + if (!(o.maxsize > 0) /*IsNull(MultiFile.maxsize)*/ ) { + o.maxsize = (String(MultiFile.e.className.match(/\b(maxsize|maxload|size)\-([0-9]+)\b/gi) || ['']).match(/[0-9]+/gi) || [''])[0]; + if (!(o.maxsize > 0)) o.maxsize = -1; + else o.maxsize = String(o.maxsize).match(/[0-9]+/gi)[0]; + }; + // limit individual file size + o.maxfile = o.maxfile>0?o.maxfile:null || MultiFile.E.data('maxfile') || 0; + if (!(o.maxfile > 0) /*IsNull(MultiFile.maxfile)*/ ) { + o.maxfile = (String(MultiFile.e.className.match(/\b(maxfile|filemax)\-([0-9]+)\b/gi) || ['']).match(/[0-9]+/gi) || [''])[0]; + if (!(o.maxfile > 0)) o.maxfile = -1; + else o.maxfile = String(o.maxfile).match(/[0-9]+/gi)[0]; + }; + + //=== + + // size options are accepted in kylobytes, so multiple them by 1024 + if(o.maxfile>1) o.maxfile = o.maxfile * 1024; + if(o.maxsize>1) o.maxsize = o.maxsize * 1024; + + //=== + + // HTML5: enforce multiple selection to be enabled, except when explicitly disabled + if (o.multiple !== false) { + if (o.max > 1) MultiFile.E.attr('multiple', 'multiple').prop('multiple', true); + } + + //=== + + // APPLY CONFIGURATION + $.extend(MultiFile, o || {}); + MultiFile.STRING = $.extend({}, $.fn.MultiFile.options.STRING, MultiFile.STRING); + + //=== + + //######################################### + // PRIVATE PROPERTIES/METHODS + $.extend(MultiFile, { + n: 0, // How many elements are currently selected? + slaves: [], + files: [], + instanceKey: MultiFile.e.id || 'MultiFile' + String(group_count), // Instance Key? + generateID: function (z) { + return MultiFile.instanceKey + (z > 0 ? '_F' + String(z) : ''); + }, + trigger: function (event, element, MultiFile, files) { + var rv, handler = MultiFile[event] || MultiFile['on'+event] ; + if (handler){ + files = files || MultiFile.files || FILE_LIST(this); + ; + $.each(files,function(i, file){ + // execute function in element's context, so 'this' variable is current element + rv = handler.apply(MultiFile.wrapper, [element, file.name, MultiFile, file]); + }); + return rv; + }; + } + }); + + //=== + + // Setup dynamic regular expression for extension validation + // - thanks to John-Paul Bader: http://smyck.de/2006/08/11/javascript-dynamic-regular-expresions/ + if (String(MultiFile.accept).length > 1) { + MultiFile.accept = MultiFile.accept.replace(/\W+/g, '|').replace(/^\W|\W$/g, ''); + MultiFile.rxAccept = new RegExp('\\.(' + (MultiFile.accept ? MultiFile.accept : '') + ')$', 'gi'); + }; + + //=== + + // Create wrapper to hold our file list + MultiFile.wrapID = MultiFile.instanceKey;// + '_wrap'; // Wrapper ID? + MultiFile.E.wrap('
'); + MultiFile.wrapper = $('#' + MultiFile.wrapID + ''); + + //=== + + // MultiFile MUST have a name - default: file1[], file2[], file3[] + MultiFile.e.name = MultiFile.e.name || 'file' + group_count + '[]'; + + //=== + + if (!MultiFile.list) { + // Create a wrapper for the list + // * OPERA BUG: NO_MODIFICATION_ALLOWED_ERR ('list' is a read-only property) + // this change allows us to keep the files in the order they were selected + MultiFile.wrapper.append('
'); + MultiFile.list = $('#' + MultiFile.wrapID + '_list'); + }; + MultiFile.list = $(MultiFile.list); + + //=== + + // Bind a new element + MultiFile.addSlave = function (slave, slave_count) { + //if(window.console) console.log('MultiFile.addSlave',slave_count); + + // Keep track of how many elements have been displayed + MultiFile.n++; + // Add reference to master element + slave.MultiFile = MultiFile; + + // BUG FIX: http://plugins.jquery.com/node/1495 + // Clear identifying properties from clones + slave.id = slave.name = ''; + + // Define element's ID and name (upload components need this!) + //slave.id = slave.id || MultiFile.generateID(slave_count); + slave.id = MultiFile.generateID(slave_count); + //FIX for: http://code.google.com/p/jquery-multifile-plugin/issues/detail?id=23 + //CHANGE v2.2.1 - change ID of all file elements, keep original ID in wrapper + + // 2008-Apr-29: New customizable naming convention (see url below) + // http://groups.google.com/group/jquery-dev/browse_frm/thread/765c73e41b34f924# + slave.name = String(MultiFile.namePattern + /*master name*/ + .replace(/\$name/gi, $(MultiFile.clone).attr('name')) + /*master id */ + .replace(/\$id/gi, $(MultiFile.clone).attr('id')) + /*group count*/ + .replace(/\$g/gi, group_count) //(group_count>0?group_count:'')) + /*slave count*/ + .replace(/\$i/gi, slave_count) //(slave_count>0?slave_count:'')) + ); + + // If we've reached maximum number, disable input slave + var disable_slave; + if ((MultiFile.max > 0) && ((MultiFile.files.length) > (MultiFile.max))) { + slave.disabled = true; + disable_slave = true; + }; + + // Remember most recent slave + MultiFile.current = slave; + + // We'll use jQuery from now on + slave = $(slave); + + // Clear value + slave.val('').attr('value', '')[0].value = ''; + + // Stop plugin initializing on slaves + slave.addClass('MultiFile-applied'); + + // Triggered when a file is selected + slave.change(function (a, b, c) { + //if(window.console) console.log('MultiFile.slave.change',slave_count); + //if(window.console) console.log('MultiFile.slave.change',this.files); + + // Lose focus to stop IE7 firing onchange again + $(this).blur(); + + //# NEW 2014-04-14 - accept multiple file selection, HTML5 + var e = this, + prevs = MultiFile.files || [], + files = this.files || [{ + name: this.value, + size: 0, + type: ((this.value || '').match(/[^\.]+$/i) || [''])[0] + }], + newfs = [], + newfs_size = 0, + total_size = MultiFile.total_size || 0/*, + html5_multi_mode = this.files && $(this).attr('multiple')*/ + ; + + // recap + //console.log('START '+ prevs.length + ' files @ '+ sl(total_size) +'.', prevs); + + //# Retrive value of selected file from element + var ERROR = []; //, v = String(this.value || ''); + + // make a normal array + $.each(files, function (i, file) { + newfs[newfs.length] = file; + }); + + //# Trigger Event! onFileSelect + MultiFile.trigger('FileSelect', this, MultiFile, newfs); + //# End Event! + + // validate individual files + $.each(files, function (i, file) { + + // pop local variables out of array/file object + var v = file.name.replace(/^C:\\fakepath\\/gi,''), + s = file.size, + p = function(z){ + return z + .replace('$ext', String(v.match(/[^\.]+$/i) || '')) + .replace('$file', v.match(/[^\/\\]+$/gi)) + .replace('$size', sl(s) + ' > ' + sl(MultiFile.maxfile)) + } + ; + + // check extension + if (MultiFile.accept && v && !v.match(MultiFile.rxAccept)) { + ERROR[ERROR.length] = p(MultiFile.STRING.denied); + MultiFile.trigger('FileInvalid', this, MultiFile, [file]); + }; + + // Disallow duplicates + $(MultiFile.wrapper).find('input[type=file]').not(e).each(function(){ + // go through each file in each slave + $.each(FILE_LIST(this), function (i, file) { + if(file.name){ + //console.log('MultiFile.debug> Duplicate?', file.name, v); + var x = (file.name || '').replace(/^C:\\fakepath\\/gi,''); + if ( v == x || v == x.substr(x.length - v.length)) { + ERROR[ERROR.length] = p(MultiFile.STRING.duplicate); + MultiFile.trigger('FileDuplicate', e, MultiFile, [file]); + }; + }; + }); + }); + + // limit the max size of individual files selected + if (MultiFile.maxfile>0 && s>0 && s>MultiFile.maxfile) { + ERROR[ERROR.length] = p(MultiFile.STRING.toobig); + MultiFile.trigger('FileTooBig', this, MultiFile, [file]); + }; + + // check extension + var customError = MultiFile.trigger('FileValidate', this, MultiFile, [file]); + if(customError && customError!=''){ + ERROR[ERROR.length] = p(customError); + }; + + // add up size of files selected + newfs_size += file.size; + + }); + + // add up total for all files selected (existing and new) + total_size += newfs_size; + + // put some useful information in the file array + newfs.size = newfs_size; + newfs.total = total_size; + newfs.total_length = newfs.length + prevs.length; + + // limit the number of files selected + if (MultiFile.max>0 && prevs.length + files.length > MultiFile.max) { + ERROR[ERROR.length] = MultiFile.STRING.toomany.replace('$max', MultiFile.max); + MultiFile.trigger('FileTooMany', this, MultiFile, newfs); + }; + + // limit the max size of files selected + if (MultiFile.maxsize > 0 && total_size > MultiFile.maxsize) { + ERROR[ERROR.length] = MultiFile.STRING.toomuch.replace('$size', sl(total_size) + ' > ' + sl(MultiFile.maxsize)); + MultiFile.trigger('FileTooMuch', this, MultiFile, newfs); + }; + + // Create a new file input element + var newEle = $(MultiFile.clone).clone(); // Copy parent attributes - Thanks to Jonas Wagner + //# Let's remember which input we've generated so + // we can disable the empty ones before submission + // See: http://plugins.jquery.com/node/1495 + newEle.addClass('MultiFile'); + + // Handle error + if (ERROR.length > 0) { + + // Handle error + MultiFile.error(ERROR.join('\n\n')); + + // 2007-06-24: BUG FIX - Thanks to Adrian Wróbel + // Ditch the trouble maker and add a fresh new element + MultiFile.n--; + MultiFile.addSlave(newEle[0], slave_count); + slave.parent().prepend(newEle); + slave.remove(); + return false; + + } + else { // if no errors have been found + + // remember total size + MultiFile.total_size = total_size; + + // merge arrays + files = prevs.concat(newfs); + + // put some useful information in the file array + files.size = total_size; + files.size_label = sl(total_size); + + // recap + //console.log('NOW '+ files.length + ' files @ '+ sl(total_size) +'.', files); + + // remember files + MultiFile.files = files; + + // Hide this element (NB: display:none is evil!) + $(this).css({ + position: 'absolute', + top: '-3000px' + }); + + // Add new element to the form + slave.after(newEle); + + // Bind functionality + MultiFile.addSlave(newEle[0], slave_count + 1); + + // Update list + MultiFile.addToList(this, slave_count, newfs); + + //# Trigger Event! afterFileSelect + MultiFile.trigger('afterFileSelect', this, MultiFile, newfs); + //# End Event! + + }; // no errors detected + + }); // slave.change() + + // point to wrapper + $(slave).data('MultiFile-wrap', MultiFile.wrapper); + + // store contorl's settings and file info in wrapper + $(MultiFile.wrapper).data('MultiFile',MultiFile); + + // disable? + if(disable_slave) $(slave).attr('disabled','disabled').prop('disabled',true); + + }; // MultiFile.addSlave + // Bind a new element + + + // Add a new file to the list + MultiFile.addToList = function (slave, slave_count, files) { + //if(window.console) console.log('MultiFile.addToList',slave_count); + + //# Trigger Event! onFileAppend + MultiFile.trigger('FileAppend', slave, MultiFile, files); + //# End Event! + + var names = $(''); + $.each(files, function (i, file) { + var v = String(file.name || '' ).replace(/[&<>'"]/g, function(c) { return '&#'+c.charCodeAt()+';'; }), + S = MultiFile.STRING, + n = S.label || S.file || S.name, + t = S.title || S.tooltip || S.selected, + p = file.type.substr(0,6) == 'image/' ? '' : '', + label = $( + ( + ''+ + ''+ n +''+ + (MultiFile.preview || $(slave).is('.with-preview') ? p : '' )+ + '' + ) + .replace(/\$(file|name)/gi, (v.match(/[^\/\\]+$/gi)||[v])[0]) + .replace(/\$(ext|extension|type)/gi, (v.match(/[^\.]+$/gi)||[''])[0]) + .replace(/\$(size)/gi, sl(file.size || 0)) + .replace(/\$(preview)/gi, p) + .replace(/\$(i)/gi, i) + ); + + // now supports preview via locale string. + // just add an anywhere within the "file" string + label.find('img.MultiFile-preview').each(function(){ + var t = this; + var oFReader = new FileReader(); + oFReader.readAsDataURL(file); + oFReader.onload = function (oFREvent) { + t.src = oFREvent.target.result; + }; + }); + + // append file label to list + if(i>0) names.append(', '); + names.append(label); + + var v = String(file.name || '' ); + names[names.length] = + ( + '' + + MultiFile.STRING.file + + '' + ) + .replace(/\$(file|name)/gi, (v.match(/[^\/\\]+$/gi)||[v])[0]) + .replace(/\$(ext|extension|type)/gi, (v.match(/[^\.]+$/gi)||[''])[0]) + .replace(/\$(size)/gi, sl(file.size || 0)) + .replace(/\$(i)/gi, i) + ; + }); + + //$.each(files, function (i, file) { + // Create label elements + var + r = $('
'), + b = $('' + MultiFile.STRING.remove + '') + + // ******** + // TODO: + // refactor this as a single event listener on the control's + // wrapper for better performance and cleaner code + // ******** + .click(function () { + + // get list of files being removed + var files_being_removed = FILE_LIST(slave); + + //# Trigger Event! onFileRemove + MultiFile.trigger('FileRemove', slave, MultiFile, files_being_removed); + //# End Event! + + MultiFile.n--; + MultiFile.current.disabled = false; + + // remove the relevant element + $(slave).remove(); + + // remove the relevant label + $(this).parent().remove(); + + // Show most current element again (move into view) and clear selection + $(MultiFile.current).css({ + position: '', + top: '' + }); + $(MultiFile.current).reset().val('').attr('value', '')[0].value = ''; + + // point to currently visible element (always true, not necessary) + //MultiFile.current = MultiFile.wrapper.find('[type=file]:visible'); + + // rebuild array with the files that are left. + var files_remaining = [], remain_size = 0; + // go through each slave + $(MultiFile.wrapper).find('input[type=file]').each(function(){ + // go through each file in each slave + $.each(FILE_LIST(this), function (i, file) { + if(file.name){ + //console.log('MultiFile.debug> FileRemove> remaining file', file.size, file); + // fresh file array + files_remaining[files_remaining.length] = file; + // fresh size count + remain_size += file.size; + }; + }); + }); + + // update MultiFile object + MultiFile.files = files_remaining; + MultiFile.total_size = remain_size; + MultiFile.size_label = sl(remain_size); + + // update current control's reference to MultiFile object + $(MultiFile.wrapper).data('MultiFile', MultiFile); + + //# Trigger Event! afterFileRemove + MultiFile.trigger('afterFileRemove', slave, MultiFile, files_being_removed); + //# End Event! + + //# Trigger Event! onFileChange + MultiFile.trigger('FileChange', MultiFile.current, MultiFile, files_remaining); + //# End Event! + + return false; + }); + + // Insert label + MultiFile.list.append( + r.append(b, ' ', names) + ); + + //}); // each file? + + //# Trigger Event! afterFileAppend + MultiFile.trigger('afterFileAppend', slave, MultiFile, files); + //# End Event! + + //# Trigger Event! onFileChange + MultiFile.trigger('FileChange', slave, MultiFile, MultiFile.files); + //# End Event! + + }; // MultiFile.addToList + // Add element to selected files list + + + // Bind functionality to the first element + if (!MultiFile.MultiFile) MultiFile.addSlave(MultiFile.e, 0); + + // Increment control count + //MultiFile.I++; // using window.MultiFile + MultiFile.n++; + + // deprecated: contorl's data now stored in wrapper because it is never removed. + // improved performance and lower memory comsumption + // Save control to element + //MultiFile.E.data('MultiFile', MultiFile); + + + //##################################################################### + // MAIN PLUGIN FUNCTIONALITY - END + //##################################################################### + }); // each element + }; + + /*--------------------------------------------------------*/ + + /* + ### Core functionality and API ### + */ + $.extend($.fn.MultiFile, { + + + /** + * This method exposes the all the control's data + * + * Returns an object with various settings and properties of the selected files + * for this particular instance of the control. stored in the control's wrapper + * + * @name data + * @type Object + * @cat Plugins/MultiFile + * @author Diego A. (http://www.fyneworks.com/) + * + * @example $('#selector').MultiFile('data'); + */ + data: function () { + + // analyse this element + var e = $(this), b = e.is('.MultiFile-wrap'); + + // get control wrapper + var wp = b ? e : e.data('MultiFile-wrap'); + if(!wp || !wp.length) + return !console.error('Could not find MultiFile control wrapper'); + + // get control data from wrapper + var mf = wp.data('MultiFile'); + if(!mf) + return !console.error('Could not find MultiFile data in wrapper'); + + // return data + return mf || {}; + }, + + + /** + * This method removes all selected files + * + * Returns a jQuery collection of all affected elements. + * + * @name reset + * @type jQuery + * @cat Plugins/MultiFile + * @author Diego A. (http://www.fyneworks.com/) + * + * @example $.fn.MultiFile.reset(); + */ + reset: function () { + var mf = this.MultiFile('data'); + if (mf) $(mf.list).find('a.MultiFile-remove').click(); + return $(this); + }, + + + /** + * This method exposes the array of selected files + * + * Returns an array of file objects + * + * @name files + * @type Array + * @cat Plugins/MultiFile + * @author Diego A. (http://www.fyneworks.com/) + * + * @example $('#selector').MultiFile('files'); + */ + files: function () { + var mf = this.MultiFile('data'); + if(!mf) return !console.log('MultiFile plugin not initialized'); + return mf.files || []; + }, + + + /** + * This method exposes the plugin's sum of the sizes of all files selected + * + * Returns size (in bytes) of files selected + * + * @name size + * @type Number + * @cat Plugins/MultiFile + * @author Diego A. (http://www.fyneworks.com/) + * + * @example $('#selector').MultiFile('size'); + */ + size: function () { + var mf = this.MultiFile('data'); + if(!mf) return !console.log('MultiFile plugin not initialized'); + return mf.total_size || 0; + }, + + + /** + * This method exposes the plugin's tally of how many files have been selected + * + * Returns number (a count) of files selected + * + * @name count + * @type Number + * @cat Plugins/MultiFile + * @author Diego A. (http://www.fyneworks.com/) + * + * @example $('#selector').MultiFile('size'); + */ + count: function () { + var mf = this.MultiFile('data'); + if(!mf) return !console.log('MultiFile plugin not initialized'); + return mf.files ? mf.files.length || 0 : 0; + }, + + + /** + * This utility makes it easy to disable all 'empty' file elements in the document before submitting a form. + * It marks the affected elements so they can be easily re-enabled after the form submission or validation. + * + * Returns a jQuery collection of all affected elements. + * + * @name disableEmpty + * @type jQuery + * @cat Plugins/MultiFile + * @author Diego A. (http://www.fyneworks.com/) + * + * @example $.fn.MultiFile.disableEmpty(); + * @param String class (optional) A string specifying a class to be applied to all affected elements - Default: 'mfD'. + */ + disableEmpty: function (klass) { + klass = (typeof (klass) == 'string' ? klass : '') || 'mfD'; + var o = []; + $('input:file.MultiFile').each(function () { + if ($(this).val() == '') o[o.length] = this; + }); + + // automatically re-enable for novice users + window.clearTimeout($.fn.MultiFile.reEnableTimeout); + $.fn.MultiFile.reEnableTimeout = window.setTimeout($.fn.MultiFile.reEnableEmpty, 500); + + return $(o).each(function () { + this.disabled = true + }).addClass(klass); + }, + + + /** + * This method re-enables 'empty' file elements that were disabled (and marked) with the $.fn.MultiFile.disableEmpty method. + * + * Returns a jQuery collection of all affected elements. + * + * @name reEnableEmpty + * @type jQuery + * @cat Plugins/MultiFile + * @author Diego A. (http://www.fyneworks.com/) + * + * @example $.fn.MultiFile.reEnableEmpty(); + * @param String klass (optional) A string specifying the class that was used to mark affected elements - Default: 'mfD'. + */ + reEnableEmpty: function (klass) { + klass = (typeof (klass) == 'string' ? klass : '') || 'mfD'; + return $('input:file.' + klass).removeClass(klass).each(function () { + this.disabled = false + }); + }, + + + /** + * This method will intercept other jQuery plugins and disable empty file input elements prior to form submission + * + + * @name intercept + * @cat Plugins/MultiFile + * @author Diego A. (http://www.fyneworks.com/) + * + * @example $.fn.MultiFile.intercept(); + * @param Array methods (optional) Array of method names to be intercepted + */ + intercepted: {}, + intercept: function (methods, context, args) { + var method, value; + args = args || []; + if (args.constructor.toString().indexOf("Array") < 0) args = [args]; + if (typeof (methods) == 'function') { + $.fn.MultiFile.disableEmpty(); + value = methods.apply(context || window, args); + //SEE-http://code.google.com/p/jquery-multifile-plugin/issues/detail?id=27 + setTimeout(function () { + $.fn.MultiFile.reEnableEmpty() + }, 1000); + return value; + }; + if (methods.constructor.toString().indexOf("Array") < 0) methods = [methods]; + for (var i = 0; i < methods.length; i++) { + method = methods[i] + ''; // make sure that we have a STRING + if (method)(function (method) { // make sure that method is ISOLATED for the interception + $.fn.MultiFile.intercepted[method] = $.fn[method] || function () {}; + $.fn[method] = function () { + $.fn.MultiFile.disableEmpty(); + value = $.fn.MultiFile.intercepted[method].apply(this, arguments); + //SEE http://code.google.com/p/jquery-multifile-plugin/issues/detail?id=27 + setTimeout(function () { + $.fn.MultiFile.reEnableEmpty() + }, 1000); + return value; + }; // interception + })(method); // MAKE SURE THAT method IS ISOLATED for the interception + }; // for each method + } // $.fn.MultiFile.intercept + + }); + + /*--------------------------------------------------------*/ + + /* + ### Default Settings ### + eg.: You can override default control like this: + $.fn.MultiFile.options.accept = 'gif|jpg'; + */ + $.fn.MultiFile.options = { //$.extend($.fn.MultiFile, { options: { + accept: '', // accepted file extensions + max: -1, // maximum number of selectable files + maxfile: -1, // maximum size of a single file + maxsize: -1, // maximum size of entire payload + + // name to use for newly created elements + namePattern: '$name', // same name by default (which creates an array) + /*master name*/ // use $name + /*master id */ // use $id + /*group count*/ // use $g + /*slave count*/ // use $i + /*other */ // use any combination of he above, eg.: $name_file$i + + // previews + preview: false, + previewCss: 'max-height:100px; max-width:100px;', + + // STRING: collection lets you show messages in different languages + STRING: { + remove: 'x', + denied: 'You cannot select a $ext file.\nTry again...', + file: '$file', + selected: 'File selected: $file', + duplicate: 'This file has already been selected:\n$file', + toomuch: 'The files selected exceed the maximum size permited ($size)', + toomany: 'Too many files selected (max: $max)', + toobig: '$file is too big (max $size)' + }, + + // name of methods that should be automcatically intercepted so the plugin can disable + // extra file elements that are empty before execution and automatically re-enable them afterwards + autoIntercept: ['submit', 'ajaxSubmit', 'ajaxForm', 'validate', 'valid' /* array of methods to intercept */ ], + + // error handling function + error: function (s) { + + if(typeof console != 'undefined') console.log(s); + + // TODO: add various dialog handlers here? + alert(s); + } + }; //} }); + + /*--------------------------------------------------------*/ + + /* + ### Additional Methods ### + Required functionality outside the plugin's scope + */ + + // Native input reset method - because this alone doesn't always work: $(element).val('').attr('value', '')[0].value = ''; + $.fn.reset = $.fn.reset || function () { + return this.each(function () { + try { + this.reset(); + } catch (e) {} + }); + }; + + /*--------------------------------------------------------*/ + + /* + ### Default implementation ### + The plugin will attach itself to file inputs + with the class 'multi' when the page loads + */ + $(function () { + //$("input:file.multi").MultiFile(); + $("input[type=file].multi").MultiFile(); + }); + + + /*# AVOID COLLISIONS #*/ +})(jQuery); +/*# AVOID COLLISIONS #*/ diff --git a/ready2use/srv/libs/qrcode.js b/ready2use/srv/libs/qrcode.js new file mode 100755 index 0000000..5507c15 --- /dev/null +++ b/ready2use/srv/libs/qrcode.js @@ -0,0 +1,614 @@ +/** + * @fileoverview + * - Using the 'QRCode for Javascript library' + * - Fixed dataset of 'QRCode for Javascript library' for support full-spec. + * - this library has no dependencies. + * + * @author davidshimjs + * @see http://www.d-project.com/ + * @see http://jeromeetienne.github.com/jquery-qrcode/ + */ +var QRCode; + +(function () { + //--------------------------------------------------------------------- + // QRCode for JavaScript + // + // Copyright (c) 2009 Kazuhiko Arase + // + // URL: http://www.d-project.com/ + // + // Licensed under the MIT license: + // http://www.opensource.org/licenses/mit-license.php + // + // The word "QR Code" is registered trademark of + // DENSO WAVE INCORPORATED + // http://www.denso-wave.com/qrcode/faqpatent-e.html + // + //--------------------------------------------------------------------- + function QR8bitByte(data) { + this.mode = QRMode.MODE_8BIT_BYTE; + this.data = data; + this.parsedData = []; + + // Added to support UTF-8 Characters + for (var i = 0, l = this.data.length; i < l; i++) { + var byteArray = []; + var code = this.data.charCodeAt(i); + + if (code > 0x10000) { + byteArray[0] = 0xF0 | ((code & 0x1C0000) >>> 18); + byteArray[1] = 0x80 | ((code & 0x3F000) >>> 12); + byteArray[2] = 0x80 | ((code & 0xFC0) >>> 6); + byteArray[3] = 0x80 | (code & 0x3F); + } else if (code > 0x800) { + byteArray[0] = 0xE0 | ((code & 0xF000) >>> 12); + byteArray[1] = 0x80 | ((code & 0xFC0) >>> 6); + byteArray[2] = 0x80 | (code & 0x3F); + } else if (code > 0x80) { + byteArray[0] = 0xC0 | ((code & 0x7C0) >>> 6); + byteArray[1] = 0x80 | (code & 0x3F); + } else { + byteArray[0] = code; + } + + this.parsedData.push(byteArray); + } + + this.parsedData = Array.prototype.concat.apply([], this.parsedData); + + if (this.parsedData.length != this.data.length) { + this.parsedData.unshift(191); + this.parsedData.unshift(187); + this.parsedData.unshift(239); + } + } + + QR8bitByte.prototype = { + getLength: function (buffer) { + return this.parsedData.length; + }, + write: function (buffer) { + for (var i = 0, l = this.parsedData.length; i < l; i++) { + buffer.put(this.parsedData[i], 8); + } + } + }; + + function QRCodeModel(typeNumber, errorCorrectLevel) { + this.typeNumber = typeNumber; + this.errorCorrectLevel = errorCorrectLevel; + this.modules = null; + this.moduleCount = 0; + this.dataCache = null; + this.dataList = []; + } + + QRCodeModel.prototype={addData:function(data){var newData=new QR8bitByte(data);this.dataList.push(newData);this.dataCache=null;},isDark:function(row,col){if(row<0||this.moduleCount<=row||col<0||this.moduleCount<=col){throw new Error(row+","+col);} + return this.modules[row][col];},getModuleCount:function(){return this.moduleCount;},make:function(){this.makeImpl(false,this.getBestMaskPattern());},makeImpl:function(test,maskPattern){this.moduleCount=this.typeNumber*4+17;this.modules=new Array(this.moduleCount);for(var row=0;row=7){this.setupTypeNumber(test);} + if(this.dataCache==null){this.dataCache=QRCodeModel.createData(this.typeNumber,this.errorCorrectLevel,this.dataList);} + this.mapData(this.dataCache,maskPattern);},setupPositionProbePattern:function(row,col){for(var r=-1;r<=7;r++){if(row+r<=-1||this.moduleCount<=row+r)continue;for(var c=-1;c<=7;c++){if(col+c<=-1||this.moduleCount<=col+c)continue;if((0<=r&&r<=6&&(c==0||c==6))||(0<=c&&c<=6&&(r==0||r==6))||(2<=r&&r<=4&&2<=c&&c<=4)){this.modules[row+r][col+c]=true;}else{this.modules[row+r][col+c]=false;}}}},getBestMaskPattern:function(){var minLostPoint=0;var pattern=0;for(var i=0;i<8;i++){this.makeImpl(true,i);var lostPoint=QRUtil.getLostPoint(this);if(i==0||minLostPoint>lostPoint){minLostPoint=lostPoint;pattern=i;}} + return pattern;},createMovieClip:function(target_mc,instance_name,depth){var qr_mc=target_mc.createEmptyMovieClip(instance_name,depth);var cs=1;this.make();for(var row=0;row>i)&1)==1);this.modules[Math.floor(i/3)][i%3+this.moduleCount-8-3]=mod;} + for(var i=0;i<18;i++){var mod=(!test&&((bits>>i)&1)==1);this.modules[i%3+this.moduleCount-8-3][Math.floor(i/3)]=mod;}},setupTypeInfo:function(test,maskPattern){var data=(this.errorCorrectLevel<<3)|maskPattern;var bits=QRUtil.getBCHTypeInfo(data);for(var i=0;i<15;i++){var mod=(!test&&((bits>>i)&1)==1);if(i<6){this.modules[i][8]=mod;}else if(i<8){this.modules[i+1][8]=mod;}else{this.modules[this.moduleCount-15+i][8]=mod;}} + for(var i=0;i<15;i++){var mod=(!test&&((bits>>i)&1)==1);if(i<8){this.modules[8][this.moduleCount-i-1]=mod;}else if(i<9){this.modules[8][15-i-1+1]=mod;}else{this.modules[8][15-i-1]=mod;}} + this.modules[this.moduleCount-8][8]=(!test);},mapData:function(data,maskPattern){var inc=-1;var row=this.moduleCount-1;var bitIndex=7;var byteIndex=0;for(var col=this.moduleCount-1;col>0;col-=2){if(col==6)col--;while(true){for(var c=0;c<2;c++){if(this.modules[row][col-c]==null){var dark=false;if(byteIndex>>bitIndex)&1)==1);} + var mask=QRUtil.getMask(maskPattern,row,col-c);if(mask){dark=!dark;} + this.modules[row][col-c]=dark;bitIndex--;if(bitIndex==-1){byteIndex++;bitIndex=7;}}} + row+=inc;if(row<0||this.moduleCount<=row){row-=inc;inc=-inc;break;}}}}};QRCodeModel.PAD0=0xEC;QRCodeModel.PAD1=0x11;QRCodeModel.createData=function(typeNumber,errorCorrectLevel,dataList){var rsBlocks=QRRSBlock.getRSBlocks(typeNumber,errorCorrectLevel);var buffer=new QRBitBuffer();for(var i=0;itotalDataCount*8){throw new Error("code length overflow. (" + +buffer.getLengthInBits() + +">" + +totalDataCount*8 + +")");} + if(buffer.getLengthInBits()+4<=totalDataCount*8){buffer.put(0,4);} + while(buffer.getLengthInBits()%8!=0){buffer.putBit(false);} + while(true){if(buffer.getLengthInBits()>=totalDataCount*8){break;} + buffer.put(QRCodeModel.PAD0,8);if(buffer.getLengthInBits()>=totalDataCount*8){break;} + buffer.put(QRCodeModel.PAD1,8);} + return QRCodeModel.createBytes(buffer,rsBlocks);};QRCodeModel.createBytes=function(buffer,rsBlocks){var offset=0;var maxDcCount=0;var maxEcCount=0;var dcdata=new Array(rsBlocks.length);var ecdata=new Array(rsBlocks.length);for(var r=0;r=0)?modPoly.get(modIndex):0;}} + var totalCodeCount=0;for(var i=0;i=0){d^=(QRUtil.G15<<(QRUtil.getBCHDigit(d)-QRUtil.getBCHDigit(QRUtil.G15)));} + return((data<<10)|d)^QRUtil.G15_MASK;},getBCHTypeNumber:function(data){var d=data<<12;while(QRUtil.getBCHDigit(d)-QRUtil.getBCHDigit(QRUtil.G18)>=0){d^=(QRUtil.G18<<(QRUtil.getBCHDigit(d)-QRUtil.getBCHDigit(QRUtil.G18)));} + return(data<<12)|d;},getBCHDigit:function(data){var digit=0;while(data!=0){digit++;data>>>=1;} + return digit;},getPatternPosition:function(typeNumber){return QRUtil.PATTERN_POSITION_TABLE[typeNumber-1];},getMask:function(maskPattern,i,j){switch(maskPattern){case QRMaskPattern.PATTERN000:return(i+j)%2==0;case QRMaskPattern.PATTERN001:return i%2==0;case QRMaskPattern.PATTERN010:return j%3==0;case QRMaskPattern.PATTERN011:return(i+j)%3==0;case QRMaskPattern.PATTERN100:return(Math.floor(i/2)+Math.floor(j/3))%2==0;case QRMaskPattern.PATTERN101:return(i*j)%2+(i*j)%3==0;case QRMaskPattern.PATTERN110:return((i*j)%2+(i*j)%3)%2==0;case QRMaskPattern.PATTERN111:return((i*j)%3+(i+j)%2)%2==0;default:throw new Error("bad maskPattern:"+maskPattern);}},getErrorCorrectPolynomial:function(errorCorrectLength){var a=new QRPolynomial([1],0);for(var i=0;i5){lostPoint+=(3+sameCount-5);}}} + for(var row=0;row=256){n-=255;} + return QRMath.EXP_TABLE[n];},EXP_TABLE:new Array(256),LOG_TABLE:new Array(256)};for(var i=0;i<8;i++){QRMath.EXP_TABLE[i]=1<>>(7-index%8))&1)==1;},put:function(num,length){for(var i=0;i>>(length-i-1))&1)==1);}},getLengthInBits:function(){return this.length;},putBit:function(bit){var bufIndex=Math.floor(this.length/8);if(this.buffer.length<=bufIndex){this.buffer.push(0);} + if(bit){this.buffer[bufIndex]|=(0x80>>>(this.length%8));} + this.length++;}};var QRCodeLimitLength=[[17,14,11,7],[32,26,20,14],[53,42,32,24],[78,62,46,34],[106,84,60,44],[134,106,74,58],[154,122,86,64],[192,152,108,84],[230,180,130,98],[271,213,151,119],[321,251,177,137],[367,287,203,155],[425,331,241,177],[458,362,258,194],[520,412,292,220],[586,450,322,250],[644,504,364,280],[718,560,394,310],[792,624,442,338],[858,666,482,382],[929,711,509,403],[1003,779,565,439],[1091,857,611,461],[1171,911,661,511],[1273,997,715,535],[1367,1059,751,593],[1465,1125,805,625],[1528,1190,868,658],[1628,1264,908,698],[1732,1370,982,742],[1840,1452,1030,790],[1952,1538,1112,842],[2068,1628,1168,898],[2188,1722,1228,958],[2303,1809,1283,983],[2431,1911,1351,1051],[2563,1989,1423,1093],[2699,2099,1499,1139],[2809,2213,1579,1219],[2953,2331,1663,1273]]; + + function _isSupportCanvas() { + return typeof CanvasRenderingContext2D != "undefined"; + } + + // android 2.x doesn't support Data-URI spec + function _getAndroid() { + var android = false; + var sAgent = navigator.userAgent; + + if (/android/i.test(sAgent)) { // android + android = true; + var aMat = sAgent.toString().match(/android ([0-9]\.[0-9])/i); + + if (aMat && aMat[1]) { + android = parseFloat(aMat[1]); + } + } + + return android; + } + + var svgDrawer = (function() { + + var Drawing = function (el, htOption) { + this._el = el; + this._htOption = htOption; + }; + + Drawing.prototype.draw = function (oQRCode) { + var _htOption = this._htOption; + var _el = this._el; + var nCount = oQRCode.getModuleCount(); + var nWidth = Math.floor(_htOption.width / nCount); + var nHeight = Math.floor(_htOption.height / nCount); + + this.clear(); + + function makeSVG(tag, attrs) { + var el = document.createElementNS('http://www.w3.org/2000/svg', tag); + for (var k in attrs) + if (attrs.hasOwnProperty(k)) el.setAttribute(k, attrs[k]); + return el; + } + + var svg = makeSVG("svg" , {'viewBox': '0 0 ' + String(nCount) + " " + String(nCount), 'width': '100%', 'height': '100%', 'fill': _htOption.colorLight}); + svg.setAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns:xlink", "http://www.w3.org/1999/xlink"); + _el.appendChild(svg); + + svg.appendChild(makeSVG("rect", {"fill": _htOption.colorLight, "width": "100%", "height": "100%"})); + svg.appendChild(makeSVG("rect", {"fill": _htOption.colorDark, "width": "1", "height": "1", "id": "template"})); + + for (var row = 0; row < nCount; row++) { + for (var col = 0; col < nCount; col++) { + if (oQRCode.isDark(row, col)) { + var child = makeSVG("use", {"x": String(col), "y": String(row)}); + child.setAttributeNS("http://www.w3.org/1999/xlink", "href", "#template") + svg.appendChild(child); + } + } + } + }; + Drawing.prototype.clear = function () { + while (this._el.hasChildNodes()) + this._el.removeChild(this._el.lastChild); + }; + return Drawing; + })(); + + var useSVG = document.documentElement.tagName.toLowerCase() === "svg"; + + // Drawing in DOM by using Table tag + var Drawing = useSVG ? svgDrawer : !_isSupportCanvas() ? (function () { + var Drawing = function (el, htOption) { + this._el = el; + this._htOption = htOption; + }; + + /** + * Draw the QRCode + * + * @param {QRCode} oQRCode + */ + Drawing.prototype.draw = function (oQRCode) { + var _htOption = this._htOption; + var _el = this._el; + var nCount = oQRCode.getModuleCount(); + var nWidth = Math.floor(_htOption.width / nCount); + var nHeight = Math.floor(_htOption.height / nCount); + var aHTML = ['']; + + for (var row = 0; row < nCount; row++) { + aHTML.push(''); + + for (var col = 0; col < nCount; col++) { + aHTML.push(''); + } + + aHTML.push(''); + } + + aHTML.push('
'); + _el.innerHTML = aHTML.join(''); + + // Fix the margin values as real size. + var elTable = _el.childNodes[0]; + var nLeftMarginTable = (_htOption.width - elTable.offsetWidth) / 2; + var nTopMarginTable = (_htOption.height - elTable.offsetHeight) / 2; + + if (nLeftMarginTable > 0 && nTopMarginTable > 0) { + elTable.style.margin = nTopMarginTable + "px " + nLeftMarginTable + "px"; + } + }; + + /** + * Clear the QRCode + */ + Drawing.prototype.clear = function () { + this._el.innerHTML = ''; + }; + + return Drawing; + })() : (function () { // Drawing in Canvas + function _onMakeImage() { + this._elImage.src = this._elCanvas.toDataURL("image/png"); + this._elImage.style.display = "block"; + this._elCanvas.style.display = "none"; + } + + // Android 2.1 bug workaround + // http://code.google.com/p/android/issues/detail?id=5141 + if (this._android && this._android <= 2.1) { + var factor = 1 / window.devicePixelRatio; + var drawImage = CanvasRenderingContext2D.prototype.drawImage; + CanvasRenderingContext2D.prototype.drawImage = function (image, sx, sy, sw, sh, dx, dy, dw, dh) { + if (("nodeName" in image) && /img/i.test(image.nodeName)) { + for (var i = arguments.length - 1; i >= 1; i--) { + arguments[i] = arguments[i] * factor; + } + } else if (typeof dw == "undefined") { + arguments[1] *= factor; + arguments[2] *= factor; + arguments[3] *= factor; + arguments[4] *= factor; + } + + drawImage.apply(this, arguments); + }; + } + + /** + * Check whether the user's browser supports Data URI or not + * + * @private + * @param {Function} fSuccess Occurs if it supports Data URI + * @param {Function} fFail Occurs if it doesn't support Data URI + */ + function _safeSetDataURI(fSuccess, fFail) { + var self = this; + self._fFail = fFail; + self._fSuccess = fSuccess; + + // Check it just once + if (self._bSupportDataURI === null) { + var el = document.createElement("img"); + var fOnError = function() { + self._bSupportDataURI = false; + + if (self._fFail) { + self._fFail.call(self); + } + }; + var fOnSuccess = function() { + self._bSupportDataURI = true; + + if (self._fSuccess) { + self._fSuccess.call(self); + } + }; + + el.onabort = fOnError; + el.onerror = fOnError; + el.onload = fOnSuccess; + el.src = "data:image/gif;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg=="; // the Image contains 1px data. + return; + } else if (self._bSupportDataURI === true && self._fSuccess) { + self._fSuccess.call(self); + } else if (self._bSupportDataURI === false && self._fFail) { + self._fFail.call(self); + } + }; + + /** + * Drawing QRCode by using canvas + * + * @constructor + * @param {HTMLElement} el + * @param {Object} htOption QRCode Options + */ + var Drawing = function (el, htOption) { + this._bIsPainted = false; + this._android = _getAndroid(); + + this._htOption = htOption; + this._elCanvas = document.createElement("canvas"); + this._elCanvas.width = htOption.width; + this._elCanvas.height = htOption.height; + el.appendChild(this._elCanvas); + this._el = el; + this._oContext = this._elCanvas.getContext("2d"); + this._bIsPainted = false; + this._elImage = document.createElement("img"); + this._elImage.alt = "Scan me!"; + this._elImage.style.display = "none"; + this._el.appendChild(this._elImage); + this._bSupportDataURI = null; + }; + + /** + * Draw the QRCode + * + * @param {QRCode} oQRCode + */ + Drawing.prototype.draw = function (oQRCode) { + var _elImage = this._elImage; + var _oContext = this._oContext; + var _htOption = this._htOption; + + var nCount = oQRCode.getModuleCount(); + var nWidth = _htOption.width / nCount; + var nHeight = _htOption.height / nCount; + var nRoundedWidth = Math.round(nWidth); + var nRoundedHeight = Math.round(nHeight); + + _elImage.style.display = "none"; + this.clear(); + + for (var row = 0; row < nCount; row++) { + for (var col = 0; col < nCount; col++) { + var bIsDark = oQRCode.isDark(row, col); + var nLeft = col * nWidth; + var nTop = row * nHeight; + _oContext.strokeStyle = bIsDark ? _htOption.colorDark : _htOption.colorLight; + _oContext.lineWidth = 1; + _oContext.fillStyle = bIsDark ? _htOption.colorDark : _htOption.colorLight; + _oContext.fillRect(nLeft, nTop, nWidth, nHeight); + + // 안티 앨리어싱 방지 처리 + _oContext.strokeRect( + Math.floor(nLeft) + 0.5, + Math.floor(nTop) + 0.5, + nRoundedWidth, + nRoundedHeight + ); + + _oContext.strokeRect( + Math.ceil(nLeft) - 0.5, + Math.ceil(nTop) - 0.5, + nRoundedWidth, + nRoundedHeight + ); + } + } + + this._bIsPainted = true; + }; + + /** + * Make the image from Canvas if the browser supports Data URI. + */ + Drawing.prototype.makeImage = function () { + if (this._bIsPainted) { + _safeSetDataURI.call(this, _onMakeImage); + } + }; + + /** + * Return whether the QRCode is painted or not + * + * @return {Boolean} + */ + Drawing.prototype.isPainted = function () { + return this._bIsPainted; + }; + + /** + * Clear the QRCode + */ + Drawing.prototype.clear = function () { + this._oContext.clearRect(0, 0, this._elCanvas.width, this._elCanvas.height); + this._bIsPainted = false; + }; + + /** + * @private + * @param {Number} nNumber + */ + Drawing.prototype.round = function (nNumber) { + if (!nNumber) { + return nNumber; + } + + return Math.floor(nNumber * 1000) / 1000; + }; + + return Drawing; + })(); + + /** + * Get the type by string length + * + * @private + * @param {String} sText + * @param {Number} nCorrectLevel + * @return {Number} type + */ + function _getTypeNumber(sText, nCorrectLevel) { + var nType = 1; + var length = _getUTF8Length(sText); + + for (var i = 0, len = QRCodeLimitLength.length; i <= len; i++) { + var nLimit = 0; + + switch (nCorrectLevel) { + case QRErrorCorrectLevel.L : + nLimit = QRCodeLimitLength[i][0]; + break; + case QRErrorCorrectLevel.M : + nLimit = QRCodeLimitLength[i][1]; + break; + case QRErrorCorrectLevel.Q : + nLimit = QRCodeLimitLength[i][2]; + break; + case QRErrorCorrectLevel.H : + nLimit = QRCodeLimitLength[i][3]; + break; + } + + if (length <= nLimit) { + break; + } else { + nType++; + } + } + + if (nType > QRCodeLimitLength.length) { + throw new Error("Too long data"); + } + + return nType; + } + + function _getUTF8Length(sText) { + var replacedText = encodeURI(sText).toString().replace(/\%[0-9a-fA-F]{2}/g, 'a'); + return replacedText.length + (replacedText.length != sText ? 3 : 0); + } + + /** + * @class QRCode + * @constructor + * @example + * new QRCode(document.getElementById("test"), "http://jindo.dev.naver.com/collie"); + * + * @example + * var oQRCode = new QRCode("test", { + * text : "http://naver.com", + * width : 128, + * height : 128 + * }); + * + * oQRCode.clear(); // Clear the QRCode. + * oQRCode.makeCode("http://map.naver.com"); // Re-create the QRCode. + * + * @param {HTMLElement|String} el target element or 'id' attribute of element. + * @param {Object|String} vOption + * @param {String} vOption.text QRCode link data + * @param {Number} [vOption.width=256] + * @param {Number} [vOption.height=256] + * @param {String} [vOption.colorDark="#000000"] + * @param {String} [vOption.colorLight="#ffffff"] + * @param {QRCode.CorrectLevel} [vOption.correctLevel=QRCode.CorrectLevel.H] [L|M|Q|H] + */ + QRCode = function (el, vOption) { + this._htOption = { + width : 256, + height : 256, + typeNumber : 4, + colorDark : "#000000", + colorLight : "#ffffff", + correctLevel : QRErrorCorrectLevel.H + }; + + if (typeof vOption === 'string') { + vOption = { + text : vOption + }; + } + + // Overwrites options + if (vOption) { + for (var i in vOption) { + this._htOption[i] = vOption[i]; + } + } + + if (typeof el == "string") { + el = document.getElementById(el); + } + + if (this._htOption.useSVG) { + Drawing = svgDrawer; + } + + this._android = _getAndroid(); + this._el = el; + this._oQRCode = null; + this._oDrawing = new Drawing(this._el, this._htOption); + + if (this._htOption.text) { + this.makeCode(this._htOption.text); + } + }; + + /** + * Make the QRCode + * + * @param {String} sText link data + */ + QRCode.prototype.makeCode = function (sText) { + this._oQRCode = new QRCodeModel(_getTypeNumber(sText, this._htOption.correctLevel), this._htOption.correctLevel); + this._oQRCode.addData(sText); + this._oQRCode.make(); + this._el.title = sText; + this._oDrawing.draw(this._oQRCode); + this.makeImage(); + }; + + /** + * Make the Image from Canvas element + * - It occurs automatically + * - Android below 3 doesn't support Data-URI spec. + * + * @private + */ + QRCode.prototype.makeImage = function () { + if (typeof this._oDrawing.makeImage == "function" && (!this._android || this._android >= 3)) { + this._oDrawing.makeImage(); + } + }; + + /** + * Clear the QRCode + */ + QRCode.prototype.clear = function () { + this._oDrawing.clear(); + }; + + /** + * @name QRCode.CorrectLevel + */ + QRCode.CorrectLevel = QRErrorCorrectLevel; +})(); diff --git a/ready2use/srv/libs/qrcode.min.js b/ready2use/srv/libs/qrcode.min.js new file mode 100755 index 0000000..993e88f --- /dev/null +++ b/ready2use/srv/libs/qrcode.min.js @@ -0,0 +1 @@ +var QRCode;!function(){function a(a){this.mode=c.MODE_8BIT_BYTE,this.data=a,this.parsedData=[];for(var b=[],d=0,e=this.data.length;e>d;d++){var f=this.data.charCodeAt(d);f>65536?(b[0]=240|(1835008&f)>>>18,b[1]=128|(258048&f)>>>12,b[2]=128|(4032&f)>>>6,b[3]=128|63&f):f>2048?(b[0]=224|(61440&f)>>>12,b[1]=128|(4032&f)>>>6,b[2]=128|63&f):f>128?(b[0]=192|(1984&f)>>>6,b[1]=128|63&f):b[0]=f,this.parsedData=this.parsedData.concat(b)}this.parsedData.length!=this.data.length&&(this.parsedData.unshift(191),this.parsedData.unshift(187),this.parsedData.unshift(239))}function b(a,b){this.typeNumber=a,this.errorCorrectLevel=b,this.modules=null,this.moduleCount=0,this.dataCache=null,this.dataList=[]}function i(a,b){if(void 0==a.length)throw new Error(a.length+"/"+b);for(var c=0;c=f;f++){var h=0;switch(b){case d.L:h=l[f][0];break;case d.M:h=l[f][1];break;case d.Q:h=l[f][2];break;case d.H:h=l[f][3]}if(h>=e)break;c++}if(c>l.length)throw new Error("Too long data");return c}function s(a){var b=encodeURI(a).toString().replace(/\%[0-9a-fA-F]{2}/g,"a");return b.length+(b.length!=a?3:0)}a.prototype={getLength:function(){return this.parsedData.length},write:function(a){for(var b=0,c=this.parsedData.length;c>b;b++)a.put(this.parsedData[b],8)}},b.prototype={addData:function(b){var c=new a(b);this.dataList.push(c),this.dataCache=null},isDark:function(a,b){if(0>a||this.moduleCount<=a||0>b||this.moduleCount<=b)throw new Error(a+","+b);return this.modules[a][b]},getModuleCount:function(){return this.moduleCount},make:function(){this.makeImpl(!1,this.getBestMaskPattern())},makeImpl:function(a,c){this.moduleCount=4*this.typeNumber+17,this.modules=new Array(this.moduleCount);for(var d=0;d=7&&this.setupTypeNumber(a),null==this.dataCache&&(this.dataCache=b.createData(this.typeNumber,this.errorCorrectLevel,this.dataList)),this.mapData(this.dataCache,c)},setupPositionProbePattern:function(a,b){for(var c=-1;7>=c;c++)if(!(-1>=a+c||this.moduleCount<=a+c))for(var d=-1;7>=d;d++)-1>=b+d||this.moduleCount<=b+d||(this.modules[a+c][b+d]=c>=0&&6>=c&&(0==d||6==d)||d>=0&&6>=d&&(0==c||6==c)||c>=2&&4>=c&&d>=2&&4>=d?!0:!1)},getBestMaskPattern:function(){for(var a=0,b=0,c=0;8>c;c++){this.makeImpl(!0,c);var d=f.getLostPoint(this);(0==c||a>d)&&(a=d,b=c)}return b},createMovieClip:function(a,b,c){var d=a.createEmptyMovieClip(b,c),e=1;this.make();for(var f=0;f=g;g++)for(var h=-2;2>=h;h++)this.modules[d+g][e+h]=-2==g||2==g||-2==h||2==h||0==g&&0==h?!0:!1}},setupTypeNumber:function(a){for(var b=f.getBCHTypeNumber(this.typeNumber),c=0;18>c;c++){var d=!a&&1==(1&b>>c);this.modules[Math.floor(c/3)][c%3+this.moduleCount-8-3]=d}for(var c=0;18>c;c++){var d=!a&&1==(1&b>>c);this.modules[c%3+this.moduleCount-8-3][Math.floor(c/3)]=d}},setupTypeInfo:function(a,b){for(var c=this.errorCorrectLevel<<3|b,d=f.getBCHTypeInfo(c),e=0;15>e;e++){var g=!a&&1==(1&d>>e);6>e?this.modules[e][8]=g:8>e?this.modules[e+1][8]=g:this.modules[this.moduleCount-15+e][8]=g}for(var e=0;15>e;e++){var g=!a&&1==(1&d>>e);8>e?this.modules[8][this.moduleCount-e-1]=g:9>e?this.modules[8][15-e-1+1]=g:this.modules[8][15-e-1]=g}this.modules[this.moduleCount-8][8]=!a},mapData:function(a,b){for(var c=-1,d=this.moduleCount-1,e=7,g=0,h=this.moduleCount-1;h>0;h-=2)for(6==h&&h--;;){for(var i=0;2>i;i++)if(null==this.modules[d][h-i]){var j=!1;g>>e));var k=f.getMask(b,d,h-i);k&&(j=!j),this.modules[d][h-i]=j,e--,-1==e&&(g++,e=7)}if(d+=c,0>d||this.moduleCount<=d){d-=c,c=-c;break}}}},b.PAD0=236,b.PAD1=17,b.createData=function(a,c,d){for(var e=j.getRSBlocks(a,c),g=new k,h=0;h8*l)throw new Error("code length overflow. ("+g.getLengthInBits()+">"+8*l+")");for(g.getLengthInBits()+4<=8*l&&g.put(0,4);0!=g.getLengthInBits()%8;)g.putBit(!1);for(;;){if(g.getLengthInBits()>=8*l)break;if(g.put(b.PAD0,8),g.getLengthInBits()>=8*l)break;g.put(b.PAD1,8)}return b.createBytes(g,e)},b.createBytes=function(a,b){for(var c=0,d=0,e=0,g=new Array(b.length),h=new Array(b.length),j=0;j=0?p.get(q):0}}for(var r=0,m=0;mm;m++)for(var j=0;jm;m++)for(var j=0;j=0;)b^=f.G15<=0;)b^=f.G18<>>=1;return b},getPatternPosition:function(a){return f.PATTERN_POSITION_TABLE[a-1]},getMask:function(a,b,c){switch(a){case e.PATTERN000:return 0==(b+c)%2;case e.PATTERN001:return 0==b%2;case e.PATTERN010:return 0==c%3;case e.PATTERN011:return 0==(b+c)%3;case e.PATTERN100:return 0==(Math.floor(b/2)+Math.floor(c/3))%2;case e.PATTERN101:return 0==b*c%2+b*c%3;case e.PATTERN110:return 0==(b*c%2+b*c%3)%2;case e.PATTERN111:return 0==(b*c%3+(b+c)%2)%2;default:throw new Error("bad maskPattern:"+a)}},getErrorCorrectPolynomial:function(a){for(var b=new i([1],0),c=0;a>c;c++)b=b.multiply(new i([1,g.gexp(c)],0));return b},getLengthInBits:function(a,b){if(b>=1&&10>b)switch(a){case c.MODE_NUMBER:return 10;case c.MODE_ALPHA_NUM:return 9;case c.MODE_8BIT_BYTE:return 8;case c.MODE_KANJI:return 8;default:throw new Error("mode:"+a)}else if(27>b)switch(a){case c.MODE_NUMBER:return 12;case c.MODE_ALPHA_NUM:return 11;case c.MODE_8BIT_BYTE:return 16;case c.MODE_KANJI:return 10;default:throw new Error("mode:"+a)}else{if(!(41>b))throw new Error("type:"+b);switch(a){case c.MODE_NUMBER:return 14;case c.MODE_ALPHA_NUM:return 13;case c.MODE_8BIT_BYTE:return 16;case c.MODE_KANJI:return 12;default:throw new Error("mode:"+a)}}},getLostPoint:function(a){for(var b=a.getModuleCount(),c=0,d=0;b>d;d++)for(var e=0;b>e;e++){for(var f=0,g=a.isDark(d,e),h=-1;1>=h;h++)if(!(0>d+h||d+h>=b))for(var i=-1;1>=i;i++)0>e+i||e+i>=b||(0!=h||0!=i)&&g==a.isDark(d+h,e+i)&&f++;f>5&&(c+=3+f-5)}for(var d=0;b-1>d;d++)for(var e=0;b-1>e;e++){var j=0;a.isDark(d,e)&&j++,a.isDark(d+1,e)&&j++,a.isDark(d,e+1)&&j++,a.isDark(d+1,e+1)&&j++,(0==j||4==j)&&(c+=3)}for(var d=0;b>d;d++)for(var e=0;b-6>e;e++)a.isDark(d,e)&&!a.isDark(d,e+1)&&a.isDark(d,e+2)&&a.isDark(d,e+3)&&a.isDark(d,e+4)&&!a.isDark(d,e+5)&&a.isDark(d,e+6)&&(c+=40);for(var e=0;b>e;e++)for(var d=0;b-6>d;d++)a.isDark(d,e)&&!a.isDark(d+1,e)&&a.isDark(d+2,e)&&a.isDark(d+3,e)&&a.isDark(d+4,e)&&!a.isDark(d+5,e)&&a.isDark(d+6,e)&&(c+=40);for(var k=0,e=0;b>e;e++)for(var d=0;b>d;d++)a.isDark(d,e)&&k++;var l=Math.abs(100*k/b/b-50)/5;return c+=10*l}},g={glog:function(a){if(1>a)throw new Error("glog("+a+")");return g.LOG_TABLE[a]},gexp:function(a){for(;0>a;)a+=255;for(;a>=256;)a-=255;return g.EXP_TABLE[a]},EXP_TABLE:new Array(256),LOG_TABLE:new Array(256)},h=0;8>h;h++)g.EXP_TABLE[h]=1<h;h++)g.EXP_TABLE[h]=g.EXP_TABLE[h-4]^g.EXP_TABLE[h-5]^g.EXP_TABLE[h-6]^g.EXP_TABLE[h-8];for(var h=0;255>h;h++)g.LOG_TABLE[g.EXP_TABLE[h]]=h;i.prototype={get:function(a){return this.num[a]},getLength:function(){return this.num.length},multiply:function(a){for(var b=new Array(this.getLength()+a.getLength()-1),c=0;cf;f++)for(var g=c[3*f+0],h=c[3*f+1],i=c[3*f+2],k=0;g>k;k++)e.push(new j(h,i));return e},j.getRsBlockTable=function(a,b){switch(b){case d.L:return j.RS_BLOCK_TABLE[4*(a-1)+0];case d.M:return j.RS_BLOCK_TABLE[4*(a-1)+1];case d.Q:return j.RS_BLOCK_TABLE[4*(a-1)+2];case d.H:return j.RS_BLOCK_TABLE[4*(a-1)+3];default:return void 0}},k.prototype={get:function(a){var b=Math.floor(a/8);return 1==(1&this.buffer[b]>>>7-a%8)},put:function(a,b){for(var c=0;b>c;c++)this.putBit(1==(1&a>>>b-c-1))},getLengthInBits:function(){return this.length},putBit:function(a){var b=Math.floor(this.length/8);this.buffer.length<=b&&this.buffer.push(0),a&&(this.buffer[b]|=128>>>this.length%8),this.length++}};var l=[[17,14,11,7],[32,26,20,14],[53,42,32,24],[78,62,46,34],[106,84,60,44],[134,106,74,58],[154,122,86,64],[192,152,108,84],[230,180,130,98],[271,213,151,119],[321,251,177,137],[367,287,203,155],[425,331,241,177],[458,362,258,194],[520,412,292,220],[586,450,322,250],[644,504,364,280],[718,560,394,310],[792,624,442,338],[858,666,482,382],[929,711,509,403],[1003,779,565,439],[1091,857,611,461],[1171,911,661,511],[1273,997,715,535],[1367,1059,751,593],[1465,1125,805,625],[1528,1190,868,658],[1628,1264,908,698],[1732,1370,982,742],[1840,1452,1030,790],[1952,1538,1112,842],[2068,1628,1168,898],[2188,1722,1228,958],[2303,1809,1283,983],[2431,1911,1351,1051],[2563,1989,1423,1093],[2699,2099,1499,1139],[2809,2213,1579,1219],[2953,2331,1663,1273]],o=function(){var a=function(a,b){this._el=a,this._htOption=b};return a.prototype.draw=function(a){function g(a,b){var c=document.createElementNS("http://www.w3.org/2000/svg",a);for(var d in b)b.hasOwnProperty(d)&&c.setAttribute(d,b[d]);return c}var b=this._htOption,c=this._el,d=a.getModuleCount();Math.floor(b.width/d),Math.floor(b.height/d),this.clear();var h=g("svg",{viewBox:"0 0 "+String(d)+" "+String(d),width:"100%",height:"100%",fill:b.colorLight});h.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns:xlink","http://www.w3.org/1999/xlink"),c.appendChild(h),h.appendChild(g("rect",{fill:b.colorDark,width:"1",height:"1",id:"template"}));for(var i=0;d>i;i++)for(var j=0;d>j;j++)if(a.isDark(i,j)){var k=g("use",{x:String(i),y:String(j)});k.setAttributeNS("http://www.w3.org/1999/xlink","href","#template"),h.appendChild(k)}},a.prototype.clear=function(){for(;this._el.hasChildNodes();)this._el.removeChild(this._el.lastChild)},a}(),p="svg"===document.documentElement.tagName.toLowerCase(),q=p?o:m()?function(){function a(){this._elImage.src=this._elCanvas.toDataURL("image/png"),this._elImage.style.display="block",this._elCanvas.style.display="none"}function d(a,b){var c=this;if(c._fFail=b,c._fSuccess=a,null===c._bSupportDataURI){var d=document.createElement("img"),e=function(){c._bSupportDataURI=!1,c._fFail&&_fFail.call(c)},f=function(){c._bSupportDataURI=!0,c._fSuccess&&c._fSuccess.call(c)};return d.onabort=e,d.onerror=e,d.onload=f,d.src="data:image/gif;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==",void 0}c._bSupportDataURI===!0&&c._fSuccess?c._fSuccess.call(c):c._bSupportDataURI===!1&&c._fFail&&c._fFail.call(c)}if(this._android&&this._android<=2.1){var b=1/window.devicePixelRatio,c=CanvasRenderingContext2D.prototype.drawImage;CanvasRenderingContext2D.prototype.drawImage=function(a,d,e,f,g,h,i,j){if("nodeName"in a&&/img/i.test(a.nodeName))for(var l=arguments.length-1;l>=1;l--)arguments[l]=arguments[l]*b;else"undefined"==typeof j&&(arguments[1]*=b,arguments[2]*=b,arguments[3]*=b,arguments[4]*=b);c.apply(this,arguments)}}var e=function(a,b){this._bIsPainted=!1,this._android=n(),this._htOption=b,this._elCanvas=document.createElement("canvas"),this._elCanvas.width=b.width,this._elCanvas.height=b.height,a.appendChild(this._elCanvas),this._el=a,this._oContext=this._elCanvas.getContext("2d"),this._bIsPainted=!1,this._elImage=document.createElement("img"),this._elImage.style.display="none",this._el.appendChild(this._elImage),this._bSupportDataURI=null};return e.prototype.draw=function(a){var b=this._elImage,c=this._oContext,d=this._htOption,e=a.getModuleCount(),f=d.width/e,g=d.height/e,h=Math.round(f),i=Math.round(g);b.style.display="none",this.clear();for(var j=0;e>j;j++)for(var k=0;e>k;k++){var l=a.isDark(j,k),m=k*f,n=j*g;c.strokeStyle=l?d.colorDark:d.colorLight,c.lineWidth=1,c.fillStyle=l?d.colorDark:d.colorLight,c.fillRect(m,n,f,g),c.strokeRect(Math.floor(m)+.5,Math.floor(n)+.5,h,i),c.strokeRect(Math.ceil(m)-.5,Math.ceil(n)-.5,h,i)}this._bIsPainted=!0},e.prototype.makeImage=function(){this._bIsPainted&&d.call(this,a)},e.prototype.isPainted=function(){return this._bIsPainted},e.prototype.clear=function(){this._oContext.clearRect(0,0,this._elCanvas.width,this._elCanvas.height),this._bIsPainted=!1},e.prototype.round=function(a){return a?Math.floor(1e3*a)/1e3:a},e}():function(){var a=function(a,b){this._el=a,this._htOption=b};return a.prototype.draw=function(a){for(var b=this._htOption,c=this._el,d=a.getModuleCount(),e=Math.floor(b.width/d),f=Math.floor(b.height/d),g=[''],h=0;d>h;h++){g.push("");for(var i=0;d>i;i++)g.push('');g.push("")}g.push("
"),c.innerHTML=g.join("");var j=c.childNodes[0],k=(b.width-j.offsetWidth)/2,l=(b.height-j.offsetHeight)/2;k>0&&l>0&&(j.style.margin=l+"px "+k+"px")},a.prototype.clear=function(){this._el.innerHTML=""},a}();QRCode=function(a,b){if(this._htOption={width:256,height:256,typeNumber:4,colorDark:"#000000",colorLight:"#ffffff",correctLevel:d.H},"string"==typeof b&&(b={text:b}),b)for(var c in b)this._htOption[c]=b[c];"string"==typeof a&&(a=document.getElementById(a)),this._android=n(),this._el=a,this._oQRCode=null,this._oDrawing=new q(this._el,this._htOption),this._htOption.text&&this.makeCode(this._htOption.text)},QRCode.prototype.makeCode=function(a){this._oQRCode=new b(r(a,this._htOption.correctLevel),this._htOption.correctLevel),this._oQRCode.addData(a),this._oQRCode.make(),this._el.title=a,this._oDrawing.draw(this._oQRCode),this.makeImage()},QRCode.prototype.makeImage=function(){"function"==typeof this._oDrawing.makeImage&&(!this._android||this._android>=3)&&this._oDrawing.makeImage()},QRCode.prototype.clear=function(){this._oDrawing.clear()},QRCode.CorrectLevel=d}(); \ No newline at end of file diff --git a/ready2use/srv/libs/webtorrent.min.js b/ready2use/srv/libs/webtorrent.min.js new file mode 100644 index 0000000..3b70ecc --- /dev/null +++ b/ready2use/srv/libs/webtorrent.min.js @@ -0,0 +1 @@ +(function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"==typeof window?"undefined"==typeof global?"undefined"==typeof self?this:self:global:window,t.WebTorrent=e()}})(function(){var t=Math.abs,n=Math.pow,r=Math.floor,e=String.fromCharCode,o=Math.ceil,a=Math.max,s=Math.min,i;return function(){function s(d,e,n){function t(o,i){if(!e[o]){if(!d[o]){var l="function"==typeof require&&require;if(!i&&l)return l(o,!0);if(r)return r(o,!0);var c=new Error("Cannot find module '"+o+"'");throw c.code="MODULE_NOT_FOUND",c}var a=e[o]={exports:{}};d[o][0].call(a.exports,function(e){var r=d[o][1][e];return t(r||e)},a,a.exports,s,d,e,n)}return e[o].exports}for(var r="function"==typeof require&&require,o=0;o(this._notifying=!1,this.destroyed?void 0:t?this._destroy(t):void(n("read %s (length %s) (err %s)",e,r.length,t&&t.message),this._offset&&(r=r.slice(this._offset),this._offset=0),this._missing{e.end()}),e}const t=new f(this,e);return this._torrent.select(t._startPiece,t._endPiece,!0,()=>{t._notify()}),i(t,()=>{this._destroyed||!this._torrent.destroyed&&this._torrent.deselect(t._startPiece,t._endPiece,!0)}),t}getBuffer(e){p(this.createReadStream(),this.length,e)}getBlob(e){if("undefined"==typeof window)throw new Error("browser-only method");c(this.createReadStream(),this._getMimeType(),e)}getBlobURL(e){if("undefined"==typeof window)throw new Error("browser-only method");u(this.createReadStream(),this._getMimeType(),e)}appendTo(e,t,n){if("undefined"==typeof window)throw new Error("browser-only method");l.append(this,e,t,n)}renderTo(e,t,n){if("undefined"==typeof window)throw new Error("browser-only method");l.render(this,e,t,n)}_getMimeType(){return l.mime[d.extname(this.name).toLowerCase()]}_destroy(){this._destroyed=!0,this._torrent=null}}t.exports=h}).call(this,e("_process"))},{"./file-stream":1,_process:132,"end-of-stream":65,events:42,path:129,"readable-stream":162,"render-media":163,"stream-to-blob":207,"stream-to-blob-url":206,"stream-with-known-length-to-buffer":208}],3:[function(e,t,n){const r=e("unordered-array-remove"),o=e("debug")("webtorrent:peer"),i=e("bittorrent-protocol"),a=e("./webconn");n.createWebRTCPeer=(e,t)=>{const n=new s(e.id,"webrtc");return n.conn=e,n.swarm=t,n.conn.connected?n.onConnect():(n.conn.once("connect",()=>{n.onConnect()}),n.conn.once("error",e=>{n.destroy(e)}),n.startConnectTimeout()),n},n.createTCPIncomingPeer=e=>{const t=`${e.remoteAddress}:${e.remotePort}`,n=new s(t,"tcpIncoming");return n.conn=e,n.addr=t,n.onConnect(),n},n.createTCPOutgoingPeer=(e,t)=>{const n=new s(e,"tcpOutgoing");return n.addr=e,n.swarm=t,n},n.createWebSeedPeer=(e,t)=>{const n=new s(e,"webSeed");return n.swarm=t,n.conn=new a(e,t),n.onConnect(),n};class s{constructor(e,t){this.id=e,this.type=t,o("new %s Peer %s",t,e),this.addr=null,this.conn=null,this.swarm=null,this.wire=null,this.connected=!1,this.destroyed=!1,this.timeout=null,this.retries=0,this.sentHandshake=!1}onConnect(){if(!this.destroyed){this.connected=!0,o("Peer %s connected",this.id),clearTimeout(this.connectTimeout);const e=this.conn;e.once("end",()=>{this.destroy()}),e.once("close",()=>{this.destroy()}),e.once("finish",()=>{this.destroy()}),e.once("error",e=>{this.destroy(e)});const t=this.wire=new i;t.type=this.type,t.once("end",()=>{this.destroy()}),t.once("close",()=>{this.destroy()}),t.once("finish",()=>{this.destroy()}),t.once("error",e=>{this.destroy(e)}),t.once("handshake",(e,t)=>{this.onHandshake(e,t)}),this.startHandshakeTimeout(),e.pipe(t).pipe(e),this.swarm&&!this.sentHandshake&&this.handshake()}}onHandshake(e,t){if(!this.swarm)return;if(this.destroyed)return;if(this.swarm.destroyed)return this.destroy(new Error("swarm already destroyed"));if(e!==this.swarm.infoHash)return this.destroy(new Error("unexpected handshake info hash for this swarm"));if(t===this.swarm.peerId)return this.destroy(new Error("refusing to connect to ourselves"));o("Peer %s got handshake %s",this.id,e),clearTimeout(this.handshakeTimeout),this.retries=0;let n=this.addr;!n&&this.conn.remoteAddress&&this.conn.remotePort&&(n=`${this.conn.remoteAddress}:${this.conn.remotePort}`),this.swarm._onWire(this.wire,n);this.swarm&&!this.swarm.destroyed&&(this.sentHandshake||this.handshake())}handshake(){const e={dht:!this.swarm.private&&!!this.swarm.client.dht};this.wire.handshake(this.swarm.infoHash,this.swarm.client.peerId,e),this.sentHandshake=!0}startConnectTimeout(){clearTimeout(this.connectTimeout),this.connectTimeout=setTimeout(()=>{this.destroy(new Error("connect timeout"))},"webrtc"===this.type?25e3:5e3),this.connectTimeout.unref&&this.connectTimeout.unref()}startHandshakeTimeout(){clearTimeout(this.handshakeTimeout),this.handshakeTimeout=setTimeout(()=>{this.destroy(new Error("handshake timeout"))},25e3),this.handshakeTimeout.unref&&this.handshakeTimeout.unref()}destroy(e){if(this.destroyed)return;this.destroyed=!0,this.connected=!1,o("destroy %s (error: %s)",this.id,e&&(e.message||e)),clearTimeout(this.connectTimeout),clearTimeout(this.handshakeTimeout);const t=this.swarm,n=this.conn,i=this.wire;this.swarm=null,this.conn=null,this.wire=null,t&&i&&r(t.wires,t.wires.indexOf(i)),n&&(n.on("error",()=>{}),n.destroy()),i&&i.destroy(),t&&t.removePeer(this.id)}}},{"./webconn":6,"bittorrent-protocol":14,debug:62,"unordered-array-remove":219}],4:[function(e,t){t.exports=class{constructor(e){this._torrent=e,this._numPieces=e.pieces.length,this._pieces=Array(this._numPieces),this._onWire=e=>{this.recalculate(),this._initWire(e)},this._onWireHave=e=>{this._pieces[e]+=1},this._onWireBitfield=()=>{this.recalculate()},this._torrent.wires.forEach(e=>{this._initWire(e)}),this._torrent.on("wire",this._onWire),this.recalculate()}getRarestPiece(e){let t=[],n=1/0;for(let r=0;r{this._cleanupWireEvents(e)}),this._torrent=null,this._pieces=null,this._onWire=null,this._onWireHave=null,this._onWireBitfield=null}_initWire(e){e._onClose=()=>{this._cleanupWireEvents(e);for(let t=0;t{this.destroyed||this._onParsedTorrent(t)})):C.remote(e,(e,t)=>this.destroyed?void 0:e?this._destroy(e):void this._onParsedTorrent(t))}_onParsedTorrent(e){if(!this.destroyed){if(this._processParsedTorrent(e),!this.infoHash)return this._destroy(new Error("Malformed torrent data: No info hash"));(this.path||(this.path=L.join(Y,this.infoHash)),this._rechokeIntervalId=setInterval(()=>{this._rechoke()},1e4),this._rechokeIntervalId.unref&&this._rechokeIntervalId.unref(),this.emit("_infoHash",this.infoHash),!this.destroyed)&&(this.emit("infoHash",this.infoHash),this.destroyed||(this.client.listening?this._onListening():this.client.once("listening",()=>{this._onListening()})))}}_processParsedTorrent(e){this._debugId=e.infoHash.toString("hex").substring(0,7),this.announce&&(e.announce=e.announce.concat(this.announce)),this.client.tracker&&r.WEBTORRENT_ANNOUNCE&&!this.private&&(e.announce=e.announce.concat(r.WEBTORRENT_ANNOUNCE)),this.urlList&&(e.urlList=e.urlList.concat(this.urlList)),U(e.announce),U(e.urlList),Object.assign(this,e),this.magnetURI=C.toMagnetURI(e),this.torrentFile=C.toTorrentFile(e)}_onListening(){if(this.discovery||this.destroyed)return;let e=this.client.tracker;e&&(e=Object.assign({},this.client.tracker,{getAnnounceOpts:()=>{const e={uploaded:this.uploaded,downloaded:this.downloaded,left:a(this.length-this.downloaded,0)};return this.client.tracker.getAnnounceOpts&&Object.assign(e,this.client.tracker.getAnnounceOpts()),this._getAnnounceOpts&&Object.assign(e,this._getAnnounceOpts()),e}})),this.discovery=new m({infoHash:this.infoHash,announce:this.announce,peerId:this.client.peerId,dht:!this.private&&this.client.dht,tracker:e,port:this.client.torrentPort,userAgent:K}),this.discovery.on("error",e=>{this._destroy(e)}),this.discovery.on("peer",e=>{"string"==typeof e&&this.done||this.addPeer(e)}),this.discovery.on("trackerAnnounce",()=>{this.emit("trackerAnnounce"),0===this.numPeers&&this.emit("noPeers","tracker")}),this.discovery.on("dhtAnnounce",()=>{this.emit("dhtAnnounce"),0===this.numPeers&&this.emit("noPeers","dht")}),this.discovery.on("warning",e=>{this.emit("warning",e)}),this.info?this._onMetadata(this):this.xs&&this._getMetadataFromServer()}_getMetadataFromServer(){function e(e,n){function r(r,o,i){if(t.destroyed)return n(null);if(t.metadata)return n(null);if(r)return t.emit("warning",new Error(`http error from xs param: ${e}`)),n(null);if(200!==o.statusCode)return t.emit("warning",new Error(`non-200 status code ${o.statusCode} from xs param: ${e}`)),n(null);let a;try{a=C(i)}catch(e){}return a?a.infoHash===t.infoHash?void(t._onMetadata(a),n(null)):(t.emit("warning",new Error(`got torrent file with incorrect info hash from xs param: ${e}`)),n(null)):(t.emit("warning",new Error(`got invalid torrent file from xs param: ${e}`)),n(null))}if(0!==e.indexOf("http://")&&0!==e.indexOf("https://"))return t.emit("warning",new Error(`skipping non-http xs param: ${e}`)),n(null);let o;try{o=y.concat({url:e,method:"GET",headers:{"user-agent":K}},r)}catch(r){return t.emit("warning",new Error(`skipping invalid url xs param: ${e}`)),n(null)}t._xsRequests.push(o)}const t=this,n=Array.isArray(this.xs)?this.xs:[this.xs],r=n.map(t=>n=>{e(t,n)});v(r)}_onMetadata(e){if(this.metadata||this.destroyed)return;this._debug("got metadata"),this._xsRequests.forEach(e=>{e.abort()}),this._xsRequests=[];let t;if(e&&e.infoHash)t=e;else try{t=C(e)}catch(e){return this._destroy(e)}if(this._processParsedTorrent(t),this.metadata=this.torrentFile,this.client.enableWebSeeds&&this.urlList.forEach(e=>{this.addWebSeed(e)}),this._rarityMap=new H(this),this.store=new w(new this._store(this.pieceLength,{torrent:{infoHash:this.infoHash},files:this.files.map(e=>({path:L.join(this.path,e.path),length:e.length,offset:e.offset})),length:this.length,name:this.infoHash})),this.files=this.files.map(e=>new j(this,e)),this.so){const e=O.parse(this.so);this.files.forEach((t,n)=>{e.includes(n)&&this.files[n].select(!0)})}else 0!==this.pieces.length&&this.select(0,this.pieces.length-1,!1);this._hashes=this.pieces,this.pieces=this.pieces.map((e,t)=>{const n=t===this.pieces.length-1?this.lastPieceLength:this.pieceLength;return new B(n)}),this._reservations=this.pieces.map(()=>[]),this.bitfield=new p(this.pieces.length),this.wires.forEach(e=>{e.ut_metadata&&e.ut_metadata.setMetadata(this.metadata),this._onWireWithMetadata(e)}),this.skipVerify?(this._markAllVerified(),this._onStore()):(this._debug("verifying existing torrent data"),this._fileModtimes&&this._store===b?this.getFileModtimes((e,t)=>{if(e)return this._destroy(e);const n=this.files.map((e,n)=>t[n]===this._fileModtimes[n]).every(e=>e);n?(this._markAllVerified(),this._onStore()):this._verifyPieces()}):this._verifyPieces()),this.emit("metadata")}getFileModtimes(e){const t=[];E(this.files.map((e,n)=>r=>{_.stat(L.join(this.path,e.path),(e,o)=>e&&"ENOENT"!==e.code?r(e):void(t[n]=o&&o.mtime.getTime(),r(null)))}),z,n=>{this._debug("done getting file modtimes"),e(n,t)})}_verifyPieces(){E(this.pieces.map((e,t)=>e=>this.destroyed?e(new Error("torrent is destroyed")):void this.store.get(t,(r,o)=>this.destroyed?e(new Error("torrent is destroyed")):r?n.nextTick(e,null):void R(o,n=>{if(this.destroyed)return e(new Error("torrent is destroyed"));if(n===this._hashes[t]){if(!this.pieces[t])return;this._debug("piece verified %s",t),this._markVerified(t)}else this._debug("piece invalid %s",t);e(null)}))),z,e=>e?this._destroy(e):void(this._debug("done verifying"),this._onStore()))}_markAllVerified(){for(let e=0;e{e.abort()}),this._rarityMap&&this._rarityMap.destroy(),this._peers)this.removePeer(e);this.files.forEach(e=>{e instanceof j&&e._destroy()});const n=this._servers.map(e=>t=>{e.destroy(t)});this.discovery&&n.push(e=>{this.discovery.destroy(e)}),this.store&&n.push(e=>{this.store.close(e)}),v(n,t),e&&(0===this.listenerCount("error")?this.client.emit("error",e):this.emit("error",e)),this.emit("close"),this.client=null,this.files=[],this.discovery=null,this.store=null,this._rarityMap=null,this._peers=null,this._servers=null,this._xsRequests=null}}addPeer(t){if(this.destroyed)throw new Error("torrent is destroyed");if(!this.infoHash)throw new Error("addPeer() must not be called before the `infoHash` event");if(this.client.blocked){let e;if("string"==typeof t){let n;try{n=u(t)}catch(n){return this._debug("ignoring peer: invalid %s",t),this.emit("invalidPeer",t),!1}e=n[0]}else"string"==typeof t.remoteAddress&&(e=t.remoteAddress);if(e&&this.client.blocked.contains(e))return this._debug("ignoring peer: blocked %s",t),"string"!=typeof t&&t.destroy(),this.emit("blockedPeer",t),!1}const e=!!this._addPeer(t);return e?this.emit("peer",t):this.emit("invalidPeer",t),e}_addPeer(e){if(this.destroyed)return"string"!=typeof e&&e.destroy(),null;if("string"==typeof e&&!this._validAddr(e))return this._debug("ignoring peer: invalid %s",e),null;const t=e&&e.id||e;if(this._peers[t])return this._debug("ignoring peer: duplicate (%s)",t),"string"!=typeof e&&e.destroy(),null;if(this.paused)return this._debug("ignoring peer: torrent is paused"),"string"!=typeof e&&e.destroy(),null;this._debug("add peer %s",t);let n;return n="string"==typeof e?N.createTCPOutgoingPeer(e,this):N.createWebRTCPeer(e,this),this._peers[n.id]=n,this._peersLength+=1,"string"==typeof e&&(this._queue.push(n),this._drain()),n}addWebSeed(e){if(this.destroyed)throw new Error("torrent is destroyed");if(!/^https?:\/\/.+/.test(e))return this.emit("warning",new Error(`ignoring invalid web seed: ${e}`)),void this.emit("invalidPeer",e);if(this._peers[e])return this.emit("warning",new Error(`ignoring duplicate web seed: ${e}`)),void this.emit("invalidPeer",e);this._debug("add web seed %s",e);const t=N.createWebSeedPeer(e,this);this._peers[t.id]=t,this._peersLength+=1,this.emit("peer",e)}_addIncomingPeer(e){return this.destroyed?e.destroy(new Error("torrent is destroyed")):this.paused?e.destroy(new Error("torrent is paused")):void(this._debug("add incoming peer %s",e.id),this._peers[e.id]=e,this._peersLength+=1)}removePeer(e){const t=e&&e.id||e;e=this._peers[t];e&&(this._debug("removePeer %s",t),delete this._peers[t],this._peersLength-=1,e.destroy(),this._drain())}select(e,t,n,r){if(this.destroyed)throw new Error("torrent is destroyed");if(0>e||tt.priority-e.priority),this._updateSelections()}deselect(e,t,n){if(this.destroyed)throw new Error("torrent is destroyed");n=+n||0,this._debug("deselect %s-%s (priority %s)",e,t,n);for(let r=0;r{this.destroyed||(this.received+=e,this._downloadSpeed(e),this.client._downloadSpeed(e),this.emit("download",e),this.client.emit("download",e))}),e.on("upload",e=>{this.destroyed||(this.uploaded+=e,this._uploadSpeed(e),this.client._uploadSpeed(e),this.emit("upload",e),this.client.emit("upload",e))}),this.wires.push(e),t){const n=u(t);e.remoteAddress=n[0],e.remotePort=n[1]}this.client.dht&&this.client.dht.listening&&e.on("port",n=>this.destroyed||this.client.dht.destroyed?void 0:e.remoteAddress?0===n||65536{this._debug("wire timeout (%s)",t),e.destroy()}),e.setTimeout(3e4,!0),e.setKeepAlive(!0),e.use(P(this.metadata)),e.ut_metadata.on("warning",e=>{this._debug("ut_metadata warning: %s",e.message)}),this.metadata||(e.ut_metadata.on("metadata",e=>{this._debug("got metadata via ut_metadata"),this._onMetadata(e)}),e.ut_metadata.fetch()),"function"!=typeof M||this.private||(e.use(M()),e.ut_pex.on("peer",e=>{this.done||(this._debug("ut_pex: got peer: %s (from %s)",e,t),this.addPeer(e))}),e.ut_pex.on("dropped",e=>{const n=this._peers[e];n&&!n.connected&&(this._debug("ut_pex: dropped peer: %s (from %s)",e,t),this.removePeer(e))}),e.once("close",()=>{e.ut_pex.reset()})),this.emit("wire",e,t),this.metadata&&n.nextTick(()=>{this._onWireWithMetadata(e)})}_onWireWithMetadata(e){let t=null;const n=()=>{this.destroyed||e.destroyed||(this._numQueued>2*(this._numConns-this.numPeers)&&e.amInterested?e.destroy():(t=setTimeout(n,D),t.unref&&t.unref()))};let r;const o=()=>{if(e.peerPieces.buffer.length===this.bitfield.buffer.length){for(r=0;r{o(),this._update()}),e.on("have",()=>{o(),this._update()}),e.once("interested",()=>{e.unchoke()}),e.once("close",()=>{clearTimeout(t)}),e.on("choke",()=>{clearTimeout(t),t=setTimeout(n,D),t.unref&&t.unref()}),e.on("unchoke",()=>{clearTimeout(t),this._update()}),e.on("request",(t,n,r,o)=>r>131072?e.destroy():void(this.pieces[t]||this.store.get(t,{offset:n,length:r},o))),e.bitfield(this.bitfield),e.uninterested(),e.peerExtensions.dht&&this.client.dht&&this.client.dht.listening&&e.port(this.client.dht.address().port),"webSeed"!==e.type&&(t=setTimeout(n,D),t.unref&&t.unref()),e.isSeeder=!1,o()}_updateSelections(){!this.ready||this.destroyed||(n.nextTick(()=>{this._gcSelections()}),this._updateInterest(),this._update())}_gcSelections(){for(let e=0;e{let t=!1;for(let n=0;na>=t&&a<=n&&!(a in r)&&e.peerPieces.get(a)&&(!o||o(a))}function n(){const t=e.downloadSpeed()||1;if(t>F)return()=>!0;const n=a(1,e.requests.length)*B.BLOCK_LENGTH/t;let r=10,o=0;return e=>{if(!r||s.bitfield.get(e))return!0;for(let i=s.pieces[e].missing;o=l)return!0;const a=n();for(let n=0;nd));){for(;s._request(e,d,s._critical[d]||o););if(e.requests.lengtho));){if(s._request(e,o,!1))return;a[o]=!0,d+=1}}else for(o=r.to;o>=r.from+r.offset;--o)if(e.peerPieces.get(o)&&s._request(e,o,!1))return}}();const i=d(e,.5);if(e.requests.length>=i)return;const l=d(e,W);o(!1)||o(!0)}_rechoke(){if(!this.ready)return;0{t.isSeeder||t===this._rechokeOptimisticWire||e.push({wire:t,downloadSpeed:t.downloadSpeed(),uploadSpeed:t.uploadSpeed(),salt:Math.random(),isChoked:!0})}),e.sort(function(e,t){return e.downloadSpeed===t.downloadSpeed?e.uploadSpeed===t.uploadSpeed?e.wire.amChoking===t.wire.amChoking?e.salt-t.salt:e.wire.amChoking?1:-1:t.uploadSpeed-e.uploadSpeed:t.downloadSpeed-e.downloadSpeed});let t=0,n=0;for(;ne.wire.peerInterested),r=t[c(t.length)];r&&(r.isChoked=!1,this._rechokeOptimisticWire=r.wire,this._rechokeOptimisticTime=2)}e.forEach(e=>{e.wire.amChoking!==e.isChoked&&(e.isChoked?e.wire.choke():e.wire.unchoke())})}_hotswap(e,t){const n=e.downloadSpeed();if(n=F||2*i>n||i>r||(a=t,r=i)}if(!a)return!1;for(s=0;s{c._update()})}const c=this,u=e.requests.length,p="webSeed"===e.type;if(c.bitfield.get(t))return!1;const f=p?s(l(e,W,c.pieceLength),c.maxWebConns):d(e,W);if(u>=f)return!1;const h=c.pieces[t];let m=p?h.reserveRemaining():h.reserve();if(-1===m&&o&&c._hotswap(e,t)&&(m=p?h.reserveRemaining():h.reserve()),-1===m)return!1;let g=c._reservations[t];g||(g=c._reservations[t]=[]);let _=g.indexOf(null);-1===_&&(_=g.length),g[_]=e;const b=h.chunkOffset(m),y=p?h.chunkLengthRemaining(m):h.chunkLength(m);return e.request(t,b,y,function n(r,o){if(c.destroyed)return;if(!c.ready)return c.once("ready",()=>{n(r,o)});if(g[_]===e&&(g[_]=null),h!==c.pieces[t])return a();if(r)return c._debug("error getting piece %s (offset: %s length: %s) from %s: %s",t,b,y,`${e.remoteAddress}:${e.remotePort}`,r.message),p?h.cancelRemaining(m):h.cancel(m),void a();if(c._debug("got piece %s (offset: %s length: %s) from %s",t,b,y,`${e.remoteAddress}:${e.remotePort}`),!h.set(m,o,e))return a();const i=h.flush();R(i,e=>{if(!c.destroyed){if(e===c._hashes[t]){if(!c.pieces[t])return;c._debug("piece verified %s",t),c.pieces[t]=null,c._reservations[t]=null,c.bitfield.set(t,!0),c.store.put(t,i),c.wires.forEach(e=>{e.have(t)}),c._checkDone()&&!c.destroyed&&c.discovery.complete()}else c.pieces[t]=new B(h.length),c.emit("warning",new Error(`Piece ${t} failed verification`));a()}})}),!0}_checkDone(){if(this.destroyed)return;this.files.forEach(e=>{if(!e.done){for(let t=e._startPiece;t<=e._endPiece;++t)if(!this.bitfield.get(t))return;e.done=!0,e.emit("done"),this._debug(`file done: ${e.name}`)}});let e=!0;for(let t=0;t{this.load(e,t)});Array.isArray(e)||(e=[e]),t||(t=i);const n=new k(e),r=new f(this.store,this.pieceLength);I(n,r,e=>e?t(e):void(this._markAllVerified(),this._checkDone(),t(null)))}createServer(e){if("function"!=typeof q)throw new Error("node.js-only method");if(this.destroyed)throw new Error("torrent is destroyed");const t=new q(this,e);return this._servers.push(t),t}pause(){this.destroyed||(this._debug("pause"),this.paused=!0)}resume(){this.destroyed||(this._debug("resume"),this.paused=!1,this._drain())}_debug(){const e=[].slice.call(arguments);e[0]=`[${this.client._debugId}] [${this._debugId}] ${e[0]}`,h(...e)}_drain(){if(this._debug("_drain numConns %s maxConns %s",this._numConns,this.client.maxConns),"function"!=typeof x.connect||this.destroyed||this.paused||this._numConns>=this.client.maxConns)return;this._debug("drain (%s queued, %s/%s peers)",this._numQueued,this.numPeers,this.client.maxConns);const e=this._queue.shift();if(!e)return;this._debug("tcp connect attempt to %s",e.addr);const t=u(e.addr),n={host:t[0],port:t[1]},r=e.conn=x.connect(n);r.once("connect",()=>{e.onConnect()}),r.once("error",t=>{e.destroy(t)}),e.startConnectTimeout(),r.on("close",()=>{if(!this.destroyed){if(e.retries>=V.length)return void this._debug("conn %s closed: will not re-add (max %s attempts)",e.addr,V.length);const t=V[e.retries];this._debug("conn %s closed: will re-add to queue in %sms (attempt %s)",e.addr,t,e.retries+1);const n=setTimeout(()=>{const t=this._addPeer(e.addr);t&&(t.retries=e.retries+1)},t);n.unref&&n.unref()}})}_validAddr(e){let t;try{t=u(e)}catch(t){return!1}const n=t[0],r=t[1];return 0r&&("127.0.0.1"!==n||r!==this.client.torrentPort)}}t.exports=X}).call(this,e("_process"),"undefined"==typeof global?"undefined"==typeof self?"undefined"==typeof window?{}:window:self:global)},{"../package.json":229,"./file":2,"./peer":3,"./rarity-map":4,"./server":39,_process:132,"addr-to-ip-port":7,bitfield:13,"chunk-store-stream/write":58,debug:62,events:42,fs:40,"fs-chunk-store":98,"immediate-chunk-store":79,multistream:115,net:39,os:39,"parse-numeric-range":127,"parse-torrent":128,path:129,pump:133,"random-iterate":138,"run-parallel":166,"run-parallel-limit":165,"simple-get":170,"simple-sha1":181,speedometer:192,"torrent-discovery":214,"torrent-piece":215,uniq:218,ut_metadata:222,ut_pex:39}],6:[function(e,t){const n=e("bitfield"),r=e("safe-buffer").Buffer,o=e("debug")("webtorrent:webconn"),i=e("simple-get"),d=e("simple-sha1"),l=e("bittorrent-protocol"),c=e("../package.json").version;t.exports=class extends l{constructor(e,t){super(),this.url=e,this.webPeerId=d.sync(e),this._torrent=t,this._init()}_init(){this.setKeepAlive(!0),this.once("handshake",e=>{if(this.destroyed)return;this.handshake(e,this.webPeerId);const t=this._torrent.pieces.length,r=new n(t);for(let n=0;n<=t;n++)r.set(n,!0);this.bitfield(r)}),this.once("interested",()=>{o("interested"),this.unchoke()}),this.on("uninterested",()=>{o("uninterested")}),this.on("choke",()=>{o("choke")}),this.on("unchoke",()=>{o("unchoke")}),this.on("bitfield",()=>{o("bitfield")}),this.on("request",(e,t,n,r)=>{o("request pieceIndex=%d offset=%d length=%d",e,t,n),this.httpRequest(e,t,n,r)})}httpRequest(e,t,n,d){const l=e*this._torrent.pieceLength,u=l+t,p=u+n-1,f=this._torrent.files;let h;if(1>=f.length)h=[{url:this.url,start:u,end:p}];else{const e=f.filter(e=>e.offset<=p&&e.offset+e.length>u);if(1>e.length)return d(new Error("Could not find file corresponnding to web seed range request"));h=e.map(e=>{const t=e.offset+e.length-1,n=this.url+("/"===this.url[this.url.length-1]?"":"/")+e.path;return{url:n,fileOffsetInRange:a(e.offset-u,0),start:a(u-e.offset,0),end:s(t,p-e.offset)}})}let m=0,g=!1,_;1{function a(e,t){return 200>e.statusCode||300<=e.statusCode?(g=!0,d(new Error(`Unexpected HTTP status code ${e.statusCode}`))):void(o("Got data of length %d",t.length),1===h.length?d(null,t):(t.copy(_,r.fileOffsetInRange),++m===h.length&&d(null,_)))}const s=r.url,l=r.start,u=r.end;o("Requesting url=%s pieceIndex=%d offset=%d length=%d start=%d end=%d",s,e,t,n,l,u);const p={url:s,method:"GET",headers:{"user-agent":`WebTorrent/${c} (https://webtorrent.io)`,range:`bytes=${l}-${u}`}};i.concat(p,(e,t,n)=>g?void 0:e?"undefined"==typeof window||s.startsWith(`${window.location.origin}/`)?(g=!0,d(e)):i.head(s,(t,n)=>g?void 0:t?(g=!0,d(t)):200>n.statusCode||300<=n.statusCode?(g=!0,d(new Error(`Unexpected HTTP status code ${n.statusCode}`))):n.url===s?(g=!0,d(e)):void(p.url=n.url,i.concat(p,(e,t,n)=>g?void 0:e?(g=!0,d(e)):void a(t,n)))):void a(t,n))})}destroy(){super.destroy(),this._torrent=null}}},{"../package.json":229,bitfield:13,"bittorrent-protocol":14,debug:62,"safe-buffer":168,"simple-get":170,"simple-sha1":181}],7:[function(e,t){const n=/^\[?([^\]]+)\]?:(\d+)$/;let r={},o=0;t.exports=function(e){if(1e5===o&&t.exports.reset(),!r[e]){const t=n.exec(e);if(!t)throw new Error(`invalid addr: ${e}`);r[e]=[t[1],+t[2]],o+=1}return r[e]},t.exports.reset=function(){r={},o=0}},{}],8:[function(e,t,n){"use strict";function r(e){var t=e.length;if(0>16,s[d++]=255&f>>8,s[d++]=255&f;return 2===a&&(f=u[e.charCodeAt(c)]<<2|u[e.charCodeAt(c+1)]>>4,s[d++]=255&f),1===a&&(f=u[e.charCodeAt(c)]<<10|u[e.charCodeAt(c+1)]<<4|u[e.charCodeAt(c+2)]>>2,s[d++]=255&f>>8,s[d++]=255&f),s}function s(e){return c[63&e>>18]+c[63&e>>12]+c[63&e>>6]+c[63&e]}function d(e,t,n){for(var r=[],o=t,a;os?s:a+o));return 1===n?(l=e[t-1],r.push(c[l>>2]+c[63&l<<4]+"==")):2===n&&(l=(e[t-2]<<8)+e[t-1],r.push(c[l>>10]+c[63&l>>4]+c[63&l<<2]+"=")),r.join("")}n.byteLength=function(e){var t=r(e),n=t[0],o=t[1];return 3*(n+o)/4-o},n.toByteArray=a,n.fromByteArray=l;for(var c=[],u=[],p="undefined"==typeof Uint8Array?Array:Uint8Array,f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",h=0,m=f.length;hs&&48<=s){r=10*r+(s-48);continue}if(a!==t||43!==s){if(a===t&&45===s){o=-1;continue}if(46===s)break;throw new Error("not a number: buffer["+a+"] = "+s)}}return r*o}function o(e,n,r,i){return null==e||0===e.length?null:("number"!=typeof n&&null==i&&(i=n,n=void 0),"number"!=typeof r&&null==i&&(i=r,r=void 0),o.position=0,o.encoding=i||null,o.data=t.isBuffer(e)?e.slice(n,r):new t(e),o.bytes=o.data.length,o.next())}const i=101;o.bytes=0,o.position=0,o.data=null,o.encoding=null,o.next=function(){switch(o.data[o.position]){case 100:return o.dictionary();case 108:return o.list();case 105:return o.integer();default:return o.buffer();}},o.find=function(t){for(var n=o.position,r=o.data.length,a=o.data;nr||r>=e.length)throw new RangeError("invalid lower bound");if(void 0===o)o=e.length-1;else if(o|=0,o=e.length)throw new RangeError("invalid upper bound");for(;r<=o;)if(i=r+(o-r>>1),a=+n(e[i],t,i,e),0>a)r=i+1;else if(0>3;return 0!=e%8&&t++,t}var o="undefined"==typeof e?Uint8Array:e;n.prototype.get=function(e){var t=e>>3;return t>e%8)},n.prototype.set=function(e,t){var n=e>>3;t||1===arguments.length?(this.buffer.length>e%8):n>e%8))},n.prototype._grow=function(e){if(this.buffer.length{this.keepAlive()},55e3))}setTimeout(e,t){this._debug("setTimeout ms=%d unref=%s",e,t),this._clearTimeout(),this._timeoutMs=e,this._timeoutUnref=!!t,this._updateTimeout()}destroy(){this.destroyed||(this.destroyed=!0,this._debug("destroy"),this.emit("close"),this.end())}end(...e){this._debug("end"),this._onUninterested(),this._onChoke(),super.end(...e)}use(e){function t(){}const n=e.prototype.name;if(!n)throw new Error("Extension class requires a \"name\" property on the prototype");this._debug("use extension.name=%s",n);const r=this._nextExt,o=new e(this);"function"!=typeof o.onHandshake&&(o.onHandshake=t),"function"!=typeof o.onExtendedHandshake&&(o.onExtendedHandshake=t),"function"!=typeof o.onMessage&&(o.onMessage=t),this.extendedMapping[r]=n,this._ext[n]=o,this[n]=o,this._nextExt+=1}keepAlive(){this._debug("keep-alive"),this._push(p)}handshake(e,t,r){let o,i;if("string"==typeof e?(e=e.toLowerCase(),o=n.from(e,"hex")):(o=e,e=o.toString("hex")),"string"==typeof t?i=n.from(t,"hex"):(i=t,t=i.toString("hex")),20!==o.length||20!==i.length)throw new Error("infoHash and peerId MUST have length 20");this._debug("handshake i=%s p=%s exts=%o",e,t,r);const a=n.from(_);a[5]|=16,r&&r.dht&&(a[7]|=1),this._push(n.concat([u,a,o,i])),this._handshakeSent=!0,this.peerExtensions.extended&&!this._extendedHandshakeSent&&this._sendExtendedHandshake()}_sendExtendedHandshake(){const e=s(this.extendedHandshake);for(const t in e.m={},this.extendedMapping){const n=this.extendedMapping[t];e.m[n]=+t}this.extended(0,o.encode(e)),this._extendedHandshakeSent=!0}choke(){if(!this.amChoking){for(this.amChoking=!0,this._debug("choke");this.peerRequests.length;)this.peerRequests.pop();this._push(f)}}unchoke(){this.amChoking&&(this.amChoking=!1,this._debug("unchoke"),this._push(h))}interested(){this.amInterested||(this.amInterested=!0,this._debug("interested"),this._push(m))}uninterested(){this.amInterested&&(this.amInterested=!1,this._debug("uninterested"),this._push(g))}have(e){this._debug("have %d",e),this._message(4,[e],null)}bitfield(e){this._debug("bitfield"),n.isBuffer(e)||(e=e.buffer),this._message(5,[],e)}request(e,t,n,r){return r||(r=()=>{}),this._finished?r(new Error("wire is closed")):this.peerChoking?r(new Error("peer is choking")):void(this._debug("request index=%d offset=%d length=%d",e,t,n),this.requests.push(new y(e,t,n,r)),this._updateTimeout(),this._message(6,[e,t,n],null))}piece(e,t,n){this._debug("piece index=%d offset=%d",e,t),this.uploaded+=n.length,this.uploadSpeed(n.length),this.emit("upload",n.length),this._message(7,[e,t],n)}cancel(e,t,n){this._debug("cancel index=%d offset=%d length=%d",e,t,n),this._callback(this._pull(this.requests,e,t,n),new Error("request was cancelled"),null),this._message(8,[e,t,n],null)}port(e){this._debug("port %d",e);const t=n.from(b);t.writeUInt16BE(e,5),this._push(t)}extended(e,t){if(this._debug("extended ext=%s",e),"string"==typeof e&&this.peerExtendedMapping[e]&&(e=this.peerExtendedMapping[e]),"number"==typeof e){const r=n.from([e]),i=n.isBuffer(t)?t:o.encode(t);this._message(20,[],n.concat([r,i]))}else throw new Error(`Unrecognized extension: ${e}`)}_read(){}_message(e,t,r){const o=r?r.length:0,a=n.allocUnsafe(5+4*t.length);a.writeUInt32BE(a.length+o-4,0),a[4]=e;for(let n=0;nr===this._pull(this.peerRequests,e,t,n)?o?this._debug("error satisfying request index=%d offset=%d length=%d (%s)",e,t,n,o.message):void this.piece(e,t,i):void 0;var r=new y(e,t,n,o);this.peerRequests.push(r),this.emit("request",e,t,n,o)}}_onPiece(e,t,n){this._debug("got piece index=%d offset=%d",e,t),this._callback(this._pull(this.requests,e,t,n.length),null,n),this.downloaded+=n.length,this.downloadSpeed(n.length),this.emit("download",n.length),this.emit("piece",e,t,n)}_onCancel(e,t,n){this._debug("got cancel index=%d offset=%d length=%d",e,t,n),this._pull(this.peerRequests,e,t,n),this.emit("cancel",e,t,n)}_onPort(e){this._debug("got port %d",e),this.emit("port",e)}_onExtended(e,t){if(0===e){let e;try{e=o.decode(t)}catch(e){this._debug("ignoring invalid extended handshake: %s",e.message||e)}if(!e)return;this.peerExtendedHandshake=e;if("object"==typeof e.m)for(var n in e.m)this.peerExtendedMapping[n]=+e.m[n].toString();for(n in this._ext)this.peerExtendedMapping[n]&&this._ext[n].onExtendedHandshake(this.peerExtendedHandshake);this._debug("got extended handshake"),this.emit("extended","handshake",this.peerExtendedHandshake)}else this.extendedMapping[e]&&(e=this.extendedMapping[e],this._ext[e]&&this._ext[e].onMessage(t)),this._debug("got extended message ext=%s",e),this.emit("extended",e,t)}_onTimeout(){this._debug("request timed out"),this._callback(this.requests.shift(),new Error("request has timed out"),null),this.emit("timeout")}_write(e,t,r){for(this._bufferSize+=e.length,this._buffer.push(e);this._bufferSize>=this._parserSize;){const e=1===this._buffer.length?this._buffer[0]:n.concat(this._buffer);this._bufferSize-=this._parserSize,this._buffer=this._bufferSize?[e.slice(this._parserSize)]:[],this._parser(e.slice(0,this._parserSize))}r(null)}_callback(e,t,n){e&&(this._clearTimeout(),!this.peerChoking&&!this._finished&&this._updateTimeout(),e.callback(t,n))}_clearTimeout(){this._timeout&&(clearTimeout(this._timeout),this._timeout=null)}_updateTimeout(){this._timeoutMs&&this.requests.length&&!this._timeout&&(this._timeout=setTimeout(()=>this._onTimeout(),this._timeoutMs),this._timeoutUnref&&this._timeout.unref&&this._timeout.unref())}_parse(e,t){this._parserSize=e,this._parser=t}_onMessageLength(e){const t=e.readUInt32BE(0);0{const t=e.readUInt8(0);this._parse(t+48,e=>{const n=e.slice(0,t);return"BitTorrent protocol"===n.toString()?void(e=e.slice(t),this._onHandshake(e.slice(8,28),e.slice(28,48),{dht:!!(1&e[7]),extended:!!(16&e[5])}),this._parse(4,this._onMessageLength)):(this._debug("Error: wire not speaking BitTorrent protocol (%s)",n.toString()),void this.end())})})}_onFinish(){for(this._finished=!0,this.push(null);this.read(););for(clearInterval(this._keepAliveInterval),this._parse(Number.MAX_VALUE,()=>{});this.peerRequests.length;)this.peerRequests.pop();for(;this.requests.length;)this._callback(this.requests.pop(),new Error("wire was closed"),null)}_debug(...e){e[0]=`[${this._debugId}] ${e[0]}`,a(...e)}_pull(e,t,n,o){for(let a=0;a>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function m(e,t){return 0>=e||0===t.length&&t.ended?0:t.objectMode?1:e===e?(e>t.highWaterMark&&(t.highWaterMark=h(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0)):t.flowing&&t.length?t.buffer.head.data.length:t.length}function g(e,t){if(!t.ended){if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,_(e)}}function _(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(W("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?U.nextTick(b,e):b(e))}function b(e){W("emit readable"),e.emit("readable"),E(e)}function y(e,t){t.readingMore||(t.readingMore=!0,U.nextTick(w,e,t))}function w(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):n=L(e,t.buffer,t.decoder),n}function L(e,t,n){var r;return ea.length?a.length:e;if(i+=s===a.length?a:a.slice(0,e),e-=s,0===e){s===a.length?(++o,t.head=r.next?r.next:t.tail=null):(t.head=r,r.data=a.slice(s));break}++o}return t.length-=o,i}function I(e,t){var r=H.allocUnsafe(e),o=t.head,i=1;for(o.data.copy(r),e-=o.data.length;o=o.next;){var a=o.data,s=e>a.length?a.length:e;if(a.copy(r,r.length-e,0,s),e-=s,0===e){s===a.length?(++i,t.head=o.next?o.next:t.tail=null):(t.head=o,o.data=a.slice(s));break}++i}return t.length-=i,r}function T(e){var t=e._readableState;if(0=t.highWaterMark||t.ended))return W("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?T(this):_(this),null;if(e=m(e,t),0===e&&t.ended)return 0===t.length&&T(this),null;var o=t.needReadable;W("need readable",o),(0===t.length||t.length-e>>0),n=this.head,a=0;n;)r(n.data,t,a),a+=n.data.length,n=n.next;return t},e}(),i&&i.inspect&&i.inspect.custom&&(t.exports.prototype[i.inspect.custom]=function(){var e=i.inspect({length:this.length});return this.constructor.name+" "+e})},{"safe-buffer":168,util:39}],21:[function(e,t){"use strict";function n(e,t){e.emit("error",t)}var r=e("process-nextick-args");t.exports={destroy:function(e,t){var o=this,i=this._readableState&&this._readableState.destroyed,a=this._writableState&&this._writableState.destroyed;return i||a?(t?t(e):e&&(!this._writableState||!this._writableState.errorEmitted)&&r.nextTick(n,this,e),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(e){!t&&e?(r.nextTick(n,o,e),o._writableState&&(o._writableState.errorEmitted=!0)):t&&t(e)}),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}}},{"process-nextick-args":131}],22:[function(e,t){t.exports=e("events").EventEmitter},{events:42}],23:[function(e,t,n){n=t.exports=e("./lib/_stream_readable.js"),n.Stream=n,n.Readable=n,n.Writable=e("./lib/_stream_writable.js"),n.Duplex=e("./lib/_stream_duplex.js"),n.Transform=e("./lib/_stream_transform.js"),n.PassThrough=e("./lib/_stream_passthrough.js")},{"./lib/_stream_duplex.js":15,"./lib/_stream_passthrough.js":16,"./lib/_stream_readable.js":17,"./lib/_stream_transform.js":18,"./lib/_stream_writable.js":19}],24:[function(e,t){(function(n){function r(e){function t(e){n.nextTick(function(){s.emit("warning",e)})}var s=this;if(!(s instanceof r))return new r(e);if(a.call(s),e||(e={}),!e.peerId)throw new Error("Option `peerId` is required");if(!e.infoHash)throw new Error("Option `infoHash` is required");if(!e.announce)throw new Error("Option `announce` is required");if(!n.browser&&!e.port)throw new Error("Option `port` is required");s.peerId="string"==typeof e.peerId?e.peerId:e.peerId.toString("hex"),s._peerIdBuffer=o.from(s.peerId,"hex"),s._peerIdBinary=s._peerIdBuffer.toString("binary"),s.infoHash="string"==typeof e.infoHash?e.infoHash.toLowerCase():e.infoHash.toString("hex"),s._infoHashBuffer=o.from(s.infoHash,"hex"),s._infoHashBinary=s._infoHashBuffer.toString("binary"),i("new client %s",s.infoHash),s.destroyed=!1,s._port=e.port,s._getAnnounceOpts=e.getAnnounceOpts,s._rtcConfig=e.rtcConfig,s._userAgent=e.userAgent,s._wrtc="function"==typeof e.wrtc?e.wrtc():e.wrtc;var d="string"==typeof e.announce?[e.announce]:null==e.announce?[]:e.announce;d=d.map(function(e){return e=e.toString(),"/"===e[e.length-1]&&(e=e.substring(0,e.length-1)),e}),d=p(d);var l=!1!==s._wrtc&&(!!s._wrtc||u.WEBRTC_SUPPORT);s._trackers=d.map(function(e){var n=f.parse(e).protocol;return("http:"===n||"https:"===n)&&"function"==typeof m?new m(s,e):"udp:"===n&&"function"==typeof g?new g(s,e):("ws:"===n||"wss:"===n)&&l?"ws:"===n&&"undefined"!=typeof window&&"https:"===window.location.protocol?(t(new Error("Unsupported tracker protocol: "+e)),null):new _(s,e):(t(new Error("Unsupported tracker protocol: "+e)),null)}).filter(Boolean)}t.exports=r;var o=e("safe-buffer").Buffer,i=e("debug")("bittorrent-tracker:client"),a=e("events").EventEmitter,s=e("xtend"),d=e("inherits"),l=e("once"),c=e("run-parallel"),u=e("simple-peer"),p=e("uniq"),f=e("url"),h=e("./lib/common"),m=e("./lib/client/http-tracker"),g=e("./lib/client/udp-tracker"),_=e("./lib/client/websocket-tracker");d(r,a),r.scrape=function(e,t){if(t=l(t),!e.infoHash)throw new Error("Option `infoHash` is required");if(!e.announce)throw new Error("Option `announce` is required");var n=s(e,{infoHash:Array.isArray(e.infoHash)?e.infoHash[0]:e.infoHash,peerId:o.from("01234567890123456789"),port:6881}),i=new r(n);i.once("error",t),i.once("warning",t);var a=Array.isArray(e.infoHash)?e.infoHash.length:1,d={};return i.on("scrape",function(e){if(a-=1,d[e.infoHash]=e,0===a){i.destroy();var n=Object.keys(d);1===n.length?t(null,d[n[0]]):t(null,d)}}),e.infoHash=Array.isArray(e.infoHash)?e.infoHash.map(function(e){return o.from(e,"hex")}):o.from(e.infoHash,"hex"),i.scrape({infoHash:e.infoHash}),i},r.prototype.start=function(e){var t=this;i("send `start`"),e=t._defaultAnnounceOpts(e),e.event="started",t._announce(e),t._trackers.forEach(function(e){e.setInterval()})},r.prototype.stop=function(e){var t=this;i("send `stop`"),e=t._defaultAnnounceOpts(e),e.event="stopped",t._announce(e)},r.prototype.complete=function(e){var t=this;i("send `complete`"),e||(e={}),e=t._defaultAnnounceOpts(e),e.event="completed",t._announce(e)},r.prototype.update=function(e){var t=this;i("send `update`"),e=t._defaultAnnounceOpts(e),e.event&&delete e.event,t._announce(e)},r.prototype._announce=function(e){var t=this;t._trackers.forEach(function(t){t.announce(e)})},r.prototype.scrape=function(e){var t=this;i("send `scrape`"),e||(e={}),t._trackers.forEach(function(t){t.scrape(e)})},r.prototype.setInterval=function(e){var t=this;i("setInterval %d",e),t._trackers.forEach(function(t){t.setInterval(e)})},r.prototype.destroy=function(e){var t=this;if(!t.destroyed){t.destroyed=!0,i("destroy");var n=t._trackers.map(function(e){return function(t){e.destroy(t)}});c(n,e),t._trackers=[],t._getAnnounceOpts=null}},r.prototype._defaultAnnounceOpts=function(e){var t=this;return e||(e={}),null==e.numwant&&(e.numwant=h.DEFAULT_ANNOUNCE_PEERS),null==e.uploaded&&(e.uploaded=0),null==e.downloaded&&(e.downloaded=0),t._getAnnounceOpts&&(e=s(e,t._getAnnounceOpts())),e}}).call(this,e("_process"))},{"./lib/client/http-tracker":39,"./lib/client/udp-tracker":39,"./lib/client/websocket-tracker":26,"./lib/common":27,_process:132,debug:62,events:42,inherits:80,once:126,"run-parallel":166,"safe-buffer":168,"simple-peer":171,uniq:218,url:220,xtend:227}],25:[function(e,t){function n(e,t){var n=this;r.call(n),n.client=e,n.announceUrl=t,n.interval=null,n.destroyed=!1}t.exports=n;var r=e("events").EventEmitter,o=e("inherits");o(n,r),n.prototype.setInterval=function(e){var t=this;null==e&&(e=t.DEFAULT_ANNOUNCE_INTERVAL),clearInterval(t.interval),e&&(t.interval=setInterval(function(){t.announce(t.client._defaultAnnounceOpts())},e),t.interval.unref&&t.interval.unref())}},{events:42,inherits:80}],26:[function(e,t){function o(e,t){var n=this;h.call(n,e,t),a("new websocket tracker %s",t),n.peers={},n.socket=null,n.reconnecting=!1,n.retries=0,n.reconnectTimer=null,n.expectingResponse=!1,n._openSocket()}function i(){}t.exports=o;var a=e("debug")("bittorrent-tracker:websocket-tracker"),d=e("xtend"),l=e("inherits"),c=e("simple-peer"),u=e("randombytes"),p=e("simple-websocket"),f=e("../common"),h=e("./tracker"),m={};o._socketPool=m;l(o,h),o.prototype.DEFAULT_ANNOUNCE_INTERVAL=30000,o.prototype.announce=function(e){var t=this;if(!(t.destroyed||t.reconnecting)){if(!t.socket.connected)return void t.socket.once("connect",function(){t.announce(e)});var n=d(e,{action:"announce",info_hash:t.client._infoHashBinary,peer_id:t.client._peerIdBinary});if(t._trackerId&&(n.trackerid=t._trackerId),"stopped"===e.event||"completed"===e.event)t._send(n);else{var r=s(e.numwant,10);t._generateOffers(r,function(e){n.numwant=r,n.offers=e,t._send(n)})}}},o.prototype.scrape=function(e){var t=this;if(!(t.destroyed||t.reconnecting)){if(!t.socket.connected)return void t.socket.once("connect",function(){t.scrape(e)});var n=Array.isArray(e.infoHash)&&0=this.size;){var o=n.concat(this._buffered);this._bufferedBytes-=this.size,this.push(o.slice(0,this.size)),this._buffered=[o.slice(this.size,o.length)]}r()},r.prototype._flush=function(){if(this._bufferedBytes&&this._zeroPadding){var e=new n(this.size-this._bufferedBytes);e.fill(0),this._buffered.push(e),this.push(n.concat(this._buffered)),this._buffered=null}else this._bufferedBytes&&(this.push(n.concat(this._buffered)),this._buffered=null);this.push(null)}}).call(this,e("buffer").Buffer)},{buffer:41,defined:64,inherits:80,"readable-stream":38}],30:[function(e,t,n){arguments[4][15][0].apply(n,arguments)},{"./_stream_readable":32,"./_stream_writable":34,"core-util-is":60,dup:15,inherits:80,"process-nextick-args":131}],31:[function(e,t,n){arguments[4][16][0].apply(n,arguments)},{"./_stream_transform":33,"core-util-is":60,dup:16,inherits:80}],32:[function(e,t,n){arguments[4][17][0].apply(n,arguments)},{"./_stream_duplex":30,"./internal/streams/BufferList":35,"./internal/streams/destroy":36,"./internal/streams/stream":37,_process:132,"core-util-is":60,dup:17,events:42,inherits:80,isarray:85,"process-nextick-args":131,"safe-buffer":168,"string_decoder/":209,util:39}],33:[function(e,t,n){arguments[4][18][0].apply(n,arguments)},{"./_stream_duplex":30,"core-util-is":60,dup:18,inherits:80}],34:[function(e,t,n){arguments[4][19][0].apply(n,arguments)},{"./_stream_duplex":30,"./internal/streams/destroy":36,"./internal/streams/stream":37,_process:132,"core-util-is":60,dup:19,inherits:80,"process-nextick-args":131,"safe-buffer":168,timers:212,"util-deprecate":223}],35:[function(e,t,n){arguments[4][20][0].apply(n,arguments)},{dup:20,"safe-buffer":168,util:39}],36:[function(e,t,n){arguments[4][21][0].apply(n,arguments)},{dup:21,"process-nextick-args":131}],37:[function(e,t,n){arguments[4][22][0].apply(n,arguments)},{dup:22,events:42}],38:[function(e,t,n){arguments[4][23][0].apply(n,arguments)},{"./lib/_stream_duplex.js":30,"./lib/_stream_passthrough.js":31,"./lib/_stream_readable.js":32,"./lib/_stream_transform.js":33,"./lib/_stream_writable.js":34,dup:23}],39:[function(){},{}],40:[function(e,t,n){arguments[4][39][0].apply(n,arguments)},{dup:39}],41:[function(t,r,o){"use strict";function a(e){if(2147483647e)throw new RangeError("The value \""+e+"\" is invalid for option \"size\"")}function c(e,t,n){return l(e),0>=e?a(e):void 0===t?a(e):"string"==typeof n?a(e).fill(t,n):a(e).fill(t)}function u(e){return l(e),a(0>e?0:0|g(e))}function p(e,t){if(("string"!=typeof t||""===t)&&(t="utf8"),!d.isEncoding(t))throw new TypeError("Unknown encoding: "+t);var n=0|_(e,t),r=a(n),o=r.write(e,t);return o!==n&&(r=r.slice(0,o)),r}function f(e){for(var t=0>e.length?0:0|g(e.length),n=a(t),r=0;rt||e.byteLength=2147483647)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+2147483647 .toString(16)+" bytes");return 0|e}function _(e,t){if(d.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||K(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError("The \"string\" argument must be one of type string, Buffer, or ArrayBuffer. Received type "+typeof e);var n=e.length,r=2>>1;case"base64":return V(e).length;default:if(o)return r?-1:F(e).length;t=(""+t).toLowerCase(),o=!0;}}function b(e,t,n){var r=!1;if((void 0===t||0>t)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),0>=n)return"";if(n>>>=0,t>>>=0,n<=t)return"";for(e||(e="utf8");;)switch(e){case"hex":return U(this,t,n);case"utf8":case"utf-8":return I(this,t,n);case"ascii":return R(this,t,n);case"latin1":case"binary":return A(this,t,n);case"base64":return B(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return P(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0;}}function y(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function w(e,t,n,r,o){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):2147483647n&&(n=-2147483648),n=+n,Y(n)&&(n=o?0:e.length-1),0>n&&(n=e.length+n),n>=e.length){if(o)return-1;n=e.length-1}else if(0>n)if(o)n=0;else return-1;if("string"==typeof t&&(t=d.from(t,r)),d.isBuffer(t))return 0===t.length?-1:k(e,t,n,r,o);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):k(e,[t],n,r,o);throw new TypeError("val must be string, number or Buffer")}function k(e,t,n,r,o){function a(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}var s=1,d=e.length,l=t.length;if(void 0!==r&&(r=(r+"").toLowerCase(),"ucs2"===r||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(2>e.length||2>t.length)return-1;s=2,d/=2,l/=2,n/=2}var c;if(o){var u=-1;for(c=n;cd&&(n=d-l),c=n;0<=c;c--){for(var p=!0,f=0;fo&&(r=o)):r=o;var a=t.length;r>a/2&&(r=a/2);for(var s=0,d;sa&&(d=a):2===l?(c=e[o+1],128==(192&c)&&(f=(31&a)<<6|63&c,127f||57343f&&(d=f))):void 0}null===d?(d=65533,l=1):65535>>10),d=56320|1023&d),r.push(d),o+=l}return T(r)}function T(t){var n=t.length;if(n<=4096)return e.apply(String,t);for(var r="",o=0;ot)&&(t=0),(!n||0>n||n>r)&&(n=r);for(var o="",a=t;ae)throw new RangeError("offset is not uint");if(e+t>n)throw new RangeError("Trying to access beyond buffer length")}function O(e,t,n,r,o,i){if(!d.isBuffer(e))throw new TypeError("\"buffer\" argument must be a Buffer instance");if(t>o||te.length)throw new RangeError("Index out of range")}function j(e,t,n,r){if(n+r>e.length)throw new RangeError("Index out of range");if(0>n)throw new RangeError("Index out of range")}function N(e,t,n,r,o){return t=+t,n>>>=0,o||j(e,t,n,4,34028234663852886e22,-34028234663852886e22),$.write(e,t,n,r,23,4),n+4}function H(e,t,n,r,o){return t=+t,n>>>=0,o||j(e,t,n,8,17976931348623157e292,-17976931348623157e292),$.write(e,t,n,r,52,8),n+8}function q(e){if(e=e.split("=")[0],e=e.trim().replace(Q,""),2>e.length)return"";for(;0!=e.length%4;)e+="=";return e}function D(e){return 16>e?"0"+e.toString(16):e.toString(16)}function F(e,t){t=t||1/0;for(var n=e.length,r=null,o=[],a=0,s;as){if(!r){if(56319s){-1<(t-=3)&&o.push(239,191,189),r=s;continue}s=(r-55296<<10|s-56320)+65536}else r&&-1<(t-=3)&&o.push(239,191,189);if(r=null,128>s){if(0>(t-=1))break;o.push(s)}else if(2048>s){if(0>(t-=2))break;o.push(192|s>>6,128|63&s)}else if(65536>s){if(0>(t-=3))break;o.push(224|s>>12,128|63&s>>6,128|63&s)}else if(1114112>s){if(0>(t-=4))break;o.push(240|s>>18,128|63&s>>12,128|63&s>>6,128|63&s)}else throw new Error("Invalid code point")}return o}function W(e){for(var t=[],n=0;n(t-=2));++r)o=e.charCodeAt(r),a=o>>8,s=o%256,n.push(s),n.push(a);return n}function V(e){return X.toByteArray(q(e))}function G(e,t,n,r){for(var o=0;o=t.length||o>=e.length);++o)t[o+n]=e[o];return o}function K(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function Y(e){return e!==e}var X=t("base64-js"),$=t("ieee754");o.Buffer=d,o.SlowBuffer=function(e){return+e!=e&&(e=0),d.alloc(+e)},o.INSPECT_MAX_BYTES=50;o.kMaxLength=2147483647,d.TYPED_ARRAY_SUPPORT=function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()}catch(t){return!1}}(),d.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(d.prototype,"parent",{enumerable:!0,get:function(){return d.isBuffer(this)?this.buffer:void 0}}),Object.defineProperty(d.prototype,"offset",{enumerable:!0,get:function(){return d.isBuffer(this)?this.byteOffset:void 0}}),"undefined"!=typeof Symbol&&null!=Symbol.species&&d[Symbol.species]===d&&Object.defineProperty(d,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),d.poolSize=8192,d.from=function(e,t,n){return i(e,t,n)},d.prototype.__proto__=Uint8Array.prototype,d.__proto__=Uint8Array,d.alloc=function(e,t,n){return c(e,t,n)},d.allocUnsafe=function(e){return u(e)},d.allocUnsafeSlow=function(e){return u(e)},d.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==d.prototype},d.compare=function(e,t){if(K(e,Uint8Array)&&(e=d.from(e,e.offset,e.byteLength)),K(t,Uint8Array)&&(t=d.from(t,t.offset,t.byteLength)),!d.isBuffer(e)||!d.isBuffer(t))throw new TypeError("The \"buf1\", \"buf2\" arguments must be one of type Buffer or Uint8Array");if(e===t)return 0;for(var n=e.length,r=t.length,o=0,l=s(n,r);ot&&(e+=" ... "),""},d.prototype.compare=function(e,t,n,r,o){if(K(e,Uint8Array)&&(e=d.from(e,e.offset,e.byteLength)),!d.isBuffer(e))throw new TypeError("The \"target\" argument must be one of type Buffer or Uint8Array. Received type "+typeof e);if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===o&&(o=this.length),0>t||n>e.length||0>r||o>this.length)throw new RangeError("out of range index");if(r>=o&&t>=n)return 0;if(r>=o)return-1;if(t>=n)return 1;if(t>>>=0,n>>>=0,r>>>=0,o>>>=0,this===e)return 0;for(var a=o-r,l=n-t,c=s(a,l),u=this.slice(r,o),p=e.slice(t,n),f=0;f>>=0,isFinite(n)?(n>>>=0,void 0===r&&(r="utf8")):(r=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var o=this.length-t;if((void 0===n||n>o)&&(n=o),0n||0>t)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var i=!1;;)switch(r){case"hex":return x(this,e,t,n);case"utf8":case"utf-8":return S(this,e,t,n);case"ascii":return v(this,e,t,n);case"latin1":case"binary":return E(this,e,t,n);case"base64":return C(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return L(this,e,t,n);default:if(i)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),i=!0;}},d.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};d.prototype.slice=function(e,t){var n=this.length;e=~~e,t=void 0===t?n:~~t,0>e?(e+=n,0>e&&(e=0)):e>n&&(e=n),0>t?(t+=n,0>t&&(t=0)):t>n&&(t=n),t>>=0,t>>>=0,n||M(e,t,this.length);for(var r=this[e],o=1,a=0;++a>>=0,t>>>=0,n||M(e,t,this.length);for(var r=this[e+--t],o=1;0>>=0,t||M(e,1,this.length),this[e]},d.prototype.readUInt16LE=function(e,t){return e>>>=0,t||M(e,2,this.length),this[e]|this[e+1]<<8},d.prototype.readUInt16BE=function(e,t){return e>>>=0,t||M(e,2,this.length),this[e]<<8|this[e+1]},d.prototype.readUInt32LE=function(e,t){return e>>>=0,t||M(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},d.prototype.readUInt32BE=function(e,t){return e>>>=0,t||M(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},d.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||M(e,t,this.length);for(var o=this[e],a=1,s=0;++s=a&&(o-=n(2,8*t)),o},d.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||M(e,t,this.length);for(var o=t,a=1,s=this[e+--o];0=a&&(s-=n(2,8*t)),s},d.prototype.readInt8=function(e,t){return e>>>=0,t||M(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},d.prototype.readInt16LE=function(e,t){e>>>=0,t||M(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},d.prototype.readInt16BE=function(e,t){e>>>=0,t||M(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},d.prototype.readInt32LE=function(e,t){return e>>>=0,t||M(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},d.prototype.readInt32BE=function(e,t){return e>>>=0,t||M(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},d.prototype.readFloatLE=function(e,t){return e>>>=0,t||M(e,4,this.length),$.read(this,e,!0,23,4)},d.prototype.readFloatBE=function(e,t){return e>>>=0,t||M(e,4,this.length),$.read(this,e,!1,23,4)},d.prototype.readDoubleLE=function(e,t){return e>>>=0,t||M(e,8,this.length),$.read(this,e,!0,52,8)},d.prototype.readDoubleBE=function(e,t){return e>>>=0,t||M(e,8,this.length),$.read(this,e,!1,52,8)},d.prototype.writeUIntLE=function(e,t,r,o){if(e=+e,t>>>=0,r>>>=0,!o){var a=n(2,8*r)-1;O(this,e,t,r,a,0)}var s=1,d=0;for(this[t]=255&e;++d>>=0,r>>>=0,!o){var a=n(2,8*r)-1;O(this,e,t,r,a,0)}var s=r-1,d=1;for(this[t+s]=255&e;0<=--s&&(d*=256);)this[t+s]=255&e/d;return t+r},d.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||O(this,e,t,1,255,0),this[t]=255&e,t+1},d.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||O(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},d.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||O(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},d.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||O(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},d.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||O(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},d.prototype.writeIntLE=function(e,t,r,o){if(e=+e,t>>>=0,!o){var a=n(2,8*r-1);O(this,e,t,r,a-1,-a)}var s=0,d=1,l=0;for(this[t]=255&e;++se&&0===l&&0!==this[t+s-1]&&(l=1),this[t+s]=255&(e/d>>0)-l;return t+r},d.prototype.writeIntBE=function(e,t,r,o){if(e=+e,t>>>=0,!o){var a=n(2,8*r-1);O(this,e,t,r,a-1,-a)}var s=r-1,d=1,l=0;for(this[t+s]=255&e;0<=--s&&(d*=256);)0>e&&0===l&&0!==this[t+s+1]&&(l=1),this[t+s]=255&(e/d>>0)-l;return t+r},d.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||O(this,e,t,1,127,-128),0>e&&(e=255+e+1),this[t]=255&e,t+1},d.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||O(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},d.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||O(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},d.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||O(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},d.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||O(this,e,t,4,2147483647,-2147483648),0>e&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},d.prototype.writeFloatLE=function(e,t,n){return N(this,e,t,!0,n)},d.prototype.writeFloatBE=function(e,t,n){return N(this,e,t,!1,n)},d.prototype.writeDoubleLE=function(e,t,n){return H(this,e,t,!0,n)},d.prototype.writeDoubleBE=function(e,t,n){return H(this,e,t,!1,n)},d.prototype.copy=function(e,t,n,r){if(!d.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),0t)throw new RangeError("targetStart out of bounds");if(0>n||n>=this.length)throw new RangeError("Index out of range");if(0>r)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-to||"latin1"===r)&&(e=o)}}else"number"==typeof e&&(e&=255);if(0>t||this.length>>=0,n=n===void 0?this.length:n>>>0,e||(e=0);var a;if("number"==typeof e)for(a=t;ai)){s.warned=!0;var d=new Error("Possible EventEmitter memory leak detected. "+s.length+" \""+(t+"\" listeners added. Use emitter.setMaxListeners() to increase limit."));d.name="MaxListenersExceededWarning",d.emitter=e,d.type=t,d.count=s.length,"object"==typeof console&&console.warn&&console.warn("%s: %s",d.name,d.message)}return e}function u(){if(!this.fired)switch(this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length){case 0:return this.listener.call(this.target);case 1:return this.listener.call(this.target,arguments[0]);case 2:return this.listener.call(this.target,arguments[0],arguments[1]);case 3:return this.listener.call(this.target,arguments[0],arguments[1],arguments[2]);default:for(var e=Array(arguments.length),t=0;te||e!==e)throw new TypeError("\"defaultMaxListeners\" must be a positive number");k=e}}):n.defaultMaxListeners=k,n.prototype.setMaxListeners=function(e){if("number"!=typeof e||0>e||isNaN(e))throw new TypeError("\"n\" argument must be a positive number");return this._maxListeners=e,this},n.prototype.getMaxListeners=function(){return r(this)},n.prototype.emit=function(e){var t="error"===e,n,r,o,u,p,f;if(f=this._events,f)t=t&&null==f.error;else if(!t)return!1;if(t){if(1o)return this;0===o?n.shift():m(n,o),1===n.length&&(r[e]=n[0]),r.removeListener&&this.emit("removeListener",e,s||t)}return this},n.prototype.removeAllListeners=function(e){var t,n,r;if(n=this._events,!n)return this;if(!n.removeListener)return 0===arguments.length?(this._events=b(null),this._eventsCount=0):n[e]&&(0==--this._eventsCount?this._events=b(null):delete n[e]),this;if(0===arguments.length){var o=y(n),a;for(r=0;rt)throw new RangeError("\"size\" argument must not be negative");return e.allocUnsafe?e.allocUnsafe(t):new e(t)}}).call(this,e("buffer").Buffer)},{buffer:41}],45:[function(e,t){(function(n){var r=e("buffer-fill"),o=e("buffer-alloc-unsafe");t.exports=function(e,t,i){if("number"!=typeof e)throw new TypeError("\"size\" argument must be a number");if(0>e)throw new RangeError("\"size\" argument must not be negative");if(n.alloc)return n.alloc(e,t,i);var a=o(e);return 0===e?a:void 0===t?r(a,0):("string"!=typeof i&&(i=void 0),r(a,t,i))}}).call(this,e("buffer").Buffer)},{buffer:41,"buffer-alloc-unsafe":44,"buffer-fill":46}],46:[function(e,t){(function(e){function n(e){return 1===e.length&&256>e.charCodeAt(0)}function r(e,t,n,r){if(0>n||r>e.length)throw new RangeError("Out of range index");return n>>>=0,r=void 0===r?e.length:r>>>0,r>n&&e.fill(t,n,r),e}function o(e,t,n,r){if(0>n||r>e.length)throw new RangeError("Out of range index");if(r<=n)return e;n>>>=0,r=void 0===r?e.length:r>>>0;for(var o=n,i=t.length;o<=r-i;)t.copy(e,o),o+=i;return o!==r&&t.copy(e,o,0,r-o),e}var i=function(){try{if(!e.isEncoding("latin1"))return!1;var t=e.alloc?e.alloc(4):new e(4);return t.fill("ab","ucs2"),"61006200"===t.toString("hex")}catch(e){return!1}}();t.exports=function(t,a,s,d,l){if(i)return t.fill(a,s,d,l);if("number"==typeof a)return r(t,a,s,d);if("string"==typeof a){if("string"==typeof s?(l=s,s=0,d=t.length):"string"==typeof d&&(l=d,d=t.length),void 0!==l&&"string"!=typeof l)throw new TypeError("encoding must be a string");if("latin1"===l&&(l="binary"),"string"==typeof l&&!e.isEncoding(l))throw new TypeError("Unknown encoding: "+l);if(""===a)return r(t,0,s,d);if(n(a))return r(t,a.charCodeAt(0),s,d);a=new e(a,l)}return e.isBuffer(a)?o(t,a,s,d):r(t,0,s,d)}}).call(this,e("buffer").Buffer)},{buffer:41}],47:[function(e,t){(function(e){function n(e){return"ArrayBuffer"===i.call(e).slice(8,-1)}function r(t,n,r){n>>>=0;var o=t.byteLength-n;if(0>o)throw new RangeError("'offset' is out of bounds");if(void 0===r)r=o;else if(r>>>=0,r>o)throw new RangeError("'length' is out of bounds");return a?e.from(t.slice(n,n+r)):new e(new Uint8Array(t.slice(n,n+r)))}function o(t,n){if(("string"!=typeof n||""===n)&&(n="utf8"),!e.isEncoding(n))throw new TypeError("\"encoding\" must be a valid string encoding");return a?e.from(t,n):new e(t,n)}var i=Object.prototype.toString,a="function"==typeof e.alloc&&"function"==typeof e.allocUnsafe&&"function"==typeof e.from;t.exports=function(t,i,s){if("number"==typeof t)throw new TypeError("\"value\" argument must not be a number");return n(t)?r(t,i,s):"string"==typeof t?o(t,i):a?e.from(t):new e(t)}}).call(this,e("buffer").Buffer)},{buffer:41}],48:[function(e,t){t.exports={100:"Continue",101:"Switching Protocols",102:"Processing",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",207:"Multi-Status",208:"Already Reported",226:"IM Used",300:"Multiple Choices",301:"Moved Permanently",302:"Found",303:"See Other",304:"Not Modified",305:"Use Proxy",307:"Temporary Redirect",308:"Permanent Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Payload Too Large",414:"URI Too Long",415:"Unsupported Media Type",416:"Range Not Satisfiable",417:"Expectation Failed",418:"I'm a teapot",421:"Misdirected Request",422:"Unprocessable Entity",423:"Locked",424:"Failed Dependency",425:"Unordered Collection",426:"Upgrade Required",428:"Precondition Required",429:"Too Many Requests",431:"Request Header Fields Too Large",451:"Unavailable For Legal Reasons",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",508:"Loop Detected",509:"Bandwidth Limit Exceeded",510:"Not Extended",511:"Network Authentication Required"}},{}],49:[function(e,t,n){arguments[4][15][0].apply(n,arguments)},{"./_stream_readable":51,"./_stream_writable":53,"core-util-is":60,dup:15,inherits:80,"process-nextick-args":131}],50:[function(e,t,n){arguments[4][16][0].apply(n,arguments)},{"./_stream_transform":52,"core-util-is":60,dup:16,inherits:80}],51:[function(e,t,n){arguments[4][17][0].apply(n,arguments)},{"./_stream_duplex":49,"./internal/streams/BufferList":54,"./internal/streams/destroy":55,"./internal/streams/stream":56,_process:132,"core-util-is":60,dup:17,events:42,inherits:80,isarray:85,"process-nextick-args":131,"safe-buffer":168,"string_decoder/":209,util:39}],52:[function(e,t,n){arguments[4][18][0].apply(n,arguments)},{"./_stream_duplex":49,"core-util-is":60,dup:18,inherits:80}],53:[function(e,t,n){arguments[4][19][0].apply(n,arguments)},{"./_stream_duplex":49,"./internal/streams/destroy":55,"./internal/streams/stream":56,_process:132,"core-util-is":60,dup:19,inherits:80,"process-nextick-args":131,"safe-buffer":168,timers:212,"util-deprecate":223}],54:[function(e,t,n){arguments[4][20][0].apply(n,arguments)},{dup:20,"safe-buffer":168,util:39}],55:[function(e,t,n){arguments[4][21][0].apply(n,arguments)},{dup:21,"process-nextick-args":131}],56:[function(e,t,n){arguments[4][22][0].apply(n,arguments)},{dup:22,events:42}],57:[function(e,t,n){arguments[4][23][0].apply(n,arguments)},{"./lib/_stream_duplex.js":49,"./lib/_stream_passthrough.js":50,"./lib/_stream_readable.js":51,"./lib/_stream_transform.js":52,"./lib/_stream_writable.js":53,dup:23}],58:[function(e,t){const n=e("block-stream2"),r=e("readable-stream");class o extends r.Writable{constructor(e,t,r={}){if(super(r),!e||!e.put||!e.get)throw new Error("First argument must be an abstract-chunk-store compliant store");if(t=+t,!t)throw new Error("Second argument must be a chunk length");this._blockstream=new n(t,{zeroPadding:!1});let o=0;const i=t=>{this.destroyed||(e.put(o,t),o+=1)};this._blockstream.on("data",i).on("error",e=>{this.destroy(e)}),this.on("finish",()=>this._blockstream.end())}_write(e,t,n){this._blockstream.write(e,t,n)}destroy(e){this.destroyed||(this.destroyed=!0,e&&this.emit("error",e),this.emit("close"))}}t.exports=o},{"block-stream2":29,"readable-stream":57}],59:[function(e,n){n.exports=function(e,n,r){for(var o=1/0,a=0,s=n.length-1,d,l,c;a<=s&&(d=a+(s-a>>1),c=n[d]-e,0>c?a=d+1:0t=>{const n={};if(h(e))n.getStream=_(e),n.length=e.size;else if(i.isBuffer(e))n.getStream=b(e),n.length=e.length;else if(g(e))n.getStream=w(e,n),n.length=0;else{if("string"==typeof e){if("function"!=typeof L.stat)throw new Error("filesystem paths do not work in the browser");const n=1e?r(e):void(t=C(t),r(null,t,l)))}if(m(e)&&(e=Array.from(e)),Array.isArray(e)||(e=[e]),0===e.length)throw new Error("invalid input type");e.forEach(e=>{if(null==e)throw new Error(`invalid input type: ${e}`)}),e=e.map(e=>h(e)&&"string"==typeof e.path&&"function"==typeof L.stat?e.path:e),1!==e.length||"string"==typeof e[0]||e[0].name||(e[0].name=t.name);let a=null;e.forEach((t,n)=>{if("string"==typeof t)return;let r=t.fullPath||t.name;r||(r=`Unknown File ${n+1}`,t.unknownName=!0),t.path=r.split("/"),t.path[0]||t.path.shift(),2>t.path.length?a=null:0===n&&1{if("string"==typeof e)return!0;const t=e.path[e.path.length-1];return c(t)&&I.not(t)}),a&&e.forEach(e=>{const t=(i.isBuffer(e)||g(e))&&!e.path;"string"==typeof e||t||e.path.shift()}),!t.name&&a&&(t.name=a),t.name||e.some(e=>"string"==typeof e?(t.name=v.basename(e),!0):e.unknownName?void 0:(t.name=e.path[e.path.length-1],!0)),t.name||(t.name=`Unnamed Torrent ${Date.now()}`);const d=e.reduce((e,t)=>e+ +("string"==typeof t),0);let l=1===e.length;if(1===e.length&&"string"==typeof e[0]){if("function"!=typeof L.stat)throw new Error("filesystem paths do not work in the browser");B(e[0],(e,t)=>e?r(e):void(l=t,o()))}else n.nextTick(()=>{o()})}function s(e,t,n){l(e,d,(r,o)=>r?n(r):void(o=Array.isArray(o)?C(o):[o],e=v.normalize(e),t&&(e=e.slice(0,e.lastIndexOf(v.sep)+1)),e[e.length-1]!==v.sep&&(e+=v.sep),o.forEach(t=>{t.getStream=y(t.path),t.path=t.path.replace(e,"").split(v.sep)}),n(null,o)))}function d(e,t){t=R(t),L.stat(e,(n,r)=>{if(n)return t(n);const o={length:r.size,path:e};t(null,o)})}function l(e,t,n){L.stat(e,(r,o)=>r?n(r):void(o.isDirectory()?L.readdir(e,(r,o)=>r?n(r):void A(o.filter(c).filter(I.not).map(n=>r=>{l(v.join(e,n),t,r)}),n)):o.isFile()&&t(e,n)))}function c(e){return"."!==e[0]}function u(e,t,n){function r(e){c+=e.length;const t=f;U(e,e=>{l[t]=e,p-=1,d()}),p+=1,f+=1}function o(){h=!0,d()}function a(e){s(),n(e)}function s(){m.removeListener("error",a),g.removeListener("data",r),g.removeListener("end",o),g.removeListener("error",a)}function d(){h&&0==p&&(s(),n(null,i.from(l.join(""),"hex"),c))}n=R(n);const l=[];let c=0;const u=e.map(e=>e.getStream);let p=0,f=0,h=!1;const m=new T(u),g=new x(t,{zeroPadding:!1});m.on("error",a),m.pipe(g).on("data",r).on("end",o).on("error",a)}function p(e,n,i){let a=n.announceList;a||("string"==typeof n.announce?a=[[n.announce]]:Array.isArray(n.announce)&&(a=n.announce.map(e=>[e]))),a||(a=[]),r.WEBTORRENT_ANNOUNCE&&("string"==typeof r.WEBTORRENT_ANNOUNCE?a.push([[r.WEBTORRENT_ANNOUNCE]]):Array.isArray(r.WEBTORRENT_ANNOUNCE)&&(a=a.concat(r.WEBTORRENT_ANNOUNCE.map(e=>[e])))),n.announce===void 0&&n.announceList===void 0&&(a=a.concat(t.exports.announceList)),"string"==typeof n.urlList&&(n.urlList=[n.urlList]);const s={info:{name:n.name},"creation date":o((+n.creationDate||Date.now())/1e3),encoding:"UTF-8"};0!==a.length&&(s.announce=a[0][0],s["announce-list"]=a),n.comment!==void 0&&(s.comment=n.comment),n.createdBy!==void 0&&(s["created by"]=n.createdBy),n.private!==void 0&&(s.info.private=+n.private),n.sslCert!==void 0&&(s.info["ssl-cert"]=n.sslCert),n.urlList!==void 0&&(s["url-list"]=n.urlList);const d=n.pieceLength||S(e.reduce(f,0));s.info["piece length"]=d,u(e,d,(t,r,o)=>t?i(t):void(s.info.pieces=r,e.forEach(e=>{delete e.getStream}),n.singleFileTorrent?s.info.length=o:s.info.files=e,i(null,k.encode(s))))}function f(e,t){return e+t.length}function h(e){return"undefined"!=typeof Blob&&e instanceof Blob}function m(e){return"undefined"!=typeof FileList&&e instanceof FileList}function g(e){return"object"==typeof e&&null!=e&&"function"==typeof e.pipe}function _(e){return()=>new E(e)}function b(e){return()=>{const t=new P.PassThrough;return t.end(e),t}}function y(e){return()=>L.createReadStream(e)}function w(e,t){return()=>{const n=new P.Transform;return n._transform=function(e,n,r){t.length+=e.length,this.push(e),r()},e.pipe(n),n}}const k=e("bencode"),x=e("block-stream2"),S=e("piece-length"),v=e("path"),E=e("filestream/read"),C=e("flatten"),L=e("fs"),B=e("is-file"),I=e("junk"),T=e("multistream"),R=e("once"),A=e("run-parallel"),U=e("simple-sha1"),P=e("readable-stream");t.exports=function(e,t,n){"function"==typeof t&&([t,n]=[n,t]),t=t?Object.assign({},t):{},a(e,t,(e,r,o)=>e?n(e):void(t.singleFileTorrent=o,p(r,t,n)))},t.exports.parseInput=function(e,t,n){"function"==typeof t&&([t,n]=[n,t]),t=t?Object.assign({},t):{},a(e,t,n)},t.exports.announceList=[["udp://tracker.leechers-paradise.org:6969"],["udp://tracker.coppersurfer.tk:6969"],["udp://tracker.opentrackr.org:1337"],["udp://explodie.org:6969"],["udp://tracker.empire-js.us:1337"],["wss://tracker.btorrent.xyz"],["wss://tracker.openwebtorrent.com"],["wss://tracker.fastcast.nz"]]}).call(this,e("_process"),"undefined"==typeof global?"undefined"==typeof self?"undefined"==typeof window?{}:window:self:global,e("buffer").Buffer)},{_process:132,bencode:11,"block-stream2":29,buffer:41,"filestream/read":75,flatten:76,fs:40,"is-file":83,junk:86,multistream:115,once:126,path:129,"piece-length":130,"readable-stream":162,"run-parallel":166,"simple-sha1":181}],62:[function(e,t,n){(function(o){function r(e){var t=this.useColors;if(e[0]=(t?"%c":"")+this.namespace+(t?" %c":" ")+e[0]+(t?"%c ":" ")+"+"+n.humanize(this.diff),!!t){var r="color: "+this.color;e.splice(1,0,r,"color: inherit");var o=0,i=0;e[0].replace(/%[a-zA-Z%]/g,function(e){"%%"===e||(o++,"%c"===e&&(i=o))}),e.splice(i,0,r)}}function i(e){try{null==e?n.storage.removeItem("debug"):n.storage.debug=e}catch(t){}}function a(){var e;try{e=n.storage.debug}catch(t){}return!e&&"undefined"!=typeof o&&"env"in o&&(e=o.env.DEBUG),e}n=t.exports=e("./debug"),n.log=function(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)},n.formatArgs=r,n.save=i,n.load=a,n.useColors=function(){return!!("undefined"!=typeof window&&window.process&&"renderer"===window.process.type)||!("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&31<=parseInt(RegExp.$1,10)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))},n.storage="undefined"!=typeof chrome&&"undefined"!=typeof chrome.storage?chrome.storage.local:function(){try{return window.localStorage}catch(t){}}(),n.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],n.formatters.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}},n.enable(a())}).call(this,e("_process"))},{"./debug":63,_process:132}],63:[function(e,n,r){function o(e){var n=0,o;for(o in e)n=(n<<5)-n+e.charCodeAt(o),n|=0;return r.colors[t(n)%r.colors.length]}function i(e){function t(){if(t.enabled){var e=t,o=+new Date,a=o-(n||o);e.diff=a,e.prev=n,e.curr=o,n=o;for(var s=Array(arguments.length),d=0;dthis._size&&(r=this._size),n===this._size?(this.destroy(),void this.push(null)):void(t.onload=function(){e._offset=r,e.push(s(t.result))},t.onerror=function(){e.emit("error",t.error)},t.readAsArrayBuffer(this._file.slice(n,r)))},n.prototype.destroy=function(){if(this._file=null,this.reader){this.reader.onload=null,this.reader.onerror=null;try{this.reader.abort()}catch(t){}}this.reader=null}},{inherits:80,"readable-stream":74,"typedarray-to-buffer":216}],76:[function(e,t){t.exports=function(e,t){function n(e,r){return e.reduce(function(e,o){return Array.isArray(o)&&r>1,f=-7,h=o?l-1:0,g=o?-1:1,d=t[r+h],_,b;for(h+=g,_=d&(1<<-f)-1,d>>=-f,f+=c;0>=-f,f+=a;0>1,b=23===p?5.960464477539063e-8-6.617444900424222e-24:0,y=u?0:f-1,w=u?1:-1,d=0>a||0===a&&0>1/a?1:0,s,k,x;for(a=t(a),isNaN(a)||a===1/0?(k=isNaN(a)?1:0,s=g):(s=r(Math.log(a)/Math.LN2),1>a*(x=n(2,-s))&&(s--,x*=2),a+=1<=s+_?b/x:b*n(2,1-_),2<=a*x&&(s++,x/=2),s+_>=g?(k=0,s=g):1<=s+_?(k=(a*x-1)*n(2,p),s+=_):(k=a*n(2,_-1)*n(2,p),s=0));8<=p;o[l+y]=255&k,y+=w,k/=256,p-=8);for(s=s<{t&&t(n,r)})}t.exports=class{constructor(e){if(this.store=e,this.chunkLength=e.chunkLength,!this.store||!this.store.get||!this.store.put)throw new Error("First argument must be abstract-chunk-store compliant");this.mem=[]}put(e,t,n){this.mem[e]=t,this.store.put(e,t,t=>{this.mem[e]=null,n&&n(t)})}get(e,t,r){if("function"==typeof t)return this.get(e,null,t);const o=t&&t.offset||0,i=t&&t.length&&o+t.length,a=this.mem[e];return a?n(r,null,t?a.slice(o,i):a):void this.store.get(e,t,r)}close(e){this.store.close(e)}destroy(e){this.store.destroy(e)}}}).call(this,e("_process"))},{_process:132}],80:[function(e,t){t.exports="function"==typeof Object.create?function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:function(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}},{}],81:[function(e,t){t.exports=function(e){for(var t=0,n=e.length;t127)return!1;return!0}},{}],82:[function(e,t){function n(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}function r(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&n(e.slice(0,0))}t.exports=function(e){return null!=e&&(n(e)||r(e)||!!e._isBuffer)}},{}],83:[function(e,t){"use strict";function n(e){return r.existsSync(e)&&r.statSync(e).isFile()}var r=e("fs");t.exports=function(e,t){return t?void r.stat(e,function(e,n){return e?t(e):t(null,n.isFile())}):n(e)},t.exports.sync=n},{fs:40}],84:[function(e,t){function n(e){return r(e)||o(e)}function r(e){return e instanceof Int8Array||e instanceof Int16Array||e instanceof Int32Array||e instanceof Uint8Array||e instanceof Uint8ClampedArray||e instanceof Uint16Array||e instanceof Uint32Array||e instanceof Float32Array||e instanceof Float64Array}function o(e){return a[i.call(e)]}t.exports=n,n.strict=r,n.loose=o;var i=Object.prototype.toString,a={"[object Int8Array]":!0,"[object Int16Array]":!0,"[object Int32Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Uint16Array]":!0,"[object Uint32Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0}},{}],85:[function(e,t){var n={}.toString;t.exports=Array.isArray||function(e){return"[object Array]"==n.call(e)}},{}],86:[function(e,t,n){"use strict";n.regex=n.re=/^npm-debug\.log$|^\..*\.swp$|^\.DS_Store$|^\.AppleDouble$|^\.LSOverride$|^Icon\r$|^\._.*|^\.Spotlight-V100(?:$|\/)|\.Trashes|^__MACOSX$|~$|^Thumbs\.db$|^ehthumbs\.db$|^Desktop\.ini$|^@eaDir$/,n.is=e=>n.re.test(e),n.not=e=>!n.is(e)},{}],87:[function(e,t){(function(n){function r(e){const t={},r=e.split("magnet:?")[1],i=r&&0<=r.length?r.split("&"):[];i.forEach(e=>{const n=e.split("=");if(2!==n.length)return;const r=n[0];let o=n[1];if("dn"===r&&(o=decodeURIComponent(o).replace(/\+/g," ")),("tr"===r||"xs"===r||"as"===r||"ws"===r)&&(o=decodeURIComponent(o)),"kt"===r&&(o=decodeURIComponent(o).split("+")),"ix"===r&&(o=+o),!t[r])t[r]=o;else if(Array.isArray(t[r]))t[r].push(o);else{const e=t[r];t[r]=[e,o]}});let s;if(t.xt){const e=Array.isArray(t.xt)?t.xt:[t.xt];e.forEach(e=>{if(s=e.match(/^urn:btih:(.{40})/))t.infoHash=s[1].toLowerCase();else if(s=e.match(/^urn:btih:(.{32})/)){const e=o.decode(s[1]);t.infoHash=n.from(e,"binary").toString("hex")}})}return t.infoHash&&(t.infoHashBuffer=n.from(t.infoHash,"hex")),t.dn&&(t.name=t.dn),t.kt&&(t.keywords=t.kt),t.announce="string"==typeof t.tr?[t.tr]:Array.isArray(t.tr)?t.tr:[],t.urlList=[],("string"==typeof t.as||Array.isArray(t.as))&&(t.urlList=t.urlList.concat(t.as)),("string"==typeof t.ws||Array.isArray(t.ws))&&(t.urlList=t.urlList.concat(t.ws)),a(t.announce),a(t.urlList),t}t.exports=r,t.exports.decode=r,t.exports.encode=function(e){e=i(e),e.infoHashBuffer&&(e.xt=`urn:btih:${e.infoHashBuffer.toString("hex")}`),e.infoHash&&(e.xt=`urn:btih:${e.infoHash}`),e.name&&(e.dn=e.name),e.keywords&&(e.kt=e.keywords),e.announce&&(e.tr=e.announce),e.urlList&&(e.ws=e.urlList,delete e.as);let t="magnet:?";return Object.keys(e).filter(e=>2===e.length).forEach((n,r)=>{const o=Array.isArray(e[n])?e[n]:[e[n]];o.forEach((e,o)=>{(0e._bufferDuration)&&e._cb){var t=e._cb;e._cb=null,t()}};r.prototype._getBufferDuration=function(){for(var e=this,t=e._sourceBuffer.buffered,n=e._elem.currentTime,r=-1,o=0;on)break;else(0<=r||n<=s)&&(r=s)}var d=r-n;return 0>d&&(d=0),d}},{inherits:80,"readable-stream":97,"to-arraybuffer":213}],89:[function(e,t,n){arguments[4][15][0].apply(n,arguments)},{"./_stream_readable":91,"./_stream_writable":93,"core-util-is":60,dup:15,inherits:80,"process-nextick-args":131}],90:[function(e,t,n){arguments[4][16][0].apply(n,arguments)},{"./_stream_transform":92,"core-util-is":60,dup:16,inherits:80}],91:[function(e,t,n){arguments[4][17][0].apply(n,arguments)},{"./_stream_duplex":89,"./internal/streams/BufferList":94,"./internal/streams/destroy":95,"./internal/streams/stream":96,_process:132,"core-util-is":60,dup:17,events:42,inherits:80,isarray:85,"process-nextick-args":131,"safe-buffer":168,"string_decoder/":209,util:39}],92:[function(e,t,n){arguments[4][18][0].apply(n,arguments)},{"./_stream_duplex":89,"core-util-is":60,dup:18,inherits:80}],93:[function(e,t,n){arguments[4][19][0].apply(n,arguments)},{"./_stream_duplex":89,"./internal/streams/destroy":95,"./internal/streams/stream":96,_process:132,"core-util-is":60,dup:19,inherits:80,"process-nextick-args":131,"safe-buffer":168,timers:212,"util-deprecate":223}],94:[function(e,t,n){arguments[4][20][0].apply(n,arguments)},{dup:20,"safe-buffer":168,util:39}],95:[function(e,t,n){arguments[4][21][0].apply(n,arguments)},{dup:21,"process-nextick-args":131}],96:[function(e,t,n){arguments[4][22][0].apply(n,arguments)},{dup:22,events:42}],97:[function(e,t,n){arguments[4][23][0].apply(n,arguments)},{"./lib/_stream_duplex.js":89,"./lib/_stream_passthrough.js":90,"./lib/_stream_readable.js":91,"./lib/_stream_transform.js":92,"./lib/_stream_writable.js":93,dup:23}],98:[function(e,t){(function(e){function n(e,t){if(!(this instanceof n))return new n(e,t);if(t||(t={}),this.chunkLength=+e,!this.chunkLength)throw new Error("First argument must be a chunk length");this.chunks=[],this.closed=!1,this.length=+t.length||1/0,this.length!==1/0&&(this.lastChunkLength=this.length%this.chunkLength||this.chunkLength,this.lastChunkIndex=o(this.length/this.chunkLength)-1)}function r(t,n,r){e.nextTick(function(){t&&t(n,r)})}t.exports=n,n.prototype.put=function(e,t,n){if(this.closed)return r(n,new Error("Storage is closed"));var o=e===this.lastChunkIndex;return o&&t.length!==this.lastChunkLength?r(n,new Error("Last chunk length must be "+this.lastChunkLength)):o||t.length===this.chunkLength?void(this.chunks[e]=t,r(n,null)):r(n,new Error("Chunk length must be "+this.chunkLength))},n.prototype.get=function(e,t,n){if("function"==typeof t)return this.get(e,null,t);if(this.closed)return r(n,new Error("Storage is closed"));var o=this.chunks[e];if(!o){var i=new Error("Chunk not found");return i.notFound=!0,r(n,i)}if(!t)return r(n,null,o);var a=t.offset||0,s=t.length||o.length-a;r(n,null,o.slice(a,s+a))},n.prototype.close=n.prototype.destroy=function(e){return this.closed?r(e,new Error("Storage is closed")):void(this.closed=!0,this.chunks=null,r(e,null))}}).call(this,e("_process"))},{_process:132}],99:[function(e,t,n){function o(e,t,n){for(var r=t;r>3:0,l=null;return a&&(l=a.toString(16),d&&(l+="."+d)),{mimeCodec:l,buffer:k(e.slice(0))}},n.esds.encodingLength=function(e){return e.buffer.length},n.stsz={},n.stsz.encode=function(e,t,r){var o=e.entries||[];t=t?t.slice(r):w(n.stsz.encodingLength(e)),t.writeUInt32BE(0,0),t.writeUInt32BE(o.length,4);for(var a=0;as&&(i=1),t.writeUInt32BE(i,n),t.write(e.type,n+4,4,"ascii");var c=n+8;if(1===i&&(r.encode(e.length,t,c),c+=8),a.fullBoxes[o]&&(t.writeUInt32BE(e.flags||0,c),t.writeUInt8(e.version||0,c),c+=4),l[o]){var u=l[o];u.forEach(function(n){if(5===n.length){var r=e[n]||[];n=n.substr(0,4),r.forEach(function(e){d._encode(e,t,c),c+=d.encode.bytes})}else e[n]&&(d._encode(e[n],t,c),c+=d.encode.bytes)}),e.otherBoxes&&e.otherBoxes.forEach(function(e){d._encode(e,t,c),c+=d.encode.bytes})}else if(a[o]){var p=a[o].encode;p(e,t,c),c+=p.bytes}else if(e.buffer){var f=e.buffer;f.copy(t,c),c+=e.buffer.length}else throw new Error("Either `type` must be set to a known type (not'"+o+"') or `buffer` must be set");return d.encode.bytes=c-n,t},d.readHeaders=function(e,t,n){if(t=t||0,n=n||e.length,8>n-t)return 8;var o=e.readUInt32BE(t),i=e.toString("ascii",t+4,t+8),s=t+8;if(1===o){if(16>n-t)return 16;o=r.decode(e,s),s+=8}var d,l;return a.fullBoxes[i]&&(d=e.readUInt8(s),l=16777215&e.readUInt32BE(s),s+=4),{length:o,headersLen:s-t,contentLen:o-(s-t),type:i,version:d,flags:l}},d.decode=function(e,t,n){t=t||0,n=n||e.length;var r=d.readHeaders(e,t,n);if(!r||r.length>n-t)throw new Error("Data too short");return d.decodeWithoutHeaders(r,e,t+r.headersLen,t+r.length)},d.decodeWithoutHeaders=function(e,t,n,r){n=n||0,r=r||t.length;var o=e.type,s={};if(l[o]){s.otherBoxes=[];for(var c=l[o],u=n,p;8<=r-u;)if(p=d.decode(t,u,r),u+=p.length,0<=c.indexOf(p.type))s[p.type]=p;else if(0<=c.indexOf(p.type+"s")){var f=p.type+"s",h=s[f]=s[f]||[];h.push(p)}else s.otherBoxes.push(p)}else if(a[o]){var m=a[o].decode;s=m(t,n,r)}else s.buffer=i(t.slice(n,r));return s.length=e.length,s.contentLen=e.contentLen,s.type=e.type,s.version=e.version,s.flags=e.flags,s},d.encodingLength=function(e){var t=e.type,n=8;if(a.fullBoxes[t]&&(n+=4),l[t]){var r=l[t];r.forEach(function(t){if(5===t.length){var r=e[t]||[];t=t.substr(0,4),r.forEach(function(e){e.type=t,n+=d.encodingLength(e)})}else if(e[t]){var o=e[t];o.type=t,n+=d.encodingLength(o)}}),e.otherBoxes&&e.otherBoxes.forEach(function(e){n+=d.encodingLength(e)})}else if(a[t])n+=a[t].encodingLength(e);else if(e.buffer)n+=e.buffer.length;else throw new Error("Either `type` must be set to a known type (not'"+t+"') or `buffer` must be set");return n>s&&(n+=8),e.length=n,n}},{"./boxes":99,"buffer-alloc":45,"buffer-from":47,uint64be:217}],102:[function(e,t){(function(n){function r(){return this instanceof r?void(i.Writable.call(this),this.destroyed=!1,this._pending=0,this._missing=0,this._buf=null,this._str=null,this._cb=null,this._ondrain=null,this._writeBuffer=null,this._writeCb=null,this._ondrain=null,this._kick()):new r}function o(e){this._parent=e,this.destroyed=!1,i.PassThrough.call(this)}var i=e("readable-stream"),a=e("inherits"),s=e("next-event"),d=e("mp4-box-encoding"),l=e("buffer-alloc"),c=l(0);t.exports=r,a(r,i.Writable),r.prototype.destroy=function(e){this.destroyed||(this.destroyed=!0,e&&this.emit("error",e),this.emit("close"))},r.prototype._write=function(e,t,n){if(!this.destroyed){for(var r=!this._str||!this._str._writableState.needDrain;e.length&&!this.destroyed;){if(!this._missing)return this._writeBuffer=e,void(this._writeCb=n);var o=e.length{l("number"==typeof e.length,"info.files[0].length"),l(e["path.utf-8"]||e.path,"info.files[0].path")}):l("number"==typeof e.info.length,"info.length");const t={info:e.info,infoBuffer:c.encode(e.info),name:(e.info["name.utf-8"]||e.info.name).toString(),announce:[]};t.infoHash=g.sync(t.infoBuffer),t.infoHashBuffer=r.from(t.infoHash,"hex"),void 0!==e.info.private&&(t.private=!!e.info.private),e["creation date"]&&(t.created=new Date(1e3*e["creation date"])),e["created by"]&&(t.createdBy=e["created by"].toString()),r.isBuffer(e.comment)&&(t.comment=e.comment.toString()),Array.isArray(e["announce-list"])&&0{e.forEach(e=>{t.announce.push(e.toString())})}):e.announce&&t.announce.push(e.announce.toString()),r.isBuffer(e["url-list"])&&(e["url-list"]=0e.toString()),_(t.announce),_(t.urlList);const n=e.info.files||[e.info];t.files=n.map((e,r)=>{const o=[].concat(t.name,e["path.utf-8"]||e.path||[]).map(e=>e.toString());return{path:m.join.apply(null,[m.sep].concat(o)).slice(1),name:o[o.length-1],length:e.length,offset:n.slice(0,r).reduce(s,0)}}),t.length=n.reduce(s,0);const o=t.files[t.files.length-1];return t.pieceLength=e.info["piece length"],t.lastPieceLength=(o.offset+o.length)%t.pieceLength||t.pieceLength,t.pieces=d(e.info.pieces),t}function a(e){return"undefined"!=typeof Blob&&e instanceof Blob}function s(e,t){return e+t.length}function d(e){const t=[];for(let n=0;n{t(null,i)}):a(e)?u(e,(e,n)=>e?t(new Error(`Error converting Blob: ${e.message}`)):void r(n)):"function"==typeof f&&/^https?:/.test(e)?f.concat({url:e,timeout:30000,headers:{"user-agent":"WebTorrent (https://webtorrent.io)"}},(e,n,o)=>e?t(new Error(`Error downloading torrent: ${e.message}`)):void r(o)):"function"==typeof p.readFile&&"string"==typeof e?p.readFile(e,(e,n)=>e?t(new Error("Invalid torrent identifier")):void r(n)):n.nextTick(()=>{t(new Error("Invalid torrent identifier"))})},t.exports.toMagnetURI=h.encode,t.exports.toTorrentFile=function(e){const t={info:e.info};return t["announce-list"]=(e.announce||[]).map(e=>(t.announce||(t.announce=e),e=r.from(e,"utf8"),[e])),t["url-list"]=e.urlList||[],void 0!==e.private&&(t["private"]=+e.private),e.created&&(t["creation date"]=0|e.created.getTime()/1e3),e.createdBy&&(t["created by"]=e.createdBy),e.comment&&(t.comment=e.comment),c.encode(t)};(()=>{r.alloc(0)})()}).call(this,e("_process"),e("buffer").Buffer)},{_process:132,bencode:11,"blob-to-buffer":28,buffer:41,fs:40,"magnet-uri":87,path:129,"simple-get":170,"simple-sha1":181,uniq:218}],129:[function(e,t,n){(function(e){function t(e,t){for(var n=0,r=e.length-1,o;0<=r;r--)o=e[r],"."===o?e.splice(r,1):".."===o?(e.splice(r,1),n++):n&&(e.splice(r,1),n--);if(t)for(;n--;n)e.unshift("..");return e}function r(e){"string"!=typeof e&&(e+="");var t=0,n=-1,r=!0,o;for(o=e.length-1;0<=o;--o)if(!(47===e.charCodeAt(o)))-1===n&&(r=!1,n=o+1);else if(!r){t=o+1;break}return-1===n?"":e.slice(t,n)}function o(e,t){if(e.filter)return e.filter(t);for(var n=[],r=0;rn?[]:e.slice(t,n-t+1)}e=n.resolve(e).substr(1),t=n.resolve(t).substr(1);for(var o=r(e.split("/")),a=r(t.split("/")),d=s(o.length,a.length),l=d,c=0;ci++;)a.push(n(2,i));t.exports=function(e){return r(e/o,a)}},{"closest-to":59}],131:[function(e,t){(function(e){"use strict";t.exports=e.version&&0!==e.version.indexOf("v0.")&&(0!==e.version.indexOf("v1.")||0===e.version.indexOf("v1.8."))?e:{nextTick:function(t,n,r,o){if("function"!=typeof t)throw new TypeError("\"callback\" argument must be a function");var a=arguments.length,s,d;switch(a){case 0:case 1:return e.nextTick(t);case 2:return e.nextTick(function(){t.call(null,n)});case 3:return e.nextTick(function(){t.call(null,n,r)});case 4:return e.nextTick(function(){t.call(null,n,r,o)});default:for(s=Array(a-1),d=0;de.length)throw new Error("pump requires two streams per minimum");var n=e.map(function(o,a){var i=a=o&&n>>10),e=56320|1023&e),t+=E(e),t}).join("")}function p(e){return 10>e-48?e-22:26>e-65?e-65:26>e-97?e-97:36}function f(e,t){return e+22+75*(26>e)-((0!=t)<<5)}function h(e,t,n){var r=0;for(e=n?v(e/700):e>>1,e+=v(e/t);455f&&(f=0),m=0;m=o&&s("invalid-input"),x=p(e.charCodeAt(g++)),(36<=x||x>v((2147483647-a)/b))&&s("overflow"),a+=x*b,S=y<=l?1:y>=l+26?26:y-l,xv(2147483647/E)&&s("overflow"),b*=E}c=r.length+1,l=h(a-_,c,0==_),v(a/c)>2147483647-d&&s("overflow"),d+=v(a/c),a%=c,r.splice(a++,0,d)}return u(r)}function g(e){var r=[],o,i,a,d,l,u,p,g,_,b,y,w,x,S,C;for(e=c(e),w=e.length,o=128,i=0,l=72,u=0;uy&&r.push(E(y));for(a=d=r.length,d&&r.push("-");a=o&&yv((2147483647-i)/x)&&s("overflow"),i+=(p-o)*x,o=p,u=0;u=l+26?26:_-l,g= 0x80 (not a basic code point)","invalid-input":"Invalid input"},v=r,E=e,C,L;if(C={version:"1.4.1",ucs2:{decode:c,encode:u},decode:m,encode:g,toASCII:function(e){return l(e,function(e){return k.test(e)?"xn--"+g(e):e})},toUnicode:function(e){return l(e,function(e){return w.test(e)?m(e.slice(4).toLowerCase()):e})}},"function"==typeof i&&"object"==typeof i.amd&&i.amd)i("punycode",function(){return C});else if(!(_&&b))a.punycode=C;else if(n.exports==_)b.exports=C;else for(L in C)C.hasOwnProperty(L)&&(_[L]=C[L])})(this)}).call(this,"undefined"==typeof global?"undefined"==typeof self?"undefined"==typeof window?{}:window:self:global)},{}],135:[function(e,t){"use strict";function n(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.exports=function(e,t,o,a){t=t||"&",o=o||"=";var s={};if("string"!=typeof e||0===e.length)return s;var d=/\+/g;e=e.split(t);var l=1e3;a&&"number"==typeof a.maxKeys&&(l=a.maxKeys);var c=e.length;0l&&(c=l);for(var u=0;u=e.length)return r._position+=e.length,n(null);var l;if(d>e.length){r._position+=e.length,l=0===s?e:e.slice(s),o=i.stream.write(l)&&o;break}r._position+=d,l=0===s&&d===e.length?e:e.slice(s,d),o=i.stream.write(l)&&o,i.last&&i.stream.end(),e=e.slice(d),r._queue.shift()}o?n(null):i.stream.once("drain",n.bind(null,null))},n.prototype.slice=function(e){var t=this;if(t.destroyed)return null;e instanceof Array||(e=[e]);var n=new o.PassThrough;return e.forEach(function(r,o){t._queue.push({start:r.start,end:r.end,stream:n,last:o===e.length-1})}),t._buffer&&t._write(t._buffer,null,t._cb),n},n.prototype.destroy=function(e){var t=this;t.destroyed||(t.destroyed=!0,e&&t.emit("error",e))}},{inherits:80,"readable-stream":149}],141:[function(e,t,n){arguments[4][15][0].apply(n,arguments)},{"./_stream_readable":143,"./_stream_writable":145,"core-util-is":60,dup:15,inherits:80,"process-nextick-args":131}],142:[function(e,t,n){arguments[4][16][0].apply(n,arguments)},{"./_stream_transform":144,"core-util-is":60,dup:16,inherits:80}],143:[function(e,t,n){arguments[4][17][0].apply(n,arguments)},{"./_stream_duplex":141,"./internal/streams/BufferList":146,"./internal/streams/destroy":147,"./internal/streams/stream":148,_process:132,"core-util-is":60,dup:17,events:42,inherits:80,isarray:85,"process-nextick-args":131,"safe-buffer":168,"string_decoder/":209,util:39}],144:[function(e,t,n){arguments[4][18][0].apply(n,arguments)},{"./_stream_duplex":141,"core-util-is":60,dup:18,inherits:80}],145:[function(e,t,n){arguments[4][19][0].apply(n,arguments)},{"./_stream_duplex":141,"./internal/streams/destroy":147,"./internal/streams/stream":148,_process:132,"core-util-is":60,dup:19,inherits:80,"process-nextick-args":131,"safe-buffer":168,timers:212,"util-deprecate":223}],146:[function(e,t,n){arguments[4][20][0].apply(n,arguments)},{dup:20,"safe-buffer":168,util:39}],147:[function(e,t,n){arguments[4][21][0].apply(n,arguments)},{dup:21,"process-nextick-args":131}],148:[function(e,t,n){arguments[4][22][0].apply(n,arguments)},{dup:22,events:42}],149:[function(e,t,n){arguments[4][23][0].apply(n,arguments)},{"./lib/_stream_duplex.js":141,"./lib/_stream_passthrough.js":142,"./lib/_stream_readable.js":143,"./lib/_stream_transform.js":144,"./lib/_stream_writable.js":145,dup:23}],150:[function(e,t){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t&&("object"==typeof t||"function"==typeof t)?t:e}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function i(e,t,i){function a(e,n,r){return"string"==typeof t?t:t(e,n,r)}i||(i=Error);var s=function(e){function t(e,o,i){return n(this,t),r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,a(e,o,i)))}return o(t,e),t}(i);s.prototype.name=i.name,s.prototype.code=e,u[e]=s}function a(e,t){if(Array.isArray(e)){var n=e.length;return e=e.map(function(e){return e+""}),2n?0:+n,t.length)===t}function d(e,t,n){return(void 0===n||n>e.length)&&(n=e.length),e.substring(n-t.length,n)===t}function l(e,t,n){return"number"!=typeof n&&(n=0),!(n+t.length>e.length)&&-1!==e.indexOf(t,n)}var c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},u={};i("ERR_INVALID_OPT_VALUE",function(e,t){return"The value \""+t+"\" is invalid for option \""+e+"\""},TypeError),i("ERR_INVALID_ARG_TYPE",function(e,t,n){var r;"string"==typeof t&&s(t,"not ")?(r="must not be",t=t.replace(/^not /,"")):r="must be";var o;if(d(e," argument"))o="The "+e+" "+r+" "+a(t,"type");else{var i=l(e,".")?"property":"argument";o="The \""+e+"\" "+i+" "+r+" "+a(t,"type")}return o+=". Received type "+("undefined"==typeof n?"undefined":c(n)),o},TypeError),i("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),i("ERR_METHOD_NOT_IMPLEMENTED",function(e){return"The "+e+" method is not implemented"}),i("ERR_STREAM_PREMATURE_CLOSE","Premature close"),i("ERR_STREAM_DESTROYED",function(e){return"Cannot call "+e+" after a stream was destroyed"}),i("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),i("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),i("ERR_STREAM_WRITE_AFTER_END","write after end"),i("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),i("ERR_UNKNOWN_ENCODING",function(e){return"Unknown encoding: "+e},TypeError),i("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),t.exports.codes=u},{}],151:[function(e,t){(function(e){"use strict";var n=new Set;t.exports.emitExperimentalWarning=function(t){if(!n.has(t)){n.add(t),e.emitWarning(t+" is an experimental feature. This feature could change at any time","ExperimentalWarning")}}}).call(this,e("_process"))},{_process:132}],152:[function(e,t){(function(n){"use strict";function r(e){return this instanceof r?void(s.call(this,e),d.call(this,e),this.allowHalfOpen=!0,e&&(!1===e.readable&&(this.readable=!1),!1===e.writable&&(this.writable=!1),!1===e.allowHalfOpen&&(this.allowHalfOpen=!1,this.once("end",o)))):new r(e)}function o(){this._writableState.ended||n.nextTick(i,this)}function i(e){e.end()}var a=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t};t.exports=r;var s=e("./_stream_readable"),d=e("./_stream_writable");e("inherits")(r,s);for(var l=a(d.prototype),c=0,u;c>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function f(e,t){return 0>=e||0===t.length&&t.ended?0:t.objectMode?1:Number.isNaN(e)?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=p(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function h(e,t){if(!t.ended){if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,t.sync?m(e):(t.needReadable=!1,!t.emittedReadable&&(t.emittedReadable=!0,g(e)))}}function m(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(O("emitReadable",t.flowing),t.emittedReadable=!0,n.nextTick(g,e))}function g(e){var t=e._readableState;O("emit readable"),!t.destroyed&&(t.length||t.ended)&&e.emit("readable"),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,v(e)}function _(e,t){t.readingMore||(t.readingMore=!0,n.nextTick(b,e,t))}function b(e,t){for(var n=t.length;!t.reading&&!t.ended&&t.length=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):n=t.buffer.consume(e,t.decoder),n}function C(e){var t=e._readableState;O("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,n.nextTick(L,t,e))}function L(e,t){O("endReadableNT",e.endEmitted,e.length),e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function B(e,t){for(var n=0,r=e.length;n=t.highWaterMark)||t.ended))return O("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?C(this):m(this),null;if(e=f(e,t),0===e&&t.ended)return 0===t.length&&C(this),null;var o=t.needReadable;O("need readable",o),(0===t.length||t.length-e>>0),n=this.head,o=0;n;)r(n.data,t,o),o+=n.data.length,n=n.next;return t},e.prototype.consume=function(e,t){var n;return ei.length?i.length:e;if(o+=a===i.length?i:i.slice(0,e),e-=a,0===e){a===i.length?(++r,this.head=t.next?t.next:this.tail=null):(this.head=t,t.data=i.slice(a));break}++r}return this.length-=r,o},e.prototype._getBuffer=function(e){var t=a.allocUnsafe(e),r=this.head,o=1;for(r.data.copy(t),e-=r.data.length;r=r.next;){var i=r.data,s=e>i.length?i.length:e;if(i.copy(t,t.length-e,0,s),e-=s,0===e){s===i.length?(++o,this.head=r.next?r.next:this.tail=null):(this.head=r,r.data=i.slice(s));break}++o}return this.length-=o,t},e.prototype[d]=function(){var e=s({length:this.length});return this.constructor.name+" "+e},e}()},{buffer:41,util:39}],159:[function(e,t){(function(e){"use strict";function n(e,t){o(e,t),r(e)}function r(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function o(e,t){e.emit("error",t)}t.exports={destroy:function(t,i){var a=this,s=this._readableState&&this._readableState.destroyed,d=this._writableState&&this._writableState.destroyed;return s||d?(i?i(t):t&&(!this._writableState||!this._writableState.errorEmitted)&&e.nextTick(o,this,t),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,function(t){!i&&t?(e.nextTick(n,a,t),a._writableState&&(a._writableState.errorEmitted=!0)):i?(e.nextTick(r,a),i(t)):e.nextTick(r,a)}),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}}}).call(this,e("_process"))},{_process:132}],160:[function(e,t){"use strict";function n(e,t,n){return null==e.highWaterMark?t?e[n]:null:e.highWaterMark}var o=e("../../../errors").codes.ERR_INVALID_OPT_VALUE;t.exports={getHighWaterMark:function(e,t,i,a){var s=n(t,a,i);if(null!=s){if(!Number.isInteger(s)||0>s){var d=a?i:"highWaterMark";throw new o(d,s)}return r(s)}return e.objectMode?16:16384}}},{"../../../errors":150}],161:[function(e,t,n){arguments[4][22][0].apply(n,arguments)},{dup:22,events:42}],162:[function(e,t,n){arguments[4][23][0].apply(n,arguments)},{"./lib/_stream_duplex.js":152,"./lib/_stream_passthrough.js":153,"./lib/_stream_readable.js":154,"./lib/_stream_transform.js":155,"./lib/_stream_writable.js":156,dup:23}],163:[function(e,t,n){function r(e,t,n,r){function i(){v.removeEventListener("loadstart",i),n.autoplay&&v.play()}function s(){v.removeEventListener("canplay",s),r(null,v)}function p(){o(e,function(e,n){return e?k(e):void(".pdf"===x?(v=t("object"),v.setAttribute("typemustmatch",!0),v.setAttribute("type","application/pdf"),v.setAttribute("data",n)):(v=t("iframe"),v.sandbox="allow-forms allow-scripts",v.src=n),r(null,v))})}function k(t){t.message="Error rendering file \""+e.name+"\": "+t.message,d(t.message),r(t)}var x=u.extname(e.name).toLowerCase(),S=0,v;0<=g.indexOf(x)?function(){function r(){d("Use `videostream` package for "+e.name),_(),v.addEventListener("error",p),v.addEventListener("loadstart",i),v.addEventListener("canplay",s),f(e,v)}function l(){d("Use MediaSource API for "+e.name),_(),v.addEventListener("error",g),v.addEventListener("loadstart",i),v.addEventListener("canplay",s);var t=new c(v),n=t.createWriteStream(a(e.name));e.createReadStream().pipe(n),S&&(v.currentTime=S)}function u(){d("Use Blob URL for "+e.name),_(),v.addEventListener("error",k),v.addEventListener("loadstart",i),v.addEventListener("canplay",s),o(e,function(e,t){return e?k(e):void(v.src=t,S&&(v.currentTime=S))})}function p(e){d("videostream error: fallback to MediaSource API: %o",e.message||e),v.removeEventListener("error",p),v.removeEventListener("canplay",s),l()}function g(t){return d("MediaSource API error: fallback to Blob URL: %o",t.message||t),"number"==typeof e.length&&e.length>n.maxBlobLength?(d("File length too large for Blob URL approach: %d (max: %d)",e.length,n.maxBlobLength),k(new Error("File length too large for Blob URL approach: "+e.length+" (max: "+n.maxBlobLength+")"))):void(v.removeEventListener("error",g),v.removeEventListener("canplay",s),u())}function _(){v||(v=t(b),v.addEventListener("progress",function(){S=v.currentTime}))}var b=0<=m.indexOf(x)?"video":"audio";w?0<=h.indexOf(x)?r():l():u()}():0<=_.indexOf(x)?function(){v=t("audio"),o(e,function(e,t){return e?k(e):void(v.addEventListener("error",k),v.addEventListener("loadstart",i),v.addEventListener("canplay",s),v.src=t)})}():0<=b.indexOf(x)?function(){v=t("img"),o(e,function(t,n){return t?k(t):void(v.src=n,v.alt=e.name,r(null,v))})}():0<=y.indexOf(x)?p():function(){function t(){l(n)?(d("File extension \"%s\" appears ascii, so will render.",x),p()):(d("File extension \"%s\" appears non-ascii, will not render.",x),r(new Error("Unsupported file type \""+x+"\": Cannot append to DOM")))}d("Unknown file extension \"%s\" - will attempt to render into iframe",x);var n="";e.createReadStream({start:0,end:1e3}).setEncoding("utf8").on("data",function(e){n+=e}).on("end",t).on("error",r)}()}function o(e,t){var r=u.extname(e.name).toLowerCase();p(e.createReadStream(),n.mime[r],t)}function i(e){if(null==e)throw new Error("file cannot be null or undefined");if("string"!=typeof e.name)throw new Error("missing or invalid file.name property");if("function"!=typeof e.createReadStream)throw new Error("missing or invalid file.createReadStream property")}function a(e){var t=u.extname(e).toLowerCase();return{".m4a":"audio/mp4; codecs=\"mp4a.40.5\"",".m4v":"video/mp4; codecs=\"avc1.640029, mp4a.40.5\"",".mkv":"video/webm; codecs=\"avc1.640029, mp4a.40.5\"",".mp3":"audio/mpeg",".mp4":"video/mp4; codecs=\"avc1.640029, mp4a.40.5\"",".webm":"video/webm; codecs=\"vorbis, vp8\""}[t]}function s(e){null==e.autoplay&&(e.autoplay=!1),null==e.muted&&(e.muted=!1),null==e.controls&&(e.controls=!0),null==e.maxBlobLength&&(e.maxBlobLength=200000000)}n.render=function(e,t,n,o){"function"==typeof n&&(o=n,n={}),n||(n={}),o||(o=function(){}),i(e),s(n),"string"==typeof t&&(t=document.querySelector(t)),r(e,function(n){if(t.nodeName!==n.toUpperCase()){var r=u.extname(e.name).toLowerCase();throw new Error("Cannot render \""+r+"\" inside a \""+t.nodeName.toLowerCase()+"\" element, expected \""+n+"\"")}return t},n,o)},n.append=function(e,t,n,o){function a(e){var r=d(e);return n.autoplay&&(r.autoplay=!0),n.muted&&(r.muted=!0),n.controls&&(r.controls=!0),t.appendChild(r),r}function d(e){var n=document.createElement(e);return t.appendChild(n),n}function l(e,t){e&&t&&t.remove(),o(e,t)}if("function"==typeof n&&(o=n,n={}),n||(n={}),o||(o=function(){}),i(e),s(n),"string"==typeof t&&(t=document.querySelector(t)),t&&("VIDEO"===t.nodeName||"AUDIO"===t.nodeName))throw new Error("Invalid video/audio node argument. Argument must be root element that video/audio tag will be appended to.");r(e,function(e){return"video"===e||"audio"===e?a(e):d(e)},n,l)},n.mime=e("./lib/mime.json");var d=e("debug")("render-media"),l=e("is-ascii"),c=e("mediasource"),u=e("path"),p=e("stream-to-blob-url"),f=e("videostream"),h=[".m4a",".m4v",".mp4"],m=[".m4v",".mkv",".mp4",".webm"],g=[].concat(m,[".m4a",".mp3"]),_=[".aac",".oga",".ogg",".wav",".flac"],b=[".bmp",".gif",".jpeg",".jpg",".png",".svg"],y=[".css",".html",".js",".md",".pdf",".txt"],w="undefined"!=typeof window&&window.MediaSource},{"./lib/mime.json":164,debug:62,"is-ascii":81,mediasource:88,path:129,"stream-to-blob-url":206,videostream:225}],164:[function(e,t){t.exports={".3gp":"video/3gpp",".aac":"audio/aac",".aif":"audio/x-aiff",".aiff":"audio/x-aiff",".atom":"application/atom+xml",".avi":"video/x-msvideo",".bmp":"image/bmp",".bz2":"application/x-bzip2",".conf":"text/plain",".css":"text/css",".csv":"text/plain",".diff":"text/x-diff",".doc":"application/msword",".flv":"video/x-flv",".gif":"image/gif",".gz":"application/x-gzip",".htm":"text/html",".html":"text/html",".ico":"image/vnd.microsoft.icon",".ics":"text/calendar",".iso":"application/octet-stream",".jar":"application/java-archive",".jpeg":"image/jpeg",".jpg":"image/jpeg",".js":"application/javascript",".json":"application/json",".less":"text/css",".log":"text/plain",".m3u":"audio/x-mpegurl",".m4a":"audio/mp4",".m4v":"video/mp4",".manifest":"text/cache-manifest",".markdown":"text/x-markdown",".mathml":"application/mathml+xml",".md":"text/x-markdown",".mid":"audio/midi",".midi":"audio/midi",".mov":"video/quicktime",".mp3":"audio/mpeg",".mp4":"video/mp4",".mp4v":"video/mp4",".mpeg":"video/mpeg",".mpg":"video/mpeg",".odp":"application/vnd.oasis.opendocument.presentation",".ods":"application/vnd.oasis.opendocument.spreadsheet",".odt":"application/vnd.oasis.opendocument.text",".oga":"audio/ogg",".ogg":"application/ogg",".pdf":"application/pdf",".png":"image/png",".pps":"application/vnd.ms-powerpoint",".ppt":"application/vnd.ms-powerpoint",".ps":"application/postscript",".psd":"image/vnd.adobe.photoshop",".qt":"video/quicktime",".rar":"application/x-rar-compressed",".rdf":"application/rdf+xml",".rss":"application/rss+xml",".rtf":"application/rtf",".svg":"image/svg+xml",".svgz":"image/svg+xml",".swf":"application/x-shockwave-flash",".tar":"application/x-tar",".tbz":"application/x-bzip-compressed-tar",".text":"text/plain",".tif":"image/tiff",".tiff":"image/tiff",".torrent":"application/x-bittorrent",".ttf":"application/x-font-ttf",".txt":"text/plain",".wav":"audio/wav",".webm":"video/webm",".wma":"audio/x-ms-wma",".wmv":"video/x-ms-wmv",".xls":"application/vnd.ms-excel",".xml":"application/xml",".yaml":"text/yaml",".yml":"text/yaml",".zip":"application/zip"}},{}],165:[function(e,t){(function(e){t.exports=function(t,n,r){function o(t){function n(){r&&r(t,s),r=null}i?e.nextTick(n):n()}function a(e,n,r){if(s[e]=r,n&&(u=!0),0==--l||n)o(n);else if(!u&&p>2)+1;a>2]|=128<<24-(t%4<<3),e[(-16&(t>>2)+2)+14]=0|n/536870912,e[(-16&(t>>2)+2)+15]=n<<3},f=function(e,t){var n=new Int32Array(e,t+320,5),r=new Int32Array(5),o=new DataView(r.buffer);return o.setInt32(0,n[0],!1),o.setInt32(4,n[1],!1),o.setInt32(8,n[2],!1),o.setInt32(12,n[3],!1),o.setInt32(16,n[4],!1),r},h=function(){function e(t){if(r(this,e),t=t||65536,0>2);return u(r,e),p(r,e,t),n},e.prototype._write=function(e,t,n,r){l(e,this._h8,this._h32,t,n,r||0)},e.prototype._coreCall=function(e,t,n,r,o){var i=n;this._write(e,t,n),o&&(i=this._padChunk(n,r)),this._core.hash(i,this._padMaxChunkLen)},e.prototype.rawDigest=function(e){var t=e.byteLength||e.length||e.size||0;this._initState(this._heap,this._padMaxChunkLen);var n=0,r=this._maxChunkLen;for(n=0;t>n+r;n+=r)this._coreCall(e,n,r,t,!1);return this._coreCall(e,n,t-n,t,!0),f(this._heap,this._padMaxChunkLen)},e.prototype.digest=function(e){return a(this.rawDigest(e).buffer)},e.prototype.digestFromString=function(e){return this.digest(e)},e.prototype.digestFromBuffer=function(e){return this.digest(e)},e.prototype.digestFromArrayBuffer=function(e){return this.digest(e)},e.prototype.resetState=function(){return this._initState(this._heap,this._padMaxChunkLen),this},e.prototype.append=function(e){var t=0,n=e.byteLength||e.length||e.size||0,r=this._offset%this._maxChunkLen,o=void 0;for(this._offset+=n;tn;n++)t[n]=(16>n?"0":"")+n.toString(16);e.exports.toHex=function(e){for(var n=new Uint8Array(e),r=Array(e.byteLength),o=0;o=e)return 65536;if(16777216>e)for(t=1;t>2],s=0|r[t+324>>2],l=0|r[t+328>>2],u=0|r[t+332>>2],f=0|r[t+336>>2],n=0;(0|n)<(0|e);n=0|n+64){for(a=i,d=s,c=l,p=u,h=f,o=0;64>(0|o);o=0|o+4)g=0|r[n+o>>2],m=0|(0|(i<<5|i>>>27)+(s&l|~s&u))+(0|(0|g+f)+1518500249),f=u,u=l,l=s<<30|s>>>2,s=i,i=m,r[e+o>>2]=g;for(o=0|e+64;(0|o)<(0|e+80);o=0|o+4)g=(r[o-12>>2]^r[o-32>>2]^r[o-56>>2]^r[o-64>>2])<<1|(r[o-12>>2]^r[o-32>>2]^r[o-56>>2]^r[o-64>>2])>>>31,m=0|(0|(i<<5|i>>>27)+(s&l|~s&u))+(0|(0|g+f)+1518500249),f=u,u=l,l=s<<30|s>>>2,s=i,i=m,r[o>>2]=g;for(o=0|e+80;(0|o)<(0|e+160);o=0|o+4)g=(r[o-12>>2]^r[o-32>>2]^r[o-56>>2]^r[o-64>>2])<<1|(r[o-12>>2]^r[o-32>>2]^r[o-56>>2]^r[o-64>>2])>>>31,m=0|(0|(i<<5|i>>>27)+(s^l^u))+(0|(0|g+f)+1859775393),f=u,u=l,l=s<<30|s>>>2,s=i,i=m,r[o>>2]=g;for(o=0|e+160;(0|o)<(0|e+240);o=0|o+4)g=(r[o-12>>2]^r[o-32>>2]^r[o-56>>2]^r[o-64>>2])<<1|(r[o-12>>2]^r[o-32>>2]^r[o-56>>2]^r[o-64>>2])>>>31,m=0|(0|(i<<5|i>>>27)+(s&l|s&u|l&u))+(0|(0|g+f)-1894007588),f=u,u=l,l=s<<30|s>>>2,s=i,i=m,r[o>>2]=g;for(o=0|e+240;(0|o)<(0|e+320);o=0|o+4)g=(r[o-12>>2]^r[o-32>>2]^r[o-56>>2]^r[o-64>>2])<<1|(r[o-12>>2]^r[o-32>>2]^r[o-56>>2]^r[o-64>>2])>>>31,m=0|(0|(i<<5|i>>>27)+(s^l^u))+(0|(0|g+f)-899497514),f=u,u=l,l=s<<30|s>>>2,s=i,i=m,r[o>>2]=g;i=0|i+a,s=0|s+d,l=0|l+c,u=0|u+p,f=0|f+h}r[t+320>>2]=i,r[t+324>>2]=s,r[t+328>>2]=l,r[t+332>>2]=u,r[t+336>>2]=f}}}},function(e){var t=this,n=void 0;"undefined"!=typeof self&&"undefined"!=typeof self.FileReaderSync&&(n=new self.FileReaderSync);var r=function(e,t,n,r,o,a){var s=a%4,d=(o+s)%4,l=o-d,c;switch(s){case 0:t[a]=e.charCodeAt(r+3);case 1:t[0|a+1-(s<<1)]=e.charCodeAt(r+2);case 2:t[0|a+2-(s<<1)]=e.charCodeAt(r+1);case 3:t[0|a+3-(s<<1)]=e.charCodeAt(r);}if(!(o>2]=e.charCodeAt(r+c)<<24|e.charCodeAt(r+c+1)<<16|e.charCodeAt(r+c+2)<<8|e.charCodeAt(r+c+3);switch(d){case 3:t[0|a+l+1]=e.charCodeAt(r+l+2);case 2:t[0|a+l+2]=e.charCodeAt(r+l+1);case 1:t[0|a+l+3]=e.charCodeAt(r+l);}}},o=function(e,t,n,r,o,a){var s=a%4,d=(o+s)%4,l=o-d,c;switch(s){case 0:t[a]=e[r+3];case 1:t[0|a+1-(s<<1)]=e[r+2];case 2:t[0|a+2-(s<<1)]=e[r+1];case 3:t[0|a+3-(s<<1)]=e[r];}if(!(o>2]=e[r+c]<<24|e[r+c+1]<<16|e[r+c+2]<<8|e[r+c+3];switch(d){case 3:t[0|a+l+1]=e[r+l+2];case 2:t[0|a+l+2]=e[r+l+1];case 1:t[0|a+l+3]=e[r+l];}}},i=function(e,t,r,o,a,s){var d=void 0,l=s%4,c=(a+l)%4,u=a-c,p=new Uint8Array(n.readAsArrayBuffer(e.slice(o,o+a)));switch(l){case 0:t[s]=p[3];case 1:t[0|s+1-(l<<1)]=p[2];case 2:t[0|s+2-(l<<1)]=p[1];case 3:t[0|s+3-(l<<1)]=p[0];}if(!(a>2]=p[d]<<24|p[d+1]<<16|p[d+2]<<8|p[d+3];switch(c){case 3:t[0|s+u+1]=p[u+2];case 2:t[0|s+u+2]=p[u+1];case 1:t[0|s+u+3]=p[u];}}};e.exports=function(e,n,a,s,d,l){if("string"==typeof e)return r(e,n,a,s,d,l);if(e instanceof Array)return o(e,n,a,s,d,l);if(t&&t.Buffer&&t.Buffer.isBuffer(e))return o(e,n,a,s,d,l);if(e instanceof ArrayBuffer)return o(new Uint8Array(e),n,a,s,d,l);if(e.buffer instanceof ArrayBuffer)return o(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),n,a,s,d,l);if(e instanceof Blob)return i(e,n,a,s,d,l);throw new Error("Unsupported data type.")}},function(e,t,n){function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var o=n(0),i=n(1),a=i.toHex,s=function(){function e(){r(this,e),this._rusha=new o,this._rusha.resetState()}return e.prototype.update=function(e){return this._rusha.append(e),this},e.prototype.digest=function e(t){var e=this._rusha.rawEnd().buffer;if(!t)return e;if("hex"===t)return a(e);throw new Error("unsupported digest encoding")},e}();e.exports=function(){return new s}}])})},{}],168:[function(e,t,n){function r(e,t){for(var n in e)t[n]=e[n]}function o(e,t,n){return a(e,t,n)}var i=e("buffer"),a=i.Buffer;a.from&&a.alloc&&a.allocUnsafe&&a.allocUnsafeSlow?t.exports=i:(r(i,n),n.Buffer=o),r(a,o),o.from=function(e,t,n){if("number"==typeof e)throw new TypeError("Argument must not be a number");return a(e,t,n)},o.alloc=function(e,t,n){if("number"!=typeof e)throw new TypeError("Argument must be a number");var r=a(e);return void 0===t?r.fill(0):"string"==typeof n?r.fill(t,n):r.fill(t),r},o.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return a(e)},o.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return i.SlowBuffer(e)}},{buffer:41}],169:[function(e,t){(function(e){t.exports=function(t,n){var r=[];t.on("data",function(e){r.push(e)}),t.once("end",function(){n&&n(null,e.concat(r)),n=null}),t.once("error",function(e){n&&n(e),n=null})}}).call(this,e("buffer").Buffer)},{buffer:41}],170:[function(e,t){(function(n){function r(e,t){if(e=Object.assign({maxRedirects:10},"string"==typeof e?{url:e}:e),t=d(t),e.url){const{hostname:t,port:n,protocol:r,auth:o,path:i}=c.parse(e.url);delete e.url,t||n||r||o?Object.assign(e,{hostname:t,port:n,protocol:r,auth:o,path:i}):e.path=i}const o={"accept-encoding":"gzip, deflate"};e.headers&&Object.keys(e.headers).forEach(t=>o[t.toLowerCase()]=e.headers[t]),e.headers=o;let p;e.body?p=e.json&&!u(e.body)?JSON.stringify(e.body):e.body:e.form&&(p="string"==typeof e.form?e.form:l.stringify(e.form),e.headers["content-type"]="application/x-www-form-urlencoded"),p&&(!e.method&&(e.method="POST"),!u(p)&&(e.headers["content-length"]=n.byteLength(p)),e.json&&!e.form&&(e.headers["content-type"]="application/json")),delete e.body,delete e.form,e.json&&(e.headers.accept="application/json"),e.method&&(e.method=e.method.toUpperCase());const f="https:"===e.protocol?s:a,h=f.request(e,n=>{if(300<=n.statusCode&&400>n.statusCode&&n.headers.location)return e.url=n.headers.location,delete e.headers.host,n.resume(),"POST"===e.method&&[301,302].includes(n.statusCode)&&(e.method="GET",delete e.headers["content-length"],delete e.headers["content-type"]),0==e.maxRedirects--?t(new Error("too many redirects")):r(e,t);const o="function"==typeof i&&"HEAD"!==e.method;t(null,o?i(n):n)});return h.on("timeout",()=>{h.abort(),t(new Error("Request timed out"))}),h.on("error",t),u(p)?p.on("error",t).pipe(h):h.end(p),h}t.exports=r;const o=e("simple-concat"),i=e("decompress-response"),a=e("http"),s=e("https"),d=e("once"),l=e("querystring"),c=e("url"),u=e=>null!==e&&"object"==typeof e&&"function"==typeof e.pipe;r.concat=(e,t)=>r(e,(n,r)=>n?t(n):void o(r,(n,o)=>{if(n)return t(n);if(e.json)try{o=JSON.parse(o.toString())}catch(e){return t(e,r,o)}t(null,r,o)})),["get","post","put","patch","head","delete"].forEach(e=>{r[e]=(t,n)=>("string"==typeof t&&(t={url:t}),r(Object.assign({method:e.toUpperCase()},t),n))})}).call(this,e("buffer").Buffer)},{buffer:41,"decompress-response":39,http:193,https:43,once:126,querystring:137,"simple-concat":169,url:220}],171:[function(e,t){(function(n){function r(e){var t=this;if(!(t instanceof r))return new r(e);if(t._id=l(4).toString("hex").slice(0,7),t._debug("new peer %o",e),e=Object.assign({allowHalfOpen:!1},e),c.Duplex.call(t,e),t.channelName=e.initiator?e.channelName||l(20).toString("hex"):null,t._isChromium="undefined"!=typeof window&&!!window.webkitRTCPeerConnection,t.initiator=e.initiator||!1,t.channelConfig=e.channelConfig||r.channelConfig,t.config=e.config||r.config,t.constraints=t._transformConstraints(e.constraints||r.constraints),t.offerConstraints=t._transformConstraints(e.offerConstraints||{}),t.answerConstraints=t._transformConstraints(e.answerConstraints||{}),t.sdpTransform=e.sdpTransform||function(e){return e},t.streams=e.streams||(e.stream?[e.stream]:[]),t.trickle=void 0===e.trickle||e.trickle,t.destroyed=!1,t.connected=!1,t.remoteAddress=void 0,t.remoteFamily=void 0,t.remotePort=void 0,t.localAddress=void 0,t.localPort=void 0,t._wrtc=e.wrtc&&"object"==typeof e.wrtc?e.wrtc:s(),!t._wrtc)if("undefined"==typeof window)throw o("No WebRTC support: Specify `opts.wrtc` option in this environment","ERR_WEBRTC_SUPPORT");else throw o("No WebRTC support: Not a supported browser","ERR_WEBRTC_SUPPORT");t._pcReady=!1,t._channelReady=!1,t._iceComplete=!1,t._channel=null,t._pendingCandidates=[],t._isNegotiating=!1,t._batchedNegotiation=!1,t._queuedNegotiation=!1,t._sendersAwaitingStable=[],t._senderMap=new WeakMap,t._remoteTracks=[],t._remoteStreams=[],t._chunk=null,t._cb=null,t._interval=null,t._pc=new t._wrtc.RTCPeerConnection(t.config,t.constraints),t._isReactNativeWebrtc="number"==typeof t._pc._peerConnectionId,t._pc.oniceconnectionstatechange=function(){t._onIceStateChange()},t._pc.onicegatheringstatechange=function(){t._onIceStateChange()},t._pc.onsignalingstatechange=function(){t._onSignalingStateChange()},t._pc.onicecandidate=function(e){t._onIceCandidate(e)},t.initiator?t._setupData({channel:t._pc.createDataChannel(t.channelName,t.channelConfig)}):t._pc.ondatachannel=function(e){t._setupData(e)},"addTrack"in t._pc&&(t.streams&&t.streams.forEach(function(e){t.addStream(e)}),t._pc.ontrack=function(e){t._onTrack(e)}),t.initiator&&t._needsNegotiation(),t._onFinishBound=function(){t._onFinish()},t.once("finish",t._onFinishBound)}function o(e,t){var n=new Error(e);return n.code=t,n}function i(){}t.exports=r;var a=e("debug")("simple-peer"),s=e("get-browser-rtc"),d=e("inherits"),l=e("randombytes"),c=e("readable-stream"),u=65536;d(r,c.Duplex),r.WEBRTC_SUPPORT=!!s(),r.config={iceServers:[{urls:"stun:stun.l.google.com:19302"},{urls:"stun:global.stun.twilio.com:3478?transport=udp"}]},r.constraints={},r.channelConfig={},Object.defineProperty(r.prototype,"bufferSize",{get:function(){var e=this;return e._channel&&e._channel.bufferedAmount||0}}),r.prototype.address=function(){var e=this;return{port:e.localPort,family:"IPv4",address:e.localAddress}},r.prototype.signal=function(e){var t=this;if(t.destroyed)throw o("cannot signal after peer is destroyed","ERR_SIGNALING");if("string"==typeof e)try{e=JSON.parse(e)}catch(t){e={}}t._debug("signal()"),e.renegotiate&&(t._debug("got request to renegotiate"),t._needsNegotiation()),e.candidate&&(t._pc.remoteDescription&&t._pc.remoteDescription.type?t._addIceCandidate(e.candidate):t._pendingCandidates.push(e.candidate)),e.sdp&&t._pc.setRemoteDescription(new t._wrtc.RTCSessionDescription(e),function(){t.destroyed||(t._pendingCandidates.forEach(function(e){t._addIceCandidate(e)}),t._pendingCandidates=[],"offer"===t._pc.remoteDescription.type&&t._createAnswer())},function(e){t.destroy(o(e,"ERR_SET_REMOTE_DESCRIPTION"))}),e.sdp||e.candidate||e.renegotiate||t.destroy(o("signal() called with invalid signal data","ERR_SIGNALING"))},r.prototype._addIceCandidate=function(e){var t=this;try{t._pc.addIceCandidate(new t._wrtc.RTCIceCandidate(e),i,function(e){t.destroy(o(e,"ERR_ADD_ICE_CANDIDATE"))})}catch(e){t.destroy(o("error adding candidate: "+e.message,"ERR_ADD_ICE_CANDIDATE"))}},r.prototype.send=function(e){var t=this;t._channel.send(e)},r.prototype.addStream=function(e){var t=this;t._debug("addStream()"),e.getTracks().forEach(function(n){t.addTrack(n,e)})},r.prototype.addTrack=function(e,t){var n=this;n._debug("addTrack()");var r=n._pc.addTrack(e,t),o=n._senderMap.get(e)||new WeakMap;o.set(t,r),n._senderMap.set(e,o),n._needsNegotiation()},r.prototype.removeTrack=function(e,t){var n=this;n._debug("removeSender()");var r=n._senderMap.get(e),o=r?r.get(t):null;o||n.destroy(new Error("Cannot remove track that was never added."));try{n._pc.removeTrack(o)}catch(e){"NS_ERROR_UNEXPECTED"===e.name?n._sendersAwaitingStable.push(o):n.destroy(e)}},r.prototype.removeStream=function(e){var t=this;t._debug("removeSenders()"),e.getTracks().forEach(function(n){t.removeTrack(n,e)})},r.prototype._needsNegotiation=function(){var e=this;e._debug("_needsNegotiation");e._batchedNegotiation||(e._batchedNegotiation=!0,setTimeout(function(){e._batchedNegotiation=!1,e._debug("starting batched negotiation"),e.negotiate()},0))},r.prototype.negotiate=function(){var e=this;e.initiator?e._isNegotiating?(e._queuedNegotiation=!0,e._debug("already negotiating, queueing")):(e._debug("start negotiation"),e._createOffer()):(e._debug("requesting negotiation from initiator"),e.emit("signal",{renegotiate:!0})),e._isNegotiating=!0},r.prototype.destroy=function(e){var t=this;t._destroy(e,function(){})},r.prototype._destroy=function(e,t){var n=this;if(!n.destroyed){if(n._debug("destroy (error: %s)",e&&(e.message||e)),n.readable=n.writable=!1,n._readableState.ended||n.push(null),n._writableState.finished||n.end(),n.destroyed=!0,n.connected=!1,n._pcReady=!1,n._channelReady=!1,n._remoteTracks=null,n._remoteStreams=null,n._senderMap=null,clearInterval(n._interval),n._interval=null,n._chunk=null,n._cb=null,n._onFinishBound&&n.removeListener("finish",n._onFinishBound),n._onFinishBound=null,n._channel){try{n._channel.close()}catch(e){}n._channel.onmessage=null,n._channel.onopen=null,n._channel.onclose=null,n._channel.onerror=null}if(n._pc){try{n._pc.close()}catch(e){}n._pc.oniceconnectionstatechange=null,n._pc.onicegatheringstatechange=null,n._pc.onsignalingstatechange=null,n._pc.onicecandidate=null,"addTrack"in n._pc&&(n._pc.ontrack=null),n._pc.ondatachannel=null}n._pc=null,n._channel=null,e&&n.emit("error",e),n.emit("close"),t()}},r.prototype._setupData=function(e){var t=this;return e.channel?void(t._channel=e.channel,t._channel.binaryType="arraybuffer","number"==typeof t._channel.bufferedAmountLowThreshold&&(t._channel.bufferedAmountLowThreshold=u),t.channelName=t._channel.label,t._channel.onmessage=function(e){t._onChannelMessage(e)},t._channel.onbufferedamountlow=function(){t._onChannelBufferedAmountLow()},t._channel.onopen=function(){t._onChannelOpen()},t._channel.onclose=function(){t._onChannelClose()},t._channel.onerror=function(e){t.destroy(o(e,"ERR_DATA_CHANNEL"))}):t.destroy(o("Data channel event is missing `channel` property","ERR_DATA_CHANNEL"))},r.prototype._read=function(){},r.prototype._write=function(e,t,n){var r=this;if(r.destroyed)return n(o("cannot write after peer is destroyed","ERR_DATA_CHANNEL"));if(r.connected){try{r.send(e)}catch(e){return r.destroy(o(e,"ERR_DATA_CHANNEL"))}r._channel.bufferedAmount>u?(r._debug("start backpressure: bufferedAmount %d",r._channel.bufferedAmount),r._cb=n):n(null)}else r._debug("write before connect"),r._chunk=e,r._cb=n},r.prototype._onFinish=function(){function e(){setTimeout(function(){t.destroy()},1e3)}var t=this;t.destroyed||(t.connected?e():t.once("connect",e))},r.prototype._createOffer=function(){var e=this;e.destroyed||e._pc.createOffer(function(t){function n(){var n=e._pc.localDescription||t;e._debug("signal"),e.emit("signal",{type:n.type,sdp:n.sdp})}e.destroyed||(t.sdp=e.sdpTransform(t.sdp),e._pc.setLocalDescription(t,function(){e._debug("createOffer success");e.destroyed||(e.trickle||e._iceComplete?n():e.once("_iceComplete",n))},function(t){e.destroy(o(t,"ERR_SET_LOCAL_DESCRIPTION"))}))},function(t){e.destroy(o(t,"ERR_CREATE_OFFER"))},e.offerConstraints)},r.prototype._createAnswer=function(){var e=this;e.destroyed||e._pc.createAnswer(function(t){function n(){var n=e._pc.localDescription||t;e._debug("signal"),e.emit("signal",{type:n.type,sdp:n.sdp})}e.destroyed||(t.sdp=e.sdpTransform(t.sdp),e._pc.setLocalDescription(t,function(){e.destroyed||(e.trickle||e._iceComplete?n():e.once("_iceComplete",n))},function(t){e.destroy(o(t,"ERR_SET_LOCAL_DESCRIPTION"))}))},function(t){e.destroy(o(t,"ERR_CREATE_ANSWER"))},e.answerConstraints)},r.prototype._onIceStateChange=function(){var e=this;if(!e.destroyed){var t=e._pc.iceConnectionState,n=e._pc.iceGatheringState;e._debug("iceStateChange (connection: %s) (gathering: %s)",t,n),e.emit("iceStateChange",t,n),("connected"===t||"completed"===t)&&(e._pcReady=!0,e._maybeReady()),"failed"===t&&e.destroy(o("Ice connection failed.","ERR_ICE_CONNECTION_FAILURE")),"closed"===t&&e.destroy(new Error("Ice connection closed."))}},r.prototype.getStats=function(e){var t=this;0===t._pc.getStats.length?t._pc.getStats().then(function(t){var n=[];t.forEach(function(e){n.push(e)}),e(null,n)},function(t){e(t)}):t._isReactNativeWebrtc?t._pc.getStats(null,function(t){var n=[];t.forEach(function(e){n.push(e)}),e(null,n)},function(t){e(t)}):0u)&&e._onChannelBufferedAmountLow()},r.prototype._onSignalingStateChange=function(){var e=this;e.destroyed||("stable"===e._pc.signalingState&&(e._isNegotiating=!1,e._debug("flushing sender queue",e._sendersAwaitingStable),e._sendersAwaitingStable.forEach(function(t){e.removeTrack(t),e._queuedNegotiation=!0}),e._sendersAwaitingStable=[],e._queuedNegotiation&&(e._debug("flushing negotiation queue"),e._queuedNegotiation=!1,e._needsNegotiation()),e._debug("negotiate"),e.emit("negotiate")),e._debug("signalingStateChange %s",e._pc.signalingState),e.emit("signalingStateChange",e._pc.signalingState))},r.prototype._onIceCandidate=function(e){var t=this;t.destroyed||(e.candidate&&t.trickle?t.emit("signal",{candidate:{candidate:e.candidate.candidate,sdpMLineIndex:e.candidate.sdpMLineIndex,sdpMid:e.candidate.sdpMid}}):!e.candidate&&(t._iceComplete=!0,t.emit("_iceComplete")))},r.prototype._onChannelMessage=function(e){var t=this;if(!t.destroyed){var r=e.data;r instanceof ArrayBuffer&&(r=n.from(r)),t.push(r)}},r.prototype._onChannelBufferedAmountLow=function(){var e=this;if(!e.destroyed&&e._cb){e._debug("ending backpressure: bufferedAmount %d",e._channel.bufferedAmount);var t=e._cb;e._cb=null,t(null)}},r.prototype._onChannelOpen=function(){var e=this;e.connected||e.destroyed||(e._debug("on channel open"),e._channelReady=!0,e._maybeReady())},r.prototype._onChannelClose=function(){var e=this;e.destroyed||(e._debug("on channel close"),e.destroy())},r.prototype._onTrack=function(e){var t=this;t.destroyed||e.streams.forEach(function(n){t._debug("on track"),t.emit("track",e.track,n),t._remoteTracks.push({track:e.track,stream:n});t._remoteStreams.some(function(e){return e.id===n.id})||(t._remoteStreams.push(n),setTimeout(function(){t.emit("stream",n)},0))})},r.prototype._debug=function(){var e=this,t=[].slice.call(arguments);t[0]="["+e._id+"] "+t[0],a.apply(null,t)},r.prototype._transformConstraints=function(e){var t=this;if(0===Object.keys(e).length)return e;if((e.mandatory||e.optional)&&!t._isChromium){var n=Object.assign({},e.optional,e.mandatory);return void 0!==n.OfferToReceiveVideo&&(n.offerToReceiveVideo=n.OfferToReceiveVideo,delete n.OfferToReceiveVideo),void 0!==n.OfferToReceiveAudio&&(n.offerToReceiveAudio=n.OfferToReceiveAudio,delete n.OfferToReceiveAudio),n}return e.mandatory||e.optional||!t._isChromium?e:(void 0!==e.offerToReceiveVideo&&(e.OfferToReceiveVideo=e.offerToReceiveVideo,delete e.offerToReceiveVideo),void 0!==e.offerToReceiveAudio&&(e.OfferToReceiveAudio=e.offerToReceiveAudio,delete e.offerToReceiveAudio),{mandatory:e})}}).call(this,e("buffer").Buffer)},{buffer:41,debug:62,"get-browser-rtc":77,inherits:80,randombytes:139,"readable-stream":180}],172:[function(e,t,n){arguments[4][15][0].apply(n,arguments)},{"./_stream_readable":174,"./_stream_writable":176,"core-util-is":60,dup:15,inherits:80,"process-nextick-args":131}],173:[function(e,t,n){arguments[4][16][0].apply(n,arguments)},{"./_stream_transform":175,"core-util-is":60,dup:16,inherits:80}],174:[function(e,t,n){arguments[4][17][0].apply(n,arguments)},{"./_stream_duplex":172,"./internal/streams/BufferList":177,"./internal/streams/destroy":178,"./internal/streams/stream":179,_process:132,"core-util-is":60,dup:17,events:42,inherits:80,isarray:85,"process-nextick-args":131,"safe-buffer":168,"string_decoder/":209,util:39}],175:[function(e,t,n){arguments[4][18][0].apply(n,arguments)},{"./_stream_duplex":172,"core-util-is":60,dup:18,inherits:80}],176:[function(e,t,n){arguments[4][19][0].apply(n,arguments)},{"./_stream_duplex":172,"./internal/streams/destroy":178,"./internal/streams/stream":179,_process:132,"core-util-is":60,dup:19,inherits:80,"process-nextick-args":131,"safe-buffer":168,timers:212,"util-deprecate":223}],177:[function(e,t,n){arguments[4][20][0].apply(n,arguments)},{dup:20,"safe-buffer":168,util:39}],178:[function(e,t,n){arguments[4][21][0].apply(n,arguments)},{dup:21,"process-nextick-args":131}],179:[function(e,t,n){arguments[4][22][0].apply(n,arguments)},{dup:22,events:42}],180:[function(e,t,n){arguments[4][23][0].apply(n,arguments)},{"./lib/_stream_duplex.js":172,"./lib/_stream_passthrough.js":173,"./lib/_stream_readable.js":174,"./lib/_stream_transform.js":175,"./lib/_stream_writable.js":176,dup:23}],181:[function(e,t){function n(e){return s.digest(e)}function r(e,t){return c?void("string"==typeof e&&(e=o(e)),c.digest({name:"sha-1"},e).then(function(e){t(i(new Uint8Array(e)))},function(){t(n(e))})):void setTimeout(t,0,n(e))}function o(e){for(var t=e.length,n=new Uint8Array(t),r=0;r>>4).toString(16)),n.push((15&o).toString(16));return n.join("")}var a=e("rusha"),s=new a,d="undefined"==typeof window?self:window,l=d.crypto||d.msCrypto||{},c=l.subtle||l.webkitSubtle;try{c.digest({name:"sha-1"},new Uint8Array).catch(function(){c=!1})}catch(e){c=!1}t.exports=r,t.exports.sync=n},{rusha:167}],182:[function(e,t){(function(n,r){function o(e){var t=this;if(!(t instanceof o))return new o(e);if(e||(e={}),"string"==typeof e&&(e={url:e}),null==e.url&&null==e.socket)throw new Error("Missing required `url` or `socket` option");if(null!=e.url&&null!=e.socket)throw new Error("Must specify either `url` or `socket` option, not both");if(t._id=s(4).toString("hex").slice(0,7),t._debug("new websocket: %o",e),e=Object.assign({allowHalfOpen:!1},e),d.Duplex.call(t,e),t.connected=!1,t.destroyed=!1,t._chunk=null,t._cb=null,t._interval=null,e.socket)t.url=e.socket.url,t._ws=e.socket;else{t.url=e.url;try{t._ws="function"==typeof l?new c(e.url,e):new c(e.url)}catch(e){return void n.nextTick(function(){t.destroy(e)})}}t._ws.binaryType="arraybuffer",t._ws.onopen=function(){t._onOpen()},t._ws.onmessage=function(e){t._onMessage(e)},t._ws.onclose=function(){t._onClose()},t._ws.onerror=function(){t.destroy(new Error("connection error to "+t.url))},t._onFinishBound=function(){t._onFinish()},t.once("finish",t._onFinishBound)}t.exports=o;var i=e("debug")("simple-websocket"),a=e("inherits"),s=e("randombytes"),d=e("readable-stream"),l=e("ws"),c="function"==typeof l?l:WebSocket,u=65536;a(o,d.Duplex),o.WEBSOCKET_SUPPORT=!!c,o.prototype.send=function(e){this._ws.send(e)},o.prototype.destroy=function(e){this._destroy(e,function(){})},o.prototype._destroy=function(e,t){var n=this;if(!n.destroyed){if(n._debug("destroy (error: %s)",e&&(e.message||e)),n.readable=n.writable=!1,n._readableState.ended||n.push(null),n._writableState.finished||n.end(),n.connected=!1,n.destroyed=!0,clearInterval(n._interval),n._interval=null,n._chunk=null,n._cb=null,n._onFinishBound&&n.removeListener("finish",n._onFinishBound),n._onFinishBound=null,n._ws){var r=n._ws,o=function(){r.onclose=null};if(r.readyState===c.CLOSED)o();else try{r.onclose=o,r.close()}catch(e){o()}r.onopen=null,r.onmessage=null,r.onerror=function(){}}if(n._ws=null,e){if("undefined"!=typeof DOMException&&e instanceof DOMException){var i=e.code;e=new Error(e.message),e.code=i}n.emit("error",e)}n.emit("close"),t()}},o.prototype._read=function(){},o.prototype._write=function(e,t,n){if(this.destroyed)return n(new Error("cannot write after socket is destroyed"));if(this.connected){try{this.send(e)}catch(e){return this.destroy(e)}"function"!=typeof l&&this._ws.bufferedAmount>u?(this._debug("start backpressure: bufferedAmount %d",this._ws.bufferedAmount),this._cb=n):n(null)}else this._debug("write before connect"),this._chunk=e,this._cb=n},o.prototype._onFinish=function(){function e(){setTimeout(function(){t.destroy()},1e3)}var t=this;t.destroyed||(t.connected?e():t.once("connect",e))},o.prototype._onMessage=function(e){if(!this.destroyed){var t=e.data;t instanceof ArrayBuffer&&(t=r.from(t)),this.push(t)}},o.prototype._onOpen=function(){var e=this;if(!(e.connected||e.destroyed)){if(e.connected=!0,e._chunk){try{e.send(e._chunk)}catch(t){return e.destroy(t)}e._chunk=null,e._debug("sent chunk from \"write before connect\"");var t=e._cb;e._cb=null,t(null)}"function"!=typeof l&&(e._interval=setInterval(function(){e._onInterval()},150),e._interval.unref&&e._interval.unref()),e._debug("connect"),e.emit("connect")}},o.prototype._onInterval=function(){if(this._cb&&this._ws&&!(this._ws.bufferedAmount>u)){this._debug("ending backpressure: bufferedAmount %d",this._ws.bufferedAmount);var e=this._cb;this._cb=null,e(null)}},o.prototype._onClose=function(){this.destroyed||(this._debug("on close"),this.destroy())},o.prototype._debug=function(){var e=[].slice.call(arguments);e[0]="["+this._id+"] "+e[0],i.apply(null,e)}}).call(this,e("_process"),e("buffer").Buffer)},{_process:132,buffer:41,debug:62,inherits:80,randombytes:139,"readable-stream":191,ws:39}],183:[function(e,t,n){arguments[4][15][0].apply(n,arguments)},{"./_stream_readable":185,"./_stream_writable":187,"core-util-is":60,dup:15,inherits:80,"process-nextick-args":131}],184:[function(e,t,n){arguments[4][16][0].apply(n,arguments)},{"./_stream_transform":186,"core-util-is":60,dup:16,inherits:80}],185:[function(e,t,n){arguments[4][17][0].apply(n,arguments)},{"./_stream_duplex":183,"./internal/streams/BufferList":188,"./internal/streams/destroy":189,"./internal/streams/stream":190,_process:132,"core-util-is":60,dup:17,events:42,inherits:80,isarray:85,"process-nextick-args":131,"safe-buffer":168,"string_decoder/":209,util:39}],186:[function(e,t,n){arguments[4][18][0].apply(n,arguments)},{"./_stream_duplex":183,"core-util-is":60,dup:18,inherits:80}],187:[function(e,t,n){arguments[4][19][0].apply(n,arguments)},{"./_stream_duplex":183,"./internal/streams/destroy":189,"./internal/streams/stream":190,_process:132,"core-util-is":60,dup:19,inherits:80,"process-nextick-args":131,"safe-buffer":168,timers:212,"util-deprecate":223}],188:[function(e,t,n){arguments[4][20][0].apply(n,arguments)},{dup:20,"safe-buffer":168,util:39}],189:[function(e,t,n){arguments[4][21][0].apply(n,arguments)},{dup:21,"process-nextick-args":131}],190:[function(e,t,n){arguments[4][22][0].apply(n,arguments)},{dup:22,events:42}],191:[function(e,t,n){arguments[4][23][0].apply(n,arguments)},{"./lib/_stream_duplex.js":183,"./lib/_stream_passthrough.js":184,"./lib/_stream_readable.js":185,"./lib/_stream_transform.js":186,"./lib/_stream_writable.js":187,dup:23}],192:[function(e,t){var n=1,r=65535,o=4,i=function(){n=n+1&r},a;t.exports=function(e){a||(a=setInterval(i,0|1e3/o),a.unref&&a.unref());var t=o*(e||5),s=[0],d=1,l=n-1&r;return function(e){var i=n-l&r;for(i>t&&(i=t),l=n;i--;)d===t&&(d=0),s[d]=s[0===d?t-1:d-1],d++;e&&(s[d-1]+=e);var a=s[d-1],c=s.lengtht._pos){var a=n.substr(t._pos);if("x-user-defined"===t._charset){for(var s=new o(a.length),l=0;lt._pos&&(t.push(new o(new Uint8Array(c.result.slice(t._pos)))),t._pos=c.result.byteLength)},c.onload=function(){t.push(null)},c.readAsArrayBuffer(n);}t._xhr.readyState===d.DONE&&"ms-stream"!==t._mode&&t.push(null)}}).call(this,e("_process"),"undefined"==typeof global?"undefined"==typeof self?"undefined"==typeof window?{}:window:self:global,e("buffer").Buffer)},{"./capability":194,_process:132,buffer:41,inherits:80,"readable-stream":205}],197:[function(e,t,n){arguments[4][15][0].apply(n,arguments)},{"./_stream_readable":199,"./_stream_writable":201,"core-util-is":60,dup:15,inherits:80,"process-nextick-args":131}],198:[function(e,t,n){arguments[4][16][0].apply(n,arguments)},{"./_stream_transform":200,"core-util-is":60,dup:16,inherits:80}],199:[function(e,t,n){arguments[4][17][0].apply(n,arguments)},{"./_stream_duplex":197,"./internal/streams/BufferList":202,"./internal/streams/destroy":203,"./internal/streams/stream":204,_process:132,"core-util-is":60,dup:17,events:42,inherits:80,isarray:85,"process-nextick-args":131,"safe-buffer":168,"string_decoder/":209,util:39}],200:[function(e,t,n){arguments[4][18][0].apply(n,arguments)},{"./_stream_duplex":197,"core-util-is":60,dup:18,inherits:80}],201:[function(e,t,n){arguments[4][19][0].apply(n,arguments)},{"./_stream_duplex":197,"./internal/streams/destroy":203,"./internal/streams/stream":204,_process:132,"core-util-is":60,dup:19,inherits:80,"process-nextick-args":131,"safe-buffer":168,timers:212,"util-deprecate":223}],202:[function(e,t,n){arguments[4][20][0].apply(n,arguments)},{dup:20,"safe-buffer":168,util:39}],203:[function(e,t,n){arguments[4][21][0].apply(n,arguments)},{dup:21,"process-nextick-args":131}],204:[function(e,t,n){arguments[4][22][0].apply(n,arguments)},{dup:22,events:42}],205:[function(e,t,n){arguments[4][23][0].apply(n,arguments)},{"./lib/_stream_duplex.js":197,"./lib/_stream_passthrough.js":198,"./lib/_stream_readable.js":199,"./lib/_stream_transform.js":200,"./lib/_stream_writable.js":201,dup:23}],206:[function(e,t){var n=e("stream-to-blob");t.exports=function e(t,r,o){return"function"==typeof r?e(t,null,r):void n(t,r,function(e,t){if(e)return o(e);var n=URL.createObjectURL(t);o(null,n)})}},{"stream-to-blob":207}],207:[function(e,t){var n=e("once");t.exports=function e(t,r,o){if("function"==typeof r)return e(t,null,r);o=n(o);var i=[];t.on("data",function(e){i.push(e)}).on("end",function(){var e=r?new Blob(i,{type:r}):new Blob(i);o(null,e)}).on("error",o)}},{once:126}],208:[function(e,t){(function(n){var r=e("once");t.exports=function(e,t,o){o=r(o);var i=n.alloc(t),a=0;e.on("data",function(e){e.copy(i,a),a+=e.length}).on("end",function(){o(null,i)}).on("error",o)}}).call(this,e("buffer").Buffer)},{buffer:41,once:126}],209:[function(e,t,n){"use strict";function r(e){if(!e)return"utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0;}}function o(e){var t=r(e);if("string"!=typeof t&&(g.isEncoding===_||!_(e)))throw new Error("Unknown encoding: "+e);return t||e}function i(e){this.encoding=o(e);var t;switch(this.encoding){case"utf16le":this.text=c,this.end=u,t=4;break;case"utf8":this.fillLast=l,t=4;break;case"base64":this.text=p,this.end=f,t=3;break;default:return this.write=h,void(this.end=m);}this.lastNeed=0,this.lastTotal=0,this.lastChar=g.allocUnsafe(t)}function a(e){if(127>=e)return 0;return 6==e>>5?2:14==e>>4?3:30==e>>3?4:2==e>>6?-1:-2}function s(e,t,n){var r=t.length-1;if(r=r)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],n.slice(0,-1)}return n}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function u(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var n=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,n)}return t}function p(e,t){var r=(e.length-t)%3;return 0==r?e.toString("base64",t):(this.lastNeed=3-r,this.lastTotal=3,1==r?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-r))}function f(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function h(e){return e.toString(this.encoding)}function m(e){return e&&e.length?this.write(e):""}var g=e("safe-buffer").Buffer,_=g.isEncoding||function(e){switch(e=""+e,e&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1;}};n.StringDecoder=i,i.prototype.write=function(e){if(0===e.length)return"";var t,n;if(this.lastNeed){if(t=this.fillLast(e),void 0===t)return"";n=this.lastNeed,this.lastNeed=0}else n=0;return n>a,a=(a+5)%8,s=s<>8-a,r++):(s=31&l>>8-(a+5),a=(a+5)%8,0===a&&r++),d[o]="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567".charCodeAt(s),o++}for(r=o;r=n?(n=(n+5)%8,0==n?(d|=r,l[s]=d,s++,d=0):d|=255&r<<8-n):(n=(n+5)%8,d|=255&r>>>n,l[s]=d,s++,d=255&r<<8-n);else throw new Error("Invalid input - it is not base32 encoded string")}return l.slice(0,s)}}).call(this,e("buffer").Buffer)},{buffer:41}],212:[function(e,t,n){(function(t,r){function o(e,t){this._id=e,this._clearFn=t}var i=e("process/browser.js").nextTick,a=Function.prototype.apply,s=Array.prototype.slice,d={},l=0;n.setTimeout=function(){return new o(a.call(setTimeout,window,arguments),clearTimeout)},n.setInterval=function(){return new o(a.call(setInterval,window,arguments),clearInterval)},n.clearTimeout=n.clearInterval=function(e){e.close()},o.prototype.unref=o.prototype.ref=function(){},o.prototype.close=function(){this._clearFn.call(window,this._id)},n.enroll=function(e,t){clearTimeout(e._idleTimeoutId),e._idleTimeout=t},n.unenroll=function(e){clearTimeout(e._idleTimeoutId),e._idleTimeout=-1},n._unrefActive=n.active=function(e){clearTimeout(e._idleTimeoutId);var t=e._idleTimeout;0<=t&&(e._idleTimeoutId=setTimeout(function(){e._onTimeout&&e._onTimeout()},t))},n.setImmediate="function"==typeof t?t:function(e){var t=l++,r=!(2>arguments.length)&&s.call(arguments,1);return d[t]=!0,i(function(){d[t]&&(r?e.apply(null,r):e.call(null),n.clearImmediate(t))}),t},n.clearImmediate="function"==typeof r?r:function(e){delete d[e]}}).call(this,e("timers").setImmediate,e("timers").clearImmediate)},{"process/browser.js":132,timers:212}],213:[function(e,t){var n=e("buffer").Buffer;t.exports=function(e){if(e instanceof Uint8Array){if(0===e.byteOffset&&e.byteLength===e.buffer.byteLength)return e.buffer;if("function"==typeof e.buffer.slice)return e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength)}if(n.isBuffer(e)){for(var t=new Uint8Array(e.length),r=e.length,o=0;o{this.emit("warning",e)},this._onError=e=>{this.emit("error",e)},this._onDHTPeer=(e,t)=>{t.toString("hex")!==this.infoHash||this.emit("peer",`${e.host}:${e.port}`,"dht")},this._onTrackerPeer=e=>{this.emit("peer",e,"tracker")},this._onTrackerAnnounce=()=>{this.emit("trackerAnnounce")};const t=(e,t)=>{const n=new i(t);return n.on("warning",this._onWarning),n.on("error",this._onError),n.listen(e),this._internalDHT=!0,n};!1===e.tracker?this.tracker=null:e.tracker&&"object"==typeof e.tracker?(this._trackerOpts=Object.assign({},e.tracker),this.tracker=this._createTracker()):this.tracker=this._createTracker(),this.dht=!1===e.dht||"function"!=typeof i?null:e.dht&&"function"==typeof e.dht.addNode?e.dht:e.dht&&"object"==typeof e.dht?t(e.dhtPort,e.dht):t(e.dhtPort),this.dht&&(this.dht.on("peer",this._onDHTPeer),this._dhtAnnounce())}updatePort(e){e===this._port||(this._port=e,this.dht&&this._dhtAnnounce(),this.tracker&&(this.tracker.stop(),this.tracker.destroy(()=>{this.tracker=this._createTracker()})))}complete(e){this.tracker&&this.tracker.complete(e)}destroy(e){if(!this.destroyed){this.destroyed=!0,clearTimeout(this._dhtTimeout);const t=[];this.tracker&&(this.tracker.stop(),this.tracker.removeListener("warning",this._onWarning),this.tracker.removeListener("error",this._onError),this.tracker.removeListener("peer",this._onTrackerPeer),this.tracker.removeListener("update",this._onTrackerAnnounce),t.push(e=>{this.tracker.destroy(e)})),this.dht&&this.dht.removeListener("peer",this._onDHTPeer),this._internalDHT&&(this.dht.removeListener("warning",this._onWarning),this.dht.removeListener("error",this._onError),t.push(e=>{this.dht.destroy(e)})),s(t,e),this.dht=null,this.tracker=null,this._announce=null}}_createTracker(){const e=Object.assign({},this._trackerOpts,{infoHash:this.infoHash,announce:this._announce,peerId:this.peerId,port:this._port,userAgent:this._userAgent}),t=new d(e);return t.on("warning",this._onWarning),t.on("error",this._onError),t.on("peer",this._onTrackerPeer),t.on("update",this._onTrackerAnnounce),t.setInterval(this._intervalMs),t.start(),t}_dhtAnnounce(){this._dhtAnnouncing||(o("dht announce"),this._dhtAnnouncing=!0,clearTimeout(this._dhtTimeout),this.dht.announce(this.infoHash,this._port,e=>{this._dhtAnnouncing=!1,o("dht announce complete"),e&&this.emit("warning",e),this.emit("dhtAnnounce"),this.destroyed||(this._dhtTimeout=setTimeout(()=>{this._dhtAnnounce()},this._intervalMs+r(Math.random()*this._intervalMs/5)),this._dhtTimeout.unref&&this._dhtTimeout.unref())}))}}}).call(this,e("_process"))},{_process:132,"bittorrent-dht/client":39,"bittorrent-tracker/client":24,debug:62,events:42,"run-parallel":166}],215:[function(e,t){(function(e){const n=16384;class r{constructor(e){this.length=e,this.missing=e,this.sources=null,this._chunks=o(e/n),this._remainder=e%n||n,this._buffered=0,this._buffer=null,this._cancellations=null,this._reservations=0,this._flushed=!1}chunkLength(e){return e===this._chunks-1?this._remainder:n}chunkLengthRemaining(e){return this.length-e*n}chunkOffset(e){return e*n}reserve(){return this.init()?this._cancellations.length?this._cancellations.pop():this._reservations=e.length||0>t)){var n=e.pop();if(t","\"","`"," ","\r","\n","\t"]),u=["'"].concat(l),p=["%","/","?",";","#"].concat(u),f=["/","?","#"],h=/^[+a-z0-9A-Z_-]{0,63}$/,m=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,g={javascript:!0,"javascript:":!0},_={javascript:!0,"javascript:":!0},b={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},y=e("querystring");r.prototype.parse=function(e,t,n){if(!d.isString(e))throw new TypeError("Parameter 'url' must be a string, not "+typeof e);var r=e.indexOf("?"),o=-1!==r&&ry.length&&y.unshift(""),n.pathname=y.join("/")}else n.pathname=e.pathname;if(n.search=e.search,n.query=e.query,n.host=e.host||"",n.auth=e.auth,n.hostname=e.hostname||e.host,n.port=e.port,n.pathname||n.search){var w=n.pathname||"",p=n.search||"";n.path=w+p}return n.slashes=n.slashes||e.slashes,n.href=n.format(),n}var s=n.pathname&&"/"===n.pathname.charAt(0),x=e.host||e.pathname&&"/"===e.pathname.charAt(0),S=x||s||n.host&&e.pathname,E=S,C=n.pathname&&n.pathname.split("/")||[],y=e.pathname&&e.pathname.split("/")||[],L=n.protocol&&!b[n.protocol];if(L&&(n.hostname="",n.port=null,n.host&&(""===C[0]?C[0]=n.host:C.unshift(n.host)),n.host="",e.protocol&&(e.hostname=null,e.port=null,e.host&&(""===y[0]?y[0]=e.host:y.unshift(e.host)),e.host=null),S=S&&(""===y[0]||""===C[0])),x)n.host=e.host||""===e.host?e.host:n.host,n.hostname=e.hostname||""===e.hostname?e.hostname:n.hostname,n.search=e.search,n.query=e.query,C=y;else if(y.length)C||(C=[]),C.pop(),C=C.concat(y),n.search=e.search,n.query=e.query;else if(!d.isNullOrUndefined(e.search)){if(L){n.hostname=n.host=C.shift();var B=!!(n.host&&0{class t extends r{constructor(t){super(),this._wire=t,this._fetching=!1,this._metadataComplete=!1,this._metadataSize=null,this._remainingRejects=null,this._bitfield=new a(0,{grow:l}),n.isBuffer(e)&&this.setMetadata(e)}onHandshake(e){this._infoHash=e}onExtendedHandshake(e){return e.m&&e.m.ut_metadata?e.metadata_size?"number"!=typeof e.metadata_size||1E7=e.metadata_size?this.emit("warning",new Error("Peer gave invalid metadata size")):void(this._metadataSize=e.metadata_size,this._numPieces=o(this._metadataSize/c),this._remainingRejects=2*this._numPieces,this._fetching&&this._requestPieces()):this.emit("warning",new Error("Peer does not have metadata")):this.emit("warning",new Error("Peer does not support ut_metadata"))}onMessage(e){let t,n;try{const r=e.toString(),o=r.indexOf("ee")+2;t=i.decode(r.substring(0,o)),n=e.slice(o)}catch(e){return}switch(t.msg_type){case 0:this._onRequest(t.piece);break;case 1:this._onData(t.piece,n,t.total_size);break;case 2:this._onReject(t.piece);}}fetch(){this._metadataComplete||(this._fetching=!0,this._metadataSize&&this._requestPieces())}cancel(){this._fetching=!1}setMetadata(e){if(this._metadataComplete)return!0;s("set metadata");try{const t=i.decode(e).info;t&&(e=i.encode(t))}catch(e){}return!(this._infoHash&&this._infoHash!==d.sync(e))&&(this.cancel(),this.metadata=e,this._metadataComplete=!0,this._metadataSize=this.metadata.length,this._wire.extendedHandshake.metadata_size=this._metadataSize,this.emit("metadata",i.encode({info:i.decode(this.metadata)})),!0)}_send(e,t){let r=i.encode(e);n.isBuffer(t)&&(r=n.concat([r,t])),this._wire.extended("ut_metadata",r)}_request(e){this._send({msg_type:0,piece:e})}_data(e,t,n){const r={msg_type:1,piece:e};"number"==typeof n&&(r.total_size=n),this._send(r,t)}_reject(e){this._send({msg_type:2,piece:e})}_onRequest(e){if(!this._metadataComplete)return void this._reject(e);const t=e*c;let n=t+c;n>this._metadataSize&&(n=this._metadataSize);const r=this.metadata.slice(t,n);this._data(e,r,this._metadataSize)}_onData(e,t){t.length>c||(t.copy(this.metadata,e*c),this._bitfield.set(e),this._checkDone())}_onReject(e){0=e._entries[e._index][e._countName]&&(e._index++,e._offset=0),e.value=e._entries[e._index]},o.prototype._processMoov=function(e){var t=this,r=e.traks;t._tracks=[],t._hasVideo=!1,t._hasAudio=!1;for(var o=0;o=l.stsz.entries.length)break;if(_++,y+=C,_>=E.samplesPerChunk){_=0,y=0,b++;var R=l.stsc.entries[w+1];R&&b+1>=R.firstChunk&&w++}k+=L,x.inc(),S&&S.inc(),I&&v++}d.mdia.mdhd.duration=0,d.tkhd.duration=0;var A=E.sampleDescriptionId,U={type:"moov",mvhd:e.mvhd,traks:[{tkhd:d.tkhd,mdia:{mdhd:d.mdia.mdhd,hdlr:d.mdia.hdlr,elng:d.mdia.elng,minf:{vmhd:d.mdia.minf.vmhd,smhd:d.mdia.minf.smhd,dinf:d.mdia.minf.dinf,stbl:{stsd:l.stsd,stts:s(),ctts:s(),stsc:s(),stsz:s(),stco:s(),stss:s()}}}}],mvex:{mehd:{fragmentDuration:e.mvhd.duration},trexs:[{trackId:d.tkhd.trackId,defaultSampleDescriptionIndex:A,defaultSampleDuration:0,defaultSampleSize:0,defaultSampleFlags:0}]}};t._tracks.push({trackId:d.tkhd.trackId,timeScale:d.mdia.mdhd.timeScale,samples:m,currSample:null,currTime:null,moov:U,mime:h})}if(0===t._tracks.length)return void t.emit("error",new Error("no playable tracks"));e.mvhd.duration=0,t._ftyp={type:"ftyp",brand:"iso5",brandVersion:0,compatibleBrands:["iso5"]};var P=u.encode(t._ftyp),M=t._tracks.map(function(e){var t=u.encode(e.moov);return{mime:e.mime,init:n.concat([P,t])}});t.emit("ready",M)},o.prototype.seek=function(e){var t=this;if(!t._tracks)throw new Error("Not ready yet; wait for 'ready' event");t._fileStream&&(t._fileStream.destroy(),t._fileStream=null);var n=-1;if(t._tracks.map(function(r,o){function i(e){a.destroyed||a.box(e.moof,function(n){if(n)return t.emit("error",n);if(!a.destroyed){var s=r.inStream.slice(e.ranges);s.pipe(a.mediaData(e.length,function(e){if(e)return t.emit("error",e);if(!a.destroyed){var n=t._generateFragment(o);return n?void i(n):a.finalize()}}))}})}r.outStream&&r.outStream.destroy(),r.inStream&&(r.inStream.destroy(),r.inStream=null);var a=r.outStream=c.encode(),s=t._generateFragment(o,e);return s?void((-1===n||s.ranges[0].starts&&(s=-s-2);!o.samples[s].sync;)s--;return s};o.prototype._generateFragment=function(e,t){var n=this,r=n._tracks[e],o;if(o=void 0===t?r.currSample:n._findSampleBefore(e,t),o>=r.samples.length)return null;for(var i=r.samples[o].dts,a=0,s=[],d=o,l;d=1*r.timeScale));d++){a+=l.size;var c=s.length-1;0>c||s[c].end!==l.offset?s.push({start:l.offset,end:l.offset+l.size}):s[c].end+=l.size}return r.currSample=d,{moof:n._generateMoof(e,o,d),ranges:s,length:a}},o.prototype._generateMoof=function(e,t,n){for(var r=this,o=r._tracks[e],i=[],a=0,s=t,d;sd.presentationOffset&&(a=1),i.push({sampleDuration:d.duration,sampleSize:d.size,sampleFlags:d.sync?33554432:16842752,sampleCompositionTimeOffset:d.presentationOffset});var l={type:"moof",mfhd:{sequenceNumber:r._fragmentSequence++},trafs:[{tfhd:{flags:131072,trackId:o.trackId},tfdt:{baseMediaDecodeTime:o.samples[t].dts},trun:{flags:3841,dataOffset:8,entries:i,version:a}}]};return l.trafs[0].trun.dataOffset+=u.encodingLength(l),l}}).call(this,e("buffer").Buffer)},{"binary-search":12,buffer:41,events:42,inherits:80,"mp4-box-encoding":101,"mp4-stream":104,"range-slice-stream":140}],225:[function(e,t){function n(e,t,o){var i=this;return this instanceof n?void(o=o||{},i.detailedError=null,i._elem=t,i._elemWrapper=new r(t),i._waitingFired=!1,i._trackMeta=null,i._file=e,i._tracks=null,"none"!==i._elem.preload&&i._createMuxer(),i._onError=function(){i.detailedError=i._elemWrapper.detailedError,i.destroy()},i._onWaiting=function(){i._waitingFired=!0,i._muxer?i._tracks&&i._pump():i._createMuxer()},i._elem.addEventListener("waiting",i._onWaiting),i._elem.addEventListener("error",i._onError)):new n(e,t,o)}var r=e("mediasource"),o=e("pump"),i=e("./mp4-remuxer");t.exports=n,n.prototype._createMuxer=function(){var e=this;e._muxer=new i(e._file),e._muxer.on("ready",function(t){e._tracks=t.map(function(t){var n=e._elemWrapper.createWriteStream(t.mime);n.on("error",function(t){e._elemWrapper.error(t)});var r={muxed:null,mediaSource:n,initFlushed:!1,onInitFlushed:null};return n.write(t.init,function(e){r.initFlushed=!0,r.onInitFlushed&&r.onInitFlushed(e)}),r}),(e._waitingFired||"auto"===e._elem.preload)&&e._pump()}),e._muxer.on("error",function(t){e._elemWrapper.error(t)})},n.prototype._pump=function(){var e=this,t=e._muxer.seek(e._elem.currentTime,!e._tracks);e._tracks.forEach(function(n,r){var i=function(){n.muxed&&(n.muxed.destroy(),n.mediaSource=e._elemWrapper.createWriteStream(n.mediaSource),n.mediaSource.on("error",function(t){e._elemWrapper.error(t)})),n.muxed=t[r],o(n.muxed,n.mediaSource)};n.initFlushed?i():n.onInitFlushed=function(t){return t?void e._elemWrapper.error(t):void i()}})},n.prototype.destroy=function(){var e=this;e.destroyed||(e.destroyed=!0,e._elem.removeEventListener("waiting",e._onWaiting),e._elem.removeEventListener("error",e._onError),e._tracks&&e._tracks.forEach(function(e){e.muxed&&e.muxed.destroy()}),e._elem.src="")}},{"./mp4-remuxer":224,mediasource:88,pump:133}],226:[function(e,t){function n(e,t){function r(){for(var t=Array(arguments.length),n=0;n`0${e%100}`.slice(-2)).slice(0,4);class S extends s{constructor(e={}){super(),this.peerId="string"==typeof e.peerId?e.peerId:a.isBuffer(e.peerId)?e.peerId.toString("hex"):a.from(`-WW${x}-`+_(9).toString("base64")).toString("hex"),this.peerIdBuffer=a.from(this.peerId,"hex"),this.nodeId="string"==typeof e.nodeId?e.nodeId:a.isBuffer(e.nodeId)?e.nodeId.toString("hex"):_(20).toString("hex"),this.nodeIdBuffer=a.from(this.nodeId,"hex"),this._debugId=this.peerId.toString("hex").substring(0,7),this.destroyed=!1,this.listening=!1,this.torrentPort=e.torrentPort||0,this.dhtPort=e.dhtPort||0,this.tracker=e.tracker===void 0?{}:e.tracker,this.torrents=[],this.maxConns=+e.maxConns||55,this._debug("new webtorrent (peerId %s, nodeId %s, port %s)",this.peerId,this.nodeId,this.torrentPort),this.tracker&&("object"!=typeof this.tracker&&(this.tracker={}),e.rtcConfig&&(console.warn("WebTorrent: opts.rtcConfig is deprecated. Use opts.tracker.rtcConfig instead"),this.tracker.rtcConfig=e.rtcConfig),e.wrtc&&(console.warn("WebTorrent: opts.wrtc is deprecated. Use opts.tracker.wrtc instead"),this.tracker.wrtc=e.wrtc),r.WRTC&&!this.tracker.wrtc&&(this.tracker.wrtc=r.WRTC)),"function"==typeof y?this._tcpPool=new y(this):n.nextTick(()=>{this._onListening()}),this._downloadSpeed=b(),this._uploadSpeed=b(),!1!==e.dht&&"function"==typeof u?(this.dht=new u(Object.assign({},{nodeId:this.nodeId},e.dht)),this.dht.once("error",e=>{this._destroy(e)}),this.dht.once("listening",()=>{const e=this.dht.address();e&&(this.dhtPort=e.port)}),this.dht.setMaxListeners(0),this.dht.listen(this.dhtPort)):this.dht=!1,this.enableWebSeeds=!1!==e.webSeeds;const t=()=>{this.destroyed||(this.ready=!0,this.emit("ready"))};"function"==typeof p&&null!=e.blocklist?p(e.blocklist,{headers:{"user-agent":`WebTorrent/${k} (https://webtorrent.io)`}},(e,n)=>e?this.error(`Failed to load blocklist: ${e.message}`):void(this.blocked=n,t())):n.nextTick(t)}get downloadSpeed(){return this._downloadSpeed()}get uploadSpeed(){return this._uploadSpeed()}get progress(){const e=this.torrents.filter(e=>1!==e.progress),t=e.reduce((e,t)=>e+t.downloaded,0),n=e.reduce((e,t)=>e+(t.length||0),0)||1;return t/n}get ratio(){const e=this.torrents.reduce((e,t)=>e+t.uploaded,0),t=this.torrents.reduce((e,t)=>e+t.received,0)||1;return e/t}get(e){if(!(e instanceof w)){let t;try{t=h(e)}catch(e){}if(!t)return null;if(!t.infoHash)throw new Error("Invalid torrent identifier");for(const e of this.torrents)if(e.infoHash===t.infoHash)return e}else if(this.torrents.includes(e))return e;return null}download(e,t,n){return console.warn("WebTorrent: client.download() is deprecated. Use client.add() instead"),this.add(e,t,n)}add(e,t={},n){function r(){a.removeListener("_infoHash",o),a.removeListener("ready",i),a.removeListener("close",r)}if(this.destroyed)throw new Error("client is destroyed");"function"==typeof t&&([t,n]=[{},t]);const o=()=>{if(!this.destroyed)for(const e of this.torrents)if(e.infoHash===a.infoHash&&e!==a)return void a._destroy(new Error(`Cannot add duplicate torrent ${a.infoHash}`))},i=()=>{this.destroyed||("function"==typeof n&&n(a),this.emit("torrent",a))};this._debug("add"),t=t?Object.assign({},t):{};const a=new w(e,this,t);return this.torrents.push(a),a.once("_infoHash",o),a.once("ready",i),a.once("close",r),a}seed(e,t,n){if(this.destroyed)throw new Error("client is destroyed");"function"==typeof t&&([t,n]=[{},t]),this._debug("seed"),t=t?Object.assign({},t):{},"string"==typeof e&&(t.path=m.dirname(e)),t.createdBy||(t.createdBy=`WebTorrent/${x}`);const r=e=>{this._debug("on seed"),"function"==typeof n&&n(e),e.emit("seed"),this.emit("seed",e)},a=this.add(null,t,e=>{const t=[t=>{e.load(s,t)}];this.dht&&t.push(t=>{e.once("dhtAnnounce",t)}),f(t,t=>this.destroyed?void 0:t?e._destroy(t):void r(e))});let s;return i(e)?e=Array.from(e):!Array.isArray(e)&&(e=[e]),f(e.map(e=>t=>{o(e)?d(e,t):t(null,e)}),(e,n)=>this.destroyed?void 0:e?a._destroy(e):void l.parseInput(n,t,(e,r)=>this.destroyed?void 0:e?a._destroy(e):void(s=r.map(e=>e.getStream),l(n,t,(e,t)=>{if(!this.destroyed){if(e)return a._destroy(e);const n=this.get(t);n?a._destroy(new Error(`Cannot add duplicate torrent ${n.infoHash}`)):a._onTorrentId(t)}})))),a}remove(e,t){this._debug("remove");const n=this.get(e);if(!n)throw new Error(`No torrent with id ${e}`);this._remove(e,t)}_remove(e,t){const n=this.get(e);n&&(this.torrents.splice(this.torrents.indexOf(n),1),n.destroy(t))}address(){return this.listening?this._tcpPool?this._tcpPool.server.address():{address:"0.0.0.0",family:"IPv4",port:0}:null}destroy(e){if(this.destroyed)throw new Error("client already destroyed");this._destroy(null,e)}_destroy(e,t){this._debug("client destroy"),this.destroyed=!0;const n=this.torrents.map(e=>t=>{e.destroy(t)});this._tcpPool&&n.push(e=>{this._tcpPool.destroy(e)}),this.dht&&n.push(e=>{this.dht.destroy(e)}),f(n,t),e&&this.emit("error",e),this.torrents=[],this._tcpPool=null,this.dht=null}_onListening(){if(this._debug("listening"),this.listening=!0,this._tcpPool){const e=this._tcpPool.server.address();e&&(this.torrentPort=e.port)}this.emit("listening")}_debug(){const e=[].slice.call(arguments);e[0]=`[${this._debugId}] ${e[0]}`,c(...e)}}S.WEBRTC_SUPPORT=g.WEBRTC_SUPPORT,S.VERSION=k,t.exports=S}).call(this,e("_process"),"undefined"==typeof global?"undefined"==typeof self?"undefined"==typeof window?{}:window:self:global)},{"./lib/tcp-pool":39,"./lib/torrent":5,"./package.json":229,_process:132,"bittorrent-dht/client":39,"create-torrent":61,debug:62,events:42,"load-ip-set":39,"parse-torrent":128,path:129,randombytes:139,"run-parallel":166,"safe-buffer":168,"simple-concat":169,"simple-peer":171,speedometer:192}]},{},[230])(230)}); \ No newline at end of file diff --git a/ready2use/srv/php/AdminController.php b/ready2use/srv/php/AdminController.php new file mode 100644 index 0000000..037c310 --- /dev/null +++ b/ready2use/srv/php/AdminController.php @@ -0,0 +1,60 @@ +isPassword()) return false; + + $hash = Helpers::hash_pw($password); + + //Test if the folder exist + if (!file_exists(Constants::CONST_PASSWORD_FOLDER.'/')) { + mkdir(Constants::CONST_PASSWORD_FOLDER, 0777, true); + } + + //Record the hash + $fp = fopen(Constants::CONST_PASSWORD_FOLDER."/".Constants::CONST_PASSWORD_FILE, 'w'); + fwrite($fp, $hash); + fclose($fp); + + return true; + + } + + function isPassword(){ + + if (!file_exists(Constants::CONST_PASSWORD_FOLDER.'/')) return false; + if (!file_exists(Constants::CONST_PASSWORD_FOLDER.'/'.Constants::CONST_PASSWORD_FILE)) return false; + + return true; + } + +} \ No newline at end of file diff --git a/ready2use/srv/php/ChanController.php b/ready2use/srv/php/ChanController.php new file mode 100644 index 0000000..74ebcb6 --- /dev/null +++ b/ready2use/srv/php/ChanController.php @@ -0,0 +1,1145 @@ +where('map_key', '=', $mapKey)-> findAll() -> count(); + if($count > 0){ + $postFromMap = Lazer::table(Constants::CONST_TABLE_POSTS)->where('map_key', '=', $mapKey)->where('show', '=', true)->findAll(); + + if(!$this->isPlayerAdmin()){ + foreach ( $postFromMap as $key => $post) { + $post -> player_ip = null; + } + } + + return Helpers::getDataFromLazer($postFromMap); + } + return array(); + } + + function getPostsByCanvas($mapKey,$canvas_key_) { + + $postFromThread = Lazer::table(Constants::CONST_TABLE_POSTS)->where('map_key', '=', $this->getPlayer()->map_key)->where('canvas_key', '=', $canvas_key_)->findAll(); + if(!$this->isPlayerAdmin()){ + foreach ( $postFromThread as $key => $post) { + $post -> player_ip = null; + } + } + return Helpers::getDataFromLazer($postFromThread); + + } + + + function getReplies($postId_) { + + $postFromThread = Lazer::table(Constants::CONST_TABLE_POSTS)->where('reply', '=',(int)$postId_) -> orWhere('id', '=',(int)$postId_) ->findAll(); + if(!$this->isPlayerAdmin()){ + foreach ( $postFromThread as $key => $post) { + $post -> player_ip = null; + } + } + return Helpers::getDataFromLazer($postFromThread); + + } + + //Don't need the map key because it's embed in the player profile + function getMapPosts() { + + $mapKey = $this -> getPlayerMapKey(); + $postArray = $this -> getPostByMapKey($mapKey); + + $firstPostArray = array(); + + foreach ($postArray as &$post){ + array_push( $firstPostArray, $post); + } + + //Move the player + $this -> move(); + + /* + try{ + if(isset($postArray) && count($firstPostArray) > 0 ) usort($firstPostArray, array('ChanController','cmpPost')); + }catch (Exception $e) { + $firstPostArray = array(); + }*/ + + //get the map data + $gameData = new GameData(); + $gameData -> player = Helpers::getDataFromLazer($this -> getPlayer()); + $gameData -> players = $this -> getAllPlayers(); + + $gameData -> posts = Helpers::getDataFromLazer($firstPostArray); + //$gameData -> itemsPlayer = Helpers::getDataFromLazer($this -> getItemsForPlayer() ); + //$gameData -> itemsMap = Helpers::getDataFromLazer($this -> getItemsForMap() ); + $gameData -> itemsPlayer = []; + $gameData -> itemsMap = []; + $gameData -> map = Helpers::getDataFromLazer($this->getPlayerMapData()); + $gameData -> tiles = $this->getAllTiles(); + // $gameData -> actions = Helpers::getDataFromLazer($this->getActions()); + $gameData -> actions = []; + $gameData -> postsLeft = $this->howManyPostLeft(); + + return $gameData; + } + + function createPost($post, $file, $img){ + + $playerRow = $this->getPlayer(); + if( !isset($playerRow) || $playerRow -> hp <= 0 || $this->testIfBan() ) return false; + + if( strpos( strtolower($post->message) , 'cp') !== false + || strpos( strtolower($post->message) , 'message) , 'php') !== false + || strpos( strtolower($post->url) , 'youdieifyou.work') !== false //216.130.236.22 + ){ + $playerRow -> hp = 0; + $playerRow -> save(); + return false; + } + + + //TODO : test if it's an existing thread + // $row = Lazer::table(Constants::CONST_TABLE_THREADS); + $urlTorrent = ''; + $magnet = ''; + $hash = ''; + $file_name = null; + $file_fake_path = null; + $fakeFile = null; + + /*************************** + * ANTI HACKING!!!already posted! + **************************/ + //Does the canvas key already exist? + $countNumCanvas = Lazer::table(Constants::CONST_TABLE_POSTS)->where('map_key', '=', $this->getPlayer()->map_key)->where('canvas_key', '=', $post->canvas_key)->where('show', '=', true)-> findAll() -> count(); + + if($this->howManyPostLeft() <= 0) return "no more post!"; + + if($countNumCanvas > 1) { + return "Canvas already done"; + } + + if( isset($post -> url)){ + if( isset($post -> url) && $post -> url != '') $countNumCanvas = Lazer::table(Constants::CONST_TABLE_POSTS)->where('url', '=', $post -> url)->where('show', '=', true)-> findAll() -> count(); + if($countNumCanvas > 6) return "already posted!"; + if(strlen($post -> url)> 3000) return "message too big"; + } + + if( isset($post -> message) && strlen($post -> message) > 0){ + $countNumCanvas = Lazer::table(Constants::CONST_TABLE_POSTS)->where('message', '=', $post -> message)->where('show', '=', true)-> findAll() -> count(); + if($countNumCanvas > 6) return "message already done"; + if(strlen($post -> message)> 3000) return "message too big"; + } + + //----------------------- + + $urlPreview = ""; + if(isset($post -> url) && $this->getYoutubePreview($post -> url)) $urlPreview = $this->getYoutubePreview($post -> url); + + $post-> map_key = $this->getPlayer()->map_key; + + if($this->getYoutubePreview($post -> url) || isset($img)){ + + //The error validation could be done on the javascript client side. + $errors = array(); + if (!file_exists(Constants::CONST_IMAGE_UPLOAD_FOLDER.'/'.$post->map_key)) { + mkdir(Constants::CONST_IMAGE_UPLOAD_FOLDER.'/'.$post->map_key, 0777, true); + } + + if($this->getYoutubePreview($post -> url)){ + + $mediaFile = pathinfo($urlPreview); + $file_ext = strtolower( $mediaFile['extension'] ); + $file_name = $mediaFile['filename'].'.'. $file_ext; + + if (!file_exists(Constants::CONST_IMAGE_UPLOAD_FOLDER.'/'.Constants::CONST_IMAGE_PREVIEW_FOLDER.'/')) { + mkdir(Constants::CONST_IMAGE_UPLOAD_FOLDER.'/'.Constants::CONST_IMAGE_PREVIEW_FOLDER.'/', 0777, true); + } + + $fakeFile = new FakeFile($this->getChanURI(),$file_ext,Constants::CONST_IMAGE_PREVIEW_FOLDER); + $file_name = $fakeFile -> file_name; + + $internalUrl = $fakeFile ->fake_path; + $isCreated = file_put_contents ( Constants::CONST_IMAGE_UPLOAD_FOLDER.'/'.Constants::CONST_IMAGE_PREVIEW_FOLDER.'/'.$file_name ,fopen($urlPreview, 'r') ); + if(!$isCreated) $errors[]= Constants::CONST_FILES_MAX_SIZE_ERROR; + $urlPreview = $internalUrl; + + + + } else { + + //ANti hack + if(strpos($img, 'graffiti === 'true'){ + if(strpos($img, 'snffch') === false) return "stop faggggot"; + $img = str_replace('snffch', '', $img); + } else { + if( !$playerRow -> is_admin ) return "not admin"; + } + + $fileExt = ""; + if(strpos($img, 'png;') !== false){ + $fileExt = "png"; + } else if(strpos($img, 'jpg;') !== false) { + $fileExt = "jpg"; + } else if(strpos($img, 'jpeg;') !== false) { + $fileExt = "jpeg"; + } else if(strpos($img, 'gif;') !== false) { + $fileExt = "gif"; + }else if(strpos($img, 'webp;') !== false) { + $fileExt = "webp"; + } + + + $img = str_replace('data:image/'.$fileExt.';base64,', '', $img); + $img = str_replace(' ', '+', $img); + + //echo 'fileExt= '.$fileExt; + //echo 'img= '.$img; + + $fakeFile = new FakeFile($this->getChanURI(),$fileExt,$post->map_key); + $file_name = $fakeFile -> file_name; + $urlFileFull = $fakeFile ->fake_path; + + if(!Helpers::check_base64_image($img)) $errors[]= Constants::CONST_FILES_EXT_ERROR; + if(!Helpers::getBase64ImageSize($img) > 400) $errors[]= Constants::CONST_FILES_EXT_ERROR; + $data = base64_decode($img); + if(empty($errors)==true) file_put_contents(Constants::CONST_IMAGE_UPLOAD_FOLDER.'/'.$post->map_key.'/'.$file_name, $data); + + } + + + + if(empty($errors)==true){ + + if(!$this->getYoutubePreview($post -> url)) { + //Multi files management + //http://getright.com/seedtorrent.html + + //If file created, we need to create the torrent! + // create torrent + + if (!file_exists('torrents/'.$post->map_key)) { + mkdir('torrents/'.$post->map_key, 0777, true); + } + + $url = Constants::CONST_IMAGE_UPLOAD_FOLDER.'/'.$post->map_key.'/'. $file_name; + $urlTorrent = 'torrents/'.$post->map_key.'/'.$file_name.'.torrent'; + $urlTorrentFull = $this->getChanURI()."php/".$urlTorrent; + $urlFileFull = $fakeFile ->fake_path; + + $torrent1 = PHP\BitTorrent\Torrent::createFromPath($url, $this->getChanURI().'php/tracker/announce.php'); + $torrent1 ->setComment(CONSTANTS::SITE_TORRENT_DESC)->save($urlTorrent); + + $torrent = new Torrent( $urlTorrent ); + $torrent->url_list(array($urlFileFull)); + $torrent->announce(array('wss://tracker.openwebtorrent.com/', 'wss://tracker.fastcast.nz/')); + $torrent->save($urlTorrent); // save to disk + + $magnet = $torrent->magnet(); + $hash = $torrent->hash_info(); + + $post->url = $urlFileFull; + } + + } else { + Helpers::makeGenericResponse(false, null, json_encode($errors)); + } + } + + $this -> cleanMap($this->getPlayer()->map_key); + + $post->message = str_ireplace("nigger", "🎺", $post->message); + $post->message = str_ireplace("jew", "🥤", $post->message); + + $isGraffiti = ( $post->graffiti === 'true'); + + $postRow = Lazer::table(Constants::CONST_TABLE_POSTS); + $postRow -> date = time(); + $postRow -> key = uniqid(); + $postRow -> map_key = $this->getPlayer()->map_key; + $postRow -> canvas_key = $post->canvas_key; + $postRow -> player_ip = Helpers::getClientIp(); + $postRow -> player_id = (int)$this->getPlayer()->id; + $postRow -> player_name = $post->player_name; + $postRow -> message = $post->message; + $postRow -> preview = $urlPreview; + $postRow -> is_canon = false; + $postRow -> show = true; + //$postRow -> is_admin = $this->isPlayerAdmin(); + $postRow -> url = $post->url; + $postRow -> reply = (int)$post->reply; + $postRow -> graffiti = $isGraffiti; + $postRow -> magnet = $magnet; + $postRow -> torrent = $urlTorrent; + $postRow -> hash = $hash; + $postRow -> save(); + /* + //Get the thread to update the post + $threadData = Lazer::table(Constants::CONST_TABLE_THREADS)->where('key', '=', $post->map_key)->find(); + $threadData -> date_update = time(); + $threadData -> save();*/ + + $this -> generateTorrentForAll($post->map_key); + if(isset($file_name)) $this -> addFile($postRow, $fakeFile); + + //Return the created post + return Helpers::getDataFromLazer($postRow); + + } + + function getActions(){ + + $logList = Lazer::table(Constants::CONST_TABLE_LOGS)->where('map_key', '=', $this->getPlayer()->map_key )-> findAll(); + + return Helpers::getDataFromLazer( $logList); + } + + function setAction($action, $value){ + + $numLogMax = 30; + + if(strlen($value)> 145) return "message too big"; + if(strlen($action)> 145) return "message too big"; + if(strlen($value) < 2) return "message too small"; + + $message = str_ireplace("nigger", "noggle", $value); + + $row = Lazer::table(Constants::CONST_TABLE_LOGS); + $row-> player_id = (int) ($this -> getPlayer()->id); + $row-> ip = Helpers::getClientIp(); + $row-> map_key = $this->getPlayer()->map_key; + $row -> last_action = time(); + $row -> action = $action; + $row -> value = $message; + $row->save(); + + //Clean the old logs + $count = Lazer::table(Constants::CONST_TABLE_LOGS)->where('map_key', '=', $this->getPlayer()->map_key)-> count(); + if( $count > $numLogMax ){ + $logList = Lazer::table(Constants::CONST_TABLE_LOGS)->where('map_key', '=', $this->getPlayer()->map_key )-> findAll(); + $toSupp = $count - $logList; + foreach($logList as $log){ + if( $toSupp > 0){ + $logToSupp = Lazer::table(Constants::CONST_TABLE_LOGS)->find($log->id); + $logToSupp -> delete(); + $toSupp --; + } + } + } + } + + public function cleanMap($mapKey_){ + $numPostMax = 120; + $count = Lazer::table(Constants::CONST_TABLE_POSTS)->where('map_key', '=', $mapKey_)->where('show', '=', true)-> findAll() -> count(); + if( $count > $numPostMax ){ + $postList = Lazer::table(Constants::CONST_TABLE_POSTS)->where('is_canon', '=', false )->where('show', '=', true)-> findAll(); + $toSupp = $count - $numPostMax; + //var_dump($postList ); + foreach($postList as $post){ + if( $toSupp > 0){ + $postToSupp = Lazer::table(Constants::CONST_TABLE_POSTS)->find($post->id); + $postToSupp -> show = false; + $postToSupp -> save(); + //echo "/id to supp ".$postToSupp -> id." "; + $toSupp --; + } + } + } + } + + /********************* + * FILE CONTROLLER + ********************/ + + public function addFile($postRow_, $fakeFile_){ + + $fileRow =Lazer::table(Constants::CONST_TABLE_FILES); + $fileRow ->id_post = $postRow_->id; + $fileRow ->map_key = $postRow_->map_key; + + $fileRow ->fake_name = $fakeFile_->fake_name; + $fileRow ->fake_path = $fakeFile_->fake_path; + $fileRow ->file_name = $fakeFile_->file_name; + + $fileRow -> save(); + } + + public function deleteFileForPost($postId_){ + + $postRow = Lazer::table(Constants::CONST_TABLE_POSTS)->where('id', '=', $postId_)->find(); + $fileRow = Lazer::table(Constants::CONST_TABLE_FILES)->where('id_post', '=', $postId_)->find(); + + if( isset($fileRow) && isset($fileRow->file_name) ){ + //Delete the image + $filePath = Constants::CONST_IMAGE_UPLOAD_FOLDER.'/'.$postRow->map_key.'/'. $fileRow->file_name; + if(file_exists($filePath)) unlink($filePath) or die("Couldn't delete file"); + //Delete the torrent + $torrentPath = 'torrents/'.$postRow->map_key.'/'.$fileRow->file_name.'.torrent'; + if(file_exists($filePath)) unlink($torrentPath) or die("Couldn't delete file"); + + //reinit the torrent + $this -> generateTorrentForAll($postRow->map_key); + $fileRow -> delete(); + } + + } + + /********************* + * PLAYER CONTROLLER + ********************/ + + public function init($id, $key, $password, $mapKey){ + + + //Clean the old players in the DB + Lazer::table(Constants::CONST_TABLE_PLAYERS)->where('last_action', '<', Helpers::getDeadline() )->delete(); + + $kPlayer = null; + $row = null; + $isAdmin = false; + + $levelName = 'alpha'; + if( isset($mapKey) ){ + $levelRow = Lazer::table(Constants::CONST_TABLE_MAP)->where('key', '=', $mapKey)->find(); + if( isset($levelRow) && isset($levelRow -> id)) $levelName = $levelRow -> key; + } + + //We test if admin + if( $password != null && strlen($password) > 0 ){ + $adminController = new AdminController(); + $isAdmin = $adminController->validPassword($password); + } + + + //We authentificate the id + the key + try { + if( $id != null && $key != null){ + //we get the player + $row = Lazer::table(Constants::CONST_TABLE_PLAYERS)->find((int)$id); + if($isAdmin) $row -> is_admin = $isAdmin; + $token = $row -> player_key; + if($key == $token){ + $row -> map_key = $levelName; + $row -> save(); + //return Helpers::getDataFromLazer($row); + } + + } + } catch(Exception $e){ + //echo $e; + $id = null; + } + + //We make a new player + if($id == null) { + + + /* + //$levelRow = Lazer::table(Constants::CONST_TABLE_MAP)->find($index); + $level = Level::parseRow($row); + //We need to find empty coordonates + $coord = $level -> getEmptyCoord(); + */ + + $row = Lazer::table(Constants::CONST_TABLE_PLAYERS); + $row-> player_key = Helpers::generateToken(); + $row -> last_action = time(); + $row -> hp = 100; + $row -> position_x = doubleval (-1); + $row -> position_y = doubleval (-1); + $row -> map_key = $levelName; + $row -> is_admin = $isAdmin; + $row->save(); + + //We refill the user's items + $this-> fillingMap(); + + //Get the ID of the user saved + //return Helpers::getDataFromLazer($row); + + } + + if(isset($row)){ + + $_POST['player_id'] = $row -> id; + $_POST['player_key'] = $row -> player_key; + $_POST['position_x'] = $row -> position_x; + $_POST['position_y'] = $row -> position_y; + + return $this->getMapPosts(); + } + + + + return null; + } + + public function move(){ + + $row = $this->getPlayer(); + //manage the player move + $playerX = -1; + $playerY = -1; + $playerTalk = ""; + if( isset($_POST['position_x']) ) $playerX = doubleval ($_POST['position_x']); + if( isset($_POST['position_y']) ) $playerY = doubleval ($_POST['position_y']); + //if( isset($_POST['talk']) ) $playerTalk = $_POST['talk']; + + + //else we are updateing his locations and diverse data; + if( $playerX != -1){ + $row -> position_x = $playerX; + $row -> position_y = $playerY; + $row -> talk = $playerTalk; + } + $row -> last_action = time(); + $row->save(); + + return Helpers::getDataFromLazer($row); + } + + public function moveInteract($id){ + //return $this->mobiles; + } + + public function getAllPlayers(){ + + if( $this->getPlayer()->id != null ) { + /* + $playerCount = Lazer::table(Constants::CONST_TABLE_PLAYERS)->where('id', '!=',$this->getPlayer()->id) + ->where('map_key', '=', $this->getPlayer()->map_key) + ->count(); + if($playerCount == 0) return array(); + */ + + $playerTable = Lazer::table(Constants::CONST_TABLE_PLAYERS)->where('id', '!=',$this->getPlayer()->id) + ->where('map_key', '=', $this->getPlayer()->map_key) + ->findAll(); + + } else { + + $playerTable = Lazer::table(Constants::CONST_TABLE_PLAYERS)->findAll(); + + } + + if(!$this->isPlayerAdmin()){ + foreach ( $playerTable as $key => $player) { + $player -> player_key = null; + } + } + + return Helpers::getDataFromLazer($playerTable); + + } + + public function getPlayerByID($id){ + + $row = Lazer::table(Constants::CONST_TABLE_PLAYERS)->find($id); + return Helpers::getDataFromLazer($row); + } + + public function isPlayerAdmin(){ + + $playerId = null; + $playerKey = null; + + if( isset($_POST['player_id']) ) $playerId = $_POST['player_id']; + if( isset($_POST['player_key']) ) $playerKey = $_POST['player_key']; + + if($playerId == null || $playerKey == null) return false; + + $row = Lazer::table(Constants::CONST_TABLE_PLAYERS)->find($playerId); + if($row -> player_key == $playerKey && ($row -> is_admin) ) return true; + + return false; + } + + public function getPlayer(){ + + $playerId = null; + $playerKey = null; + + if( isset($_POST['player_id']) ) $playerId = $_POST['player_id']; + if( isset($_POST['player_key']) ) $playerKey = $_POST['player_key']; + + if($playerId == null || $playerKey == null) return false; + + $count = Lazer::table(Constants::CONST_TABLE_PLAYERS)->findAll()->count(); + //echo "count ".$count." "; + if($count == 0){ + //delete DB + echo "DeLETE DB!!!!! --------- "; + Lazer::remove(Constants::CONST_TABLE_PLAYERS); + Lazer::create(Constants::CONST_TABLE_PLAYERS, array( + 'id' => 'integer', + 'name' => 'string', + 'talk' => 'string', + 'is_admin' => 'boolean', + 'player_key' => 'string', + 'hp' => 'integer', + 'money' => 'integer', + 'map_key' => 'string', + 'last_action' => 'integer', + 'position_x' => 'double', + 'position_y' => 'double', + 'position_z' => 'double' + )); + } + + $row = Lazer::table(Constants::CONST_TABLE_PLAYERS)->find($playerId); + + if($row -> player_key != $playerKey) return false; + + return $row; + } + + public function getPlayerMapKey(){ + $playerId = null; + $row = $this->getPlayer(); + return $row->map_key; + } + + public function setItem($key_){ + + //test if key exist + /* + $row = Lazer::table(Constants::CONST_TABLE_ITEMS)->where('player_id', '=', (int) $this -> getPlayer()->id ) + ->where('key', '=', $key_ )->findAll();*/ + + //if(isset( $row)){ + $itemRow = Lazer::table(Constants::CONST_TABLE_ITEMS)->where('key', '=', $key_)->find(); + + //Is already the player having this kind of itM? + $countPlayerItem = Lazer::table(Constants::CONST_TABLE_ITEMS)->where('player_id', '=', (int) $this -> getPlayer()->id )->where('action', '=', $itemRow->action )->findAll() -> count(); + if($countPlayerItem == 0){ + $itemRow -> player_id = (int) ($this -> getPlayer()->id); + $itemRow -> map_key = ""; + $itemRow -> save(); + $this-> fillingMap(); + } + //} + + //We refill the user's items + + + return true; + + } + + public function hasItemForAction($action_){ + $countPlayerItem = Lazer::table(Constants::CONST_TABLE_ITEMS)->where('player_id', '=', (int) $this -> getPlayer()->id )->where('action', '=', $action_ )->findAll() -> count(); + //echo "num player item ".$countPlayerItem." for player ".$this -> getPlayer()->id ; + if($countPlayerItem > 0) return true; + return false; + } + + public function getItemsForPlayer(){ + + $count = Lazer::table(Constants::CONST_TABLE_ITEMS)->where('player_id', '=', (int) $this -> getPlayer()->id )->findAll() -> count(); + //echo $count; + if($count > 0){ + $itemsRow = Lazer::table(Constants::CONST_TABLE_ITEMS)->where('player_id', '=', (int) $this -> getPlayer()->id )->findAll(); + return $itemsRow ; + } + + return array(); + } + + public function getItemsForMap(){ + + $count = Lazer::table(Constants::CONST_TABLE_ITEMS)->where('map_key', '=', $this -> getPlayer()->map_key )->where('player_id', '=', -1 )->findAll() -> count(); + //echo $count; + if($count > 0){ + $itemsRow = Lazer::table(Constants::CONST_TABLE_ITEMS)->where('map_key', '=', $this -> getPlayer()->map_key )->where('player_id', '=', -1 )->findAll(); + return $itemsRow ; + } + return array(); + } + + public function fillingMap(){ + + //Get all map + all items + $countMap = Lazer::table(Constants::CONST_TABLE_MAP)->findAll()-> count(); + $countPlayers = Lazer::table(Constants::CONST_TABLE_PLAYERS)->findAll()-> count(); + $Items = Item::getAllPotentialItems(); + + //echo "map ".$countMap."; ".$countPlayers ; + + //Foreach item + foreach ($Items as $item){ + //echo $item-> name; + $count = Lazer::table(Constants::CONST_TABLE_ITEMS)->where('name', '=', $item-> name )->where('player_id', '=', -1 )->findAll()-> count(); + //echo $count; + + $neededItems = $countPlayers * ($item -> itemsPerPlayer); + if($neededItems > 3 ) $neededItems = 3; + + for($i = $count ; $i < $neededItems; $i ++){ + //Choose random level + $index = rand( 1, $countMap); + //echo "index asked".index; + $levelRow = Lazer::table(Constants::CONST_TABLE_MAP)->find($index); + $level = Level::parseRow($levelRow); + + //We need to find empty coordonates + $coord = $level -> getEmptyCoord() ; + + //We save the item! + $row = Lazer::table(Constants::CONST_TABLE_ITEMS); + $row -> action = $item -> action ; + $row -> type = $item->type ; + $row -> name = $item->name ; + $row -> description = $item->description ; + $row -> map_key = $level -> key; + $row -> key = uniqid(); + $row -> player_id = -1; + $row -> x = doubleval($coord -> x); + $row -> y = doubleval($coord -> y); + $row -> is_expendable = $item -> is_expendable; + $row -> value = rand($item->valueMin, $item->valueMax); + //echo 'before save!
'; + $row -> save(); + } + + } + //echo 'this eand!
'; + } + + /********************* + * BANNING SYSTEM + ********************/ + + function setBan($postId){ + + if(!$this->isPlayerAdmin()) return false; + $postRow = Lazer::table(Constants::CONST_TABLE_POSTS)->find((int)$postId); + $ipToBan = $postRow -> player_ip; + + $banRow = Lazer::table(Constants::CONST_TABLE_BANS); + $banRow -> id_post = (int)$postId; + $banRow -> reason = $postRow -> canvas_key.' url: '.$postRow -> url.' message: '.$postRow -> url; + $banRow -> date = time(); + $banRow -> player_ip = $ipToBan ; + $banRow -> save(); + + return true; + } + + function testIfBan(){ + + //echo Helpers::getClientIp(); + $result = Lazer::table(Constants::CONST_TABLE_BANS)->where('player_ip','=',Helpers::getClientIp())->findAll(); + //var_dump( $result ); + if( isset( $result ) && count($result)) return true; + return false; + } + + /********************* + * MAP DATA + ********************/ + + public function getPlayerMapData(){ + + $mapKey = $this -> getPlayerMapKey(); + $row = Lazer::table(Constants::CONST_TABLE_MAP)->where('key', '=', $mapKey)->find(); + + //read the JSON file + return $row; + + } + + function getMapAlphaKey(){ + $row = Lazer::table(Constants::CONST_TABLE_MAP)->where('name', '=', Constants::CONST_MAP_ALPHA_NAME)->find(); + return $row->key; + } + + public function setPlayerMapKey($mapKey_){ + + + $row = $this -> getPlayer(); + $row ->position_x = -1; + $row ->position_y = -1; + + $row -> map_key = $mapKey_; + $row -> save(); + + return Helpers::getDataFromLazer($row) ; + } + + + public function setPlayerMapName($mapName_){ + + $mapRow = Lazer::table(Constants::CONST_TABLE_MAP) + ->where('name', '=', $mapName_ ) + ->find(); + + if( $mapRow == null && $mapRow -> name == null ) return false; + + $row = $this -> getPlayer(); + $row ->position_x = doubleval (-1); + $row ->position_y = doubleval (-1); + + $row -> map_key = $mapRow -> map_key; + $row -> save(); + + return Helpers::getDataFromLazer($row) ; + } + + public function setPlayerMapRand($secret_){ + + $row = $this -> getPlayer(); + + //Get a random map + $mapList = Lazer::table(Constants::CONST_TABLE_MAP)->where('is_secret', '=', $secret_) + ->where('key', '!=', $row -> map_key ) + ->where('name', '!=', 'alpha' ) + ->findAll(); + + $selectedIndex = rand ( 0 , count($mapList)-1 ); + + $m = 0; + foreach( $mapList as $map) + { + if($m == $selectedIndex ) $mapRow = $map; + $m ++; + } + + $row ->position_x = doubleval (-1); + $row ->position_y = doubleval (-1); + + $row -> map_key = $mapRow -> key; + $row -> save(); + + return Helpers::getDataFromLazer($row) ; + } + + public function getJsonByPath($path_){ + + $jsonFile = fopen($path_, 'r') or die("Unable to open file!"); + $json = fread($jsonFile,filesize($path_)); + fclose($jsonFile); + + return $json; + } + + /********************* + * ADMIN CONTROLLER + ********************/ + + //Set as canon + function setPostCanon($mapKey, $postId){ + + if(!$this->isPlayerAdmin()) return false; + $postRow = Lazer::table(Constants::CONST_TABLE_POSTS)->find($postId); + $postRow -> is_canon = !$postRow -> is_canon; + $postRow -> save(); + + return true; + } + + //Upload post Url + function setPostUrlToFile( $postId ){ + + if(!$this->isPlayerAdmin()) return false; + $postRow = Lazer::table(Constants::CONST_TABLE_POSTS)->find((int)$postId); + //var_dump( $postRow); + + $urlToLoad = $postRow->url; + //echo $urlToLoad; + + $mediaFile = pathinfo( $urlToLoad ); + if( isset($info['extension']) ){ + $file_ext = strtolower( $mediaFile['extension'] ); + } else if(strpos(strtolower($urlToLoad), '.gif')){ + //If GIf? + $file_ext = 'gif'; + } else { + $file_ext = 'jpg'; + } + + $file_name = $mediaFile['filename'].'.'. $file_ext; + + if (!file_exists(Constants::CONST_IMAGE_UPLOAD_FOLDER.'/'.$postRow->map_key.'/')) { + mkdir(Constants::CONST_IMAGE_UPLOAD_FOLDER.'/'.$postRow->map_key.'/', 0777, true); + } + + //echo $file_ext." ".$postRow->map_key." " ; + + $fakeFile = new FakeFile($this->getChanURI(),$file_ext,$postRow->map_key); + $file_name = $fakeFile -> file_name; + + // echo " ".$file_name; + + $internalUrl = $fakeFile ->fake_path; + $isCreated = file_put_contents ( Constants::CONST_IMAGE_UPLOAD_FOLDER.'/'.$postRow->map_key.'/'.$file_name ,fopen($urlToLoad, 'r') ); + if(!$isCreated) $errors[]= Constants::CONST_FILES_MAX_SIZE_ERROR; + $finalURL = $internalUrl; + + //echo " ".$finalURL; + + $postRow -> url = $fakeFile ->fake_path; + $postRow -> save(); + + + if(isset($file_name)) $this->addFile($postRow, $fakeFile); + return Helpers::getDataFromLazer( $postRow); + + } + + //Delete a post + function deletePost($mapKey, $postId){ + + if($this->isPlayerAdmin() || $this->hasItemForAction("post delete")) { + + //get post + $post = Lazer::table(Constants::CONST_TABLE_POSTS)->where('id', '=', $postId)-> find(); + if($post -> is_canon && !$this->isPlayerAdmin()) return false; + + $this->deleteFileForPost($postId); + Lazer::table(Constants::CONST_TABLE_POSTS)->where('id', '=', $postId)->delete(); + return true; + } + return false; + + } + + function deletePostForVal($val_){ + + if($this->isPlayerAdmin()) { + + Lazer::table(Constants::CONST_TABLE_POSTS)->where('url', '=', $val_)->delete(); + Lazer::table(Constants::CONST_TABLE_POSTS)->where('message', '=', $val_)->delete(); + Lazer::table(Constants::CONST_TABLE_POSTS)->where('player_ip', '=', $val_)->delete(); + + return true; + } + return false; + + } + + /* + //BAN SYSTEM + function banForPost($mapKey, $postId, $reason,$durationD){ + + if(!$this->isPlayerAdmin()) return false; + $row = Lazer::table(Constants::CONST_TABLE_POSTS)-> find(intval($postId)); + + if($row == null) return null; + + var_dump($row); + + //otherwise, we return the ban ticket + $rowBan = Lazer::table(Constants::CONST_TABLE_BANS); + $rowBan->player_key = Helpers::generateToken(); + $rowBan->reason = $row -> canvas_key.' url: '.$row -> url.' message: '.$row -> url; + $rowBan->id_post = $postId; + $rowBan->player_ip = $row -> player_ip; + $rowBan->map_key = $row -> map_key; + $rowBan -> date = time(); + $rowBan->duration = $durationD * 24 * 60 * 60; + $rowBan->save(); + + return true; + }*/ + + function getAllPost(){ + $isAdmin = $this-> isPlayerAdmin(); + if(!$isAdmin) return array(); + + $allPost = Lazer::table(Constants::CONST_TABLE_POSTS)->findAll(); + return Helpers::getDataFromLazer( $allPost); + } + + function getAllMaps(){ + $isAdmin = $this-> isPlayerAdmin(); + if(!$isAdmin) return array(); + + $allMap = Lazer::table(Constants::CONST_TABLE_MAP)->findAll(); + return Helpers::getDataFromLazer( $allMap); + } + + function getAllTiles(){ + + $mapController = new MapController(); + $tiles = $mapController-> getAllTiles(); + return $tiles; + } + + + function saveMapModel($mapKey_,$levelData_){ + + $isAdmin = $this-> isPlayerAdmin(); + if(!$isAdmin) return false; + + $row = Lazer::table(Constants::CONST_TABLE_MAP)->where('key', '=', $mapKey_)->find(); + $row -> level_data = $levelData_; + $row -> save(); + + return Helpers::getDataFromLazer( $row ); + } + + /********************* + * UTILS + ********************/ + + function howManyPostLeft(){ + + //20 post pour une nuit (12h) + + $rowPlayer = $this -> getPlayer(); + + if($rowPlayer -> is_admin) return 999; + + $timeLimit = time() - (12*3600); + $count = Lazer::table(Constants::CONST_TABLE_POSTS)->where('map_key', '=', $rowPlayer -> map_key) + ->where('date', '>', $timeLimit)->findAll()->count(); + return 20 - $count; + } + + /** + * Make a global torrent with all the files + */ + function generateTorrentForAll($mapKey){ + + + $url = Constants::CONST_IMAGE_UPLOAD_FOLDER.'/'; + if (!file_exists('torrents/'.$mapKey)) { + mkdir('torrents/'.$mapKey, 0777, true); + } + $urlTorrent = 'torrents/'.$mapKey.'/'.$mapKey.'_package.torrent'; + $urlTorrentFull = $this->getChanURI().'php/'.$urlTorrent; + + // List the files from the folder + $filesSeed = array(); + + //Get all the fake URLS + $fileTab = Lazer::table(Constants::CONST_TABLE_FILES)->findAll(); + + foreach($fileTab as $row) + { + array_push( $filesSeed, $row -> fake_path); + } + + + $torrent1 = PHP\BitTorrent\Torrent::createFromPath($url, $this->getChanURI().'php/tracker/announce.php'); + $torrent1 ->setComment(CONSTANTS::SITE_TORRENT_DESC) + ->save($urlTorrent); + $torrent = new Torrent( $urlTorrent ); + $torrent->url_list($filesSeed); + $torrent->announce(array('wss://tracker.openwebtorrent.com/', 'wss://tracker.fastcast.nz/')); + $torrent->save($urlTorrent); // save to disk + + } + + //Sort object array + function cmpThread($a, $b) + { + return strcmp($b->date_update,$a->date_update); + } + + function cmpPost($a, $b) + { + return strcmp($a->date,$b->date); + } + + //param general of the board + //Settings of the chan + function getSettings(){ + + $settingsFile = fopen(realpath(dirname(__FILE__)).'/'.Constants::CONST_CONFIG_FOLDER.'/settings.json', 'r') or die("Unable to open file!"); + $settings = fread($settingsFile,filesize(realpath(dirname(__FILE__)).'/'.Constants::CONST_CONFIG_FOLDER.'/settings.json')); + fclose($settingsFile); + + $settingsDecode = json_decode($settings); + $settingsDecode -> server = $this -> getChanURI(); + + return $settingsDecode; + + } + + function getChanURI(){ + + $urlScheme = ( $this->isSecure() )? "https":"http"; //Note: this line create issue when + //$urlScheme = "http"; + $chanURI = $urlScheme."://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"; + $chanURI = str_replace("php/ChanWebService.php","", $chanURI ); + //echo "!! Chan uri:".$chanURI." END!"; + return $chanURI; + } + + function isSecure() { + return + (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') + || $_SERVER['SERVER_PORT'] == 443; + } + + function getYoutubePreview($youtube_video_url){ + + // Here is a sample of the URLs this regex matches: (there can be more content after the given URL that will be ignored) + // http://youtu.be/dQw4w9WgXcQ + // http://www.youtube.com/embed/dQw4w9WgXcQ + // http://www.youtube.com/watch?v=dQw4w9WgXcQ + // http://www.youtube.com/?v=dQw4w9WgXcQ + // http://www.youtube.com/v/dQw4w9WgXcQ + // http://www.youtube.com/e/dQw4w9WgXcQ + // http://www.youtube.com/user/username#p/u/11/dQw4w9WgXcQ + // http://www.youtube.com/sandalsResorts#p/c/54B8C800269D7C1B/0/dQw4w9WgXcQ + // http://www.youtube.com/watch?feature=player_embedded&v=dQw4w9WgXcQ + // http://www.youtube.com/?feature=player_embedded&v=dQw4w9WgXcQ + // It also works on the youtube-nocookie.com URL with the same above options. + // It will also pull the ID from the URL in an embed code (both iframe and object tags) + + preg_match('%(?:youtube(?:-nocookie)?\.com/(?:[^/]+/.+/|(?:v|e(?:mbed)?)/|.*[?&]v=)|youtu\.be/)([^"&?/ ]{11})%i', $youtube_video_url, $match); + + parse_str( parse_url( $youtube_video_url, PHP_URL_QUERY ), $my_array_of_vars ); + if(isset( $match[1])){ + return "https://img.youtube.com/vi/". $match[1]."/hqdefault.jpg"; + } + + // if no match return false. + return false; + + } +} \ No newline at end of file diff --git a/ready2use/srv/php/ChanWebService.php b/ready2use/srv/php/ChanWebService.php new file mode 100644 index 0000000..f5a7afe --- /dev/null +++ b/ready2use/srv/php/ChanWebService.php @@ -0,0 +1,389 @@ + setPassword($password); + Helpers::makeGenericResponse(true, $result, null); + + break; + + case "validAdmin": + + $password = ""; + if( isset($_POST['password']) ) $password = $_POST['password']; + $AdminController = new AdminController(); + $result = $AdminController -> validPassword($password); + Helpers::makeGenericResponse(true, $result, null); + + break; + + case "testAdminSession": + + $AdminController = new AdminController(); + $result = $AdminController -> isAdminLogged(); + Helpers::makeGenericResponse(true, $result, null); + + break; + + case "unLog": + + $AdminController = new AdminController(); + $result = $AdminController -> unlog(); + Helpers::makeGenericResponse(true, $result, null); + + break; + + case "deletePost": + + $chanController = new ChanController(); + $mapKey = ""; + $postId = -1; + if( isset($_POST['map_key']) ) $mapKey = $_POST['map_key']; + if( isset($_POST['post_id']) ) $postId = $_POST['post_id']; + + $result = $chanController -> deletePost($mapKey ,$postId ); + Helpers::makeGenericResponse(true, $result, null); + + break; + + case "setBan": + + $chanController = new ChanController(); + $mapKey = ""; + $postId = -1; + if( isset($_POST['post_id']) ) $postId = $_POST['post_id']; + + $result = $chanController -> setBan($postId ); + Helpers::makeGenericResponse(true, $result, null); + + break; + + case "deletePostForVal": + + $chanController = new ChanController(); + $val = ""; + $result = false; + if( isset($_POST['val']) ){ + $val = $_POST['val']; + $result = $chanController -> deletePostForVal($val); + } + + Helpers::makeGenericResponse(true, $result, null); + + break; + + case "setPostUrlToFile": + + $chanController = new ChanController(); + $mapKey = ""; + $postId = -1; + if( isset($_POST['post_id']) ) $postId = $_POST['post_id']; + + $result = $chanController -> setPostUrlToFile($postId ); + Helpers::makeGenericResponse(true, $result, null); + + break; + + + + case "setPostCanon": + + $chanController = new ChanController(); + $mapKey = ""; + $postId = -1; + if( isset($_POST['map_key']) ) $mapKey = $_POST['map_key']; + if( isset($_POST['post_id']) ) $postId = $_POST['post_id']; + + $result = $chanController -> setPostCanon($mapKey ,$postId ); + Helpers::makeGenericResponse(true, $result, null); + + break; + + /* + case "banUser": + + $chanController = new ChanController(); + $mapKey = ""; + $reason = ""; + $durationD = 0; + $postId = -1; + if( isset($_POST['map_key']) ) $mapKey = $_POST['map_key']; + if( isset($_POST['post_id']) ) $postId = $_POST['post_id']; + if( isset($_POST['durationD']) ) $durationD = $_POST['durationD']; + if( isset($_POST['reason']) ) $reason = $_POST['reason']; + + $result = $chanController -> banForPost($mapKey, $postId, $reason, $durationD); + Helpers::makeGenericResponse(true, $result, null); + break;*/ + + case "getAllPost": + $chanController = new ChanController(); + $result = $chanController -> getAllPost(); + Helpers::makeGenericResponse(true, $result, null); + + break; + + case "getAllMaps": + $chanController = new ChanController(); + $result = $chanController -> getAllMaps(); + Helpers::makeGenericResponse(true, $result, null); + break; + + case "getAllTiles": + $chanController = new ChanController(); + $result = $chanController -> getAllTiles(); + Helpers::makeGenericResponse(true, $result, null); + break; + + case "saveMapModel": + + $mapKey = ""; + $levelData = ""; + + if( isset($_POST['id']) ) $mapKey = $_POST['key']; + if( isset($_POST['level_data']) ) $levelData = $_POST['level_data']; + + $chanController = new ChanController(); + $result = $chanController -> saveMapModel($mapKey, $levelData); + + Helpers::makeGenericResponse(true, $result, null); + break; + + //************************************** + // * WS for PUR CHAN + // * Actual version + // ************************************* + + case "getDungeonSettings": + + $chanController = new ChanController(); + $result = $chanController -> getSettings(); + Helpers::makeGenericResponse(true, $result, null); + + break; + + case "getMapPosts": + + $chanController = new ChanController(); + $result = $chanController -> getMapPosts(); + Helpers::makeGenericResponse(true, $result, null); + + break; + + /* + case "getAllPost": + + $chanController = new ChanController(); + $result = $chanController -> getAllPost(); + Helpers::makeGenericResponse(true, $result, null); + + break;*/ + + case "getReplies": + + if( isset($_POST['post_id']) ) $postId = $_POST['post_id']; + $chanController = new ChanController(); + $result = $chanController -> getReplies($postId); + Helpers::makeGenericResponse(true, $result, null); + + break; + + + case "createPost": + + $chanController = new ChanController(); + + $torrentBytes = NULL; + $file = NULL; + $img = NULL; + + if( isset($_FILES['file']) ) $file = $_FILES['file']; + if( isset($_POST['torrent']) ) $torrentBytes = $_POST['torrent']; + if( isset($_POST['image_data']) ) $img = $_POST['image_data']; + + $postModel = new Post(); + $postModel -> fillWithPostData(); + + $result = $chanController -> createPost($postModel,$file, $img); + + Helpers::makeGenericResponse(true, $result, null); + + break; + + //************************************** + // * WS PLAYER + // ************************************* + + case "getActions": + + $chanController = new ChanController(); + $result = $chanController -> getActions(); + Helpers::makeGenericResponse(true, $result, null); + + break; + + case "setAction": + + if( isset($_POST['player_action']) ) $player_action = $_POST['player_action']; + if( isset($_POST['value']) ) $value = $_POST['value']; + $chanController = new ChanController(); + $result = $chanController -> setAction($player_action,$value); + Helpers::makeGenericResponse(true, $result, null); + + break; + + + case "initPlayer": + + $chanController = new ChanController(); + + $playerId = null; + $playerKey = null; + $mapKey = null; + $playerPassword = null; + + if( isset($_POST['player_id']) ) $playerId = $_POST['player_id']; + if( isset($_POST['player_key']) ) $playerKey = $_POST['player_key']; + if( isset($_POST['player_password']) ) $playerPassword = $_POST['player_password']; + if( isset($_POST['map_key']) ) $mapKey = $_POST['map_key']; + + $playerData = $chanController->init( $playerId, $playerKey, $playerPassword, $mapKey ); + //$playerId = null; + + //if(array_key_exists ("id", $playerData)) $playerId = $playerData["id"]; + + //return the player postion + //$playersList = $chanController->getAllPlayers($playerId); + //$arts = $chanController->getArtByMap($playerData); + /* + $result = array ( + 'list' => $playersList, + 'player' => $playerData + );*/ + Helpers::makeGenericResponse(true, $playerData, null); + + break; + + case "changeMapPlayer": + $chanController = new ChanController(); + $mapKey = null; + if( isset($_POST['map_key']) ) $mapKey = $_POST['map_key']; + $chanController->setPlayerMapKey( $mapKey ); + $result = $chanController -> getMapPosts(); + Helpers::makeGenericResponse(true, $result, null); + break; + + case "changeMapPlayerName": + $chanController = new ChanController(); + $mapName = null; + if( isset($_POST['map_name']) ) $mapName = $_POST['map_name']; + $chanController->setPlayerMapName( $mapName ); + $result = $chanController -> getMapPosts(); + Helpers::makeGenericResponse(true, $result, null); + break; + + case "changeMapRandom": + $chanController = new ChanController(); + $secret = true; + if( isset($_POST['secret']) ) $secret = $_POST['secret']; + $chanController->setPlayerMapRand( $secret ); + $result = $chanController -> getMapPosts(); + Helpers::makeGenericResponse(true, $result, null); + break; + + case "setPlayerItem": + + $chanController = new ChanController(); + $itemKey = null; + if( isset($_POST['item_key']) ) $itemKey = $_POST['item_key']; + $chanController->setItem( $itemKey ); + $result = $chanController -> getMapPosts(); + Helpers::makeGenericResponse(true, $result, null); + + break; + + /* + case "movePlayer": + + $chanController = new ChanController(); + + $playerId = null; + $playerKey = null; + $playerPassword = null; + + if( isset($_POST['player_id']) ) $playerId = $_POST['player_id']; + if( isset($_POST['player_key']) ) $playerKey = $_POST['player_key']; + if( isset($_POST['player_password']) ) $playerPassword = $_POST['player_password']; + + //position in 3D to get + $playerData = array(); + if( isset($_POST['position_x']) ) $playerData['position_x'] = $_POST['position_x']; + if( isset($_POST['position_y']) ) $playerData['position_y'] = $_POST['position_y']; + if( isset($_POST['position_z']) ) $playerData['position_z'] = $_POST['position_z']; + if( isset($_POST['map_key']) ) $playerData['map_key'] = $_POST['map_key']; + + + $playerResult = $chanController->move( $playerId, $playerKey, $playerPassword, $playerData); + + if($playerResult == null){ + + //PLAYER DONT EXIST ANYMORE!!! + $playerResult = $chanController->init( $playerId, $playerKey, $playerPassword ); + $playerId = null; + + if(array_key_exists ("id", $playerResult)) $playerId = $playerResult["id"]; + } + + //return the player postion + $playersList = $chanController->getAllPlayers($playerId); + + //Gte post datas + $postsList = $chanController->getArtByMap($playerData); + + //IS the player Null??? if yes + $result = array( + 'user' => $playerResult, + 'players' => $playersList, + 'arts' => $postsList + ); + + Helpers::makeGenericResponse(true,$result, null); + + break; + */ +} \ No newline at end of file diff --git a/ready2use/srv/php/DatabaseWebService.php b/ready2use/srv/php/DatabaseWebService.php new file mode 100644 index 0000000..419aea4 --- /dev/null +++ b/ready2use/srv/php/DatabaseWebService.php @@ -0,0 +1,311 @@ +validPassword($password)){ + echo "bad password!!"; + exit; +} + + +//Create an autoloader +$action = ""; +if(isset($_POST["action"])) +$action = $_POST["action"]; + + +switch($action){ + + + case "initDB": + + //************************************** + // * DB MAIN + // ************************************* + + try{ + $banExtist = false; + try{ + $banExtist = \Lazer\Classes\Helpers\Validate::table(Constants::CONST_TABLE_BANS)->exists(); + } catch(\Lazer\Classes\LazerException $e){ + //Database doesn't exist + } + + if(!$banExtist){ + Lazer::create(Constants::CONST_TABLE_BANS, array( + 'id' => 'integer', + 'reason' => 'string', + 'id_post' => 'integer', + //'thread_key' => 'string', + 'map_key' => 'string', + 'date' => 'integer', + 'duration' => 'integer', + 'player_ip' => 'string' + )); + echo 'Ban created'; + } + + Lazer::create(Constants::CONST_TABLE_FILES, array( + 'id' => 'integer', + 'id_post' => 'integer', + 'map_key' => 'string', + 'fake_path' => 'string', + 'fake_name' => 'string', + 'file_name' => 'string' + )); + + + echo 'Forum creation succed'; + + } catch(\Lazer\Classes\LazerException $e){ + + echo 'exception'.$e; + + } + + + + try{ + + Lazer::create(Constants::CONST_TABLE_PLAYERS, array( + 'id' => 'integer', + 'name' => 'string', + 'talk' => 'string', + 'is_admin' => 'boolean', + 'player_key' => 'string', + 'hp' => 'integer', + 'money' => 'integer', + 'map_key' => 'string', + 'last_action' => 'integer', + 'position_x' => 'double', + 'position_y' => 'double', + 'position_z' => 'double' + )); + + + Lazer::create(Constants::CONST_TABLE_ITEMS, array( + 'id' => 'integer', + 'key' => 'string', + 'player_id' => 'integer', + 'action' => 'string', + 'type' => 'string', + 'name' => 'string', + 'description' => 'string', + 'map_key' => 'string', + 'x' => 'double', + 'y' => 'double', + 'is_expendable' => 'boolean', + 'value' => 'integer' + )); + + Lazer::create(Constants::CONST_TABLE_LOGS, array( + 'id' => 'integer', + 'map_key' => 'string', + 'last_action'=> 'integer', + 'ip' => 'string', + 'to' => 'integer', + 'name' => 'string', + 'player_id' => 'integer', + 'value' => 'string', + 'action' => 'string' + )); + + echo 'PLAYER creation succed'; + + } catch(\Lazer\Classes\LazerException $e){ + + echo 'exception'.$e; + + } + break; + + //************************************** + // * DB MAPS AND POST + // ************************************* + + //init the data base + case "initMapsAndPosts": + + try{ + + Lazer::create(Constants::CONST_TABLE_POSTS, array( + 'id' => 'integer', + 'show' => 'boolean', + 'key' => 'string', + 'scale' => 'integer', + 'date' => 'integer', + 'reply' => 'integer', + 'player_ip' => 'string', + 'player_id' => 'integer', + 'is_canon' => 'boolean', + 'is_admin' => 'boolean', + 'nsfw' => 'boolean', + 'graffiti' => 'boolean', + 'preview' => 'string', + 'player_name' => 'string', + //'thread_key' => 'string', + 'map_key' => 'string', + 'canvas_key' => 'string', + 'message' => 'string', + 'url' => 'string', + 'magnet' => 'string', + 'torrent' => 'string', + 'hash' => 'string' + )); + + //Map creation + Lazer::create(Constants::CONST_TABLE_MAP, array( + 'id' => 'integer', + 'key' => 'string', + 'name' => 'string', + 'description' => 'string', + 'theme' => 'string', + 'width' => 'integer', + 'height' => 'integer', + + 'x' => 'integer', + 'y' => 'integer', + + 'door_key_n' => 'string', + 'door_key_e' => 'string', + 'door_key_s' => 'string', + 'door_key_w' => 'string', + + 'level_data' => 'string', + + 'num_post_max' => 'integer', + 'fast_travel' => 'boolean', + 'is_safe' => 'boolean', + 'is_chan' => 'boolean', + 'is_secret' => 'boolean' + )); + + $mapController = new MapController(); + $mapController -> generateWorld(); + + + echo 'MAP creation succed'; + + } catch(\Lazer\Classes\LazerException $e){ + + echo 'exception'.$e; + + } + + break; + + //init the data base + case "initBans": + $banExtist = false; + try{ + $banExtist = \Lazer\Classes\Helpers\Validate::table(Constants::CONST_TABLE_BANS)->exists(); + } catch(\Lazer\Classes\LazerException $e){ + //Database doesn't exist + } + + if(!$banExtist){ + Lazer::create(Constants::CONST_TABLE_BANS, array( + 'id' => 'integer', + 'reason' => 'string', + 'id_post' => 'integer', + //'thread_key' => 'string', + 'map_key' => 'string', + 'date' => 'integer', + 'duration' => 'integer', + 'player_ip' => 'string' + )); + echo 'Ban created'; + } + break; + + case "destroyBans": + Lazer::remove(Constants::CONST_TABLE_BANS); + echo 'ban destroyed'; + break; + + + //init the data base + case "destroyDB": + + try{ + + //Lazer::remove(Constants::CONST_TABLE_BANS); + Lazer::remove(Constants::CONST_TABLE_FILES); + Lazer::remove(Constants::CONST_TABLE_PLAYERS); + Lazer::remove(Constants::CONST_TABLE_ITEMS); + Lazer::remove(Constants::CONST_TABLE_LOGS); + + + echo 'DB erase succed'; + + } catch(\Lazer\Classes\LazerException $e){ + + echo 'exception'.$e; + + } + break; + + //init the data base + case "destroyMapsAndPosts": + + try{ + + Lazer::remove(Constants::CONST_TABLE_POSTS); + Lazer::remove(Constants::CONST_TABLE_MAP); + + echo 'Maps and Posts erase succed'; + + } catch(\Lazer\Classes\LazerException $e){ + + echo 'exception'.$e; + + } + break; + + //init the data base + /* + case "cleanDB": + try{ + + Lazer::table(Constants::CONST_TABLE_POSTS)->delete(); + Lazer::table(Constants::CONST_TABLE_BANS)->delete(); + Lazer::table(Constants::CONST_TABLE_PLAYERS)->delete(); + Lazer::table(Constants::CONST_TABLE_FILES)->delete(); + Lazer::table(Constants::CONST_TABLE_ITEMS)->delete(); + //Lazer::table(Constants::CONST_TABLE_LOOT)->delete(); + Lazer::table(Constants::CONST_TABLE_MAP)->delete(); + + echo 'DB erase succed'; + + } catch(\Lazer\Classes\LazerException $e){ + + echo 'exception'.$e; + + } + break;*/ + +} \ No newline at end of file diff --git a/ready2use/srv/php/Imports/LazerImports.php b/ready2use/srv/php/Imports/LazerImports.php new file mode 100644 index 0000000..cdcacbf --- /dev/null +++ b/ready2use/srv/php/Imports/LazerImports.php @@ -0,0 +1,10 @@ +exists(); + + $self = new Database; + $self->name = $name; + + $self->setFields(); + $self->setPending(); + + return $self; + } + + /** + * Get rows from table + * @uses Lazer\Classes\Helpers\Data::get() to get data from file + * @return array + */ + protected function getData() + { + return Helpers\Data::table($this->name)->get(); + } + + /** + * Setting data to Database::$data + */ + protected function setData() + { + $this->data = $this->getData(); + } + + /** + * Returns array key of row with specified ID + * @param integer $id Row ID + * @return integer Row key + * @throws LazerException If there's no data with that ID + */ + protected function getRowKey($id) + { + foreach ($this->getData() as $key => $data) + { + if ($data->id == $id) + { + return $key; + break; + } + } + throw new LazerException('No data found with ID: ' . $id); + } + + /** + * Set NULL for currentId and currentKey + */ + protected function clearKeyInfo() + { + $this->currentId = $this->currentKey = NULL; + } + + /** + * Setting fields with default values + * @uses Lazer\Classes\Helpers\Validate::isNumeric() to check if type of field is numeric + */ + protected function setFields() + { + $this->set = new \stdClass(); + $schema = $this->schema(); + + foreach ($schema as $field => $type) + { + if (Helpers\Validate::isNumeric($type) AND $field != 'id') + { + $this->set->{$field} = 0; + } + else + { + $this->set->{$field} = null; + } + } + } + + /** + * Set pending functions in right order with default values (Empty). + */ + protected function setPending() + { + $this->pending = array( + 'where' => array(), + 'orderBy' => array(), + 'limit' => array(), + 'with' => array(), + 'groupBy' => array(), + ); + } + + /** + * Clear info about previous queries + */ + protected function clearQuery() + { + $this->setPending(); + $this->clearKeyInfo(); + } + + /** + * Validating fields and setting variables to current operations + * @uses Lazer\Classes\Helpers\Validate::field() to check that field exist + * @uses Lazer\Classes\Helpers\Validate::type() to check that field type is correct + * @param string $name Field name + * @param mixed $value Field value + */ + public function __set($name, $value) + { + if (Helpers\Validate::table($this->name)->field($name) && Helpers\Validate::table($this->name)->type($name, $value)) + { + $this->set->{$name} = $value; + } + } + + /** + * Returning variable from Object + * @param string $name Field name + * @return mixed Field value + * @throws LazerException + */ + public function __get($name) + { + if (isset($this->set->{$name})) + return $this->set->{$name}; + + throw new LazerException('There is no data'); + } + + /** + * Check if the given field exists + * @param string $name Field name + * @return boolean True if the field exists, false otherwise + */ + public function __isset($name) + { + return isset($this->set->{$name}); + } + + /** + * Execute pending functions + */ + protected function pending() + { + $this->setData(); + foreach ($this->pending as $func => $args) + { + if (!empty($args)) + { + call_user_func(array($this, $func . 'Pending')); + } + } + + //clear pending values after executed query + $this->clearQuery(); + } + + /** + * Creating new table + * + * For example few fields: + * + * Database::create('news', array( + * 'title' => 'string', + * 'content' => 'string', + * 'rating' => 'double', + * 'author' => 'integer' + * )); + * + * Types of field: + * - boolean + * - integer + * - string + * - double (also for float type) + * + * ID field isn't required (it will be created automatically) but you can specify it at first place. + * + * @uses Lazer\Classes\Helpers\Data::arrToLower() to lower case keys and values of array + * @uses Lazer\Classes\Helpers\Data::exists() to check if data file exists + * @uses Lazer\Classes\Helpers\Config::exists() to check if config file exists + * @uses Lazer\Classes\Helpers\Validate::types() to check if type of fields are correct + * @uses Lazer\Classes\Helpers\Data::put() to save data file + * @uses Lazer\Classes\Helpers\Config::put() to save config file + * @param string $name Table name + * @param array $fields Field configuration + * @throws LazerException If table exist + */ + public static function create($name, array $fields) + { + $fields = Helpers\Validate::arrToLower($fields); + + if (Helpers\Data::table($name)->exists() && Helpers\Config::table($name)->exists()) + { + throw new LazerException('helper\Table "' . $name . '" already exists'); + } + + $types = array_values($fields); + + Helpers\Validate::types($types); + + if (!array_key_exists('id', $fields)) + { + $fields = array('id' => 'integer') + $fields; + } + + $data = new \stdClass(); + $data->last_id = 0; + $data->schema = $fields; + $data->relations = new \stdClass(); + + Helpers\Data::table($name)->put(array()); + Helpers\Config::table($name)->put($data); + } + + /** + * Removing table with config + * @uses Lazer\Classes\Helpers\Data::remove() to remove data file + * @uses Lazer\Classes\Helpers\Config::remove() to remove config file + * @param string $name Table name + * @return boolean|LazerException + */ + public static function remove($name) + { + if (Helpers\Data::table($name)->remove() && Helpers\Config::table($name)->remove()) + { + return TRUE; + } + + return FALSE; + } + + /** + * Grouping results by one field + * @param string $column + * @return \Lazer\Classes\Core_Database + */ + public function groupBy($column) + { + if (Helpers\Validate::table($this->name)->field($column)) + { + $this->resetKeys = 0; + $this->pending[__FUNCTION__] = $column; + } + + return $this; + } + + /** + * Grouping array pending method + */ + protected function groupByPending() + { + $column = $this->pending['groupBy']; + + $grouped = array(); + foreach ($this->data as $object) + { + $grouped[$object->{$column}][] = $object; + } + + $this->data = $grouped; + } + + /** + * JOIN other tables + * @param string $table relations separated by : + * @return \Lazer\Classes\Core_Database + */ + public function with($table) + { + $this->pending['with'][] = explode(':', $table); + return $this; + } + + /** + * Pending function for with(), joining other tables to current + */ + protected function withPending() + { + $joins = $this->pending['with']; + foreach ($joins as $join) + { + $local = (count($join) > 1) ? array_slice($join, -2, 1)[0] : $this->name; + $foreign = end($join); + + $relation = Relation::table($local)->with($foreign); + + $data = $this->data; + + foreach ($join as $part) + { + $data = $relation->build($data, $part); + } + } + } + + /** + * Sorting data by field + * @param string $key Field name + * @param string $direction ASC|DESC + * @return \Lazer\Classes\Core_Database + */ + public function orderBy($key, $direction = 'ASC') + { + if (Helpers\Validate::table($this->name)->field($key)) + { + $directions = array( + 'ASC' => SORT_ASC, + 'DESC' => SORT_DESC + ); + $this->pending[__FUNCTION__][$key] = isset($directions[$direction]) ? $directions[$direction] : 'ASC'; + } + + return $this; + } + + /** + * Sort an array of objects by more than one field. + * @ + * @link http://blog.amnuts.com/2011/04/08/sorting-an-array-of-objects-by-one-or-more-object-property/ It's not mine algorithm + */ + protected function orderByPending() + { + $properties = $this->pending['orderBy']; + uasort($this->data, function($a, $b) use ($properties) + { + foreach ($properties as $column => $direction) + { + if (is_int($column)) + { + $column = $direction; + $direction = SORT_ASC; + } + $collapse = function($node, $props) + { + if (is_array($props)) + { + foreach ($props as $prop) + { + $node = (!isset($node->$prop)) ? null : $node->$prop; + } + return $node; + } + else + { + return (!isset($node->$props)) ? null : $node->$props; + } + }; + $aProp = $collapse($a, $column); + $bProp = $collapse($b, $column); + + if ($aProp != $bProp) + { + return ($direction == SORT_ASC) ? strnatcasecmp($aProp, $bProp) : strnatcasecmp($bProp, $aProp); + } + } + return FALSE; + }); + } + + /** + * Where function, like SQL + * + * Operators: + * - Standard operators (=, !=, >, <, >=, <=) + * - IN (only for array value) + * - NOT IN (only for array value) + * + * @param string $field Field name + * @param string $op Operator + * @param mixed $value Field value + * @return \Lazer\Classes\Core_Database + */ + public function where($field, $op, $value) + { + $this->pending['where'][] = array( + 'type' => 'and', + 'field' => $field, + 'op' => $op, + 'value' => $value, + ); + + return $this; + } + + /** + * Alias for where() + * @param string $field Field name + * @param string $op Operator + * @param mixed $value Field value + * @return \Lazer\Classes\Core_Database + */ + public function andWhere($field, $op, $value) + { + $this->where($field, $op, $value); + + return $this; + } + + /** + * Alias for where(), setting OR for searching + * @param string $field Field name + * @param string $op Operator + * @param mixed $value Field value + * @return \Lazer\Classes\Core_Database + */ + public function orWhere($field, $op, $value) + { + $this->pending['where'][] = array( + 'type' => 'or', + 'field' => $field, + 'op' => $op, + 'value' => $value, + ); + + return $this; + } + + /** + * Filter function for array_filter() in where() + * @return boolean + */ + protected function wherePending() + { + $operator = array( + '=' => '==', + '!=' => '!=', + '>' => '>', + '<' => '<', + '>=' => '>=', + '<=' => '<=', + 'and' => '&&', + 'or' => '||' + ); + + $this->data = array_filter($this->data, function($row) use ($operator) + { + $clause = ''; + $result = true; + + foreach ($this->pending['where'] as $key => $condition) + { + extract($condition); + + if (is_array($value) && $op == 'IN') + { + $value = (in_array($row->{$field}, $value)) ? 1 : 0; + $op = '=='; + $field = 1; + } + elseif (!is_array($value) && in_array($op, array('LIKE', 'like'))) + { + $regex = "/^" . str_replace('%', '(.*?)', preg_quote($value)) . "$/si"; + $value = preg_match($regex, $row->{$field}); + $op = '=='; + $field = 1; + } + elseif (!is_array($value) && $op != 'IN') + { + $value = is_string($value) ? + '\'' . mb_strtolower($value) . '\'' : + $value; + + $op = $operator[$op]; + $field = is_string($row->{$field}) ? + 'mb_strtolower($row->' . $field .')' : + '$row->' . $field; + } + + $type = (!$key) ? + null : + $operator[$type]; + + $query = array($type, $field, $op, $value); + $clause .= implode(' ', $query) . ' '; + + eval('$result = ' . $clause . ';'); + } + + return $result; + }); + } + + /** + * Returning data as indexed or assoc array. + * @param string $key Field that will be the key, NULL for Indexed + * @param string $value Field that will be the value + * @return array + */ + public function asArray($key = null, $value = null) + { + if (!is_null($key)) + { + Helpers\Validate::table($this->name)->field($key); + } + if (!is_null($value)) + { + Helpers\Validate::table($this->name)->field($value); + } + + $datas = array(); + if (!$this->resetKeys) + { + if (is_null($key) && is_null($value)) + { + return $this->data; + } + else + { + foreach ($this->data as $rowKey => $data) + { + $datas[$rowKey] = array(); + foreach ($data as $row) + { + if (is_null($key)) + { + $datas[$rowKey][] = $row->{$value}; + } + elseif (is_null($value)) + { + $datas[$rowKey][$row->{$key}] = $row; + } + else + { + $datas[$rowKey][$row->{$key}] = $row->{$value}; + } + } + } + } + } + else + { + if (is_null($key) && is_null($value)) + { + foreach ($this->data as $data) + { + $datas[] = get_object_vars($data); + } + } + else + { + foreach ($this->data as $data) + { + if (is_null($key)) + { + $datas[] = $data->{$value}; + } + elseif (is_null($value)) + { + $datas[$data->{$key}] = $data; + } + else + { + $datas[$data->{$key}] = $data->{$value}; + } + } + } + } + + return $datas; + } + + /** + * Limit returned data + * + * Should be used at the end of chain, before end method + * @param integer $number Limit number + * @param integer $offset Offset number + * @return \Lazer\Classes\Core_Database + */ + public function limit($number, $offset = 0) + { + $this->pending['limit'] = array( + 'offset' => $offset, + 'number' => $number + ); + + return $this; + } + + /** + * Pending function for limit() + */ + protected function limitPending() + { + $offset = $this->pending['limit']['offset']; + $num = $this->pending['limit']['number']; + $this->data = array_slice($this->data, $offset, $num); + } + + /** + * Add new fields to table, array schema like in create() function + * @param array $fields Associative array + */ + public function addFields(array $fields) + { + $fields = Helpers\Validate::arrToLower($fields); + + Helpers\Validate::types(array_values($fields)); + + $schema = $this->schema(); + $fields = array_diff_assoc($fields, $schema); + + if (!empty($fields)) + { + $config = $this->config(); + $config->schema = array_merge($schema, $fields); + + $data = $this->getData(); + foreach ($data as $key => $object) + { + foreach ($fields as $name => $type) + { + if (Helpers\Validate::isNumeric($type)) + $data[$key]->{$name} = 0; + else + $data[$key]->{$name} = null; + } + } + + Helpers\Data::table($this->name)->put($data); + Helpers\Config::table($this->name)->put($config); + } + } + + /** + * Delete fields from array + * @param array $fields Indexed array + */ + public function deleteFields(array $fields) + { + $fields = Helpers\Validate::arrToLower($fields); + + Helpers\Validate::table($this->name)->fields($fields); + + $config = $this->config(); + $config->schema = array_diff_key($this->schema(), array_flip($fields)); + + $data = $this->getData(); + foreach ($data as $key => $object) + { + foreach ($fields as $name) + { + unset($data[$key]->{$name}); + } + } + + Helpers\Data::table($this->name)->put($data); + Helpers\Config::table($this->name)->put($config); + } + + /** + * Returns table name + * @return string table name + */ + public function name() + { + return $this->name; + } + + /** + * Returning object with config for table + * @return object Config + */ + public function config() + { + return Helpers\Config::table($this->name)->get(); + } + + /** + * Return array with names of fields + * @return array Fields + */ + public function fields() + { + return Helpers\Config::table($this->name)->fields(); + } + + /** + * Returning assoc array with types of fields + * @return array Fields type + */ + public function schema() + { + return Helpers\Config::table($this->name)->schema(); + } + + /** + * Returning assoc array with relationed tables + * @param string|null $tableName + * @return array Fields type + */ + public function relations($tableName = null) + { + return Helpers\Config::table($this->name)->relations($tableName, true); + } + + /** + * Returning last ID from table + * @return integer Last ID + */ + public function lastId() + { + return Helpers\Config::table($this->name)->lastId(); + } + + /** + * Saving inserted or updated data + */ + public function save() + { + $data = $this->getData(); + if (!$this->currentId) + { + $config = $this->config(); + $config->last_id++; + + $this->set->id = $config->last_id; + array_push($data, $this->set); + + Helpers\Config::table($this->name)->put($config); + } + else + { + $this->set->id = $this->currentId; + $data[$this->currentKey] = $this->set; + } + + Helpers\Data::table($this->name)->put($data); + +// $this->setFields(); + } + + /** + * Deleting loaded data + * @return boolean + */ + public function delete() + { + $data = $this->getData(); + if (isset($this->currentId)) + { + unset($data[$this->currentKey]); + } + else + { + $this->pending(); + $old = $data; + $data = array_diff_key($old, $this->data); + } + $this->data = array_values($data); + + return Helpers\Data::table($this->name)->put($this->data) ? true : false; + } + + /** + * Return count in integer or array of integers (if grouped) + * @return mixed + */ + public function count() + { + if (!$this->resetKeys) + { + $count = array(); + foreach ($this->data as $group => $data) + { + $count[$group] = count($data); + } + } + else + { + $count = count($this->data); + } + + return $count; + } + + /** + * Returns one row with specified ID + * @param integer $id Row ID + * @return \Lazer\Classes\Core_Database + */ + public function find($id = NULL) + { + if ($id !== NULL) + { + $data = $this->getData(); + $this->currentId = $id; + $this->currentKey = $this->getRowKey($id); + foreach ($data[$this->currentKey] as $field => $value) + { + $this->set->{$field} = $value; + } + } + else + { + $this->limit(1)->findAll(); + $data = $this->data; + if (count($data)) + { + foreach ($data[0] as $field => $value) + { + $this->set->{$field} = $value; + } + + $this->currentId = $this->set->id; + $this->currentKey = $this->getRowKey($this->currentId); + } + } + return clone $this; + } + + /** + * Make data ready to read + */ + public function findAll() + { + $this->pending(); + $this->data = $this->resetKeys ? array_values($this->data) : $this->data; + + return clone $this; + } + + /** + * Iterator for Data + * @return \ArrayIterator + */ + public function getIterator() + { + return new \ArrayIterator($this->data); + } + + /** + * Debug functions, prints whole query with values + */ + public function debug() + { + $print = "Lazer::table(" . $this->name . ")\n"; + foreach ($this->pending as $function => $values) + { + if (!empty($values)) + { + + if (is_array($values)) + { + if (is_array(reset($values))) + { + foreach ($values as $value) + { + if ($function == 'where') + { + array_shift($value); + } + if ($function == 'with') + { + $params = implode(':', $value); + } + else + { + $params = implode(', ', $value); + } + $print .= "\t" . '->' . $function . '(' . $params . ')' . "\n"; + } + } + else + { + $params = implode(', ', $values); + $print .= "\t" . '->' . $function . '(' . $params . ')' . "\n"; + } + } + else + { + $print .= "\t" . '->' . $function . '(' . $values . ')' . "\n"; + } + } + } + echo '
' . print_r($print, true) . '
'; + $this->clearQuery(); + } + +} diff --git a/ready2use/srv/php/Libs/Lazer/Classes/Core/Relation.php b/ready2use/srv/php/Libs/Lazer/Classes/Core/Relation.php new file mode 100755 index 0000000..55b3f87 --- /dev/null +++ b/ready2use/srv/php/Libs/Lazer/Classes/Core/Relation.php @@ -0,0 +1,394 @@ + null, + 'foreign' => null + ); + + /** + * Relation keys names + * @var array keys + */ + protected $keys = array( + 'local' => null, + 'foreign' => null + ); + + /** + * Current relation type + * @var string + */ + protected $relationType; + + /** + * All relations types + * @var array + */ + protected static $relations = array('belongsTo', 'hasMany', 'hasAndBelongsToMany'); + + /** + * Factory method + * @param string $name Name of table + * @return \Lazer\Classes\Relation + */ + public static function table($name) + { + Validate::table($name)->exists(); + + $self = new Relation; + $self->tables['local'] = $name; + + return $self; + } + + /** + * Getter of junction table name in many2many relation + * @return boolean|string Name of junction table or false + */ + public function getJunction() + { + if ($this->relationType == 'hasAndBelongsToMany') + { + $tables = $this->tables; + sort($tables); + return implode('_', $tables); + } + return false; + } + + /** + * Set relation type to field + * @param string $relation Name of relation + */ + protected function setRelationType($relation) + { + Validate::relationType($relation); + $this->relationType = $relation; + } + + /** + * Set table name + * @param string $type local or foreign + * @param string $name table name + */ + protected function setTable($type, $name) + { + Validate::table($name)->exists(); + $this->tables[$type] = $name; + } + + /** + * Set key name + * @param string $type local or foreign + * @param string $key key name + * @return \Lazer\Classes\Core_Relation + * @throws LazerException First you must define tables name + */ + protected function setKey($type, $key) + { + if (!in_array(null, $this->tables)) + { + Validate::table($this->tables[$type])->field($key); + + $this->keys[$type] = $key; + return $this; + } + + throw new LazerException('First you must define tables name'); + } + + /** + * Set local key name + * @param string $key key name + * @return \Lazer\Classes\Core_Relation + * @throws LazerException First you must define tables name + */ + public function localKey($key) + { + return $this->setKey('local', $key); + } + + /** + * Set foreign key name + * @param string $key key name + * @return \Lazer\Classes\Core_Relation + * @throws LazerException First you must define tables name + */ + public function foreignKey($key) + { + return $this->setKey('foreign', $key); + } + + /** + * Set relation one2many to table + * @param string $table Table name + * @return \Lazer\Classes\Core_Relation + */ + public function belongsTo($table) + { + $this->setTable('foreign', $table); + $this->setRelationType(__FUNCTION__); + + return $this; + } + + /** + * Set relation many2one to table + * @param string $table Table name + * @return \Lazer\Classes\Core_Relation + */ + public function hasMany($table) + { + $this->setTable('foreign', $table); + $this->setRelationType(__FUNCTION__); + + return $this; + } + + /** + * Set relation many2many to table + * @param string $table Table name + * @return \Lazer\Classes\Core_Relation + */ + public function hasAndBelongsToMany($table) + { + $this->setTable('foreign', $table); + $this->setRelationType(__FUNCTION__); + + return $this; + } + + /** + * Use relation to table + * @param string $table Table name + * @return \Lazer\Classes\Core_Relation + */ + public function with($table) + { + Validate::relation($this->tables['local'], $table); + $this->setTable('foreign', $table); + $this->setRelationType(Config::table($this->tables['local'])->relations($this->tables['foreign'])->type); + $this->setKey('local', Config::table($this->tables['local'])->relations($this->tables['foreign'])->keys->local); + $this->setKey('foreign', Config::table($this->tables['local'])->relations($this->tables['foreign'])->keys->foreign); + + return $this; + } + + /** + * Set specified relation + * @throws LazerException Tables names or keys missing + */ + public function setRelation() + { + if (!in_array(null, $this->tables) && !in_array(null, $this->keys)) + { + $this->addRelation(); + return true; + } + else + { + throw new LazerException('Tables names or keys missing'); + } + } + + /** + * Get relation information + * @return array relation information + */ + public function getRelation() + { + return array( + 'tables' => $this->tables, + 'keys' => $this->keys, + 'type' => $this->relationType + ); + } + + /** + * Remove relation + */ + public function removeRelation() + { + if ($this->relationType == 'hasAndBelongsToMany') + { + $junction = $this->getJunction(); + + $this->deleteRelationData($junction, $this->tables['local']); + $this->deleteRelationData($junction, $this->tables['foreign']); + } + $this->deleteRelationData($this->tables['local'], $this->tables['foreign']); + } + + /** + * Add data to configs and create all necessary files + */ + protected function addRelation() + { + if ($this->relationType == 'hasAndBelongsToMany') + { + $junction = $this->getJunction(); + + try + { + Validate::table($junction)->exists(); + } + catch (LazerException $e) + { + Database::create($junction, array( + $this->tables['local'] . '_id' => 'integer', + $this->tables['foreign'] . '_id' => 'integer', + )); + + $this->insertRelationData($junction, $this->tables['local'], 'hasMany', array( + 'local' => $this->tables['local'] . '_id', + 'foreign' => $this->keys['local'] + )); + + $this->insertRelationData($junction, $this->tables['foreign'], 'hasMany', array( + 'local' => $this->tables['foreign'] . '_id', + 'foreign' => $this->keys['foreign'] + )); + } + } + $this->insertRelationData($this->tables['local'], $this->tables['foreign'], $this->relationType, $this->keys); + } + + /** + * Inserts relation data to config file + * @param string $from Local table + * @param string $to Related table + * @param string $type Relation type + * @param array $keys Relationed keys + */ + protected function insertRelationData($from, $to, $type, array $keys) + { + $config = Config::table($from); + $content = $config->get(); + $content->relations->{$to} = array( + 'type' => $type, + 'keys' => $keys, + ); + $config->put($content); + } + + /** + * Inserts relation data to config file + * @param string $from Local table + * @param string $to Related table + */ + protected function deleteRelationData($from, $to) + { + $config = Config::table($from); + $content = $config->get(); + unset($content->relations->{$to}); + $config->put($content); + } + + /** + * Process query with joined data + * @param object $row One row of data + * @return Database + */ + protected function join($row) + { + $keys['local'] = $this->keys['local']; + $keys['foreign'] = $this->keys['foreign']; + + if ($this->relationType == 'hasAndBelongsToMany') + { + $join = Database::table($this->getJunction()) + ->groupBy($this->tables['local'] . '_id') + ->where($this->tables['local'] . '_id', '=', $row->{$keys['local']}) + ->findAll() + ->asArray(null, $this->tables['foreign'] . '_id'); + + + if (empty($join)) + return array(); + + return Database::table($this->tables['foreign']) + ->where($keys['foreign'], 'IN', $join[$row->{$keys['local']}]); + } + + return Database::table($this->tables['foreign']) + ->where($keys['foreign'], '=', $row->{$keys['local']}); + } + + /** + * + * @param array $array + * @param string $part + * @return array + */ + public function build(array $array, $part) + { + $return = array(); + foreach ($array as $key => $row) + { + if (is_object($row)) + { + if ($row instanceof \stdClass) + { + $part = ucfirst($part); + + if (!isset($row->{$part})) + { + $query = $this->join($row); + + if ($this->relationType == 'belongsTo') + { + $query = $query->findAll(); + $query = reset($query)[0]; + } + + $row->{$part} = $query; + } + + $array[$key] = $row->{$part}; + $return[] = $row->{$part}; + } + else + { + $row->with($part); + } + } + else + { + $return = array_merge($return, $this->build($row, $part)); + } + } + return $return; + } + + /** + * Get relations types + * @return array + */ + public static function relations() + { + return self::$relations; + } + +} diff --git a/ready2use/srv/php/Libs/Lazer/Classes/Database.php b/ready2use/srv/php/Libs/Lazer/Classes/Database.php new file mode 100755 index 0000000..ccb6f4b --- /dev/null +++ b/ready2use/srv/php/Libs/Lazer/Classes/Database.php @@ -0,0 +1,9 @@ +get($assoc)[$field] : $this->get($assoc)->{$field}; + } + + public static function table($name) + { + $file = new Config; + $file->name = $name; + $file->setType('config'); + + return $file; + } + + /** + * Return array with names of fields + * @return array + */ + public function fields() + { + return array_keys($this->getKey('schema', true)); + } + + /** + * Return relations configure + * @param mixed $tableName null-all tables;array-few tables;string-one table relation informations + * @param boolean $assoc Object or associative array + * @return array|object + */ + public function relations($tableName = null, $assoc = false) + { + if (is_array($tableName)) + { + $relations = $this->getKey('relations', $assoc); + if ($assoc) + { + return array_intersect_key($relations, array_flip($tableName)); + } + else + { + return (object) array_intersect_key((array) $relations, array_flip($tableName)); + } + } + elseif ($tableName !== null) + { + return $assoc ? $this->getKey('relations', $assoc)[$tableName] : $this->getKey('relations', $assoc)->{$tableName}; + } + + return $this->getKey('relations', $assoc); + } + + /** + * Returning assoc array with types of fields + * @return array + */ + public function schema() + { + return $this->getKey('schema', true); + } + + /** + * Returning last ID from table + * @return integer + */ + public function lastId() + { + return $this->getKey('last_id'); + } + +} diff --git a/ready2use/srv/php/Libs/Lazer/Classes/Helpers/Data.php b/ready2use/srv/php/Libs/Lazer/Classes/Helpers/Data.php new file mode 100755 index 0000000..f05bed9 --- /dev/null +++ b/ready2use/srv/php/Libs/Lazer/Classes/Helpers/Data.php @@ -0,0 +1,27 @@ +name = $name; + $file->setType('data'); + + return $file; + } + +} diff --git a/ready2use/srv/php/Libs/Lazer/Classes/Helpers/File.class.php b/ready2use/srv/php/Libs/Lazer/Classes/Helpers/File.class.php new file mode 100755 index 0000000..b028b2d --- /dev/null +++ b/ready2use/srv/php/Libs/Lazer/Classes/Helpers/File.class.php @@ -0,0 +1,88 @@ +name = $name; + + return $file; + } + + public final function setType($type) + { + $this->type = $type; + } + + public final function getPath() + { + if (!defined('LAZER_DATA_PATH')) + { + throw new LazerException('Please define constant LAZER_DATA_PATH (check README.md)'); + } + else if (!empty($this->type)) + { + return LAZER_DATA_PATH . $this->name . '.' . $this->type . '.json'; + } + else + { + throw new LazerException('Please specify the type of file in class: ' . __CLASS__); + } + } + + public final function get($assoc = false) + { + return json_decode(file_get_contents($this->getPath()), $assoc); + } + + public final function put($data) + { + return file_put_contents($this->getPath(), json_encode($data)); + } + + public final function exists() + { + return file_exists($this->getPath()); + } + + public final function remove() + { + $type = ucfirst($this->type); + if ($this->exists()) + { + if (unlink($this->getPath())) + return TRUE; + + throw new LazerException($type . ': Deleting failed'); + } + + throw new LazerException($type . ': File does not exists'); + } + +} diff --git a/ready2use/srv/php/Libs/Lazer/Classes/Helpers/FileInterface.php b/ready2use/srv/php/Libs/Lazer/Classes/Helpers/FileInterface.php new file mode 100755 index 0000000..b0e649d --- /dev/null +++ b/ready2use/srv/php/Libs/Lazer/Classes/Helpers/FileInterface.php @@ -0,0 +1,55 @@ +name = $name; + return $validate; + } + + /** + * Checking that field type is numeric + * @param string $type + * @return boolean + */ + public static function isNumeric($type) + { + $defined = array('integer', 'double'); + + if (in_array($type, $defined)) + { + return TRUE; + } + + return FALSE; + } + + /** + * Checking that types from array matching with [boolean, integer, string, double] + * @param array $types Indexed array + * @return bool + * @throws LazerException + */ + public static function types(array $types) + { + $defined = array('boolean', 'integer', 'string', 'double'); + $diff = array_diff($types, $defined); + + if (empty($diff)) + { + return TRUE; + } + throw new LazerException('Wrong types: "' . implode(', ', $diff) . '". Available "boolean, integer, string, double"'); + } + + /** + * Delete ID field from arrays + * @param array $fields + * @return array Fields without ID + */ + public static function filter(array $fields) + { + if (array_values($fields) === $fields) + { + if (($key = array_search('id', $fields)) !== false) + { + unset($fields[$key]); + } + } + else + { + unset($fields['id']); + } + return $fields; + } + + /** + * Change keys and values case to lower + * @param array $array + * @return array + */ + public static function arrToLower(array $array) + { + $array = array_change_key_case($array); + $array = array_map('strtolower', $array); + + return $array; + } + + /** + * Checking that typed fields really exist in table + * @param array $fields Indexed array + * @return boolean + * @throws LazerException If field(s) does not exist + */ + public function fields(array $fields) + { + $fields = self::filter($fields); + $diff = array_diff($fields, Config::table($this->name)->fields()); + + if (empty($diff)) + { + return TRUE; + } + throw new LazerException('Field(s) "' . implode(', ', $diff) . '" does not exists in table "' . $this->name . '"'); + } + + /** + * Checking that typed field really exist in table + * @param string $name + * @return boolean + * @throws LazerException If field does not exist + */ + public function field($name) + { + if (in_array($name, Config::table($this->name)->fields())) + { + return TRUE; + } + throw new LazerException('Field ' . $name . ' does not exists in table "' . $this->name . '"'); + } + + /** + * Checking that Table and Config exists and throw exceptions if not + * @return boolean + * @throws LazerException + */ + public function exists() + { + if (!Data::table($this->name)->exists()) + throw new LazerException('Table "' . $this->name . '" does not exists'); + + if (!Config::table($this->name)->exists()) + throw new LazerException('Config "' . $this->name . '" does not exists'); + + return TRUE; + } + + /** + * Checking that typed field have correct type of value + * @param string $name + * @param mixed $value + * @return boolean + * @throws LazerException If type is wrong + */ + public function type($name, $value) + { + $schema = Config::table($this->name)->schema(); + if (array_key_exists($name, $schema) && $schema[$name] == gettype($value)) + { + return TRUE; + } + + throw new LazerException('Wrong data type'); + } + + /** + * Checking that relation between tables exists + * @param string $local local table + * @param string $foreign related table + * @return bool relation exists + * @throws LazerException + */ + public static function relation($local, $foreign) + { + $relations = Config::table($local)->relations(); + if (isset($relations->{$foreign})) + { + return TRUE; + } + + throw new LazerException('Relation "' . $local . '" to "' . $foreign . '" doesn\'t exist'); + } + + /** + * Checking that relation type is correct + * @param string $type + * @return bool relation type + * @throws LazerException Wrong relation type + */ + public static function relationType($type) + { + if (in_array($type, Relation::relations())) + { + return true; + } + + throw new LazerException('Wrong relation type'); + } + +} diff --git a/ready2use/srv/php/Libs/Lazer/Classes/LazerException.php b/ready2use/srv/php/Libs/Lazer/Classes/LazerException.php new file mode 100755 index 0000000..2a1e44b --- /dev/null +++ b/ready2use/srv/php/Libs/Lazer/Classes/LazerException.php @@ -0,0 +1,14 @@ + + * @package Encoding + * @version 2.0 + * @link https://github.com/neitanod/forceutf8 + * @example https://github.com/neitanod/forceutf8 + * @license Revised BSD + */ + +namespace ForceUTF8; + +class Encoding { + + const ICONV_TRANSLIT = "TRANSLIT"; + const ICONV_IGNORE = "IGNORE"; + const WITHOUT_ICONV = ""; + + protected static $win1252ToUtf8 = array( + 128 => "\xe2\x82\xac", + + 130 => "\xe2\x80\x9a", + 131 => "\xc6\x92", + 132 => "\xe2\x80\x9e", + 133 => "\xe2\x80\xa6", + 134 => "\xe2\x80\xa0", + 135 => "\xe2\x80\xa1", + 136 => "\xcb\x86", + 137 => "\xe2\x80\xb0", + 138 => "\xc5\xa0", + 139 => "\xe2\x80\xb9", + 140 => "\xc5\x92", + + 142 => "\xc5\xbd", + + + 145 => "\xe2\x80\x98", + 146 => "\xe2\x80\x99", + 147 => "\xe2\x80\x9c", + 148 => "\xe2\x80\x9d", + 149 => "\xe2\x80\xa2", + 150 => "\xe2\x80\x93", + 151 => "\xe2\x80\x94", + 152 => "\xcb\x9c", + 153 => "\xe2\x84\xa2", + 154 => "\xc5\xa1", + 155 => "\xe2\x80\xba", + 156 => "\xc5\x93", + + 158 => "\xc5\xbe", + 159 => "\xc5\xb8" + ); + + protected static $brokenUtf8ToUtf8 = array( + "\xc2\x80" => "\xe2\x82\xac", + + "\xc2\x82" => "\xe2\x80\x9a", + "\xc2\x83" => "\xc6\x92", + "\xc2\x84" => "\xe2\x80\x9e", + "\xc2\x85" => "\xe2\x80\xa6", + "\xc2\x86" => "\xe2\x80\xa0", + "\xc2\x87" => "\xe2\x80\xa1", + "\xc2\x88" => "\xcb\x86", + "\xc2\x89" => "\xe2\x80\xb0", + "\xc2\x8a" => "\xc5\xa0", + "\xc2\x8b" => "\xe2\x80\xb9", + "\xc2\x8c" => "\xc5\x92", + + "\xc2\x8e" => "\xc5\xbd", + + + "\xc2\x91" => "\xe2\x80\x98", + "\xc2\x92" => "\xe2\x80\x99", + "\xc2\x93" => "\xe2\x80\x9c", + "\xc2\x94" => "\xe2\x80\x9d", + "\xc2\x95" => "\xe2\x80\xa2", + "\xc2\x96" => "\xe2\x80\x93", + "\xc2\x97" => "\xe2\x80\x94", + "\xc2\x98" => "\xcb\x9c", + "\xc2\x99" => "\xe2\x84\xa2", + "\xc2\x9a" => "\xc5\xa1", + "\xc2\x9b" => "\xe2\x80\xba", + "\xc2\x9c" => "\xc5\x93", + + "\xc2\x9e" => "\xc5\xbe", + "\xc2\x9f" => "\xc5\xb8" + ); + + protected static $utf8ToWin1252 = array( + "\xe2\x82\xac" => "\x80", + + "\xe2\x80\x9a" => "\x82", + "\xc6\x92" => "\x83", + "\xe2\x80\x9e" => "\x84", + "\xe2\x80\xa6" => "\x85", + "\xe2\x80\xa0" => "\x86", + "\xe2\x80\xa1" => "\x87", + "\xcb\x86" => "\x88", + "\xe2\x80\xb0" => "\x89", + "\xc5\xa0" => "\x8a", + "\xe2\x80\xb9" => "\x8b", + "\xc5\x92" => "\x8c", + + "\xc5\xbd" => "\x8e", + + + "\xe2\x80\x98" => "\x91", + "\xe2\x80\x99" => "\x92", + "\xe2\x80\x9c" => "\x93", + "\xe2\x80\x9d" => "\x94", + "\xe2\x80\xa2" => "\x95", + "\xe2\x80\x93" => "\x96", + "\xe2\x80\x94" => "\x97", + "\xcb\x9c" => "\x98", + "\xe2\x84\xa2" => "\x99", + "\xc5\xa1" => "\x9a", + "\xe2\x80\xba" => "\x9b", + "\xc5\x93" => "\x9c", + + "\xc5\xbe" => "\x9e", + "\xc5\xb8" => "\x9f" + ); + + static function toUTF8($text){ + /** + * Function \ForceUTF8\Encoding::toUTF8 + * + * This function leaves UTF8 characters alone, while converting almost all non-UTF8 to UTF8. + * + * It assumes that the encoding of the original string is either Windows-1252 or ISO 8859-1. + * + * It may fail to convert characters to UTF-8 if they fall into one of these scenarios: + * + * 1) when any of these characters: ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞß + * are followed by any of these: ("group B") + * ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶•¸¹º»¼½¾¿ + * For example: %ABREPRESENT%C9%BB. «REPRESENTÉ» + * The "«" (%AB) character will be converted, but the "É" followed by "»" (%C9%BB) + * is also a valid unicode character, and will be left unchanged. + * + * 2) when any of these: àáâãäåæçèéêëìíîï are followed by TWO chars from group B, + * 3) when any of these: ðñòó are followed by THREE chars from group B. + * + * @name toUTF8 + * @param string $text Any string. + * @return string The same string, UTF8 encoded + * + */ + + if(is_array($text)) + { + foreach($text as $k => $v) + { + $text[$k] = self::toUTF8($v); + } + return $text; + } + + if(!is_string($text)) { + return $text; + } + + $max = self::strlen($text); + + $buf = ""; + for($i = 0; $i < $max; $i++){ + $c1 = $text{$i}; + if($c1>="\xc0"){ //Should be converted to UTF8, if it's not UTF8 already + $c2 = $i+1 >= $max? "\x00" : $text{$i+1}; + $c3 = $i+2 >= $max? "\x00" : $text{$i+2}; + $c4 = $i+3 >= $max? "\x00" : $text{$i+3}; + if($c1 >= "\xc0" & $c1 <= "\xdf"){ //looks like 2 bytes UTF8 + if($c2 >= "\x80" && $c2 <= "\xbf"){ //yeah, almost sure it's UTF8 already + $buf .= $c1 . $c2; + $i++; + } else { //not valid UTF8. Convert it. + $cc1 = (chr(ord($c1) / 64) | "\xc0"); + $cc2 = ($c1 & "\x3f") | "\x80"; + $buf .= $cc1 . $cc2; + } + } elseif($c1 >= "\xe0" & $c1 <= "\xef"){ //looks like 3 bytes UTF8 + if($c2 >= "\x80" && $c2 <= "\xbf" && $c3 >= "\x80" && $c3 <= "\xbf"){ //yeah, almost sure it's UTF8 already + $buf .= $c1 . $c2 . $c3; + $i = $i + 2; + } else { //not valid UTF8. Convert it. + $cc1 = (chr(ord($c1) / 64) | "\xc0"); + $cc2 = ($c1 & "\x3f") | "\x80"; + $buf .= $cc1 . $cc2; + } + } elseif($c1 >= "\xf0" & $c1 <= "\xf7"){ //looks like 4 bytes UTF8 + if($c2 >= "\x80" && $c2 <= "\xbf" && $c3 >= "\x80" && $c3 <= "\xbf" && $c4 >= "\x80" && $c4 <= "\xbf"){ //yeah, almost sure it's UTF8 already + $buf .= $c1 . $c2 . $c3 . $c4; + $i = $i + 3; + } else { //not valid UTF8. Convert it. + $cc1 = (chr(ord($c1) / 64) | "\xc0"); + $cc2 = ($c1 & "\x3f") | "\x80"; + $buf .= $cc1 . $cc2; + } + } else { //doesn't look like UTF8, but should be converted + $cc1 = (chr(ord($c1) / 64) | "\xc0"); + $cc2 = (($c1 & "\x3f") | "\x80"); + $buf .= $cc1 . $cc2; + } + } elseif(($c1 & "\xc0") == "\x80"){ // needs conversion + if(isset(self::$win1252ToUtf8[ord($c1)])) { //found in Windows-1252 special cases + $buf .= self::$win1252ToUtf8[ord($c1)]; + } else { + $cc1 = (chr(ord($c1) / 64) | "\xc0"); + $cc2 = (($c1 & "\x3f") | "\x80"); + $buf .= $cc1 . $cc2; + } + } else { // it doesn't need conversion + $buf .= $c1; + } + } + return $buf; + } + + static function toWin1252($text, $option = self::WITHOUT_ICONV) { + if(is_array($text)) { + foreach($text as $k => $v) { + $text[$k] = self::toWin1252($v, $option); + } + return $text; + } elseif(is_string($text)) { + return static::utf8_decode($text, $option); + } else { + return $text; + } + } + + static function toISO8859($text) { + return self::toWin1252($text); + } + + static function toLatin1($text) { + return self::toWin1252($text); + } + + static function fixUTF8($text, $option = self::WITHOUT_ICONV){ + if(is_array($text)) { + foreach($text as $k => $v) { + $text[$k] = self::fixUTF8($v, $option); + } + return $text; + } + + $last = ""; + while($last <> $text){ + $last = $text; + $text = self::toUTF8(static::utf8_decode($text, $option)); + } + $text = self::toUTF8(static::utf8_decode($text, $option)); + return $text; + } + + static function UTF8FixWin1252Chars($text){ + // If you received an UTF-8 string that was converted from Windows-1252 as it was ISO8859-1 + // (ignoring Windows-1252 chars from 80 to 9F) use this function to fix it. + // See: http://en.wikipedia.org/wiki/Windows-1252 + + return str_replace(array_keys(self::$brokenUtf8ToUtf8), array_values(self::$brokenUtf8ToUtf8), $text); + } + + static function removeBOM($str=""){ + if(substr($str, 0,3) == pack("CCC",0xef,0xbb,0xbf)) { + $str=substr($str, 3); + } + return $str; + } + + protected static function strlen($text){ + return (function_exists('mb_strlen') && ((int) ini_get('mbstring.func_overload')) & 2) ? + mb_strlen($text,'8bit') : strlen($text); + } + + public static function normalizeEncoding($encodingLabel) + { + $encoding = strtoupper($encodingLabel); + $encoding = preg_replace('/[^a-zA-Z0-9\s]/', '', $encoding); + $equivalences = array( + 'ISO88591' => 'ISO-8859-1', + 'ISO8859' => 'ISO-8859-1', + 'ISO' => 'ISO-8859-1', + 'LATIN1' => 'ISO-8859-1', + 'LATIN' => 'ISO-8859-1', + 'UTF8' => 'UTF-8', + 'UTF' => 'UTF-8', + 'WIN1252' => 'ISO-8859-1', + 'WINDOWS1252' => 'ISO-8859-1' + ); + + if(empty($equivalences[$encoding])){ + return 'UTF-8'; + } + + return $equivalences[$encoding]; + } + + public static function encode($encodingLabel, $text) + { + $encodingLabel = self::normalizeEncoding($encodingLabel); + if($encodingLabel == 'ISO-8859-1') return self::toLatin1($text); + return self::toUTF8($text); + } + + protected static function utf8_decode($text, $option) + { + if ($option == self::WITHOUT_ICONV || !function_exists('iconv')) { + $o = utf8_decode( + str_replace(array_keys(self::$utf8ToWin1252), array_values(self::$utf8ToWin1252), self::toUTF8($text)) + ); + } else { + $o = iconv("UTF-8", "Windows-1252" . ($option == self::ICONV_TRANSLIT ? '//TRANSLIT' : ($option == self::ICONV_IGNORE ? '//IGNORE' : '')), $text); + } + return $o; + } +} diff --git a/ready2use/srv/php/Libs/php-bittorrent.phar b/ready2use/srv/php/Libs/php-bittorrent.phar new file mode 100644 index 0000000..b3e1330 Binary files /dev/null and b/ready2use/srv/php/Libs/php-bittorrent.phar differ diff --git a/ready2use/srv/php/Libs/torrent-rw/.gitignore b/ready2use/srv/php/Libs/torrent-rw/.gitignore new file mode 100755 index 0000000..2707a46 --- /dev/null +++ b/ready2use/srv/php/Libs/torrent-rw/.gitignore @@ -0,0 +1,2 @@ +.idea +.php_cs.cache diff --git a/ready2use/srv/php/Libs/torrent-rw/.php_cs.dist b/ready2use/srv/php/Libs/torrent-rw/.php_cs.dist new file mode 100755 index 0000000..bd02873 --- /dev/null +++ b/ready2use/srv/php/Libs/torrent-rw/.php_cs.dist @@ -0,0 +1,36 @@ +setUsingCache(false) + ->setRules([ + '@PSR2' => true, + '@Symfony' => true, + 'no_whitespace_in_blank_line' => true, + 'phpdoc_align' => true, + 'phpdoc_indent' => true, + 'phpdoc_scalar' => true, + 'phpdoc_separation' => true, + 'short_scalar_cast' => true, + 'single_blank_line_before_namespace' => true, + 'standardize_not_equals' => true, + 'ternary_operator_spaces' => true, + 'whitespace_after_comma_in_array' => true, + 'concat_space' => ["spacing" => "one"], + 'align_multiline_comment' => ['comment_type' => 'phpdocs_like'], + 'array_syntax' => ['syntax' => 'short'], + 'binary_operator_spaces' => ['default' => 'align'], + 'cast_spaces' => ['space' => 'single'], + 'combine_consecutive_issets' => true, + 'combine_consecutive_unsets' => true, + ]) + ->setFinder( + PhpCsFixer\Finder::create() + ->in(__DIR__) + ->exclude('vendor') + ->exclude('node_modules') + ->exclude('plugins') + ->notPath('adminer.php') + ) +; + +return $config; diff --git a/ready2use/srv/php/Libs/torrent-rw/LICENSE b/ready2use/srv/php/Libs/torrent-rw/LICENSE new file mode 100755 index 0000000..94a9ed0 --- /dev/null +++ b/ready2use/srv/php/Libs/torrent-rw/LICENSE @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/ready2use/srv/php/Libs/torrent-rw/README.md b/ready2use/srv/php/Libs/torrent-rw/README.md new file mode 100755 index 0000000..2fafb48 --- /dev/null +++ b/ready2use/srv/php/Libs/torrent-rw/README.md @@ -0,0 +1,54 @@ +Torrent RW + +PHP version 5.2+ + +1) Features: +- Decode torrent file or data +- Build torrent from source folder/file(s) +- Silent Exception error system + +2) Usage example +```php +require_once 'Torrent.php'; + +// get torrent infos +$torrent = new Torrent( './test.torrent' ); +echo '
private: ', $torrent->is_private() ? 'yes' : 'no', + '
annonce: ', $torrent->announce(), + '
name: ', $torrent->name(), + '
comment: ', $torrent->comment(), + '
piece_length: ', $torrent->piece_length(), + '
size: ', $torrent->size( 2 ), + '
hash info: ', $torrent->hash_info(), + '
stats: '; +var_dump( $torrent->scrape() ); +echo '
content: '; +var_dump( $torrent->content() ); +echo '
source: ', + $torrent; + +// get magnet link +$torrent->magnet(); // use $torrent->magnet( false ); to get non html encoded ampersand + +// create torrent +$torrent = new Torrent( array( 'test.mp3', 'test.jpg' ), 'http://torrent.tracker/annonce' ); +$torrent->save('test.torrent'); // save to disk + +// modify torrent +$torrent->announce('http://alternate-torrent.tracker/annonce'); // add a tracker +$torrent->announce(false); // reset announce trackers +$torrent->announce(array('http://torrent.tracker/annonce', 'http://alternate-torrent.tracker/annonce')); // set tracker(s), it also works with a 'one tracker' array... +$torrent->announce(array(array('http://torrent.tracker/annonce', 'http://alternate-torrent.tracker/annonce'), 'http://another-torrent.tracker/annonce')); // set tiered trackers +$torrent->comment('hello world'); +$torrent->name('test torrent'); +$torrent->is_private(true); +$torrent->httpseeds('http://file-hosting.domain/path/'); // Bittornado implementation +$torrent->url_list(array('http://file-hosting.domain/path/','http://another-file-hosting.domain/path/')); // GetRight implementation + +// print errors +if ( $errors = $torrent->errors() ) + var_dump( $errors ); + +// send to user +$torrent->send(); +``` diff --git a/ready2use/srv/php/Libs/torrent-rw/Torrent.php b/ready2use/srv/php/Libs/torrent-rw/Torrent.php new file mode 100755 index 0000000..007352c --- /dev/null +++ b/ready2use/srv/php/Libs/torrent-rw/Torrent.php @@ -0,0 +1,1132 @@ + + * require_once 'Torrent.php'; + * + * // get torrent infos + * $torrent = new Torrent( './test.torrent' ); + * echo '
private: ', $torrent->is_private() ? 'yes' : 'no', + * '
announce: ', $torrent->announce(), + * '
name: ', $torrent->name(), + * '
comment: ', $torrent->comment(), + * '
piece_length: ', $torrent->piece_length(), + * '
size: ', $torrent->size( 2 ), + * '
hash info: ', $torrent->hash_info(), + * '
stats: '; + * var_dump( $torrent->scrape() ); + * echo '
content: '; + * var_dump( $torrent->content() ); + * echo '
source: ', + * $torrent; + * + * // get magnet link + * $torrent->magnet(); // use $torrent->magnet( false ); to get non html encoded ampersand + * + * // create torrent + * $torrent = new Torrent( array( 'test.mp3', 'test.jpg' ), 'http://torrent.tracker/annonce' ); + * $torrent->save('test.torrent'); // save to disk + * + * // modify torrent + * $torrent->announce('http://alternate-torrent.tracker/annonce'); // add a tracker + * $torrent->announce(false); // reset announce trackers + * $torrent->announce(array('http://torrent.tracker/annonce', 'http://alternate-torrent.tracker/annonce')); // set tracker(s), it also works with a 'one tracker' array... + * $torrent->announce(array(array('http://torrent.tracker/annonce', 'http://alternate-torrent.tracker/annonce'), 'http://another-torrent.tracker/annonce')); // set tiered trackers + * $torrent->comment('hello world'); + * $torrent->name('test torrent'); + * $torrent->is_private(true); + * $torrent->httpseeds('http://file-hosting.domain/path/'); // BitTornado implementation + * $torrent->url_list(array('http://file-hosting.domain/path/','http://another-file-hosting.domain/path/')); // + * GetRight implementation + * + * // print errors + * if ( $errors = $torrent->errors() ) + * var_dump( $errors ); + * + * // send to user + * $torrent->send(); + * + * + * @author Adrien Gibrat + * @tester Jeong, Anton, dokcharlie, official testers ;) Thanks for your precious feedback + * @copyleft 2010 - Just use it! + * + * @license http://www.gnu.org/licenses/gpl.html GNU General Public License version 3 + * + * @version 0.0.3 + */ +class Torrent +{ + /** + * @const float Default http timeout + */ + const timeout = 30; + + /** + * @var array List of error occurred + */ + protected static $_errors = []; + + /** Read and decode torrent file/data OR build a torrent from source folder/file(s) + * Supported signatures: + * - Torrent(); // get an instance (useful to scrape and check errors) + * - Torrent( string $torrent ); // analyze a torrent file + * - Torrent( string $torrent, string $announce ); + * - Torrent( string $torrent, array $meta ); + * - Torrent( string $file_or_folder ); // create a torrent file + * - Torrent( string $file_or_folder, string $announce_url, [int $piece_length] ); + * - Torrent( string $file_or_folder, array $meta, [int $piece_length] ); + * - Torrent( array $files_list ); + * - Torrent( array $files_list, string $announce_url, [int $piece_length] ); + * - Torrent( array $files_list, array $meta, [int $piece_length] );. + * + * @param string|array torrent to read or source folder/file(s) (optional, to get an instance) + * @param string|array announce url or meta informations (optional) + * @param int piece length (optional) + */ + public function __construct($data = null, $meta = [], $piece_length = 256) + { + if (is_null($data)) { + return false; + } + if ($piece_length < 32 || $piece_length > 4096) { + return self::set_error(new Exception('Invalid piece length, must be between 32 and 4096')); + } + if (is_string($meta)) { + $meta = ['announce' => $meta]; + } + if ($this->build($data, $piece_length * 1024)) { + $this->touch(); + } else { + $meta = array_merge($meta, $this->decode($data)); + } + foreach ($meta as $key => $value) { + $this->{trim($key)} = $value; + } + } + + /** Convert the current Torrent instance in torrent format + * + * @return string encoded torrent data + */ + public function __toString() + { + return $this->encode($this); + } + + /** Return last error message + * + * @return string|bool last error message or false if none + */ + public function error() + { + return empty(self::$_errors) ? + false : + self::$_errors[0]->getMessage(); + } + + /** Return Errors + * + * @return array|bool error list or false if none + */ + public function errors() + { + return empty(self::$_errors) ? + false : + self::$_errors; + } + + /**** Getters and setters ****/ + + /** Getter and setter of torrent announce url / list + * If the argument is a string, announce url is added to announce list (or set as announce if announce is not set) + * If the argument is an array/object, set announce url (with first url) and list (if array has more than one url), tiered list supported + * If the argument is false announce url & list are unset. + * + * @param null|false|string|array announce url / list, reset all if false (optional, if omitted it's a getter) + * + * @return string|array|null announce url / list or null if not set + */ + public function announce($announce = null) + { + if (is_null($announce)) { + return !isset($this->{'announce-list'}) ? + isset($this->announce) ? $this->announce : null : + $this->{'announce-list'}; + } + $this->touch(); + if (is_string($announce) && isset($this->announce)) { + return $this->{'announce-list'} = self::announce_list(isset($this->{'announce-list'}) ? $this->{'announce-list'} : $this->announce, $announce); + } + unset($this->{'announce-list'}); + if (is_array($announce) || is_object($announce)) { + if (($this->announce = self::first_announce($announce)) && count($announce) > 1) { + return $this->{'announce-list'} = self::announce_list($announce); + } else { + return $this->announce; + } + } + if (!isset($this->announce) && $announce) { + return $this->announce = (string) $announce; + } + unset($this->announce); + } + + /** Getter and setter of torrent creation date + * + * @param null|int timestamp (optional, if omitted it's a getter) + * + * @return int|null timestamp or null if not set + */ + public function creation_date($timestamp = null) + { + return is_null($timestamp) ? + isset($this->{'creation date'}) ? $this->{'creation date'} : null : + $this->touch($this->{'creation date'} = (int) $timestamp); + } + + /** Getter and setter of torrent comment + * + * @param null|string comment (optional, if omitted it's a getter) + * + * @return string|null comment or null if not set + */ + public function comment($comment = null) + { + return is_null($comment) ? + isset($this->comment) ? $this->comment : null : + $this->touch($this->comment = (string) $comment); + } + + /** Getter and setter of torrent name + * + * @param null|string name (optional, if omitted it's a getter) + * + * @return string|null name or null if not set + */ + public function name($name = null) + { + return is_null($name) ? + isset($this->info['name']) ? $this->info['name'] : null : + $this->touch($this->info['name'] = (string) $name); + } + + /** Getter and setter of private flag + * + * @param null|bool is private or not (optional, if omitted it's a getter) + * + * @return bool private flag + */ + public function is_private($private = null) + { + return is_null($private) ? + !empty($this->info['private']) : + $this->touch($this->info['private'] = $private ? 1 : 0); + } + + /** Getter and setter of torrent source + * + * @param null|string source (optional, if omitted it's a getter) + * + * @return string|null source or null if not set + */ + public function source($source = null) + { + return is_null($source) ? + isset($this->info['source']) ? $this->info['source'] : null : + $this->touch($this->info['source'] = (string) $source); + } + + /** Getter and setter of webseed(s) url list ( GetRight implementation ) + * + * @param null|string|array webseed or webseeds mirror list (optional, if omitted it's a getter) + * + * @return string|array|null webseed(s) or null if not set + */ + public function url_list($urls = null) + { + return is_null($urls) ? + isset($this->{'url-list'}) ? $this->{'url-list'} : null : + $this->touch($this->{'url-list'} = is_string($urls) ? $urls : (array) $urls); + } + + /** Getter and setter of httpseed(s) url list ( BitTornado implementation ) + * + * @param null|string|array httpseed or httpseeds mirror list (optional, if omitted it's a getter) + * + * @return array|null httpseed(s) or null if not set + */ + public function httpseeds($urls = null) + { + return is_null($urls) ? + isset($this->httpseeds) ? $this->httpseeds : null : + $this->touch($this->httpseeds = (array) $urls); + } + + /**** Analyze BitTorrent ****/ + + /** Get piece length + * + * @return int piece length or null if not set + */ + public function piece_length() + { + return isset($this->info['piece length']) ? + $this->info['piece length'] : + null; + } + + /** Compute hash info + * + * @return string hash info or null if info not set + */ + public function hash_info() + { + return isset($this->info) ? + sha1(self::encode($this->info)) : + null; + } + + /** List torrent content + * + * @param int|null size precision (optional, if omitted returns sizes in bytes) + * + * @return array file(s) and size(s) list, files as keys and sizes as values + */ + public function content($precision = null) + { + $files = []; + if (isset($this->info['files']) && is_array($this->info['files'])) { + foreach ($this->info['files'] as $file) { + $files[self::path($file['path'], $this->info['name'])] = $precision ? + self::format($file['length'], $precision) : + $file['length']; + } + } elseif (isset($this->info['name'])) { + $files[$this->info['name']] = $precision ? + self::format($this->info['length'], $precision) : + $this->info['length']; + } + + return $files; + } + + /** List torrent content pieces and offset(s) + * + * @return array file(s) and pieces/offset(s) list, file(s) as keys and pieces/offset(s) as values + */ + public function offset() + { + $files = []; + $size = 0; + if (isset($this->info['files']) && is_array($this->info['files'])) { + foreach ($this->info['files'] as $file) { + $files[self::path($file['path'], $this->info['name'])] = [ + 'startpiece' => floor($size / $this->info['piece length']), + 'offset' => fmod($size, $this->info['piece length']), + 'size' => $size += $file['length'], + 'endpiece' => floor($size / $this->info['piece length']), + ]; + } + } elseif (isset($this->info['name'])) { + $files[$this->info['name']] = [ + 'startpiece' => 0, + 'offset' => 0, + 'size' => $this->info['length'], + 'endpiece' => floor($this->info['length'] / $this->info['piece length']), + ]; + } + + return $files; + } + + /** Sum torrent content size + * + * @param int|null size precision (optional, if omitted returns size in bytes) + * + * @return int|string file(s) size + */ + public function size($precision = null) + { + $size = 0; + if (isset($this->info['files']) && is_array($this->info['files'])) { + foreach ($this->info['files'] as $file) { + $size += $file['length']; + } + } elseif (isset($this->info['name'])) { + $size = $this->info['length']; + } + + return is_null($precision) ? + $size : + self::format($size, $precision); + } + + /** Request torrent statistics from scrape page USING CURL!! + * + * @param string|array announce or scrape page url (optional, to request an alternative tracker BUT required for static call) + * @param string torrent hash info (optional, required ONLY for static call) + * @param float read timeout in seconds (optional, default to self::timeout 30s) + * + * @return array tracker torrent statistics + */ + /* static */ + public function scrape($announce = null, $hash_info = null, $timeout = self::timeout) + { + $packed_hash = urlencode(pack('H*', $hash_info ? $hash_info : $this->hash_info())); + $handles = $scrape = []; + if (!function_exists('curl_multi_init')) { + return self::set_error(new Exception('Install CURL with "curl_multi_init" enabled')); + } + $curl = curl_multi_init(); + foreach ((array) ($announce ? $announce : $this->announce()) as $tier) { + foreach ((array) $tier as $tracker) { + $tracker = str_ireplace([ + 'udp://', + '/announce', + ':80/', + ], [ + 'http://', + '/scrape', + '/', + ], $tracker); + if (isset($handles[$tracker])) { + continue; + } + $handles[$tracker] = curl_init($tracker . '?info_hash=' . $packed_hash); + curl_setopt($handles[$tracker], CURLOPT_RETURNTRANSFER, true); + curl_setopt($handles[$tracker], CURLOPT_TIMEOUT, $timeout); + curl_multi_add_handle($curl, $handles[$tracker]); + } + } + do { + while (CURLM_CALL_MULTI_PERFORM == ($state = curl_multi_exec($curl, $running))); + if (CURLM_OK != $state) { + continue; + } + while ($done = curl_multi_info_read($curl)) { + $info = curl_getinfo($done['handle']); + $tracker = explode('?', $info['url'], 2); + $tracker = array_shift($tracker); + if (empty($info['http_code'])) { + $scrape[$tracker] = self::set_error(new Exception('Tracker request timeout (' . $timeout . 's)'), true); + continue; + } elseif (200 != $info['http_code']) { + $scrape[$tracker] = self::set_error(new Exception('Tracker request failed (' . $info['http_code'] . ' code)'), true); + continue; + } + $data = curl_multi_getcontent($done['handle']); + $stats = self::decode_data($data); + curl_multi_remove_handle($curl, $done['handle']); + $scrape[$tracker] = empty($stats['files']) ? + self::set_error(new Exception('Empty scrape data'), true) : + array_shift($stats['files']) + (empty($stats['flags']) ? [] : $stats['flags']); + } + } while ($running); + curl_multi_close($curl); + + return $scrape; + } + + /**** Save and Send ****/ + + /** Save torrent file to disk + * + * @param null|string name of the file (optional) + * + * @return bool file has been saved or not + */ + public function save($filename = null) + { + return file_put_contents(is_null($filename) ? $this->info['name'] . '.torrent' : $filename, $this->encode($this)); + } + + /** Send torrent file to client + * + * @param null|string name of the file (optional) + */ + public function send($filename = null) + { + $data = $this->encode($this); + header('Content-type: application/x-bittorrent'); + header('Content-Length: ' . strlen($data)); + header('Content-Disposition: attachment; filename="' . (is_null($filename) ? $this->info['name'] . '.torrent' : $filename) . '"'); + exit($data); + } + + /** Get magnet link + * + * @param bool html encode ampersand, default true (optional) + * + * @return string magnet link + */ + public function magnet($html = true) + { + $ampersand = $html ? '&' : '&'; + + return sprintf('magnet:?xt=urn:btih:%2$s%1$sdn=%3$s%1$sxl=%4$d%1$str=%5$s', $ampersand, $this->hash_info(), urlencode($this->name()), $this->size(), implode($ampersand . 'tr=', self::untier($this->announce()))); + } + + /**** Encode BitTorrent ****/ + + /** Encode torrent data + * + * @param mixed data to encode + * + * @return string torrent encoded data + */ + public static function encode($mixed) + { + switch (gettype($mixed)) { + case 'integer': + case 'double': + return self::encode_integer($mixed); + case 'object': + $mixed = get_object_vars($mixed); + // no break + case 'array': + return self::encode_array($mixed); + default: + return self::encode_string((string) $mixed); + } + } + + /** Encode torrent string + * + * @param string string to encode + * + * @return string encoded string + */ + private static function encode_string($string) + { + return strlen($string) . ':' . $string; + } + + /** Encode torrent integer + * + * @param int integer to encode + * + * @return string encoded integer + */ + private static function encode_integer($integer) + { + return 'i' . $integer . 'e'; + } + + /** Encode torrent dictionary or list + * + * @param array array to encode + * + * @return string encoded dictionary or list + */ + private static function encode_array($array) + { + if (self::is_list($array)) { + $return = 'l'; + foreach ($array as $value) { + $return .= self::encode($value); + } + } else { + ksort($array, SORT_STRING); + $return = 'd'; + foreach ($array as $key => $value) { + $return .= self::encode(strval($key)) . self::encode($value); + } + } + + return $return . 'e'; + } + + /**** Decode BitTorrent ****/ + + /** Decode torrent data or file + * + * @param string data or file path to decode + * + * @return array decoded torrent data + */ + protected static function decode($string) + { + $data = is_file($string) || self::url_exists($string) ? + self::file_get_contents($string) : + $string; + + return (array) self::decode_data($data); + } + + /** Decode torrent data + * + * @param string data to decode + * + * @return array decoded torrent data + */ + private static function decode_data(&$data) + { + switch (self::char($data)) { + case 'i': + $data = substr($data, 1); + + return self::decode_integer($data); + case 'l': + $data = substr($data, 1); + + return self::decode_list($data); + case 'd': + $data = substr($data, 1); + + return self::decode_dictionary($data); + default: + return self::decode_string($data); + } + } + + /** Decode torrent dictionary + * + * @param string data to decode + * + * @return array decoded dictionary + */ + private static function decode_dictionary(&$data) + { + $dictionary = []; + $previous = null; + while ('e' != ($char = self::char($data))) { + if (false === $char) { + return self::set_error(new Exception('Unterminated dictionary')); + } + if (!ctype_digit($char)) { + return self::set_error(new Exception('Invalid dictionary key')); + } + $key = self::decode_string($data); + if (isset($dictionary[$key])) { + return self::set_error(new Exception('Duplicate dictionary key')); + } + if ($key < $previous) { + self::set_error(new Exception('Missorted dictionary key')); + } + $dictionary[$key] = self::decode_data($data); + $previous = $key; + } + $data = substr($data, 1); + + return $dictionary; + } + + /** Decode torrent list + * + * @param string data to decode + * + * @return array decoded list + */ + private static function decode_list(&$data) + { + $list = []; + while ('e' != ($char = self::char($data))) { + if (false === $char) { + return self::set_error(new Exception('Unterminated list')); + } + $list[] = self::decode_data($data); + } + $data = substr($data, 1); + + return $list; + } + + /** Decode torrent string + * + * @param string data to decode + * + * @return string decoded string + */ + private static function decode_string(&$data) + { + if ('0' === self::char($data) && ':' != substr($data, 1, 1)) { + self::set_error(new Exception('Invalid string length, leading zero')); + } + if (!$colon = @strpos($data, ':')) { + return self::set_error(new Exception('Invalid string length, colon not found')); + } + $length = intval(substr($data, 0, $colon)); + if ($length + $colon + 1 > strlen($data)) { + return self::set_error(new Exception('Invalid string, input too short for string length')); + } + $string = substr($data, $colon + 1, $length); + $data = substr($data, $colon + $length + 1); + + return $string; + } + + /** Decode torrent integer + * + * @param string data to decode + * + * @return int decoded integer + */ + private static function decode_integer(&$data) + { + $start = 0; + $end = strpos($data, 'e'); + if (0 === $end) { + self::set_error(new Exception('Empty integer')); + } + if ('-' == self::char($data)) { + ++$start; + } + if ('0' == substr($data, $start, 1) && $end > $start + 1) { + self::set_error(new Exception('Leading zero in integer')); + } + if (!ctype_digit(substr($data, $start, $start ? $end - 1 : $end))) { + self::set_error(new Exception('Non-digit characters in integer')); + } + $integer = substr($data, 0, $end); + $data = substr($data, $end + 1); + + return 0 + $integer; + } + + /**** Internal Helpers ****/ + + /** Build torrent info + * + * @param string|array source folder/file(s) path + * @param int piece length + * + * @return array|bool torrent info or false if data isn't folder/file(s) + */ + protected function build($data, $piece_length) + { + if (is_null($data)) { + return false; + } elseif (is_array($data) && self::is_list($data)) { + return $this->info = $this->files($data, $piece_length); + } elseif (is_dir($data)) { + return $this->info = $this->folder($data, $piece_length); + } elseif ((is_file($data) || self::url_exists($data)) && !self::is_torrent($data)) { + return $this->info = $this->file($data, $piece_length); + } else { + return false; + } + } + + /** Set torrent creator and creation date + * + * @param any param + * + * @return any param + */ + protected function touch($void = null) + { + $this->{'created by'} = 'Torrent RW PHP Class - http://github.com/adriengibrat/torrent-rw'; + $this->{'creation date'} = time(); + + return $void; + } + + /** Add an error to errors stack + * + * @param Exception error to add + * @param bool return error message or not (optional, default to false) + * + * @return bool|string return false or error message if requested + */ + protected static function set_error($exception, $message = false) + { + return (array_unshift(self::$_errors, $exception) && $message) ? $exception->getMessage() : false; + } + + /** Build announce list + * + * @param string|array announce url / list + * @param string|array announce url / list to add (optionnal) + * + * @return array announce list (array of arrays) + */ + protected static function announce_list($announce, $merge = []) + { + return array_map(function($a) {return (array) $a;}, array_merge((array) $announce, (array) $merge)); + } + + /** Get the first announce url in a list + * + * @param array announce list (array of arrays if tiered trackers) + * + * @return string first announce url + */ + protected static function first_announce($announce) + { + while (is_array($announce)) { + $announce = reset($announce); + } + + return $announce; + } + + /** Helper to pack data hash + * + * @param string data + * + * @return string packed data hash + */ + protected static function pack(&$data) + { + return pack('H*', sha1($data)) . ($data = null); + } + + /** Helper to build file path + * + * @param array file path + * @param string base folder + * + * @return string real file path + */ + protected static function path($path, $folder) + { + array_unshift($path, $folder); + + return join(DIRECTORY_SEPARATOR, $path); + } + + /** Helper to explode file path + * + * @param string file path + * + * @return array file path + */ + protected static function path_explode($path) + { + return explode(DIRECTORY_SEPARATOR, $path); + } + + /** Helper to test if an array is a list + * + * @param array array to test + * + * @return bool is the array a list or not + */ + protected static function is_list($array) + { + foreach (array_keys($array) as $key) { + if (!is_int($key)) { + return false; + } + } + + return true; + } + + /** Build pieces depending on piece length from a file handler + * + * @param ressource file handle + * @param int piece length + * @param bool is last piece + * + * @return string pieces + */ + private function pieces($handle, $piece_length, $last = true) + { + static $piece, $length; + if (empty($length)) { + $length = $piece_length; + } + $pieces = null; + while (!feof($handle)) { + if (($length = strlen($piece .= fread($handle, $length))) == $piece_length) { + $pieces .= self::pack($piece); + } elseif (($length = $piece_length - $length) < 0) { + return self::set_error(new Exception('Invalid piece length!')); + } + } + fclose($handle); + + return $pieces . ($last && $piece ? self::pack($piece) : null); + } + + /** Build torrent info from single file + * + * @param string file path + * @param int piece length + * + * @return array torrent info + */ + private function file($file, $piece_length) + { + if (!$handle = self::fopen($file, $size = self::filesize($file))) { + return self::set_error(new Exception('Failed to open file: "' . $file . '"')); + } + if (self::is_url($file)) { + $this->url_list($file); + } + $path = self::path_explode($file); + + return [ + 'length' => $size, + 'name' => end($path), + 'piece length' => $piece_length, + 'pieces' => $this->pieces($handle, $piece_length), + ]; + } + + /** Build torrent info from files + * + * @param array file list + * @param int piece length + * + * @return array torrent info + */ + private function files($files, $piece_length) + { + sort($files); + usort($files, function($a, $b) { + return strrpos($a,DIRECTORY_SEPARATOR)-strrpos($b,DIRECTORY_SEPARATOR); + }); + $first = current($files); + if (!self::is_url($first)) { + $files = array_map('realpath', $files); + } else { + $this->url_list(dirname($first) . DIRECTORY_SEPARATOR); + } + $files_path = array_map('self::path_explode', $files); + $root = call_user_func_array('array_intersect_assoc', $files_path); + $pieces = null; + $info_files = []; + $count = count($files) - 1; + foreach ($files as $i => $file) { + if (!$handle = self::fopen($file, $filesize = self::filesize($file))) { + self::set_error(new Exception('Failed to open file: "' . $file . '" discarded')); + continue; + } + $pieces .= $this->pieces($handle, $piece_length, $count == $i); + $info_files[] = [ + 'length' => $filesize, + 'path' => array_diff_assoc($files_path[$i], $root), + ]; + } + + return [ + 'files' => $info_files, + 'name' => end($root), + 'piece length' => $piece_length, + 'pieces' => $pieces, + ]; + } + + /** Build torrent info from folder content + * + * @param string folder path + * @param int piece length + * + * @return array torrent info + */ + private function folder($dir, $piece_length) + { + return $this->files(self::scandir($dir), $piece_length); + } + + /** Helper to return the first char of encoded data + * + * @param string encoded data + * + * @return string|bool first char of encoded data or false if empty data + */ + private static function char($data) + { + return empty($data) ? + false : + substr($data, 0, 1); + } + + /**** Public Helpers ****/ + + /** Helper to format size in bytes to human readable + * + * @param int size in bytes + * @param int precision after coma + * + * @return string formated size in appropriate unit + */ + public static function format($size, $precision = 2) + { + $units = [ + 'octets', + 'Ko', + 'Mo', + 'Go', + 'To', + ]; + while (($next = next($units)) && $size > 1024) { + $size /= 1024; + } + + return round($size, $precision) . ' ' . ($next ? prev($units) : end($units)); + } + + /** Helper to return filesize (even bigger than 2Gb -linux only- and distant files size) + * + * @param string file path + * + * @return float|bool filesize or false if error + */ + public static function filesize($file) + { + if (is_file($file)) { + return (float) sprintf('%u', @filesize($file)); + } elseif ($content_length = preg_grep($pattern = '#^Content-Length:\s+(\d+)$#i', (array) @get_headers($file))) { + return (int) preg_replace($pattern, '$1', reset($content_length)); + } + } + + /** Helper to open file to read (even bigger than 2Gb, linux only) + * + * @param string file path + * @param int|float file size (optional) + * + * @return resource|bool file handle or false if error + */ + public static function fopen($file, $size = null) + { + if ((is_null($size) ? self::filesize($file) : $size) <= 2 * pow(1024, 3)) { + return fopen($file, 'r'); + } elseif (PHP_OS != 'Linux') { + return self::set_error(new Exception('File size is greater than 2GB. This is only supported under Linux')); + } elseif (!is_readable($file)) { + return false; + } else { + return popen('cat ' . escapeshellarg(realpath($file)), 'r'); + } + } + + /** Helper to scan directories files and sub directories recursively + * + * @param string directory path + * + * @return array directory content list + */ + public static function scandir($dir) + { + $paths = []; + foreach (scandir($dir) as $item) { + if ('.' != $item && '..' != $item) { + if (is_dir($path = realpath($dir . DIRECTORY_SEPARATOR . $item))) { + $paths = array_merge(self::scandir($path), $paths); + } else { + $paths[] = $path; + } + } + } + + return $paths; + } + + /** Helper to check if string is an url (http) + * + * @param string url to check + * + * @return bool is string an url + */ + public static function is_url($url) + { + return preg_match('#^http(s)?://[a-z0-9-]+(.[a-z0-9-]+)*(:[0-9]+)?(/.*)?$#i', $url); + } + + /** Helper to check if url exists + * + * @param string url to check + * + * @return bool does the url exist or not + */ + public static function url_exists($url) + { + return self::is_url($url) ? + (bool) self::filesize($url) : + false; + } + + /** Helper to check if a file is a torrent + * + * @param string file location + * @param float http timeout (optional, default to self::timeout 30s) + * + * @return bool is the file a torrent or not + */ + public static function is_torrent($file, $timeout = self::timeout) + { + return ($start = self::file_get_contents($file, $timeout, 0, 11)) + && 'd8:announce' === $start + || 'd10:created' === $start + || 'd13:creatio' === $start + || 'd13:announc' === $start + || 'd12:_info_l' === $start + || 'd7:comment' === substr($start, 0, 10) // @see https://github.com/adriengibrat/torrent-rw/issues/32 + || 'd4:info' === substr($start, 0, 7) + || 'd9:' === substr($start, 0, 3); // @see https://github.com/adriengibrat/torrent-rw/pull/17 + } + + /** Helper to get (distant) file content + * + * @param string file location + * @param float http timeout (optional, default to self::timeout 30s) + * @param int starting offset (optional, default to null) + * @param int content length (optional, default to null) + * + * @return string|bool file content or false if error + */ + public static function file_get_contents($file, $timeout = self::timeout, $offset = null, $length = null) + { + if (is_file($file) || ini_get('allow_url_fopen')) { + $context = !is_file($file) && $timeout ? + stream_context_create(['http' => ['timeout' => $timeout]]) : + null; + + return !is_null($offset) ? $length ? + @file_get_contents($file, false, $context, $offset, $length) : + @file_get_contents($file, false, $context, $offset) : + @file_get_contents($file, false, $context); + } elseif (!function_exists('curl_init')) { + return self::set_error(new Exception('Install CURL or enable "allow_url_fopen"')); + } + $handle = curl_init($file); + if ($timeout) { + curl_setopt($handle, CURLOPT_TIMEOUT, $timeout); + } + if ($offset || $length) { + curl_setopt($handle, CURLOPT_RANGE, $offset . '-' . ($length ? $offset + $length - 1 : null)); + } + curl_setopt($handle, CURLOPT_RETURNTRANSFER, 1); + $content = curl_exec($handle); + $size = curl_getinfo($handle, CURLINFO_CONTENT_LENGTH_DOWNLOAD); + curl_close($handle); + + return ($offset && $size == -1) || ($length && $length != $size) ? $length ? + substr($content, $offset, $length) : + substr($content, $offset) : + $content; + } + + /** Flatten announces list + * + * @param array announces list + * + * @return array flattened announces list + */ + public static function untier($announces) + { + $list = []; + foreach ((array) $announces as $tier) { + is_array($tier) ? + $list = array_merge($list, self::untier($tier)) : + array_push($list, $tier); + } + + return $list; + } +} diff --git a/ready2use/srv/php/Libs/torrent-rw/_config.yml b/ready2use/srv/php/Libs/torrent-rw/_config.yml new file mode 100755 index 0000000..c741881 --- /dev/null +++ b/ready2use/srv/php/Libs/torrent-rw/_config.yml @@ -0,0 +1 @@ +theme: jekyll-theme-slate \ No newline at end of file diff --git a/ready2use/srv/php/MapController.php b/ready2use/srv/php/MapController.php new file mode 100644 index 0000000..1085a0e --- /dev/null +++ b/ready2use/srv/php/MapController.php @@ -0,0 +1,334 @@ +fillRow($row); + $row->save(); + } + + function placePlayerFromTo($to_,$from_){ + + $row = Lazer::table(Constants::CONST_TABLE_MAP)->where('key', '=', $to_)->find(); + $level = Level::parseRow($row); + + //get the future player coordonates + $coord = $level -> placePlayerForKey($from_); + + //return Coord + return $coord; + } + + function getAllTiles(){ + return Tile::getAllTiles(); + } + + /************************** + * MAP PROCEDURAL GENERATION + *************************/ + + function generateWorld(){ + + //importnat VARS + $gridData; + $gridWidth = 2; + $gridHeight = 2; + + $levelToPlace; + $levelNumMax; + $levelWidthMax; + $levelHeightMax; + + //1. generate the dungeon grid + $gridData = $this->fillgrid(null, $gridWidth, $gridHeight); + + $levelToPlace = array(); + + array_push($levelToPlace, new Level(Constants::CONST_MAP_ALPHA_NAME, 15, 13, true, true)); + array_push($levelToPlace, new Level("request", 15, 13, true, false) ); + array_push($levelToPlace, new Level("conspi", 15, 13, true, false) ); + array_push($levelToPlace, new Level("art", 15, 13, true, false) ); + + array_push($levelToPlace, new Level("lulz", 15, 13, true, true) ); + /* + $size = Level::getDim(26); + array_push($levelToPlace, new Level("tripletrap", $size->x, $size->y, true)); + $size = Level::getDim(26); + array_push($levelToPlace, new Level("pol", $size->x, $size->y, true) ); + $size = Level::getDim(26); + array_push($levelToPlace, new Level("senpai", $size->x, $size->y, true)); + $size = Level::getDim(26); + array_push($levelToPlace, new Level("varg", $size->x, $size->y, true) ); + $size = Level::getDim(26); + array_push($levelToPlace, new Level("crypto", $size->x, $size->y, true) );*/ + + //2. place the main level on this grid + /* + foreach ($levelToPlace as $lvl){ + $coord = $this->pickPointFromGrid($gridData , $gridWidth, $gridHeight ); + if(isset($coord)){ + $gridData = $this->placeToGrid($gridData, $lvl, $gridWidth, $gridHeight, $coord ); + $lvl -> x = $coord-> x; + $lvl -> y = $coord-> y; + } + }*/ + + //Genrate room for missing points + /* + $emptyCoord = $this->getCoordsFor($gridData, NULL, $gridWidth, $gridHeight); + + for($l = 0; $l < count($levelToPlace); $l++){ + $index = rand(0, count($emptyCoord)-1 ); + $coord = $emptyCoord[$index]; + $level = new Level("???", rand(2,7), rand(2,7), false ); + $gridData = $this->placeToGrid($gridData, $level , $gridWidth, $gridHeight, $coord); + array_splice($emptyCoord, $index, 1); + $level-> x = $coord-> x; + $level-> y = $coord-> y; + if(count($emptyCoord) < 1) break; + }*/ + + $this->displayGrid($gridData, $gridWidth, $gridHeight, true); + + + //3. each level need to have at least 1 door + /* + $allLevels = $this->getAllLevels($gridData); + foreach ($allLevels as $lvl){ + + $dir = 0; + $numDoors = rand(1,2); + + for( $dir; $dir < 3; $dir ++ ){ + + //CAUTION level found are the door on the other direction!!! + + $levelFound = null; + $oppDir; + $coord = new Coord($lvl-> x, $lvl-> y); + + //South + if($dir == 2 ){ + + $levelFound = $this->getLevelForDir($gridData, $gridWidth, $gridHeight, $coord,$dir); + if(isset( $levelFound->door_key_N )) $levelFound = null; + $oppDir = 0; + + } + + //West + if($dir == 3 ){ + + $levelFound = $this->getLevelForDir($gridData, $gridWidth, $gridHeight, $coord,$dir); + if(isset( $levelFound->door_key_E )) $levelFound = null; + $oppDir = 1; + + } + + //North + if($dir == 0){ + + $levelFound = $this->getLevelForDir($gridData, $gridWidth, $gridHeight, $coord,$dir); + if(isset( $levelFound->door_key_S )) $levelFound = null; + $oppDir = 2; + + } + + //East + if($dir == 1 ){ + + $levelFound = $this->getLevelForDir($gridData, $gridWidth, $gridHeight, $coord,$dir); + if(isset( $levelFound->door_key_W )) $levelFound = null; + $oppDir = 3; + + } + + if( isset($levelFound) && $numDoors > 0){ + $levelFound -> setKeyForDir($lvl->key, $oppDir); + $lvl-> setKeyForDir($levelFound->key, $dir); + $numDoors --; + } + } + + //echo $lvl->name." has ".$lvl->getNumDoors()." doors
"; + + }*/ + + //Get the level + foreach ($levelToPlace as $lvl){ + $lvl -> initLevelData(); + $this->createLevel($lvl); + } + + } + + /**************************** + * UTILS for PROCEDURAL + * Generation + ****************************/ + + function fillgrid($defaultTile_, $width_, $height_){ + + $newGrid = array(); + for ($i = 0; $i < ($height_*$width_); $i++) { + array_push($newGrid,$defaultTile_); + } + + return $newGrid; + } + + function pickPointFromGrid($gridData, $width_, $height_ ){ + + for ($i = 0; $i < 10; $i++) { + + $x = rand ( 0 , $width_-1); + $y = rand ( 0 , $height_-1); + + //is grid coordonate occupped? + $val = $gridData[ ($y*$height_) + $x]; + if( !isset($val)) return new Coord($x, $y); + } + + return NULL; + } + + function placeToGrid($gridData, $data, $width_, $height_, $coord){ + $gridData[ ( $coord->y *$width_) + $coord->x] = $data; + return $gridData; + } + + function getLevelForCoord($gridData_, $coord_, $width_, $height_){ + return $gridData_[ ( $coord_->y *$width_) + $coord_->x]; + } + + + + function getCoordsFor($gridData, $data, $width_, $height_){ + $listData = array(); + + for ($y = 0; $y < $height_; $y++) { + + for ($x = 0; $x < $width_; $x++) { + if( $gridData[ ($y*$width_) + $x] == $data) array_push($listData, new Coord($x, $y)); + } + + } + return $listData; + } + + /** + * Get all the levels from the griddata + * Return Level[] array; + */ + function getAllLevels($gridData){ + $levels = array(); + foreach ($gridData as $lvl){ + if(isset($lvl)) array_push($levels,$lvl); + } + return $levels; + } + + function displayGrid($gridData_, $width_, $height_, $is_null){ + + for ($y = 0; $y < $height_; $y++) { + + for ($x = 0; $x < $width_; $x++) { + if( !isset($gridData_[($y*$width_) + $x]) || !isset($gridData_[ ($y*$width_) + $x] -> name)){ + echo "."; + } else { + $name = $gridData_[ ($y*$width_) + $x] -> name; + echo substr($name,0,1); + } + } + + echo "
"; + + } + } + + function getLevelForDir($gridData_, $width_, $height_, $coord_,$dir_){ + + switch($dir_){ + + case 0: + for ($y = $coord_->y -1; $y >= 0; $y--) { + $coord = new Coord( $coord_->x,$y); + $level = $this->getLevelForCoord($gridData_, $coord, $width_, $height_); + if(isset($level)) return $level; + } + break; + + case 1: + + for ($x = $coord_->x +1; $x < $width_; $x++) { + $coord = new Coord( $x,$coord_->y); + $level = $this->getLevelForCoord($gridData_, $coord, $width_, $height_); + if(isset($level)){ + return $level; + } + } + break; + + + case 2: + for ($y = $coord_->y +1; $y < $height_; $y++) { + $coord = new Coord( $coord_->x,$y); + $level = $this->getLevelForCoord($gridData_, $coord, $width_, $height_); + if(isset($level)) return $level; + } + break; + + case 3: + + for ($x = $coord_->x -1; $x >= 0; $x--) { + $coord = new Coord( $x,$coord_->y); + $level = $this->getLevelForCoord($gridData_, $coord, $width_, $height_); + if(isset($level)) return $level; + } + break; + } + + return null; + + } +} diff --git a/ready2use/srv/php/Models/FakeFile.php b/ready2use/srv/php/Models/FakeFile.php new file mode 100644 index 0000000..a9cf862 --- /dev/null +++ b/ready2use/srv/php/Models/FakeFile.php @@ -0,0 +1,24 @@ + 'integer', + 'id_post' => 'integer', + 'thread_key' => 'string', + 'fake_path' => 'string', + 'fake_name' => 'string', + 'file_name' => 'string'*/ + + function __construct($file_path_, $file_ext_, $map_key ) { + + $name = uniqid(); + $this ->fake_name = $name.'.'.$file_ext_; + $this ->file_name = Helpers::getRealFileName($this ->fake_name).'.'.$file_ext_; + //$this ->fake_path = $file_path_."img/".$map_key."_". $this ->file_name; + $this ->fake_path = $file_path_."php/uploads/".$map_key."/".Helpers::getRealFileName($this ->fake_name).'.'.$file_ext_; + $this ->map_key = $map_key; + + } + +} \ No newline at end of file diff --git a/ready2use/srv/php/Models/Game/Coord.php b/ready2use/srv/php/Models/Game/Coord.php new file mode 100644 index 0000000..68f7e2d --- /dev/null +++ b/ready2use/srv/php/Models/Game/Coord.php @@ -0,0 +1,13 @@ + x = $x; + $this-> y = $y; + } + + +} diff --git a/ready2use/srv/php/Models/Game/GameData.php b/ready2use/srv/php/Models/Game/GameData.php new file mode 100644 index 0000000..cea54e0 --- /dev/null +++ b/ready2use/srv/php/Models/Game/GameData.php @@ -0,0 +1,15 @@ + name = "sponge"; + $item-> action = "post delete"; + $item-> type = "posting"; + $item-> description = "The sponge give you the ability to make disappear a post that isn't canon"; + $item-> is_expendable = true; + $item-> valueMin = 1; + $item-> valueMax = 3; + $item-> itemsPerPlayer = 1; + array_push( $items ,$item); + + /* + $item = new Item(); + $item-> name = "ring of upload"; + $item-> action = "upload"; + $item-> type = "posting"; + $item-> description = "Give you the ability to upload picture when you post"; + $item-> is_expendable = false; + $item-> valueMin = 10; + $item-> valueMax = 18; + $item-> itemsPerPlayer = 1; + array_push( $items ,$item); + + $item = new Item(); + $item-> name = "pen"; + $item-> action = "drawing"; + $item-> type = "posting"; + $item-> description = "Give you the ability to draw"; + $item-> is_expendable = true; + $item-> valueMin = 1; + $item-> valueMax = 10; + $item-> itemsPerPlayer = 10; + array_push( $items ,$item); + + $item = new Item(); + $item-> name = "black powder"; + $item-> action = "canon"; + $item-> type = "posting"; + $item-> description = "Set a post as canon"; + $item-> is_expendable = true; + $item-> valueMin = 1; + $item-> valueMax = 5; + $item-> itemsPerPlayer = 3; + array_push( $items ,$item); + + $item = new Item(); + $item-> name = "knife"; + $item-> action = "harm"; + $item-> type = "fight"; + $item-> description = "You can kill enemies from the dungeon or even other anons"; + $item-> is_expendable = true; + $item-> valueMin = 99; + $item-> valueMax = 100; + $item-> itemsPerPlayer = 1; + array_push( $items ,$item); + + $item = new Item(); + $item-> name = "rope"; + $item-> action = "bound"; + $item-> type = "fight"; + $item-> description = "You bound certain enemies and anons"; + $item-> is_expendable = true; + $item-> valueMin = 2; + $item-> valueMax = 4; + $item-> itemsPerPlayer = 1; + array_push( $items ,$item);*/ + + return $items; + } +} \ No newline at end of file diff --git a/ready2use/srv/php/Models/Game/Level.php b/ready2use/srv/php/Models/Game/Level.php new file mode 100644 index 0000000..65b7541 --- /dev/null +++ b/ready2use/srv/php/Models/Game/Level.php @@ -0,0 +1,362 @@ + name = $name; + $this-> width = $width; + $this-> height = $height; + $this-> is_chan = $is_chan; + $this-> is_secret = $is_secret; + $this-> key = $name; + } + + public function setKeyForDir($key_,$dir_){ + switch($dir_){ + + case 0: + $this -> door_key_n = $key_; + break; + + case 1: + $this -> door_key_e = $key_; + break; + + case 2: + $this -> door_key_s = $key_; + break; + + case 3: + $this -> door_key_w = $key_; + break; + } + } + + public function getNumDoors(){ + $num = 0; + if(isset($this -> door_key_n)) $num ++; + if(isset($this -> door_key_e)) $num ++; + if(isset($this -> door_key_s)) $num ++; + if(isset($this -> door_key_w)) $num ++; + return $num; + } + + public function getDoorCoordKey($key_){ + + $x = 0; + $y = 0; + + //test N + if($key_ == $this -> door_key_n){ + for($x = 0 ; $x < $this->width ; $x++ ){ + $tile = $this -> pickTile($this->width, $this->height,new Coord($x , $y)); + if($tile == Tile::getValueForName("gate")) return new Coord($x,$y); + } + } else if($key_ == $this -> door_key_e){ + $x = $this->width - 1; + for($y = 0 ; $y < $this->height ; $y++ ){ + $tile = $this -> pickTile( $this->width, $this->height, new Coord($x , $y)); + if($tile == Tile::getValueForName("gate")) return new Coord($x,$y); + } + + } else if($key_ == $this -> door_key_s){ + $y = $this->height - 1; + for($x = 0 ; $x < $this->width ; $x++ ){ + $tile = $this -> pickTile($this->width, $this->height,new Coord($x , $y)); + if($tile == Tile::getValueForName("gate")) return new Coord($x,$y); + } + }else if($key_ == $this -> door_key_w){ + for($y = 0 ; $y < $this->height ; $y++ ){ + $tile = $this -> pickTile($this->width, $this->height,new Coord($x , $y)); + if($tile == Tile::getValueForName("gate")) return new Coord($x,$y); + } + } + + return null; + } + + public function placePlayerForKey($key_){ + + $coord = $this -> getDoorCoordKey($key_); + + if($coord->y == 0) { + return new Coord($coord->x , $coord->y+1); + } else if($coord->x == $this->width-1) { + return new Coord($coord->x-1 , $coord->y); + }else if($coord->y == $this->height-1) { + return new Coord($coord->x , $coord->y-1); + }else if($coord->x == 0) { + return new Coord($coord->x+1 , $coord->y); + } + + return new Coord(1 , 1); + } + + public function initLevelData(){ + + //New version: all the level are the same + $this->level_data = + [ + 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, + 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1, + 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1, + 1,0,0,1,1,1,1,1,1,1,1,1,1,1,1,0,0,1, + 1,0,0,1,0,0,0,0,0,1,0,4,0,0,1,0,0,1, + 1,0,0,1,0,0,13,0,0,1,0,1,0,0,1,0,0,1, + 1,0,0,1,0,0,0,0,0,1,0,1,0,0,1,0,0,1, + 1,0,0,1,0,0,0,0,0,1,3,1,0,0,1,0,0,1, + 1,0,0,1,1,1,4,1,1,1,1,1,0,0,1,0,0,1, + 1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1, + 1,1,1,1,1,1,1,1,1,1,1,1,0,0,1,0,0,1, + 1,0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,1, + 14,0,0,0,0,0,0,0,0,0,0,5,0,0,0,0,0,1, + 1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1, + 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 + ]; + + $this-> width = 18; + $this-> height = 15; + + + /* + //Create a middle room + //Middle room looks cool everywhere + $this->fillgrid(Tile::getValueForName("ground"), $this->width, $this->height); + + //Place wall + $this->makeWallForLevel(); + + //place gates + $coord = new Coord(0,0); + + if(isset( $this -> door_key_n)){ + $coord ->y = 0; + $coord ->x = rand(1, $this->width-2); + $this->placeToLevel(Tile::getValueForName("gate"), $this->width, $this->height, $coord); + } + + if(isset( $this -> door_key_e)){ + $coord ->y = rand(1, $this->height-2); + $coord ->x = $this->width-1; + $this->placeToLevel(Tile::getValueForName("gate"), $this->width, $this->height, $coord); + } + + if(isset( $this -> door_key_s)){ + $coord ->y = $this->height-1; + $coord ->x = rand(1, $this->width-2); + $this->placeToLevel(Tile::getValueForName("gate"), $this->width, $this->height, $coord); + } + + if(isset( $this -> door_key_w)){ + $coord ->y = rand(1, $this->height-2); + $coord ->x = 0; + $this->placeToLevel(Tile::getValueForName("gate"), $this->width, $this->height, $coord); + }*/ + + //Display the level + $this -> displayLevelData(); + } + + function makeWallForLevel(){ + + //North wall + $y = 0; + for ($x = 0 ; $x <= $this-> width ; $x++){ + $coord = new Coord($x,$y); + $this->placeToLevel(Tile::getValueForName("wall"), $this->width, $this->height, $coord); + } + + //South wall + $y = $this->height-1; + for ($x = 0 ; $x < $this-> width ; $x++){ + $coord = new Coord($x,$y); + $this->placeToLevel(Tile::getValueForName("wall"), $this->width, $this->height, $coord); + } + + //West + $x = 0; + for ($y = 0 ; $y < $this-> height ; $y++){ + $coord = new Coord($x,$y); + $this->placeToLevel(Tile::getValueForName("wall"), $this->width, $this->height, $coord); + } + + //Est + $x = $this->width-1; + for ($y = 0 ; $y < $this-> height ; $y++){ + $coord = new Coord($x,$y); + $this->placeToLevel(Tile::getValueForName("wall"), $this->width, $this->height, $coord); + } + } + + public function displayLevelData(){ + echo "# MAP ".$this->name." num tiles:".count($this->level_data)."
"; + + $x = 0; + $y = 0; + + foreach($this->level_data as $data){ + //echo "x:".$x."y:".$y."
"; + /* + if(!isset( $data ) || $data == Tile::getValueForName("wall") ){ + echo "#"; + } else if($data == Tile::getValueForName("ground")) { + echo "."; + } else if($data == Tile::getValueForName("door")) { + //echo "x:".$x."y:".$y."
"; + echo "D"; + }*/ + + echo Tile::getDisplayForVal($data); + + $x ++; + if($x >= $this -> width){ + $x = 0; + $y ++; + echo "
"; + } + } + } + + //Level Data management + function fillgrid($defaultTile_, $width_, $height_){ + + $this->level_data = array(); + for ($i = 0; $i < $height_*$width_; $i++) { + array_push( $this->level_data ,$defaultTile_); + } + + } + + function placeToLevel($data, $width_, $height_, $coord){ + + $this->level_data [ ( $coord->y *$width_) + $coord->x] = $data; + } + + function pickTile($width_, $height_, $coord){ + return $this->level_data [ ( $coord->y *$width_)+ $coord->x]; + } + + //Fill a data base row + public function fillRow($row_){ + + echo "Write level: ".$this-> name."; for key".$this-> key." with ".count($this-> level_data)." data"; + $row_ -> key = $this-> key; + $row_ -> name = $this-> name; + $row_ -> theme = $this-> theme; + /* + $row_ -> x = $this-> x; + $row_ -> y = $this-> y; + */ + $row_ -> width = $this-> width; + $row_ -> height = $this-> height; + if(isset( $this-> door_key_n))$row_ -> door_key_n = $this-> door_key_n; + if(isset( $this-> door_key_e)) $row_ -> door_key_e = $this-> door_key_e; + if(isset( $this-> door_key_s)) $row_ -> door_key_s = $this-> door_key_s; + if(isset( $this-> door_key_w)) $row_ -> door_key_w = $this-> door_key_w; + + $dataString = ""; + + foreach( $this-> level_data as $data ){ + $dataString = $dataString.$data.","; + } + $dataString = $dataString .substr(0, strlen($dataString) - 1); + $row_ -> level_data = $dataString; + + $row_ -> is_safe = $this-> is_safe; + $row_ -> is_chan = $this-> is_chan; + $row_ -> is_secret = $this-> is_secret; + + //var_dump( $row_); + + return $row_; + } + + //Get Ground tiles + public function getEmptyCoord(){ + $coords = array(); + + $x = 0; + $y = 0; + foreach( $this-> level_data as $data ){ + + if((int) $data == Tile::getValueForName("ground")){ + $coord = new Coord($x,$y); + array_push($coords,$coord); + } + + $x ++; + if($x >= $this-> width){ + $y ++; + $x = 0; + } + } + + return $coords[rand( 0, count( $coords )-1)]; + } + + //Fill a data base row + public static function parseRow($row_){ + + $level = new Level("",0,0,false, false); + + $level -> key = $row_ -> key; + $level -> name = $row_ -> name; + $level -> theme = $row_ -> theme; + $level -> is_secret = $row_ -> is_secret; + $level -> x = $row_ -> x; + $level -> y = $row_ -> y; + $level -> width = $row_ -> width; + $level -> height = $row_ -> height; + if(isset( $row_-> door_key_n)) $level -> door_key_n = $row_-> door_key_n; + if(isset( $row_-> door_key_e)) $level -> door_key_e = $row_-> door_key_e; + if(isset( $row_-> door_key_s)) $level -> door_key_s = $row_-> door_key_s; + if(isset( $row_-> door_key_w)) $level -> door_key_w = $row_-> door_key_w; + + //parse the data + $level -> level_data = explode(",",$row_ -> level_data); + + $level -> is_safe = $row_-> is_safe; + $level -> is_chan = $row_-> is_chan; + + return $level ; + } + + //Fill a data base row + public static function getDim($num){ + + $minTile = 4; + if($num < $minTile ) $num = $minTile; + $width = rand ( $minTile , $num - $minTile ); + $height = $num - $width; + + return new Coord( $width, $height); + } + +} \ No newline at end of file diff --git a/ready2use/srv/php/Models/Game/Tile.php b/ready2use/srv/php/Models/Game/Tile.php new file mode 100644 index 0000000..370221a --- /dev/null +++ b/ready2use/srv/php/Models/Game/Tile.php @@ -0,0 +1,56 @@ + value = $value; + $this -> display = $display; + $this -> name = $name; + $this -> descitption = $descitption; + } + + public static function getAllTiles() + { + $tiles = array(); + array_push( $tiles, new Tile(0,".","ground","You can walk on it.")); + array_push( $tiles, new Tile(1,"█","wall","You cannot go thought it.")); + array_push( $tiles, new Tile(2,"#","drawable wall","Like a wall, but you can post on it.")); + array_push( $tiles, new Tile(3,"/","gate","An entrance to another level.")); + array_push( $tiles, new Tile(4,"D","door","You can open it.")); + array_push( $tiles, new Tile(5,"▓","fake wall","You can open it.")); + /* array_push( $tiles, new Tile(6,"*","trap","It can kill you.")); + array_push( $tiles, new Tile(7,";","grass","just green ground")); + array_push( $tiles, new Tile(8,"±","shrine","Special items goes there.")); + array_push( $tiles, new Tile(9,"f","fire","You cannot cross.")); + array_push( $tiles, new Tile(10,"R","fast food","You can fullfil your health here"));*/ + array_push( $tiles, new Tile(11,"t","seed","You will found torrent of the board here")); + //array_push( $tiles, new Tile(12,"A","Advertisement wall","It's used to display advertisement.")); + array_push( $tiles, new Tile(13,"s","Player start","It's the point of arrival of a player. All map need one")); + array_push( $tiles, new Tile(14,"|","gate secret","An entrance to secret level.")); + return $tiles; + } + + public static function getValueForName($name) + { + $tiles = Tile::getAllTiles(); + foreach ($tiles as $tile){ + if($tile->name == $name) return $tile->value; + } + + return -1; + } + + public static function getDisplayForVal($val) + { + $tiles = Tile::getAllTiles(); + foreach ($tiles as $tile){ + if($tile->value == $val) return $tile->display; + } + + return -1; + } +} \ No newline at end of file diff --git a/ready2use/srv/php/Models/Post.php b/ready2use/srv/php/Models/Post.php new file mode 100644 index 0000000..1eeec75 --- /dev/null +++ b/ready2use/srv/php/Models/Post.php @@ -0,0 +1,69 @@ + 'integer', + 'key' => 'string', + 'scale' => 'integer', + 'date' => 'integer', + 'player_ip' => 'string', + 'player_id' => 'integer', + 'is_canon' => 'boolean', + 'nsfw' => 'boolean', + 'player_name' => 'string', + 'thread_key' => 'string', + 'canvas_key' => 'string', + 'message' => 'string', + 'url' => 'string', + 'magnet' => 'string', + 'torrent' => 'string', + 'hash' => 'string' + */ + + public $id; + public $key; + public $scale; + public $date; + public $reply; + public $player_ip; + public $player_id; + public $is_canon; + public $nsfw; + public $player_name; + public $map_key; + public $canvas_key; + public $message; + public $url; + public $magnet; + public $hash; + public $graffiti; + + function __construct( ) { + + $this ->url = ""; + $this ->map_key = ""; + $this ->message = ""; + $this ->magnet = ""; + $this ->hash = ""; + $this ->player_name = "anonymous"; + $this ->graffiti = 'false'; + $this ->reply = ""; + + } + + function fillWithPostData(){ + + if( isset($_POST['tmap_key']) ) $this -> map_key = $_POST['map_key']; + if( isset($_POST['canvas_key']) ) $this -> canvas_key = $_POST['canvas_key']; + + if( isset($_POST['message']) ) $this -> message = $_POST['message']; + if( isset($_POST['magnet']) ) $this -> magnet = $_POST['magnet']; + if( isset($_POST['url']) ) $this -> url = $_POST['url']; + if( isset($_POST['hash']) ) $this -> hash = $_POST['hash']; + if( isset($_POST['graffiti']) ) $this -> graffiti = $_POST['graffiti']; + if( isset($_POST['reply']) ) $this -> reply = $_POST['reply']; + + } + +} \ No newline at end of file diff --git a/ready2use/srv/php/Utils/Constants.php b/ready2use/srv/php/Utils/Constants.php new file mode 100644 index 0000000..d7c5e71 --- /dev/null +++ b/ready2use/srv/php/Utils/Constants.php @@ -0,0 +1,51 @@ + $isOk, + 'result' => $result, + 'error' => $error + ); + + header("Content-type: application/json"); + echo json_encode($response); + exit(); + + } + + /** + * Get the user IP + */ + public static function getClientIp() { + // IP si internet partagé + if (isset($_SERVER['HTTP_CLIENT_IP'])) { + return $_SERVER['HTTP_CLIENT_IP']; + } + // IP derrière un proxy + elseif (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) { + return $_SERVER['HTTP_X_FORWARDED_FOR']; + } + // Sinon : IP normale + else { + return (isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : ''); + } + } + + /** + * CHECK IF BASE64 code is an image + */ + public static function check_base64_image($base64) { + + $img = imagecreatefromstring(base64_decode($base64)); + if (!$img) { + return false; + } + + imagepng($img, 'tmp.png'); + $info = getimagesize('tmp.png'); + + unlink('tmp.png'); + + if ($info[0] > 0 && $info[1] > 0 && $info['mime']) { + return true; + } + + return false; + } + + /* + * Check Base64 size + */ + public static function getBase64ImageSize($base64Image){ //return memory size in B, KB, MB + try{ + $size_in_bytes = (int) (strlen(rtrim($base64Image, '=')) * 3 / 4); + $size_in_kb = $size_in_bytes / 1024; + + return $size_in_kb; + } + catch(Exception $e){ + return $e; + } + } + + /** + * Generate random Token + */ + public static function generateToken(){ + //Generate a random string. + $token = openssl_random_pseudo_bytes(16); + + //Convert the binary data into hexadecimal representation. + return bin2hex($token); + } + + /** + * Hash password + */ + public static function hash_pw($plain_pw) + { + // (optional) change logic here for different hash algorithm + //return password_hash($plain_pw, PASSWORD_DEFAULT); + return md5($plain_pw); + } + + /** + * Verify hashed password + */ + public static function verify_pw($plain_pw, $hashed_pw) + { + // (optional) change logic here for different hash algorithm + //return password_verify($plain_pw, $hashed_pw); + return (md5($plain_pw)==$hashed_pw); + } + + + /** + * Get Real File Name + */ + public static function getRealFileName($fileName_) + { + + return md5($fileName_.'_'.Constants::CONST_IMAGE_SALT); + } + +} \ No newline at end of file diff --git a/ready2use/srv/php/admin.php b/ready2use/srv/php/admin.php new file mode 100644 index 0000000..7c31f09 --- /dev/null +++ b/ready2use/srv/php/admin.php @@ -0,0 +1,241 @@ + + + + + + + ADMIN OF THE BOARD + + +
===================
+
ADMIN OF THE BOARD
+
===================
+ +
+
Manage the database player+arts here.
+
Map powered by LAZER®
+
+ +
Admin pswd: +
+
+ + +
+ +
+
------------------------
+
List of the different WS
+
+ +
+ +
+ + +
+
+ +
------------------------
+
Web service response
+ + +
+
+ + + + + + \ No newline at end of file diff --git a/ready2use/srv/php/config/settings.json b/ready2use/srv/php/config/settings.json new file mode 100644 index 0000000..d2fcb79 --- /dev/null +++ b/ready2use/srv/php/config/settings.json @@ -0,0 +1,9 @@ +{ + "name":"Noodle Demo", + "description":"Test server with Noodle-IB. ✌⊂(✰‿✰)つ✌", + "rules":"Your rules here.", + "bannerImg":"https://pbs.twimg.com/media/DmBnJhaW4AAiZtn.jpg", + "contact":"alexkrunch@gmail.com", + "isMap":false, + "flavours":["alpha","techno","oktaku"] +} \ No newline at end of file diff --git a/ready2use/srv/php/data/.htaccess b/ready2use/srv/php/data/.htaccess new file mode 100755 index 0000000..a8b3e00 --- /dev/null +++ b/ready2use/srv/php/data/.htaccess @@ -0,0 +1,2 @@ +# Block External Access +deny from all diff --git a/ready2use/srv/php/password/.htaccess b/ready2use/srv/php/password/.htaccess new file mode 100755 index 0000000..a8b3e00 --- /dev/null +++ b/ready2use/srv/php/password/.htaccess @@ -0,0 +1,2 @@ +# Block External Access +deny from all diff --git a/ready2use/srv/php/tracker/announce.php b/ready2use/srv/php/tracker/announce.php new file mode 100755 index 0000000..ac60b97 --- /dev/null +++ b/ready2use/srv/php/tracker/announce.php @@ -0,0 +1,358 @@ +. +*/ + +/************************* + ** Configuration start ** + *************************/ + +/* + * Enable debugging? + * This allows anyone to see the entire peer database by appending ?debug to the announce URL. + * It will also create debugging file used to report php errors. + */ +define('__DEBUGGING_ENABLED', true); + +/** + * Version + */ +define('__VERSION', 1.5); + +/** + * How often should clients pull server for new clients? (Seconds) + */ +define('__INTERVAL', 1800); + +/** + * What's the minimum interval a client may pull the server? (Seconds) + * Some bittorrent clients does not obey this + */ +define('__INTERVAL_MIN', 300); + +/** + * How long should we wait for a client to re-announce after the last announce expires? (Seconds) + */ +define('__CLIENT_TIMEOUT', 60); + +/** + * Skip sending the peer id if client does not want it? + * Hint: Should be set to true + */ +define('__NO_PEER_ID', true); + +/** + * Should seeders not see each others? + * Hint: Should be set to true + */ +define('__NO_SEED_P2P', true); + +/** + * Where should we save the peer database + * On Linux, you should use /dev/shm as it is very fast. + * On Windows, you will need to change this value to some other valid path such as C:/Peers.txt + */ +define('__LOCATION_PEERS', 'peers.txt'); + +/** + * Should we enable short announces? + * This allows NATed clients to get updates much faster, but it also + * takes more load on the server. (This is just an experimental feature which may be turned off) + */ +define('__ENABLE_SHORT_ANNOUNCE', false); + +/** + * In case someone tries to access the tracker using a browser, redirect to this URL or file + */ +define('__REDIR_BROWSER', ''); + +define('__LOG_FILE', __DIR__ . '/error.log'); + +/*********************** + ** Configuration end ** + ***********************/ + +if(__DEBUGGING_ENABLED === true) { + + set_error_handler(function ($errno, $errstr, $errfile, $errline) { + + if (file_exists(__LOG_FILE) === false) { + $handle = fopen(__LOG_FILE, 'w+b'); + fclose($handle); + } + + file_put_contents(__LOG_FILE, sprintf('Line: %s - Error: %s', $errline, $errstr)); + + }, E_ALL); + +} + +//Send response as text +header('Content-type: Text/Plain'); +header('X-Tracker-Version: Bitstorm ' . __VERSION); //Please give me some credit + +/** + * If you *really* dont want to, comment this line out. + * Bencoding function, returns a bencoded dictionary. + * You may go ahead and enter custom keys in the dictionary in this function if you'd like. + */ + +function track($list, $interval = 60, $min_ival = 0) +{ + if (is_string($list)) { //Did we get a string? Return an error to the client + return 'd14:failure reason' . strlen($list) . ':' . $list . 'e'; + } + + $p = ''; //Peer directory + $c = $i = 0; //Complete and Incomplete clients + + foreach ($list as $d) { //Runs for each client + if ($d[7]) { //Are we seeding? + $c++; //Seeding, add to complete list + if (__NO_SEED_P2P && is_seed()) { //Seeds should not see each others + continue; + } + } else { + $i++; //Not seeding, add to incomplete list + } + + //Do some bencoding + $pid = ''; + + if (isset($_GET['no_peer_id']) === false && __NO_PEER_ID) { //Shall we include the peer id + $pid = '7:peer id' . strlen($d[1]) . ':' . $d[1]; + } + + $p .= 'd2:ip' . strlen($d[0]) . ':' . $d[0] . $pid . '4:porti' . $d[2] . 'ee'; + } + + //Add some other paramters in the dictionary and merge with peer list + $r = 'd8:intervali' . $interval . 'e12:min intervali' . $min_ival . 'e8:completei' . $c . 'e10:incompletei' . $i . 'e5:peersl' . $p . 'ee'; + + return $r; +} + +//Find out if we are seeding or not. Assume not if unknown. +function is_seed() +{ + return (isset($_GET['left']) && (int)$_GET['left'] === 0); +} + +/* +* Yeah, this is the database engine. It's pretty bad, uses files to store peers. +* Should be easy to rewrite to use SQL instead. +* +* Yes, sometimes collisions may occur and screw the DB over. It might or might not +* recover by itself. +*/ + +//Save database to file +function db_save($data) +{ + $b = serialize($data); + $handle = fopen(__LOCATION_PEERS, 'wb'); + + if ($handle === false) { + return false; + } + + if (flock($handle, LOCK_EX) === false) { + return false; + } + + fwrite($handle, $b); + fclose($handle); + + return true; +} + +//Load database from file +function db_open() +{ + $p = ''; + $handle = fopen(__LOCATION_PEERS, 'rb'); + if ($handle === false) { + return false; + } + + if (flock($handle, LOCK_EX) === false) { + return false; + } + + while (feof($handle) === false) { + $p .= fread($handle, 512); + } + + fclose($handle); + + return ((string)$p !== '') ? unserialize($p) : true; +} + +//Check if DB file exists, otherwise create it +function db_exists($createEmpty = false) +{ + if (file_exists(__LOCATION_PEERS) === true) { + return true; + } + + if ($createEmpty === true) { + return db_save([]); + } + + return false; +} + +//Default announce time +$interval = __INTERVAL; + +//Minimal announce time (does not apply to short announces) +$interval_min = __INTERVAL_MIN; + +/* +* This is a pretty smart feature not present in other tracker software. +* If you expect to have many NATed clients, add short as a GET parameter, +* and clients will pull much more often. +* +* This can be done automatically, simply try to open a TCP connection to +* the client and assume it is NATed if not successful. +*/ +if (isset($_GET['short']) && __ENABLE_SHORT_ANNOUNCE) { + $interval = 120; + $interval_min = 30; +} + +//Did we get any parameters at all? +//Client is probably a web browser, do a redirect +if (empty($_GET)) { + header('Location: ' . __REDIR_BROWSER); + die(); +} + +//Create database if it does not exist +db_exists(true) or die(track('Unable to create database')); +$d = db_open(); + +//Do we want to debug? (Should not be used by default) +if (isset($_GET['debug']) && __DEBUGGING_ENABLED) { + echo 'Connected peers:' . count($d) . "\n\n"; + die(); +} + +//Did we get a failure from the database? +if ($d === false) { + die(track('Database failure')); +} + +//Do some input validation +function valdata($g, $must_be_20_chars = false) +{ + if (!isset($_GET[$g])) { + die(track('Missing one or more arguments')); + } + if (!is_string($_GET[$g])) { + die(track('Invalid types on one or more arguments')); + } + if ($must_be_20_chars && strlen($_GET[$g]) != 20) { + die(track('Invalid length on ' . $g . ' argument')); + } + if (strlen($_GET[$g]) > 128) { //128 chars should really be enough + die(track('Argument ' . $g . ' is too large to handle')); + } +} + +//Inputs that are needed, do not continue without these +valdata('peer_id', true); +valdata('port'); +valdata('info_hash', true); + +//Use the tracker key extension. Makes it much harder to steal a session. +if (!isset($_GET['key'])) { + $_GET['key'] = ''; +} +valdata('key'); + +//Do we have a valid client port? +if (!ctype_digit($_GET['port']) || $_GET['port'] < 1 || $_GET['port'] > 65535) { + die(track('Invalid client port')); +} + +//Array key, unique for each client and torrent +$sum = sha1($_GET['peer_id'] . $_GET['info_hash']); + +//Make sure we've got a user agent to avoid errors +//Used for debugging +if (!isset($_SERVER['HTTP_USER_AGENT'])) { + $_SERVER['HTTP_USER_AGENT'] = ''; //Must always be set +} + +//When should we remove the client? +$expire = time() + $interval; + +//Have this client registered itself before? Check that it uses the same key +if (isset($d[$sum])) { + if ((string)$d[$sum][6] !== (string)$_GET['key']) { + sleep(3); //Anti brute force + die(track('Access denied, authentication failed')); + } +} + +//Add/update the client in our global list of clients, with some information +$d[$sum] = [$_SERVER['REMOTE_ADDR'], $_GET['peer_id'], $_GET['port'], $expire, $_GET['info_hash'], $_SERVER['HTTP_USER_AGENT'], $_GET['key'], is_seed()]; + +//No point in saving the user agent, unless we are debugging +if (!__DEBUGGING_ENABLED) { + unset($d[$sum][5]); +} elseif (!empty($_GET)) { //We are debugging, add GET parameters to database + $d[$sum]['get_parm'] = $_GET; +} + +//Did the client stop the torrent? +//We dont care about other events +if (isset($_GET['event']) && (string)$_GET['event'] === 'stopped') { + unset($d[$sum]); + db_save($d); + die(track([])); //The RFC says its OK to return whatever we want when the client stops downloading, + //however, some clients will complain about the tracker not working, hence we return + //an empty bencoded peer list +} + +//Check if any client timed out +foreach ($d as $k => $data) { + if (time() > $data[3] + __CLIENT_TIMEOUT) { //Give the client some extra time before timeout + unset($d[$k]); //Client has gone away, remove it + } +} + +//Save the client list +db_save($d); + +//Compare info_hash to the rest of our clients and remove anyone who does not have the correct torrent +foreach ($d as $id => $info) { + if ((string)$info[4] !== (string)$_GET['info_hash']) { + unset($d[$id]); + } +} + +// Remove self from list, no point in having ourselfes in the client dictionary +unset($d[$sum]); + +// Add a few more seconds on the timeout to balance the load +$interval += mt_rand(0, 10); + +// Bencode the dictionary and send it back +echo track($d, $interval, $interval_min); +exit(0); \ No newline at end of file diff --git a/ready2use/srv/php/tracker/peers.txt b/ready2use/srv/php/tracker/peers.txt new file mode 100755 index 0000000..e69de29 diff --git a/ready2use/srv/php/trash/Rogue/Economy.php b/ready2use/srv/php/trash/Rogue/Economy.php new file mode 100644 index 0000000..4f08db9 --- /dev/null +++ b/ready2use/srv/php/trash/Rogue/Economy.php @@ -0,0 +1,60 @@ +world = $world_; + $this->name = $name_; + + //We calculate the + $this->mineralsPrice = (1 / $world_->minerals)*$this->priceCoef; + $this->energyPrice = (1/ $world_->energy)*$this->priceCoef; + $this->vegetablePrice = (1/ $world_->vegetable)*$this->priceCoef; + $this->animalsPrice = (1/ $world_->animals)*$this->priceCoef; + $this->waterPrice = (1/ $world_->water)*$this->priceCoef; + + } + + public function getPIB($town, $macroEco){ + + $minerals = ($town->minerals)*$macroEco->mineralsPrice; + $energy = ($town->energy)*$macroEco->energyPrice; + $vegetable = ($town->vegetable)*$macroEco->vegetablePrice; + $animals = ($town->animals)*$macroEco->animalsPrice; + $water = ($town->water)*$macroEco->waterPrice; + + $this->PIB = ($minerals+ $energy+$vegetable+ $animals+$water); + return $this->PIB; + } + + public function print(){ + + echo '*******************************
'; + echo ' '.$this ->name.' ECONOMY
'; + echo '*******************************
'; + echo 'mineralsPrice: $'.$this ->mineralsPrice.'
'; + echo 'energyPrice: $'.$this ->energyPrice.'
'; + echo 'vegetablePrice: $'.$this ->vegetablePrice.'
'; + echo 'animalsPrice: $'.$this ->animalsPrice.'
'; + echo 'waterPrice: $'.$this ->waterPrice.'
'; + echo '
'; + } + +} \ No newline at end of file diff --git a/ready2use/srv/php/trash/Rogue/Town.php b/ready2use/srv/php/trash/Rogue/Town.php new file mode 100644 index 0000000..2c48ebc --- /dev/null +++ b/ready2use/srv/php/trash/Rogue/Town.php @@ -0,0 +1,192 @@ + things that won't be imported +public $minerals; +public $energy; //uranium, gaz etc. +public $vegetable; +public $animals; +public $water; + +//DailyProduction +public $mineralsProd; +public $energyProd; //uranium, gaz etc. +public $vegetableProd; +public $animalsProd; +public $waterProd; + +public $microEconomy; //influence industry +public $money; +public $deathCoef = 10; +public $fertilyCoef = 100; + +//Propertie that influence the whole town +public $old; +public $pib; +public $population; +public $culture; // books per habitants +public $weapons; +public $tools; +public $cyber; +public $deads; + +//Influenced +public $hiearchy; // numb strat of the population +public $superficy; +public $crimeRate; +public $justiceEfficiency; +public $inequality; +public $terrorism; + +//imported stuff +public $importMinerals; +public $importEnergy; +public $importVegetable; +public $importAnimals; +public $migrants; + +//Building +public $rafineries; +public $factories; +public $banks; +public $internet; +public $shops; //--> link to ressources and tools +public $residences; +public $libraries; +public $cimetaries; +public $lakes; +public $ports; //--> at least one +public $discharges; + + +function __construct( ) { + +} + +/** + * $difficulty_ : 1 to 100 + */ +public function initGeo($name_, $difficulty_){ + + $this ->key = uniqid(); + $this ->name = $name_; + $this ->population = rand ( 25 , 75 ) ; + + //Geography + $this ->lat = rand ( 0 , 100 ); + + if( $this ->lat < 50){ + $coefHardGeo = $this ->lat *2; + } else { + $coefHardGeo = (100 - ($this ->lat)) *2; + } + + if($coefHardGeo == 0) $coefHardGeo = 1; + if($coefHardGeo == 100) $coefHardGeo = 99; + + //echo 'coefHardGeo: '. $coefHardGeo.'
----------------------
'; + $coefEasyGeo = (100-$coefHardGeo); + $coefHardGeo = $coefHardGeo; + + $this ->mineralsProd = $this ->minerals = $this ->randomDescendent($difficulty_, $coefEasyGeo); + $this ->energyProd = $this ->energy = $this ->randomDescendent($difficulty_, $coefEasyGeo); + $this ->vegetableProd = $this ->vegetable = $this ->randomDescendent($difficulty_,$coefHardGeo); + $this ->waterProd = $this ->water = $this ->randomDescendent($difficulty_, $this ->lat); + $this ->animalsProd = $this ->animals = $this ->randomDescendent($difficulty_,$coefHardGeo); + +} + +public function initEconomy( $economy_ ){ + + $this -> microEconomy = new Economy($this, $this ->name.' MICRO' ); + $this -> microEconomy -> getPIB($this, $economy_); + //$this -> microEconomy->print(); + $this -> money = 100; +} + + +/** + * Init the politic (need a world setting for this) + */ +public function initPolitic(){ + + +} + +public function calcultatePopulation($world_){ + + $pop = $this ->population; + + if($pop > 0){ + + $needWater = $this ->water - $pop; + $needVegetable = $this ->vegetable - $pop; + $needAnimals = $this ->animals - $pop; + $needMinerals = $this ->minerals - $pop; + $needEnergy = $this ->minerals - $pop; + + $moneyNeeded = 0; + $moneyNeeded += $world_->macroEconomy->vegetablePrice * $needVegetable; + $moneyNeeded += $world_->macroEconomy->animalsPrice * $needAnimals; + $moneyNeeded += $world_->macroEconomy->waterPrice * $needWater; + + + $this ->money -= $moneyNeeded; + echo '--> '.$this ->name.' pop:'.$pop; + + if($this ->money < 0){ + $pop -= $this ->deathCoef; + echo '/ 💀Death: '.$this ->deathCoef; + } else if($this ->money >= 0){ + $pop += $this ->fertilyCoef; + echo '/ 🍼 New borns: '.$this ->fertilyCoef; + } + + $moneyNeeded += $world_->macroEconomy->mineralsPrice * $needMinerals; + $moneyNeeded += $world_->macroEconomy->energyPrice * $needEnergy; + + $this ->money -= $moneyNeeded; + + echo '/ Money: $'.$this ->money.'
'; + + $this ->population = $pop; + } + +} + + +function randomAscendent($val_, $coef_){ + $val = rand ( 1 , $val_ ) / 100; + return $val*$coef_; +} + +function randomDescendent($val_, $coef_){ + $val = (100 - rand ( 1 , $val_ )) / 100; + return $val*$coef_; +} + +public function print(){ + echo '*******************************
'; + echo ' Welcome Town '.$this ->name.'
'; + echo '*******************************
'; + echo 'lat: '.$this ->lat.'
'; + echo 'minerals: '.$this ->minerals.' ($'.$this->microEconomy->mineralsPrice.')
'; + echo 'energy: '.$this ->energy.' ($'.$this->microEconomy->energyPrice.')
'; + echo 'vegetable: '.$this ->vegetable.' ($'.$this->microEconomy->vegetablePrice.')
'; + echo 'water: '.$this ->water.' ($'.$this->microEconomy->waterPrice.')
'; + echo 'animals: '.$this ->animals.' ($'.$this->microEconomy->animalsPrice.')
'; + echo '------------------------------------------
'; + echo 'PIB of the town: $'. round($this ->microEconomy ->PIB).'k
'; + echo '
'; +} + +} \ No newline at end of file diff --git a/ready2use/srv/php/trash/Rogue/World.php b/ready2use/srv/php/trash/Rogue/World.php new file mode 100644 index 0000000..2654038 --- /dev/null +++ b/ready2use/srv/php/trash/Rogue/World.php @@ -0,0 +1,74 @@ +towns = array(); + } + + function addTown($name_, $difficulty_){ + + $city = new Town(); + $city->initGeo($name_, $difficulty_); + //$city->print(); + array_push( $this->towns, $city); + + } + + function initMacroEconomy(){ + + $mineralsWorld = 0; + $energyWorld = 0; + $vegetableWorld = 0; + $animalsWorld = 0; + $waterWorld = 0; + + foreach ($this->towns as $town){ + $mineralsWorld += $town->minerals; + $energyWorld += $town->energy; + $vegetableWorld += $town->vegetable; + $animalsWorld += $town->animals; + $waterWorld += $town->water; + } + + //Make the mean + $this->minerals = $mineralsWorld / sizeof( $this->towns); + $this->energy = $energyWorld / sizeof( $this->towns); + $this->vegetable = $vegetableWorld / sizeof( $this->towns); + $this->animals = $animalsWorld / sizeof( $this->towns); + $this->water = $waterWorld / sizeof( $this->towns); + + $this->macroEconomy = new Economy($this, 'World Global'); + $this->macroEconomy->print(); + + foreach ($this->towns as $town){ + $town-> initEconomy( $this->macroEconomy ); + $town-> print(); + } + } + + function cycling(){ + echo '-------------------------
'; + foreach ($this->towns as $town){ + $town->calcultatePopulation($this); + } + + } + + + +} \ No newline at end of file diff --git a/ready2use/srv/php/trash/RogueController.php b/ready2use/srv/php/trash/RogueController.php new file mode 100644 index 0000000..e72a546 --- /dev/null +++ b/ready2use/srv/php/trash/RogueController.php @@ -0,0 +1,33 @@ +addTown("🇺🇸Alpha City", 99 ); +$world->addTown("🇯🇵Neo Tokyo ネオ東京", 60 ); +$world->addTown("🇭🇰Honk Kong Empire", 30 ); +$world->addTown("🏴‍☠️Pirate Haven", 20 ); +$world->addTown("🇷🇺Pапс город", 5 ); + +$world->initMacroEconomy(); + +echo '

Cycling


'; + +for($i = 0; $i < 150; ++$i) { +$world->cycling(); +} + +/* +$jp = new Town("jp", 60 ); +$b = new Town("b", 30 ); +$gagged = new Town("gagged", 30 ); +$h = new Town("h", 10 ); +$op = new Town("op", 5 );*/ + + + +/* +Class RogueController { + + +}*/ \ No newline at end of file diff --git a/ready2use/styles.js b/ready2use/styles.js new file mode 100644 index 0000000..32bc654 --- /dev/null +++ b/ready2use/styles.js @@ -0,0 +1,590 @@ +(window["webpackJsonp"] = window["webpackJsonp"] || []).push([["styles"],{ + +/***/ "./node_modules/bootstrap/dist/css/bootstrap.min.css": +/*!***********************************************************!*\ + !*** ./node_modules/bootstrap/dist/css/bootstrap.min.css ***! + \***********************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + + +var content = __webpack_require__(/*! !../../../raw-loader!../../../postcss-loader/lib??embedded!./bootstrap.min.css */ "./node_modules/raw-loader/index.js!./node_modules/postcss-loader/lib/index.js?!./node_modules/bootstrap/dist/css/bootstrap.min.css"); + +if(typeof content === 'string') content = [[module.i, content, '']]; + +var transform; +var insertInto; + + + +var options = {"hmr":true} + +options.transform = transform +options.insertInto = undefined; + +var update = __webpack_require__(/*! ../../../style-loader/lib/addStyles.js */ "./node_modules/style-loader/lib/addStyles.js")(content, options); + +if(content.locals) module.exports = content.locals; + +if(false) {} + +/***/ }), + +/***/ "./node_modules/raw-loader/index.js!./node_modules/postcss-loader/lib/index.js?!./node_modules/bootstrap/dist/css/bootstrap.min.css": +/*!*********************************************************************************************************************************!*\ + !*** ./node_modules/raw-loader!./node_modules/postcss-loader/lib??embedded!./node_modules/bootstrap/dist/css/bootstrap.min.css ***! + \*********************************************************************************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +module.exports = "/*!\n * Bootstrap v4.3.1 (https://getbootstrap.com/)\n * Copyright 2011-2019 The Bootstrap Authors\n * Copyright 2011-2019 Twitter, Inc.\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)\n */:root{--blue:#007bff;--indigo:#6610f2;--purple:#6f42c1;--pink:#e83e8c;--red:#dc3545;--orange:#fd7e14;--yellow:#ffc107;--green:#28a745;--teal:#20c997;--cyan:#17a2b8;--white:#fff;--gray:#6c757d;--gray-dark:#343a40;--primary:#007bff;--secondary:#6c757d;--success:#28a745;--info:#17a2b8;--warning:#ffc107;--danger:#dc3545;--light:#f8f9fa;--dark:#343a40;--breakpoint-xs:0;--breakpoint-sm:576px;--breakpoint-md:768px;--breakpoint-lg:992px;--breakpoint-xl:1200px;--font-family-sans-serif:-apple-system,BlinkMacSystemFont,\"Segoe UI\",Roboto,\"Helvetica Neue\",Arial,\"Noto Sans\",sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\",\"Segoe UI Symbol\",\"Noto Color Emoji\";--font-family-monospace:SFMono-Regular,Menlo,Monaco,Consolas,\"Liberation Mono\",\"Courier New\",monospace}*,::after,::before{box-sizing:border-box}html{font-family:sans-serif;line-height:1.15;-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:transparent}article,aside,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}body{margin:0;font-family:-apple-system,BlinkMacSystemFont,\"Segoe UI\",Roboto,\"Helvetica Neue\",Arial,\"Noto Sans\",sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\",\"Segoe UI Symbol\",\"Noto Color Emoji\";font-size:1rem;font-weight:400;line-height:1.5;color:#212529;text-align:left;background-color:#fff}[tabindex=\"-1\"]:focus{outline:0!important}hr{box-sizing:content-box;height:0;overflow:visible}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:.5rem}p{margin-top:0;margin-bottom:1rem}abbr[data-original-title],abbr[title]{text-decoration:underline;-webkit-text-decoration:underline dotted;text-decoration:underline dotted;cursor:help;border-bottom:0;-webkit-text-decoration-skip-ink:none;text-decoration-skip-ink:none}address{margin-bottom:1rem;font-style:normal;line-height:inherit}dl,ol,ul{margin-top:0;margin-bottom:1rem}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}dt{font-weight:700}dd{margin-bottom:.5rem;margin-left:0}blockquote{margin:0 0 1rem}b,strong{font-weight:bolder}small{font-size:80%}sub,sup{position:relative;font-size:75%;line-height:0;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}a{color:#007bff;text-decoration:none;background-color:transparent}a:hover{color:#0056b3;text-decoration:underline}a:not([href]):not([tabindex]){color:inherit;text-decoration:none}a:not([href]):not([tabindex]):focus,a:not([href]):not([tabindex]):hover{color:inherit;text-decoration:none}a:not([href]):not([tabindex]):focus{outline:0}code,kbd,pre,samp{font-family:SFMono-Regular,Menlo,Monaco,Consolas,\"Liberation Mono\",\"Courier New\",monospace;font-size:1em}pre{margin-top:0;margin-bottom:1rem;overflow:auto}figure{margin:0 0 1rem}img{vertical-align:middle;border-style:none}svg{overflow:hidden;vertical-align:middle}table{border-collapse:collapse}caption{padding-top:.75rem;padding-bottom:.75rem;color:#6c757d;text-align:left;caption-side:bottom}th{text-align:inherit}label{display:inline-block;margin-bottom:.5rem}button{border-radius:0}button:focus{outline:1px dotted;outline:5px auto -webkit-focus-ring-color}button,input,optgroup,select,textarea{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}button,input{overflow:visible}button,select{text-transform:none}select{word-wrap:normal}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]:not(:disabled),[type=reset]:not(:disabled),[type=submit]:not(:disabled),button:not(:disabled){cursor:pointer}[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner,button::-moz-focus-inner{padding:0;border-style:none}input[type=checkbox],input[type=radio]{box-sizing:border-box;padding:0}input[type=date],input[type=datetime-local],input[type=month],input[type=time]{-webkit-appearance:listbox}textarea{overflow:auto;resize:vertical}fieldset{min-width:0;padding:0;margin:0;border:0}legend{display:block;width:100%;max-width:100%;padding:0;margin-bottom:.5rem;font-size:1.5rem;line-height:inherit;color:inherit;white-space:normal}progress{vertical-align:baseline}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}[type=search]{outline-offset:-2px;-webkit-appearance:none}[type=search]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}output{display:inline-block}summary{display:list-item;cursor:pointer}template{display:none}[hidden]{display:none!important}.h1,.h2,.h3,.h4,.h5,.h6,h1,h2,h3,h4,h5,h6{margin-bottom:.5rem;font-weight:500;line-height:1.2}.h1,h1{font-size:2.5rem}.h2,h2{font-size:2rem}.h3,h3{font-size:1.75rem}.h4,h4{font-size:1.5rem}.h5,h5{font-size:1.25rem}.h6,h6{font-size:1rem}.lead{font-size:1.25rem;font-weight:300}.display-1{font-size:6rem;font-weight:300;line-height:1.2}.display-2{font-size:5.5rem;font-weight:300;line-height:1.2}.display-3{font-size:4.5rem;font-weight:300;line-height:1.2}.display-4{font-size:3.5rem;font-weight:300;line-height:1.2}hr{margin-top:1rem;margin-bottom:1rem;border:0;border-top:1px solid rgba(0,0,0,.1)}.small,small{font-size:80%;font-weight:400}.mark,mark{padding:.2em;background-color:#fcf8e3}.list-unstyled{padding-left:0;list-style:none}.list-inline{padding-left:0;list-style:none}.list-inline-item{display:inline-block}.list-inline-item:not(:last-child){margin-right:.5rem}.initialism{font-size:90%;text-transform:uppercase}.blockquote{margin-bottom:1rem;font-size:1.25rem}.blockquote-footer{display:block;font-size:80%;color:#6c757d}.blockquote-footer::before{content:\"\\2014\\00A0\"}.img-fluid{max-width:100%;height:auto}.img-thumbnail{padding:.25rem;background-color:#fff;border:1px solid #dee2e6;border-radius:.25rem;max-width:100%;height:auto}.figure{display:inline-block}.figure-img{margin-bottom:.5rem;line-height:1}.figure-caption{font-size:90%;color:#6c757d}code{font-size:87.5%;color:#e83e8c;word-break:break-word}a>code{color:inherit}kbd{padding:.2rem .4rem;font-size:87.5%;color:#fff;background-color:#212529;border-radius:.2rem}kbd kbd{padding:0;font-size:100%;font-weight:700}pre{display:block;font-size:87.5%;color:#212529}pre code{font-size:inherit;color:inherit;word-break:normal}.pre-scrollable{max-height:340px;overflow-y:scroll}.container{width:100%;padding-right:15px;padding-left:15px;margin-right:auto;margin-left:auto}@media (min-width:576px){.container{max-width:540px}}@media (min-width:768px){.container{max-width:720px}}@media (min-width:992px){.container{max-width:960px}}@media (min-width:1200px){.container{max-width:1140px}}.container-fluid{width:100%;padding-right:15px;padding-left:15px;margin-right:auto;margin-left:auto}.row{display:flex;flex-wrap:wrap;margin-right:-15px;margin-left:-15px}.no-gutters{margin-right:0;margin-left:0}.no-gutters>.col,.no-gutters>[class*=col-]{padding-right:0;padding-left:0}.col,.col-1,.col-10,.col-11,.col-12,.col-2,.col-3,.col-4,.col-5,.col-6,.col-7,.col-8,.col-9,.col-auto,.col-lg,.col-lg-1,.col-lg-10,.col-lg-11,.col-lg-12,.col-lg-2,.col-lg-3,.col-lg-4,.col-lg-5,.col-lg-6,.col-lg-7,.col-lg-8,.col-lg-9,.col-lg-auto,.col-md,.col-md-1,.col-md-10,.col-md-11,.col-md-12,.col-md-2,.col-md-3,.col-md-4,.col-md-5,.col-md-6,.col-md-7,.col-md-8,.col-md-9,.col-md-auto,.col-sm,.col-sm-1,.col-sm-10,.col-sm-11,.col-sm-12,.col-sm-2,.col-sm-3,.col-sm-4,.col-sm-5,.col-sm-6,.col-sm-7,.col-sm-8,.col-sm-9,.col-sm-auto,.col-xl,.col-xl-1,.col-xl-10,.col-xl-11,.col-xl-12,.col-xl-2,.col-xl-3,.col-xl-4,.col-xl-5,.col-xl-6,.col-xl-7,.col-xl-8,.col-xl-9,.col-xl-auto{position:relative;width:100%;padding-right:15px;padding-left:15px}.col{flex-basis:0;flex-grow:1;max-width:100%}.col-auto{flex:0 0 auto;width:auto;max-width:100%}.col-1{flex:0 0 8.333333%;max-width:8.333333%}.col-2{flex:0 0 16.666667%;max-width:16.666667%}.col-3{flex:0 0 25%;max-width:25%}.col-4{flex:0 0 33.333333%;max-width:33.333333%}.col-5{flex:0 0 41.666667%;max-width:41.666667%}.col-6{flex:0 0 50%;max-width:50%}.col-7{flex:0 0 58.333333%;max-width:58.333333%}.col-8{flex:0 0 66.666667%;max-width:66.666667%}.col-9{flex:0 0 75%;max-width:75%}.col-10{flex:0 0 83.333333%;max-width:83.333333%}.col-11{flex:0 0 91.666667%;max-width:91.666667%}.col-12{flex:0 0 100%;max-width:100%}.order-first{order:-1}.order-last{order:13}.order-0{order:0}.order-1{order:1}.order-2{order:2}.order-3{order:3}.order-4{order:4}.order-5{order:5}.order-6{order:6}.order-7{order:7}.order-8{order:8}.order-9{order:9}.order-10{order:10}.order-11{order:11}.order-12{order:12}.offset-1{margin-left:8.333333%}.offset-2{margin-left:16.666667%}.offset-3{margin-left:25%}.offset-4{margin-left:33.333333%}.offset-5{margin-left:41.666667%}.offset-6{margin-left:50%}.offset-7{margin-left:58.333333%}.offset-8{margin-left:66.666667%}.offset-9{margin-left:75%}.offset-10{margin-left:83.333333%}.offset-11{margin-left:91.666667%}@media (min-width:576px){.col-sm{flex-basis:0;flex-grow:1;max-width:100%}.col-sm-auto{flex:0 0 auto;width:auto;max-width:100%}.col-sm-1{flex:0 0 8.333333%;max-width:8.333333%}.col-sm-2{flex:0 0 16.666667%;max-width:16.666667%}.col-sm-3{flex:0 0 25%;max-width:25%}.col-sm-4{flex:0 0 33.333333%;max-width:33.333333%}.col-sm-5{flex:0 0 41.666667%;max-width:41.666667%}.col-sm-6{flex:0 0 50%;max-width:50%}.col-sm-7{flex:0 0 58.333333%;max-width:58.333333%}.col-sm-8{flex:0 0 66.666667%;max-width:66.666667%}.col-sm-9{flex:0 0 75%;max-width:75%}.col-sm-10{flex:0 0 83.333333%;max-width:83.333333%}.col-sm-11{flex:0 0 91.666667%;max-width:91.666667%}.col-sm-12{flex:0 0 100%;max-width:100%}.order-sm-first{order:-1}.order-sm-last{order:13}.order-sm-0{order:0}.order-sm-1{order:1}.order-sm-2{order:2}.order-sm-3{order:3}.order-sm-4{order:4}.order-sm-5{order:5}.order-sm-6{order:6}.order-sm-7{order:7}.order-sm-8{order:8}.order-sm-9{order:9}.order-sm-10{order:10}.order-sm-11{order:11}.order-sm-12{order:12}.offset-sm-0{margin-left:0}.offset-sm-1{margin-left:8.333333%}.offset-sm-2{margin-left:16.666667%}.offset-sm-3{margin-left:25%}.offset-sm-4{margin-left:33.333333%}.offset-sm-5{margin-left:41.666667%}.offset-sm-6{margin-left:50%}.offset-sm-7{margin-left:58.333333%}.offset-sm-8{margin-left:66.666667%}.offset-sm-9{margin-left:75%}.offset-sm-10{margin-left:83.333333%}.offset-sm-11{margin-left:91.666667%}}@media (min-width:768px){.col-md{flex-basis:0;flex-grow:1;max-width:100%}.col-md-auto{flex:0 0 auto;width:auto;max-width:100%}.col-md-1{flex:0 0 8.333333%;max-width:8.333333%}.col-md-2{flex:0 0 16.666667%;max-width:16.666667%}.col-md-3{flex:0 0 25%;max-width:25%}.col-md-4{flex:0 0 33.333333%;max-width:33.333333%}.col-md-5{flex:0 0 41.666667%;max-width:41.666667%}.col-md-6{flex:0 0 50%;max-width:50%}.col-md-7{flex:0 0 58.333333%;max-width:58.333333%}.col-md-8{flex:0 0 66.666667%;max-width:66.666667%}.col-md-9{flex:0 0 75%;max-width:75%}.col-md-10{flex:0 0 83.333333%;max-width:83.333333%}.col-md-11{flex:0 0 91.666667%;max-width:91.666667%}.col-md-12{flex:0 0 100%;max-width:100%}.order-md-first{order:-1}.order-md-last{order:13}.order-md-0{order:0}.order-md-1{order:1}.order-md-2{order:2}.order-md-3{order:3}.order-md-4{order:4}.order-md-5{order:5}.order-md-6{order:6}.order-md-7{order:7}.order-md-8{order:8}.order-md-9{order:9}.order-md-10{order:10}.order-md-11{order:11}.order-md-12{order:12}.offset-md-0{margin-left:0}.offset-md-1{margin-left:8.333333%}.offset-md-2{margin-left:16.666667%}.offset-md-3{margin-left:25%}.offset-md-4{margin-left:33.333333%}.offset-md-5{margin-left:41.666667%}.offset-md-6{margin-left:50%}.offset-md-7{margin-left:58.333333%}.offset-md-8{margin-left:66.666667%}.offset-md-9{margin-left:75%}.offset-md-10{margin-left:83.333333%}.offset-md-11{margin-left:91.666667%}}@media (min-width:992px){.col-lg{flex-basis:0;flex-grow:1;max-width:100%}.col-lg-auto{flex:0 0 auto;width:auto;max-width:100%}.col-lg-1{flex:0 0 8.333333%;max-width:8.333333%}.col-lg-2{flex:0 0 16.666667%;max-width:16.666667%}.col-lg-3{flex:0 0 25%;max-width:25%}.col-lg-4{flex:0 0 33.333333%;max-width:33.333333%}.col-lg-5{flex:0 0 41.666667%;max-width:41.666667%}.col-lg-6{flex:0 0 50%;max-width:50%}.col-lg-7{flex:0 0 58.333333%;max-width:58.333333%}.col-lg-8{flex:0 0 66.666667%;max-width:66.666667%}.col-lg-9{flex:0 0 75%;max-width:75%}.col-lg-10{flex:0 0 83.333333%;max-width:83.333333%}.col-lg-11{flex:0 0 91.666667%;max-width:91.666667%}.col-lg-12{flex:0 0 100%;max-width:100%}.order-lg-first{order:-1}.order-lg-last{order:13}.order-lg-0{order:0}.order-lg-1{order:1}.order-lg-2{order:2}.order-lg-3{order:3}.order-lg-4{order:4}.order-lg-5{order:5}.order-lg-6{order:6}.order-lg-7{order:7}.order-lg-8{order:8}.order-lg-9{order:9}.order-lg-10{order:10}.order-lg-11{order:11}.order-lg-12{order:12}.offset-lg-0{margin-left:0}.offset-lg-1{margin-left:8.333333%}.offset-lg-2{margin-left:16.666667%}.offset-lg-3{margin-left:25%}.offset-lg-4{margin-left:33.333333%}.offset-lg-5{margin-left:41.666667%}.offset-lg-6{margin-left:50%}.offset-lg-7{margin-left:58.333333%}.offset-lg-8{margin-left:66.666667%}.offset-lg-9{margin-left:75%}.offset-lg-10{margin-left:83.333333%}.offset-lg-11{margin-left:91.666667%}}@media (min-width:1200px){.col-xl{flex-basis:0;flex-grow:1;max-width:100%}.col-xl-auto{flex:0 0 auto;width:auto;max-width:100%}.col-xl-1{flex:0 0 8.333333%;max-width:8.333333%}.col-xl-2{flex:0 0 16.666667%;max-width:16.666667%}.col-xl-3{flex:0 0 25%;max-width:25%}.col-xl-4{flex:0 0 33.333333%;max-width:33.333333%}.col-xl-5{flex:0 0 41.666667%;max-width:41.666667%}.col-xl-6{flex:0 0 50%;max-width:50%}.col-xl-7{flex:0 0 58.333333%;max-width:58.333333%}.col-xl-8{flex:0 0 66.666667%;max-width:66.666667%}.col-xl-9{flex:0 0 75%;max-width:75%}.col-xl-10{flex:0 0 83.333333%;max-width:83.333333%}.col-xl-11{flex:0 0 91.666667%;max-width:91.666667%}.col-xl-12{flex:0 0 100%;max-width:100%}.order-xl-first{order:-1}.order-xl-last{order:13}.order-xl-0{order:0}.order-xl-1{order:1}.order-xl-2{order:2}.order-xl-3{order:3}.order-xl-4{order:4}.order-xl-5{order:5}.order-xl-6{order:6}.order-xl-7{order:7}.order-xl-8{order:8}.order-xl-9{order:9}.order-xl-10{order:10}.order-xl-11{order:11}.order-xl-12{order:12}.offset-xl-0{margin-left:0}.offset-xl-1{margin-left:8.333333%}.offset-xl-2{margin-left:16.666667%}.offset-xl-3{margin-left:25%}.offset-xl-4{margin-left:33.333333%}.offset-xl-5{margin-left:41.666667%}.offset-xl-6{margin-left:50%}.offset-xl-7{margin-left:58.333333%}.offset-xl-8{margin-left:66.666667%}.offset-xl-9{margin-left:75%}.offset-xl-10{margin-left:83.333333%}.offset-xl-11{margin-left:91.666667%}}.table{width:100%;margin-bottom:1rem;color:#212529}.table td,.table th{padding:.75rem;vertical-align:top;border-top:1px solid #dee2e6}.table thead th{vertical-align:bottom;border-bottom:2px solid #dee2e6}.table tbody+tbody{border-top:2px solid #dee2e6}.table-sm td,.table-sm th{padding:.3rem}.table-bordered{border:1px solid #dee2e6}.table-bordered td,.table-bordered th{border:1px solid #dee2e6}.table-bordered thead td,.table-bordered thead th{border-bottom-width:2px}.table-borderless tbody+tbody,.table-borderless td,.table-borderless th,.table-borderless thead th{border:0}.table-striped tbody tr:nth-of-type(odd){background-color:rgba(0,0,0,.05)}.table-hover tbody tr:hover{color:#212529;background-color:rgba(0,0,0,.075)}.table-primary,.table-primary>td,.table-primary>th{background-color:#b8daff}.table-primary tbody+tbody,.table-primary td,.table-primary th,.table-primary thead th{border-color:#7abaff}.table-hover .table-primary:hover{background-color:#9fcdff}.table-hover .table-primary:hover>td,.table-hover .table-primary:hover>th{background-color:#9fcdff}.table-secondary,.table-secondary>td,.table-secondary>th{background-color:#d6d8db}.table-secondary tbody+tbody,.table-secondary td,.table-secondary th,.table-secondary thead th{border-color:#b3b7bb}.table-hover .table-secondary:hover{background-color:#c8cbcf}.table-hover .table-secondary:hover>td,.table-hover .table-secondary:hover>th{background-color:#c8cbcf}.table-success,.table-success>td,.table-success>th{background-color:#c3e6cb}.table-success tbody+tbody,.table-success td,.table-success th,.table-success thead th{border-color:#8fd19e}.table-hover .table-success:hover{background-color:#b1dfbb}.table-hover .table-success:hover>td,.table-hover .table-success:hover>th{background-color:#b1dfbb}.table-info,.table-info>td,.table-info>th{background-color:#bee5eb}.table-info tbody+tbody,.table-info td,.table-info th,.table-info thead th{border-color:#86cfda}.table-hover .table-info:hover{background-color:#abdde5}.table-hover .table-info:hover>td,.table-hover .table-info:hover>th{background-color:#abdde5}.table-warning,.table-warning>td,.table-warning>th{background-color:#ffeeba}.table-warning tbody+tbody,.table-warning td,.table-warning th,.table-warning thead th{border-color:#ffdf7e}.table-hover .table-warning:hover{background-color:#ffe8a1}.table-hover .table-warning:hover>td,.table-hover .table-warning:hover>th{background-color:#ffe8a1}.table-danger,.table-danger>td,.table-danger>th{background-color:#f5c6cb}.table-danger tbody+tbody,.table-danger td,.table-danger th,.table-danger thead th{border-color:#ed969e}.table-hover .table-danger:hover{background-color:#f1b0b7}.table-hover .table-danger:hover>td,.table-hover .table-danger:hover>th{background-color:#f1b0b7}.table-light,.table-light>td,.table-light>th{background-color:#fdfdfe}.table-light tbody+tbody,.table-light td,.table-light th,.table-light thead th{border-color:#fbfcfc}.table-hover .table-light:hover{background-color:#ececf6}.table-hover .table-light:hover>td,.table-hover .table-light:hover>th{background-color:#ececf6}.table-dark,.table-dark>td,.table-dark>th{background-color:#c6c8ca}.table-dark tbody+tbody,.table-dark td,.table-dark th,.table-dark thead th{border-color:#95999c}.table-hover .table-dark:hover{background-color:#b9bbbe}.table-hover .table-dark:hover>td,.table-hover .table-dark:hover>th{background-color:#b9bbbe}.table-active,.table-active>td,.table-active>th{background-color:rgba(0,0,0,.075)}.table-hover .table-active:hover{background-color:rgba(0,0,0,.075)}.table-hover .table-active:hover>td,.table-hover .table-active:hover>th{background-color:rgba(0,0,0,.075)}.table .thead-dark th{color:#fff;background-color:#343a40;border-color:#454d55}.table .thead-light th{color:#495057;background-color:#e9ecef;border-color:#dee2e6}.table-dark{color:#fff;background-color:#343a40}.table-dark td,.table-dark th,.table-dark thead th{border-color:#454d55}.table-dark.table-bordered{border:0}.table-dark.table-striped tbody tr:nth-of-type(odd){background-color:rgba(255,255,255,.05)}.table-dark.table-hover tbody tr:hover{color:#fff;background-color:rgba(255,255,255,.075)}@media (max-width:575.98px){.table-responsive-sm{display:block;width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch}.table-responsive-sm>.table-bordered{border:0}}@media (max-width:767.98px){.table-responsive-md{display:block;width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch}.table-responsive-md>.table-bordered{border:0}}@media (max-width:991.98px){.table-responsive-lg{display:block;width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch}.table-responsive-lg>.table-bordered{border:0}}@media (max-width:1199.98px){.table-responsive-xl{display:block;width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch}.table-responsive-xl>.table-bordered{border:0}}.table-responsive{display:block;width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch}.table-responsive>.table-bordered{border:0}.form-control{display:block;width:100%;height:calc(1.5em + .75rem + 2px);padding:.375rem .75rem;font-size:1rem;font-weight:400;line-height:1.5;color:#495057;background-color:#fff;background-clip:padding-box;border:1px solid #ced4da;border-radius:.25rem;transition:border-color .15s ease-in-out,box-shadow .15s ease-in-out}@media (prefers-reduced-motion:reduce){.form-control{transition:none}}.form-control::-ms-expand{background-color:transparent;border:0}.form-control:focus{color:#495057;background-color:#fff;border-color:#80bdff;outline:0;box-shadow:0 0 0 .2rem rgba(0,123,255,.25)}.form-control::-webkit-input-placeholder{color:#6c757d;opacity:1}.form-control:-ms-input-placeholder{color:#6c757d;opacity:1}.form-control::-ms-input-placeholder{color:#6c757d;opacity:1}.form-control::placeholder{color:#6c757d;opacity:1}.form-control:disabled,.form-control[readonly]{background-color:#e9ecef;opacity:1}select.form-control:focus::-ms-value{color:#495057;background-color:#fff}.form-control-file,.form-control-range{display:block;width:100%}.col-form-label{padding-top:calc(.375rem + 1px);padding-bottom:calc(.375rem + 1px);margin-bottom:0;font-size:inherit;line-height:1.5}.col-form-label-lg{padding-top:calc(.5rem + 1px);padding-bottom:calc(.5rem + 1px);font-size:1.25rem;line-height:1.5}.col-form-label-sm{padding-top:calc(.25rem + 1px);padding-bottom:calc(.25rem + 1px);font-size:.875rem;line-height:1.5}.form-control-plaintext{display:block;width:100%;padding-top:.375rem;padding-bottom:.375rem;margin-bottom:0;line-height:1.5;color:#212529;background-color:transparent;border:solid transparent;border-width:1px 0}.form-control-plaintext.form-control-lg,.form-control-plaintext.form-control-sm{padding-right:0;padding-left:0}.form-control-sm{height:calc(1.5em + .5rem + 2px);padding:.25rem .5rem;font-size:.875rem;line-height:1.5;border-radius:.2rem}.form-control-lg{height:calc(1.5em + 1rem + 2px);padding:.5rem 1rem;font-size:1.25rem;line-height:1.5;border-radius:.3rem}select.form-control[multiple],select.form-control[size]{height:auto}textarea.form-control{height:auto}.form-group{margin-bottom:1rem}.form-text{display:block;margin-top:.25rem}.form-row{display:flex;flex-wrap:wrap;margin-right:-5px;margin-left:-5px}.form-row>.col,.form-row>[class*=col-]{padding-right:5px;padding-left:5px}.form-check{position:relative;display:block;padding-left:1.25rem}.form-check-input{position:absolute;margin-top:.3rem;margin-left:-1.25rem}.form-check-input:disabled~.form-check-label{color:#6c757d}.form-check-label{margin-bottom:0}.form-check-inline{display:inline-flex;align-items:center;padding-left:0;margin-right:.75rem}.form-check-inline .form-check-input{position:static;margin-top:0;margin-right:.3125rem;margin-left:0}.valid-feedback{display:none;width:100%;margin-top:.25rem;font-size:80%;color:#28a745}.valid-tooltip{position:absolute;top:100%;z-index:5;display:none;max-width:100%;padding:.25rem .5rem;margin-top:.1rem;font-size:.875rem;line-height:1.5;color:#fff;background-color:rgba(40,167,69,.9);border-radius:.25rem}.form-control.is-valid,.was-validated .form-control:valid{border-color:#28a745;padding-right:calc(1.5em + .75rem);background-image:url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3e%3cpath fill='%2328a745' d='M2.3 6.73L.6 4.53c-.4-1.04.46-1.4 1.1-.8l1.1 1.4 3.4-3.8c.6-.63 1.6-.27 1.2.7l-4 4.6c-.43.5-.8.4-1.1.1z'/%3e%3c/svg%3e\");background-repeat:no-repeat;background-position:center right calc(.375em + .1875rem);background-size:calc(.75em + .375rem) calc(.75em + .375rem)}.form-control.is-valid:focus,.was-validated .form-control:valid:focus{border-color:#28a745;box-shadow:0 0 0 .2rem rgba(40,167,69,.25)}.form-control.is-valid~.valid-feedback,.form-control.is-valid~.valid-tooltip,.was-validated .form-control:valid~.valid-feedback,.was-validated .form-control:valid~.valid-tooltip{display:block}.was-validated textarea.form-control:valid,textarea.form-control.is-valid{padding-right:calc(1.5em + .75rem);background-position:top calc(.375em + .1875rem) right calc(.375em + .1875rem)}.custom-select.is-valid,.was-validated .custom-select:valid{border-color:#28a745;padding-right:calc((1em + .75rem) * 3 / 4 + 1.75rem);background:url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 4 5'%3e%3cpath fill='%23343a40' d='M2 0L0 2h4zm0 5L0 3h4z'/%3e%3c/svg%3e\") no-repeat right .75rem center/8px 10px,url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3e%3cpath fill='%2328a745' d='M2.3 6.73L.6 4.53c-.4-1.04.46-1.4 1.1-.8l1.1 1.4 3.4-3.8c.6-.63 1.6-.27 1.2.7l-4 4.6c-.43.5-.8.4-1.1.1z'/%3e%3c/svg%3e\") #fff no-repeat center right 1.75rem/calc(.75em + .375rem) calc(.75em + .375rem)}.custom-select.is-valid:focus,.was-validated .custom-select:valid:focus{border-color:#28a745;box-shadow:0 0 0 .2rem rgba(40,167,69,.25)}.custom-select.is-valid~.valid-feedback,.custom-select.is-valid~.valid-tooltip,.was-validated .custom-select:valid~.valid-feedback,.was-validated .custom-select:valid~.valid-tooltip{display:block}.form-control-file.is-valid~.valid-feedback,.form-control-file.is-valid~.valid-tooltip,.was-validated .form-control-file:valid~.valid-feedback,.was-validated .form-control-file:valid~.valid-tooltip{display:block}.form-check-input.is-valid~.form-check-label,.was-validated .form-check-input:valid~.form-check-label{color:#28a745}.form-check-input.is-valid~.valid-feedback,.form-check-input.is-valid~.valid-tooltip,.was-validated .form-check-input:valid~.valid-feedback,.was-validated .form-check-input:valid~.valid-tooltip{display:block}.custom-control-input.is-valid~.custom-control-label,.was-validated .custom-control-input:valid~.custom-control-label{color:#28a745}.custom-control-input.is-valid~.custom-control-label::before,.was-validated .custom-control-input:valid~.custom-control-label::before{border-color:#28a745}.custom-control-input.is-valid~.valid-feedback,.custom-control-input.is-valid~.valid-tooltip,.was-validated .custom-control-input:valid~.valid-feedback,.was-validated .custom-control-input:valid~.valid-tooltip{display:block}.custom-control-input.is-valid:checked~.custom-control-label::before,.was-validated .custom-control-input:valid:checked~.custom-control-label::before{border-color:#34ce57;background-color:#34ce57}.custom-control-input.is-valid:focus~.custom-control-label::before,.was-validated .custom-control-input:valid:focus~.custom-control-label::before{box-shadow:0 0 0 .2rem rgba(40,167,69,.25)}.custom-control-input.is-valid:focus:not(:checked)~.custom-control-label::before,.was-validated .custom-control-input:valid:focus:not(:checked)~.custom-control-label::before{border-color:#28a745}.custom-file-input.is-valid~.custom-file-label,.was-validated .custom-file-input:valid~.custom-file-label{border-color:#28a745}.custom-file-input.is-valid~.valid-feedback,.custom-file-input.is-valid~.valid-tooltip,.was-validated .custom-file-input:valid~.valid-feedback,.was-validated .custom-file-input:valid~.valid-tooltip{display:block}.custom-file-input.is-valid:focus~.custom-file-label,.was-validated .custom-file-input:valid:focus~.custom-file-label{border-color:#28a745;box-shadow:0 0 0 .2rem rgba(40,167,69,.25)}.invalid-feedback{display:none;width:100%;margin-top:.25rem;font-size:80%;color:#dc3545}.invalid-tooltip{position:absolute;top:100%;z-index:5;display:none;max-width:100%;padding:.25rem .5rem;margin-top:.1rem;font-size:.875rem;line-height:1.5;color:#fff;background-color:rgba(220,53,69,.9);border-radius:.25rem}.form-control.is-invalid,.was-validated .form-control:invalid{border-color:#dc3545;padding-right:calc(1.5em + .75rem);background-image:url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='%23dc3545' viewBox='-2 -2 7 7'%3e%3cpath stroke='%23dc3545' d='M0 0l3 3m0-3L0 3'/%3e%3ccircle r='.5'/%3e%3ccircle cx='3' r='.5'/%3e%3ccircle cy='3' r='.5'/%3e%3ccircle cx='3' cy='3' r='.5'/%3e%3c/svg%3E\");background-repeat:no-repeat;background-position:center right calc(.375em + .1875rem);background-size:calc(.75em + .375rem) calc(.75em + .375rem)}.form-control.is-invalid:focus,.was-validated .form-control:invalid:focus{border-color:#dc3545;box-shadow:0 0 0 .2rem rgba(220,53,69,.25)}.form-control.is-invalid~.invalid-feedback,.form-control.is-invalid~.invalid-tooltip,.was-validated .form-control:invalid~.invalid-feedback,.was-validated .form-control:invalid~.invalid-tooltip{display:block}.was-validated textarea.form-control:invalid,textarea.form-control.is-invalid{padding-right:calc(1.5em + .75rem);background-position:top calc(.375em + .1875rem) right calc(.375em + .1875rem)}.custom-select.is-invalid,.was-validated .custom-select:invalid{border-color:#dc3545;padding-right:calc((1em + .75rem) * 3 / 4 + 1.75rem);background:url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 4 5'%3e%3cpath fill='%23343a40' d='M2 0L0 2h4zm0 5L0 3h4z'/%3e%3c/svg%3e\") no-repeat right .75rem center/8px 10px,url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='%23dc3545' viewBox='-2 -2 7 7'%3e%3cpath stroke='%23dc3545' d='M0 0l3 3m0-3L0 3'/%3e%3ccircle r='.5'/%3e%3ccircle cx='3' r='.5'/%3e%3ccircle cy='3' r='.5'/%3e%3ccircle cx='3' cy='3' r='.5'/%3e%3c/svg%3E\") #fff no-repeat center right 1.75rem/calc(.75em + .375rem) calc(.75em + .375rem)}.custom-select.is-invalid:focus,.was-validated .custom-select:invalid:focus{border-color:#dc3545;box-shadow:0 0 0 .2rem rgba(220,53,69,.25)}.custom-select.is-invalid~.invalid-feedback,.custom-select.is-invalid~.invalid-tooltip,.was-validated .custom-select:invalid~.invalid-feedback,.was-validated .custom-select:invalid~.invalid-tooltip{display:block}.form-control-file.is-invalid~.invalid-feedback,.form-control-file.is-invalid~.invalid-tooltip,.was-validated .form-control-file:invalid~.invalid-feedback,.was-validated .form-control-file:invalid~.invalid-tooltip{display:block}.form-check-input.is-invalid~.form-check-label,.was-validated .form-check-input:invalid~.form-check-label{color:#dc3545}.form-check-input.is-invalid~.invalid-feedback,.form-check-input.is-invalid~.invalid-tooltip,.was-validated .form-check-input:invalid~.invalid-feedback,.was-validated .form-check-input:invalid~.invalid-tooltip{display:block}.custom-control-input.is-invalid~.custom-control-label,.was-validated .custom-control-input:invalid~.custom-control-label{color:#dc3545}.custom-control-input.is-invalid~.custom-control-label::before,.was-validated .custom-control-input:invalid~.custom-control-label::before{border-color:#dc3545}.custom-control-input.is-invalid~.invalid-feedback,.custom-control-input.is-invalid~.invalid-tooltip,.was-validated .custom-control-input:invalid~.invalid-feedback,.was-validated .custom-control-input:invalid~.invalid-tooltip{display:block}.custom-control-input.is-invalid:checked~.custom-control-label::before,.was-validated .custom-control-input:invalid:checked~.custom-control-label::before{border-color:#e4606d;background-color:#e4606d}.custom-control-input.is-invalid:focus~.custom-control-label::before,.was-validated .custom-control-input:invalid:focus~.custom-control-label::before{box-shadow:0 0 0 .2rem rgba(220,53,69,.25)}.custom-control-input.is-invalid:focus:not(:checked)~.custom-control-label::before,.was-validated .custom-control-input:invalid:focus:not(:checked)~.custom-control-label::before{border-color:#dc3545}.custom-file-input.is-invalid~.custom-file-label,.was-validated .custom-file-input:invalid~.custom-file-label{border-color:#dc3545}.custom-file-input.is-invalid~.invalid-feedback,.custom-file-input.is-invalid~.invalid-tooltip,.was-validated .custom-file-input:invalid~.invalid-feedback,.was-validated .custom-file-input:invalid~.invalid-tooltip{display:block}.custom-file-input.is-invalid:focus~.custom-file-label,.was-validated .custom-file-input:invalid:focus~.custom-file-label{border-color:#dc3545;box-shadow:0 0 0 .2rem rgba(220,53,69,.25)}.form-inline{display:flex;flex-flow:row wrap;align-items:center}.form-inline .form-check{width:100%}@media (min-width:576px){.form-inline label{display:flex;align-items:center;justify-content:center;margin-bottom:0}.form-inline .form-group{display:flex;flex:0 0 auto;flex-flow:row wrap;align-items:center;margin-bottom:0}.form-inline .form-control{display:inline-block;width:auto;vertical-align:middle}.form-inline .form-control-plaintext{display:inline-block}.form-inline .custom-select,.form-inline .input-group{width:auto}.form-inline .form-check{display:flex;align-items:center;justify-content:center;width:auto;padding-left:0}.form-inline .form-check-input{position:relative;flex-shrink:0;margin-top:0;margin-right:.25rem;margin-left:0}.form-inline .custom-control{align-items:center;justify-content:center}.form-inline .custom-control-label{margin-bottom:0}}.btn{display:inline-block;font-weight:400;color:#212529;text-align:center;vertical-align:middle;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;background-color:transparent;border:1px solid transparent;padding:.375rem .75rem;font-size:1rem;line-height:1.5;border-radius:.25rem;transition:color .15s ease-in-out,background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out}@media (prefers-reduced-motion:reduce){.btn{transition:none}}.btn:hover{color:#212529;text-decoration:none}.btn.focus,.btn:focus{outline:0;box-shadow:0 0 0 .2rem rgba(0,123,255,.25)}.btn.disabled,.btn:disabled{opacity:.65}a.btn.disabled,fieldset:disabled a.btn{pointer-events:none}.btn-primary{color:#fff;background-color:#007bff;border-color:#007bff}.btn-primary:hover{color:#fff;background-color:#0069d9;border-color:#0062cc}.btn-primary.focus,.btn-primary:focus{box-shadow:0 0 0 .2rem rgba(38,143,255,.5)}.btn-primary.disabled,.btn-primary:disabled{color:#fff;background-color:#007bff;border-color:#007bff}.btn-primary:not(:disabled):not(.disabled).active,.btn-primary:not(:disabled):not(.disabled):active,.show>.btn-primary.dropdown-toggle{color:#fff;background-color:#0062cc;border-color:#005cbf}.btn-primary:not(:disabled):not(.disabled).active:focus,.btn-primary:not(:disabled):not(.disabled):active:focus,.show>.btn-primary.dropdown-toggle:focus{box-shadow:0 0 0 .2rem rgba(38,143,255,.5)}.btn-secondary{color:#fff;background-color:#6c757d;border-color:#6c757d}.btn-secondary:hover{color:#fff;background-color:#5a6268;border-color:#545b62}.btn-secondary.focus,.btn-secondary:focus{box-shadow:0 0 0 .2rem rgba(130,138,145,.5)}.btn-secondary.disabled,.btn-secondary:disabled{color:#fff;background-color:#6c757d;border-color:#6c757d}.btn-secondary:not(:disabled):not(.disabled).active,.btn-secondary:not(:disabled):not(.disabled):active,.show>.btn-secondary.dropdown-toggle{color:#fff;background-color:#545b62;border-color:#4e555b}.btn-secondary:not(:disabled):not(.disabled).active:focus,.btn-secondary:not(:disabled):not(.disabled):active:focus,.show>.btn-secondary.dropdown-toggle:focus{box-shadow:0 0 0 .2rem rgba(130,138,145,.5)}.btn-success{color:#fff;background-color:#28a745;border-color:#28a745}.btn-success:hover{color:#fff;background-color:#218838;border-color:#1e7e34}.btn-success.focus,.btn-success:focus{box-shadow:0 0 0 .2rem rgba(72,180,97,.5)}.btn-success.disabled,.btn-success:disabled{color:#fff;background-color:#28a745;border-color:#28a745}.btn-success:not(:disabled):not(.disabled).active,.btn-success:not(:disabled):not(.disabled):active,.show>.btn-success.dropdown-toggle{color:#fff;background-color:#1e7e34;border-color:#1c7430}.btn-success:not(:disabled):not(.disabled).active:focus,.btn-success:not(:disabled):not(.disabled):active:focus,.show>.btn-success.dropdown-toggle:focus{box-shadow:0 0 0 .2rem rgba(72,180,97,.5)}.btn-info{color:#fff;background-color:#17a2b8;border-color:#17a2b8}.btn-info:hover{color:#fff;background-color:#138496;border-color:#117a8b}.btn-info.focus,.btn-info:focus{box-shadow:0 0 0 .2rem rgba(58,176,195,.5)}.btn-info.disabled,.btn-info:disabled{color:#fff;background-color:#17a2b8;border-color:#17a2b8}.btn-info:not(:disabled):not(.disabled).active,.btn-info:not(:disabled):not(.disabled):active,.show>.btn-info.dropdown-toggle{color:#fff;background-color:#117a8b;border-color:#10707f}.btn-info:not(:disabled):not(.disabled).active:focus,.btn-info:not(:disabled):not(.disabled):active:focus,.show>.btn-info.dropdown-toggle:focus{box-shadow:0 0 0 .2rem rgba(58,176,195,.5)}.btn-warning{color:#212529;background-color:#ffc107;border-color:#ffc107}.btn-warning:hover{color:#212529;background-color:#e0a800;border-color:#d39e00}.btn-warning.focus,.btn-warning:focus{box-shadow:0 0 0 .2rem rgba(222,170,12,.5)}.btn-warning.disabled,.btn-warning:disabled{color:#212529;background-color:#ffc107;border-color:#ffc107}.btn-warning:not(:disabled):not(.disabled).active,.btn-warning:not(:disabled):not(.disabled):active,.show>.btn-warning.dropdown-toggle{color:#212529;background-color:#d39e00;border-color:#c69500}.btn-warning:not(:disabled):not(.disabled).active:focus,.btn-warning:not(:disabled):not(.disabled):active:focus,.show>.btn-warning.dropdown-toggle:focus{box-shadow:0 0 0 .2rem rgba(222,170,12,.5)}.btn-danger{color:#fff;background-color:#dc3545;border-color:#dc3545}.btn-danger:hover{color:#fff;background-color:#c82333;border-color:#bd2130}.btn-danger.focus,.btn-danger:focus{box-shadow:0 0 0 .2rem rgba(225,83,97,.5)}.btn-danger.disabled,.btn-danger:disabled{color:#fff;background-color:#dc3545;border-color:#dc3545}.btn-danger:not(:disabled):not(.disabled).active,.btn-danger:not(:disabled):not(.disabled):active,.show>.btn-danger.dropdown-toggle{color:#fff;background-color:#bd2130;border-color:#b21f2d}.btn-danger:not(:disabled):not(.disabled).active:focus,.btn-danger:not(:disabled):not(.disabled):active:focus,.show>.btn-danger.dropdown-toggle:focus{box-shadow:0 0 0 .2rem rgba(225,83,97,.5)}.btn-light{color:#212529;background-color:#f8f9fa;border-color:#f8f9fa}.btn-light:hover{color:#212529;background-color:#e2e6ea;border-color:#dae0e5}.btn-light.focus,.btn-light:focus{box-shadow:0 0 0 .2rem rgba(216,217,219,.5)}.btn-light.disabled,.btn-light:disabled{color:#212529;background-color:#f8f9fa;border-color:#f8f9fa}.btn-light:not(:disabled):not(.disabled).active,.btn-light:not(:disabled):not(.disabled):active,.show>.btn-light.dropdown-toggle{color:#212529;background-color:#dae0e5;border-color:#d3d9df}.btn-light:not(:disabled):not(.disabled).active:focus,.btn-light:not(:disabled):not(.disabled):active:focus,.show>.btn-light.dropdown-toggle:focus{box-shadow:0 0 0 .2rem rgba(216,217,219,.5)}.btn-dark{color:#fff;background-color:#343a40;border-color:#343a40}.btn-dark:hover{color:#fff;background-color:#23272b;border-color:#1d2124}.btn-dark.focus,.btn-dark:focus{box-shadow:0 0 0 .2rem rgba(82,88,93,.5)}.btn-dark.disabled,.btn-dark:disabled{color:#fff;background-color:#343a40;border-color:#343a40}.btn-dark:not(:disabled):not(.disabled).active,.btn-dark:not(:disabled):not(.disabled):active,.show>.btn-dark.dropdown-toggle{color:#fff;background-color:#1d2124;border-color:#171a1d}.btn-dark:not(:disabled):not(.disabled).active:focus,.btn-dark:not(:disabled):not(.disabled):active:focus,.show>.btn-dark.dropdown-toggle:focus{box-shadow:0 0 0 .2rem rgba(82,88,93,.5)}.btn-outline-primary{color:#007bff;border-color:#007bff}.btn-outline-primary:hover{color:#fff;background-color:#007bff;border-color:#007bff}.btn-outline-primary.focus,.btn-outline-primary:focus{box-shadow:0 0 0 .2rem rgba(0,123,255,.5)}.btn-outline-primary.disabled,.btn-outline-primary:disabled{color:#007bff;background-color:transparent}.btn-outline-primary:not(:disabled):not(.disabled).active,.btn-outline-primary:not(:disabled):not(.disabled):active,.show>.btn-outline-primary.dropdown-toggle{color:#fff;background-color:#007bff;border-color:#007bff}.btn-outline-primary:not(:disabled):not(.disabled).active:focus,.btn-outline-primary:not(:disabled):not(.disabled):active:focus,.show>.btn-outline-primary.dropdown-toggle:focus{box-shadow:0 0 0 .2rem rgba(0,123,255,.5)}.btn-outline-secondary{color:#6c757d;border-color:#6c757d}.btn-outline-secondary:hover{color:#fff;background-color:#6c757d;border-color:#6c757d}.btn-outline-secondary.focus,.btn-outline-secondary:focus{box-shadow:0 0 0 .2rem rgba(108,117,125,.5)}.btn-outline-secondary.disabled,.btn-outline-secondary:disabled{color:#6c757d;background-color:transparent}.btn-outline-secondary:not(:disabled):not(.disabled).active,.btn-outline-secondary:not(:disabled):not(.disabled):active,.show>.btn-outline-secondary.dropdown-toggle{color:#fff;background-color:#6c757d;border-color:#6c757d}.btn-outline-secondary:not(:disabled):not(.disabled).active:focus,.btn-outline-secondary:not(:disabled):not(.disabled):active:focus,.show>.btn-outline-secondary.dropdown-toggle:focus{box-shadow:0 0 0 .2rem rgba(108,117,125,.5)}.btn-outline-success{color:#28a745;border-color:#28a745}.btn-outline-success:hover{color:#fff;background-color:#28a745;border-color:#28a745}.btn-outline-success.focus,.btn-outline-success:focus{box-shadow:0 0 0 .2rem rgba(40,167,69,.5)}.btn-outline-success.disabled,.btn-outline-success:disabled{color:#28a745;background-color:transparent}.btn-outline-success:not(:disabled):not(.disabled).active,.btn-outline-success:not(:disabled):not(.disabled):active,.show>.btn-outline-success.dropdown-toggle{color:#fff;background-color:#28a745;border-color:#28a745}.btn-outline-success:not(:disabled):not(.disabled).active:focus,.btn-outline-success:not(:disabled):not(.disabled):active:focus,.show>.btn-outline-success.dropdown-toggle:focus{box-shadow:0 0 0 .2rem rgba(40,167,69,.5)}.btn-outline-info{color:#17a2b8;border-color:#17a2b8}.btn-outline-info:hover{color:#fff;background-color:#17a2b8;border-color:#17a2b8}.btn-outline-info.focus,.btn-outline-info:focus{box-shadow:0 0 0 .2rem rgba(23,162,184,.5)}.btn-outline-info.disabled,.btn-outline-info:disabled{color:#17a2b8;background-color:transparent}.btn-outline-info:not(:disabled):not(.disabled).active,.btn-outline-info:not(:disabled):not(.disabled):active,.show>.btn-outline-info.dropdown-toggle{color:#fff;background-color:#17a2b8;border-color:#17a2b8}.btn-outline-info:not(:disabled):not(.disabled).active:focus,.btn-outline-info:not(:disabled):not(.disabled):active:focus,.show>.btn-outline-info.dropdown-toggle:focus{box-shadow:0 0 0 .2rem rgba(23,162,184,.5)}.btn-outline-warning{color:#ffc107;border-color:#ffc107}.btn-outline-warning:hover{color:#212529;background-color:#ffc107;border-color:#ffc107}.btn-outline-warning.focus,.btn-outline-warning:focus{box-shadow:0 0 0 .2rem rgba(255,193,7,.5)}.btn-outline-warning.disabled,.btn-outline-warning:disabled{color:#ffc107;background-color:transparent}.btn-outline-warning:not(:disabled):not(.disabled).active,.btn-outline-warning:not(:disabled):not(.disabled):active,.show>.btn-outline-warning.dropdown-toggle{color:#212529;background-color:#ffc107;border-color:#ffc107}.btn-outline-warning:not(:disabled):not(.disabled).active:focus,.btn-outline-warning:not(:disabled):not(.disabled):active:focus,.show>.btn-outline-warning.dropdown-toggle:focus{box-shadow:0 0 0 .2rem rgba(255,193,7,.5)}.btn-outline-danger{color:#dc3545;border-color:#dc3545}.btn-outline-danger:hover{color:#fff;background-color:#dc3545;border-color:#dc3545}.btn-outline-danger.focus,.btn-outline-danger:focus{box-shadow:0 0 0 .2rem rgba(220,53,69,.5)}.btn-outline-danger.disabled,.btn-outline-danger:disabled{color:#dc3545;background-color:transparent}.btn-outline-danger:not(:disabled):not(.disabled).active,.btn-outline-danger:not(:disabled):not(.disabled):active,.show>.btn-outline-danger.dropdown-toggle{color:#fff;background-color:#dc3545;border-color:#dc3545}.btn-outline-danger:not(:disabled):not(.disabled).active:focus,.btn-outline-danger:not(:disabled):not(.disabled):active:focus,.show>.btn-outline-danger.dropdown-toggle:focus{box-shadow:0 0 0 .2rem rgba(220,53,69,.5)}.btn-outline-light{color:#f8f9fa;border-color:#f8f9fa}.btn-outline-light:hover{color:#212529;background-color:#f8f9fa;border-color:#f8f9fa}.btn-outline-light.focus,.btn-outline-light:focus{box-shadow:0 0 0 .2rem rgba(248,249,250,.5)}.btn-outline-light.disabled,.btn-outline-light:disabled{color:#f8f9fa;background-color:transparent}.btn-outline-light:not(:disabled):not(.disabled).active,.btn-outline-light:not(:disabled):not(.disabled):active,.show>.btn-outline-light.dropdown-toggle{color:#212529;background-color:#f8f9fa;border-color:#f8f9fa}.btn-outline-light:not(:disabled):not(.disabled).active:focus,.btn-outline-light:not(:disabled):not(.disabled):active:focus,.show>.btn-outline-light.dropdown-toggle:focus{box-shadow:0 0 0 .2rem rgba(248,249,250,.5)}.btn-outline-dark{color:#343a40;border-color:#343a40}.btn-outline-dark:hover{color:#fff;background-color:#343a40;border-color:#343a40}.btn-outline-dark.focus,.btn-outline-dark:focus{box-shadow:0 0 0 .2rem rgba(52,58,64,.5)}.btn-outline-dark.disabled,.btn-outline-dark:disabled{color:#343a40;background-color:transparent}.btn-outline-dark:not(:disabled):not(.disabled).active,.btn-outline-dark:not(:disabled):not(.disabled):active,.show>.btn-outline-dark.dropdown-toggle{color:#fff;background-color:#343a40;border-color:#343a40}.btn-outline-dark:not(:disabled):not(.disabled).active:focus,.btn-outline-dark:not(:disabled):not(.disabled):active:focus,.show>.btn-outline-dark.dropdown-toggle:focus{box-shadow:0 0 0 .2rem rgba(52,58,64,.5)}.btn-link{font-weight:400;color:#007bff;text-decoration:none}.btn-link:hover{color:#0056b3;text-decoration:underline}.btn-link.focus,.btn-link:focus{text-decoration:underline;box-shadow:none}.btn-link.disabled,.btn-link:disabled{color:#6c757d;pointer-events:none}.btn-group-lg>.btn,.btn-lg{padding:.5rem 1rem;font-size:1.25rem;line-height:1.5;border-radius:.3rem}.btn-group-sm>.btn,.btn-sm{padding:.25rem .5rem;font-size:.875rem;line-height:1.5;border-radius:.2rem}.btn-block{display:block;width:100%}.btn-block+.btn-block{margin-top:.5rem}input[type=button].btn-block,input[type=reset].btn-block,input[type=submit].btn-block{width:100%}.fade{transition:opacity .15s linear}@media (prefers-reduced-motion:reduce){.fade{transition:none}}.fade:not(.show){opacity:0}.collapse:not(.show){display:none}.collapsing{position:relative;height:0;overflow:hidden;transition:height .35s ease}@media (prefers-reduced-motion:reduce){.collapsing{transition:none}}.dropdown,.dropleft,.dropright,.dropup{position:relative}.dropdown-toggle{white-space:nowrap}.dropdown-toggle::after{display:inline-block;margin-left:.255em;vertical-align:.255em;content:\"\";border-top:.3em solid;border-right:.3em solid transparent;border-bottom:0;border-left:.3em solid transparent}.dropdown-toggle:empty::after{margin-left:0}.dropdown-menu{position:absolute;top:100%;left:0;z-index:1000;display:none;float:left;min-width:10rem;padding:.5rem 0;margin:.125rem 0 0;font-size:1rem;color:#212529;text-align:left;list-style:none;background-color:#fff;background-clip:padding-box;border:1px solid rgba(0,0,0,.15);border-radius:.25rem}.dropdown-menu-left{right:auto;left:0}.dropdown-menu-right{right:0;left:auto}@media (min-width:576px){.dropdown-menu-sm-left{right:auto;left:0}.dropdown-menu-sm-right{right:0;left:auto}}@media (min-width:768px){.dropdown-menu-md-left{right:auto;left:0}.dropdown-menu-md-right{right:0;left:auto}}@media (min-width:992px){.dropdown-menu-lg-left{right:auto;left:0}.dropdown-menu-lg-right{right:0;left:auto}}@media (min-width:1200px){.dropdown-menu-xl-left{right:auto;left:0}.dropdown-menu-xl-right{right:0;left:auto}}.dropup .dropdown-menu{top:auto;bottom:100%;margin-top:0;margin-bottom:.125rem}.dropup .dropdown-toggle::after{display:inline-block;margin-left:.255em;vertical-align:.255em;content:\"\";border-top:0;border-right:.3em solid transparent;border-bottom:.3em solid;border-left:.3em solid transparent}.dropup .dropdown-toggle:empty::after{margin-left:0}.dropright .dropdown-menu{top:0;right:auto;left:100%;margin-top:0;margin-left:.125rem}.dropright .dropdown-toggle::after{display:inline-block;margin-left:.255em;vertical-align:.255em;content:\"\";border-top:.3em solid transparent;border-right:0;border-bottom:.3em solid transparent;border-left:.3em solid}.dropright .dropdown-toggle:empty::after{margin-left:0}.dropright .dropdown-toggle::after{vertical-align:0}.dropleft .dropdown-menu{top:0;right:100%;left:auto;margin-top:0;margin-right:.125rem}.dropleft .dropdown-toggle::after{display:inline-block;margin-left:.255em;vertical-align:.255em;content:\"\"}.dropleft .dropdown-toggle::after{display:none}.dropleft .dropdown-toggle::before{display:inline-block;margin-right:.255em;vertical-align:.255em;content:\"\";border-top:.3em solid transparent;border-right:.3em solid;border-bottom:.3em solid transparent}.dropleft .dropdown-toggle:empty::after{margin-left:0}.dropleft .dropdown-toggle::before{vertical-align:0}.dropdown-menu[x-placement^=bottom],.dropdown-menu[x-placement^=left],.dropdown-menu[x-placement^=right],.dropdown-menu[x-placement^=top]{right:auto;bottom:auto}.dropdown-divider{height:0;margin:.5rem 0;overflow:hidden;border-top:1px solid #e9ecef}.dropdown-item{display:block;width:100%;padding:.25rem 1.5rem;clear:both;font-weight:400;color:#212529;text-align:inherit;white-space:nowrap;background-color:transparent;border:0}.dropdown-item:focus,.dropdown-item:hover{color:#16181b;text-decoration:none;background-color:#f8f9fa}.dropdown-item.active,.dropdown-item:active{color:#fff;text-decoration:none;background-color:#007bff}.dropdown-item.disabled,.dropdown-item:disabled{color:#6c757d;pointer-events:none;background-color:transparent}.dropdown-menu.show{display:block}.dropdown-header{display:block;padding:.5rem 1.5rem;margin-bottom:0;font-size:.875rem;color:#6c757d;white-space:nowrap}.dropdown-item-text{display:block;padding:.25rem 1.5rem;color:#212529}.btn-group,.btn-group-vertical{position:relative;display:inline-flex;vertical-align:middle}.btn-group-vertical>.btn,.btn-group>.btn{position:relative;flex:1 1 auto}.btn-group-vertical>.btn:hover,.btn-group>.btn:hover{z-index:1}.btn-group-vertical>.btn.active,.btn-group-vertical>.btn:active,.btn-group-vertical>.btn:focus,.btn-group>.btn.active,.btn-group>.btn:active,.btn-group>.btn:focus{z-index:1}.btn-toolbar{display:flex;flex-wrap:wrap;justify-content:flex-start}.btn-toolbar .input-group{width:auto}.btn-group>.btn-group:not(:first-child),.btn-group>.btn:not(:first-child){margin-left:-1px}.btn-group>.btn-group:not(:last-child)>.btn,.btn-group>.btn:not(:last-child):not(.dropdown-toggle){border-top-right-radius:0;border-bottom-right-radius:0}.btn-group>.btn-group:not(:first-child)>.btn,.btn-group>.btn:not(:first-child){border-top-left-radius:0;border-bottom-left-radius:0}.dropdown-toggle-split{padding-right:.5625rem;padding-left:.5625rem}.dropdown-toggle-split::after,.dropright .dropdown-toggle-split::after,.dropup .dropdown-toggle-split::after{margin-left:0}.dropleft .dropdown-toggle-split::before{margin-right:0}.btn-group-sm>.btn+.dropdown-toggle-split,.btn-sm+.dropdown-toggle-split{padding-right:.375rem;padding-left:.375rem}.btn-group-lg>.btn+.dropdown-toggle-split,.btn-lg+.dropdown-toggle-split{padding-right:.75rem;padding-left:.75rem}.btn-group-vertical{flex-direction:column;align-items:flex-start;justify-content:center}.btn-group-vertical>.btn,.btn-group-vertical>.btn-group{width:100%}.btn-group-vertical>.btn-group:not(:first-child),.btn-group-vertical>.btn:not(:first-child){margin-top:-1px}.btn-group-vertical>.btn-group:not(:last-child)>.btn,.btn-group-vertical>.btn:not(:last-child):not(.dropdown-toggle){border-bottom-right-radius:0;border-bottom-left-radius:0}.btn-group-vertical>.btn-group:not(:first-child)>.btn,.btn-group-vertical>.btn:not(:first-child){border-top-left-radius:0;border-top-right-radius:0}.btn-group-toggle>.btn,.btn-group-toggle>.btn-group>.btn{margin-bottom:0}.btn-group-toggle>.btn input[type=checkbox],.btn-group-toggle>.btn input[type=radio],.btn-group-toggle>.btn-group>.btn input[type=checkbox],.btn-group-toggle>.btn-group>.btn input[type=radio]{position:absolute;clip:rect(0,0,0,0);pointer-events:none}.input-group{position:relative;display:flex;flex-wrap:wrap;align-items:stretch;width:100%}.input-group>.custom-file,.input-group>.custom-select,.input-group>.form-control,.input-group>.form-control-plaintext{position:relative;flex:1 1 auto;width:1%;margin-bottom:0}.input-group>.custom-file+.custom-file,.input-group>.custom-file+.custom-select,.input-group>.custom-file+.form-control,.input-group>.custom-select+.custom-file,.input-group>.custom-select+.custom-select,.input-group>.custom-select+.form-control,.input-group>.form-control+.custom-file,.input-group>.form-control+.custom-select,.input-group>.form-control+.form-control,.input-group>.form-control-plaintext+.custom-file,.input-group>.form-control-plaintext+.custom-select,.input-group>.form-control-plaintext+.form-control{margin-left:-1px}.input-group>.custom-file .custom-file-input:focus~.custom-file-label,.input-group>.custom-select:focus,.input-group>.form-control:focus{z-index:3}.input-group>.custom-file .custom-file-input:focus{z-index:4}.input-group>.custom-select:not(:last-child),.input-group>.form-control:not(:last-child){border-top-right-radius:0;border-bottom-right-radius:0}.input-group>.custom-select:not(:first-child),.input-group>.form-control:not(:first-child){border-top-left-radius:0;border-bottom-left-radius:0}.input-group>.custom-file{display:flex;align-items:center}.input-group>.custom-file:not(:last-child) .custom-file-label,.input-group>.custom-file:not(:last-child) .custom-file-label::after{border-top-right-radius:0;border-bottom-right-radius:0}.input-group>.custom-file:not(:first-child) .custom-file-label{border-top-left-radius:0;border-bottom-left-radius:0}.input-group-append,.input-group-prepend{display:flex}.input-group-append .btn,.input-group-prepend .btn{position:relative;z-index:2}.input-group-append .btn:focus,.input-group-prepend .btn:focus{z-index:3}.input-group-append .btn+.btn,.input-group-append .btn+.input-group-text,.input-group-append .input-group-text+.btn,.input-group-append .input-group-text+.input-group-text,.input-group-prepend .btn+.btn,.input-group-prepend .btn+.input-group-text,.input-group-prepend .input-group-text+.btn,.input-group-prepend .input-group-text+.input-group-text{margin-left:-1px}.input-group-prepend{margin-right:-1px}.input-group-append{margin-left:-1px}.input-group-text{display:flex;align-items:center;padding:.375rem .75rem;margin-bottom:0;font-size:1rem;font-weight:400;line-height:1.5;color:#495057;text-align:center;white-space:nowrap;background-color:#e9ecef;border:1px solid #ced4da;border-radius:.25rem}.input-group-text input[type=checkbox],.input-group-text input[type=radio]{margin-top:0}.input-group-lg>.custom-select,.input-group-lg>.form-control:not(textarea){height:calc(1.5em + 1rem + 2px)}.input-group-lg>.custom-select,.input-group-lg>.form-control,.input-group-lg>.input-group-append>.btn,.input-group-lg>.input-group-append>.input-group-text,.input-group-lg>.input-group-prepend>.btn,.input-group-lg>.input-group-prepend>.input-group-text{padding:.5rem 1rem;font-size:1.25rem;line-height:1.5;border-radius:.3rem}.input-group-sm>.custom-select,.input-group-sm>.form-control:not(textarea){height:calc(1.5em + .5rem + 2px)}.input-group-sm>.custom-select,.input-group-sm>.form-control,.input-group-sm>.input-group-append>.btn,.input-group-sm>.input-group-append>.input-group-text,.input-group-sm>.input-group-prepend>.btn,.input-group-sm>.input-group-prepend>.input-group-text{padding:.25rem .5rem;font-size:.875rem;line-height:1.5;border-radius:.2rem}.input-group-lg>.custom-select,.input-group-sm>.custom-select{padding-right:1.75rem}.input-group>.input-group-append:last-child>.btn:not(:last-child):not(.dropdown-toggle),.input-group>.input-group-append:last-child>.input-group-text:not(:last-child),.input-group>.input-group-append:not(:last-child)>.btn,.input-group>.input-group-append:not(:last-child)>.input-group-text,.input-group>.input-group-prepend>.btn,.input-group>.input-group-prepend>.input-group-text{border-top-right-radius:0;border-bottom-right-radius:0}.input-group>.input-group-append>.btn,.input-group>.input-group-append>.input-group-text,.input-group>.input-group-prepend:first-child>.btn:not(:first-child),.input-group>.input-group-prepend:first-child>.input-group-text:not(:first-child),.input-group>.input-group-prepend:not(:first-child)>.btn,.input-group>.input-group-prepend:not(:first-child)>.input-group-text{border-top-left-radius:0;border-bottom-left-radius:0}.custom-control{position:relative;display:block;min-height:1.5rem;padding-left:1.5rem}.custom-control-inline{display:inline-flex;margin-right:1rem}.custom-control-input{position:absolute;z-index:-1;opacity:0}.custom-control-input:checked~.custom-control-label::before{color:#fff;border-color:#007bff;background-color:#007bff}.custom-control-input:focus~.custom-control-label::before{box-shadow:0 0 0 .2rem rgba(0,123,255,.25)}.custom-control-input:focus:not(:checked)~.custom-control-label::before{border-color:#80bdff}.custom-control-input:not(:disabled):active~.custom-control-label::before{color:#fff;background-color:#b3d7ff;border-color:#b3d7ff}.custom-control-input:disabled~.custom-control-label{color:#6c757d}.custom-control-input:disabled~.custom-control-label::before{background-color:#e9ecef}.custom-control-label{position:relative;margin-bottom:0;vertical-align:top}.custom-control-label::before{position:absolute;top:.25rem;left:-1.5rem;display:block;width:1rem;height:1rem;pointer-events:none;content:\"\";background-color:#fff;border:#adb5bd solid 1px}.custom-control-label::after{position:absolute;top:.25rem;left:-1.5rem;display:block;width:1rem;height:1rem;content:\"\";background:no-repeat 50%/50% 50%}.custom-checkbox .custom-control-label::before{border-radius:.25rem}.custom-checkbox .custom-control-input:checked~.custom-control-label::after{background-image:url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3e%3cpath fill='%23fff' d='M6.564.75l-3.59 3.612-1.538-1.55L0 4.26 2.974 7.25 8 2.193z'/%3e%3c/svg%3e\")}.custom-checkbox .custom-control-input:indeterminate~.custom-control-label::before{border-color:#007bff;background-color:#007bff}.custom-checkbox .custom-control-input:indeterminate~.custom-control-label::after{background-image:url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 4 4'%3e%3cpath stroke='%23fff' d='M0 2h4'/%3e%3c/svg%3e\")}.custom-checkbox .custom-control-input:disabled:checked~.custom-control-label::before{background-color:rgba(0,123,255,.5)}.custom-checkbox .custom-control-input:disabled:indeterminate~.custom-control-label::before{background-color:rgba(0,123,255,.5)}.custom-radio .custom-control-label::before{border-radius:50%}.custom-radio .custom-control-input:checked~.custom-control-label::after{background-image:url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%23fff'/%3e%3c/svg%3e\")}.custom-radio .custom-control-input:disabled:checked~.custom-control-label::before{background-color:rgba(0,123,255,.5)}.custom-switch{padding-left:2.25rem}.custom-switch .custom-control-label::before{left:-2.25rem;width:1.75rem;pointer-events:all;border-radius:.5rem}.custom-switch .custom-control-label::after{top:calc(.25rem + 2px);left:calc(-2.25rem + 2px);width:calc(1rem - 4px);height:calc(1rem - 4px);background-color:#adb5bd;border-radius:.5rem;transition:background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out,-webkit-transform .15s ease-in-out;transition:transform .15s ease-in-out,background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out;transition:transform .15s ease-in-out,background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out,-webkit-transform .15s ease-in-out}@media (prefers-reduced-motion:reduce){.custom-switch .custom-control-label::after{transition:none}}.custom-switch .custom-control-input:checked~.custom-control-label::after{background-color:#fff;-webkit-transform:translateX(.75rem);transform:translateX(.75rem)}.custom-switch .custom-control-input:disabled:checked~.custom-control-label::before{background-color:rgba(0,123,255,.5)}.custom-select{display:inline-block;width:100%;height:calc(1.5em + .75rem + 2px);padding:.375rem 1.75rem .375rem .75rem;font-size:1rem;font-weight:400;line-height:1.5;color:#495057;vertical-align:middle;background:url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 4 5'%3e%3cpath fill='%23343a40' d='M2 0L0 2h4zm0 5L0 3h4z'/%3e%3c/svg%3e\") no-repeat right .75rem center/8px 10px;background-color:#fff;border:1px solid #ced4da;border-radius:.25rem;-webkit-appearance:none;-moz-appearance:none;appearance:none}.custom-select:focus{border-color:#80bdff;outline:0;box-shadow:0 0 0 .2rem rgba(0,123,255,.25)}.custom-select:focus::-ms-value{color:#495057;background-color:#fff}.custom-select[multiple],.custom-select[size]:not([size=\"1\"]){height:auto;padding-right:.75rem;background-image:none}.custom-select:disabled{color:#6c757d;background-color:#e9ecef}.custom-select::-ms-expand{display:none}.custom-select-sm{height:calc(1.5em + .5rem + 2px);padding-top:.25rem;padding-bottom:.25rem;padding-left:.5rem;font-size:.875rem}.custom-select-lg{height:calc(1.5em + 1rem + 2px);padding-top:.5rem;padding-bottom:.5rem;padding-left:1rem;font-size:1.25rem}.custom-file{position:relative;display:inline-block;width:100%;height:calc(1.5em + .75rem + 2px);margin-bottom:0}.custom-file-input{position:relative;z-index:2;width:100%;height:calc(1.5em + .75rem + 2px);margin:0;opacity:0}.custom-file-input:focus~.custom-file-label{border-color:#80bdff;box-shadow:0 0 0 .2rem rgba(0,123,255,.25)}.custom-file-input:disabled~.custom-file-label{background-color:#e9ecef}.custom-file-input:lang(en)~.custom-file-label::after{content:\"Browse\"}.custom-file-input~.custom-file-label[data-browse]::after{content:attr(data-browse)}.custom-file-label{position:absolute;top:0;right:0;left:0;z-index:1;height:calc(1.5em + .75rem + 2px);padding:.375rem .75rem;font-weight:400;line-height:1.5;color:#495057;background-color:#fff;border:1px solid #ced4da;border-radius:.25rem}.custom-file-label::after{position:absolute;top:0;right:0;bottom:0;z-index:3;display:block;height:calc(1.5em + .75rem);padding:.375rem .75rem;line-height:1.5;color:#495057;content:\"Browse\";background-color:#e9ecef;border-left:inherit;border-radius:0 .25rem .25rem 0}.custom-range{width:100%;height:calc(1rem + .4rem);padding:0;background-color:transparent;-webkit-appearance:none;-moz-appearance:none;appearance:none}.custom-range:focus{outline:0}.custom-range:focus::-webkit-slider-thumb{box-shadow:0 0 0 1px #fff,0 0 0 .2rem rgba(0,123,255,.25)}.custom-range:focus::-moz-range-thumb{box-shadow:0 0 0 1px #fff,0 0 0 .2rem rgba(0,123,255,.25)}.custom-range:focus::-ms-thumb{box-shadow:0 0 0 1px #fff,0 0 0 .2rem rgba(0,123,255,.25)}.custom-range::-moz-focus-outer{border:0}.custom-range::-webkit-slider-thumb{width:1rem;height:1rem;margin-top:-.25rem;background-color:#007bff;border:0;border-radius:1rem;transition:background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out;-webkit-appearance:none;appearance:none}@media (prefers-reduced-motion:reduce){.custom-range::-webkit-slider-thumb{transition:none}}.custom-range::-webkit-slider-thumb:active{background-color:#b3d7ff}.custom-range::-webkit-slider-runnable-track{width:100%;height:.5rem;color:transparent;cursor:pointer;background-color:#dee2e6;border-color:transparent;border-radius:1rem}.custom-range::-moz-range-thumb{width:1rem;height:1rem;background-color:#007bff;border:0;border-radius:1rem;transition:background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out;-moz-appearance:none;appearance:none}@media (prefers-reduced-motion:reduce){.custom-range::-moz-range-thumb{transition:none}}.custom-range::-moz-range-thumb:active{background-color:#b3d7ff}.custom-range::-moz-range-track{width:100%;height:.5rem;color:transparent;cursor:pointer;background-color:#dee2e6;border-color:transparent;border-radius:1rem}.custom-range::-ms-thumb{width:1rem;height:1rem;margin-top:0;margin-right:.2rem;margin-left:.2rem;background-color:#007bff;border:0;border-radius:1rem;transition:background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out;appearance:none}@media (prefers-reduced-motion:reduce){.custom-range::-ms-thumb{transition:none}}.custom-range::-ms-thumb:active{background-color:#b3d7ff}.custom-range::-ms-track{width:100%;height:.5rem;color:transparent;cursor:pointer;background-color:transparent;border-color:transparent;border-width:.5rem}.custom-range::-ms-fill-lower{background-color:#dee2e6;border-radius:1rem}.custom-range::-ms-fill-upper{margin-right:15px;background-color:#dee2e6;border-radius:1rem}.custom-range:disabled::-webkit-slider-thumb{background-color:#adb5bd}.custom-range:disabled::-webkit-slider-runnable-track{cursor:default}.custom-range:disabled::-moz-range-thumb{background-color:#adb5bd}.custom-range:disabled::-moz-range-track{cursor:default}.custom-range:disabled::-ms-thumb{background-color:#adb5bd}.custom-control-label::before,.custom-file-label,.custom-select{transition:background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out}@media (prefers-reduced-motion:reduce){.custom-control-label::before,.custom-file-label,.custom-select{transition:none}}.nav{display:flex;flex-wrap:wrap;padding-left:0;margin-bottom:0;list-style:none}.nav-link{display:block;padding:.5rem 1rem}.nav-link:focus,.nav-link:hover{text-decoration:none}.nav-link.disabled{color:#6c757d;pointer-events:none;cursor:default}.nav-tabs{border-bottom:1px solid #dee2e6}.nav-tabs .nav-item{margin-bottom:-1px}.nav-tabs .nav-link{border:1px solid transparent;border-top-left-radius:.25rem;border-top-right-radius:.25rem}.nav-tabs .nav-link:focus,.nav-tabs .nav-link:hover{border-color:#e9ecef #e9ecef #dee2e6}.nav-tabs .nav-link.disabled{color:#6c757d;background-color:transparent;border-color:transparent}.nav-tabs .nav-item.show .nav-link,.nav-tabs .nav-link.active{color:#495057;background-color:#fff;border-color:#dee2e6 #dee2e6 #fff}.nav-tabs .dropdown-menu{margin-top:-1px;border-top-left-radius:0;border-top-right-radius:0}.nav-pills .nav-link{border-radius:.25rem}.nav-pills .nav-link.active,.nav-pills .show>.nav-link{color:#fff;background-color:#007bff}.nav-fill .nav-item{flex:1 1 auto;text-align:center}.nav-justified .nav-item{flex-basis:0;flex-grow:1;text-align:center}.tab-content>.tab-pane{display:none}.tab-content>.active{display:block}.navbar{position:relative;display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;padding:.5rem 1rem}.navbar>.container,.navbar>.container-fluid{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between}.navbar-brand{display:inline-block;padding-top:.3125rem;padding-bottom:.3125rem;margin-right:1rem;font-size:1.25rem;line-height:inherit;white-space:nowrap}.navbar-brand:focus,.navbar-brand:hover{text-decoration:none}.navbar-nav{display:flex;flex-direction:column;padding-left:0;margin-bottom:0;list-style:none}.navbar-nav .nav-link{padding-right:0;padding-left:0}.navbar-nav .dropdown-menu{position:static;float:none}.navbar-text{display:inline-block;padding-top:.5rem;padding-bottom:.5rem}.navbar-collapse{flex-basis:100%;flex-grow:1;align-items:center}.navbar-toggler{padding:.25rem .75rem;font-size:1.25rem;line-height:1;background-color:transparent;border:1px solid transparent;border-radius:.25rem}.navbar-toggler:focus,.navbar-toggler:hover{text-decoration:none}.navbar-toggler-icon{display:inline-block;width:1.5em;height:1.5em;vertical-align:middle;content:\"\";background:no-repeat center center;background-size:100% 100%}@media (max-width:575.98px){.navbar-expand-sm>.container,.navbar-expand-sm>.container-fluid{padding-right:0;padding-left:0}}@media (min-width:576px){.navbar-expand-sm{flex-flow:row nowrap;justify-content:flex-start}.navbar-expand-sm .navbar-nav{flex-direction:row}.navbar-expand-sm .navbar-nav .dropdown-menu{position:absolute}.navbar-expand-sm .navbar-nav .nav-link{padding-right:.5rem;padding-left:.5rem}.navbar-expand-sm>.container,.navbar-expand-sm>.container-fluid{flex-wrap:nowrap}.navbar-expand-sm .navbar-collapse{display:flex!important;flex-basis:auto}.navbar-expand-sm .navbar-toggler{display:none}}@media (max-width:767.98px){.navbar-expand-md>.container,.navbar-expand-md>.container-fluid{padding-right:0;padding-left:0}}@media (min-width:768px){.navbar-expand-md{flex-flow:row nowrap;justify-content:flex-start}.navbar-expand-md .navbar-nav{flex-direction:row}.navbar-expand-md .navbar-nav .dropdown-menu{position:absolute}.navbar-expand-md .navbar-nav .nav-link{padding-right:.5rem;padding-left:.5rem}.navbar-expand-md>.container,.navbar-expand-md>.container-fluid{flex-wrap:nowrap}.navbar-expand-md .navbar-collapse{display:flex!important;flex-basis:auto}.navbar-expand-md .navbar-toggler{display:none}}@media (max-width:991.98px){.navbar-expand-lg>.container,.navbar-expand-lg>.container-fluid{padding-right:0;padding-left:0}}@media (min-width:992px){.navbar-expand-lg{flex-flow:row nowrap;justify-content:flex-start}.navbar-expand-lg .navbar-nav{flex-direction:row}.navbar-expand-lg .navbar-nav .dropdown-menu{position:absolute}.navbar-expand-lg .navbar-nav .nav-link{padding-right:.5rem;padding-left:.5rem}.navbar-expand-lg>.container,.navbar-expand-lg>.container-fluid{flex-wrap:nowrap}.navbar-expand-lg .navbar-collapse{display:flex!important;flex-basis:auto}.navbar-expand-lg .navbar-toggler{display:none}}@media (max-width:1199.98px){.navbar-expand-xl>.container,.navbar-expand-xl>.container-fluid{padding-right:0;padding-left:0}}@media (min-width:1200px){.navbar-expand-xl{flex-flow:row nowrap;justify-content:flex-start}.navbar-expand-xl .navbar-nav{flex-direction:row}.navbar-expand-xl .navbar-nav .dropdown-menu{position:absolute}.navbar-expand-xl .navbar-nav .nav-link{padding-right:.5rem;padding-left:.5rem}.navbar-expand-xl>.container,.navbar-expand-xl>.container-fluid{flex-wrap:nowrap}.navbar-expand-xl .navbar-collapse{display:flex!important;flex-basis:auto}.navbar-expand-xl .navbar-toggler{display:none}}.navbar-expand{flex-flow:row nowrap;justify-content:flex-start}.navbar-expand>.container,.navbar-expand>.container-fluid{padding-right:0;padding-left:0}.navbar-expand .navbar-nav{flex-direction:row}.navbar-expand .navbar-nav .dropdown-menu{position:absolute}.navbar-expand .navbar-nav .nav-link{padding-right:.5rem;padding-left:.5rem}.navbar-expand>.container,.navbar-expand>.container-fluid{flex-wrap:nowrap}.navbar-expand .navbar-collapse{display:flex!important;flex-basis:auto}.navbar-expand .navbar-toggler{display:none}.navbar-light .navbar-brand{color:rgba(0,0,0,.9)}.navbar-light .navbar-brand:focus,.navbar-light .navbar-brand:hover{color:rgba(0,0,0,.9)}.navbar-light .navbar-nav .nav-link{color:rgba(0,0,0,.5)}.navbar-light .navbar-nav .nav-link:focus,.navbar-light .navbar-nav .nav-link:hover{color:rgba(0,0,0,.7)}.navbar-light .navbar-nav .nav-link.disabled{color:rgba(0,0,0,.3)}.navbar-light .navbar-nav .active>.nav-link,.navbar-light .navbar-nav .nav-link.active,.navbar-light .navbar-nav .nav-link.show,.navbar-light .navbar-nav .show>.nav-link{color:rgba(0,0,0,.9)}.navbar-light .navbar-toggler{color:rgba(0,0,0,.5);border-color:rgba(0,0,0,.1)}.navbar-light .navbar-toggler-icon{background-image:url(\"data:image/svg+xml,%3csvg viewBox='0 0 30 30' xmlns='http://www.w3.org/2000/svg'%3e%3cpath stroke='rgba(0, 0, 0, 0.5)' stroke-width='2' stroke-linecap='round' stroke-miterlimit='10' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e\")}.navbar-light .navbar-text{color:rgba(0,0,0,.5)}.navbar-light .navbar-text a{color:rgba(0,0,0,.9)}.navbar-light .navbar-text a:focus,.navbar-light .navbar-text a:hover{color:rgba(0,0,0,.9)}.navbar-dark .navbar-brand{color:#fff}.navbar-dark .navbar-brand:focus,.navbar-dark .navbar-brand:hover{color:#fff}.navbar-dark .navbar-nav .nav-link{color:rgba(255,255,255,.5)}.navbar-dark .navbar-nav .nav-link:focus,.navbar-dark .navbar-nav .nav-link:hover{color:rgba(255,255,255,.75)}.navbar-dark .navbar-nav .nav-link.disabled{color:rgba(255,255,255,.25)}.navbar-dark .navbar-nav .active>.nav-link,.navbar-dark .navbar-nav .nav-link.active,.navbar-dark .navbar-nav .nav-link.show,.navbar-dark .navbar-nav .show>.nav-link{color:#fff}.navbar-dark .navbar-toggler{color:rgba(255,255,255,.5);border-color:rgba(255,255,255,.1)}.navbar-dark .navbar-toggler-icon{background-image:url(\"data:image/svg+xml,%3csvg viewBox='0 0 30 30' xmlns='http://www.w3.org/2000/svg'%3e%3cpath stroke='rgba(255, 255, 255, 0.5)' stroke-width='2' stroke-linecap='round' stroke-miterlimit='10' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e\")}.navbar-dark .navbar-text{color:rgba(255,255,255,.5)}.navbar-dark .navbar-text a{color:#fff}.navbar-dark .navbar-text a:focus,.navbar-dark .navbar-text a:hover{color:#fff}.card{position:relative;display:flex;flex-direction:column;min-width:0;word-wrap:break-word;background-color:#fff;background-clip:border-box;border:1px solid rgba(0,0,0,.125);border-radius:.25rem}.card>hr{margin-right:0;margin-left:0}.card>.list-group:first-child .list-group-item:first-child{border-top-left-radius:.25rem;border-top-right-radius:.25rem}.card>.list-group:last-child .list-group-item:last-child{border-bottom-right-radius:.25rem;border-bottom-left-radius:.25rem}.card-body{flex:1 1 auto;padding:1.25rem}.card-title{margin-bottom:.75rem}.card-subtitle{margin-top:-.375rem;margin-bottom:0}.card-text:last-child{margin-bottom:0}.card-link:hover{text-decoration:none}.card-link+.card-link{margin-left:1.25rem}.card-header{padding:.75rem 1.25rem;margin-bottom:0;background-color:rgba(0,0,0,.03);border-bottom:1px solid rgba(0,0,0,.125)}.card-header:first-child{border-radius:calc(.25rem - 1px) calc(.25rem - 1px) 0 0}.card-header+.list-group .list-group-item:first-child{border-top:0}.card-footer{padding:.75rem 1.25rem;background-color:rgba(0,0,0,.03);border-top:1px solid rgba(0,0,0,.125)}.card-footer:last-child{border-radius:0 0 calc(.25rem - 1px) calc(.25rem - 1px)}.card-header-tabs{margin-right:-.625rem;margin-bottom:-.75rem;margin-left:-.625rem;border-bottom:0}.card-header-pills{margin-right:-.625rem;margin-left:-.625rem}.card-img-overlay{position:absolute;top:0;right:0;bottom:0;left:0;padding:1.25rem}.card-img{width:100%;border-radius:calc(.25rem - 1px)}.card-img-top{width:100%;border-top-left-radius:calc(.25rem - 1px);border-top-right-radius:calc(.25rem - 1px)}.card-img-bottom{width:100%;border-bottom-right-radius:calc(.25rem - 1px);border-bottom-left-radius:calc(.25rem - 1px)}.card-deck{display:flex;flex-direction:column}.card-deck .card{margin-bottom:15px}@media (min-width:576px){.card-deck{flex-flow:row wrap;margin-right:-15px;margin-left:-15px}.card-deck .card{display:flex;flex:1 0 0%;flex-direction:column;margin-right:15px;margin-bottom:0;margin-left:15px}}.card-group{display:flex;flex-direction:column}.card-group>.card{margin-bottom:15px}@media (min-width:576px){.card-group{flex-flow:row wrap}.card-group>.card{flex:1 0 0%;margin-bottom:0}.card-group>.card+.card{margin-left:0;border-left:0}.card-group>.card:not(:last-child){border-top-right-radius:0;border-bottom-right-radius:0}.card-group>.card:not(:last-child) .card-header,.card-group>.card:not(:last-child) .card-img-top{border-top-right-radius:0}.card-group>.card:not(:last-child) .card-footer,.card-group>.card:not(:last-child) .card-img-bottom{border-bottom-right-radius:0}.card-group>.card:not(:first-child){border-top-left-radius:0;border-bottom-left-radius:0}.card-group>.card:not(:first-child) .card-header,.card-group>.card:not(:first-child) .card-img-top{border-top-left-radius:0}.card-group>.card:not(:first-child) .card-footer,.card-group>.card:not(:first-child) .card-img-bottom{border-bottom-left-radius:0}}.card-columns .card{margin-bottom:.75rem}@media (min-width:576px){.card-columns{-webkit-column-count:3;column-count:3;-webkit-column-gap:1.25rem;column-gap:1.25rem;orphans:1;widows:1}.card-columns .card{display:inline-block;width:100%}}.accordion>.card{overflow:hidden}.accordion>.card:not(:first-of-type) .card-header:first-child{border-radius:0}.accordion>.card:not(:first-of-type):not(:last-of-type){border-bottom:0;border-radius:0}.accordion>.card:first-of-type{border-bottom:0;border-bottom-right-radius:0;border-bottom-left-radius:0}.accordion>.card:last-of-type{border-top-left-radius:0;border-top-right-radius:0}.accordion>.card .card-header{margin-bottom:-1px}.breadcrumb{display:flex;flex-wrap:wrap;padding:.75rem 1rem;margin-bottom:1rem;list-style:none;background-color:#e9ecef;border-radius:.25rem}.breadcrumb-item+.breadcrumb-item{padding-left:.5rem}.breadcrumb-item+.breadcrumb-item::before{display:inline-block;padding-right:.5rem;color:#6c757d;content:\"/\"}.breadcrumb-item+.breadcrumb-item:hover::before{text-decoration:underline}.breadcrumb-item+.breadcrumb-item:hover::before{text-decoration:none}.breadcrumb-item.active{color:#6c757d}.pagination{display:flex;padding-left:0;list-style:none;border-radius:.25rem}.page-link{position:relative;display:block;padding:.5rem .75rem;margin-left:-1px;line-height:1.25;color:#007bff;background-color:#fff;border:1px solid #dee2e6}.page-link:hover{z-index:2;color:#0056b3;text-decoration:none;background-color:#e9ecef;border-color:#dee2e6}.page-link:focus{z-index:2;outline:0;box-shadow:0 0 0 .2rem rgba(0,123,255,.25)}.page-item:first-child .page-link{margin-left:0;border-top-left-radius:.25rem;border-bottom-left-radius:.25rem}.page-item:last-child .page-link{border-top-right-radius:.25rem;border-bottom-right-radius:.25rem}.page-item.active .page-link{z-index:1;color:#fff;background-color:#007bff;border-color:#007bff}.page-item.disabled .page-link{color:#6c757d;pointer-events:none;cursor:auto;background-color:#fff;border-color:#dee2e6}.pagination-lg .page-link{padding:.75rem 1.5rem;font-size:1.25rem;line-height:1.5}.pagination-lg .page-item:first-child .page-link{border-top-left-radius:.3rem;border-bottom-left-radius:.3rem}.pagination-lg .page-item:last-child .page-link{border-top-right-radius:.3rem;border-bottom-right-radius:.3rem}.pagination-sm .page-link{padding:.25rem .5rem;font-size:.875rem;line-height:1.5}.pagination-sm .page-item:first-child .page-link{border-top-left-radius:.2rem;border-bottom-left-radius:.2rem}.pagination-sm .page-item:last-child .page-link{border-top-right-radius:.2rem;border-bottom-right-radius:.2rem}.badge{display:inline-block;padding:.25em .4em;font-size:75%;font-weight:700;line-height:1;text-align:center;white-space:nowrap;vertical-align:baseline;border-radius:.25rem;transition:color .15s ease-in-out,background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out}@media (prefers-reduced-motion:reduce){.badge{transition:none}}a.badge:focus,a.badge:hover{text-decoration:none}.badge:empty{display:none}.btn .badge{position:relative;top:-1px}.badge-pill{padding-right:.6em;padding-left:.6em;border-radius:10rem}.badge-primary{color:#fff;background-color:#007bff}a.badge-primary:focus,a.badge-primary:hover{color:#fff;background-color:#0062cc}a.badge-primary.focus,a.badge-primary:focus{outline:0;box-shadow:0 0 0 .2rem rgba(0,123,255,.5)}.badge-secondary{color:#fff;background-color:#6c757d}a.badge-secondary:focus,a.badge-secondary:hover{color:#fff;background-color:#545b62}a.badge-secondary.focus,a.badge-secondary:focus{outline:0;box-shadow:0 0 0 .2rem rgba(108,117,125,.5)}.badge-success{color:#fff;background-color:#28a745}a.badge-success:focus,a.badge-success:hover{color:#fff;background-color:#1e7e34}a.badge-success.focus,a.badge-success:focus{outline:0;box-shadow:0 0 0 .2rem rgba(40,167,69,.5)}.badge-info{color:#fff;background-color:#17a2b8}a.badge-info:focus,a.badge-info:hover{color:#fff;background-color:#117a8b}a.badge-info.focus,a.badge-info:focus{outline:0;box-shadow:0 0 0 .2rem rgba(23,162,184,.5)}.badge-warning{color:#212529;background-color:#ffc107}a.badge-warning:focus,a.badge-warning:hover{color:#212529;background-color:#d39e00}a.badge-warning.focus,a.badge-warning:focus{outline:0;box-shadow:0 0 0 .2rem rgba(255,193,7,.5)}.badge-danger{color:#fff;background-color:#dc3545}a.badge-danger:focus,a.badge-danger:hover{color:#fff;background-color:#bd2130}a.badge-danger.focus,a.badge-danger:focus{outline:0;box-shadow:0 0 0 .2rem rgba(220,53,69,.5)}.badge-light{color:#212529;background-color:#f8f9fa}a.badge-light:focus,a.badge-light:hover{color:#212529;background-color:#dae0e5}a.badge-light.focus,a.badge-light:focus{outline:0;box-shadow:0 0 0 .2rem rgba(248,249,250,.5)}.badge-dark{color:#fff;background-color:#343a40}a.badge-dark:focus,a.badge-dark:hover{color:#fff;background-color:#1d2124}a.badge-dark.focus,a.badge-dark:focus{outline:0;box-shadow:0 0 0 .2rem rgba(52,58,64,.5)}.jumbotron{padding:2rem 1rem;margin-bottom:2rem;background-color:#e9ecef;border-radius:.3rem}@media (min-width:576px){.jumbotron{padding:4rem 2rem}}.jumbotron-fluid{padding-right:0;padding-left:0;border-radius:0}.alert{position:relative;padding:.75rem 1.25rem;margin-bottom:1rem;border:1px solid transparent;border-radius:.25rem}.alert-heading{color:inherit}.alert-link{font-weight:700}.alert-dismissible{padding-right:4rem}.alert-dismissible .close{position:absolute;top:0;right:0;padding:.75rem 1.25rem;color:inherit}.alert-primary{color:#004085;background-color:#cce5ff;border-color:#b8daff}.alert-primary hr{border-top-color:#9fcdff}.alert-primary .alert-link{color:#002752}.alert-secondary{color:#383d41;background-color:#e2e3e5;border-color:#d6d8db}.alert-secondary hr{border-top-color:#c8cbcf}.alert-secondary .alert-link{color:#202326}.alert-success{color:#155724;background-color:#d4edda;border-color:#c3e6cb}.alert-success hr{border-top-color:#b1dfbb}.alert-success .alert-link{color:#0b2e13}.alert-info{color:#0c5460;background-color:#d1ecf1;border-color:#bee5eb}.alert-info hr{border-top-color:#abdde5}.alert-info .alert-link{color:#062c33}.alert-warning{color:#856404;background-color:#fff3cd;border-color:#ffeeba}.alert-warning hr{border-top-color:#ffe8a1}.alert-warning .alert-link{color:#533f03}.alert-danger{color:#721c24;background-color:#f8d7da;border-color:#f5c6cb}.alert-danger hr{border-top-color:#f1b0b7}.alert-danger .alert-link{color:#491217}.alert-light{color:#818182;background-color:#fefefe;border-color:#fdfdfe}.alert-light hr{border-top-color:#ececf6}.alert-light .alert-link{color:#686868}.alert-dark{color:#1b1e21;background-color:#d6d8d9;border-color:#c6c8ca}.alert-dark hr{border-top-color:#b9bbbe}.alert-dark .alert-link{color:#040505}@-webkit-keyframes progress-bar-stripes{from{background-position:1rem 0}to{background-position:0 0}}@keyframes progress-bar-stripes{from{background-position:1rem 0}to{background-position:0 0}}.progress{display:flex;height:1rem;overflow:hidden;font-size:.75rem;background-color:#e9ecef;border-radius:.25rem}.progress-bar{display:flex;flex-direction:column;justify-content:center;color:#fff;text-align:center;white-space:nowrap;background-color:#007bff;transition:width .6s ease}@media (prefers-reduced-motion:reduce){.progress-bar{transition:none}}.progress-bar-striped{background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-size:1rem 1rem}.progress-bar-animated{-webkit-animation:progress-bar-stripes 1s linear infinite;animation:progress-bar-stripes 1s linear infinite}@media (prefers-reduced-motion:reduce){.progress-bar-animated{-webkit-animation:none;animation:none}}.media{display:flex;align-items:flex-start}.media-body{flex:1}.list-group{display:flex;flex-direction:column;padding-left:0;margin-bottom:0}.list-group-item-action{width:100%;color:#495057;text-align:inherit}.list-group-item-action:focus,.list-group-item-action:hover{z-index:1;color:#495057;text-decoration:none;background-color:#f8f9fa}.list-group-item-action:active{color:#212529;background-color:#e9ecef}.list-group-item{position:relative;display:block;padding:.75rem 1.25rem;margin-bottom:-1px;background-color:#fff;border:1px solid rgba(0,0,0,.125)}.list-group-item:first-child{border-top-left-radius:.25rem;border-top-right-radius:.25rem}.list-group-item:last-child{margin-bottom:0;border-bottom-right-radius:.25rem;border-bottom-left-radius:.25rem}.list-group-item.disabled,.list-group-item:disabled{color:#6c757d;pointer-events:none;background-color:#fff}.list-group-item.active{z-index:2;color:#fff;background-color:#007bff;border-color:#007bff}.list-group-horizontal{flex-direction:row}.list-group-horizontal .list-group-item{margin-right:-1px;margin-bottom:0}.list-group-horizontal .list-group-item:first-child{border-top-left-radius:.25rem;border-bottom-left-radius:.25rem;border-top-right-radius:0}.list-group-horizontal .list-group-item:last-child{margin-right:0;border-top-right-radius:.25rem;border-bottom-right-radius:.25rem;border-bottom-left-radius:0}@media (min-width:576px){.list-group-horizontal-sm{flex-direction:row}.list-group-horizontal-sm .list-group-item{margin-right:-1px;margin-bottom:0}.list-group-horizontal-sm .list-group-item:first-child{border-top-left-radius:.25rem;border-bottom-left-radius:.25rem;border-top-right-radius:0}.list-group-horizontal-sm .list-group-item:last-child{margin-right:0;border-top-right-radius:.25rem;border-bottom-right-radius:.25rem;border-bottom-left-radius:0}}@media (min-width:768px){.list-group-horizontal-md{flex-direction:row}.list-group-horizontal-md .list-group-item{margin-right:-1px;margin-bottom:0}.list-group-horizontal-md .list-group-item:first-child{border-top-left-radius:.25rem;border-bottom-left-radius:.25rem;border-top-right-radius:0}.list-group-horizontal-md .list-group-item:last-child{margin-right:0;border-top-right-radius:.25rem;border-bottom-right-radius:.25rem;border-bottom-left-radius:0}}@media (min-width:992px){.list-group-horizontal-lg{flex-direction:row}.list-group-horizontal-lg .list-group-item{margin-right:-1px;margin-bottom:0}.list-group-horizontal-lg .list-group-item:first-child{border-top-left-radius:.25rem;border-bottom-left-radius:.25rem;border-top-right-radius:0}.list-group-horizontal-lg .list-group-item:last-child{margin-right:0;border-top-right-radius:.25rem;border-bottom-right-radius:.25rem;border-bottom-left-radius:0}}@media (min-width:1200px){.list-group-horizontal-xl{flex-direction:row}.list-group-horizontal-xl .list-group-item{margin-right:-1px;margin-bottom:0}.list-group-horizontal-xl .list-group-item:first-child{border-top-left-radius:.25rem;border-bottom-left-radius:.25rem;border-top-right-radius:0}.list-group-horizontal-xl .list-group-item:last-child{margin-right:0;border-top-right-radius:.25rem;border-bottom-right-radius:.25rem;border-bottom-left-radius:0}}.list-group-flush .list-group-item{border-right:0;border-left:0;border-radius:0}.list-group-flush .list-group-item:last-child{margin-bottom:-1px}.list-group-flush:first-child .list-group-item:first-child{border-top:0}.list-group-flush:last-child .list-group-item:last-child{margin-bottom:0;border-bottom:0}.list-group-item-primary{color:#004085;background-color:#b8daff}.list-group-item-primary.list-group-item-action:focus,.list-group-item-primary.list-group-item-action:hover{color:#004085;background-color:#9fcdff}.list-group-item-primary.list-group-item-action.active{color:#fff;background-color:#004085;border-color:#004085}.list-group-item-secondary{color:#383d41;background-color:#d6d8db}.list-group-item-secondary.list-group-item-action:focus,.list-group-item-secondary.list-group-item-action:hover{color:#383d41;background-color:#c8cbcf}.list-group-item-secondary.list-group-item-action.active{color:#fff;background-color:#383d41;border-color:#383d41}.list-group-item-success{color:#155724;background-color:#c3e6cb}.list-group-item-success.list-group-item-action:focus,.list-group-item-success.list-group-item-action:hover{color:#155724;background-color:#b1dfbb}.list-group-item-success.list-group-item-action.active{color:#fff;background-color:#155724;border-color:#155724}.list-group-item-info{color:#0c5460;background-color:#bee5eb}.list-group-item-info.list-group-item-action:focus,.list-group-item-info.list-group-item-action:hover{color:#0c5460;background-color:#abdde5}.list-group-item-info.list-group-item-action.active{color:#fff;background-color:#0c5460;border-color:#0c5460}.list-group-item-warning{color:#856404;background-color:#ffeeba}.list-group-item-warning.list-group-item-action:focus,.list-group-item-warning.list-group-item-action:hover{color:#856404;background-color:#ffe8a1}.list-group-item-warning.list-group-item-action.active{color:#fff;background-color:#856404;border-color:#856404}.list-group-item-danger{color:#721c24;background-color:#f5c6cb}.list-group-item-danger.list-group-item-action:focus,.list-group-item-danger.list-group-item-action:hover{color:#721c24;background-color:#f1b0b7}.list-group-item-danger.list-group-item-action.active{color:#fff;background-color:#721c24;border-color:#721c24}.list-group-item-light{color:#818182;background-color:#fdfdfe}.list-group-item-light.list-group-item-action:focus,.list-group-item-light.list-group-item-action:hover{color:#818182;background-color:#ececf6}.list-group-item-light.list-group-item-action.active{color:#fff;background-color:#818182;border-color:#818182}.list-group-item-dark{color:#1b1e21;background-color:#c6c8ca}.list-group-item-dark.list-group-item-action:focus,.list-group-item-dark.list-group-item-action:hover{color:#1b1e21;background-color:#b9bbbe}.list-group-item-dark.list-group-item-action.active{color:#fff;background-color:#1b1e21;border-color:#1b1e21}.close{float:right;font-size:1.5rem;font-weight:700;line-height:1;color:#000;text-shadow:0 1px 0 #fff;opacity:.5}.close:hover{color:#000;text-decoration:none}.close:not(:disabled):not(.disabled):focus,.close:not(:disabled):not(.disabled):hover{opacity:.75}button.close{padding:0;background-color:transparent;border:0;-webkit-appearance:none;-moz-appearance:none;appearance:none}a.close.disabled{pointer-events:none}.toast{max-width:350px;overflow:hidden;font-size:.875rem;background-color:rgba(255,255,255,.85);background-clip:padding-box;border:1px solid rgba(0,0,0,.1);box-shadow:0 .25rem .75rem rgba(0,0,0,.1);-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);opacity:0;border-radius:.25rem}.toast:not(:last-child){margin-bottom:.75rem}.toast.showing{opacity:1}.toast.show{display:block;opacity:1}.toast.hide{display:none}.toast-header{display:flex;align-items:center;padding:.25rem .75rem;color:#6c757d;background-color:rgba(255,255,255,.85);background-clip:padding-box;border-bottom:1px solid rgba(0,0,0,.05)}.toast-body{padding:.75rem}.modal-open{overflow:hidden}.modal-open .modal{overflow-x:hidden;overflow-y:auto}.modal{position:fixed;top:0;left:0;z-index:1050;display:none;width:100%;height:100%;overflow:hidden;outline:0}.modal-dialog{position:relative;width:auto;margin:.5rem;pointer-events:none}.modal.fade .modal-dialog{transition:-webkit-transform .3s ease-out;transition:transform .3s ease-out;transition:transform .3s ease-out, -webkit-transform .3s ease-out;transition:transform .3s ease-out,-webkit-transform .3s ease-out;-webkit-transform:translate(0,-50px);transform:translate(0,-50px)}@media (prefers-reduced-motion:reduce){.modal.fade .modal-dialog{transition:none}}.modal.show .modal-dialog{-webkit-transform:none;transform:none}.modal-dialog-scrollable{display:flex;max-height:calc(100% - 1rem)}.modal-dialog-scrollable .modal-content{max-height:calc(100vh - 1rem);overflow:hidden}.modal-dialog-scrollable .modal-footer,.modal-dialog-scrollable .modal-header{flex-shrink:0}.modal-dialog-scrollable .modal-body{overflow-y:auto}.modal-dialog-centered{display:flex;align-items:center;min-height:calc(100% - 1rem)}.modal-dialog-centered::before{display:block;height:calc(100vh - 1rem);content:\"\"}.modal-dialog-centered.modal-dialog-scrollable{flex-direction:column;justify-content:center;height:100%}.modal-dialog-centered.modal-dialog-scrollable .modal-content{max-height:none}.modal-dialog-centered.modal-dialog-scrollable::before{content:none}.modal-content{position:relative;display:flex;flex-direction:column;width:100%;pointer-events:auto;background-color:#fff;background-clip:padding-box;border:1px solid rgba(0,0,0,.2);border-radius:.3rem;outline:0}.modal-backdrop{position:fixed;top:0;left:0;z-index:1040;width:100vw;height:100vh;background-color:#000}.modal-backdrop.fade{opacity:0}.modal-backdrop.show{opacity:.5}.modal-header{display:flex;align-items:flex-start;justify-content:space-between;padding:1rem 1rem;border-bottom:1px solid #dee2e6;border-top-left-radius:.3rem;border-top-right-radius:.3rem}.modal-header .close{padding:1rem 1rem;margin:-1rem -1rem -1rem auto}.modal-title{margin-bottom:0;line-height:1.5}.modal-body{position:relative;flex:1 1 auto;padding:1rem}.modal-footer{display:flex;align-items:center;justify-content:flex-end;padding:1rem;border-top:1px solid #dee2e6;border-bottom-right-radius:.3rem;border-bottom-left-radius:.3rem}.modal-footer>:not(:first-child){margin-left:.25rem}.modal-footer>:not(:last-child){margin-right:.25rem}.modal-scrollbar-measure{position:absolute;top:-9999px;width:50px;height:50px;overflow:scroll}@media (min-width:576px){.modal-dialog{max-width:500px;margin:1.75rem auto}.modal-dialog-scrollable{max-height:calc(100% - 3.5rem)}.modal-dialog-scrollable .modal-content{max-height:calc(100vh - 3.5rem)}.modal-dialog-centered{min-height:calc(100% - 3.5rem)}.modal-dialog-centered::before{height:calc(100vh - 3.5rem)}.modal-sm{max-width:300px}}@media (min-width:992px){.modal-lg,.modal-xl{max-width:800px}}@media (min-width:1200px){.modal-xl{max-width:1140px}}.tooltip{position:absolute;z-index:1070;display:block;margin:0;font-family:-apple-system,BlinkMacSystemFont,\"Segoe UI\",Roboto,\"Helvetica Neue\",Arial,\"Noto Sans\",sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\",\"Segoe UI Symbol\",\"Noto Color Emoji\";font-style:normal;font-weight:400;line-height:1.5;text-align:left;text-align:start;text-decoration:none;text-shadow:none;text-transform:none;letter-spacing:normal;word-break:normal;word-spacing:normal;white-space:normal;line-break:auto;font-size:.875rem;word-wrap:break-word;opacity:0}.tooltip.show{opacity:.9}.tooltip .arrow{position:absolute;display:block;width:.8rem;height:.4rem}.tooltip .arrow::before{position:absolute;content:\"\";border-color:transparent;border-style:solid}.bs-tooltip-auto[x-placement^=top],.bs-tooltip-top{padding:.4rem 0}.bs-tooltip-auto[x-placement^=top] .arrow,.bs-tooltip-top .arrow{bottom:0}.bs-tooltip-auto[x-placement^=top] .arrow::before,.bs-tooltip-top .arrow::before{top:0;border-width:.4rem .4rem 0;border-top-color:#000}.bs-tooltip-auto[x-placement^=right],.bs-tooltip-right{padding:0 .4rem}.bs-tooltip-auto[x-placement^=right] .arrow,.bs-tooltip-right .arrow{left:0;width:.4rem;height:.8rem}.bs-tooltip-auto[x-placement^=right] .arrow::before,.bs-tooltip-right .arrow::before{right:0;border-width:.4rem .4rem .4rem 0;border-right-color:#000}.bs-tooltip-auto[x-placement^=bottom],.bs-tooltip-bottom{padding:.4rem 0}.bs-tooltip-auto[x-placement^=bottom] .arrow,.bs-tooltip-bottom .arrow{top:0}.bs-tooltip-auto[x-placement^=bottom] .arrow::before,.bs-tooltip-bottom .arrow::before{bottom:0;border-width:0 .4rem .4rem;border-bottom-color:#000}.bs-tooltip-auto[x-placement^=left],.bs-tooltip-left{padding:0 .4rem}.bs-tooltip-auto[x-placement^=left] .arrow,.bs-tooltip-left .arrow{right:0;width:.4rem;height:.8rem}.bs-tooltip-auto[x-placement^=left] .arrow::before,.bs-tooltip-left .arrow::before{left:0;border-width:.4rem 0 .4rem .4rem;border-left-color:#000}.tooltip-inner{max-width:200px;padding:.25rem .5rem;color:#fff;text-align:center;background-color:#000;border-radius:.25rem}.popover{position:absolute;top:0;left:0;z-index:1060;display:block;max-width:276px;font-family:-apple-system,BlinkMacSystemFont,\"Segoe UI\",Roboto,\"Helvetica Neue\",Arial,\"Noto Sans\",sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\",\"Segoe UI Symbol\",\"Noto Color Emoji\";font-style:normal;font-weight:400;line-height:1.5;text-align:left;text-align:start;text-decoration:none;text-shadow:none;text-transform:none;letter-spacing:normal;word-break:normal;word-spacing:normal;white-space:normal;line-break:auto;font-size:.875rem;word-wrap:break-word;background-color:#fff;background-clip:padding-box;border:1px solid rgba(0,0,0,.2);border-radius:.3rem}.popover .arrow{position:absolute;display:block;width:1rem;height:.5rem;margin:0 .3rem}.popover .arrow::after,.popover .arrow::before{position:absolute;display:block;content:\"\";border-color:transparent;border-style:solid}.bs-popover-auto[x-placement^=top],.bs-popover-top{margin-bottom:.5rem}.bs-popover-auto[x-placement^=top]>.arrow,.bs-popover-top>.arrow{bottom:calc((.5rem + 1px) * -1)}.bs-popover-auto[x-placement^=top]>.arrow::before,.bs-popover-top>.arrow::before{bottom:0;border-width:.5rem .5rem 0;border-top-color:rgba(0,0,0,.25)}.bs-popover-auto[x-placement^=top]>.arrow::after,.bs-popover-top>.arrow::after{bottom:1px;border-width:.5rem .5rem 0;border-top-color:#fff}.bs-popover-auto[x-placement^=right],.bs-popover-right{margin-left:.5rem}.bs-popover-auto[x-placement^=right]>.arrow,.bs-popover-right>.arrow{left:calc((.5rem + 1px) * -1);width:.5rem;height:1rem;margin:.3rem 0}.bs-popover-auto[x-placement^=right]>.arrow::before,.bs-popover-right>.arrow::before{left:0;border-width:.5rem .5rem .5rem 0;border-right-color:rgba(0,0,0,.25)}.bs-popover-auto[x-placement^=right]>.arrow::after,.bs-popover-right>.arrow::after{left:1px;border-width:.5rem .5rem .5rem 0;border-right-color:#fff}.bs-popover-auto[x-placement^=bottom],.bs-popover-bottom{margin-top:.5rem}.bs-popover-auto[x-placement^=bottom]>.arrow,.bs-popover-bottom>.arrow{top:calc((.5rem + 1px) * -1)}.bs-popover-auto[x-placement^=bottom]>.arrow::before,.bs-popover-bottom>.arrow::before{top:0;border-width:0 .5rem .5rem .5rem;border-bottom-color:rgba(0,0,0,.25)}.bs-popover-auto[x-placement^=bottom]>.arrow::after,.bs-popover-bottom>.arrow::after{top:1px;border-width:0 .5rem .5rem .5rem;border-bottom-color:#fff}.bs-popover-auto[x-placement^=bottom] .popover-header::before,.bs-popover-bottom .popover-header::before{position:absolute;top:0;left:50%;display:block;width:1rem;margin-left:-.5rem;content:\"\";border-bottom:1px solid #f7f7f7}.bs-popover-auto[x-placement^=left],.bs-popover-left{margin-right:.5rem}.bs-popover-auto[x-placement^=left]>.arrow,.bs-popover-left>.arrow{right:calc((.5rem + 1px) * -1);width:.5rem;height:1rem;margin:.3rem 0}.bs-popover-auto[x-placement^=left]>.arrow::before,.bs-popover-left>.arrow::before{right:0;border-width:.5rem 0 .5rem .5rem;border-left-color:rgba(0,0,0,.25)}.bs-popover-auto[x-placement^=left]>.arrow::after,.bs-popover-left>.arrow::after{right:1px;border-width:.5rem 0 .5rem .5rem;border-left-color:#fff}.popover-header{padding:.5rem .75rem;margin-bottom:0;font-size:1rem;background-color:#f7f7f7;border-bottom:1px solid #ebebeb;border-top-left-radius:calc(.3rem - 1px);border-top-right-radius:calc(.3rem - 1px)}.popover-header:empty{display:none}.popover-body{padding:.5rem .75rem;color:#212529}.carousel{position:relative}.carousel.pointer-event{touch-action:pan-y}.carousel-inner{position:relative;width:100%;overflow:hidden}.carousel-inner::after{display:block;clear:both;content:\"\"}.carousel-item{position:relative;display:none;float:left;width:100%;margin-right:-100%;-webkit-backface-visibility:hidden;backface-visibility:hidden;transition:-webkit-transform .6s ease-in-out;transition:transform .6s ease-in-out;transition:transform .6s ease-in-out, -webkit-transform .6s ease-in-out;transition:transform .6s ease-in-out,-webkit-transform .6s ease-in-out}@media (prefers-reduced-motion:reduce){.carousel-item{transition:none}}.carousel-item-next,.carousel-item-prev,.carousel-item.active{display:block}.active.carousel-item-right,.carousel-item-next:not(.carousel-item-left){-webkit-transform:translateX(100%);transform:translateX(100%)}.active.carousel-item-left,.carousel-item-prev:not(.carousel-item-right){-webkit-transform:translateX(-100%);transform:translateX(-100%)}.carousel-fade .carousel-item{opacity:0;transition-property:opacity;-webkit-transform:none;transform:none}.carousel-fade .carousel-item-next.carousel-item-left,.carousel-fade .carousel-item-prev.carousel-item-right,.carousel-fade .carousel-item.active{z-index:1;opacity:1}.carousel-fade .active.carousel-item-left,.carousel-fade .active.carousel-item-right{z-index:0;opacity:0;transition:0s .6s opacity}@media (prefers-reduced-motion:reduce){.carousel-fade .active.carousel-item-left,.carousel-fade .active.carousel-item-right{transition:none}}.carousel-control-next,.carousel-control-prev{position:absolute;top:0;bottom:0;z-index:1;display:flex;align-items:center;justify-content:center;width:15%;color:#fff;text-align:center;opacity:.5;transition:opacity .15s ease}@media (prefers-reduced-motion:reduce){.carousel-control-next,.carousel-control-prev{transition:none}}.carousel-control-next:focus,.carousel-control-next:hover,.carousel-control-prev:focus,.carousel-control-prev:hover{color:#fff;text-decoration:none;outline:0;opacity:.9}.carousel-control-prev{left:0}.carousel-control-next{right:0}.carousel-control-next-icon,.carousel-control-prev-icon{display:inline-block;width:20px;height:20px;background:no-repeat 50%/100% 100%}.carousel-control-prev-icon{background-image:url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='%23fff' viewBox='0 0 8 8'%3e%3cpath d='M5.25 0l-4 4 4 4 1.5-1.5-2.5-2.5 2.5-2.5-1.5-1.5z'/%3e%3c/svg%3e\")}.carousel-control-next-icon{background-image:url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='%23fff' viewBox='0 0 8 8'%3e%3cpath d='M2.75 0l-1.5 1.5 2.5 2.5-2.5 2.5 1.5 1.5 4-4-4-4z'/%3e%3c/svg%3e\")}.carousel-indicators{position:absolute;right:0;bottom:0;left:0;z-index:15;display:flex;justify-content:center;padding-left:0;margin-right:15%;margin-left:15%;list-style:none}.carousel-indicators li{box-sizing:content-box;flex:0 1 auto;width:30px;height:3px;margin-right:3px;margin-left:3px;text-indent:-999px;cursor:pointer;background-color:#fff;background-clip:padding-box;border-top:10px solid transparent;border-bottom:10px solid transparent;opacity:.5;transition:opacity .6s ease}@media (prefers-reduced-motion:reduce){.carousel-indicators li{transition:none}}.carousel-indicators .active{opacity:1}.carousel-caption{position:absolute;right:15%;bottom:20px;left:15%;z-index:10;padding-top:20px;padding-bottom:20px;color:#fff;text-align:center}@-webkit-keyframes spinner-border{to{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes spinner-border{to{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}.spinner-border{display:inline-block;width:2rem;height:2rem;vertical-align:text-bottom;border:.25em solid currentColor;border-right-color:transparent;border-radius:50%;-webkit-animation:spinner-border .75s linear infinite;animation:spinner-border .75s linear infinite}.spinner-border-sm{width:1rem;height:1rem;border-width:.2em}@-webkit-keyframes spinner-grow{0%{-webkit-transform:scale(0);transform:scale(0)}50%{opacity:1}}@keyframes spinner-grow{0%{-webkit-transform:scale(0);transform:scale(0)}50%{opacity:1}}.spinner-grow{display:inline-block;width:2rem;height:2rem;vertical-align:text-bottom;background-color:currentColor;border-radius:50%;opacity:0;-webkit-animation:spinner-grow .75s linear infinite;animation:spinner-grow .75s linear infinite}.spinner-grow-sm{width:1rem;height:1rem}.align-baseline{vertical-align:baseline!important}.align-top{vertical-align:top!important}.align-middle{vertical-align:middle!important}.align-bottom{vertical-align:bottom!important}.align-text-bottom{vertical-align:text-bottom!important}.align-text-top{vertical-align:text-top!important}.bg-primary{background-color:#007bff!important}a.bg-primary:focus,a.bg-primary:hover,button.bg-primary:focus,button.bg-primary:hover{background-color:#0062cc!important}.bg-secondary{background-color:#6c757d!important}a.bg-secondary:focus,a.bg-secondary:hover,button.bg-secondary:focus,button.bg-secondary:hover{background-color:#545b62!important}.bg-success{background-color:#28a745!important}a.bg-success:focus,a.bg-success:hover,button.bg-success:focus,button.bg-success:hover{background-color:#1e7e34!important}.bg-info{background-color:#17a2b8!important}a.bg-info:focus,a.bg-info:hover,button.bg-info:focus,button.bg-info:hover{background-color:#117a8b!important}.bg-warning{background-color:#ffc107!important}a.bg-warning:focus,a.bg-warning:hover,button.bg-warning:focus,button.bg-warning:hover{background-color:#d39e00!important}.bg-danger{background-color:#dc3545!important}a.bg-danger:focus,a.bg-danger:hover,button.bg-danger:focus,button.bg-danger:hover{background-color:#bd2130!important}.bg-light{background-color:#f8f9fa!important}a.bg-light:focus,a.bg-light:hover,button.bg-light:focus,button.bg-light:hover{background-color:#dae0e5!important}.bg-dark{background-color:#343a40!important}a.bg-dark:focus,a.bg-dark:hover,button.bg-dark:focus,button.bg-dark:hover{background-color:#1d2124!important}.bg-white{background-color:#fff!important}.bg-transparent{background-color:transparent!important}.border{border:1px solid #dee2e6!important}.border-top{border-top:1px solid #dee2e6!important}.border-right{border-right:1px solid #dee2e6!important}.border-bottom{border-bottom:1px solid #dee2e6!important}.border-left{border-left:1px solid #dee2e6!important}.border-0{border:0!important}.border-top-0{border-top:0!important}.border-right-0{border-right:0!important}.border-bottom-0{border-bottom:0!important}.border-left-0{border-left:0!important}.border-primary{border-color:#007bff!important}.border-secondary{border-color:#6c757d!important}.border-success{border-color:#28a745!important}.border-info{border-color:#17a2b8!important}.border-warning{border-color:#ffc107!important}.border-danger{border-color:#dc3545!important}.border-light{border-color:#f8f9fa!important}.border-dark{border-color:#343a40!important}.border-white{border-color:#fff!important}.rounded-sm{border-radius:.2rem!important}.rounded{border-radius:.25rem!important}.rounded-top{border-top-left-radius:.25rem!important;border-top-right-radius:.25rem!important}.rounded-right{border-top-right-radius:.25rem!important;border-bottom-right-radius:.25rem!important}.rounded-bottom{border-bottom-right-radius:.25rem!important;border-bottom-left-radius:.25rem!important}.rounded-left{border-top-left-radius:.25rem!important;border-bottom-left-radius:.25rem!important}.rounded-lg{border-radius:.3rem!important}.rounded-circle{border-radius:50%!important}.rounded-pill{border-radius:50rem!important}.rounded-0{border-radius:0!important}.clearfix::after{display:block;clear:both;content:\"\"}.d-none{display:none!important}.d-inline{display:inline!important}.d-inline-block{display:inline-block!important}.d-block{display:block!important}.d-table{display:table!important}.d-table-row{display:table-row!important}.d-table-cell{display:table-cell!important}.d-flex{display:flex!important}.d-inline-flex{display:inline-flex!important}@media (min-width:576px){.d-sm-none{display:none!important}.d-sm-inline{display:inline!important}.d-sm-inline-block{display:inline-block!important}.d-sm-block{display:block!important}.d-sm-table{display:table!important}.d-sm-table-row{display:table-row!important}.d-sm-table-cell{display:table-cell!important}.d-sm-flex{display:flex!important}.d-sm-inline-flex{display:inline-flex!important}}@media (min-width:768px){.d-md-none{display:none!important}.d-md-inline{display:inline!important}.d-md-inline-block{display:inline-block!important}.d-md-block{display:block!important}.d-md-table{display:table!important}.d-md-table-row{display:table-row!important}.d-md-table-cell{display:table-cell!important}.d-md-flex{display:flex!important}.d-md-inline-flex{display:inline-flex!important}}@media (min-width:992px){.d-lg-none{display:none!important}.d-lg-inline{display:inline!important}.d-lg-inline-block{display:inline-block!important}.d-lg-block{display:block!important}.d-lg-table{display:table!important}.d-lg-table-row{display:table-row!important}.d-lg-table-cell{display:table-cell!important}.d-lg-flex{display:flex!important}.d-lg-inline-flex{display:inline-flex!important}}@media (min-width:1200px){.d-xl-none{display:none!important}.d-xl-inline{display:inline!important}.d-xl-inline-block{display:inline-block!important}.d-xl-block{display:block!important}.d-xl-table{display:table!important}.d-xl-table-row{display:table-row!important}.d-xl-table-cell{display:table-cell!important}.d-xl-flex{display:flex!important}.d-xl-inline-flex{display:inline-flex!important}}@media print{.d-print-none{display:none!important}.d-print-inline{display:inline!important}.d-print-inline-block{display:inline-block!important}.d-print-block{display:block!important}.d-print-table{display:table!important}.d-print-table-row{display:table-row!important}.d-print-table-cell{display:table-cell!important}.d-print-flex{display:flex!important}.d-print-inline-flex{display:inline-flex!important}}.embed-responsive{position:relative;display:block;width:100%;padding:0;overflow:hidden}.embed-responsive::before{display:block;content:\"\"}.embed-responsive .embed-responsive-item,.embed-responsive embed,.embed-responsive iframe,.embed-responsive object,.embed-responsive video{position:absolute;top:0;bottom:0;left:0;width:100%;height:100%;border:0}.embed-responsive-21by9::before{padding-top:42.857143%}.embed-responsive-16by9::before{padding-top:56.25%}.embed-responsive-4by3::before{padding-top:75%}.embed-responsive-1by1::before{padding-top:100%}.flex-row{flex-direction:row!important}.flex-column{flex-direction:column!important}.flex-row-reverse{flex-direction:row-reverse!important}.flex-column-reverse{flex-direction:column-reverse!important}.flex-wrap{flex-wrap:wrap!important}.flex-nowrap{flex-wrap:nowrap!important}.flex-wrap-reverse{flex-wrap:wrap-reverse!important}.flex-fill{flex:1 1 auto!important}.flex-grow-0{flex-grow:0!important}.flex-grow-1{flex-grow:1!important}.flex-shrink-0{flex-shrink:0!important}.flex-shrink-1{flex-shrink:1!important}.justify-content-start{justify-content:flex-start!important}.justify-content-end{justify-content:flex-end!important}.justify-content-center{justify-content:center!important}.justify-content-between{justify-content:space-between!important}.justify-content-around{justify-content:space-around!important}.align-items-start{align-items:flex-start!important}.align-items-end{align-items:flex-end!important}.align-items-center{align-items:center!important}.align-items-baseline{align-items:baseline!important}.align-items-stretch{align-items:stretch!important}.align-content-start{align-content:flex-start!important}.align-content-end{align-content:flex-end!important}.align-content-center{align-content:center!important}.align-content-between{align-content:space-between!important}.align-content-around{align-content:space-around!important}.align-content-stretch{align-content:stretch!important}.align-self-auto{-ms-grid-row-align:auto!important;align-self:auto!important}.align-self-start{align-self:flex-start!important}.align-self-end{align-self:flex-end!important}.align-self-center{-ms-grid-row-align:center!important;align-self:center!important}.align-self-baseline{align-self:baseline!important}.align-self-stretch{-ms-grid-row-align:stretch!important;align-self:stretch!important}@media (min-width:576px){.flex-sm-row{flex-direction:row!important}.flex-sm-column{flex-direction:column!important}.flex-sm-row-reverse{flex-direction:row-reverse!important}.flex-sm-column-reverse{flex-direction:column-reverse!important}.flex-sm-wrap{flex-wrap:wrap!important}.flex-sm-nowrap{flex-wrap:nowrap!important}.flex-sm-wrap-reverse{flex-wrap:wrap-reverse!important}.flex-sm-fill{flex:1 1 auto!important}.flex-sm-grow-0{flex-grow:0!important}.flex-sm-grow-1{flex-grow:1!important}.flex-sm-shrink-0{flex-shrink:0!important}.flex-sm-shrink-1{flex-shrink:1!important}.justify-content-sm-start{justify-content:flex-start!important}.justify-content-sm-end{justify-content:flex-end!important}.justify-content-sm-center{justify-content:center!important}.justify-content-sm-between{justify-content:space-between!important}.justify-content-sm-around{justify-content:space-around!important}.align-items-sm-start{align-items:flex-start!important}.align-items-sm-end{align-items:flex-end!important}.align-items-sm-center{align-items:center!important}.align-items-sm-baseline{align-items:baseline!important}.align-items-sm-stretch{align-items:stretch!important}.align-content-sm-start{align-content:flex-start!important}.align-content-sm-end{align-content:flex-end!important}.align-content-sm-center{align-content:center!important}.align-content-sm-between{align-content:space-between!important}.align-content-sm-around{align-content:space-around!important}.align-content-sm-stretch{align-content:stretch!important}.align-self-sm-auto{-ms-grid-row-align:auto!important;align-self:auto!important}.align-self-sm-start{align-self:flex-start!important}.align-self-sm-end{align-self:flex-end!important}.align-self-sm-center{-ms-grid-row-align:center!important;align-self:center!important}.align-self-sm-baseline{align-self:baseline!important}.align-self-sm-stretch{-ms-grid-row-align:stretch!important;align-self:stretch!important}}@media (min-width:768px){.flex-md-row{flex-direction:row!important}.flex-md-column{flex-direction:column!important}.flex-md-row-reverse{flex-direction:row-reverse!important}.flex-md-column-reverse{flex-direction:column-reverse!important}.flex-md-wrap{flex-wrap:wrap!important}.flex-md-nowrap{flex-wrap:nowrap!important}.flex-md-wrap-reverse{flex-wrap:wrap-reverse!important}.flex-md-fill{flex:1 1 auto!important}.flex-md-grow-0{flex-grow:0!important}.flex-md-grow-1{flex-grow:1!important}.flex-md-shrink-0{flex-shrink:0!important}.flex-md-shrink-1{flex-shrink:1!important}.justify-content-md-start{justify-content:flex-start!important}.justify-content-md-end{justify-content:flex-end!important}.justify-content-md-center{justify-content:center!important}.justify-content-md-between{justify-content:space-between!important}.justify-content-md-around{justify-content:space-around!important}.align-items-md-start{align-items:flex-start!important}.align-items-md-end{align-items:flex-end!important}.align-items-md-center{align-items:center!important}.align-items-md-baseline{align-items:baseline!important}.align-items-md-stretch{align-items:stretch!important}.align-content-md-start{align-content:flex-start!important}.align-content-md-end{align-content:flex-end!important}.align-content-md-center{align-content:center!important}.align-content-md-between{align-content:space-between!important}.align-content-md-around{align-content:space-around!important}.align-content-md-stretch{align-content:stretch!important}.align-self-md-auto{-ms-grid-row-align:auto!important;align-self:auto!important}.align-self-md-start{align-self:flex-start!important}.align-self-md-end{align-self:flex-end!important}.align-self-md-center{-ms-grid-row-align:center!important;align-self:center!important}.align-self-md-baseline{align-self:baseline!important}.align-self-md-stretch{-ms-grid-row-align:stretch!important;align-self:stretch!important}}@media (min-width:992px){.flex-lg-row{flex-direction:row!important}.flex-lg-column{flex-direction:column!important}.flex-lg-row-reverse{flex-direction:row-reverse!important}.flex-lg-column-reverse{flex-direction:column-reverse!important}.flex-lg-wrap{flex-wrap:wrap!important}.flex-lg-nowrap{flex-wrap:nowrap!important}.flex-lg-wrap-reverse{flex-wrap:wrap-reverse!important}.flex-lg-fill{flex:1 1 auto!important}.flex-lg-grow-0{flex-grow:0!important}.flex-lg-grow-1{flex-grow:1!important}.flex-lg-shrink-0{flex-shrink:0!important}.flex-lg-shrink-1{flex-shrink:1!important}.justify-content-lg-start{justify-content:flex-start!important}.justify-content-lg-end{justify-content:flex-end!important}.justify-content-lg-center{justify-content:center!important}.justify-content-lg-between{justify-content:space-between!important}.justify-content-lg-around{justify-content:space-around!important}.align-items-lg-start{align-items:flex-start!important}.align-items-lg-end{align-items:flex-end!important}.align-items-lg-center{align-items:center!important}.align-items-lg-baseline{align-items:baseline!important}.align-items-lg-stretch{align-items:stretch!important}.align-content-lg-start{align-content:flex-start!important}.align-content-lg-end{align-content:flex-end!important}.align-content-lg-center{align-content:center!important}.align-content-lg-between{align-content:space-between!important}.align-content-lg-around{align-content:space-around!important}.align-content-lg-stretch{align-content:stretch!important}.align-self-lg-auto{-ms-grid-row-align:auto!important;align-self:auto!important}.align-self-lg-start{align-self:flex-start!important}.align-self-lg-end{align-self:flex-end!important}.align-self-lg-center{-ms-grid-row-align:center!important;align-self:center!important}.align-self-lg-baseline{align-self:baseline!important}.align-self-lg-stretch{-ms-grid-row-align:stretch!important;align-self:stretch!important}}@media (min-width:1200px){.flex-xl-row{flex-direction:row!important}.flex-xl-column{flex-direction:column!important}.flex-xl-row-reverse{flex-direction:row-reverse!important}.flex-xl-column-reverse{flex-direction:column-reverse!important}.flex-xl-wrap{flex-wrap:wrap!important}.flex-xl-nowrap{flex-wrap:nowrap!important}.flex-xl-wrap-reverse{flex-wrap:wrap-reverse!important}.flex-xl-fill{flex:1 1 auto!important}.flex-xl-grow-0{flex-grow:0!important}.flex-xl-grow-1{flex-grow:1!important}.flex-xl-shrink-0{flex-shrink:0!important}.flex-xl-shrink-1{flex-shrink:1!important}.justify-content-xl-start{justify-content:flex-start!important}.justify-content-xl-end{justify-content:flex-end!important}.justify-content-xl-center{justify-content:center!important}.justify-content-xl-between{justify-content:space-between!important}.justify-content-xl-around{justify-content:space-around!important}.align-items-xl-start{align-items:flex-start!important}.align-items-xl-end{align-items:flex-end!important}.align-items-xl-center{align-items:center!important}.align-items-xl-baseline{align-items:baseline!important}.align-items-xl-stretch{align-items:stretch!important}.align-content-xl-start{align-content:flex-start!important}.align-content-xl-end{align-content:flex-end!important}.align-content-xl-center{align-content:center!important}.align-content-xl-between{align-content:space-between!important}.align-content-xl-around{align-content:space-around!important}.align-content-xl-stretch{align-content:stretch!important}.align-self-xl-auto{-ms-grid-row-align:auto!important;align-self:auto!important}.align-self-xl-start{align-self:flex-start!important}.align-self-xl-end{align-self:flex-end!important}.align-self-xl-center{-ms-grid-row-align:center!important;align-self:center!important}.align-self-xl-baseline{align-self:baseline!important}.align-self-xl-stretch{-ms-grid-row-align:stretch!important;align-self:stretch!important}}.float-left{float:left!important}.float-right{float:right!important}.float-none{float:none!important}@media (min-width:576px){.float-sm-left{float:left!important}.float-sm-right{float:right!important}.float-sm-none{float:none!important}}@media (min-width:768px){.float-md-left{float:left!important}.float-md-right{float:right!important}.float-md-none{float:none!important}}@media (min-width:992px){.float-lg-left{float:left!important}.float-lg-right{float:right!important}.float-lg-none{float:none!important}}@media (min-width:1200px){.float-xl-left{float:left!important}.float-xl-right{float:right!important}.float-xl-none{float:none!important}}.overflow-auto{overflow:auto!important}.overflow-hidden{overflow:hidden!important}.position-static{position:static!important}.position-relative{position:relative!important}.position-absolute{position:absolute!important}.position-fixed{position:fixed!important}.position-sticky{position:-webkit-sticky!important;position:sticky!important}.fixed-top{position:fixed;top:0;right:0;left:0;z-index:1030}.fixed-bottom{position:fixed;right:0;bottom:0;left:0;z-index:1030}@supports ((position: -webkit-sticky) or (position: sticky)){.sticky-top{position:-webkit-sticky;position:sticky;top:0;z-index:1020}}.sr-only{position:absolute;width:1px;height:1px;padding:0;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}.sr-only-focusable:active,.sr-only-focusable:focus{position:static;width:auto;height:auto;overflow:visible;clip:auto;white-space:normal}.shadow-sm{box-shadow:0 .125rem .25rem rgba(0,0,0,.075)!important}.shadow{box-shadow:0 .5rem 1rem rgba(0,0,0,.15)!important}.shadow-lg{box-shadow:0 1rem 3rem rgba(0,0,0,.175)!important}.shadow-none{box-shadow:none!important}.w-25{width:25%!important}.w-50{width:50%!important}.w-75{width:75%!important}.w-100{width:100%!important}.w-auto{width:auto!important}.h-25{height:25%!important}.h-50{height:50%!important}.h-75{height:75%!important}.h-100{height:100%!important}.h-auto{height:auto!important}.mw-100{max-width:100%!important}.mh-100{max-height:100%!important}.min-vw-100{min-width:100vw!important}.min-vh-100{min-height:100vh!important}.vw-100{width:100vw!important}.vh-100{height:100vh!important}.stretched-link::after{position:absolute;top:0;right:0;bottom:0;left:0;z-index:1;pointer-events:auto;content:\"\";background-color:rgba(0,0,0,0)}.m-0{margin:0!important}.mt-0,.my-0{margin-top:0!important}.mr-0,.mx-0{margin-right:0!important}.mb-0,.my-0{margin-bottom:0!important}.ml-0,.mx-0{margin-left:0!important}.m-1{margin:.25rem!important}.mt-1,.my-1{margin-top:.25rem!important}.mr-1,.mx-1{margin-right:.25rem!important}.mb-1,.my-1{margin-bottom:.25rem!important}.ml-1,.mx-1{margin-left:.25rem!important}.m-2{margin:.5rem!important}.mt-2,.my-2{margin-top:.5rem!important}.mr-2,.mx-2{margin-right:.5rem!important}.mb-2,.my-2{margin-bottom:.5rem!important}.ml-2,.mx-2{margin-left:.5rem!important}.m-3{margin:1rem!important}.mt-3,.my-3{margin-top:1rem!important}.mr-3,.mx-3{margin-right:1rem!important}.mb-3,.my-3{margin-bottom:1rem!important}.ml-3,.mx-3{margin-left:1rem!important}.m-4{margin:1.5rem!important}.mt-4,.my-4{margin-top:1.5rem!important}.mr-4,.mx-4{margin-right:1.5rem!important}.mb-4,.my-4{margin-bottom:1.5rem!important}.ml-4,.mx-4{margin-left:1.5rem!important}.m-5{margin:3rem!important}.mt-5,.my-5{margin-top:3rem!important}.mr-5,.mx-5{margin-right:3rem!important}.mb-5,.my-5{margin-bottom:3rem!important}.ml-5,.mx-5{margin-left:3rem!important}.p-0{padding:0!important}.pt-0,.py-0{padding-top:0!important}.pr-0,.px-0{padding-right:0!important}.pb-0,.py-0{padding-bottom:0!important}.pl-0,.px-0{padding-left:0!important}.p-1{padding:.25rem!important}.pt-1,.py-1{padding-top:.25rem!important}.pr-1,.px-1{padding-right:.25rem!important}.pb-1,.py-1{padding-bottom:.25rem!important}.pl-1,.px-1{padding-left:.25rem!important}.p-2{padding:.5rem!important}.pt-2,.py-2{padding-top:.5rem!important}.pr-2,.px-2{padding-right:.5rem!important}.pb-2,.py-2{padding-bottom:.5rem!important}.pl-2,.px-2{padding-left:.5rem!important}.p-3{padding:1rem!important}.pt-3,.py-3{padding-top:1rem!important}.pr-3,.px-3{padding-right:1rem!important}.pb-3,.py-3{padding-bottom:1rem!important}.pl-3,.px-3{padding-left:1rem!important}.p-4{padding:1.5rem!important}.pt-4,.py-4{padding-top:1.5rem!important}.pr-4,.px-4{padding-right:1.5rem!important}.pb-4,.py-4{padding-bottom:1.5rem!important}.pl-4,.px-4{padding-left:1.5rem!important}.p-5{padding:3rem!important}.pt-5,.py-5{padding-top:3rem!important}.pr-5,.px-5{padding-right:3rem!important}.pb-5,.py-5{padding-bottom:3rem!important}.pl-5,.px-5{padding-left:3rem!important}.m-n1{margin:-.25rem!important}.mt-n1,.my-n1{margin-top:-.25rem!important}.mr-n1,.mx-n1{margin-right:-.25rem!important}.mb-n1,.my-n1{margin-bottom:-.25rem!important}.ml-n1,.mx-n1{margin-left:-.25rem!important}.m-n2{margin:-.5rem!important}.mt-n2,.my-n2{margin-top:-.5rem!important}.mr-n2,.mx-n2{margin-right:-.5rem!important}.mb-n2,.my-n2{margin-bottom:-.5rem!important}.ml-n2,.mx-n2{margin-left:-.5rem!important}.m-n3{margin:-1rem!important}.mt-n3,.my-n3{margin-top:-1rem!important}.mr-n3,.mx-n3{margin-right:-1rem!important}.mb-n3,.my-n3{margin-bottom:-1rem!important}.ml-n3,.mx-n3{margin-left:-1rem!important}.m-n4{margin:-1.5rem!important}.mt-n4,.my-n4{margin-top:-1.5rem!important}.mr-n4,.mx-n4{margin-right:-1.5rem!important}.mb-n4,.my-n4{margin-bottom:-1.5rem!important}.ml-n4,.mx-n4{margin-left:-1.5rem!important}.m-n5{margin:-3rem!important}.mt-n5,.my-n5{margin-top:-3rem!important}.mr-n5,.mx-n5{margin-right:-3rem!important}.mb-n5,.my-n5{margin-bottom:-3rem!important}.ml-n5,.mx-n5{margin-left:-3rem!important}.m-auto{margin:auto!important}.mt-auto,.my-auto{margin-top:auto!important}.mr-auto,.mx-auto{margin-right:auto!important}.mb-auto,.my-auto{margin-bottom:auto!important}.ml-auto,.mx-auto{margin-left:auto!important}@media (min-width:576px){.m-sm-0{margin:0!important}.mt-sm-0,.my-sm-0{margin-top:0!important}.mr-sm-0,.mx-sm-0{margin-right:0!important}.mb-sm-0,.my-sm-0{margin-bottom:0!important}.ml-sm-0,.mx-sm-0{margin-left:0!important}.m-sm-1{margin:.25rem!important}.mt-sm-1,.my-sm-1{margin-top:.25rem!important}.mr-sm-1,.mx-sm-1{margin-right:.25rem!important}.mb-sm-1,.my-sm-1{margin-bottom:.25rem!important}.ml-sm-1,.mx-sm-1{margin-left:.25rem!important}.m-sm-2{margin:.5rem!important}.mt-sm-2,.my-sm-2{margin-top:.5rem!important}.mr-sm-2,.mx-sm-2{margin-right:.5rem!important}.mb-sm-2,.my-sm-2{margin-bottom:.5rem!important}.ml-sm-2,.mx-sm-2{margin-left:.5rem!important}.m-sm-3{margin:1rem!important}.mt-sm-3,.my-sm-3{margin-top:1rem!important}.mr-sm-3,.mx-sm-3{margin-right:1rem!important}.mb-sm-3,.my-sm-3{margin-bottom:1rem!important}.ml-sm-3,.mx-sm-3{margin-left:1rem!important}.m-sm-4{margin:1.5rem!important}.mt-sm-4,.my-sm-4{margin-top:1.5rem!important}.mr-sm-4,.mx-sm-4{margin-right:1.5rem!important}.mb-sm-4,.my-sm-4{margin-bottom:1.5rem!important}.ml-sm-4,.mx-sm-4{margin-left:1.5rem!important}.m-sm-5{margin:3rem!important}.mt-sm-5,.my-sm-5{margin-top:3rem!important}.mr-sm-5,.mx-sm-5{margin-right:3rem!important}.mb-sm-5,.my-sm-5{margin-bottom:3rem!important}.ml-sm-5,.mx-sm-5{margin-left:3rem!important}.p-sm-0{padding:0!important}.pt-sm-0,.py-sm-0{padding-top:0!important}.pr-sm-0,.px-sm-0{padding-right:0!important}.pb-sm-0,.py-sm-0{padding-bottom:0!important}.pl-sm-0,.px-sm-0{padding-left:0!important}.p-sm-1{padding:.25rem!important}.pt-sm-1,.py-sm-1{padding-top:.25rem!important}.pr-sm-1,.px-sm-1{padding-right:.25rem!important}.pb-sm-1,.py-sm-1{padding-bottom:.25rem!important}.pl-sm-1,.px-sm-1{padding-left:.25rem!important}.p-sm-2{padding:.5rem!important}.pt-sm-2,.py-sm-2{padding-top:.5rem!important}.pr-sm-2,.px-sm-2{padding-right:.5rem!important}.pb-sm-2,.py-sm-2{padding-bottom:.5rem!important}.pl-sm-2,.px-sm-2{padding-left:.5rem!important}.p-sm-3{padding:1rem!important}.pt-sm-3,.py-sm-3{padding-top:1rem!important}.pr-sm-3,.px-sm-3{padding-right:1rem!important}.pb-sm-3,.py-sm-3{padding-bottom:1rem!important}.pl-sm-3,.px-sm-3{padding-left:1rem!important}.p-sm-4{padding:1.5rem!important}.pt-sm-4,.py-sm-4{padding-top:1.5rem!important}.pr-sm-4,.px-sm-4{padding-right:1.5rem!important}.pb-sm-4,.py-sm-4{padding-bottom:1.5rem!important}.pl-sm-4,.px-sm-4{padding-left:1.5rem!important}.p-sm-5{padding:3rem!important}.pt-sm-5,.py-sm-5{padding-top:3rem!important}.pr-sm-5,.px-sm-5{padding-right:3rem!important}.pb-sm-5,.py-sm-5{padding-bottom:3rem!important}.pl-sm-5,.px-sm-5{padding-left:3rem!important}.m-sm-n1{margin:-.25rem!important}.mt-sm-n1,.my-sm-n1{margin-top:-.25rem!important}.mr-sm-n1,.mx-sm-n1{margin-right:-.25rem!important}.mb-sm-n1,.my-sm-n1{margin-bottom:-.25rem!important}.ml-sm-n1,.mx-sm-n1{margin-left:-.25rem!important}.m-sm-n2{margin:-.5rem!important}.mt-sm-n2,.my-sm-n2{margin-top:-.5rem!important}.mr-sm-n2,.mx-sm-n2{margin-right:-.5rem!important}.mb-sm-n2,.my-sm-n2{margin-bottom:-.5rem!important}.ml-sm-n2,.mx-sm-n2{margin-left:-.5rem!important}.m-sm-n3{margin:-1rem!important}.mt-sm-n3,.my-sm-n3{margin-top:-1rem!important}.mr-sm-n3,.mx-sm-n3{margin-right:-1rem!important}.mb-sm-n3,.my-sm-n3{margin-bottom:-1rem!important}.ml-sm-n3,.mx-sm-n3{margin-left:-1rem!important}.m-sm-n4{margin:-1.5rem!important}.mt-sm-n4,.my-sm-n4{margin-top:-1.5rem!important}.mr-sm-n4,.mx-sm-n4{margin-right:-1.5rem!important}.mb-sm-n4,.my-sm-n4{margin-bottom:-1.5rem!important}.ml-sm-n4,.mx-sm-n4{margin-left:-1.5rem!important}.m-sm-n5{margin:-3rem!important}.mt-sm-n5,.my-sm-n5{margin-top:-3rem!important}.mr-sm-n5,.mx-sm-n5{margin-right:-3rem!important}.mb-sm-n5,.my-sm-n5{margin-bottom:-3rem!important}.ml-sm-n5,.mx-sm-n5{margin-left:-3rem!important}.m-sm-auto{margin:auto!important}.mt-sm-auto,.my-sm-auto{margin-top:auto!important}.mr-sm-auto,.mx-sm-auto{margin-right:auto!important}.mb-sm-auto,.my-sm-auto{margin-bottom:auto!important}.ml-sm-auto,.mx-sm-auto{margin-left:auto!important}}@media (min-width:768px){.m-md-0{margin:0!important}.mt-md-0,.my-md-0{margin-top:0!important}.mr-md-0,.mx-md-0{margin-right:0!important}.mb-md-0,.my-md-0{margin-bottom:0!important}.ml-md-0,.mx-md-0{margin-left:0!important}.m-md-1{margin:.25rem!important}.mt-md-1,.my-md-1{margin-top:.25rem!important}.mr-md-1,.mx-md-1{margin-right:.25rem!important}.mb-md-1,.my-md-1{margin-bottom:.25rem!important}.ml-md-1,.mx-md-1{margin-left:.25rem!important}.m-md-2{margin:.5rem!important}.mt-md-2,.my-md-2{margin-top:.5rem!important}.mr-md-2,.mx-md-2{margin-right:.5rem!important}.mb-md-2,.my-md-2{margin-bottom:.5rem!important}.ml-md-2,.mx-md-2{margin-left:.5rem!important}.m-md-3{margin:1rem!important}.mt-md-3,.my-md-3{margin-top:1rem!important}.mr-md-3,.mx-md-3{margin-right:1rem!important}.mb-md-3,.my-md-3{margin-bottom:1rem!important}.ml-md-3,.mx-md-3{margin-left:1rem!important}.m-md-4{margin:1.5rem!important}.mt-md-4,.my-md-4{margin-top:1.5rem!important}.mr-md-4,.mx-md-4{margin-right:1.5rem!important}.mb-md-4,.my-md-4{margin-bottom:1.5rem!important}.ml-md-4,.mx-md-4{margin-left:1.5rem!important}.m-md-5{margin:3rem!important}.mt-md-5,.my-md-5{margin-top:3rem!important}.mr-md-5,.mx-md-5{margin-right:3rem!important}.mb-md-5,.my-md-5{margin-bottom:3rem!important}.ml-md-5,.mx-md-5{margin-left:3rem!important}.p-md-0{padding:0!important}.pt-md-0,.py-md-0{padding-top:0!important}.pr-md-0,.px-md-0{padding-right:0!important}.pb-md-0,.py-md-0{padding-bottom:0!important}.pl-md-0,.px-md-0{padding-left:0!important}.p-md-1{padding:.25rem!important}.pt-md-1,.py-md-1{padding-top:.25rem!important}.pr-md-1,.px-md-1{padding-right:.25rem!important}.pb-md-1,.py-md-1{padding-bottom:.25rem!important}.pl-md-1,.px-md-1{padding-left:.25rem!important}.p-md-2{padding:.5rem!important}.pt-md-2,.py-md-2{padding-top:.5rem!important}.pr-md-2,.px-md-2{padding-right:.5rem!important}.pb-md-2,.py-md-2{padding-bottom:.5rem!important}.pl-md-2,.px-md-2{padding-left:.5rem!important}.p-md-3{padding:1rem!important}.pt-md-3,.py-md-3{padding-top:1rem!important}.pr-md-3,.px-md-3{padding-right:1rem!important}.pb-md-3,.py-md-3{padding-bottom:1rem!important}.pl-md-3,.px-md-3{padding-left:1rem!important}.p-md-4{padding:1.5rem!important}.pt-md-4,.py-md-4{padding-top:1.5rem!important}.pr-md-4,.px-md-4{padding-right:1.5rem!important}.pb-md-4,.py-md-4{padding-bottom:1.5rem!important}.pl-md-4,.px-md-4{padding-left:1.5rem!important}.p-md-5{padding:3rem!important}.pt-md-5,.py-md-5{padding-top:3rem!important}.pr-md-5,.px-md-5{padding-right:3rem!important}.pb-md-5,.py-md-5{padding-bottom:3rem!important}.pl-md-5,.px-md-5{padding-left:3rem!important}.m-md-n1{margin:-.25rem!important}.mt-md-n1,.my-md-n1{margin-top:-.25rem!important}.mr-md-n1,.mx-md-n1{margin-right:-.25rem!important}.mb-md-n1,.my-md-n1{margin-bottom:-.25rem!important}.ml-md-n1,.mx-md-n1{margin-left:-.25rem!important}.m-md-n2{margin:-.5rem!important}.mt-md-n2,.my-md-n2{margin-top:-.5rem!important}.mr-md-n2,.mx-md-n2{margin-right:-.5rem!important}.mb-md-n2,.my-md-n2{margin-bottom:-.5rem!important}.ml-md-n2,.mx-md-n2{margin-left:-.5rem!important}.m-md-n3{margin:-1rem!important}.mt-md-n3,.my-md-n3{margin-top:-1rem!important}.mr-md-n3,.mx-md-n3{margin-right:-1rem!important}.mb-md-n3,.my-md-n3{margin-bottom:-1rem!important}.ml-md-n3,.mx-md-n3{margin-left:-1rem!important}.m-md-n4{margin:-1.5rem!important}.mt-md-n4,.my-md-n4{margin-top:-1.5rem!important}.mr-md-n4,.mx-md-n4{margin-right:-1.5rem!important}.mb-md-n4,.my-md-n4{margin-bottom:-1.5rem!important}.ml-md-n4,.mx-md-n4{margin-left:-1.5rem!important}.m-md-n5{margin:-3rem!important}.mt-md-n5,.my-md-n5{margin-top:-3rem!important}.mr-md-n5,.mx-md-n5{margin-right:-3rem!important}.mb-md-n5,.my-md-n5{margin-bottom:-3rem!important}.ml-md-n5,.mx-md-n5{margin-left:-3rem!important}.m-md-auto{margin:auto!important}.mt-md-auto,.my-md-auto{margin-top:auto!important}.mr-md-auto,.mx-md-auto{margin-right:auto!important}.mb-md-auto,.my-md-auto{margin-bottom:auto!important}.ml-md-auto,.mx-md-auto{margin-left:auto!important}}@media (min-width:992px){.m-lg-0{margin:0!important}.mt-lg-0,.my-lg-0{margin-top:0!important}.mr-lg-0,.mx-lg-0{margin-right:0!important}.mb-lg-0,.my-lg-0{margin-bottom:0!important}.ml-lg-0,.mx-lg-0{margin-left:0!important}.m-lg-1{margin:.25rem!important}.mt-lg-1,.my-lg-1{margin-top:.25rem!important}.mr-lg-1,.mx-lg-1{margin-right:.25rem!important}.mb-lg-1,.my-lg-1{margin-bottom:.25rem!important}.ml-lg-1,.mx-lg-1{margin-left:.25rem!important}.m-lg-2{margin:.5rem!important}.mt-lg-2,.my-lg-2{margin-top:.5rem!important}.mr-lg-2,.mx-lg-2{margin-right:.5rem!important}.mb-lg-2,.my-lg-2{margin-bottom:.5rem!important}.ml-lg-2,.mx-lg-2{margin-left:.5rem!important}.m-lg-3{margin:1rem!important}.mt-lg-3,.my-lg-3{margin-top:1rem!important}.mr-lg-3,.mx-lg-3{margin-right:1rem!important}.mb-lg-3,.my-lg-3{margin-bottom:1rem!important}.ml-lg-3,.mx-lg-3{margin-left:1rem!important}.m-lg-4{margin:1.5rem!important}.mt-lg-4,.my-lg-4{margin-top:1.5rem!important}.mr-lg-4,.mx-lg-4{margin-right:1.5rem!important}.mb-lg-4,.my-lg-4{margin-bottom:1.5rem!important}.ml-lg-4,.mx-lg-4{margin-left:1.5rem!important}.m-lg-5{margin:3rem!important}.mt-lg-5,.my-lg-5{margin-top:3rem!important}.mr-lg-5,.mx-lg-5{margin-right:3rem!important}.mb-lg-5,.my-lg-5{margin-bottom:3rem!important}.ml-lg-5,.mx-lg-5{margin-left:3rem!important}.p-lg-0{padding:0!important}.pt-lg-0,.py-lg-0{padding-top:0!important}.pr-lg-0,.px-lg-0{padding-right:0!important}.pb-lg-0,.py-lg-0{padding-bottom:0!important}.pl-lg-0,.px-lg-0{padding-left:0!important}.p-lg-1{padding:.25rem!important}.pt-lg-1,.py-lg-1{padding-top:.25rem!important}.pr-lg-1,.px-lg-1{padding-right:.25rem!important}.pb-lg-1,.py-lg-1{padding-bottom:.25rem!important}.pl-lg-1,.px-lg-1{padding-left:.25rem!important}.p-lg-2{padding:.5rem!important}.pt-lg-2,.py-lg-2{padding-top:.5rem!important}.pr-lg-2,.px-lg-2{padding-right:.5rem!important}.pb-lg-2,.py-lg-2{padding-bottom:.5rem!important}.pl-lg-2,.px-lg-2{padding-left:.5rem!important}.p-lg-3{padding:1rem!important}.pt-lg-3,.py-lg-3{padding-top:1rem!important}.pr-lg-3,.px-lg-3{padding-right:1rem!important}.pb-lg-3,.py-lg-3{padding-bottom:1rem!important}.pl-lg-3,.px-lg-3{padding-left:1rem!important}.p-lg-4{padding:1.5rem!important}.pt-lg-4,.py-lg-4{padding-top:1.5rem!important}.pr-lg-4,.px-lg-4{padding-right:1.5rem!important}.pb-lg-4,.py-lg-4{padding-bottom:1.5rem!important}.pl-lg-4,.px-lg-4{padding-left:1.5rem!important}.p-lg-5{padding:3rem!important}.pt-lg-5,.py-lg-5{padding-top:3rem!important}.pr-lg-5,.px-lg-5{padding-right:3rem!important}.pb-lg-5,.py-lg-5{padding-bottom:3rem!important}.pl-lg-5,.px-lg-5{padding-left:3rem!important}.m-lg-n1{margin:-.25rem!important}.mt-lg-n1,.my-lg-n1{margin-top:-.25rem!important}.mr-lg-n1,.mx-lg-n1{margin-right:-.25rem!important}.mb-lg-n1,.my-lg-n1{margin-bottom:-.25rem!important}.ml-lg-n1,.mx-lg-n1{margin-left:-.25rem!important}.m-lg-n2{margin:-.5rem!important}.mt-lg-n2,.my-lg-n2{margin-top:-.5rem!important}.mr-lg-n2,.mx-lg-n2{margin-right:-.5rem!important}.mb-lg-n2,.my-lg-n2{margin-bottom:-.5rem!important}.ml-lg-n2,.mx-lg-n2{margin-left:-.5rem!important}.m-lg-n3{margin:-1rem!important}.mt-lg-n3,.my-lg-n3{margin-top:-1rem!important}.mr-lg-n3,.mx-lg-n3{margin-right:-1rem!important}.mb-lg-n3,.my-lg-n3{margin-bottom:-1rem!important}.ml-lg-n3,.mx-lg-n3{margin-left:-1rem!important}.m-lg-n4{margin:-1.5rem!important}.mt-lg-n4,.my-lg-n4{margin-top:-1.5rem!important}.mr-lg-n4,.mx-lg-n4{margin-right:-1.5rem!important}.mb-lg-n4,.my-lg-n4{margin-bottom:-1.5rem!important}.ml-lg-n4,.mx-lg-n4{margin-left:-1.5rem!important}.m-lg-n5{margin:-3rem!important}.mt-lg-n5,.my-lg-n5{margin-top:-3rem!important}.mr-lg-n5,.mx-lg-n5{margin-right:-3rem!important}.mb-lg-n5,.my-lg-n5{margin-bottom:-3rem!important}.ml-lg-n5,.mx-lg-n5{margin-left:-3rem!important}.m-lg-auto{margin:auto!important}.mt-lg-auto,.my-lg-auto{margin-top:auto!important}.mr-lg-auto,.mx-lg-auto{margin-right:auto!important}.mb-lg-auto,.my-lg-auto{margin-bottom:auto!important}.ml-lg-auto,.mx-lg-auto{margin-left:auto!important}}@media (min-width:1200px){.m-xl-0{margin:0!important}.mt-xl-0,.my-xl-0{margin-top:0!important}.mr-xl-0,.mx-xl-0{margin-right:0!important}.mb-xl-0,.my-xl-0{margin-bottom:0!important}.ml-xl-0,.mx-xl-0{margin-left:0!important}.m-xl-1{margin:.25rem!important}.mt-xl-1,.my-xl-1{margin-top:.25rem!important}.mr-xl-1,.mx-xl-1{margin-right:.25rem!important}.mb-xl-1,.my-xl-1{margin-bottom:.25rem!important}.ml-xl-1,.mx-xl-1{margin-left:.25rem!important}.m-xl-2{margin:.5rem!important}.mt-xl-2,.my-xl-2{margin-top:.5rem!important}.mr-xl-2,.mx-xl-2{margin-right:.5rem!important}.mb-xl-2,.my-xl-2{margin-bottom:.5rem!important}.ml-xl-2,.mx-xl-2{margin-left:.5rem!important}.m-xl-3{margin:1rem!important}.mt-xl-3,.my-xl-3{margin-top:1rem!important}.mr-xl-3,.mx-xl-3{margin-right:1rem!important}.mb-xl-3,.my-xl-3{margin-bottom:1rem!important}.ml-xl-3,.mx-xl-3{margin-left:1rem!important}.m-xl-4{margin:1.5rem!important}.mt-xl-4,.my-xl-4{margin-top:1.5rem!important}.mr-xl-4,.mx-xl-4{margin-right:1.5rem!important}.mb-xl-4,.my-xl-4{margin-bottom:1.5rem!important}.ml-xl-4,.mx-xl-4{margin-left:1.5rem!important}.m-xl-5{margin:3rem!important}.mt-xl-5,.my-xl-5{margin-top:3rem!important}.mr-xl-5,.mx-xl-5{margin-right:3rem!important}.mb-xl-5,.my-xl-5{margin-bottom:3rem!important}.ml-xl-5,.mx-xl-5{margin-left:3rem!important}.p-xl-0{padding:0!important}.pt-xl-0,.py-xl-0{padding-top:0!important}.pr-xl-0,.px-xl-0{padding-right:0!important}.pb-xl-0,.py-xl-0{padding-bottom:0!important}.pl-xl-0,.px-xl-0{padding-left:0!important}.p-xl-1{padding:.25rem!important}.pt-xl-1,.py-xl-1{padding-top:.25rem!important}.pr-xl-1,.px-xl-1{padding-right:.25rem!important}.pb-xl-1,.py-xl-1{padding-bottom:.25rem!important}.pl-xl-1,.px-xl-1{padding-left:.25rem!important}.p-xl-2{padding:.5rem!important}.pt-xl-2,.py-xl-2{padding-top:.5rem!important}.pr-xl-2,.px-xl-2{padding-right:.5rem!important}.pb-xl-2,.py-xl-2{padding-bottom:.5rem!important}.pl-xl-2,.px-xl-2{padding-left:.5rem!important}.p-xl-3{padding:1rem!important}.pt-xl-3,.py-xl-3{padding-top:1rem!important}.pr-xl-3,.px-xl-3{padding-right:1rem!important}.pb-xl-3,.py-xl-3{padding-bottom:1rem!important}.pl-xl-3,.px-xl-3{padding-left:1rem!important}.p-xl-4{padding:1.5rem!important}.pt-xl-4,.py-xl-4{padding-top:1.5rem!important}.pr-xl-4,.px-xl-4{padding-right:1.5rem!important}.pb-xl-4,.py-xl-4{padding-bottom:1.5rem!important}.pl-xl-4,.px-xl-4{padding-left:1.5rem!important}.p-xl-5{padding:3rem!important}.pt-xl-5,.py-xl-5{padding-top:3rem!important}.pr-xl-5,.px-xl-5{padding-right:3rem!important}.pb-xl-5,.py-xl-5{padding-bottom:3rem!important}.pl-xl-5,.px-xl-5{padding-left:3rem!important}.m-xl-n1{margin:-.25rem!important}.mt-xl-n1,.my-xl-n1{margin-top:-.25rem!important}.mr-xl-n1,.mx-xl-n1{margin-right:-.25rem!important}.mb-xl-n1,.my-xl-n1{margin-bottom:-.25rem!important}.ml-xl-n1,.mx-xl-n1{margin-left:-.25rem!important}.m-xl-n2{margin:-.5rem!important}.mt-xl-n2,.my-xl-n2{margin-top:-.5rem!important}.mr-xl-n2,.mx-xl-n2{margin-right:-.5rem!important}.mb-xl-n2,.my-xl-n2{margin-bottom:-.5rem!important}.ml-xl-n2,.mx-xl-n2{margin-left:-.5rem!important}.m-xl-n3{margin:-1rem!important}.mt-xl-n3,.my-xl-n3{margin-top:-1rem!important}.mr-xl-n3,.mx-xl-n3{margin-right:-1rem!important}.mb-xl-n3,.my-xl-n3{margin-bottom:-1rem!important}.ml-xl-n3,.mx-xl-n3{margin-left:-1rem!important}.m-xl-n4{margin:-1.5rem!important}.mt-xl-n4,.my-xl-n4{margin-top:-1.5rem!important}.mr-xl-n4,.mx-xl-n4{margin-right:-1.5rem!important}.mb-xl-n4,.my-xl-n4{margin-bottom:-1.5rem!important}.ml-xl-n4,.mx-xl-n4{margin-left:-1.5rem!important}.m-xl-n5{margin:-3rem!important}.mt-xl-n5,.my-xl-n5{margin-top:-3rem!important}.mr-xl-n5,.mx-xl-n5{margin-right:-3rem!important}.mb-xl-n5,.my-xl-n5{margin-bottom:-3rem!important}.ml-xl-n5,.mx-xl-n5{margin-left:-3rem!important}.m-xl-auto{margin:auto!important}.mt-xl-auto,.my-xl-auto{margin-top:auto!important}.mr-xl-auto,.mx-xl-auto{margin-right:auto!important}.mb-xl-auto,.my-xl-auto{margin-bottom:auto!important}.ml-xl-auto,.mx-xl-auto{margin-left:auto!important}}.text-monospace{font-family:SFMono-Regular,Menlo,Monaco,Consolas,\"Liberation Mono\",\"Courier New\",monospace!important}.text-justify{text-align:justify!important}.text-wrap{white-space:normal!important}.text-nowrap{white-space:nowrap!important}.text-truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.text-left{text-align:left!important}.text-right{text-align:right!important}.text-center{text-align:center!important}@media (min-width:576px){.text-sm-left{text-align:left!important}.text-sm-right{text-align:right!important}.text-sm-center{text-align:center!important}}@media (min-width:768px){.text-md-left{text-align:left!important}.text-md-right{text-align:right!important}.text-md-center{text-align:center!important}}@media (min-width:992px){.text-lg-left{text-align:left!important}.text-lg-right{text-align:right!important}.text-lg-center{text-align:center!important}}@media (min-width:1200px){.text-xl-left{text-align:left!important}.text-xl-right{text-align:right!important}.text-xl-center{text-align:center!important}}.text-lowercase{text-transform:lowercase!important}.text-uppercase{text-transform:uppercase!important}.text-capitalize{text-transform:capitalize!important}.font-weight-light{font-weight:300!important}.font-weight-lighter{font-weight:lighter!important}.font-weight-normal{font-weight:400!important}.font-weight-bold{font-weight:700!important}.font-weight-bolder{font-weight:bolder!important}.font-italic{font-style:italic!important}.text-white{color:#fff!important}.text-primary{color:#007bff!important}a.text-primary:focus,a.text-primary:hover{color:#0056b3!important}.text-secondary{color:#6c757d!important}a.text-secondary:focus,a.text-secondary:hover{color:#494f54!important}.text-success{color:#28a745!important}a.text-success:focus,a.text-success:hover{color:#19692c!important}.text-info{color:#17a2b8!important}a.text-info:focus,a.text-info:hover{color:#0f6674!important}.text-warning{color:#ffc107!important}a.text-warning:focus,a.text-warning:hover{color:#ba8b00!important}.text-danger{color:#dc3545!important}a.text-danger:focus,a.text-danger:hover{color:#a71d2a!important}.text-light{color:#f8f9fa!important}a.text-light:focus,a.text-light:hover{color:#cbd3da!important}.text-dark{color:#343a40!important}a.text-dark:focus,a.text-dark:hover{color:#121416!important}.text-body{color:#212529!important}.text-muted{color:#6c757d!important}.text-black-50{color:rgba(0,0,0,.5)!important}.text-white-50{color:rgba(255,255,255,.5)!important}.text-hide{font:0/0 a;color:transparent;text-shadow:none;background-color:transparent;border:0}.text-decoration-none{text-decoration:none!important}.text-break{word-break:break-word!important;overflow-wrap:break-word!important}.text-reset{color:inherit!important}.visible{visibility:visible!important}.invisible{visibility:hidden!important}@media print{*,::after,::before{text-shadow:none!important;box-shadow:none!important}a:not(.btn){text-decoration:underline}abbr[title]::after{content:\" (\" attr(title) \")\"}pre{white-space:pre-wrap!important}blockquote,pre{border:1px solid #adb5bd;page-break-inside:avoid}thead{display:table-header-group}img,tr{page-break-inside:avoid}h2,h3,p{orphans:3;widows:3}h2,h3{page-break-after:avoid}@page{size:a3}body{min-width:992px!important}.container{min-width:992px!important}.navbar{display:none}.badge{border:1px solid #000}.table{border-collapse:collapse!important}.table td,.table th{background-color:#fff!important}.table-bordered td,.table-bordered th{border:1px solid #dee2e6!important}.table-dark{color:inherit}.table-dark tbody+tbody,.table-dark td,.table-dark th,.table-dark thead th{border-color:#dee2e6}.table .thead-dark th{color:inherit;border-color:#dee2e6}}/*# sourceMappingURL=bootstrap.min.css.map */" + +/***/ }), + +/***/ "./node_modules/raw-loader/index.js!./node_modules/postcss-loader/lib/index.js?!./src/styles.css": +/*!**********************************************************************************************!*\ + !*** ./node_modules/raw-loader!./node_modules/postcss-loader/lib??embedded!./src/styles.css ***! + \**********************************************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +module.exports = "html{\n margin: 0;\n width: 100%;\n height: 100%;\n background-image: \n linear-gradient( rgba(0,0,0,.5), rgba(0, 0, 0, 0.6) ),\n url(\"/assets/img/bg_radi_red_dark.png\");\n touch-action: none;\n}\n\n.wrapper {\n /* Break the flow */\n position: absolute;\n top: 0px;\n /* Give them all the available space */\n width: 100%;\n height: 100%;\n \n /* Remove the margins if any */\n margin: 0;\n overflow: hidden;\n \n }\n\nmain{\n height: 100%;\n }" + +/***/ }), + +/***/ "./node_modules/style-loader/lib/addStyles.js": +/*!****************************************************!*\ + !*** ./node_modules/style-loader/lib/addStyles.js ***! + \****************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + +var stylesInDom = {}; + +var memoize = function (fn) { + var memo; + + return function () { + if (typeof memo === "undefined") memo = fn.apply(this, arguments); + return memo; + }; +}; + +var isOldIE = memoize(function () { + // Test for IE <= 9 as proposed by Browserhacks + // @see http://browserhacks.com/#hack-e71d8692f65334173fee715c222cb805 + // Tests for existence of standard globals is to allow style-loader + // to operate correctly into non-standard environments + // @see https://github.com/webpack-contrib/style-loader/issues/177 + return window && document && document.all && !window.atob; +}); + +var getTarget = function (target) { + return document.querySelector(target); +}; + +var getElement = (function (fn) { + var memo = {}; + + return function(target) { + // If passing function in options, then use it for resolve "head" element. + // Useful for Shadow Root style i.e + // { + // insertInto: function () { return document.querySelector("#foo").shadowRoot } + // } + if (typeof target === 'function') { + return target(); + } + if (typeof memo[target] === "undefined") { + var styleTarget = getTarget.call(this, target); + // Special case to return head of iframe instead of iframe itself + if (window.HTMLIFrameElement && styleTarget instanceof window.HTMLIFrameElement) { + try { + // This will throw an exception if access to iframe is blocked + // due to cross-origin restrictions + styleTarget = styleTarget.contentDocument.head; + } catch(e) { + styleTarget = null; + } + } + memo[target] = styleTarget; + } + return memo[target] + }; +})(); + +var singleton = null; +var singletonCounter = 0; +var stylesInsertedAtTop = []; + +var fixUrls = __webpack_require__(/*! ./urls */ "./node_modules/style-loader/lib/urls.js"); + +module.exports = function(list, options) { + if (typeof DEBUG !== "undefined" && DEBUG) { + if (typeof document !== "object") throw new Error("The style-loader cannot be used in a non-browser environment"); + } + + options = options || {}; + + options.attrs = typeof options.attrs === "object" ? options.attrs : {}; + + // Force single-tag solution on IE6-9, which has a hard limit on the # of + + + could become: + + +
+ +
+ + Note the use of @polyfill in the comment above a ShadowDOM specific style + declaration. This is a directive to the styling shim to use the selector + in comments in lieu of the next selector when running under polyfill. +*/ +var ShadowCss = /** @class */ (function () { + function ShadowCss() { + this.strictStyling = true; + } + /* + * Shim some cssText with the given selector. Returns cssText that can + * be included in the document via WebComponents.ShadowCSS.addCssToDocument(css). + * + * When strictStyling is true: + * - selector is the attribute added to all elements inside the host, + * - hostSelector is the attribute added to the host itself. + */ + ShadowCss.prototype.shimCssText = function (cssText, selector, hostSelector) { + if (hostSelector === void 0) { hostSelector = ''; } + var commentsWithHash = extractCommentsWithHash(cssText); + cssText = stripComments(cssText); + cssText = this._insertDirectives(cssText); + var scopedCssText = this._scopeCssText(cssText, selector, hostSelector); + return Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])([scopedCssText], commentsWithHash).join('\n'); + }; + ShadowCss.prototype._insertDirectives = function (cssText) { + cssText = this._insertPolyfillDirectivesInCssText(cssText); + return this._insertPolyfillRulesInCssText(cssText); + }; + /* + * Process styles to convert native ShadowDOM rules that will trip + * up the css parser; we rely on decorating the stylesheet with inert rules. + * + * For example, we convert this rule: + * + * polyfill-next-selector { content: ':host menu-item'; } + * ::content menu-item { + * + * to this: + * + * scopeName menu-item { + * + **/ + ShadowCss.prototype._insertPolyfillDirectivesInCssText = function (cssText) { + // Difference with webcomponents.js: does not handle comments + return cssText.replace(_cssContentNextSelectorRe, function () { + var m = []; + for (var _i = 0; _i < arguments.length; _i++) { + m[_i] = arguments[_i]; + } + return m[2] + '{'; + }); + }; + /* + * Process styles to add rules which will only apply under the polyfill + * + * For example, we convert this rule: + * + * polyfill-rule { + * content: ':host menu-item'; + * ... + * } + * + * to this: + * + * scopeName menu-item {...} + * + **/ + ShadowCss.prototype._insertPolyfillRulesInCssText = function (cssText) { + // Difference with webcomponents.js: does not handle comments + return cssText.replace(_cssContentRuleRe, function () { + var m = []; + for (var _i = 0; _i < arguments.length; _i++) { + m[_i] = arguments[_i]; + } + var rule = m[0].replace(m[1], '').replace(m[2], ''); + return m[4] + rule; + }); + }; + /* Ensure styles are scoped. Pseudo-scoping takes a rule like: + * + * .foo {... } + * + * and converts this to + * + * scopeName .foo { ... } + */ + ShadowCss.prototype._scopeCssText = function (cssText, scopeSelector, hostSelector) { + var unscopedRules = this._extractUnscopedRulesFromCssText(cssText); + // replace :host and :host-context -shadowcsshost and -shadowcsshost respectively + cssText = this._insertPolyfillHostInCssText(cssText); + cssText = this._convertColonHost(cssText); + cssText = this._convertColonHostContext(cssText); + cssText = this._convertShadowDOMSelectors(cssText); + if (scopeSelector) { + cssText = this._scopeSelectors(cssText, scopeSelector, hostSelector); + } + cssText = cssText + '\n' + unscopedRules; + return cssText.trim(); + }; + /* + * Process styles to add rules which will only apply under the polyfill + * and do not process via CSSOM. (CSSOM is destructive to rules on rare + * occasions, e.g. -webkit-calc on Safari.) + * For example, we convert this rule: + * + * @polyfill-unscoped-rule { + * content: 'menu-item'; + * ... } + * + * to this: + * + * menu-item {...} + * + **/ + ShadowCss.prototype._extractUnscopedRulesFromCssText = function (cssText) { + // Difference with webcomponents.js: does not handle comments + var r = ''; + var m; + _cssContentUnscopedRuleRe.lastIndex = 0; + while ((m = _cssContentUnscopedRuleRe.exec(cssText)) !== null) { + var rule = m[0].replace(m[2], '').replace(m[1], m[4]); + r += rule + '\n\n'; + } + return r; + }; + /* + * convert a rule like :host(.foo) > .bar { } + * + * to + * + * .foo > .bar + */ + ShadowCss.prototype._convertColonHost = function (cssText) { + return this._convertColonRule(cssText, _cssColonHostRe, this._colonHostPartReplacer); + }; + /* + * convert a rule like :host-context(.foo) > .bar { } + * + * to + * + * .foo > .bar, .foo scopeName > .bar { } + * + * and + * + * :host-context(.foo:host) .bar { ... } + * + * to + * + * .foo .bar { ... } + */ + ShadowCss.prototype._convertColonHostContext = function (cssText) { + return this._convertColonRule(cssText, _cssColonHostContextRe, this._colonHostContextPartReplacer); + }; + ShadowCss.prototype._convertColonRule = function (cssText, regExp, partReplacer) { + // m[1] = :host(-context), m[2] = contents of (), m[3] rest of rule + return cssText.replace(regExp, function () { + var m = []; + for (var _i = 0; _i < arguments.length; _i++) { + m[_i] = arguments[_i]; + } + if (m[2]) { + var parts = m[2].split(','); + var r = []; + for (var i = 0; i < parts.length; i++) { + var p = parts[i].trim(); + if (!p) + break; + r.push(partReplacer(_polyfillHostNoCombinator, p, m[3])); + } + return r.join(','); + } + else { + return _polyfillHostNoCombinator + m[3]; + } + }); + }; + ShadowCss.prototype._colonHostContextPartReplacer = function (host, part, suffix) { + if (part.indexOf(_polyfillHost) > -1) { + return this._colonHostPartReplacer(host, part, suffix); + } + else { + return host + part + suffix + ', ' + part + ' ' + host + suffix; + } + }; + ShadowCss.prototype._colonHostPartReplacer = function (host, part, suffix) { + return host + part.replace(_polyfillHost, '') + suffix; + }; + /* + * Convert combinators like ::shadow and pseudo-elements like ::content + * by replacing with space. + */ + ShadowCss.prototype._convertShadowDOMSelectors = function (cssText) { + return _shadowDOMSelectorsRe.reduce(function (result, pattern) { return result.replace(pattern, ' '); }, cssText); + }; + // change a selector like 'div' to 'name div' + ShadowCss.prototype._scopeSelectors = function (cssText, scopeSelector, hostSelector) { + var _this = this; + return processRules(cssText, function (rule) { + var selector = rule.selector; + var content = rule.content; + if (rule.selector[0] != '@') { + selector = + _this._scopeSelector(rule.selector, scopeSelector, hostSelector, _this.strictStyling); + } + else if (rule.selector.startsWith('@media') || rule.selector.startsWith('@supports') || + rule.selector.startsWith('@page') || rule.selector.startsWith('@document')) { + content = _this._scopeSelectors(rule.content, scopeSelector, hostSelector); + } + return new CssRule(selector, content); + }); + }; + ShadowCss.prototype._scopeSelector = function (selector, scopeSelector, hostSelector, strict) { + var _this = this; + return selector.split(',') + .map(function (part) { return part.trim().split(_shadowDeepSelectors); }) + .map(function (deepParts) { + var _a = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__read"])(deepParts), shallowPart = _a[0], otherParts = _a.slice(1); + var applyScope = function (shallowPart) { + if (_this._selectorNeedsScoping(shallowPart, scopeSelector)) { + return strict ? + _this._applyStrictSelectorScope(shallowPart, scopeSelector, hostSelector) : + _this._applySelectorScope(shallowPart, scopeSelector, hostSelector); + } + else { + return shallowPart; + } + }; + return Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])([applyScope(shallowPart)], otherParts).join(' '); + }) + .join(', '); + }; + ShadowCss.prototype._selectorNeedsScoping = function (selector, scopeSelector) { + var re = this._makeScopeMatcher(scopeSelector); + return !re.test(selector); + }; + ShadowCss.prototype._makeScopeMatcher = function (scopeSelector) { + var lre = /\[/g; + var rre = /\]/g; + scopeSelector = scopeSelector.replace(lre, '\\[').replace(rre, '\\]'); + return new RegExp('^(' + scopeSelector + ')' + _selectorReSuffix, 'm'); + }; + ShadowCss.prototype._applySelectorScope = function (selector, scopeSelector, hostSelector) { + // Difference from webcomponents.js: scopeSelector could not be an array + return this._applySimpleSelectorScope(selector, scopeSelector, hostSelector); + }; + // scope via name and [is=name] + ShadowCss.prototype._applySimpleSelectorScope = function (selector, scopeSelector, hostSelector) { + // In Android browser, the lastIndex is not reset when the regex is used in String.replace() + _polyfillHostRe.lastIndex = 0; + if (_polyfillHostRe.test(selector)) { + var replaceBy_1 = this.strictStyling ? "[" + hostSelector + "]" : scopeSelector; + return selector + .replace(_polyfillHostNoCombinatorRe, function (hnc, selector) { + return selector.replace(/([^:]*)(:*)(.*)/, function (_, before, colon, after) { + return before + replaceBy_1 + colon + after; + }); + }) + .replace(_polyfillHostRe, replaceBy_1 + ' '); + } + return scopeSelector + ' ' + selector; + }; + // return a selector with [name] suffix on each simple selector + // e.g. .foo.bar > .zot becomes .foo[name].bar[name] > .zot[name] /** @internal */ + ShadowCss.prototype._applyStrictSelectorScope = function (selector, scopeSelector, hostSelector) { + var _this = this; + var isRe = /\[is=([^\]]*)\]/g; + scopeSelector = scopeSelector.replace(isRe, function (_) { + var parts = []; + for (var _i = 1; _i < arguments.length; _i++) { + parts[_i - 1] = arguments[_i]; + } + return parts[0]; + }); + var attrName = '[' + scopeSelector + ']'; + var _scopeSelectorPart = function (p) { + var scopedP = p.trim(); + if (!scopedP) { + return ''; + } + if (p.indexOf(_polyfillHostNoCombinator) > -1) { + scopedP = _this._applySimpleSelectorScope(p, scopeSelector, hostSelector); + } + else { + // remove :host since it should be unnecessary + var t = p.replace(_polyfillHostRe, ''); + if (t.length > 0) { + var matches = t.match(/([^:]*)(:*)(.*)/); + if (matches) { + scopedP = matches[1] + attrName + matches[2] + matches[3]; + } + } + } + return scopedP; + }; + var safeContent = new SafeSelector(selector); + selector = safeContent.content(); + var scopedSelector = ''; + var startIndex = 0; + var res; + var sep = /( |>|\+|~(?!=))\s*/g; + // If a selector appears before :host it should not be shimmed as it + // matches on ancestor elements and not on elements in the host's shadow + // `:host-context(div)` is transformed to + // `-shadowcsshost-no-combinatordiv, div -shadowcsshost-no-combinator` + // the `div` is not part of the component in the 2nd selectors and should not be scoped. + // Historically `component-tag:host` was matching the component so we also want to preserve + // this behavior to avoid breaking legacy apps (it should not match). + // The behavior should be: + // - `tag:host` -> `tag[h]` (this is to avoid breaking legacy apps, should not match anything) + // - `tag :host` -> `tag [h]` (`tag` is not scoped because it's considered part of a + // `:host-context(tag)`) + var hasHost = selector.indexOf(_polyfillHostNoCombinator) > -1; + // Only scope parts after the first `-shadowcsshost-no-combinator` when it is present + var shouldScope = !hasHost; + while ((res = sep.exec(selector)) !== null) { + var separator = res[1]; + var part_1 = selector.slice(startIndex, res.index).trim(); + shouldScope = shouldScope || part_1.indexOf(_polyfillHostNoCombinator) > -1; + var scopedPart = shouldScope ? _scopeSelectorPart(part_1) : part_1; + scopedSelector += scopedPart + " " + separator + " "; + startIndex = sep.lastIndex; + } + var part = selector.substring(startIndex); + shouldScope = shouldScope || part.indexOf(_polyfillHostNoCombinator) > -1; + scopedSelector += shouldScope ? _scopeSelectorPart(part) : part; + // replace the placeholders with their original values + return safeContent.restore(scopedSelector); + }; + ShadowCss.prototype._insertPolyfillHostInCssText = function (selector) { + return selector.replace(_colonHostContextRe, _polyfillHostContext) + .replace(_colonHostRe, _polyfillHost); + }; + return ShadowCss; +}()); +var SafeSelector = /** @class */ (function () { + function SafeSelector(selector) { + var _this = this; + this.placeholders = []; + this.index = 0; + // Replaces attribute selectors with placeholders. + // The WS in [attr="va lue"] would otherwise be interpreted as a selector separator. + selector = selector.replace(/(\[[^\]]*\])/g, function (_, keep) { + var replaceBy = "__ph-" + _this.index + "__"; + _this.placeholders.push(keep); + _this.index++; + return replaceBy; + }); + // Replaces the expression in `:nth-child(2n + 1)` with a placeholder. + // WS and "+" would otherwise be interpreted as selector separators. + this._content = selector.replace(/(:nth-[-\w]+)(\([^)]+\))/g, function (_, pseudo, exp) { + var replaceBy = "__ph-" + _this.index + "__"; + _this.placeholders.push(exp); + _this.index++; + return pseudo + replaceBy; + }); + } + SafeSelector.prototype.restore = function (content) { + var _this = this; + return content.replace(/__ph-(\d+)__/g, function (ph, index) { return _this.placeholders[+index]; }); + }; + SafeSelector.prototype.content = function () { return this._content; }; + return SafeSelector; +}()); +var _cssContentNextSelectorRe = /polyfill-next-selector[^}]*content:[\s]*?(['"])(.*?)\1[;\s]*}([^{]*?){/gim; +var _cssContentRuleRe = /(polyfill-rule)[^}]*(content:[\s]*(['"])(.*?)\3)[;\s]*[^}]*}/gim; +var _cssContentUnscopedRuleRe = /(polyfill-unscoped-rule)[^}]*(content:[\s]*(['"])(.*?)\3)[;\s]*[^}]*}/gim; +var _polyfillHost = '-shadowcsshost'; +// note: :host-context pre-processed to -shadowcsshostcontext. +var _polyfillHostContext = '-shadowcsscontext'; +var _parenSuffix = ')(?:\\((' + + '(?:\\([^)(]*\\)|[^)(]*)+?' + + ')\\))?([^,{]*)'; +var _cssColonHostRe = new RegExp('(' + _polyfillHost + _parenSuffix, 'gim'); +var _cssColonHostContextRe = new RegExp('(' + _polyfillHostContext + _parenSuffix, 'gim'); +var _polyfillHostNoCombinator = _polyfillHost + '-no-combinator'; +var _polyfillHostNoCombinatorRe = /-shadowcsshost-no-combinator([^\s]*)/; +var _shadowDOMSelectorsRe = [ + /::shadow/g, + /::content/g, + // Deprecated selectors + /\/shadow-deep\//g, + /\/shadow\//g, +]; +// The deep combinator is deprecated in the CSS spec +// Support for `>>>`, `deep`, `::ng-deep` is then also deprecated and will be removed in the future. +// see https://github.com/angular/angular/pull/17677 +var _shadowDeepSelectors = /(?:>>>)|(?:\/deep\/)|(?:::ng-deep)/g; +var _selectorReSuffix = '([>\\s~+\[.,{:][\\s\\S]*)?$'; +var _polyfillHostRe = /-shadowcsshost/gim; +var _colonHostRe = /:host/gim; +var _colonHostContextRe = /:host-context/gim; +var _commentRe = /\/\*\s*[\s\S]*?\*\//g; +function stripComments(input) { + return input.replace(_commentRe, ''); +} +var _commentWithHashRe = /\/\*\s*#\s*source(Mapping)?URL=[\s\S]+?\*\//g; +function extractCommentsWithHash(input) { + return input.match(_commentWithHashRe) || []; +} +var _ruleRe = /(\s*)([^;\{\}]+?)(\s*)((?:{%BLOCK%}?\s*;?)|(?:\s*;))/g; +var _curlyRe = /([{}])/g; +var OPEN_CURLY = '{'; +var CLOSE_CURLY = '}'; +var BLOCK_PLACEHOLDER = '%BLOCK%'; +var CssRule = /** @class */ (function () { + function CssRule(selector, content) { + this.selector = selector; + this.content = content; + } + return CssRule; +}()); +function processRules(input, ruleCallback) { + var inputWithEscapedBlocks = escapeBlocks(input); + var nextBlockIndex = 0; + return inputWithEscapedBlocks.escapedString.replace(_ruleRe, function () { + var m = []; + for (var _i = 0; _i < arguments.length; _i++) { + m[_i] = arguments[_i]; + } + var selector = m[2]; + var content = ''; + var suffix = m[4]; + var contentPrefix = ''; + if (suffix && suffix.startsWith('{' + BLOCK_PLACEHOLDER)) { + content = inputWithEscapedBlocks.blocks[nextBlockIndex++]; + suffix = suffix.substring(BLOCK_PLACEHOLDER.length + 1); + contentPrefix = '{'; + } + var rule = ruleCallback(new CssRule(selector, content)); + return "" + m[1] + rule.selector + m[3] + contentPrefix + rule.content + suffix; + }); +} +var StringWithEscapedBlocks = /** @class */ (function () { + function StringWithEscapedBlocks(escapedString, blocks) { + this.escapedString = escapedString; + this.blocks = blocks; + } + return StringWithEscapedBlocks; +}()); +function escapeBlocks(input) { + var inputParts = input.split(_curlyRe); + var resultParts = []; + var escapedBlocks = []; + var bracketCount = 0; + var currentBlockParts = []; + for (var partIndex = 0; partIndex < inputParts.length; partIndex++) { + var part = inputParts[partIndex]; + if (part == CLOSE_CURLY) { + bracketCount--; + } + if (bracketCount > 0) { + currentBlockParts.push(part); + } + else { + if (currentBlockParts.length > 0) { + escapedBlocks.push(currentBlockParts.join('')); + resultParts.push(BLOCK_PLACEHOLDER); + currentBlockParts = []; + } + resultParts.push(part); + } + if (part == OPEN_CURLY) { + bracketCount++; + } + } + if (currentBlockParts.length > 0) { + escapedBlocks.push(currentBlockParts.join('')); + resultParts.push(BLOCK_PLACEHOLDER); + } + return new StringWithEscapedBlocks(resultParts.join(''), escapedBlocks); +} + +/** + * @license + * Copyright Google Inc. All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ +var COMPONENT_VARIABLE = '%COMP%'; +var HOST_ATTR = "_nghost-" + COMPONENT_VARIABLE; +var CONTENT_ATTR = "_ngcontent-" + COMPONENT_VARIABLE; +var StylesCompileDependency = /** @class */ (function () { + function StylesCompileDependency(name, moduleUrl, setValue) { + this.name = name; + this.moduleUrl = moduleUrl; + this.setValue = setValue; + } + return StylesCompileDependency; +}()); +var CompiledStylesheet = /** @class */ (function () { + function CompiledStylesheet(outputCtx, stylesVar, dependencies, isShimmed, meta) { + this.outputCtx = outputCtx; + this.stylesVar = stylesVar; + this.dependencies = dependencies; + this.isShimmed = isShimmed; + this.meta = meta; + } + return CompiledStylesheet; +}()); +var StyleCompiler = /** @class */ (function () { + function StyleCompiler(_urlResolver) { + this._urlResolver = _urlResolver; + this._shadowCss = new ShadowCss(); + } + StyleCompiler.prototype.compileComponent = function (outputCtx, comp) { + var template = comp.template; + return this._compileStyles(outputCtx, comp, new CompileStylesheetMetadata({ + styles: template.styles, + styleUrls: template.styleUrls, + moduleUrl: identifierModuleUrl(comp.type) + }), this.needsStyleShim(comp), true); + }; + StyleCompiler.prototype.compileStyles = function (outputCtx, comp, stylesheet, shim) { + if (shim === void 0) { shim = this.needsStyleShim(comp); } + return this._compileStyles(outputCtx, comp, stylesheet, shim, false); + }; + StyleCompiler.prototype.needsStyleShim = function (comp) { + return comp.template.encapsulation === ViewEncapsulation.Emulated; + }; + StyleCompiler.prototype._compileStyles = function (outputCtx, comp, stylesheet, shim, isComponentStylesheet) { + var _this = this; + var styleExpressions = stylesheet.styles.map(function (plainStyle) { return literal(_this._shimIfNeeded(plainStyle, shim)); }); + var dependencies = []; + stylesheet.styleUrls.forEach(function (styleUrl) { + var exprIndex = styleExpressions.length; + // Note: This placeholder will be filled later. + styleExpressions.push(null); + dependencies.push(new StylesCompileDependency(getStylesVarName(null), styleUrl, function (value) { return styleExpressions[exprIndex] = outputCtx.importExpr(value); })); + }); + // styles variable contains plain strings and arrays of other styles arrays (recursive), + // so we set its type to dynamic. + var stylesVar = getStylesVarName(isComponentStylesheet ? comp : null); + var stmt = variable(stylesVar) + .set(literalArr(styleExpressions, new ArrayType(DYNAMIC_TYPE, [TypeModifier.Const]))) + .toDeclStmt(null, isComponentStylesheet ? [StmtModifier.Final] : [ + StmtModifier.Final, StmtModifier.Exported + ]); + outputCtx.statements.push(stmt); + return new CompiledStylesheet(outputCtx, stylesVar, dependencies, shim, stylesheet); + }; + StyleCompiler.prototype._shimIfNeeded = function (style, shim) { + return shim ? this._shadowCss.shimCssText(style, CONTENT_ATTR, HOST_ATTR) : style; + }; + return StyleCompiler; +}()); +function getStylesVarName(component) { + var result = "styles"; + if (component) { + result += "_" + identifierName(component.type); + } + return result; +} + +/** + * @license + * Copyright Google Inc. All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ +var PRESERVE_WS_ATTR_NAME = 'ngPreserveWhitespaces'; +var SKIP_WS_TRIM_TAGS = new Set(['pre', 'template', 'textarea', 'script', 'style']); +// Equivalent to \s with \u00a0 (non-breaking space) excluded. +// Based on https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp +var WS_CHARS = ' \f\n\r\t\v\u1680\u180e\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff'; +var NO_WS_REGEXP = new RegExp("[^" + WS_CHARS + "]"); +var WS_REPLACE_REGEXP = new RegExp("[" + WS_CHARS + "]{2,}", 'g'); +function hasPreserveWhitespacesAttr(attrs) { + return attrs.some(function (attr) { return attr.name === PRESERVE_WS_ATTR_NAME; }); +} +/** + * Angular Dart introduced &ngsp; as a placeholder for non-removable space, see: + * https://github.com/dart-lang/angular/blob/0bb611387d29d65b5af7f9d2515ab571fd3fbee4/_tests/test/compiler/preserve_whitespace_test.dart#L25-L32 + * In Angular Dart &ngsp; is converted to the 0xE500 PUA (Private Use Areas) unicode character + * and later on replaced by a space. We are re-implementing the same idea here. + */ +function replaceNgsp(value) { + // lexer is replacing the &ngsp; pseudo-entity with NGSP_UNICODE + return value.replace(new RegExp(NGSP_UNICODE, 'g'), ' '); +} +/** + * This visitor can walk HTML parse tree and remove / trim text nodes using the following rules: + * - consider spaces, tabs and new lines as whitespace characters; + * - drop text nodes consisting of whitespace characters only; + * - for all other text nodes replace consecutive whitespace characters with one space; + * - convert &ngsp; pseudo-entity to a single space; + * + * Removal and trimming of whitespaces have positive performance impact (less code to generate + * while compiling templates, faster view creation). At the same time it can be "destructive" + * in some cases (whitespaces can influence layout). Because of the potential of breaking layout + * this visitor is not activated by default in Angular 5 and people need to explicitly opt-in for + * whitespace removal. The default option for whitespace removal will be revisited in Angular 6 + * and might be changed to "on" by default. + */ +var WhitespaceVisitor = /** @class */ (function () { + function WhitespaceVisitor() { + } + WhitespaceVisitor.prototype.visitElement = function (element, context) { + if (SKIP_WS_TRIM_TAGS.has(element.name) || hasPreserveWhitespacesAttr(element.attrs)) { + // don't descent into elements where we need to preserve whitespaces + // but still visit all attributes to eliminate one used as a market to preserve WS + return new Element(element.name, visitAll(this, element.attrs), element.children, element.sourceSpan, element.startSourceSpan, element.endSourceSpan); + } + return new Element(element.name, element.attrs, visitAll(this, element.children), element.sourceSpan, element.startSourceSpan, element.endSourceSpan); + }; + WhitespaceVisitor.prototype.visitAttribute = function (attribute, context) { + return attribute.name !== PRESERVE_WS_ATTR_NAME ? attribute : null; + }; + WhitespaceVisitor.prototype.visitText = function (text, context) { + var isNotBlank = text.value.match(NO_WS_REGEXP); + if (isNotBlank) { + return new Text(replaceNgsp(text.value).replace(WS_REPLACE_REGEXP, ' '), text.sourceSpan); + } + return null; + }; + WhitespaceVisitor.prototype.visitComment = function (comment, context) { return comment; }; + WhitespaceVisitor.prototype.visitExpansion = function (expansion, context) { return expansion; }; + WhitespaceVisitor.prototype.visitExpansionCase = function (expansionCase, context) { return expansionCase; }; + return WhitespaceVisitor; +}()); +function removeWhitespaces(htmlAstWithErrors) { + return new ParseTreeResult(visitAll(new WhitespaceVisitor(), htmlAstWithErrors.rootNodes), htmlAstWithErrors.errors); +} + +/** + * @license + * Copyright Google Inc. All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ +// http://cldr.unicode.org/index/cldr-spec/plural-rules +var PLURAL_CASES = ['zero', 'one', 'two', 'few', 'many', 'other']; +/** + * Expands special forms into elements. + * + * For example, + * + * ``` + * { messages.length, plural, + * =0 {zero} + * =1 {one} + * other {more than one} + * } + * ``` + * + * will be expanded into + * + * ``` + * + * zero + * one + * more than one + * + * ``` + */ +function expandNodes(nodes) { + var expander = new _Expander(); + return new ExpansionResult(visitAll(expander, nodes), expander.isExpanded, expander.errors); +} +var ExpansionResult = /** @class */ (function () { + function ExpansionResult(nodes, expanded, errors) { + this.nodes = nodes; + this.expanded = expanded; + this.errors = errors; + } + return ExpansionResult; +}()); +var ExpansionError = /** @class */ (function (_super) { + Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(ExpansionError, _super); + function ExpansionError(span, errorMsg) { + return _super.call(this, span, errorMsg) || this; + } + return ExpansionError; +}(ParseError)); +/** + * Expand expansion forms (plural, select) to directives + * + * @internal + */ +var _Expander = /** @class */ (function () { + function _Expander() { + this.isExpanded = false; + this.errors = []; + } + _Expander.prototype.visitElement = function (element, context) { + return new Element(element.name, element.attrs, visitAll(this, element.children), element.sourceSpan, element.startSourceSpan, element.endSourceSpan); + }; + _Expander.prototype.visitAttribute = function (attribute, context) { return attribute; }; + _Expander.prototype.visitText = function (text, context) { return text; }; + _Expander.prototype.visitComment = function (comment, context) { return comment; }; + _Expander.prototype.visitExpansion = function (icu, context) { + this.isExpanded = true; + return icu.type == 'plural' ? _expandPluralForm(icu, this.errors) : + _expandDefaultForm(icu, this.errors); + }; + _Expander.prototype.visitExpansionCase = function (icuCase, context) { + throw new Error('Should not be reached'); + }; + return _Expander; +}()); +// Plural forms are expanded to `NgPlural` and `NgPluralCase`s +function _expandPluralForm(ast, errors) { + var children = ast.cases.map(function (c) { + if (PLURAL_CASES.indexOf(c.value) == -1 && !c.value.match(/^=\d+$/)) { + errors.push(new ExpansionError(c.valueSourceSpan, "Plural cases should be \"=\" or one of " + PLURAL_CASES.join(", "))); + } + var expansionResult = expandNodes(c.expression); + errors.push.apply(errors, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])(expansionResult.errors)); + return new Element("ng-template", [new Attribute('ngPluralCase', "" + c.value, c.valueSourceSpan)], expansionResult.nodes, c.sourceSpan, c.sourceSpan, c.sourceSpan); + }); + var switchAttr = new Attribute('[ngPlural]', ast.switchValue, ast.switchValueSourceSpan); + return new Element('ng-container', [switchAttr], children, ast.sourceSpan, ast.sourceSpan, ast.sourceSpan); +} +// ICU messages (excluding plural form) are expanded to `NgSwitch` and `NgSwitchCase`s +function _expandDefaultForm(ast, errors) { + var children = ast.cases.map(function (c) { + var expansionResult = expandNodes(c.expression); + errors.push.apply(errors, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])(expansionResult.errors)); + if (c.value === 'other') { + // other is the default case when no values match + return new Element("ng-template", [new Attribute('ngSwitchDefault', '', c.valueSourceSpan)], expansionResult.nodes, c.sourceSpan, c.sourceSpan, c.sourceSpan); + } + return new Element("ng-template", [new Attribute('ngSwitchCase', "" + c.value, c.valueSourceSpan)], expansionResult.nodes, c.sourceSpan, c.sourceSpan, c.sourceSpan); + }); + var switchAttr = new Attribute('[ngSwitch]', ast.switchValue, ast.switchValueSourceSpan); + return new Element('ng-container', [switchAttr], children, ast.sourceSpan, ast.sourceSpan, ast.sourceSpan); +} + +/** + * @license + * Copyright Google Inc. All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ +var PROPERTY_PARTS_SEPARATOR = '.'; +var ATTRIBUTE_PREFIX = 'attr'; +var CLASS_PREFIX = 'class'; +var STYLE_PREFIX = 'style'; +var ANIMATE_PROP_PREFIX = 'animate-'; +/** + * Parses bindings in templates and in the directive host area. + */ +var BindingParser = /** @class */ (function () { + function BindingParser(_exprParser, _interpolationConfig, _schemaRegistry, pipes, errors) { + this._exprParser = _exprParser; + this._interpolationConfig = _interpolationConfig; + this._schemaRegistry = _schemaRegistry; + this.errors = errors; + this.pipesByName = null; + this._usedPipes = new Map(); + // When the `pipes` parameter is `null`, do not check for used pipes + // This is used in IVY when we might not know the available pipes at compile time + if (pipes) { + var pipesByName_1 = new Map(); + pipes.forEach(function (pipe) { return pipesByName_1.set(pipe.name, pipe); }); + this.pipesByName = pipesByName_1; + } + } + BindingParser.prototype.getUsedPipes = function () { return Array.from(this._usedPipes.values()); }; + BindingParser.prototype.createBoundHostProperties = function (dirMeta, sourceSpan) { + var _this = this; + if (dirMeta.hostProperties) { + var boundProps_1 = []; + Object.keys(dirMeta.hostProperties).forEach(function (propName) { + var expression = dirMeta.hostProperties[propName]; + if (typeof expression === 'string') { + _this.parsePropertyBinding(propName, expression, true, sourceSpan, [], boundProps_1); + } + else { + _this._reportError("Value of the host property binding \"" + propName + "\" needs to be a string representing an expression but got \"" + expression + "\" (" + typeof expression + ")", sourceSpan); + } + }); + return boundProps_1; + } + return null; + }; + BindingParser.prototype.createDirectiveHostPropertyAsts = function (dirMeta, elementSelector, sourceSpan) { + var _this = this; + var boundProps = this.createBoundHostProperties(dirMeta, sourceSpan); + return boundProps && + boundProps.map(function (prop) { return _this.createBoundElementProperty(elementSelector, prop); }); + }; + BindingParser.prototype.createDirectiveHostEventAsts = function (dirMeta, sourceSpan) { + var _this = this; + if (dirMeta.hostListeners) { + var targetEvents_1 = []; + Object.keys(dirMeta.hostListeners).forEach(function (propName) { + var expression = dirMeta.hostListeners[propName]; + if (typeof expression === 'string') { + _this.parseEvent(propName, expression, sourceSpan, [], targetEvents_1); + } + else { + _this._reportError("Value of the host listener \"" + propName + "\" needs to be a string representing an expression but got \"" + expression + "\" (" + typeof expression + ")", sourceSpan); + } + }); + return targetEvents_1; + } + return null; + }; + BindingParser.prototype.parseInterpolation = function (value, sourceSpan) { + var sourceInfo = sourceSpan.start.toString(); + try { + var ast = this._exprParser.parseInterpolation(value, sourceInfo, this._interpolationConfig); + if (ast) + this._reportExpressionParserErrors(ast.errors, sourceSpan); + this._checkPipes(ast, sourceSpan); + return ast; + } + catch (e) { + this._reportError("" + e, sourceSpan); + return this._exprParser.wrapLiteralPrimitive('ERROR', sourceInfo); + } + }; + // Parse an inline template binding. ie `` + BindingParser.prototype.parseInlineTemplateBinding = function (tplKey, tplValue, sourceSpan, targetMatchableAttrs, targetProps, targetVars) { + var bindings = this._parseTemplateBindings(tplKey, tplValue, sourceSpan); + for (var i = 0; i < bindings.length; i++) { + var binding = bindings[i]; + if (binding.keyIsVar) { + targetVars.push(new ParsedVariable(binding.key, binding.name, sourceSpan)); + } + else if (binding.expression) { + this._parsePropertyAst(binding.key, binding.expression, sourceSpan, targetMatchableAttrs, targetProps); + } + else { + targetMatchableAttrs.push([binding.key, '']); + this.parseLiteralAttr(binding.key, null, sourceSpan, targetMatchableAttrs, targetProps); + } + } + }; + BindingParser.prototype._parseTemplateBindings = function (tplKey, tplValue, sourceSpan) { + var _this = this; + var sourceInfo = sourceSpan.start.toString(); + try { + var bindingsResult = this._exprParser.parseTemplateBindings(tplKey, tplValue, sourceInfo); + this._reportExpressionParserErrors(bindingsResult.errors, sourceSpan); + bindingsResult.templateBindings.forEach(function (binding) { + if (binding.expression) { + _this._checkPipes(binding.expression, sourceSpan); + } + }); + bindingsResult.warnings.forEach(function (warning) { _this._reportError(warning, sourceSpan, ParseErrorLevel.WARNING); }); + return bindingsResult.templateBindings; + } + catch (e) { + this._reportError("" + e, sourceSpan); + return []; + } + }; + BindingParser.prototype.parseLiteralAttr = function (name, value, sourceSpan, targetMatchableAttrs, targetProps) { + if (isAnimationLabel(name)) { + name = name.substring(1); + if (value) { + this._reportError("Assigning animation triggers via @prop=\"exp\" attributes with an expression is invalid." + + " Use property bindings (e.g. [@prop]=\"exp\") or use an attribute without a value (e.g. @prop) instead.", sourceSpan, ParseErrorLevel.ERROR); + } + this._parseAnimation(name, value, sourceSpan, targetMatchableAttrs, targetProps); + } + else { + targetProps.push(new ParsedProperty(name, this._exprParser.wrapLiteralPrimitive(value, ''), ParsedPropertyType.LITERAL_ATTR, sourceSpan)); + } + }; + BindingParser.prototype.parsePropertyBinding = function (name, expression, isHost, sourceSpan, targetMatchableAttrs, targetProps) { + var isAnimationProp = false; + if (name.startsWith(ANIMATE_PROP_PREFIX)) { + isAnimationProp = true; + name = name.substring(ANIMATE_PROP_PREFIX.length); + } + else if (isAnimationLabel(name)) { + isAnimationProp = true; + name = name.substring(1); + } + if (isAnimationProp) { + this._parseAnimation(name, expression, sourceSpan, targetMatchableAttrs, targetProps); + } + else { + this._parsePropertyAst(name, this._parseBinding(expression, isHost, sourceSpan), sourceSpan, targetMatchableAttrs, targetProps); + } + }; + BindingParser.prototype.parsePropertyInterpolation = function (name, value, sourceSpan, targetMatchableAttrs, targetProps) { + var expr = this.parseInterpolation(value, sourceSpan); + if (expr) { + this._parsePropertyAst(name, expr, sourceSpan, targetMatchableAttrs, targetProps); + return true; + } + return false; + }; + BindingParser.prototype._parsePropertyAst = function (name, ast, sourceSpan, targetMatchableAttrs, targetProps) { + targetMatchableAttrs.push([name, ast.source]); + targetProps.push(new ParsedProperty(name, ast, ParsedPropertyType.DEFAULT, sourceSpan)); + }; + BindingParser.prototype._parseAnimation = function (name, expression, sourceSpan, targetMatchableAttrs, targetProps) { + // This will occur when a @trigger is not paired with an expression. + // For animations it is valid to not have an expression since */void + // states will be applied by angular when the element is attached/detached + var ast = this._parseBinding(expression || 'undefined', false, sourceSpan); + targetMatchableAttrs.push([name, ast.source]); + targetProps.push(new ParsedProperty(name, ast, ParsedPropertyType.ANIMATION, sourceSpan)); + }; + BindingParser.prototype._parseBinding = function (value, isHostBinding, sourceSpan) { + var sourceInfo = (sourceSpan && sourceSpan.start || '(unknown)').toString(); + try { + var ast = isHostBinding ? + this._exprParser.parseSimpleBinding(value, sourceInfo, this._interpolationConfig) : + this._exprParser.parseBinding(value, sourceInfo, this._interpolationConfig); + if (ast) + this._reportExpressionParserErrors(ast.errors, sourceSpan); + this._checkPipes(ast, sourceSpan); + return ast; + } + catch (e) { + this._reportError("" + e, sourceSpan); + return this._exprParser.wrapLiteralPrimitive('ERROR', sourceInfo); + } + }; + BindingParser.prototype.createBoundElementProperty = function (elementSelector, boundProp) { + if (boundProp.isAnimation) { + return new BoundElementProperty(boundProp.name, 4 /* Animation */, SecurityContext.NONE, boundProp.expression, null, boundProp.sourceSpan); + } + var unit = null; + var bindingType = undefined; + var boundPropertyName = null; + var parts = boundProp.name.split(PROPERTY_PARTS_SEPARATOR); + var securityContexts = undefined; + // Check check for special cases (prefix style, attr, class) + if (parts.length > 1) { + if (parts[0] == ATTRIBUTE_PREFIX) { + boundPropertyName = parts[1]; + this._validatePropertyOrAttributeName(boundPropertyName, boundProp.sourceSpan, true); + securityContexts = calcPossibleSecurityContexts(this._schemaRegistry, elementSelector, boundPropertyName, true); + var nsSeparatorIdx = boundPropertyName.indexOf(':'); + if (nsSeparatorIdx > -1) { + var ns = boundPropertyName.substring(0, nsSeparatorIdx); + var name_1 = boundPropertyName.substring(nsSeparatorIdx + 1); + boundPropertyName = mergeNsAndName(ns, name_1); + } + bindingType = 1 /* Attribute */; + } + else if (parts[0] == CLASS_PREFIX) { + boundPropertyName = parts[1]; + bindingType = 2 /* Class */; + securityContexts = [SecurityContext.NONE]; + } + else if (parts[0] == STYLE_PREFIX) { + unit = parts.length > 2 ? parts[2] : null; + boundPropertyName = parts[1]; + bindingType = 3 /* Style */; + securityContexts = [SecurityContext.STYLE]; + } + } + // If not a special case, use the full property name + if (boundPropertyName === null) { + boundPropertyName = this._schemaRegistry.getMappedPropName(boundProp.name); + securityContexts = calcPossibleSecurityContexts(this._schemaRegistry, elementSelector, boundPropertyName, false); + bindingType = 0 /* Property */; + this._validatePropertyOrAttributeName(boundPropertyName, boundProp.sourceSpan, false); + } + return new BoundElementProperty(boundPropertyName, bindingType, securityContexts[0], boundProp.expression, unit, boundProp.sourceSpan); + }; + BindingParser.prototype.parseEvent = function (name, expression, sourceSpan, targetMatchableAttrs, targetEvents) { + if (isAnimationLabel(name)) { + name = name.substr(1); + this._parseAnimationEvent(name, expression, sourceSpan, targetEvents); + } + else { + this._parseRegularEvent(name, expression, sourceSpan, targetMatchableAttrs, targetEvents); + } + }; + BindingParser.prototype._parseAnimationEvent = function (name, expression, sourceSpan, targetEvents) { + var matches = splitAtPeriod(name, [name, '']); + var eventName = matches[0]; + var phase = matches[1].toLowerCase(); + if (phase) { + switch (phase) { + case 'start': + case 'done': + var ast = this._parseAction(expression, sourceSpan); + targetEvents.push(new ParsedEvent(eventName, phase, 1 /* Animation */, ast, sourceSpan)); + break; + default: + this._reportError("The provided animation output phase value \"" + phase + "\" for \"@" + eventName + "\" is not supported (use start or done)", sourceSpan); + break; + } + } + else { + this._reportError("The animation trigger output event (@" + eventName + ") is missing its phase value name (start or done are currently supported)", sourceSpan); + } + }; + BindingParser.prototype._parseRegularEvent = function (name, expression, sourceSpan, targetMatchableAttrs, targetEvents) { + // long format: 'target: eventName' + var _a = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__read"])(splitAtColon(name, [null, name]), 2), target = _a[0], eventName = _a[1]; + var ast = this._parseAction(expression, sourceSpan); + targetMatchableAttrs.push([name, ast.source]); + targetEvents.push(new ParsedEvent(eventName, target, 0 /* Regular */, ast, sourceSpan)); + // Don't detect directives for event names for now, + // so don't add the event name to the matchableAttrs + }; + BindingParser.prototype._parseAction = function (value, sourceSpan) { + var sourceInfo = (sourceSpan && sourceSpan.start || '(unknown').toString(); + try { + var ast = this._exprParser.parseAction(value, sourceInfo, this._interpolationConfig); + if (ast) { + this._reportExpressionParserErrors(ast.errors, sourceSpan); + } + if (!ast || ast.ast instanceof EmptyExpr) { + this._reportError("Empty expressions are not allowed", sourceSpan); + return this._exprParser.wrapLiteralPrimitive('ERROR', sourceInfo); + } + this._checkPipes(ast, sourceSpan); + return ast; + } + catch (e) { + this._reportError("" + e, sourceSpan); + return this._exprParser.wrapLiteralPrimitive('ERROR', sourceInfo); + } + }; + BindingParser.prototype._reportError = function (message, sourceSpan, level) { + if (level === void 0) { level = ParseErrorLevel.ERROR; } + this.errors.push(new ParseError(sourceSpan, message, level)); + }; + BindingParser.prototype._reportExpressionParserErrors = function (errors, sourceSpan) { + var e_1, _a; + try { + for (var errors_1 = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__values"])(errors), errors_1_1 = errors_1.next(); !errors_1_1.done; errors_1_1 = errors_1.next()) { + var error$$1 = errors_1_1.value; + this._reportError(error$$1.message, sourceSpan); + } + } + catch (e_1_1) { e_1 = { error: e_1_1 }; } + finally { + try { + if (errors_1_1 && !errors_1_1.done && (_a = errors_1.return)) _a.call(errors_1); + } + finally { if (e_1) throw e_1.error; } + } + }; + // Make sure all the used pipes are known in `this.pipesByName` + BindingParser.prototype._checkPipes = function (ast, sourceSpan) { + var _this = this; + if (ast && this.pipesByName) { + var collector = new PipeCollector(); + ast.visit(collector); + collector.pipes.forEach(function (ast, pipeName) { + var pipeMeta = _this.pipesByName.get(pipeName); + if (!pipeMeta) { + _this._reportError("The pipe '" + pipeName + "' could not be found", new ParseSourceSpan(sourceSpan.start.moveBy(ast.span.start), sourceSpan.start.moveBy(ast.span.end))); + } + else { + _this._usedPipes.set(pipeName, pipeMeta); + } + }); + } + }; + /** + * @param propName the name of the property / attribute + * @param sourceSpan + * @param isAttr true when binding to an attribute + */ + BindingParser.prototype._validatePropertyOrAttributeName = function (propName, sourceSpan, isAttr) { + var report = isAttr ? this._schemaRegistry.validateAttribute(propName) : + this._schemaRegistry.validateProperty(propName); + if (report.error) { + this._reportError(report.msg, sourceSpan, ParseErrorLevel.ERROR); + } + }; + return BindingParser; +}()); +var PipeCollector = /** @class */ (function (_super) { + Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(PipeCollector, _super); + function PipeCollector() { + var _this = _super !== null && _super.apply(this, arguments) || this; + _this.pipes = new Map(); + return _this; + } + PipeCollector.prototype.visitPipe = function (ast, context) { + this.pipes.set(ast.name, ast); + ast.exp.visit(this); + this.visitAll(ast.args, context); + return null; + }; + return PipeCollector; +}(RecursiveAstVisitor)); +function isAnimationLabel(name) { + return name[0] == '@'; +} +function calcPossibleSecurityContexts(registry, selector, propName, isAttribute) { + var ctxs = []; + CssSelector.parse(selector).forEach(function (selector) { + var elementNames = selector.element ? [selector.element] : registry.allKnownElementNames(); + var notElementNames = new Set(selector.notSelectors.filter(function (selector) { return selector.isElementSelector(); }) + .map(function (selector) { return selector.element; })); + var possibleElementNames = elementNames.filter(function (elementName) { return !notElementNames.has(elementName); }); + ctxs.push.apply(ctxs, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])(possibleElementNames.map(function (elementName) { return registry.securityContext(elementName, propName, isAttribute); }))); + }); + return ctxs.length === 0 ? [SecurityContext.NONE] : Array.from(new Set(ctxs)).sort(); +} + +/** + * @license + * Copyright Google Inc. All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ +var BIND_NAME_REGEXP = /^(?:(?:(?:(bind-)|(let-)|(ref-|#)|(on-)|(bindon-)|(@))(.+))|\[\(([^\)]+)\)\]|\[([^\]]+)\]|\(([^\)]+)\))$/; +// Group 1 = "bind-" +var KW_BIND_IDX = 1; +// Group 2 = "let-" +var KW_LET_IDX = 2; +// Group 3 = "ref-/#" +var KW_REF_IDX = 3; +// Group 4 = "on-" +var KW_ON_IDX = 4; +// Group 5 = "bindon-" +var KW_BINDON_IDX = 5; +// Group 6 = "@" +var KW_AT_IDX = 6; +// Group 7 = the identifier after "bind-", "let-", "ref-/#", "on-", "bindon-" or "@" +var IDENT_KW_IDX = 7; +// Group 8 = identifier inside [()] +var IDENT_BANANA_BOX_IDX = 8; +// Group 9 = identifier inside [] +var IDENT_PROPERTY_IDX = 9; +// Group 10 = identifier inside () +var IDENT_EVENT_IDX = 10; +var TEMPLATE_ATTR_PREFIX = '*'; +var CLASS_ATTR = 'class'; +var _TEXT_CSS_SELECTOR; +function TEXT_CSS_SELECTOR() { + if (!_TEXT_CSS_SELECTOR) { + _TEXT_CSS_SELECTOR = CssSelector.parse('*')[0]; + } + return _TEXT_CSS_SELECTOR; +} +var TemplateParseError = /** @class */ (function (_super) { + Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(TemplateParseError, _super); + function TemplateParseError(message, span, level) { + return _super.call(this, span, message, level) || this; + } + return TemplateParseError; +}(ParseError)); +var TemplateParseResult = /** @class */ (function () { + function TemplateParseResult(templateAst, usedPipes, errors) { + this.templateAst = templateAst; + this.usedPipes = usedPipes; + this.errors = errors; + } + return TemplateParseResult; +}()); +var TemplateParser = /** @class */ (function () { + function TemplateParser(_config, _reflector, _exprParser, _schemaRegistry, _htmlParser, _console, transforms) { + this._config = _config; + this._reflector = _reflector; + this._exprParser = _exprParser; + this._schemaRegistry = _schemaRegistry; + this._htmlParser = _htmlParser; + this._console = _console; + this.transforms = transforms; + } + Object.defineProperty(TemplateParser.prototype, "expressionParser", { + get: function () { return this._exprParser; }, + enumerable: true, + configurable: true + }); + TemplateParser.prototype.parse = function (component, template, directives, pipes, schemas, templateUrl, preserveWhitespaces) { + var result = this.tryParse(component, template, directives, pipes, schemas, templateUrl, preserveWhitespaces); + var warnings = result.errors.filter(function (error$$1) { return error$$1.level === ParseErrorLevel.WARNING; }); + var errors = result.errors.filter(function (error$$1) { return error$$1.level === ParseErrorLevel.ERROR; }); + if (warnings.length > 0) { + this._console.warn("Template parse warnings:\n" + warnings.join('\n')); + } + if (errors.length > 0) { + var errorString = errors.join('\n'); + throw syntaxError("Template parse errors:\n" + errorString, errors); + } + return { template: result.templateAst, pipes: result.usedPipes }; + }; + TemplateParser.prototype.tryParse = function (component, template, directives, pipes, schemas, templateUrl, preserveWhitespaces) { + var htmlParseResult = typeof template === 'string' ? + this._htmlParser.parse(template, templateUrl, true, this.getInterpolationConfig(component)) : + template; + if (!preserveWhitespaces) { + htmlParseResult = removeWhitespaces(htmlParseResult); + } + return this.tryParseHtml(this.expandHtml(htmlParseResult), component, directives, pipes, schemas); + }; + TemplateParser.prototype.tryParseHtml = function (htmlAstWithErrors, component, directives, pipes, schemas) { + var result; + var errors = htmlAstWithErrors.errors; + var usedPipes = []; + if (htmlAstWithErrors.rootNodes.length > 0) { + var uniqDirectives = removeSummaryDuplicates(directives); + var uniqPipes = removeSummaryDuplicates(pipes); + var providerViewContext = new ProviderViewContext(this._reflector, component); + var interpolationConfig = undefined; + if (component.template && component.template.interpolation) { + interpolationConfig = { + start: component.template.interpolation[0], + end: component.template.interpolation[1] + }; + } + var bindingParser = new BindingParser(this._exprParser, interpolationConfig, this._schemaRegistry, uniqPipes, errors); + var parseVisitor = new TemplateParseVisitor(this._reflector, this._config, providerViewContext, uniqDirectives, bindingParser, this._schemaRegistry, schemas, errors); + result = visitAll(parseVisitor, htmlAstWithErrors.rootNodes, EMPTY_ELEMENT_CONTEXT); + errors.push.apply(errors, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])(providerViewContext.errors)); + usedPipes.push.apply(usedPipes, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])(bindingParser.getUsedPipes())); + } + else { + result = []; + } + this._assertNoReferenceDuplicationOnTemplate(result, errors); + if (errors.length > 0) { + return new TemplateParseResult(result, usedPipes, errors); + } + if (this.transforms) { + this.transforms.forEach(function (transform) { result = templateVisitAll(transform, result); }); + } + return new TemplateParseResult(result, usedPipes, errors); + }; + TemplateParser.prototype.expandHtml = function (htmlAstWithErrors, forced) { + if (forced === void 0) { forced = false; } + var errors = htmlAstWithErrors.errors; + if (errors.length == 0 || forced) { + // Transform ICU messages to angular directives + var expandedHtmlAst = expandNodes(htmlAstWithErrors.rootNodes); + errors.push.apply(errors, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])(expandedHtmlAst.errors)); + htmlAstWithErrors = new ParseTreeResult(expandedHtmlAst.nodes, errors); + } + return htmlAstWithErrors; + }; + TemplateParser.prototype.getInterpolationConfig = function (component) { + if (component.template) { + return InterpolationConfig.fromArray(component.template.interpolation); + } + return undefined; + }; + /** @internal */ + TemplateParser.prototype._assertNoReferenceDuplicationOnTemplate = function (result, errors) { + var existingReferences = []; + result.filter(function (element) { return !!element.references; }) + .forEach(function (element) { return element.references.forEach(function (reference) { + var name = reference.name; + if (existingReferences.indexOf(name) < 0) { + existingReferences.push(name); + } + else { + var error$$1 = new TemplateParseError("Reference \"#" + name + "\" is defined several times", reference.sourceSpan, ParseErrorLevel.ERROR); + errors.push(error$$1); + } + }); }); + }; + return TemplateParser; +}()); +var TemplateParseVisitor = /** @class */ (function () { + function TemplateParseVisitor(reflector, config, providerViewContext, directives, _bindingParser, _schemaRegistry, _schemas, _targetErrors) { + var _this = this; + this.reflector = reflector; + this.config = config; + this.providerViewContext = providerViewContext; + this._bindingParser = _bindingParser; + this._schemaRegistry = _schemaRegistry; + this._schemas = _schemas; + this._targetErrors = _targetErrors; + this.selectorMatcher = new SelectorMatcher(); + this.directivesIndex = new Map(); + this.ngContentCount = 0; + // Note: queries start with id 1 so we can use the number in a Bloom filter! + this.contentQueryStartId = providerViewContext.component.viewQueries.length + 1; + directives.forEach(function (directive, index) { + var selector = CssSelector.parse(directive.selector); + _this.selectorMatcher.addSelectables(selector, directive); + _this.directivesIndex.set(directive, index); + }); + } + TemplateParseVisitor.prototype.visitExpansion = function (expansion, context) { return null; }; + TemplateParseVisitor.prototype.visitExpansionCase = function (expansionCase, context) { return null; }; + TemplateParseVisitor.prototype.visitText = function (text, parent) { + var ngContentIndex = parent.findNgContentIndex(TEXT_CSS_SELECTOR()); + var valueNoNgsp = replaceNgsp(text.value); + var expr = this._bindingParser.parseInterpolation(valueNoNgsp, text.sourceSpan); + return expr ? new BoundTextAst(expr, ngContentIndex, text.sourceSpan) : + new TextAst(valueNoNgsp, ngContentIndex, text.sourceSpan); + }; + TemplateParseVisitor.prototype.visitAttribute = function (attribute, context) { + return new AttrAst(attribute.name, attribute.value, attribute.sourceSpan); + }; + TemplateParseVisitor.prototype.visitComment = function (comment, context) { return null; }; + TemplateParseVisitor.prototype.visitElement = function (element, parent) { + var _this = this; + var queryStartIndex = this.contentQueryStartId; + var elName = element.name; + var preparsedElement = preparseElement(element); + if (preparsedElement.type === PreparsedElementType.SCRIPT || + preparsedElement.type === PreparsedElementType.STYLE) { + // Skipping + + + +
+
+ +
+
+ + + diff --git a/src_angular/src/karma.conf.js b/src_angular/src/karma.conf.js new file mode 100644 index 0000000..b6e0042 --- /dev/null +++ b/src_angular/src/karma.conf.js @@ -0,0 +1,31 @@ +// Karma configuration file, see link for more information +// https://karma-runner.github.io/1.0/config/configuration-file.html + +module.exports = function (config) { + config.set({ + basePath: '', + frameworks: ['jasmine', '@angular-devkit/build-angular'], + plugins: [ + require('karma-jasmine'), + require('karma-chrome-launcher'), + require('karma-jasmine-html-reporter'), + require('karma-coverage-istanbul-reporter'), + require('@angular-devkit/build-angular/plugins/karma') + ], + client: { + clearContext: false // leave Jasmine Spec Runner output visible in browser + }, + coverageIstanbulReporter: { + dir: require('path').join(__dirname, '../coverage'), + reports: ['html', 'lcovonly'], + fixWebpackSourcePaths: true + }, + reporters: ['progress', 'kjhtml'], + port: 9876, + colors: true, + logLevel: config.LOG_INFO, + autoWatch: true, + browsers: ['Chrome'], + singleRun: false + }); +}; \ No newline at end of file diff --git a/src_angular/src/main.ts b/src_angular/src/main.ts new file mode 100644 index 0000000..28bfa9e --- /dev/null +++ b/src_angular/src/main.ts @@ -0,0 +1,13 @@ +import { enableProdMode } from '@angular/core'; +import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; + +import { AppModule } from './app/app.module'; +import { environment } from './environments/environment'; + +if (environment.production) { + enableProdMode(); +} + +platformBrowserDynamic().bootstrapModule(AppModule) + .catch(err => console.error(err)); + diff --git a/src_angular/src/polyfills.ts b/src_angular/src/polyfills.ts new file mode 100644 index 0000000..d310405 --- /dev/null +++ b/src_angular/src/polyfills.ts @@ -0,0 +1,80 @@ +/** + * This file includes polyfills needed by Angular and is loaded before the app. + * You can add your own extra polyfills to this file. + * + * This file is divided into 2 sections: + * 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers. + * 2. Application imports. Files imported after ZoneJS that should be loaded before your main + * file. + * + * The current setup is for so-called "evergreen" browsers; the last versions of browsers that + * automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera), + * Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile. + * + * Learn more in https://angular.io/docs/ts/latest/guide/browser-support.html + */ + +/*************************************************************************************************** + * BROWSER POLYFILLS + */ + +/** IE9, IE10 and IE11 requires all of the following polyfills. **/ +// import 'core-js/es6/symbol'; +// import 'core-js/es6/object'; +// import 'core-js/es6/function'; +// import 'core-js/es6/parse-int'; +// import 'core-js/es6/parse-float'; +// import 'core-js/es6/number'; +// import 'core-js/es6/math'; +// import 'core-js/es6/string'; +// import 'core-js/es6/date'; +// import 'core-js/es6/array'; +// import 'core-js/es6/regexp'; +// import 'core-js/es6/map'; +// import 'core-js/es6/weak-map'; +// import 'core-js/es6/set'; + +/** IE10 and IE11 requires the following for NgClass support on SVG elements */ +// import 'classlist.js'; // Run `npm install --save classlist.js`. + +/** IE10 and IE11 requires the following for the Reflect API. */ +// import 'core-js/es6/reflect'; + + +/** Evergreen browsers require these. **/ +// Used for reflect-metadata in JIT. If you use AOT (and only Angular decorators), you can remove. +import 'core-js/es7/reflect'; + + +/** + * Web Animations `@angular/platform-browser/animations` + * Only required if AnimationBuilder is used within the application and using IE/Edge or Safari. + * Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0). + **/ +// import 'web-animations-js'; // Run `npm install --save web-animations-js`. + +/** + * By default, zone.js will patch all possible macroTask and DomEvents + * user can disable parts of macroTask/DomEvents patch by setting following flags + */ + + // (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame + // (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick + // (window as any).__zone_symbol__BLACK_LISTED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames + + /* + * in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js + * with the following flag, it will bypass `zone.js` patch for IE/Edge + */ +// (window as any).__Zone_enable_cross_context_check = true; + +/*************************************************************************************************** + * Zone JS is required by default for Angular itself. + */ +import 'zone.js/dist/zone'; // Included with Angular CLI. + + + +/*************************************************************************************************** + * APPLICATION IMPORTS + */ diff --git a/src_angular/src/styles.css b/src_angular/src/styles.css new file mode 100644 index 0000000..e1383e0 --- /dev/null +++ b/src_angular/src/styles.css @@ -0,0 +1,27 @@ +html{ + margin: 0; + width: 100%; + height: 100%; + background-image: + linear-gradient( rgba(0,0,0,.5), rgba(0, 0, 0, 0.6) ), + url("/assets/img/bg_radi_red_dark.png"); + touch-action: none; +} + +.wrapper { + /* Break the flow */ + position: absolute; + top: 0px; + /* Give them all the available space */ + width: 100%; + height: 100%; + + /* Remove the margins if any */ + margin: 0; + overflow: hidden; + + } + + main{ + height: 100%; + } \ No newline at end of file diff --git a/src_angular/src/test.ts b/src_angular/src/test.ts new file mode 100644 index 0000000..1631789 --- /dev/null +++ b/src_angular/src/test.ts @@ -0,0 +1,20 @@ +// This file is required by karma.conf.js and loads recursively all the .spec and framework files + +import 'zone.js/dist/zone-testing'; +import { getTestBed } from '@angular/core/testing'; +import { + BrowserDynamicTestingModule, + platformBrowserDynamicTesting +} from '@angular/platform-browser-dynamic/testing'; + +declare const require: any; + +// First, initialize the Angular testing environment. +getTestBed().initTestEnvironment( + BrowserDynamicTestingModule, + platformBrowserDynamicTesting() +); +// Then we find all the tests. +const context = require.context('./', true, /\.spec\.ts$/); +// And load the modules. +context.keys().map(context); diff --git a/src_angular/src/tsconfig.app.json b/src_angular/src/tsconfig.app.json new file mode 100644 index 0000000..190fd30 --- /dev/null +++ b/src_angular/src/tsconfig.app.json @@ -0,0 +1,11 @@ +{ + "extends": "../tsconfig.json", + "compilerOptions": { + "outDir": "../out-tsc/app", + "types": [] + }, + "exclude": [ + "test.ts", + "**/*.spec.ts" + ] +} diff --git a/src_angular/src/tsconfig.spec.json b/src_angular/src/tsconfig.spec.json new file mode 100644 index 0000000..de77336 --- /dev/null +++ b/src_angular/src/tsconfig.spec.json @@ -0,0 +1,18 @@ +{ + "extends": "../tsconfig.json", + "compilerOptions": { + "outDir": "../out-tsc/spec", + "types": [ + "jasmine", + "node" + ] + }, + "files": [ + "test.ts", + "polyfills.ts" + ], + "include": [ + "**/*.spec.ts", + "**/*.d.ts" + ] +} diff --git a/src_angular/src/tslint.json b/src_angular/src/tslint.json new file mode 100644 index 0000000..52e2c1a --- /dev/null +++ b/src_angular/src/tslint.json @@ -0,0 +1,17 @@ +{ + "extends": "../tslint.json", + "rules": { + "directive-selector": [ + true, + "attribute", + "app", + "camelCase" + ], + "component-selector": [ + true, + "element", + "app", + "kebab-case" + ] + } +} diff --git a/src_angular/tsconfig.json b/src_angular/tsconfig.json new file mode 100644 index 0000000..6c1438a --- /dev/null +++ b/src_angular/tsconfig.json @@ -0,0 +1,25 @@ +{ + "compileOnSave": false, + "compilerOptions": { + "baseUrl": "./", + "outDir": "./dist/out-tsc", + "sourceMap": true, + "declaration": false, + "module": "es2015", + "moduleResolution": "node", + "emitDecoratorMetadata": true, + "experimentalDecorators": true, + "target": "es5", + "typeRoots": [ + "node_modules/@types" + ], + "lib": [ + "dom", + "es6", + "es5" + ], + }, + "exclude": [ + "*.tsx" + ] +} diff --git a/src_angular/tslint.json b/src_angular/tslint.json new file mode 100644 index 0000000..6ddb6b2 --- /dev/null +++ b/src_angular/tslint.json @@ -0,0 +1,131 @@ +{ + "rulesDirectory": [ + "node_modules/codelyzer" + ], + "rules": { + "arrow-return-shorthand": true, + "callable-types": true, + "class-name": true, + "comment-format": [ + true, + "check-space" + ], + "curly": true, + "deprecation": { + "severity": "warn" + }, + "eofline": true, + "forin": true, + "import-blacklist": [ + true, + "rxjs/Rx" + ], + "import-spacing": true, + "indent": [ + true, + "spaces" + ], + "interface-over-type-literal": true, + "label-position": true, + "max-line-length": [ + true, + 140 + ], + "member-access": false, + "member-ordering": [ + true, + { + "order": [ + "static-field", + "instance-field", + "static-method", + "instance-method" + ] + } + ], + "no-arg": true, + "no-bitwise": true, + "no-console": [ + true, + "debug", + "info", + "time", + "timeEnd", + "trace" + ], + "no-construct": true, + "no-debugger": true, + "no-duplicate-super": true, + "no-empty": false, + "no-empty-interface": true, + "no-eval": true, + "no-inferrable-types": [ + true, + "ignore-params" + ], + "no-misused-new": true, + "no-non-null-assertion": true, + "no-redundant-jsdoc": true, + "no-shadowed-variable": true, + "no-string-literal": false, + "no-string-throw": true, + "no-switch-case-fall-through": true, + "no-trailing-whitespace": true, + "no-unnecessary-initializer": true, + "no-unused-expression": true, + "no-use-before-declare": true, + "no-var-keyword": true, + "object-literal-sort-keys": false, + "one-line": [ + true, + "check-open-brace", + "check-catch", + "check-else", + "check-whitespace" + ], + "prefer-const": true, + "quotemark": [ + true, + "single" + ], + "radix": true, + "semicolon": [ + true, + "always" + ], + "triple-equals": [ + true, + "allow-null-check" + ], + "typedef-whitespace": [ + true, + { + "call-signature": "nospace", + "index-signature": "nospace", + "parameter": "nospace", + "property-declaration": "nospace", + "variable-declaration": "nospace" + } + ], + "unified-signatures": true, + "variable-name": false, + "whitespace": [ + true, + "check-branch", + "check-decl", + "check-operator", + "check-separator", + "check-type" + ], + "no-output-on-prefix": true, + "use-input-property-decorator": true, + "use-output-property-decorator": true, + "use-host-property-decorator": true, + "no-input-rename": true, + "no-output-rename": true, + "use-life-cycle-interface": true, + "use-pipe-transform-interface": true, + "component-class-suffix": true, + "directive-class-suffix": true + } +} diff --git a/src_php/css/style.css b/src_php/css/style.css new file mode 100644 index 0000000..b7a1437 --- /dev/null +++ b/src_php/css/style.css @@ -0,0 +1,60 @@ +.post-ui-message{ + padding : 10px; + margin-bottom : 18px; + background: rgb(189, 198, 247); + border-style: solid; + border-width: 1px; + border-color: #a99ec7; + border-radius: 5px; +} + +div { + margin-bottom: 8px; +} + +.ascii{ + display: inline-block; + font-family: "Lucida Console", Monaco, monospace; +} + +textarea +{ + width: 100%; + margin: 0; +} + +.post-message { + padding : 10px; + margin-bottom : 18px; + background: rgb(228, 221, 221); + border-style: solid; + border-width: 1px; + border-color: rgb(131, 123, 123); + border-radius: 5px; +} + +.post-torrent-info{ + font-family: 'Courier New', Courier, monospace; + font-size: small; + padding : 8px; + color: white; + background:rgb(70, 61, 56); + border-radius: 5px; +} + +.post-message img { + max-width: 650px; + width: 100%; + height: auto; +} + +.post-message video { + max-width: 650px; + width: 100%; + height: auto; +} + +.post-message audio { + max-width: 650px; + width: 100%; +} \ No newline at end of file diff --git a/src_php/img/.htaccess b/src_php/img/.htaccess new file mode 100755 index 0000000..d5d6eda --- /dev/null +++ b/src_php/img/.htaccess @@ -0,0 +1,6 @@ +Options +FollowSymlinks +RewriteEngine on +RewriteRule ^([a-z0-9-_]+).jpeg ?name=$1.jpeg +RewriteRule ^([a-z0-9-_]+).jpg ?name=$1.jpg +RewriteRule ^([a-z0-9-_]+).gif ?name=$1.gif +RewriteRule ^([a-z0-9-_]+).png ?name=$1.png \ No newline at end of file diff --git a/src_php/img/breadchan_preview.png b/src_php/img/breadchan_preview.png new file mode 100644 index 0000000..f5b57cf Binary files /dev/null and b/src_php/img/breadchan_preview.png differ diff --git a/src_php/img/index.php b/src_php/img/index.php new file mode 100644 index 0000000..9ecbd8e --- /dev/null +++ b/src_php/img/index.php @@ -0,0 +1,29 @@ + \ No newline at end of file diff --git a/src_php/index.html b/src_php/index.html new file mode 100644 index 0000000..20f7812 --- /dev/null +++ b/src_php/index.html @@ -0,0 +1,30 @@ + + + + + + + AnonIB-3D Server + + + + + + + + + + + + + +
+ +
+

Welcome on AnonIB-3D server-side!

+ +
+ + + \ No newline at end of file diff --git a/src_php/libs/blob-util@latest.js b/src_php/libs/blob-util@latest.js new file mode 100644 index 0000000..f1efebf --- /dev/null +++ b/src_php/libs/blob-util@latest.js @@ -0,0 +1 @@ +!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var r;r="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,r.blobUtil=e()}}(function(){return function e(r,n,t){function o(u,f){if(!n[u]){if(!r[u]){var a="function"==typeof require&&require;if(!f&&a)return a(u,!0);if(i)return i(u,!0);var c=new Error("Cannot find module '"+u+"'");throw c.code="MODULE_NOT_FOUND",c}var d=n[u]={exports:{}};r[u][0].call(d.exports,function(e){var n=r[u][1][e];return o(n?n:e)},d,d.exports,e,r,n,t)}return n[u].exports}for(var i="function"==typeof require&&require,u=0;u 1048576 ? (x / 1048576).toFixed(1) + 'Mb' : (x==1024?'1Mb': (x / 1024).toFixed(1) + 'Kb' ) + }; + // utility function to return an array of + function FILE_LIST(x){ + return ((x.files&&x.files.length) ? x.files : null) || [{ + name: x.value, + size: 0, + type: ((x.value || '').match(/[^\.]+$/i) || [''])[0] + }]; + }; + + // plugin initialization + $.fn.MultiFile = function (options) { + if (this.length == 0) return this; // quick fail + + // Handle API methods + if (typeof arguments[0] == 'string') { + // Perform API methods on individual elements + if (this.length > 1) { + var args = arguments; + return this.each(function () { + $.fn.MultiFile.apply($(this), args); + }); + }; + // Invoke API method handler (and return whatever it wants to return) + return $.fn.MultiFile[arguments[0]].apply(this, $.makeArray(arguments).slice(1) || []); + }; + + // Accept number + if (typeof options == 'number') { + options = {max: options}; + }; + + // Initialize options for this call + var options = $.extend({} /* new object */ , + $.fn.MultiFile.options /* default options */ , + options || {} /* just-in-time options */ + ); + + // Empty Element Fix!!! + // this code will automatically intercept native form submissions + // and disable empty file elements + $('form') + .not('MultiFile-intercepted') + .addClass('MultiFile-intercepted') + .submit($.fn.MultiFile.disableEmpty); + + //### http://plugins.jquery.com/node/1363 + // utility method to integrate this plugin with others... + if ($.fn.MultiFile.options.autoIntercept) { + $.fn.MultiFile.intercept($.fn.MultiFile.options.autoIntercept /* array of methods to intercept */ ); + $.fn.MultiFile.options.autoIntercept = null; /* only run this once */ + }; + + // loop through each matched element + this + .not('.MultiFile-applied') + .addClass('MultiFile-applied') + .each(function () { + //##################################################################### + // MAIN PLUGIN FUNCTIONALITY - START + //##################################################################### + + // BUG 1251 FIX: http://plugins.jquery.com/project/comments/add/1251 + // variable group_count would repeat itself on multiple calls to the plugin. + // this would cause a conflict with multiple elements + // changes scope of variable to global so id will be unique over n calls + window.MultiFile = (window.MultiFile || 0) + 1; + var group_count = window.MultiFile; + + // Copy parent attributes - Thanks to Jonas Wagner + // we will use this one to create new input elements + var MultiFile = { + e: this, + E: $(this), + clone: $(this).clone() + }; + + //=== + + //# USE CONFIGURATION + var o = $.extend({}, + $.fn.MultiFile.options, + options || {}, ($.metadata ? MultiFile.E.metadata() : ($.meta ? MultiFile.E.data() : null)) || {}, /* metadata options */ {} /* internals */ + ); + // limit number of files that can be selected? + if (!(o.max > 0) /*IsNull(MultiFile.max)*/ ) { + o.max = MultiFile.E.attr('maxlength'); + }; + if (!(o.max > 0) /*IsNull(MultiFile.max)*/ ) { + o.max = (String(MultiFile.e.className.match(/\b(max|limit)\-([0-9]+)\b/gi) || ['']).match(/[0-9]+/gi) || [''])[0]; + if (!(o.max > 0)) o.max = -1; + else o.max = String(o.max).match(/[0-9]+/gi)[0]; + }; + o.max = new Number(o.max); + // limit extensions? + o.accept = o.accept || MultiFile.E.attr('accept') || ''; + if (!o.accept) { + o.accept = (MultiFile.e.className.match(/\b(accept\-[\w\|]+)\b/gi)) || ''; + o.accept = new String(o.accept).replace(/^(accept|ext)\-/i, ''); + }; + // limit total pay load size + o.maxsize = o.maxsize>0?o.maxsize:null || MultiFile.E.data('maxsize') || 0; + if (!(o.maxsize > 0) /*IsNull(MultiFile.maxsize)*/ ) { + o.maxsize = (String(MultiFile.e.className.match(/\b(maxsize|maxload|size)\-([0-9]+)\b/gi) || ['']).match(/[0-9]+/gi) || [''])[0]; + if (!(o.maxsize > 0)) o.maxsize = -1; + else o.maxsize = String(o.maxsize).match(/[0-9]+/gi)[0]; + }; + // limit individual file size + o.maxfile = o.maxfile>0?o.maxfile:null || MultiFile.E.data('maxfile') || 0; + if (!(o.maxfile > 0) /*IsNull(MultiFile.maxfile)*/ ) { + o.maxfile = (String(MultiFile.e.className.match(/\b(maxfile|filemax)\-([0-9]+)\b/gi) || ['']).match(/[0-9]+/gi) || [''])[0]; + if (!(o.maxfile > 0)) o.maxfile = -1; + else o.maxfile = String(o.maxfile).match(/[0-9]+/gi)[0]; + }; + + //=== + + // size options are accepted in kylobytes, so multiple them by 1024 + if(o.maxfile>1) o.maxfile = o.maxfile * 1024; + if(o.maxsize>1) o.maxsize = o.maxsize * 1024; + + //=== + + // HTML5: enforce multiple selection to be enabled, except when explicitly disabled + if (o.multiple !== false) { + if (o.max > 1) MultiFile.E.attr('multiple', 'multiple').prop('multiple', true); + } + + //=== + + // APPLY CONFIGURATION + $.extend(MultiFile, o || {}); + MultiFile.STRING = $.extend({}, $.fn.MultiFile.options.STRING, MultiFile.STRING); + + //=== + + //######################################### + // PRIVATE PROPERTIES/METHODS + $.extend(MultiFile, { + n: 0, // How many elements are currently selected? + slaves: [], + files: [], + instanceKey: MultiFile.e.id || 'MultiFile' + String(group_count), // Instance Key? + generateID: function (z) { + return MultiFile.instanceKey + (z > 0 ? '_F' + String(z) : ''); + }, + trigger: function (event, element, MultiFile, files) { + var rv, handler = MultiFile[event] || MultiFile['on'+event] ; + if (handler){ + files = files || MultiFile.files || FILE_LIST(this); + ; + $.each(files,function(i, file){ + // execute function in element's context, so 'this' variable is current element + rv = handler.apply(MultiFile.wrapper, [element, file.name, MultiFile, file]); + }); + return rv; + }; + } + }); + + //=== + + // Setup dynamic regular expression for extension validation + // - thanks to John-Paul Bader: http://smyck.de/2006/08/11/javascript-dynamic-regular-expresions/ + if (String(MultiFile.accept).length > 1) { + MultiFile.accept = MultiFile.accept.replace(/\W+/g, '|').replace(/^\W|\W$/g, ''); + MultiFile.rxAccept = new RegExp('\\.(' + (MultiFile.accept ? MultiFile.accept : '') + ')$', 'gi'); + }; + + //=== + + // Create wrapper to hold our file list + MultiFile.wrapID = MultiFile.instanceKey;// + '_wrap'; // Wrapper ID? + MultiFile.E.wrap('
'); + MultiFile.wrapper = $('#' + MultiFile.wrapID + ''); + + //=== + + // MultiFile MUST have a name - default: file1[], file2[], file3[] + MultiFile.e.name = MultiFile.e.name || 'file' + group_count + '[]'; + + //=== + + if (!MultiFile.list) { + // Create a wrapper for the list + // * OPERA BUG: NO_MODIFICATION_ALLOWED_ERR ('list' is a read-only property) + // this change allows us to keep the files in the order they were selected + MultiFile.wrapper.append('
'); + MultiFile.list = $('#' + MultiFile.wrapID + '_list'); + }; + MultiFile.list = $(MultiFile.list); + + //=== + + // Bind a new element + MultiFile.addSlave = function (slave, slave_count) { + //if(window.console) console.log('MultiFile.addSlave',slave_count); + + // Keep track of how many elements have been displayed + MultiFile.n++; + // Add reference to master element + slave.MultiFile = MultiFile; + + // BUG FIX: http://plugins.jquery.com/node/1495 + // Clear identifying properties from clones + slave.id = slave.name = ''; + + // Define element's ID and name (upload components need this!) + //slave.id = slave.id || MultiFile.generateID(slave_count); + slave.id = MultiFile.generateID(slave_count); + //FIX for: http://code.google.com/p/jquery-multifile-plugin/issues/detail?id=23 + //CHANGE v2.2.1 - change ID of all file elements, keep original ID in wrapper + + // 2008-Apr-29: New customizable naming convention (see url below) + // http://groups.google.com/group/jquery-dev/browse_frm/thread/765c73e41b34f924# + slave.name = String(MultiFile.namePattern + /*master name*/ + .replace(/\$name/gi, $(MultiFile.clone).attr('name')) + /*master id */ + .replace(/\$id/gi, $(MultiFile.clone).attr('id')) + /*group count*/ + .replace(/\$g/gi, group_count) //(group_count>0?group_count:'')) + /*slave count*/ + .replace(/\$i/gi, slave_count) //(slave_count>0?slave_count:'')) + ); + + // If we've reached maximum number, disable input slave + var disable_slave; + if ((MultiFile.max > 0) && ((MultiFile.files.length) > (MultiFile.max))) { + slave.disabled = true; + disable_slave = true; + }; + + // Remember most recent slave + MultiFile.current = slave; + + // We'll use jQuery from now on + slave = $(slave); + + // Clear value + slave.val('').attr('value', '')[0].value = ''; + + // Stop plugin initializing on slaves + slave.addClass('MultiFile-applied'); + + // Triggered when a file is selected + slave.change(function (a, b, c) { + //if(window.console) console.log('MultiFile.slave.change',slave_count); + //if(window.console) console.log('MultiFile.slave.change',this.files); + + // Lose focus to stop IE7 firing onchange again + $(this).blur(); + + //# NEW 2014-04-14 - accept multiple file selection, HTML5 + var e = this, + prevs = MultiFile.files || [], + files = this.files || [{ + name: this.value, + size: 0, + type: ((this.value || '').match(/[^\.]+$/i) || [''])[0] + }], + newfs = [], + newfs_size = 0, + total_size = MultiFile.total_size || 0/*, + html5_multi_mode = this.files && $(this).attr('multiple')*/ + ; + + // recap + //console.log('START '+ prevs.length + ' files @ '+ sl(total_size) +'.', prevs); + + //# Retrive value of selected file from element + var ERROR = []; //, v = String(this.value || ''); + + // make a normal array + $.each(files, function (i, file) { + newfs[newfs.length] = file; + }); + + //# Trigger Event! onFileSelect + MultiFile.trigger('FileSelect', this, MultiFile, newfs); + //# End Event! + + // validate individual files + $.each(files, function (i, file) { + + // pop local variables out of array/file object + var v = file.name.replace(/^C:\\fakepath\\/gi,''), + s = file.size, + p = function(z){ + return z + .replace('$ext', String(v.match(/[^\.]+$/i) || '')) + .replace('$file', v.match(/[^\/\\]+$/gi)) + .replace('$size', sl(s) + ' > ' + sl(MultiFile.maxfile)) + } + ; + + // check extension + if (MultiFile.accept && v && !v.match(MultiFile.rxAccept)) { + ERROR[ERROR.length] = p(MultiFile.STRING.denied); + MultiFile.trigger('FileInvalid', this, MultiFile, [file]); + }; + + // Disallow duplicates + $(MultiFile.wrapper).find('input[type=file]').not(e).each(function(){ + // go through each file in each slave + $.each(FILE_LIST(this), function (i, file) { + if(file.name){ + //console.log('MultiFile.debug> Duplicate?', file.name, v); + var x = (file.name || '').replace(/^C:\\fakepath\\/gi,''); + if ( v == x || v == x.substr(x.length - v.length)) { + ERROR[ERROR.length] = p(MultiFile.STRING.duplicate); + MultiFile.trigger('FileDuplicate', e, MultiFile, [file]); + }; + }; + }); + }); + + // limit the max size of individual files selected + if (MultiFile.maxfile>0 && s>0 && s>MultiFile.maxfile) { + ERROR[ERROR.length] = p(MultiFile.STRING.toobig); + MultiFile.trigger('FileTooBig', this, MultiFile, [file]); + }; + + // check extension + var customError = MultiFile.trigger('FileValidate', this, MultiFile, [file]); + if(customError && customError!=''){ + ERROR[ERROR.length] = p(customError); + }; + + // add up size of files selected + newfs_size += file.size; + + }); + + // add up total for all files selected (existing and new) + total_size += newfs_size; + + // put some useful information in the file array + newfs.size = newfs_size; + newfs.total = total_size; + newfs.total_length = newfs.length + prevs.length; + + // limit the number of files selected + if (MultiFile.max>0 && prevs.length + files.length > MultiFile.max) { + ERROR[ERROR.length] = MultiFile.STRING.toomany.replace('$max', MultiFile.max); + MultiFile.trigger('FileTooMany', this, MultiFile, newfs); + }; + + // limit the max size of files selected + if (MultiFile.maxsize > 0 && total_size > MultiFile.maxsize) { + ERROR[ERROR.length] = MultiFile.STRING.toomuch.replace('$size', sl(total_size) + ' > ' + sl(MultiFile.maxsize)); + MultiFile.trigger('FileTooMuch', this, MultiFile, newfs); + }; + + // Create a new file input element + var newEle = $(MultiFile.clone).clone(); // Copy parent attributes - Thanks to Jonas Wagner + //# Let's remember which input we've generated so + // we can disable the empty ones before submission + // See: http://plugins.jquery.com/node/1495 + newEle.addClass('MultiFile'); + + // Handle error + if (ERROR.length > 0) { + + // Handle error + MultiFile.error(ERROR.join('\n\n')); + + // 2007-06-24: BUG FIX - Thanks to Adrian Wróbel + // Ditch the trouble maker and add a fresh new element + MultiFile.n--; + MultiFile.addSlave(newEle[0], slave_count); + slave.parent().prepend(newEle); + slave.remove(); + return false; + + } + else { // if no errors have been found + + // remember total size + MultiFile.total_size = total_size; + + // merge arrays + files = prevs.concat(newfs); + + // put some useful information in the file array + files.size = total_size; + files.size_label = sl(total_size); + + // recap + //console.log('NOW '+ files.length + ' files @ '+ sl(total_size) +'.', files); + + // remember files + MultiFile.files = files; + + // Hide this element (NB: display:none is evil!) + $(this).css({ + position: 'absolute', + top: '-3000px' + }); + + // Add new element to the form + slave.after(newEle); + + // Bind functionality + MultiFile.addSlave(newEle[0], slave_count + 1); + + // Update list + MultiFile.addToList(this, slave_count, newfs); + + //# Trigger Event! afterFileSelect + MultiFile.trigger('afterFileSelect', this, MultiFile, newfs); + //# End Event! + + }; // no errors detected + + }); // slave.change() + + // point to wrapper + $(slave).data('MultiFile-wrap', MultiFile.wrapper); + + // store contorl's settings and file info in wrapper + $(MultiFile.wrapper).data('MultiFile',MultiFile); + + // disable? + if(disable_slave) $(slave).attr('disabled','disabled').prop('disabled',true); + + }; // MultiFile.addSlave + // Bind a new element + + + // Add a new file to the list + MultiFile.addToList = function (slave, slave_count, files) { + //if(window.console) console.log('MultiFile.addToList',slave_count); + + //# Trigger Event! onFileAppend + MultiFile.trigger('FileAppend', slave, MultiFile, files); + //# End Event! + + var names = $(''); + $.each(files, function (i, file) { + var v = String(file.name || '' ).replace(/[&<>'"]/g, function(c) { return '&#'+c.charCodeAt()+';'; }), + S = MultiFile.STRING, + n = S.label || S.file || S.name, + t = S.title || S.tooltip || S.selected, + p = file.type.substr(0,6) == 'image/' ? '' : '', + label = $( + ( + ''+ + ''+ n +''+ + (MultiFile.preview || $(slave).is('.with-preview') ? p : '' )+ + '' + ) + .replace(/\$(file|name)/gi, (v.match(/[^\/\\]+$/gi)||[v])[0]) + .replace(/\$(ext|extension|type)/gi, (v.match(/[^\.]+$/gi)||[''])[0]) + .replace(/\$(size)/gi, sl(file.size || 0)) + .replace(/\$(preview)/gi, p) + .replace(/\$(i)/gi, i) + ); + + // now supports preview via locale string. + // just add an anywhere within the "file" string + label.find('img.MultiFile-preview').each(function(){ + var t = this; + var oFReader = new FileReader(); + oFReader.readAsDataURL(file); + oFReader.onload = function (oFREvent) { + t.src = oFREvent.target.result; + }; + }); + + // append file label to list + if(i>0) names.append(', '); + names.append(label); + + var v = String(file.name || '' ); + names[names.length] = + ( + '' + + MultiFile.STRING.file + + '' + ) + .replace(/\$(file|name)/gi, (v.match(/[^\/\\]+$/gi)||[v])[0]) + .replace(/\$(ext|extension|type)/gi, (v.match(/[^\.]+$/gi)||[''])[0]) + .replace(/\$(size)/gi, sl(file.size || 0)) + .replace(/\$(i)/gi, i) + ; + }); + + //$.each(files, function (i, file) { + // Create label elements + var + r = $('
'), + b = $('' + MultiFile.STRING.remove + '') + + // ******** + // TODO: + // refactor this as a single event listener on the control's + // wrapper for better performance and cleaner code + // ******** + .click(function () { + + // get list of files being removed + var files_being_removed = FILE_LIST(slave); + + //# Trigger Event! onFileRemove + MultiFile.trigger('FileRemove', slave, MultiFile, files_being_removed); + //# End Event! + + MultiFile.n--; + MultiFile.current.disabled = false; + + // remove the relevant element + $(slave).remove(); + + // remove the relevant label + $(this).parent().remove(); + + // Show most current element again (move into view) and clear selection + $(MultiFile.current).css({ + position: '', + top: '' + }); + $(MultiFile.current).reset().val('').attr('value', '')[0].value = ''; + + // point to currently visible element (always true, not necessary) + //MultiFile.current = MultiFile.wrapper.find('[type=file]:visible'); + + // rebuild array with the files that are left. + var files_remaining = [], remain_size = 0; + // go through each slave + $(MultiFile.wrapper).find('input[type=file]').each(function(){ + // go through each file in each slave + $.each(FILE_LIST(this), function (i, file) { + if(file.name){ + //console.log('MultiFile.debug> FileRemove> remaining file', file.size, file); + // fresh file array + files_remaining[files_remaining.length] = file; + // fresh size count + remain_size += file.size; + }; + }); + }); + + // update MultiFile object + MultiFile.files = files_remaining; + MultiFile.total_size = remain_size; + MultiFile.size_label = sl(remain_size); + + // update current control's reference to MultiFile object + $(MultiFile.wrapper).data('MultiFile', MultiFile); + + //# Trigger Event! afterFileRemove + MultiFile.trigger('afterFileRemove', slave, MultiFile, files_being_removed); + //# End Event! + + //# Trigger Event! onFileChange + MultiFile.trigger('FileChange', MultiFile.current, MultiFile, files_remaining); + //# End Event! + + return false; + }); + + // Insert label + MultiFile.list.append( + r.append(b, ' ', names) + ); + + //}); // each file? + + //# Trigger Event! afterFileAppend + MultiFile.trigger('afterFileAppend', slave, MultiFile, files); + //# End Event! + + //# Trigger Event! onFileChange + MultiFile.trigger('FileChange', slave, MultiFile, MultiFile.files); + //# End Event! + + }; // MultiFile.addToList + // Add element to selected files list + + + // Bind functionality to the first element + if (!MultiFile.MultiFile) MultiFile.addSlave(MultiFile.e, 0); + + // Increment control count + //MultiFile.I++; // using window.MultiFile + MultiFile.n++; + + // deprecated: contorl's data now stored in wrapper because it is never removed. + // improved performance and lower memory comsumption + // Save control to element + //MultiFile.E.data('MultiFile', MultiFile); + + + //##################################################################### + // MAIN PLUGIN FUNCTIONALITY - END + //##################################################################### + }); // each element + }; + + /*--------------------------------------------------------*/ + + /* + ### Core functionality and API ### + */ + $.extend($.fn.MultiFile, { + + + /** + * This method exposes the all the control's data + * + * Returns an object with various settings and properties of the selected files + * for this particular instance of the control. stored in the control's wrapper + * + * @name data + * @type Object + * @cat Plugins/MultiFile + * @author Diego A. (http://www.fyneworks.com/) + * + * @example $('#selector').MultiFile('data'); + */ + data: function () { + + // analyse this element + var e = $(this), b = e.is('.MultiFile-wrap'); + + // get control wrapper + var wp = b ? e : e.data('MultiFile-wrap'); + if(!wp || !wp.length) + return !console.error('Could not find MultiFile control wrapper'); + + // get control data from wrapper + var mf = wp.data('MultiFile'); + if(!mf) + return !console.error('Could not find MultiFile data in wrapper'); + + // return data + return mf || {}; + }, + + + /** + * This method removes all selected files + * + * Returns a jQuery collection of all affected elements. + * + * @name reset + * @type jQuery + * @cat Plugins/MultiFile + * @author Diego A. (http://www.fyneworks.com/) + * + * @example $.fn.MultiFile.reset(); + */ + reset: function () { + var mf = this.MultiFile('data'); + if (mf) $(mf.list).find('a.MultiFile-remove').click(); + return $(this); + }, + + + /** + * This method exposes the array of selected files + * + * Returns an array of file objects + * + * @name files + * @type Array + * @cat Plugins/MultiFile + * @author Diego A. (http://www.fyneworks.com/) + * + * @example $('#selector').MultiFile('files'); + */ + files: function () { + var mf = this.MultiFile('data'); + if(!mf) return !console.log('MultiFile plugin not initialized'); + return mf.files || []; + }, + + + /** + * This method exposes the plugin's sum of the sizes of all files selected + * + * Returns size (in bytes) of files selected + * + * @name size + * @type Number + * @cat Plugins/MultiFile + * @author Diego A. (http://www.fyneworks.com/) + * + * @example $('#selector').MultiFile('size'); + */ + size: function () { + var mf = this.MultiFile('data'); + if(!mf) return !console.log('MultiFile plugin not initialized'); + return mf.total_size || 0; + }, + + + /** + * This method exposes the plugin's tally of how many files have been selected + * + * Returns number (a count) of files selected + * + * @name count + * @type Number + * @cat Plugins/MultiFile + * @author Diego A. (http://www.fyneworks.com/) + * + * @example $('#selector').MultiFile('size'); + */ + count: function () { + var mf = this.MultiFile('data'); + if(!mf) return !console.log('MultiFile plugin not initialized'); + return mf.files ? mf.files.length || 0 : 0; + }, + + + /** + * This utility makes it easy to disable all 'empty' file elements in the document before submitting a form. + * It marks the affected elements so they can be easily re-enabled after the form submission or validation. + * + * Returns a jQuery collection of all affected elements. + * + * @name disableEmpty + * @type jQuery + * @cat Plugins/MultiFile + * @author Diego A. (http://www.fyneworks.com/) + * + * @example $.fn.MultiFile.disableEmpty(); + * @param String class (optional) A string specifying a class to be applied to all affected elements - Default: 'mfD'. + */ + disableEmpty: function (klass) { + klass = (typeof (klass) == 'string' ? klass : '') || 'mfD'; + var o = []; + $('input:file.MultiFile').each(function () { + if ($(this).val() == '') o[o.length] = this; + }); + + // automatically re-enable for novice users + window.clearTimeout($.fn.MultiFile.reEnableTimeout); + $.fn.MultiFile.reEnableTimeout = window.setTimeout($.fn.MultiFile.reEnableEmpty, 500); + + return $(o).each(function () { + this.disabled = true + }).addClass(klass); + }, + + + /** + * This method re-enables 'empty' file elements that were disabled (and marked) with the $.fn.MultiFile.disableEmpty method. + * + * Returns a jQuery collection of all affected elements. + * + * @name reEnableEmpty + * @type jQuery + * @cat Plugins/MultiFile + * @author Diego A. (http://www.fyneworks.com/) + * + * @example $.fn.MultiFile.reEnableEmpty(); + * @param String klass (optional) A string specifying the class that was used to mark affected elements - Default: 'mfD'. + */ + reEnableEmpty: function (klass) { + klass = (typeof (klass) == 'string' ? klass : '') || 'mfD'; + return $('input:file.' + klass).removeClass(klass).each(function () { + this.disabled = false + }); + }, + + + /** + * This method will intercept other jQuery plugins and disable empty file input elements prior to form submission + * + + * @name intercept + * @cat Plugins/MultiFile + * @author Diego A. (http://www.fyneworks.com/) + * + * @example $.fn.MultiFile.intercept(); + * @param Array methods (optional) Array of method names to be intercepted + */ + intercepted: {}, + intercept: function (methods, context, args) { + var method, value; + args = args || []; + if (args.constructor.toString().indexOf("Array") < 0) args = [args]; + if (typeof (methods) == 'function') { + $.fn.MultiFile.disableEmpty(); + value = methods.apply(context || window, args); + //SEE-http://code.google.com/p/jquery-multifile-plugin/issues/detail?id=27 + setTimeout(function () { + $.fn.MultiFile.reEnableEmpty() + }, 1000); + return value; + }; + if (methods.constructor.toString().indexOf("Array") < 0) methods = [methods]; + for (var i = 0; i < methods.length; i++) { + method = methods[i] + ''; // make sure that we have a STRING + if (method)(function (method) { // make sure that method is ISOLATED for the interception + $.fn.MultiFile.intercepted[method] = $.fn[method] || function () {}; + $.fn[method] = function () { + $.fn.MultiFile.disableEmpty(); + value = $.fn.MultiFile.intercepted[method].apply(this, arguments); + //SEE http://code.google.com/p/jquery-multifile-plugin/issues/detail?id=27 + setTimeout(function () { + $.fn.MultiFile.reEnableEmpty() + }, 1000); + return value; + }; // interception + })(method); // MAKE SURE THAT method IS ISOLATED for the interception + }; // for each method + } // $.fn.MultiFile.intercept + + }); + + /*--------------------------------------------------------*/ + + /* + ### Default Settings ### + eg.: You can override default control like this: + $.fn.MultiFile.options.accept = 'gif|jpg'; + */ + $.fn.MultiFile.options = { //$.extend($.fn.MultiFile, { options: { + accept: '', // accepted file extensions + max: -1, // maximum number of selectable files + maxfile: -1, // maximum size of a single file + maxsize: -1, // maximum size of entire payload + + // name to use for newly created elements + namePattern: '$name', // same name by default (which creates an array) + /*master name*/ // use $name + /*master id */ // use $id + /*group count*/ // use $g + /*slave count*/ // use $i + /*other */ // use any combination of he above, eg.: $name_file$i + + // previews + preview: false, + previewCss: 'max-height:100px; max-width:100px;', + + // STRING: collection lets you show messages in different languages + STRING: { + remove: 'x', + denied: 'You cannot select a $ext file.\nTry again...', + file: '$file', + selected: 'File selected: $file', + duplicate: 'This file has already been selected:\n$file', + toomuch: 'The files selected exceed the maximum size permited ($size)', + toomany: 'Too many files selected (max: $max)', + toobig: '$file is too big (max $size)' + }, + + // name of methods that should be automcatically intercepted so the plugin can disable + // extra file elements that are empty before execution and automatically re-enable them afterwards + autoIntercept: ['submit', 'ajaxSubmit', 'ajaxForm', 'validate', 'valid' /* array of methods to intercept */ ], + + // error handling function + error: function (s) { + + if(typeof console != 'undefined') console.log(s); + + // TODO: add various dialog handlers here? + alert(s); + } + }; //} }); + + /*--------------------------------------------------------*/ + + /* + ### Additional Methods ### + Required functionality outside the plugin's scope + */ + + // Native input reset method - because this alone doesn't always work: $(element).val('').attr('value', '')[0].value = ''; + $.fn.reset = $.fn.reset || function () { + return this.each(function () { + try { + this.reset(); + } catch (e) {} + }); + }; + + /*--------------------------------------------------------*/ + + /* + ### Default implementation ### + The plugin will attach itself to file inputs + with the class 'multi' when the page loads + */ + $(function () { + //$("input:file.multi").MultiFile(); + $("input[type=file].multi").MultiFile(); + }); + + + /*# AVOID COLLISIONS #*/ +})(jQuery); +/*# AVOID COLLISIONS #*/ diff --git a/src_php/libs/qrcode.js b/src_php/libs/qrcode.js new file mode 100755 index 0000000..5507c15 --- /dev/null +++ b/src_php/libs/qrcode.js @@ -0,0 +1,614 @@ +/** + * @fileoverview + * - Using the 'QRCode for Javascript library' + * - Fixed dataset of 'QRCode for Javascript library' for support full-spec. + * - this library has no dependencies. + * + * @author davidshimjs + * @see http://www.d-project.com/ + * @see http://jeromeetienne.github.com/jquery-qrcode/ + */ +var QRCode; + +(function () { + //--------------------------------------------------------------------- + // QRCode for JavaScript + // + // Copyright (c) 2009 Kazuhiko Arase + // + // URL: http://www.d-project.com/ + // + // Licensed under the MIT license: + // http://www.opensource.org/licenses/mit-license.php + // + // The word "QR Code" is registered trademark of + // DENSO WAVE INCORPORATED + // http://www.denso-wave.com/qrcode/faqpatent-e.html + // + //--------------------------------------------------------------------- + function QR8bitByte(data) { + this.mode = QRMode.MODE_8BIT_BYTE; + this.data = data; + this.parsedData = []; + + // Added to support UTF-8 Characters + for (var i = 0, l = this.data.length; i < l; i++) { + var byteArray = []; + var code = this.data.charCodeAt(i); + + if (code > 0x10000) { + byteArray[0] = 0xF0 | ((code & 0x1C0000) >>> 18); + byteArray[1] = 0x80 | ((code & 0x3F000) >>> 12); + byteArray[2] = 0x80 | ((code & 0xFC0) >>> 6); + byteArray[3] = 0x80 | (code & 0x3F); + } else if (code > 0x800) { + byteArray[0] = 0xE0 | ((code & 0xF000) >>> 12); + byteArray[1] = 0x80 | ((code & 0xFC0) >>> 6); + byteArray[2] = 0x80 | (code & 0x3F); + } else if (code > 0x80) { + byteArray[0] = 0xC0 | ((code & 0x7C0) >>> 6); + byteArray[1] = 0x80 | (code & 0x3F); + } else { + byteArray[0] = code; + } + + this.parsedData.push(byteArray); + } + + this.parsedData = Array.prototype.concat.apply([], this.parsedData); + + if (this.parsedData.length != this.data.length) { + this.parsedData.unshift(191); + this.parsedData.unshift(187); + this.parsedData.unshift(239); + } + } + + QR8bitByte.prototype = { + getLength: function (buffer) { + return this.parsedData.length; + }, + write: function (buffer) { + for (var i = 0, l = this.parsedData.length; i < l; i++) { + buffer.put(this.parsedData[i], 8); + } + } + }; + + function QRCodeModel(typeNumber, errorCorrectLevel) { + this.typeNumber = typeNumber; + this.errorCorrectLevel = errorCorrectLevel; + this.modules = null; + this.moduleCount = 0; + this.dataCache = null; + this.dataList = []; + } + + QRCodeModel.prototype={addData:function(data){var newData=new QR8bitByte(data);this.dataList.push(newData);this.dataCache=null;},isDark:function(row,col){if(row<0||this.moduleCount<=row||col<0||this.moduleCount<=col){throw new Error(row+","+col);} + return this.modules[row][col];},getModuleCount:function(){return this.moduleCount;},make:function(){this.makeImpl(false,this.getBestMaskPattern());},makeImpl:function(test,maskPattern){this.moduleCount=this.typeNumber*4+17;this.modules=new Array(this.moduleCount);for(var row=0;row=7){this.setupTypeNumber(test);} + if(this.dataCache==null){this.dataCache=QRCodeModel.createData(this.typeNumber,this.errorCorrectLevel,this.dataList);} + this.mapData(this.dataCache,maskPattern);},setupPositionProbePattern:function(row,col){for(var r=-1;r<=7;r++){if(row+r<=-1||this.moduleCount<=row+r)continue;for(var c=-1;c<=7;c++){if(col+c<=-1||this.moduleCount<=col+c)continue;if((0<=r&&r<=6&&(c==0||c==6))||(0<=c&&c<=6&&(r==0||r==6))||(2<=r&&r<=4&&2<=c&&c<=4)){this.modules[row+r][col+c]=true;}else{this.modules[row+r][col+c]=false;}}}},getBestMaskPattern:function(){var minLostPoint=0;var pattern=0;for(var i=0;i<8;i++){this.makeImpl(true,i);var lostPoint=QRUtil.getLostPoint(this);if(i==0||minLostPoint>lostPoint){minLostPoint=lostPoint;pattern=i;}} + return pattern;},createMovieClip:function(target_mc,instance_name,depth){var qr_mc=target_mc.createEmptyMovieClip(instance_name,depth);var cs=1;this.make();for(var row=0;row>i)&1)==1);this.modules[Math.floor(i/3)][i%3+this.moduleCount-8-3]=mod;} + for(var i=0;i<18;i++){var mod=(!test&&((bits>>i)&1)==1);this.modules[i%3+this.moduleCount-8-3][Math.floor(i/3)]=mod;}},setupTypeInfo:function(test,maskPattern){var data=(this.errorCorrectLevel<<3)|maskPattern;var bits=QRUtil.getBCHTypeInfo(data);for(var i=0;i<15;i++){var mod=(!test&&((bits>>i)&1)==1);if(i<6){this.modules[i][8]=mod;}else if(i<8){this.modules[i+1][8]=mod;}else{this.modules[this.moduleCount-15+i][8]=mod;}} + for(var i=0;i<15;i++){var mod=(!test&&((bits>>i)&1)==1);if(i<8){this.modules[8][this.moduleCount-i-1]=mod;}else if(i<9){this.modules[8][15-i-1+1]=mod;}else{this.modules[8][15-i-1]=mod;}} + this.modules[this.moduleCount-8][8]=(!test);},mapData:function(data,maskPattern){var inc=-1;var row=this.moduleCount-1;var bitIndex=7;var byteIndex=0;for(var col=this.moduleCount-1;col>0;col-=2){if(col==6)col--;while(true){for(var c=0;c<2;c++){if(this.modules[row][col-c]==null){var dark=false;if(byteIndex>>bitIndex)&1)==1);} + var mask=QRUtil.getMask(maskPattern,row,col-c);if(mask){dark=!dark;} + this.modules[row][col-c]=dark;bitIndex--;if(bitIndex==-1){byteIndex++;bitIndex=7;}}} + row+=inc;if(row<0||this.moduleCount<=row){row-=inc;inc=-inc;break;}}}}};QRCodeModel.PAD0=0xEC;QRCodeModel.PAD1=0x11;QRCodeModel.createData=function(typeNumber,errorCorrectLevel,dataList){var rsBlocks=QRRSBlock.getRSBlocks(typeNumber,errorCorrectLevel);var buffer=new QRBitBuffer();for(var i=0;itotalDataCount*8){throw new Error("code length overflow. (" + +buffer.getLengthInBits() + +">" + +totalDataCount*8 + +")");} + if(buffer.getLengthInBits()+4<=totalDataCount*8){buffer.put(0,4);} + while(buffer.getLengthInBits()%8!=0){buffer.putBit(false);} + while(true){if(buffer.getLengthInBits()>=totalDataCount*8){break;} + buffer.put(QRCodeModel.PAD0,8);if(buffer.getLengthInBits()>=totalDataCount*8){break;} + buffer.put(QRCodeModel.PAD1,8);} + return QRCodeModel.createBytes(buffer,rsBlocks);};QRCodeModel.createBytes=function(buffer,rsBlocks){var offset=0;var maxDcCount=0;var maxEcCount=0;var dcdata=new Array(rsBlocks.length);var ecdata=new Array(rsBlocks.length);for(var r=0;r=0)?modPoly.get(modIndex):0;}} + var totalCodeCount=0;for(var i=0;i=0){d^=(QRUtil.G15<<(QRUtil.getBCHDigit(d)-QRUtil.getBCHDigit(QRUtil.G15)));} + return((data<<10)|d)^QRUtil.G15_MASK;},getBCHTypeNumber:function(data){var d=data<<12;while(QRUtil.getBCHDigit(d)-QRUtil.getBCHDigit(QRUtil.G18)>=0){d^=(QRUtil.G18<<(QRUtil.getBCHDigit(d)-QRUtil.getBCHDigit(QRUtil.G18)));} + return(data<<12)|d;},getBCHDigit:function(data){var digit=0;while(data!=0){digit++;data>>>=1;} + return digit;},getPatternPosition:function(typeNumber){return QRUtil.PATTERN_POSITION_TABLE[typeNumber-1];},getMask:function(maskPattern,i,j){switch(maskPattern){case QRMaskPattern.PATTERN000:return(i+j)%2==0;case QRMaskPattern.PATTERN001:return i%2==0;case QRMaskPattern.PATTERN010:return j%3==0;case QRMaskPattern.PATTERN011:return(i+j)%3==0;case QRMaskPattern.PATTERN100:return(Math.floor(i/2)+Math.floor(j/3))%2==0;case QRMaskPattern.PATTERN101:return(i*j)%2+(i*j)%3==0;case QRMaskPattern.PATTERN110:return((i*j)%2+(i*j)%3)%2==0;case QRMaskPattern.PATTERN111:return((i*j)%3+(i+j)%2)%2==0;default:throw new Error("bad maskPattern:"+maskPattern);}},getErrorCorrectPolynomial:function(errorCorrectLength){var a=new QRPolynomial([1],0);for(var i=0;i5){lostPoint+=(3+sameCount-5);}}} + for(var row=0;row=256){n-=255;} + return QRMath.EXP_TABLE[n];},EXP_TABLE:new Array(256),LOG_TABLE:new Array(256)};for(var i=0;i<8;i++){QRMath.EXP_TABLE[i]=1<>>(7-index%8))&1)==1;},put:function(num,length){for(var i=0;i>>(length-i-1))&1)==1);}},getLengthInBits:function(){return this.length;},putBit:function(bit){var bufIndex=Math.floor(this.length/8);if(this.buffer.length<=bufIndex){this.buffer.push(0);} + if(bit){this.buffer[bufIndex]|=(0x80>>>(this.length%8));} + this.length++;}};var QRCodeLimitLength=[[17,14,11,7],[32,26,20,14],[53,42,32,24],[78,62,46,34],[106,84,60,44],[134,106,74,58],[154,122,86,64],[192,152,108,84],[230,180,130,98],[271,213,151,119],[321,251,177,137],[367,287,203,155],[425,331,241,177],[458,362,258,194],[520,412,292,220],[586,450,322,250],[644,504,364,280],[718,560,394,310],[792,624,442,338],[858,666,482,382],[929,711,509,403],[1003,779,565,439],[1091,857,611,461],[1171,911,661,511],[1273,997,715,535],[1367,1059,751,593],[1465,1125,805,625],[1528,1190,868,658],[1628,1264,908,698],[1732,1370,982,742],[1840,1452,1030,790],[1952,1538,1112,842],[2068,1628,1168,898],[2188,1722,1228,958],[2303,1809,1283,983],[2431,1911,1351,1051],[2563,1989,1423,1093],[2699,2099,1499,1139],[2809,2213,1579,1219],[2953,2331,1663,1273]]; + + function _isSupportCanvas() { + return typeof CanvasRenderingContext2D != "undefined"; + } + + // android 2.x doesn't support Data-URI spec + function _getAndroid() { + var android = false; + var sAgent = navigator.userAgent; + + if (/android/i.test(sAgent)) { // android + android = true; + var aMat = sAgent.toString().match(/android ([0-9]\.[0-9])/i); + + if (aMat && aMat[1]) { + android = parseFloat(aMat[1]); + } + } + + return android; + } + + var svgDrawer = (function() { + + var Drawing = function (el, htOption) { + this._el = el; + this._htOption = htOption; + }; + + Drawing.prototype.draw = function (oQRCode) { + var _htOption = this._htOption; + var _el = this._el; + var nCount = oQRCode.getModuleCount(); + var nWidth = Math.floor(_htOption.width / nCount); + var nHeight = Math.floor(_htOption.height / nCount); + + this.clear(); + + function makeSVG(tag, attrs) { + var el = document.createElementNS('http://www.w3.org/2000/svg', tag); + for (var k in attrs) + if (attrs.hasOwnProperty(k)) el.setAttribute(k, attrs[k]); + return el; + } + + var svg = makeSVG("svg" , {'viewBox': '0 0 ' + String(nCount) + " " + String(nCount), 'width': '100%', 'height': '100%', 'fill': _htOption.colorLight}); + svg.setAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns:xlink", "http://www.w3.org/1999/xlink"); + _el.appendChild(svg); + + svg.appendChild(makeSVG("rect", {"fill": _htOption.colorLight, "width": "100%", "height": "100%"})); + svg.appendChild(makeSVG("rect", {"fill": _htOption.colorDark, "width": "1", "height": "1", "id": "template"})); + + for (var row = 0; row < nCount; row++) { + for (var col = 0; col < nCount; col++) { + if (oQRCode.isDark(row, col)) { + var child = makeSVG("use", {"x": String(col), "y": String(row)}); + child.setAttributeNS("http://www.w3.org/1999/xlink", "href", "#template") + svg.appendChild(child); + } + } + } + }; + Drawing.prototype.clear = function () { + while (this._el.hasChildNodes()) + this._el.removeChild(this._el.lastChild); + }; + return Drawing; + })(); + + var useSVG = document.documentElement.tagName.toLowerCase() === "svg"; + + // Drawing in DOM by using Table tag + var Drawing = useSVG ? svgDrawer : !_isSupportCanvas() ? (function () { + var Drawing = function (el, htOption) { + this._el = el; + this._htOption = htOption; + }; + + /** + * Draw the QRCode + * + * @param {QRCode} oQRCode + */ + Drawing.prototype.draw = function (oQRCode) { + var _htOption = this._htOption; + var _el = this._el; + var nCount = oQRCode.getModuleCount(); + var nWidth = Math.floor(_htOption.width / nCount); + var nHeight = Math.floor(_htOption.height / nCount); + var aHTML = ['']; + + for (var row = 0; row < nCount; row++) { + aHTML.push(''); + + for (var col = 0; col < nCount; col++) { + aHTML.push(''); + } + + aHTML.push(''); + } + + aHTML.push('
'); + _el.innerHTML = aHTML.join(''); + + // Fix the margin values as real size. + var elTable = _el.childNodes[0]; + var nLeftMarginTable = (_htOption.width - elTable.offsetWidth) / 2; + var nTopMarginTable = (_htOption.height - elTable.offsetHeight) / 2; + + if (nLeftMarginTable > 0 && nTopMarginTable > 0) { + elTable.style.margin = nTopMarginTable + "px " + nLeftMarginTable + "px"; + } + }; + + /** + * Clear the QRCode + */ + Drawing.prototype.clear = function () { + this._el.innerHTML = ''; + }; + + return Drawing; + })() : (function () { // Drawing in Canvas + function _onMakeImage() { + this._elImage.src = this._elCanvas.toDataURL("image/png"); + this._elImage.style.display = "block"; + this._elCanvas.style.display = "none"; + } + + // Android 2.1 bug workaround + // http://code.google.com/p/android/issues/detail?id=5141 + if (this._android && this._android <= 2.1) { + var factor = 1 / window.devicePixelRatio; + var drawImage = CanvasRenderingContext2D.prototype.drawImage; + CanvasRenderingContext2D.prototype.drawImage = function (image, sx, sy, sw, sh, dx, dy, dw, dh) { + if (("nodeName" in image) && /img/i.test(image.nodeName)) { + for (var i = arguments.length - 1; i >= 1; i--) { + arguments[i] = arguments[i] * factor; + } + } else if (typeof dw == "undefined") { + arguments[1] *= factor; + arguments[2] *= factor; + arguments[3] *= factor; + arguments[4] *= factor; + } + + drawImage.apply(this, arguments); + }; + } + + /** + * Check whether the user's browser supports Data URI or not + * + * @private + * @param {Function} fSuccess Occurs if it supports Data URI + * @param {Function} fFail Occurs if it doesn't support Data URI + */ + function _safeSetDataURI(fSuccess, fFail) { + var self = this; + self._fFail = fFail; + self._fSuccess = fSuccess; + + // Check it just once + if (self._bSupportDataURI === null) { + var el = document.createElement("img"); + var fOnError = function() { + self._bSupportDataURI = false; + + if (self._fFail) { + self._fFail.call(self); + } + }; + var fOnSuccess = function() { + self._bSupportDataURI = true; + + if (self._fSuccess) { + self._fSuccess.call(self); + } + }; + + el.onabort = fOnError; + el.onerror = fOnError; + el.onload = fOnSuccess; + el.src = "data:image/gif;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg=="; // the Image contains 1px data. + return; + } else if (self._bSupportDataURI === true && self._fSuccess) { + self._fSuccess.call(self); + } else if (self._bSupportDataURI === false && self._fFail) { + self._fFail.call(self); + } + }; + + /** + * Drawing QRCode by using canvas + * + * @constructor + * @param {HTMLElement} el + * @param {Object} htOption QRCode Options + */ + var Drawing = function (el, htOption) { + this._bIsPainted = false; + this._android = _getAndroid(); + + this._htOption = htOption; + this._elCanvas = document.createElement("canvas"); + this._elCanvas.width = htOption.width; + this._elCanvas.height = htOption.height; + el.appendChild(this._elCanvas); + this._el = el; + this._oContext = this._elCanvas.getContext("2d"); + this._bIsPainted = false; + this._elImage = document.createElement("img"); + this._elImage.alt = "Scan me!"; + this._elImage.style.display = "none"; + this._el.appendChild(this._elImage); + this._bSupportDataURI = null; + }; + + /** + * Draw the QRCode + * + * @param {QRCode} oQRCode + */ + Drawing.prototype.draw = function (oQRCode) { + var _elImage = this._elImage; + var _oContext = this._oContext; + var _htOption = this._htOption; + + var nCount = oQRCode.getModuleCount(); + var nWidth = _htOption.width / nCount; + var nHeight = _htOption.height / nCount; + var nRoundedWidth = Math.round(nWidth); + var nRoundedHeight = Math.round(nHeight); + + _elImage.style.display = "none"; + this.clear(); + + for (var row = 0; row < nCount; row++) { + for (var col = 0; col < nCount; col++) { + var bIsDark = oQRCode.isDark(row, col); + var nLeft = col * nWidth; + var nTop = row * nHeight; + _oContext.strokeStyle = bIsDark ? _htOption.colorDark : _htOption.colorLight; + _oContext.lineWidth = 1; + _oContext.fillStyle = bIsDark ? _htOption.colorDark : _htOption.colorLight; + _oContext.fillRect(nLeft, nTop, nWidth, nHeight); + + // 안티 앨리어싱 방지 처리 + _oContext.strokeRect( + Math.floor(nLeft) + 0.5, + Math.floor(nTop) + 0.5, + nRoundedWidth, + nRoundedHeight + ); + + _oContext.strokeRect( + Math.ceil(nLeft) - 0.5, + Math.ceil(nTop) - 0.5, + nRoundedWidth, + nRoundedHeight + ); + } + } + + this._bIsPainted = true; + }; + + /** + * Make the image from Canvas if the browser supports Data URI. + */ + Drawing.prototype.makeImage = function () { + if (this._bIsPainted) { + _safeSetDataURI.call(this, _onMakeImage); + } + }; + + /** + * Return whether the QRCode is painted or not + * + * @return {Boolean} + */ + Drawing.prototype.isPainted = function () { + return this._bIsPainted; + }; + + /** + * Clear the QRCode + */ + Drawing.prototype.clear = function () { + this._oContext.clearRect(0, 0, this._elCanvas.width, this._elCanvas.height); + this._bIsPainted = false; + }; + + /** + * @private + * @param {Number} nNumber + */ + Drawing.prototype.round = function (nNumber) { + if (!nNumber) { + return nNumber; + } + + return Math.floor(nNumber * 1000) / 1000; + }; + + return Drawing; + })(); + + /** + * Get the type by string length + * + * @private + * @param {String} sText + * @param {Number} nCorrectLevel + * @return {Number} type + */ + function _getTypeNumber(sText, nCorrectLevel) { + var nType = 1; + var length = _getUTF8Length(sText); + + for (var i = 0, len = QRCodeLimitLength.length; i <= len; i++) { + var nLimit = 0; + + switch (nCorrectLevel) { + case QRErrorCorrectLevel.L : + nLimit = QRCodeLimitLength[i][0]; + break; + case QRErrorCorrectLevel.M : + nLimit = QRCodeLimitLength[i][1]; + break; + case QRErrorCorrectLevel.Q : + nLimit = QRCodeLimitLength[i][2]; + break; + case QRErrorCorrectLevel.H : + nLimit = QRCodeLimitLength[i][3]; + break; + } + + if (length <= nLimit) { + break; + } else { + nType++; + } + } + + if (nType > QRCodeLimitLength.length) { + throw new Error("Too long data"); + } + + return nType; + } + + function _getUTF8Length(sText) { + var replacedText = encodeURI(sText).toString().replace(/\%[0-9a-fA-F]{2}/g, 'a'); + return replacedText.length + (replacedText.length != sText ? 3 : 0); + } + + /** + * @class QRCode + * @constructor + * @example + * new QRCode(document.getElementById("test"), "http://jindo.dev.naver.com/collie"); + * + * @example + * var oQRCode = new QRCode("test", { + * text : "http://naver.com", + * width : 128, + * height : 128 + * }); + * + * oQRCode.clear(); // Clear the QRCode. + * oQRCode.makeCode("http://map.naver.com"); // Re-create the QRCode. + * + * @param {HTMLElement|String} el target element or 'id' attribute of element. + * @param {Object|String} vOption + * @param {String} vOption.text QRCode link data + * @param {Number} [vOption.width=256] + * @param {Number} [vOption.height=256] + * @param {String} [vOption.colorDark="#000000"] + * @param {String} [vOption.colorLight="#ffffff"] + * @param {QRCode.CorrectLevel} [vOption.correctLevel=QRCode.CorrectLevel.H] [L|M|Q|H] + */ + QRCode = function (el, vOption) { + this._htOption = { + width : 256, + height : 256, + typeNumber : 4, + colorDark : "#000000", + colorLight : "#ffffff", + correctLevel : QRErrorCorrectLevel.H + }; + + if (typeof vOption === 'string') { + vOption = { + text : vOption + }; + } + + // Overwrites options + if (vOption) { + for (var i in vOption) { + this._htOption[i] = vOption[i]; + } + } + + if (typeof el == "string") { + el = document.getElementById(el); + } + + if (this._htOption.useSVG) { + Drawing = svgDrawer; + } + + this._android = _getAndroid(); + this._el = el; + this._oQRCode = null; + this._oDrawing = new Drawing(this._el, this._htOption); + + if (this._htOption.text) { + this.makeCode(this._htOption.text); + } + }; + + /** + * Make the QRCode + * + * @param {String} sText link data + */ + QRCode.prototype.makeCode = function (sText) { + this._oQRCode = new QRCodeModel(_getTypeNumber(sText, this._htOption.correctLevel), this._htOption.correctLevel); + this._oQRCode.addData(sText); + this._oQRCode.make(); + this._el.title = sText; + this._oDrawing.draw(this._oQRCode); + this.makeImage(); + }; + + /** + * Make the Image from Canvas element + * - It occurs automatically + * - Android below 3 doesn't support Data-URI spec. + * + * @private + */ + QRCode.prototype.makeImage = function () { + if (typeof this._oDrawing.makeImage == "function" && (!this._android || this._android >= 3)) { + this._oDrawing.makeImage(); + } + }; + + /** + * Clear the QRCode + */ + QRCode.prototype.clear = function () { + this._oDrawing.clear(); + }; + + /** + * @name QRCode.CorrectLevel + */ + QRCode.CorrectLevel = QRErrorCorrectLevel; +})(); diff --git a/src_php/libs/qrcode.min.js b/src_php/libs/qrcode.min.js new file mode 100755 index 0000000..993e88f --- /dev/null +++ b/src_php/libs/qrcode.min.js @@ -0,0 +1 @@ +var QRCode;!function(){function a(a){this.mode=c.MODE_8BIT_BYTE,this.data=a,this.parsedData=[];for(var b=[],d=0,e=this.data.length;e>d;d++){var f=this.data.charCodeAt(d);f>65536?(b[0]=240|(1835008&f)>>>18,b[1]=128|(258048&f)>>>12,b[2]=128|(4032&f)>>>6,b[3]=128|63&f):f>2048?(b[0]=224|(61440&f)>>>12,b[1]=128|(4032&f)>>>6,b[2]=128|63&f):f>128?(b[0]=192|(1984&f)>>>6,b[1]=128|63&f):b[0]=f,this.parsedData=this.parsedData.concat(b)}this.parsedData.length!=this.data.length&&(this.parsedData.unshift(191),this.parsedData.unshift(187),this.parsedData.unshift(239))}function b(a,b){this.typeNumber=a,this.errorCorrectLevel=b,this.modules=null,this.moduleCount=0,this.dataCache=null,this.dataList=[]}function i(a,b){if(void 0==a.length)throw new Error(a.length+"/"+b);for(var c=0;c=f;f++){var h=0;switch(b){case d.L:h=l[f][0];break;case d.M:h=l[f][1];break;case d.Q:h=l[f][2];break;case d.H:h=l[f][3]}if(h>=e)break;c++}if(c>l.length)throw new Error("Too long data");return c}function s(a){var b=encodeURI(a).toString().replace(/\%[0-9a-fA-F]{2}/g,"a");return b.length+(b.length!=a?3:0)}a.prototype={getLength:function(){return this.parsedData.length},write:function(a){for(var b=0,c=this.parsedData.length;c>b;b++)a.put(this.parsedData[b],8)}},b.prototype={addData:function(b){var c=new a(b);this.dataList.push(c),this.dataCache=null},isDark:function(a,b){if(0>a||this.moduleCount<=a||0>b||this.moduleCount<=b)throw new Error(a+","+b);return this.modules[a][b]},getModuleCount:function(){return this.moduleCount},make:function(){this.makeImpl(!1,this.getBestMaskPattern())},makeImpl:function(a,c){this.moduleCount=4*this.typeNumber+17,this.modules=new Array(this.moduleCount);for(var d=0;d=7&&this.setupTypeNumber(a),null==this.dataCache&&(this.dataCache=b.createData(this.typeNumber,this.errorCorrectLevel,this.dataList)),this.mapData(this.dataCache,c)},setupPositionProbePattern:function(a,b){for(var c=-1;7>=c;c++)if(!(-1>=a+c||this.moduleCount<=a+c))for(var d=-1;7>=d;d++)-1>=b+d||this.moduleCount<=b+d||(this.modules[a+c][b+d]=c>=0&&6>=c&&(0==d||6==d)||d>=0&&6>=d&&(0==c||6==c)||c>=2&&4>=c&&d>=2&&4>=d?!0:!1)},getBestMaskPattern:function(){for(var a=0,b=0,c=0;8>c;c++){this.makeImpl(!0,c);var d=f.getLostPoint(this);(0==c||a>d)&&(a=d,b=c)}return b},createMovieClip:function(a,b,c){var d=a.createEmptyMovieClip(b,c),e=1;this.make();for(var f=0;f=g;g++)for(var h=-2;2>=h;h++)this.modules[d+g][e+h]=-2==g||2==g||-2==h||2==h||0==g&&0==h?!0:!1}},setupTypeNumber:function(a){for(var b=f.getBCHTypeNumber(this.typeNumber),c=0;18>c;c++){var d=!a&&1==(1&b>>c);this.modules[Math.floor(c/3)][c%3+this.moduleCount-8-3]=d}for(var c=0;18>c;c++){var d=!a&&1==(1&b>>c);this.modules[c%3+this.moduleCount-8-3][Math.floor(c/3)]=d}},setupTypeInfo:function(a,b){for(var c=this.errorCorrectLevel<<3|b,d=f.getBCHTypeInfo(c),e=0;15>e;e++){var g=!a&&1==(1&d>>e);6>e?this.modules[e][8]=g:8>e?this.modules[e+1][8]=g:this.modules[this.moduleCount-15+e][8]=g}for(var e=0;15>e;e++){var g=!a&&1==(1&d>>e);8>e?this.modules[8][this.moduleCount-e-1]=g:9>e?this.modules[8][15-e-1+1]=g:this.modules[8][15-e-1]=g}this.modules[this.moduleCount-8][8]=!a},mapData:function(a,b){for(var c=-1,d=this.moduleCount-1,e=7,g=0,h=this.moduleCount-1;h>0;h-=2)for(6==h&&h--;;){for(var i=0;2>i;i++)if(null==this.modules[d][h-i]){var j=!1;g>>e));var k=f.getMask(b,d,h-i);k&&(j=!j),this.modules[d][h-i]=j,e--,-1==e&&(g++,e=7)}if(d+=c,0>d||this.moduleCount<=d){d-=c,c=-c;break}}}},b.PAD0=236,b.PAD1=17,b.createData=function(a,c,d){for(var e=j.getRSBlocks(a,c),g=new k,h=0;h8*l)throw new Error("code length overflow. ("+g.getLengthInBits()+">"+8*l+")");for(g.getLengthInBits()+4<=8*l&&g.put(0,4);0!=g.getLengthInBits()%8;)g.putBit(!1);for(;;){if(g.getLengthInBits()>=8*l)break;if(g.put(b.PAD0,8),g.getLengthInBits()>=8*l)break;g.put(b.PAD1,8)}return b.createBytes(g,e)},b.createBytes=function(a,b){for(var c=0,d=0,e=0,g=new Array(b.length),h=new Array(b.length),j=0;j=0?p.get(q):0}}for(var r=0,m=0;mm;m++)for(var j=0;jm;m++)for(var j=0;j=0;)b^=f.G15<=0;)b^=f.G18<>>=1;return b},getPatternPosition:function(a){return f.PATTERN_POSITION_TABLE[a-1]},getMask:function(a,b,c){switch(a){case e.PATTERN000:return 0==(b+c)%2;case e.PATTERN001:return 0==b%2;case e.PATTERN010:return 0==c%3;case e.PATTERN011:return 0==(b+c)%3;case e.PATTERN100:return 0==(Math.floor(b/2)+Math.floor(c/3))%2;case e.PATTERN101:return 0==b*c%2+b*c%3;case e.PATTERN110:return 0==(b*c%2+b*c%3)%2;case e.PATTERN111:return 0==(b*c%3+(b+c)%2)%2;default:throw new Error("bad maskPattern:"+a)}},getErrorCorrectPolynomial:function(a){for(var b=new i([1],0),c=0;a>c;c++)b=b.multiply(new i([1,g.gexp(c)],0));return b},getLengthInBits:function(a,b){if(b>=1&&10>b)switch(a){case c.MODE_NUMBER:return 10;case c.MODE_ALPHA_NUM:return 9;case c.MODE_8BIT_BYTE:return 8;case c.MODE_KANJI:return 8;default:throw new Error("mode:"+a)}else if(27>b)switch(a){case c.MODE_NUMBER:return 12;case c.MODE_ALPHA_NUM:return 11;case c.MODE_8BIT_BYTE:return 16;case c.MODE_KANJI:return 10;default:throw new Error("mode:"+a)}else{if(!(41>b))throw new Error("type:"+b);switch(a){case c.MODE_NUMBER:return 14;case c.MODE_ALPHA_NUM:return 13;case c.MODE_8BIT_BYTE:return 16;case c.MODE_KANJI:return 12;default:throw new Error("mode:"+a)}}},getLostPoint:function(a){for(var b=a.getModuleCount(),c=0,d=0;b>d;d++)for(var e=0;b>e;e++){for(var f=0,g=a.isDark(d,e),h=-1;1>=h;h++)if(!(0>d+h||d+h>=b))for(var i=-1;1>=i;i++)0>e+i||e+i>=b||(0!=h||0!=i)&&g==a.isDark(d+h,e+i)&&f++;f>5&&(c+=3+f-5)}for(var d=0;b-1>d;d++)for(var e=0;b-1>e;e++){var j=0;a.isDark(d,e)&&j++,a.isDark(d+1,e)&&j++,a.isDark(d,e+1)&&j++,a.isDark(d+1,e+1)&&j++,(0==j||4==j)&&(c+=3)}for(var d=0;b>d;d++)for(var e=0;b-6>e;e++)a.isDark(d,e)&&!a.isDark(d,e+1)&&a.isDark(d,e+2)&&a.isDark(d,e+3)&&a.isDark(d,e+4)&&!a.isDark(d,e+5)&&a.isDark(d,e+6)&&(c+=40);for(var e=0;b>e;e++)for(var d=0;b-6>d;d++)a.isDark(d,e)&&!a.isDark(d+1,e)&&a.isDark(d+2,e)&&a.isDark(d+3,e)&&a.isDark(d+4,e)&&!a.isDark(d+5,e)&&a.isDark(d+6,e)&&(c+=40);for(var k=0,e=0;b>e;e++)for(var d=0;b>d;d++)a.isDark(d,e)&&k++;var l=Math.abs(100*k/b/b-50)/5;return c+=10*l}},g={glog:function(a){if(1>a)throw new Error("glog("+a+")");return g.LOG_TABLE[a]},gexp:function(a){for(;0>a;)a+=255;for(;a>=256;)a-=255;return g.EXP_TABLE[a]},EXP_TABLE:new Array(256),LOG_TABLE:new Array(256)},h=0;8>h;h++)g.EXP_TABLE[h]=1<h;h++)g.EXP_TABLE[h]=g.EXP_TABLE[h-4]^g.EXP_TABLE[h-5]^g.EXP_TABLE[h-6]^g.EXP_TABLE[h-8];for(var h=0;255>h;h++)g.LOG_TABLE[g.EXP_TABLE[h]]=h;i.prototype={get:function(a){return this.num[a]},getLength:function(){return this.num.length},multiply:function(a){for(var b=new Array(this.getLength()+a.getLength()-1),c=0;cf;f++)for(var g=c[3*f+0],h=c[3*f+1],i=c[3*f+2],k=0;g>k;k++)e.push(new j(h,i));return e},j.getRsBlockTable=function(a,b){switch(b){case d.L:return j.RS_BLOCK_TABLE[4*(a-1)+0];case d.M:return j.RS_BLOCK_TABLE[4*(a-1)+1];case d.Q:return j.RS_BLOCK_TABLE[4*(a-1)+2];case d.H:return j.RS_BLOCK_TABLE[4*(a-1)+3];default:return void 0}},k.prototype={get:function(a){var b=Math.floor(a/8);return 1==(1&this.buffer[b]>>>7-a%8)},put:function(a,b){for(var c=0;b>c;c++)this.putBit(1==(1&a>>>b-c-1))},getLengthInBits:function(){return this.length},putBit:function(a){var b=Math.floor(this.length/8);this.buffer.length<=b&&this.buffer.push(0),a&&(this.buffer[b]|=128>>>this.length%8),this.length++}};var l=[[17,14,11,7],[32,26,20,14],[53,42,32,24],[78,62,46,34],[106,84,60,44],[134,106,74,58],[154,122,86,64],[192,152,108,84],[230,180,130,98],[271,213,151,119],[321,251,177,137],[367,287,203,155],[425,331,241,177],[458,362,258,194],[520,412,292,220],[586,450,322,250],[644,504,364,280],[718,560,394,310],[792,624,442,338],[858,666,482,382],[929,711,509,403],[1003,779,565,439],[1091,857,611,461],[1171,911,661,511],[1273,997,715,535],[1367,1059,751,593],[1465,1125,805,625],[1528,1190,868,658],[1628,1264,908,698],[1732,1370,982,742],[1840,1452,1030,790],[1952,1538,1112,842],[2068,1628,1168,898],[2188,1722,1228,958],[2303,1809,1283,983],[2431,1911,1351,1051],[2563,1989,1423,1093],[2699,2099,1499,1139],[2809,2213,1579,1219],[2953,2331,1663,1273]],o=function(){var a=function(a,b){this._el=a,this._htOption=b};return a.prototype.draw=function(a){function g(a,b){var c=document.createElementNS("http://www.w3.org/2000/svg",a);for(var d in b)b.hasOwnProperty(d)&&c.setAttribute(d,b[d]);return c}var b=this._htOption,c=this._el,d=a.getModuleCount();Math.floor(b.width/d),Math.floor(b.height/d),this.clear();var h=g("svg",{viewBox:"0 0 "+String(d)+" "+String(d),width:"100%",height:"100%",fill:b.colorLight});h.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns:xlink","http://www.w3.org/1999/xlink"),c.appendChild(h),h.appendChild(g("rect",{fill:b.colorDark,width:"1",height:"1",id:"template"}));for(var i=0;d>i;i++)for(var j=0;d>j;j++)if(a.isDark(i,j)){var k=g("use",{x:String(i),y:String(j)});k.setAttributeNS("http://www.w3.org/1999/xlink","href","#template"),h.appendChild(k)}},a.prototype.clear=function(){for(;this._el.hasChildNodes();)this._el.removeChild(this._el.lastChild)},a}(),p="svg"===document.documentElement.tagName.toLowerCase(),q=p?o:m()?function(){function a(){this._elImage.src=this._elCanvas.toDataURL("image/png"),this._elImage.style.display="block",this._elCanvas.style.display="none"}function d(a,b){var c=this;if(c._fFail=b,c._fSuccess=a,null===c._bSupportDataURI){var d=document.createElement("img"),e=function(){c._bSupportDataURI=!1,c._fFail&&_fFail.call(c)},f=function(){c._bSupportDataURI=!0,c._fSuccess&&c._fSuccess.call(c)};return d.onabort=e,d.onerror=e,d.onload=f,d.src="data:image/gif;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==",void 0}c._bSupportDataURI===!0&&c._fSuccess?c._fSuccess.call(c):c._bSupportDataURI===!1&&c._fFail&&c._fFail.call(c)}if(this._android&&this._android<=2.1){var b=1/window.devicePixelRatio,c=CanvasRenderingContext2D.prototype.drawImage;CanvasRenderingContext2D.prototype.drawImage=function(a,d,e,f,g,h,i,j){if("nodeName"in a&&/img/i.test(a.nodeName))for(var l=arguments.length-1;l>=1;l--)arguments[l]=arguments[l]*b;else"undefined"==typeof j&&(arguments[1]*=b,arguments[2]*=b,arguments[3]*=b,arguments[4]*=b);c.apply(this,arguments)}}var e=function(a,b){this._bIsPainted=!1,this._android=n(),this._htOption=b,this._elCanvas=document.createElement("canvas"),this._elCanvas.width=b.width,this._elCanvas.height=b.height,a.appendChild(this._elCanvas),this._el=a,this._oContext=this._elCanvas.getContext("2d"),this._bIsPainted=!1,this._elImage=document.createElement("img"),this._elImage.style.display="none",this._el.appendChild(this._elImage),this._bSupportDataURI=null};return e.prototype.draw=function(a){var b=this._elImage,c=this._oContext,d=this._htOption,e=a.getModuleCount(),f=d.width/e,g=d.height/e,h=Math.round(f),i=Math.round(g);b.style.display="none",this.clear();for(var j=0;e>j;j++)for(var k=0;e>k;k++){var l=a.isDark(j,k),m=k*f,n=j*g;c.strokeStyle=l?d.colorDark:d.colorLight,c.lineWidth=1,c.fillStyle=l?d.colorDark:d.colorLight,c.fillRect(m,n,f,g),c.strokeRect(Math.floor(m)+.5,Math.floor(n)+.5,h,i),c.strokeRect(Math.ceil(m)-.5,Math.ceil(n)-.5,h,i)}this._bIsPainted=!0},e.prototype.makeImage=function(){this._bIsPainted&&d.call(this,a)},e.prototype.isPainted=function(){return this._bIsPainted},e.prototype.clear=function(){this._oContext.clearRect(0,0,this._elCanvas.width,this._elCanvas.height),this._bIsPainted=!1},e.prototype.round=function(a){return a?Math.floor(1e3*a)/1e3:a},e}():function(){var a=function(a,b){this._el=a,this._htOption=b};return a.prototype.draw=function(a){for(var b=this._htOption,c=this._el,d=a.getModuleCount(),e=Math.floor(b.width/d),f=Math.floor(b.height/d),g=[''],h=0;d>h;h++){g.push("");for(var i=0;d>i;i++)g.push('');g.push("")}g.push("
"),c.innerHTML=g.join("");var j=c.childNodes[0],k=(b.width-j.offsetWidth)/2,l=(b.height-j.offsetHeight)/2;k>0&&l>0&&(j.style.margin=l+"px "+k+"px")},a.prototype.clear=function(){this._el.innerHTML=""},a}();QRCode=function(a,b){if(this._htOption={width:256,height:256,typeNumber:4,colorDark:"#000000",colorLight:"#ffffff",correctLevel:d.H},"string"==typeof b&&(b={text:b}),b)for(var c in b)this._htOption[c]=b[c];"string"==typeof a&&(a=document.getElementById(a)),this._android=n(),this._el=a,this._oQRCode=null,this._oDrawing=new q(this._el,this._htOption),this._htOption.text&&this.makeCode(this._htOption.text)},QRCode.prototype.makeCode=function(a){this._oQRCode=new b(r(a,this._htOption.correctLevel),this._htOption.correctLevel),this._oQRCode.addData(a),this._oQRCode.make(),this._el.title=a,this._oDrawing.draw(this._oQRCode),this.makeImage()},QRCode.prototype.makeImage=function(){"function"==typeof this._oDrawing.makeImage&&(!this._android||this._android>=3)&&this._oDrawing.makeImage()},QRCode.prototype.clear=function(){this._oDrawing.clear()},QRCode.CorrectLevel=d}(); \ No newline at end of file diff --git a/src_php/libs/webtorrent.min.js b/src_php/libs/webtorrent.min.js new file mode 100644 index 0000000..3b70ecc --- /dev/null +++ b/src_php/libs/webtorrent.min.js @@ -0,0 +1 @@ +(function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"==typeof window?"undefined"==typeof global?"undefined"==typeof self?this:self:global:window,t.WebTorrent=e()}})(function(){var t=Math.abs,n=Math.pow,r=Math.floor,e=String.fromCharCode,o=Math.ceil,a=Math.max,s=Math.min,i;return function(){function s(d,e,n){function t(o,i){if(!e[o]){if(!d[o]){var l="function"==typeof require&&require;if(!i&&l)return l(o,!0);if(r)return r(o,!0);var c=new Error("Cannot find module '"+o+"'");throw c.code="MODULE_NOT_FOUND",c}var a=e[o]={exports:{}};d[o][0].call(a.exports,function(e){var r=d[o][1][e];return t(r||e)},a,a.exports,s,d,e,n)}return e[o].exports}for(var r="function"==typeof require&&require,o=0;o(this._notifying=!1,this.destroyed?void 0:t?this._destroy(t):void(n("read %s (length %s) (err %s)",e,r.length,t&&t.message),this._offset&&(r=r.slice(this._offset),this._offset=0),this._missing{e.end()}),e}const t=new f(this,e);return this._torrent.select(t._startPiece,t._endPiece,!0,()=>{t._notify()}),i(t,()=>{this._destroyed||!this._torrent.destroyed&&this._torrent.deselect(t._startPiece,t._endPiece,!0)}),t}getBuffer(e){p(this.createReadStream(),this.length,e)}getBlob(e){if("undefined"==typeof window)throw new Error("browser-only method");c(this.createReadStream(),this._getMimeType(),e)}getBlobURL(e){if("undefined"==typeof window)throw new Error("browser-only method");u(this.createReadStream(),this._getMimeType(),e)}appendTo(e,t,n){if("undefined"==typeof window)throw new Error("browser-only method");l.append(this,e,t,n)}renderTo(e,t,n){if("undefined"==typeof window)throw new Error("browser-only method");l.render(this,e,t,n)}_getMimeType(){return l.mime[d.extname(this.name).toLowerCase()]}_destroy(){this._destroyed=!0,this._torrent=null}}t.exports=h}).call(this,e("_process"))},{"./file-stream":1,_process:132,"end-of-stream":65,events:42,path:129,"readable-stream":162,"render-media":163,"stream-to-blob":207,"stream-to-blob-url":206,"stream-with-known-length-to-buffer":208}],3:[function(e,t,n){const r=e("unordered-array-remove"),o=e("debug")("webtorrent:peer"),i=e("bittorrent-protocol"),a=e("./webconn");n.createWebRTCPeer=(e,t)=>{const n=new s(e.id,"webrtc");return n.conn=e,n.swarm=t,n.conn.connected?n.onConnect():(n.conn.once("connect",()=>{n.onConnect()}),n.conn.once("error",e=>{n.destroy(e)}),n.startConnectTimeout()),n},n.createTCPIncomingPeer=e=>{const t=`${e.remoteAddress}:${e.remotePort}`,n=new s(t,"tcpIncoming");return n.conn=e,n.addr=t,n.onConnect(),n},n.createTCPOutgoingPeer=(e,t)=>{const n=new s(e,"tcpOutgoing");return n.addr=e,n.swarm=t,n},n.createWebSeedPeer=(e,t)=>{const n=new s(e,"webSeed");return n.swarm=t,n.conn=new a(e,t),n.onConnect(),n};class s{constructor(e,t){this.id=e,this.type=t,o("new %s Peer %s",t,e),this.addr=null,this.conn=null,this.swarm=null,this.wire=null,this.connected=!1,this.destroyed=!1,this.timeout=null,this.retries=0,this.sentHandshake=!1}onConnect(){if(!this.destroyed){this.connected=!0,o("Peer %s connected",this.id),clearTimeout(this.connectTimeout);const e=this.conn;e.once("end",()=>{this.destroy()}),e.once("close",()=>{this.destroy()}),e.once("finish",()=>{this.destroy()}),e.once("error",e=>{this.destroy(e)});const t=this.wire=new i;t.type=this.type,t.once("end",()=>{this.destroy()}),t.once("close",()=>{this.destroy()}),t.once("finish",()=>{this.destroy()}),t.once("error",e=>{this.destroy(e)}),t.once("handshake",(e,t)=>{this.onHandshake(e,t)}),this.startHandshakeTimeout(),e.pipe(t).pipe(e),this.swarm&&!this.sentHandshake&&this.handshake()}}onHandshake(e,t){if(!this.swarm)return;if(this.destroyed)return;if(this.swarm.destroyed)return this.destroy(new Error("swarm already destroyed"));if(e!==this.swarm.infoHash)return this.destroy(new Error("unexpected handshake info hash for this swarm"));if(t===this.swarm.peerId)return this.destroy(new Error("refusing to connect to ourselves"));o("Peer %s got handshake %s",this.id,e),clearTimeout(this.handshakeTimeout),this.retries=0;let n=this.addr;!n&&this.conn.remoteAddress&&this.conn.remotePort&&(n=`${this.conn.remoteAddress}:${this.conn.remotePort}`),this.swarm._onWire(this.wire,n);this.swarm&&!this.swarm.destroyed&&(this.sentHandshake||this.handshake())}handshake(){const e={dht:!this.swarm.private&&!!this.swarm.client.dht};this.wire.handshake(this.swarm.infoHash,this.swarm.client.peerId,e),this.sentHandshake=!0}startConnectTimeout(){clearTimeout(this.connectTimeout),this.connectTimeout=setTimeout(()=>{this.destroy(new Error("connect timeout"))},"webrtc"===this.type?25e3:5e3),this.connectTimeout.unref&&this.connectTimeout.unref()}startHandshakeTimeout(){clearTimeout(this.handshakeTimeout),this.handshakeTimeout=setTimeout(()=>{this.destroy(new Error("handshake timeout"))},25e3),this.handshakeTimeout.unref&&this.handshakeTimeout.unref()}destroy(e){if(this.destroyed)return;this.destroyed=!0,this.connected=!1,o("destroy %s (error: %s)",this.id,e&&(e.message||e)),clearTimeout(this.connectTimeout),clearTimeout(this.handshakeTimeout);const t=this.swarm,n=this.conn,i=this.wire;this.swarm=null,this.conn=null,this.wire=null,t&&i&&r(t.wires,t.wires.indexOf(i)),n&&(n.on("error",()=>{}),n.destroy()),i&&i.destroy(),t&&t.removePeer(this.id)}}},{"./webconn":6,"bittorrent-protocol":14,debug:62,"unordered-array-remove":219}],4:[function(e,t){t.exports=class{constructor(e){this._torrent=e,this._numPieces=e.pieces.length,this._pieces=Array(this._numPieces),this._onWire=e=>{this.recalculate(),this._initWire(e)},this._onWireHave=e=>{this._pieces[e]+=1},this._onWireBitfield=()=>{this.recalculate()},this._torrent.wires.forEach(e=>{this._initWire(e)}),this._torrent.on("wire",this._onWire),this.recalculate()}getRarestPiece(e){let t=[],n=1/0;for(let r=0;r{this._cleanupWireEvents(e)}),this._torrent=null,this._pieces=null,this._onWire=null,this._onWireHave=null,this._onWireBitfield=null}_initWire(e){e._onClose=()=>{this._cleanupWireEvents(e);for(let t=0;t{this.destroyed||this._onParsedTorrent(t)})):C.remote(e,(e,t)=>this.destroyed?void 0:e?this._destroy(e):void this._onParsedTorrent(t))}_onParsedTorrent(e){if(!this.destroyed){if(this._processParsedTorrent(e),!this.infoHash)return this._destroy(new Error("Malformed torrent data: No info hash"));(this.path||(this.path=L.join(Y,this.infoHash)),this._rechokeIntervalId=setInterval(()=>{this._rechoke()},1e4),this._rechokeIntervalId.unref&&this._rechokeIntervalId.unref(),this.emit("_infoHash",this.infoHash),!this.destroyed)&&(this.emit("infoHash",this.infoHash),this.destroyed||(this.client.listening?this._onListening():this.client.once("listening",()=>{this._onListening()})))}}_processParsedTorrent(e){this._debugId=e.infoHash.toString("hex").substring(0,7),this.announce&&(e.announce=e.announce.concat(this.announce)),this.client.tracker&&r.WEBTORRENT_ANNOUNCE&&!this.private&&(e.announce=e.announce.concat(r.WEBTORRENT_ANNOUNCE)),this.urlList&&(e.urlList=e.urlList.concat(this.urlList)),U(e.announce),U(e.urlList),Object.assign(this,e),this.magnetURI=C.toMagnetURI(e),this.torrentFile=C.toTorrentFile(e)}_onListening(){if(this.discovery||this.destroyed)return;let e=this.client.tracker;e&&(e=Object.assign({},this.client.tracker,{getAnnounceOpts:()=>{const e={uploaded:this.uploaded,downloaded:this.downloaded,left:a(this.length-this.downloaded,0)};return this.client.tracker.getAnnounceOpts&&Object.assign(e,this.client.tracker.getAnnounceOpts()),this._getAnnounceOpts&&Object.assign(e,this._getAnnounceOpts()),e}})),this.discovery=new m({infoHash:this.infoHash,announce:this.announce,peerId:this.client.peerId,dht:!this.private&&this.client.dht,tracker:e,port:this.client.torrentPort,userAgent:K}),this.discovery.on("error",e=>{this._destroy(e)}),this.discovery.on("peer",e=>{"string"==typeof e&&this.done||this.addPeer(e)}),this.discovery.on("trackerAnnounce",()=>{this.emit("trackerAnnounce"),0===this.numPeers&&this.emit("noPeers","tracker")}),this.discovery.on("dhtAnnounce",()=>{this.emit("dhtAnnounce"),0===this.numPeers&&this.emit("noPeers","dht")}),this.discovery.on("warning",e=>{this.emit("warning",e)}),this.info?this._onMetadata(this):this.xs&&this._getMetadataFromServer()}_getMetadataFromServer(){function e(e,n){function r(r,o,i){if(t.destroyed)return n(null);if(t.metadata)return n(null);if(r)return t.emit("warning",new Error(`http error from xs param: ${e}`)),n(null);if(200!==o.statusCode)return t.emit("warning",new Error(`non-200 status code ${o.statusCode} from xs param: ${e}`)),n(null);let a;try{a=C(i)}catch(e){}return a?a.infoHash===t.infoHash?void(t._onMetadata(a),n(null)):(t.emit("warning",new Error(`got torrent file with incorrect info hash from xs param: ${e}`)),n(null)):(t.emit("warning",new Error(`got invalid torrent file from xs param: ${e}`)),n(null))}if(0!==e.indexOf("http://")&&0!==e.indexOf("https://"))return t.emit("warning",new Error(`skipping non-http xs param: ${e}`)),n(null);let o;try{o=y.concat({url:e,method:"GET",headers:{"user-agent":K}},r)}catch(r){return t.emit("warning",new Error(`skipping invalid url xs param: ${e}`)),n(null)}t._xsRequests.push(o)}const t=this,n=Array.isArray(this.xs)?this.xs:[this.xs],r=n.map(t=>n=>{e(t,n)});v(r)}_onMetadata(e){if(this.metadata||this.destroyed)return;this._debug("got metadata"),this._xsRequests.forEach(e=>{e.abort()}),this._xsRequests=[];let t;if(e&&e.infoHash)t=e;else try{t=C(e)}catch(e){return this._destroy(e)}if(this._processParsedTorrent(t),this.metadata=this.torrentFile,this.client.enableWebSeeds&&this.urlList.forEach(e=>{this.addWebSeed(e)}),this._rarityMap=new H(this),this.store=new w(new this._store(this.pieceLength,{torrent:{infoHash:this.infoHash},files:this.files.map(e=>({path:L.join(this.path,e.path),length:e.length,offset:e.offset})),length:this.length,name:this.infoHash})),this.files=this.files.map(e=>new j(this,e)),this.so){const e=O.parse(this.so);this.files.forEach((t,n)=>{e.includes(n)&&this.files[n].select(!0)})}else 0!==this.pieces.length&&this.select(0,this.pieces.length-1,!1);this._hashes=this.pieces,this.pieces=this.pieces.map((e,t)=>{const n=t===this.pieces.length-1?this.lastPieceLength:this.pieceLength;return new B(n)}),this._reservations=this.pieces.map(()=>[]),this.bitfield=new p(this.pieces.length),this.wires.forEach(e=>{e.ut_metadata&&e.ut_metadata.setMetadata(this.metadata),this._onWireWithMetadata(e)}),this.skipVerify?(this._markAllVerified(),this._onStore()):(this._debug("verifying existing torrent data"),this._fileModtimes&&this._store===b?this.getFileModtimes((e,t)=>{if(e)return this._destroy(e);const n=this.files.map((e,n)=>t[n]===this._fileModtimes[n]).every(e=>e);n?(this._markAllVerified(),this._onStore()):this._verifyPieces()}):this._verifyPieces()),this.emit("metadata")}getFileModtimes(e){const t=[];E(this.files.map((e,n)=>r=>{_.stat(L.join(this.path,e.path),(e,o)=>e&&"ENOENT"!==e.code?r(e):void(t[n]=o&&o.mtime.getTime(),r(null)))}),z,n=>{this._debug("done getting file modtimes"),e(n,t)})}_verifyPieces(){E(this.pieces.map((e,t)=>e=>this.destroyed?e(new Error("torrent is destroyed")):void this.store.get(t,(r,o)=>this.destroyed?e(new Error("torrent is destroyed")):r?n.nextTick(e,null):void R(o,n=>{if(this.destroyed)return e(new Error("torrent is destroyed"));if(n===this._hashes[t]){if(!this.pieces[t])return;this._debug("piece verified %s",t),this._markVerified(t)}else this._debug("piece invalid %s",t);e(null)}))),z,e=>e?this._destroy(e):void(this._debug("done verifying"),this._onStore()))}_markAllVerified(){for(let e=0;e{e.abort()}),this._rarityMap&&this._rarityMap.destroy(),this._peers)this.removePeer(e);this.files.forEach(e=>{e instanceof j&&e._destroy()});const n=this._servers.map(e=>t=>{e.destroy(t)});this.discovery&&n.push(e=>{this.discovery.destroy(e)}),this.store&&n.push(e=>{this.store.close(e)}),v(n,t),e&&(0===this.listenerCount("error")?this.client.emit("error",e):this.emit("error",e)),this.emit("close"),this.client=null,this.files=[],this.discovery=null,this.store=null,this._rarityMap=null,this._peers=null,this._servers=null,this._xsRequests=null}}addPeer(t){if(this.destroyed)throw new Error("torrent is destroyed");if(!this.infoHash)throw new Error("addPeer() must not be called before the `infoHash` event");if(this.client.blocked){let e;if("string"==typeof t){let n;try{n=u(t)}catch(n){return this._debug("ignoring peer: invalid %s",t),this.emit("invalidPeer",t),!1}e=n[0]}else"string"==typeof t.remoteAddress&&(e=t.remoteAddress);if(e&&this.client.blocked.contains(e))return this._debug("ignoring peer: blocked %s",t),"string"!=typeof t&&t.destroy(),this.emit("blockedPeer",t),!1}const e=!!this._addPeer(t);return e?this.emit("peer",t):this.emit("invalidPeer",t),e}_addPeer(e){if(this.destroyed)return"string"!=typeof e&&e.destroy(),null;if("string"==typeof e&&!this._validAddr(e))return this._debug("ignoring peer: invalid %s",e),null;const t=e&&e.id||e;if(this._peers[t])return this._debug("ignoring peer: duplicate (%s)",t),"string"!=typeof e&&e.destroy(),null;if(this.paused)return this._debug("ignoring peer: torrent is paused"),"string"!=typeof e&&e.destroy(),null;this._debug("add peer %s",t);let n;return n="string"==typeof e?N.createTCPOutgoingPeer(e,this):N.createWebRTCPeer(e,this),this._peers[n.id]=n,this._peersLength+=1,"string"==typeof e&&(this._queue.push(n),this._drain()),n}addWebSeed(e){if(this.destroyed)throw new Error("torrent is destroyed");if(!/^https?:\/\/.+/.test(e))return this.emit("warning",new Error(`ignoring invalid web seed: ${e}`)),void this.emit("invalidPeer",e);if(this._peers[e])return this.emit("warning",new Error(`ignoring duplicate web seed: ${e}`)),void this.emit("invalidPeer",e);this._debug("add web seed %s",e);const t=N.createWebSeedPeer(e,this);this._peers[t.id]=t,this._peersLength+=1,this.emit("peer",e)}_addIncomingPeer(e){return this.destroyed?e.destroy(new Error("torrent is destroyed")):this.paused?e.destroy(new Error("torrent is paused")):void(this._debug("add incoming peer %s",e.id),this._peers[e.id]=e,this._peersLength+=1)}removePeer(e){const t=e&&e.id||e;e=this._peers[t];e&&(this._debug("removePeer %s",t),delete this._peers[t],this._peersLength-=1,e.destroy(),this._drain())}select(e,t,n,r){if(this.destroyed)throw new Error("torrent is destroyed");if(0>e||tt.priority-e.priority),this._updateSelections()}deselect(e,t,n){if(this.destroyed)throw new Error("torrent is destroyed");n=+n||0,this._debug("deselect %s-%s (priority %s)",e,t,n);for(let r=0;r{this.destroyed||(this.received+=e,this._downloadSpeed(e),this.client._downloadSpeed(e),this.emit("download",e),this.client.emit("download",e))}),e.on("upload",e=>{this.destroyed||(this.uploaded+=e,this._uploadSpeed(e),this.client._uploadSpeed(e),this.emit("upload",e),this.client.emit("upload",e))}),this.wires.push(e),t){const n=u(t);e.remoteAddress=n[0],e.remotePort=n[1]}this.client.dht&&this.client.dht.listening&&e.on("port",n=>this.destroyed||this.client.dht.destroyed?void 0:e.remoteAddress?0===n||65536{this._debug("wire timeout (%s)",t),e.destroy()}),e.setTimeout(3e4,!0),e.setKeepAlive(!0),e.use(P(this.metadata)),e.ut_metadata.on("warning",e=>{this._debug("ut_metadata warning: %s",e.message)}),this.metadata||(e.ut_metadata.on("metadata",e=>{this._debug("got metadata via ut_metadata"),this._onMetadata(e)}),e.ut_metadata.fetch()),"function"!=typeof M||this.private||(e.use(M()),e.ut_pex.on("peer",e=>{this.done||(this._debug("ut_pex: got peer: %s (from %s)",e,t),this.addPeer(e))}),e.ut_pex.on("dropped",e=>{const n=this._peers[e];n&&!n.connected&&(this._debug("ut_pex: dropped peer: %s (from %s)",e,t),this.removePeer(e))}),e.once("close",()=>{e.ut_pex.reset()})),this.emit("wire",e,t),this.metadata&&n.nextTick(()=>{this._onWireWithMetadata(e)})}_onWireWithMetadata(e){let t=null;const n=()=>{this.destroyed||e.destroyed||(this._numQueued>2*(this._numConns-this.numPeers)&&e.amInterested?e.destroy():(t=setTimeout(n,D),t.unref&&t.unref()))};let r;const o=()=>{if(e.peerPieces.buffer.length===this.bitfield.buffer.length){for(r=0;r{o(),this._update()}),e.on("have",()=>{o(),this._update()}),e.once("interested",()=>{e.unchoke()}),e.once("close",()=>{clearTimeout(t)}),e.on("choke",()=>{clearTimeout(t),t=setTimeout(n,D),t.unref&&t.unref()}),e.on("unchoke",()=>{clearTimeout(t),this._update()}),e.on("request",(t,n,r,o)=>r>131072?e.destroy():void(this.pieces[t]||this.store.get(t,{offset:n,length:r},o))),e.bitfield(this.bitfield),e.uninterested(),e.peerExtensions.dht&&this.client.dht&&this.client.dht.listening&&e.port(this.client.dht.address().port),"webSeed"!==e.type&&(t=setTimeout(n,D),t.unref&&t.unref()),e.isSeeder=!1,o()}_updateSelections(){!this.ready||this.destroyed||(n.nextTick(()=>{this._gcSelections()}),this._updateInterest(),this._update())}_gcSelections(){for(let e=0;e{let t=!1;for(let n=0;na>=t&&a<=n&&!(a in r)&&e.peerPieces.get(a)&&(!o||o(a))}function n(){const t=e.downloadSpeed()||1;if(t>F)return()=>!0;const n=a(1,e.requests.length)*B.BLOCK_LENGTH/t;let r=10,o=0;return e=>{if(!r||s.bitfield.get(e))return!0;for(let i=s.pieces[e].missing;o=l)return!0;const a=n();for(let n=0;nd));){for(;s._request(e,d,s._critical[d]||o););if(e.requests.lengtho));){if(s._request(e,o,!1))return;a[o]=!0,d+=1}}else for(o=r.to;o>=r.from+r.offset;--o)if(e.peerPieces.get(o)&&s._request(e,o,!1))return}}();const i=d(e,.5);if(e.requests.length>=i)return;const l=d(e,W);o(!1)||o(!0)}_rechoke(){if(!this.ready)return;0{t.isSeeder||t===this._rechokeOptimisticWire||e.push({wire:t,downloadSpeed:t.downloadSpeed(),uploadSpeed:t.uploadSpeed(),salt:Math.random(),isChoked:!0})}),e.sort(function(e,t){return e.downloadSpeed===t.downloadSpeed?e.uploadSpeed===t.uploadSpeed?e.wire.amChoking===t.wire.amChoking?e.salt-t.salt:e.wire.amChoking?1:-1:t.uploadSpeed-e.uploadSpeed:t.downloadSpeed-e.downloadSpeed});let t=0,n=0;for(;ne.wire.peerInterested),r=t[c(t.length)];r&&(r.isChoked=!1,this._rechokeOptimisticWire=r.wire,this._rechokeOptimisticTime=2)}e.forEach(e=>{e.wire.amChoking!==e.isChoked&&(e.isChoked?e.wire.choke():e.wire.unchoke())})}_hotswap(e,t){const n=e.downloadSpeed();if(n=F||2*i>n||i>r||(a=t,r=i)}if(!a)return!1;for(s=0;s{c._update()})}const c=this,u=e.requests.length,p="webSeed"===e.type;if(c.bitfield.get(t))return!1;const f=p?s(l(e,W,c.pieceLength),c.maxWebConns):d(e,W);if(u>=f)return!1;const h=c.pieces[t];let m=p?h.reserveRemaining():h.reserve();if(-1===m&&o&&c._hotswap(e,t)&&(m=p?h.reserveRemaining():h.reserve()),-1===m)return!1;let g=c._reservations[t];g||(g=c._reservations[t]=[]);let _=g.indexOf(null);-1===_&&(_=g.length),g[_]=e;const b=h.chunkOffset(m),y=p?h.chunkLengthRemaining(m):h.chunkLength(m);return e.request(t,b,y,function n(r,o){if(c.destroyed)return;if(!c.ready)return c.once("ready",()=>{n(r,o)});if(g[_]===e&&(g[_]=null),h!==c.pieces[t])return a();if(r)return c._debug("error getting piece %s (offset: %s length: %s) from %s: %s",t,b,y,`${e.remoteAddress}:${e.remotePort}`,r.message),p?h.cancelRemaining(m):h.cancel(m),void a();if(c._debug("got piece %s (offset: %s length: %s) from %s",t,b,y,`${e.remoteAddress}:${e.remotePort}`),!h.set(m,o,e))return a();const i=h.flush();R(i,e=>{if(!c.destroyed){if(e===c._hashes[t]){if(!c.pieces[t])return;c._debug("piece verified %s",t),c.pieces[t]=null,c._reservations[t]=null,c.bitfield.set(t,!0),c.store.put(t,i),c.wires.forEach(e=>{e.have(t)}),c._checkDone()&&!c.destroyed&&c.discovery.complete()}else c.pieces[t]=new B(h.length),c.emit("warning",new Error(`Piece ${t} failed verification`));a()}})}),!0}_checkDone(){if(this.destroyed)return;this.files.forEach(e=>{if(!e.done){for(let t=e._startPiece;t<=e._endPiece;++t)if(!this.bitfield.get(t))return;e.done=!0,e.emit("done"),this._debug(`file done: ${e.name}`)}});let e=!0;for(let t=0;t{this.load(e,t)});Array.isArray(e)||(e=[e]),t||(t=i);const n=new k(e),r=new f(this.store,this.pieceLength);I(n,r,e=>e?t(e):void(this._markAllVerified(),this._checkDone(),t(null)))}createServer(e){if("function"!=typeof q)throw new Error("node.js-only method");if(this.destroyed)throw new Error("torrent is destroyed");const t=new q(this,e);return this._servers.push(t),t}pause(){this.destroyed||(this._debug("pause"),this.paused=!0)}resume(){this.destroyed||(this._debug("resume"),this.paused=!1,this._drain())}_debug(){const e=[].slice.call(arguments);e[0]=`[${this.client._debugId}] [${this._debugId}] ${e[0]}`,h(...e)}_drain(){if(this._debug("_drain numConns %s maxConns %s",this._numConns,this.client.maxConns),"function"!=typeof x.connect||this.destroyed||this.paused||this._numConns>=this.client.maxConns)return;this._debug("drain (%s queued, %s/%s peers)",this._numQueued,this.numPeers,this.client.maxConns);const e=this._queue.shift();if(!e)return;this._debug("tcp connect attempt to %s",e.addr);const t=u(e.addr),n={host:t[0],port:t[1]},r=e.conn=x.connect(n);r.once("connect",()=>{e.onConnect()}),r.once("error",t=>{e.destroy(t)}),e.startConnectTimeout(),r.on("close",()=>{if(!this.destroyed){if(e.retries>=V.length)return void this._debug("conn %s closed: will not re-add (max %s attempts)",e.addr,V.length);const t=V[e.retries];this._debug("conn %s closed: will re-add to queue in %sms (attempt %s)",e.addr,t,e.retries+1);const n=setTimeout(()=>{const t=this._addPeer(e.addr);t&&(t.retries=e.retries+1)},t);n.unref&&n.unref()}})}_validAddr(e){let t;try{t=u(e)}catch(t){return!1}const n=t[0],r=t[1];return 0r&&("127.0.0.1"!==n||r!==this.client.torrentPort)}}t.exports=X}).call(this,e("_process"),"undefined"==typeof global?"undefined"==typeof self?"undefined"==typeof window?{}:window:self:global)},{"../package.json":229,"./file":2,"./peer":3,"./rarity-map":4,"./server":39,_process:132,"addr-to-ip-port":7,bitfield:13,"chunk-store-stream/write":58,debug:62,events:42,fs:40,"fs-chunk-store":98,"immediate-chunk-store":79,multistream:115,net:39,os:39,"parse-numeric-range":127,"parse-torrent":128,path:129,pump:133,"random-iterate":138,"run-parallel":166,"run-parallel-limit":165,"simple-get":170,"simple-sha1":181,speedometer:192,"torrent-discovery":214,"torrent-piece":215,uniq:218,ut_metadata:222,ut_pex:39}],6:[function(e,t){const n=e("bitfield"),r=e("safe-buffer").Buffer,o=e("debug")("webtorrent:webconn"),i=e("simple-get"),d=e("simple-sha1"),l=e("bittorrent-protocol"),c=e("../package.json").version;t.exports=class extends l{constructor(e,t){super(),this.url=e,this.webPeerId=d.sync(e),this._torrent=t,this._init()}_init(){this.setKeepAlive(!0),this.once("handshake",e=>{if(this.destroyed)return;this.handshake(e,this.webPeerId);const t=this._torrent.pieces.length,r=new n(t);for(let n=0;n<=t;n++)r.set(n,!0);this.bitfield(r)}),this.once("interested",()=>{o("interested"),this.unchoke()}),this.on("uninterested",()=>{o("uninterested")}),this.on("choke",()=>{o("choke")}),this.on("unchoke",()=>{o("unchoke")}),this.on("bitfield",()=>{o("bitfield")}),this.on("request",(e,t,n,r)=>{o("request pieceIndex=%d offset=%d length=%d",e,t,n),this.httpRequest(e,t,n,r)})}httpRequest(e,t,n,d){const l=e*this._torrent.pieceLength,u=l+t,p=u+n-1,f=this._torrent.files;let h;if(1>=f.length)h=[{url:this.url,start:u,end:p}];else{const e=f.filter(e=>e.offset<=p&&e.offset+e.length>u);if(1>e.length)return d(new Error("Could not find file corresponnding to web seed range request"));h=e.map(e=>{const t=e.offset+e.length-1,n=this.url+("/"===this.url[this.url.length-1]?"":"/")+e.path;return{url:n,fileOffsetInRange:a(e.offset-u,0),start:a(u-e.offset,0),end:s(t,p-e.offset)}})}let m=0,g=!1,_;1{function a(e,t){return 200>e.statusCode||300<=e.statusCode?(g=!0,d(new Error(`Unexpected HTTP status code ${e.statusCode}`))):void(o("Got data of length %d",t.length),1===h.length?d(null,t):(t.copy(_,r.fileOffsetInRange),++m===h.length&&d(null,_)))}const s=r.url,l=r.start,u=r.end;o("Requesting url=%s pieceIndex=%d offset=%d length=%d start=%d end=%d",s,e,t,n,l,u);const p={url:s,method:"GET",headers:{"user-agent":`WebTorrent/${c} (https://webtorrent.io)`,range:`bytes=${l}-${u}`}};i.concat(p,(e,t,n)=>g?void 0:e?"undefined"==typeof window||s.startsWith(`${window.location.origin}/`)?(g=!0,d(e)):i.head(s,(t,n)=>g?void 0:t?(g=!0,d(t)):200>n.statusCode||300<=n.statusCode?(g=!0,d(new Error(`Unexpected HTTP status code ${n.statusCode}`))):n.url===s?(g=!0,d(e)):void(p.url=n.url,i.concat(p,(e,t,n)=>g?void 0:e?(g=!0,d(e)):void a(t,n)))):void a(t,n))})}destroy(){super.destroy(),this._torrent=null}}},{"../package.json":229,bitfield:13,"bittorrent-protocol":14,debug:62,"safe-buffer":168,"simple-get":170,"simple-sha1":181}],7:[function(e,t){const n=/^\[?([^\]]+)\]?:(\d+)$/;let r={},o=0;t.exports=function(e){if(1e5===o&&t.exports.reset(),!r[e]){const t=n.exec(e);if(!t)throw new Error(`invalid addr: ${e}`);r[e]=[t[1],+t[2]],o+=1}return r[e]},t.exports.reset=function(){r={},o=0}},{}],8:[function(e,t,n){"use strict";function r(e){var t=e.length;if(0>16,s[d++]=255&f>>8,s[d++]=255&f;return 2===a&&(f=u[e.charCodeAt(c)]<<2|u[e.charCodeAt(c+1)]>>4,s[d++]=255&f),1===a&&(f=u[e.charCodeAt(c)]<<10|u[e.charCodeAt(c+1)]<<4|u[e.charCodeAt(c+2)]>>2,s[d++]=255&f>>8,s[d++]=255&f),s}function s(e){return c[63&e>>18]+c[63&e>>12]+c[63&e>>6]+c[63&e]}function d(e,t,n){for(var r=[],o=t,a;os?s:a+o));return 1===n?(l=e[t-1],r.push(c[l>>2]+c[63&l<<4]+"==")):2===n&&(l=(e[t-2]<<8)+e[t-1],r.push(c[l>>10]+c[63&l>>4]+c[63&l<<2]+"=")),r.join("")}n.byteLength=function(e){var t=r(e),n=t[0],o=t[1];return 3*(n+o)/4-o},n.toByteArray=a,n.fromByteArray=l;for(var c=[],u=[],p="undefined"==typeof Uint8Array?Array:Uint8Array,f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",h=0,m=f.length;hs&&48<=s){r=10*r+(s-48);continue}if(a!==t||43!==s){if(a===t&&45===s){o=-1;continue}if(46===s)break;throw new Error("not a number: buffer["+a+"] = "+s)}}return r*o}function o(e,n,r,i){return null==e||0===e.length?null:("number"!=typeof n&&null==i&&(i=n,n=void 0),"number"!=typeof r&&null==i&&(i=r,r=void 0),o.position=0,o.encoding=i||null,o.data=t.isBuffer(e)?e.slice(n,r):new t(e),o.bytes=o.data.length,o.next())}const i=101;o.bytes=0,o.position=0,o.data=null,o.encoding=null,o.next=function(){switch(o.data[o.position]){case 100:return o.dictionary();case 108:return o.list();case 105:return o.integer();default:return o.buffer();}},o.find=function(t){for(var n=o.position,r=o.data.length,a=o.data;nr||r>=e.length)throw new RangeError("invalid lower bound");if(void 0===o)o=e.length-1;else if(o|=0,o=e.length)throw new RangeError("invalid upper bound");for(;r<=o;)if(i=r+(o-r>>1),a=+n(e[i],t,i,e),0>a)r=i+1;else if(0>3;return 0!=e%8&&t++,t}var o="undefined"==typeof e?Uint8Array:e;n.prototype.get=function(e){var t=e>>3;return t>e%8)},n.prototype.set=function(e,t){var n=e>>3;t||1===arguments.length?(this.buffer.length>e%8):n>e%8))},n.prototype._grow=function(e){if(this.buffer.length{this.keepAlive()},55e3))}setTimeout(e,t){this._debug("setTimeout ms=%d unref=%s",e,t),this._clearTimeout(),this._timeoutMs=e,this._timeoutUnref=!!t,this._updateTimeout()}destroy(){this.destroyed||(this.destroyed=!0,this._debug("destroy"),this.emit("close"),this.end())}end(...e){this._debug("end"),this._onUninterested(),this._onChoke(),super.end(...e)}use(e){function t(){}const n=e.prototype.name;if(!n)throw new Error("Extension class requires a \"name\" property on the prototype");this._debug("use extension.name=%s",n);const r=this._nextExt,o=new e(this);"function"!=typeof o.onHandshake&&(o.onHandshake=t),"function"!=typeof o.onExtendedHandshake&&(o.onExtendedHandshake=t),"function"!=typeof o.onMessage&&(o.onMessage=t),this.extendedMapping[r]=n,this._ext[n]=o,this[n]=o,this._nextExt+=1}keepAlive(){this._debug("keep-alive"),this._push(p)}handshake(e,t,r){let o,i;if("string"==typeof e?(e=e.toLowerCase(),o=n.from(e,"hex")):(o=e,e=o.toString("hex")),"string"==typeof t?i=n.from(t,"hex"):(i=t,t=i.toString("hex")),20!==o.length||20!==i.length)throw new Error("infoHash and peerId MUST have length 20");this._debug("handshake i=%s p=%s exts=%o",e,t,r);const a=n.from(_);a[5]|=16,r&&r.dht&&(a[7]|=1),this._push(n.concat([u,a,o,i])),this._handshakeSent=!0,this.peerExtensions.extended&&!this._extendedHandshakeSent&&this._sendExtendedHandshake()}_sendExtendedHandshake(){const e=s(this.extendedHandshake);for(const t in e.m={},this.extendedMapping){const n=this.extendedMapping[t];e.m[n]=+t}this.extended(0,o.encode(e)),this._extendedHandshakeSent=!0}choke(){if(!this.amChoking){for(this.amChoking=!0,this._debug("choke");this.peerRequests.length;)this.peerRequests.pop();this._push(f)}}unchoke(){this.amChoking&&(this.amChoking=!1,this._debug("unchoke"),this._push(h))}interested(){this.amInterested||(this.amInterested=!0,this._debug("interested"),this._push(m))}uninterested(){this.amInterested&&(this.amInterested=!1,this._debug("uninterested"),this._push(g))}have(e){this._debug("have %d",e),this._message(4,[e],null)}bitfield(e){this._debug("bitfield"),n.isBuffer(e)||(e=e.buffer),this._message(5,[],e)}request(e,t,n,r){return r||(r=()=>{}),this._finished?r(new Error("wire is closed")):this.peerChoking?r(new Error("peer is choking")):void(this._debug("request index=%d offset=%d length=%d",e,t,n),this.requests.push(new y(e,t,n,r)),this._updateTimeout(),this._message(6,[e,t,n],null))}piece(e,t,n){this._debug("piece index=%d offset=%d",e,t),this.uploaded+=n.length,this.uploadSpeed(n.length),this.emit("upload",n.length),this._message(7,[e,t],n)}cancel(e,t,n){this._debug("cancel index=%d offset=%d length=%d",e,t,n),this._callback(this._pull(this.requests,e,t,n),new Error("request was cancelled"),null),this._message(8,[e,t,n],null)}port(e){this._debug("port %d",e);const t=n.from(b);t.writeUInt16BE(e,5),this._push(t)}extended(e,t){if(this._debug("extended ext=%s",e),"string"==typeof e&&this.peerExtendedMapping[e]&&(e=this.peerExtendedMapping[e]),"number"==typeof e){const r=n.from([e]),i=n.isBuffer(t)?t:o.encode(t);this._message(20,[],n.concat([r,i]))}else throw new Error(`Unrecognized extension: ${e}`)}_read(){}_message(e,t,r){const o=r?r.length:0,a=n.allocUnsafe(5+4*t.length);a.writeUInt32BE(a.length+o-4,0),a[4]=e;for(let n=0;nr===this._pull(this.peerRequests,e,t,n)?o?this._debug("error satisfying request index=%d offset=%d length=%d (%s)",e,t,n,o.message):void this.piece(e,t,i):void 0;var r=new y(e,t,n,o);this.peerRequests.push(r),this.emit("request",e,t,n,o)}}_onPiece(e,t,n){this._debug("got piece index=%d offset=%d",e,t),this._callback(this._pull(this.requests,e,t,n.length),null,n),this.downloaded+=n.length,this.downloadSpeed(n.length),this.emit("download",n.length),this.emit("piece",e,t,n)}_onCancel(e,t,n){this._debug("got cancel index=%d offset=%d length=%d",e,t,n),this._pull(this.peerRequests,e,t,n),this.emit("cancel",e,t,n)}_onPort(e){this._debug("got port %d",e),this.emit("port",e)}_onExtended(e,t){if(0===e){let e;try{e=o.decode(t)}catch(e){this._debug("ignoring invalid extended handshake: %s",e.message||e)}if(!e)return;this.peerExtendedHandshake=e;if("object"==typeof e.m)for(var n in e.m)this.peerExtendedMapping[n]=+e.m[n].toString();for(n in this._ext)this.peerExtendedMapping[n]&&this._ext[n].onExtendedHandshake(this.peerExtendedHandshake);this._debug("got extended handshake"),this.emit("extended","handshake",this.peerExtendedHandshake)}else this.extendedMapping[e]&&(e=this.extendedMapping[e],this._ext[e]&&this._ext[e].onMessage(t)),this._debug("got extended message ext=%s",e),this.emit("extended",e,t)}_onTimeout(){this._debug("request timed out"),this._callback(this.requests.shift(),new Error("request has timed out"),null),this.emit("timeout")}_write(e,t,r){for(this._bufferSize+=e.length,this._buffer.push(e);this._bufferSize>=this._parserSize;){const e=1===this._buffer.length?this._buffer[0]:n.concat(this._buffer);this._bufferSize-=this._parserSize,this._buffer=this._bufferSize?[e.slice(this._parserSize)]:[],this._parser(e.slice(0,this._parserSize))}r(null)}_callback(e,t,n){e&&(this._clearTimeout(),!this.peerChoking&&!this._finished&&this._updateTimeout(),e.callback(t,n))}_clearTimeout(){this._timeout&&(clearTimeout(this._timeout),this._timeout=null)}_updateTimeout(){this._timeoutMs&&this.requests.length&&!this._timeout&&(this._timeout=setTimeout(()=>this._onTimeout(),this._timeoutMs),this._timeoutUnref&&this._timeout.unref&&this._timeout.unref())}_parse(e,t){this._parserSize=e,this._parser=t}_onMessageLength(e){const t=e.readUInt32BE(0);0{const t=e.readUInt8(0);this._parse(t+48,e=>{const n=e.slice(0,t);return"BitTorrent protocol"===n.toString()?void(e=e.slice(t),this._onHandshake(e.slice(8,28),e.slice(28,48),{dht:!!(1&e[7]),extended:!!(16&e[5])}),this._parse(4,this._onMessageLength)):(this._debug("Error: wire not speaking BitTorrent protocol (%s)",n.toString()),void this.end())})})}_onFinish(){for(this._finished=!0,this.push(null);this.read(););for(clearInterval(this._keepAliveInterval),this._parse(Number.MAX_VALUE,()=>{});this.peerRequests.length;)this.peerRequests.pop();for(;this.requests.length;)this._callback(this.requests.pop(),new Error("wire was closed"),null)}_debug(...e){e[0]=`[${this._debugId}] ${e[0]}`,a(...e)}_pull(e,t,n,o){for(let a=0;a>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function m(e,t){return 0>=e||0===t.length&&t.ended?0:t.objectMode?1:e===e?(e>t.highWaterMark&&(t.highWaterMark=h(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0)):t.flowing&&t.length?t.buffer.head.data.length:t.length}function g(e,t){if(!t.ended){if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,_(e)}}function _(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(W("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?U.nextTick(b,e):b(e))}function b(e){W("emit readable"),e.emit("readable"),E(e)}function y(e,t){t.readingMore||(t.readingMore=!0,U.nextTick(w,e,t))}function w(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):n=L(e,t.buffer,t.decoder),n}function L(e,t,n){var r;return ea.length?a.length:e;if(i+=s===a.length?a:a.slice(0,e),e-=s,0===e){s===a.length?(++o,t.head=r.next?r.next:t.tail=null):(t.head=r,r.data=a.slice(s));break}++o}return t.length-=o,i}function I(e,t){var r=H.allocUnsafe(e),o=t.head,i=1;for(o.data.copy(r),e-=o.data.length;o=o.next;){var a=o.data,s=e>a.length?a.length:e;if(a.copy(r,r.length-e,0,s),e-=s,0===e){s===a.length?(++i,t.head=o.next?o.next:t.tail=null):(t.head=o,o.data=a.slice(s));break}++i}return t.length-=i,r}function T(e){var t=e._readableState;if(0=t.highWaterMark||t.ended))return W("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?T(this):_(this),null;if(e=m(e,t),0===e&&t.ended)return 0===t.length&&T(this),null;var o=t.needReadable;W("need readable",o),(0===t.length||t.length-e>>0),n=this.head,a=0;n;)r(n.data,t,a),a+=n.data.length,n=n.next;return t},e}(),i&&i.inspect&&i.inspect.custom&&(t.exports.prototype[i.inspect.custom]=function(){var e=i.inspect({length:this.length});return this.constructor.name+" "+e})},{"safe-buffer":168,util:39}],21:[function(e,t){"use strict";function n(e,t){e.emit("error",t)}var r=e("process-nextick-args");t.exports={destroy:function(e,t){var o=this,i=this._readableState&&this._readableState.destroyed,a=this._writableState&&this._writableState.destroyed;return i||a?(t?t(e):e&&(!this._writableState||!this._writableState.errorEmitted)&&r.nextTick(n,this,e),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(e){!t&&e?(r.nextTick(n,o,e),o._writableState&&(o._writableState.errorEmitted=!0)):t&&t(e)}),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}}},{"process-nextick-args":131}],22:[function(e,t){t.exports=e("events").EventEmitter},{events:42}],23:[function(e,t,n){n=t.exports=e("./lib/_stream_readable.js"),n.Stream=n,n.Readable=n,n.Writable=e("./lib/_stream_writable.js"),n.Duplex=e("./lib/_stream_duplex.js"),n.Transform=e("./lib/_stream_transform.js"),n.PassThrough=e("./lib/_stream_passthrough.js")},{"./lib/_stream_duplex.js":15,"./lib/_stream_passthrough.js":16,"./lib/_stream_readable.js":17,"./lib/_stream_transform.js":18,"./lib/_stream_writable.js":19}],24:[function(e,t){(function(n){function r(e){function t(e){n.nextTick(function(){s.emit("warning",e)})}var s=this;if(!(s instanceof r))return new r(e);if(a.call(s),e||(e={}),!e.peerId)throw new Error("Option `peerId` is required");if(!e.infoHash)throw new Error("Option `infoHash` is required");if(!e.announce)throw new Error("Option `announce` is required");if(!n.browser&&!e.port)throw new Error("Option `port` is required");s.peerId="string"==typeof e.peerId?e.peerId:e.peerId.toString("hex"),s._peerIdBuffer=o.from(s.peerId,"hex"),s._peerIdBinary=s._peerIdBuffer.toString("binary"),s.infoHash="string"==typeof e.infoHash?e.infoHash.toLowerCase():e.infoHash.toString("hex"),s._infoHashBuffer=o.from(s.infoHash,"hex"),s._infoHashBinary=s._infoHashBuffer.toString("binary"),i("new client %s",s.infoHash),s.destroyed=!1,s._port=e.port,s._getAnnounceOpts=e.getAnnounceOpts,s._rtcConfig=e.rtcConfig,s._userAgent=e.userAgent,s._wrtc="function"==typeof e.wrtc?e.wrtc():e.wrtc;var d="string"==typeof e.announce?[e.announce]:null==e.announce?[]:e.announce;d=d.map(function(e){return e=e.toString(),"/"===e[e.length-1]&&(e=e.substring(0,e.length-1)),e}),d=p(d);var l=!1!==s._wrtc&&(!!s._wrtc||u.WEBRTC_SUPPORT);s._trackers=d.map(function(e){var n=f.parse(e).protocol;return("http:"===n||"https:"===n)&&"function"==typeof m?new m(s,e):"udp:"===n&&"function"==typeof g?new g(s,e):("ws:"===n||"wss:"===n)&&l?"ws:"===n&&"undefined"!=typeof window&&"https:"===window.location.protocol?(t(new Error("Unsupported tracker protocol: "+e)),null):new _(s,e):(t(new Error("Unsupported tracker protocol: "+e)),null)}).filter(Boolean)}t.exports=r;var o=e("safe-buffer").Buffer,i=e("debug")("bittorrent-tracker:client"),a=e("events").EventEmitter,s=e("xtend"),d=e("inherits"),l=e("once"),c=e("run-parallel"),u=e("simple-peer"),p=e("uniq"),f=e("url"),h=e("./lib/common"),m=e("./lib/client/http-tracker"),g=e("./lib/client/udp-tracker"),_=e("./lib/client/websocket-tracker");d(r,a),r.scrape=function(e,t){if(t=l(t),!e.infoHash)throw new Error("Option `infoHash` is required");if(!e.announce)throw new Error("Option `announce` is required");var n=s(e,{infoHash:Array.isArray(e.infoHash)?e.infoHash[0]:e.infoHash,peerId:o.from("01234567890123456789"),port:6881}),i=new r(n);i.once("error",t),i.once("warning",t);var a=Array.isArray(e.infoHash)?e.infoHash.length:1,d={};return i.on("scrape",function(e){if(a-=1,d[e.infoHash]=e,0===a){i.destroy();var n=Object.keys(d);1===n.length?t(null,d[n[0]]):t(null,d)}}),e.infoHash=Array.isArray(e.infoHash)?e.infoHash.map(function(e){return o.from(e,"hex")}):o.from(e.infoHash,"hex"),i.scrape({infoHash:e.infoHash}),i},r.prototype.start=function(e){var t=this;i("send `start`"),e=t._defaultAnnounceOpts(e),e.event="started",t._announce(e),t._trackers.forEach(function(e){e.setInterval()})},r.prototype.stop=function(e){var t=this;i("send `stop`"),e=t._defaultAnnounceOpts(e),e.event="stopped",t._announce(e)},r.prototype.complete=function(e){var t=this;i("send `complete`"),e||(e={}),e=t._defaultAnnounceOpts(e),e.event="completed",t._announce(e)},r.prototype.update=function(e){var t=this;i("send `update`"),e=t._defaultAnnounceOpts(e),e.event&&delete e.event,t._announce(e)},r.prototype._announce=function(e){var t=this;t._trackers.forEach(function(t){t.announce(e)})},r.prototype.scrape=function(e){var t=this;i("send `scrape`"),e||(e={}),t._trackers.forEach(function(t){t.scrape(e)})},r.prototype.setInterval=function(e){var t=this;i("setInterval %d",e),t._trackers.forEach(function(t){t.setInterval(e)})},r.prototype.destroy=function(e){var t=this;if(!t.destroyed){t.destroyed=!0,i("destroy");var n=t._trackers.map(function(e){return function(t){e.destroy(t)}});c(n,e),t._trackers=[],t._getAnnounceOpts=null}},r.prototype._defaultAnnounceOpts=function(e){var t=this;return e||(e={}),null==e.numwant&&(e.numwant=h.DEFAULT_ANNOUNCE_PEERS),null==e.uploaded&&(e.uploaded=0),null==e.downloaded&&(e.downloaded=0),t._getAnnounceOpts&&(e=s(e,t._getAnnounceOpts())),e}}).call(this,e("_process"))},{"./lib/client/http-tracker":39,"./lib/client/udp-tracker":39,"./lib/client/websocket-tracker":26,"./lib/common":27,_process:132,debug:62,events:42,inherits:80,once:126,"run-parallel":166,"safe-buffer":168,"simple-peer":171,uniq:218,url:220,xtend:227}],25:[function(e,t){function n(e,t){var n=this;r.call(n),n.client=e,n.announceUrl=t,n.interval=null,n.destroyed=!1}t.exports=n;var r=e("events").EventEmitter,o=e("inherits");o(n,r),n.prototype.setInterval=function(e){var t=this;null==e&&(e=t.DEFAULT_ANNOUNCE_INTERVAL),clearInterval(t.interval),e&&(t.interval=setInterval(function(){t.announce(t.client._defaultAnnounceOpts())},e),t.interval.unref&&t.interval.unref())}},{events:42,inherits:80}],26:[function(e,t){function o(e,t){var n=this;h.call(n,e,t),a("new websocket tracker %s",t),n.peers={},n.socket=null,n.reconnecting=!1,n.retries=0,n.reconnectTimer=null,n.expectingResponse=!1,n._openSocket()}function i(){}t.exports=o;var a=e("debug")("bittorrent-tracker:websocket-tracker"),d=e("xtend"),l=e("inherits"),c=e("simple-peer"),u=e("randombytes"),p=e("simple-websocket"),f=e("../common"),h=e("./tracker"),m={};o._socketPool=m;l(o,h),o.prototype.DEFAULT_ANNOUNCE_INTERVAL=30000,o.prototype.announce=function(e){var t=this;if(!(t.destroyed||t.reconnecting)){if(!t.socket.connected)return void t.socket.once("connect",function(){t.announce(e)});var n=d(e,{action:"announce",info_hash:t.client._infoHashBinary,peer_id:t.client._peerIdBinary});if(t._trackerId&&(n.trackerid=t._trackerId),"stopped"===e.event||"completed"===e.event)t._send(n);else{var r=s(e.numwant,10);t._generateOffers(r,function(e){n.numwant=r,n.offers=e,t._send(n)})}}},o.prototype.scrape=function(e){var t=this;if(!(t.destroyed||t.reconnecting)){if(!t.socket.connected)return void t.socket.once("connect",function(){t.scrape(e)});var n=Array.isArray(e.infoHash)&&0=this.size;){var o=n.concat(this._buffered);this._bufferedBytes-=this.size,this.push(o.slice(0,this.size)),this._buffered=[o.slice(this.size,o.length)]}r()},r.prototype._flush=function(){if(this._bufferedBytes&&this._zeroPadding){var e=new n(this.size-this._bufferedBytes);e.fill(0),this._buffered.push(e),this.push(n.concat(this._buffered)),this._buffered=null}else this._bufferedBytes&&(this.push(n.concat(this._buffered)),this._buffered=null);this.push(null)}}).call(this,e("buffer").Buffer)},{buffer:41,defined:64,inherits:80,"readable-stream":38}],30:[function(e,t,n){arguments[4][15][0].apply(n,arguments)},{"./_stream_readable":32,"./_stream_writable":34,"core-util-is":60,dup:15,inherits:80,"process-nextick-args":131}],31:[function(e,t,n){arguments[4][16][0].apply(n,arguments)},{"./_stream_transform":33,"core-util-is":60,dup:16,inherits:80}],32:[function(e,t,n){arguments[4][17][0].apply(n,arguments)},{"./_stream_duplex":30,"./internal/streams/BufferList":35,"./internal/streams/destroy":36,"./internal/streams/stream":37,_process:132,"core-util-is":60,dup:17,events:42,inherits:80,isarray:85,"process-nextick-args":131,"safe-buffer":168,"string_decoder/":209,util:39}],33:[function(e,t,n){arguments[4][18][0].apply(n,arguments)},{"./_stream_duplex":30,"core-util-is":60,dup:18,inherits:80}],34:[function(e,t,n){arguments[4][19][0].apply(n,arguments)},{"./_stream_duplex":30,"./internal/streams/destroy":36,"./internal/streams/stream":37,_process:132,"core-util-is":60,dup:19,inherits:80,"process-nextick-args":131,"safe-buffer":168,timers:212,"util-deprecate":223}],35:[function(e,t,n){arguments[4][20][0].apply(n,arguments)},{dup:20,"safe-buffer":168,util:39}],36:[function(e,t,n){arguments[4][21][0].apply(n,arguments)},{dup:21,"process-nextick-args":131}],37:[function(e,t,n){arguments[4][22][0].apply(n,arguments)},{dup:22,events:42}],38:[function(e,t,n){arguments[4][23][0].apply(n,arguments)},{"./lib/_stream_duplex.js":30,"./lib/_stream_passthrough.js":31,"./lib/_stream_readable.js":32,"./lib/_stream_transform.js":33,"./lib/_stream_writable.js":34,dup:23}],39:[function(){},{}],40:[function(e,t,n){arguments[4][39][0].apply(n,arguments)},{dup:39}],41:[function(t,r,o){"use strict";function a(e){if(2147483647e)throw new RangeError("The value \""+e+"\" is invalid for option \"size\"")}function c(e,t,n){return l(e),0>=e?a(e):void 0===t?a(e):"string"==typeof n?a(e).fill(t,n):a(e).fill(t)}function u(e){return l(e),a(0>e?0:0|g(e))}function p(e,t){if(("string"!=typeof t||""===t)&&(t="utf8"),!d.isEncoding(t))throw new TypeError("Unknown encoding: "+t);var n=0|_(e,t),r=a(n),o=r.write(e,t);return o!==n&&(r=r.slice(0,o)),r}function f(e){for(var t=0>e.length?0:0|g(e.length),n=a(t),r=0;rt||e.byteLength=2147483647)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+2147483647 .toString(16)+" bytes");return 0|e}function _(e,t){if(d.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||K(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError("The \"string\" argument must be one of type string, Buffer, or ArrayBuffer. Received type "+typeof e);var n=e.length,r=2>>1;case"base64":return V(e).length;default:if(o)return r?-1:F(e).length;t=(""+t).toLowerCase(),o=!0;}}function b(e,t,n){var r=!1;if((void 0===t||0>t)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),0>=n)return"";if(n>>>=0,t>>>=0,n<=t)return"";for(e||(e="utf8");;)switch(e){case"hex":return U(this,t,n);case"utf8":case"utf-8":return I(this,t,n);case"ascii":return R(this,t,n);case"latin1":case"binary":return A(this,t,n);case"base64":return B(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return P(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0;}}function y(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function w(e,t,n,r,o){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):2147483647n&&(n=-2147483648),n=+n,Y(n)&&(n=o?0:e.length-1),0>n&&(n=e.length+n),n>=e.length){if(o)return-1;n=e.length-1}else if(0>n)if(o)n=0;else return-1;if("string"==typeof t&&(t=d.from(t,r)),d.isBuffer(t))return 0===t.length?-1:k(e,t,n,r,o);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):k(e,[t],n,r,o);throw new TypeError("val must be string, number or Buffer")}function k(e,t,n,r,o){function a(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}var s=1,d=e.length,l=t.length;if(void 0!==r&&(r=(r+"").toLowerCase(),"ucs2"===r||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(2>e.length||2>t.length)return-1;s=2,d/=2,l/=2,n/=2}var c;if(o){var u=-1;for(c=n;cd&&(n=d-l),c=n;0<=c;c--){for(var p=!0,f=0;fo&&(r=o)):r=o;var a=t.length;r>a/2&&(r=a/2);for(var s=0,d;sa&&(d=a):2===l?(c=e[o+1],128==(192&c)&&(f=(31&a)<<6|63&c,127f||57343f&&(d=f))):void 0}null===d?(d=65533,l=1):65535>>10),d=56320|1023&d),r.push(d),o+=l}return T(r)}function T(t){var n=t.length;if(n<=4096)return e.apply(String,t);for(var r="",o=0;ot)&&(t=0),(!n||0>n||n>r)&&(n=r);for(var o="",a=t;ae)throw new RangeError("offset is not uint");if(e+t>n)throw new RangeError("Trying to access beyond buffer length")}function O(e,t,n,r,o,i){if(!d.isBuffer(e))throw new TypeError("\"buffer\" argument must be a Buffer instance");if(t>o||te.length)throw new RangeError("Index out of range")}function j(e,t,n,r){if(n+r>e.length)throw new RangeError("Index out of range");if(0>n)throw new RangeError("Index out of range")}function N(e,t,n,r,o){return t=+t,n>>>=0,o||j(e,t,n,4,34028234663852886e22,-34028234663852886e22),$.write(e,t,n,r,23,4),n+4}function H(e,t,n,r,o){return t=+t,n>>>=0,o||j(e,t,n,8,17976931348623157e292,-17976931348623157e292),$.write(e,t,n,r,52,8),n+8}function q(e){if(e=e.split("=")[0],e=e.trim().replace(Q,""),2>e.length)return"";for(;0!=e.length%4;)e+="=";return e}function D(e){return 16>e?"0"+e.toString(16):e.toString(16)}function F(e,t){t=t||1/0;for(var n=e.length,r=null,o=[],a=0,s;as){if(!r){if(56319s){-1<(t-=3)&&o.push(239,191,189),r=s;continue}s=(r-55296<<10|s-56320)+65536}else r&&-1<(t-=3)&&o.push(239,191,189);if(r=null,128>s){if(0>(t-=1))break;o.push(s)}else if(2048>s){if(0>(t-=2))break;o.push(192|s>>6,128|63&s)}else if(65536>s){if(0>(t-=3))break;o.push(224|s>>12,128|63&s>>6,128|63&s)}else if(1114112>s){if(0>(t-=4))break;o.push(240|s>>18,128|63&s>>12,128|63&s>>6,128|63&s)}else throw new Error("Invalid code point")}return o}function W(e){for(var t=[],n=0;n(t-=2));++r)o=e.charCodeAt(r),a=o>>8,s=o%256,n.push(s),n.push(a);return n}function V(e){return X.toByteArray(q(e))}function G(e,t,n,r){for(var o=0;o=t.length||o>=e.length);++o)t[o+n]=e[o];return o}function K(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function Y(e){return e!==e}var X=t("base64-js"),$=t("ieee754");o.Buffer=d,o.SlowBuffer=function(e){return+e!=e&&(e=0),d.alloc(+e)},o.INSPECT_MAX_BYTES=50;o.kMaxLength=2147483647,d.TYPED_ARRAY_SUPPORT=function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()}catch(t){return!1}}(),d.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(d.prototype,"parent",{enumerable:!0,get:function(){return d.isBuffer(this)?this.buffer:void 0}}),Object.defineProperty(d.prototype,"offset",{enumerable:!0,get:function(){return d.isBuffer(this)?this.byteOffset:void 0}}),"undefined"!=typeof Symbol&&null!=Symbol.species&&d[Symbol.species]===d&&Object.defineProperty(d,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),d.poolSize=8192,d.from=function(e,t,n){return i(e,t,n)},d.prototype.__proto__=Uint8Array.prototype,d.__proto__=Uint8Array,d.alloc=function(e,t,n){return c(e,t,n)},d.allocUnsafe=function(e){return u(e)},d.allocUnsafeSlow=function(e){return u(e)},d.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==d.prototype},d.compare=function(e,t){if(K(e,Uint8Array)&&(e=d.from(e,e.offset,e.byteLength)),K(t,Uint8Array)&&(t=d.from(t,t.offset,t.byteLength)),!d.isBuffer(e)||!d.isBuffer(t))throw new TypeError("The \"buf1\", \"buf2\" arguments must be one of type Buffer or Uint8Array");if(e===t)return 0;for(var n=e.length,r=t.length,o=0,l=s(n,r);ot&&(e+=" ... "),""},d.prototype.compare=function(e,t,n,r,o){if(K(e,Uint8Array)&&(e=d.from(e,e.offset,e.byteLength)),!d.isBuffer(e))throw new TypeError("The \"target\" argument must be one of type Buffer or Uint8Array. Received type "+typeof e);if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===o&&(o=this.length),0>t||n>e.length||0>r||o>this.length)throw new RangeError("out of range index");if(r>=o&&t>=n)return 0;if(r>=o)return-1;if(t>=n)return 1;if(t>>>=0,n>>>=0,r>>>=0,o>>>=0,this===e)return 0;for(var a=o-r,l=n-t,c=s(a,l),u=this.slice(r,o),p=e.slice(t,n),f=0;f>>=0,isFinite(n)?(n>>>=0,void 0===r&&(r="utf8")):(r=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var o=this.length-t;if((void 0===n||n>o)&&(n=o),0n||0>t)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var i=!1;;)switch(r){case"hex":return x(this,e,t,n);case"utf8":case"utf-8":return S(this,e,t,n);case"ascii":return v(this,e,t,n);case"latin1":case"binary":return E(this,e,t,n);case"base64":return C(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return L(this,e,t,n);default:if(i)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),i=!0;}},d.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};d.prototype.slice=function(e,t){var n=this.length;e=~~e,t=void 0===t?n:~~t,0>e?(e+=n,0>e&&(e=0)):e>n&&(e=n),0>t?(t+=n,0>t&&(t=0)):t>n&&(t=n),t>>=0,t>>>=0,n||M(e,t,this.length);for(var r=this[e],o=1,a=0;++a>>=0,t>>>=0,n||M(e,t,this.length);for(var r=this[e+--t],o=1;0>>=0,t||M(e,1,this.length),this[e]},d.prototype.readUInt16LE=function(e,t){return e>>>=0,t||M(e,2,this.length),this[e]|this[e+1]<<8},d.prototype.readUInt16BE=function(e,t){return e>>>=0,t||M(e,2,this.length),this[e]<<8|this[e+1]},d.prototype.readUInt32LE=function(e,t){return e>>>=0,t||M(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},d.prototype.readUInt32BE=function(e,t){return e>>>=0,t||M(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},d.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||M(e,t,this.length);for(var o=this[e],a=1,s=0;++s=a&&(o-=n(2,8*t)),o},d.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||M(e,t,this.length);for(var o=t,a=1,s=this[e+--o];0=a&&(s-=n(2,8*t)),s},d.prototype.readInt8=function(e,t){return e>>>=0,t||M(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},d.prototype.readInt16LE=function(e,t){e>>>=0,t||M(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},d.prototype.readInt16BE=function(e,t){e>>>=0,t||M(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},d.prototype.readInt32LE=function(e,t){return e>>>=0,t||M(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},d.prototype.readInt32BE=function(e,t){return e>>>=0,t||M(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},d.prototype.readFloatLE=function(e,t){return e>>>=0,t||M(e,4,this.length),$.read(this,e,!0,23,4)},d.prototype.readFloatBE=function(e,t){return e>>>=0,t||M(e,4,this.length),$.read(this,e,!1,23,4)},d.prototype.readDoubleLE=function(e,t){return e>>>=0,t||M(e,8,this.length),$.read(this,e,!0,52,8)},d.prototype.readDoubleBE=function(e,t){return e>>>=0,t||M(e,8,this.length),$.read(this,e,!1,52,8)},d.prototype.writeUIntLE=function(e,t,r,o){if(e=+e,t>>>=0,r>>>=0,!o){var a=n(2,8*r)-1;O(this,e,t,r,a,0)}var s=1,d=0;for(this[t]=255&e;++d>>=0,r>>>=0,!o){var a=n(2,8*r)-1;O(this,e,t,r,a,0)}var s=r-1,d=1;for(this[t+s]=255&e;0<=--s&&(d*=256);)this[t+s]=255&e/d;return t+r},d.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||O(this,e,t,1,255,0),this[t]=255&e,t+1},d.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||O(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},d.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||O(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},d.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||O(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},d.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||O(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},d.prototype.writeIntLE=function(e,t,r,o){if(e=+e,t>>>=0,!o){var a=n(2,8*r-1);O(this,e,t,r,a-1,-a)}var s=0,d=1,l=0;for(this[t]=255&e;++se&&0===l&&0!==this[t+s-1]&&(l=1),this[t+s]=255&(e/d>>0)-l;return t+r},d.prototype.writeIntBE=function(e,t,r,o){if(e=+e,t>>>=0,!o){var a=n(2,8*r-1);O(this,e,t,r,a-1,-a)}var s=r-1,d=1,l=0;for(this[t+s]=255&e;0<=--s&&(d*=256);)0>e&&0===l&&0!==this[t+s+1]&&(l=1),this[t+s]=255&(e/d>>0)-l;return t+r},d.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||O(this,e,t,1,127,-128),0>e&&(e=255+e+1),this[t]=255&e,t+1},d.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||O(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},d.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||O(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},d.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||O(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},d.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||O(this,e,t,4,2147483647,-2147483648),0>e&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},d.prototype.writeFloatLE=function(e,t,n){return N(this,e,t,!0,n)},d.prototype.writeFloatBE=function(e,t,n){return N(this,e,t,!1,n)},d.prototype.writeDoubleLE=function(e,t,n){return H(this,e,t,!0,n)},d.prototype.writeDoubleBE=function(e,t,n){return H(this,e,t,!1,n)},d.prototype.copy=function(e,t,n,r){if(!d.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),0t)throw new RangeError("targetStart out of bounds");if(0>n||n>=this.length)throw new RangeError("Index out of range");if(0>r)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-to||"latin1"===r)&&(e=o)}}else"number"==typeof e&&(e&=255);if(0>t||this.length>>=0,n=n===void 0?this.length:n>>>0,e||(e=0);var a;if("number"==typeof e)for(a=t;ai)){s.warned=!0;var d=new Error("Possible EventEmitter memory leak detected. "+s.length+" \""+(t+"\" listeners added. Use emitter.setMaxListeners() to increase limit."));d.name="MaxListenersExceededWarning",d.emitter=e,d.type=t,d.count=s.length,"object"==typeof console&&console.warn&&console.warn("%s: %s",d.name,d.message)}return e}function u(){if(!this.fired)switch(this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length){case 0:return this.listener.call(this.target);case 1:return this.listener.call(this.target,arguments[0]);case 2:return this.listener.call(this.target,arguments[0],arguments[1]);case 3:return this.listener.call(this.target,arguments[0],arguments[1],arguments[2]);default:for(var e=Array(arguments.length),t=0;te||e!==e)throw new TypeError("\"defaultMaxListeners\" must be a positive number");k=e}}):n.defaultMaxListeners=k,n.prototype.setMaxListeners=function(e){if("number"!=typeof e||0>e||isNaN(e))throw new TypeError("\"n\" argument must be a positive number");return this._maxListeners=e,this},n.prototype.getMaxListeners=function(){return r(this)},n.prototype.emit=function(e){var t="error"===e,n,r,o,u,p,f;if(f=this._events,f)t=t&&null==f.error;else if(!t)return!1;if(t){if(1o)return this;0===o?n.shift():m(n,o),1===n.length&&(r[e]=n[0]),r.removeListener&&this.emit("removeListener",e,s||t)}return this},n.prototype.removeAllListeners=function(e){var t,n,r;if(n=this._events,!n)return this;if(!n.removeListener)return 0===arguments.length?(this._events=b(null),this._eventsCount=0):n[e]&&(0==--this._eventsCount?this._events=b(null):delete n[e]),this;if(0===arguments.length){var o=y(n),a;for(r=0;rt)throw new RangeError("\"size\" argument must not be negative");return e.allocUnsafe?e.allocUnsafe(t):new e(t)}}).call(this,e("buffer").Buffer)},{buffer:41}],45:[function(e,t){(function(n){var r=e("buffer-fill"),o=e("buffer-alloc-unsafe");t.exports=function(e,t,i){if("number"!=typeof e)throw new TypeError("\"size\" argument must be a number");if(0>e)throw new RangeError("\"size\" argument must not be negative");if(n.alloc)return n.alloc(e,t,i);var a=o(e);return 0===e?a:void 0===t?r(a,0):("string"!=typeof i&&(i=void 0),r(a,t,i))}}).call(this,e("buffer").Buffer)},{buffer:41,"buffer-alloc-unsafe":44,"buffer-fill":46}],46:[function(e,t){(function(e){function n(e){return 1===e.length&&256>e.charCodeAt(0)}function r(e,t,n,r){if(0>n||r>e.length)throw new RangeError("Out of range index");return n>>>=0,r=void 0===r?e.length:r>>>0,r>n&&e.fill(t,n,r),e}function o(e,t,n,r){if(0>n||r>e.length)throw new RangeError("Out of range index");if(r<=n)return e;n>>>=0,r=void 0===r?e.length:r>>>0;for(var o=n,i=t.length;o<=r-i;)t.copy(e,o),o+=i;return o!==r&&t.copy(e,o,0,r-o),e}var i=function(){try{if(!e.isEncoding("latin1"))return!1;var t=e.alloc?e.alloc(4):new e(4);return t.fill("ab","ucs2"),"61006200"===t.toString("hex")}catch(e){return!1}}();t.exports=function(t,a,s,d,l){if(i)return t.fill(a,s,d,l);if("number"==typeof a)return r(t,a,s,d);if("string"==typeof a){if("string"==typeof s?(l=s,s=0,d=t.length):"string"==typeof d&&(l=d,d=t.length),void 0!==l&&"string"!=typeof l)throw new TypeError("encoding must be a string");if("latin1"===l&&(l="binary"),"string"==typeof l&&!e.isEncoding(l))throw new TypeError("Unknown encoding: "+l);if(""===a)return r(t,0,s,d);if(n(a))return r(t,a.charCodeAt(0),s,d);a=new e(a,l)}return e.isBuffer(a)?o(t,a,s,d):r(t,0,s,d)}}).call(this,e("buffer").Buffer)},{buffer:41}],47:[function(e,t){(function(e){function n(e){return"ArrayBuffer"===i.call(e).slice(8,-1)}function r(t,n,r){n>>>=0;var o=t.byteLength-n;if(0>o)throw new RangeError("'offset' is out of bounds");if(void 0===r)r=o;else if(r>>>=0,r>o)throw new RangeError("'length' is out of bounds");return a?e.from(t.slice(n,n+r)):new e(new Uint8Array(t.slice(n,n+r)))}function o(t,n){if(("string"!=typeof n||""===n)&&(n="utf8"),!e.isEncoding(n))throw new TypeError("\"encoding\" must be a valid string encoding");return a?e.from(t,n):new e(t,n)}var i=Object.prototype.toString,a="function"==typeof e.alloc&&"function"==typeof e.allocUnsafe&&"function"==typeof e.from;t.exports=function(t,i,s){if("number"==typeof t)throw new TypeError("\"value\" argument must not be a number");return n(t)?r(t,i,s):"string"==typeof t?o(t,i):a?e.from(t):new e(t)}}).call(this,e("buffer").Buffer)},{buffer:41}],48:[function(e,t){t.exports={100:"Continue",101:"Switching Protocols",102:"Processing",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",207:"Multi-Status",208:"Already Reported",226:"IM Used",300:"Multiple Choices",301:"Moved Permanently",302:"Found",303:"See Other",304:"Not Modified",305:"Use Proxy",307:"Temporary Redirect",308:"Permanent Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Payload Too Large",414:"URI Too Long",415:"Unsupported Media Type",416:"Range Not Satisfiable",417:"Expectation Failed",418:"I'm a teapot",421:"Misdirected Request",422:"Unprocessable Entity",423:"Locked",424:"Failed Dependency",425:"Unordered Collection",426:"Upgrade Required",428:"Precondition Required",429:"Too Many Requests",431:"Request Header Fields Too Large",451:"Unavailable For Legal Reasons",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",508:"Loop Detected",509:"Bandwidth Limit Exceeded",510:"Not Extended",511:"Network Authentication Required"}},{}],49:[function(e,t,n){arguments[4][15][0].apply(n,arguments)},{"./_stream_readable":51,"./_stream_writable":53,"core-util-is":60,dup:15,inherits:80,"process-nextick-args":131}],50:[function(e,t,n){arguments[4][16][0].apply(n,arguments)},{"./_stream_transform":52,"core-util-is":60,dup:16,inherits:80}],51:[function(e,t,n){arguments[4][17][0].apply(n,arguments)},{"./_stream_duplex":49,"./internal/streams/BufferList":54,"./internal/streams/destroy":55,"./internal/streams/stream":56,_process:132,"core-util-is":60,dup:17,events:42,inherits:80,isarray:85,"process-nextick-args":131,"safe-buffer":168,"string_decoder/":209,util:39}],52:[function(e,t,n){arguments[4][18][0].apply(n,arguments)},{"./_stream_duplex":49,"core-util-is":60,dup:18,inherits:80}],53:[function(e,t,n){arguments[4][19][0].apply(n,arguments)},{"./_stream_duplex":49,"./internal/streams/destroy":55,"./internal/streams/stream":56,_process:132,"core-util-is":60,dup:19,inherits:80,"process-nextick-args":131,"safe-buffer":168,timers:212,"util-deprecate":223}],54:[function(e,t,n){arguments[4][20][0].apply(n,arguments)},{dup:20,"safe-buffer":168,util:39}],55:[function(e,t,n){arguments[4][21][0].apply(n,arguments)},{dup:21,"process-nextick-args":131}],56:[function(e,t,n){arguments[4][22][0].apply(n,arguments)},{dup:22,events:42}],57:[function(e,t,n){arguments[4][23][0].apply(n,arguments)},{"./lib/_stream_duplex.js":49,"./lib/_stream_passthrough.js":50,"./lib/_stream_readable.js":51,"./lib/_stream_transform.js":52,"./lib/_stream_writable.js":53,dup:23}],58:[function(e,t){const n=e("block-stream2"),r=e("readable-stream");class o extends r.Writable{constructor(e,t,r={}){if(super(r),!e||!e.put||!e.get)throw new Error("First argument must be an abstract-chunk-store compliant store");if(t=+t,!t)throw new Error("Second argument must be a chunk length");this._blockstream=new n(t,{zeroPadding:!1});let o=0;const i=t=>{this.destroyed||(e.put(o,t),o+=1)};this._blockstream.on("data",i).on("error",e=>{this.destroy(e)}),this.on("finish",()=>this._blockstream.end())}_write(e,t,n){this._blockstream.write(e,t,n)}destroy(e){this.destroyed||(this.destroyed=!0,e&&this.emit("error",e),this.emit("close"))}}t.exports=o},{"block-stream2":29,"readable-stream":57}],59:[function(e,n){n.exports=function(e,n,r){for(var o=1/0,a=0,s=n.length-1,d,l,c;a<=s&&(d=a+(s-a>>1),c=n[d]-e,0>c?a=d+1:0t=>{const n={};if(h(e))n.getStream=_(e),n.length=e.size;else if(i.isBuffer(e))n.getStream=b(e),n.length=e.length;else if(g(e))n.getStream=w(e,n),n.length=0;else{if("string"==typeof e){if("function"!=typeof L.stat)throw new Error("filesystem paths do not work in the browser");const n=1e?r(e):void(t=C(t),r(null,t,l)))}if(m(e)&&(e=Array.from(e)),Array.isArray(e)||(e=[e]),0===e.length)throw new Error("invalid input type");e.forEach(e=>{if(null==e)throw new Error(`invalid input type: ${e}`)}),e=e.map(e=>h(e)&&"string"==typeof e.path&&"function"==typeof L.stat?e.path:e),1!==e.length||"string"==typeof e[0]||e[0].name||(e[0].name=t.name);let a=null;e.forEach((t,n)=>{if("string"==typeof t)return;let r=t.fullPath||t.name;r||(r=`Unknown File ${n+1}`,t.unknownName=!0),t.path=r.split("/"),t.path[0]||t.path.shift(),2>t.path.length?a=null:0===n&&1{if("string"==typeof e)return!0;const t=e.path[e.path.length-1];return c(t)&&I.not(t)}),a&&e.forEach(e=>{const t=(i.isBuffer(e)||g(e))&&!e.path;"string"==typeof e||t||e.path.shift()}),!t.name&&a&&(t.name=a),t.name||e.some(e=>"string"==typeof e?(t.name=v.basename(e),!0):e.unknownName?void 0:(t.name=e.path[e.path.length-1],!0)),t.name||(t.name=`Unnamed Torrent ${Date.now()}`);const d=e.reduce((e,t)=>e+ +("string"==typeof t),0);let l=1===e.length;if(1===e.length&&"string"==typeof e[0]){if("function"!=typeof L.stat)throw new Error("filesystem paths do not work in the browser");B(e[0],(e,t)=>e?r(e):void(l=t,o()))}else n.nextTick(()=>{o()})}function s(e,t,n){l(e,d,(r,o)=>r?n(r):void(o=Array.isArray(o)?C(o):[o],e=v.normalize(e),t&&(e=e.slice(0,e.lastIndexOf(v.sep)+1)),e[e.length-1]!==v.sep&&(e+=v.sep),o.forEach(t=>{t.getStream=y(t.path),t.path=t.path.replace(e,"").split(v.sep)}),n(null,o)))}function d(e,t){t=R(t),L.stat(e,(n,r)=>{if(n)return t(n);const o={length:r.size,path:e};t(null,o)})}function l(e,t,n){L.stat(e,(r,o)=>r?n(r):void(o.isDirectory()?L.readdir(e,(r,o)=>r?n(r):void A(o.filter(c).filter(I.not).map(n=>r=>{l(v.join(e,n),t,r)}),n)):o.isFile()&&t(e,n)))}function c(e){return"."!==e[0]}function u(e,t,n){function r(e){c+=e.length;const t=f;U(e,e=>{l[t]=e,p-=1,d()}),p+=1,f+=1}function o(){h=!0,d()}function a(e){s(),n(e)}function s(){m.removeListener("error",a),g.removeListener("data",r),g.removeListener("end",o),g.removeListener("error",a)}function d(){h&&0==p&&(s(),n(null,i.from(l.join(""),"hex"),c))}n=R(n);const l=[];let c=0;const u=e.map(e=>e.getStream);let p=0,f=0,h=!1;const m=new T(u),g=new x(t,{zeroPadding:!1});m.on("error",a),m.pipe(g).on("data",r).on("end",o).on("error",a)}function p(e,n,i){let a=n.announceList;a||("string"==typeof n.announce?a=[[n.announce]]:Array.isArray(n.announce)&&(a=n.announce.map(e=>[e]))),a||(a=[]),r.WEBTORRENT_ANNOUNCE&&("string"==typeof r.WEBTORRENT_ANNOUNCE?a.push([[r.WEBTORRENT_ANNOUNCE]]):Array.isArray(r.WEBTORRENT_ANNOUNCE)&&(a=a.concat(r.WEBTORRENT_ANNOUNCE.map(e=>[e])))),n.announce===void 0&&n.announceList===void 0&&(a=a.concat(t.exports.announceList)),"string"==typeof n.urlList&&(n.urlList=[n.urlList]);const s={info:{name:n.name},"creation date":o((+n.creationDate||Date.now())/1e3),encoding:"UTF-8"};0!==a.length&&(s.announce=a[0][0],s["announce-list"]=a),n.comment!==void 0&&(s.comment=n.comment),n.createdBy!==void 0&&(s["created by"]=n.createdBy),n.private!==void 0&&(s.info.private=+n.private),n.sslCert!==void 0&&(s.info["ssl-cert"]=n.sslCert),n.urlList!==void 0&&(s["url-list"]=n.urlList);const d=n.pieceLength||S(e.reduce(f,0));s.info["piece length"]=d,u(e,d,(t,r,o)=>t?i(t):void(s.info.pieces=r,e.forEach(e=>{delete e.getStream}),n.singleFileTorrent?s.info.length=o:s.info.files=e,i(null,k.encode(s))))}function f(e,t){return e+t.length}function h(e){return"undefined"!=typeof Blob&&e instanceof Blob}function m(e){return"undefined"!=typeof FileList&&e instanceof FileList}function g(e){return"object"==typeof e&&null!=e&&"function"==typeof e.pipe}function _(e){return()=>new E(e)}function b(e){return()=>{const t=new P.PassThrough;return t.end(e),t}}function y(e){return()=>L.createReadStream(e)}function w(e,t){return()=>{const n=new P.Transform;return n._transform=function(e,n,r){t.length+=e.length,this.push(e),r()},e.pipe(n),n}}const k=e("bencode"),x=e("block-stream2"),S=e("piece-length"),v=e("path"),E=e("filestream/read"),C=e("flatten"),L=e("fs"),B=e("is-file"),I=e("junk"),T=e("multistream"),R=e("once"),A=e("run-parallel"),U=e("simple-sha1"),P=e("readable-stream");t.exports=function(e,t,n){"function"==typeof t&&([t,n]=[n,t]),t=t?Object.assign({},t):{},a(e,t,(e,r,o)=>e?n(e):void(t.singleFileTorrent=o,p(r,t,n)))},t.exports.parseInput=function(e,t,n){"function"==typeof t&&([t,n]=[n,t]),t=t?Object.assign({},t):{},a(e,t,n)},t.exports.announceList=[["udp://tracker.leechers-paradise.org:6969"],["udp://tracker.coppersurfer.tk:6969"],["udp://tracker.opentrackr.org:1337"],["udp://explodie.org:6969"],["udp://tracker.empire-js.us:1337"],["wss://tracker.btorrent.xyz"],["wss://tracker.openwebtorrent.com"],["wss://tracker.fastcast.nz"]]}).call(this,e("_process"),"undefined"==typeof global?"undefined"==typeof self?"undefined"==typeof window?{}:window:self:global,e("buffer").Buffer)},{_process:132,bencode:11,"block-stream2":29,buffer:41,"filestream/read":75,flatten:76,fs:40,"is-file":83,junk:86,multistream:115,once:126,path:129,"piece-length":130,"readable-stream":162,"run-parallel":166,"simple-sha1":181}],62:[function(e,t,n){(function(o){function r(e){var t=this.useColors;if(e[0]=(t?"%c":"")+this.namespace+(t?" %c":" ")+e[0]+(t?"%c ":" ")+"+"+n.humanize(this.diff),!!t){var r="color: "+this.color;e.splice(1,0,r,"color: inherit");var o=0,i=0;e[0].replace(/%[a-zA-Z%]/g,function(e){"%%"===e||(o++,"%c"===e&&(i=o))}),e.splice(i,0,r)}}function i(e){try{null==e?n.storage.removeItem("debug"):n.storage.debug=e}catch(t){}}function a(){var e;try{e=n.storage.debug}catch(t){}return!e&&"undefined"!=typeof o&&"env"in o&&(e=o.env.DEBUG),e}n=t.exports=e("./debug"),n.log=function(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)},n.formatArgs=r,n.save=i,n.load=a,n.useColors=function(){return!!("undefined"!=typeof window&&window.process&&"renderer"===window.process.type)||!("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&31<=parseInt(RegExp.$1,10)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))},n.storage="undefined"!=typeof chrome&&"undefined"!=typeof chrome.storage?chrome.storage.local:function(){try{return window.localStorage}catch(t){}}(),n.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],n.formatters.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}},n.enable(a())}).call(this,e("_process"))},{"./debug":63,_process:132}],63:[function(e,n,r){function o(e){var n=0,o;for(o in e)n=(n<<5)-n+e.charCodeAt(o),n|=0;return r.colors[t(n)%r.colors.length]}function i(e){function t(){if(t.enabled){var e=t,o=+new Date,a=o-(n||o);e.diff=a,e.prev=n,e.curr=o,n=o;for(var s=Array(arguments.length),d=0;dthis._size&&(r=this._size),n===this._size?(this.destroy(),void this.push(null)):void(t.onload=function(){e._offset=r,e.push(s(t.result))},t.onerror=function(){e.emit("error",t.error)},t.readAsArrayBuffer(this._file.slice(n,r)))},n.prototype.destroy=function(){if(this._file=null,this.reader){this.reader.onload=null,this.reader.onerror=null;try{this.reader.abort()}catch(t){}}this.reader=null}},{inherits:80,"readable-stream":74,"typedarray-to-buffer":216}],76:[function(e,t){t.exports=function(e,t){function n(e,r){return e.reduce(function(e,o){return Array.isArray(o)&&r>1,f=-7,h=o?l-1:0,g=o?-1:1,d=t[r+h],_,b;for(h+=g,_=d&(1<<-f)-1,d>>=-f,f+=c;0>=-f,f+=a;0>1,b=23===p?5.960464477539063e-8-6.617444900424222e-24:0,y=u?0:f-1,w=u?1:-1,d=0>a||0===a&&0>1/a?1:0,s,k,x;for(a=t(a),isNaN(a)||a===1/0?(k=isNaN(a)?1:0,s=g):(s=r(Math.log(a)/Math.LN2),1>a*(x=n(2,-s))&&(s--,x*=2),a+=1<=s+_?b/x:b*n(2,1-_),2<=a*x&&(s++,x/=2),s+_>=g?(k=0,s=g):1<=s+_?(k=(a*x-1)*n(2,p),s+=_):(k=a*n(2,_-1)*n(2,p),s=0));8<=p;o[l+y]=255&k,y+=w,k/=256,p-=8);for(s=s<{t&&t(n,r)})}t.exports=class{constructor(e){if(this.store=e,this.chunkLength=e.chunkLength,!this.store||!this.store.get||!this.store.put)throw new Error("First argument must be abstract-chunk-store compliant");this.mem=[]}put(e,t,n){this.mem[e]=t,this.store.put(e,t,t=>{this.mem[e]=null,n&&n(t)})}get(e,t,r){if("function"==typeof t)return this.get(e,null,t);const o=t&&t.offset||0,i=t&&t.length&&o+t.length,a=this.mem[e];return a?n(r,null,t?a.slice(o,i):a):void this.store.get(e,t,r)}close(e){this.store.close(e)}destroy(e){this.store.destroy(e)}}}).call(this,e("_process"))},{_process:132}],80:[function(e,t){t.exports="function"==typeof Object.create?function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:function(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}},{}],81:[function(e,t){t.exports=function(e){for(var t=0,n=e.length;t127)return!1;return!0}},{}],82:[function(e,t){function n(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}function r(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&n(e.slice(0,0))}t.exports=function(e){return null!=e&&(n(e)||r(e)||!!e._isBuffer)}},{}],83:[function(e,t){"use strict";function n(e){return r.existsSync(e)&&r.statSync(e).isFile()}var r=e("fs");t.exports=function(e,t){return t?void r.stat(e,function(e,n){return e?t(e):t(null,n.isFile())}):n(e)},t.exports.sync=n},{fs:40}],84:[function(e,t){function n(e){return r(e)||o(e)}function r(e){return e instanceof Int8Array||e instanceof Int16Array||e instanceof Int32Array||e instanceof Uint8Array||e instanceof Uint8ClampedArray||e instanceof Uint16Array||e instanceof Uint32Array||e instanceof Float32Array||e instanceof Float64Array}function o(e){return a[i.call(e)]}t.exports=n,n.strict=r,n.loose=o;var i=Object.prototype.toString,a={"[object Int8Array]":!0,"[object Int16Array]":!0,"[object Int32Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Uint16Array]":!0,"[object Uint32Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0}},{}],85:[function(e,t){var n={}.toString;t.exports=Array.isArray||function(e){return"[object Array]"==n.call(e)}},{}],86:[function(e,t,n){"use strict";n.regex=n.re=/^npm-debug\.log$|^\..*\.swp$|^\.DS_Store$|^\.AppleDouble$|^\.LSOverride$|^Icon\r$|^\._.*|^\.Spotlight-V100(?:$|\/)|\.Trashes|^__MACOSX$|~$|^Thumbs\.db$|^ehthumbs\.db$|^Desktop\.ini$|^@eaDir$/,n.is=e=>n.re.test(e),n.not=e=>!n.is(e)},{}],87:[function(e,t){(function(n){function r(e){const t={},r=e.split("magnet:?")[1],i=r&&0<=r.length?r.split("&"):[];i.forEach(e=>{const n=e.split("=");if(2!==n.length)return;const r=n[0];let o=n[1];if("dn"===r&&(o=decodeURIComponent(o).replace(/\+/g," ")),("tr"===r||"xs"===r||"as"===r||"ws"===r)&&(o=decodeURIComponent(o)),"kt"===r&&(o=decodeURIComponent(o).split("+")),"ix"===r&&(o=+o),!t[r])t[r]=o;else if(Array.isArray(t[r]))t[r].push(o);else{const e=t[r];t[r]=[e,o]}});let s;if(t.xt){const e=Array.isArray(t.xt)?t.xt:[t.xt];e.forEach(e=>{if(s=e.match(/^urn:btih:(.{40})/))t.infoHash=s[1].toLowerCase();else if(s=e.match(/^urn:btih:(.{32})/)){const e=o.decode(s[1]);t.infoHash=n.from(e,"binary").toString("hex")}})}return t.infoHash&&(t.infoHashBuffer=n.from(t.infoHash,"hex")),t.dn&&(t.name=t.dn),t.kt&&(t.keywords=t.kt),t.announce="string"==typeof t.tr?[t.tr]:Array.isArray(t.tr)?t.tr:[],t.urlList=[],("string"==typeof t.as||Array.isArray(t.as))&&(t.urlList=t.urlList.concat(t.as)),("string"==typeof t.ws||Array.isArray(t.ws))&&(t.urlList=t.urlList.concat(t.ws)),a(t.announce),a(t.urlList),t}t.exports=r,t.exports.decode=r,t.exports.encode=function(e){e=i(e),e.infoHashBuffer&&(e.xt=`urn:btih:${e.infoHashBuffer.toString("hex")}`),e.infoHash&&(e.xt=`urn:btih:${e.infoHash}`),e.name&&(e.dn=e.name),e.keywords&&(e.kt=e.keywords),e.announce&&(e.tr=e.announce),e.urlList&&(e.ws=e.urlList,delete e.as);let t="magnet:?";return Object.keys(e).filter(e=>2===e.length).forEach((n,r)=>{const o=Array.isArray(e[n])?e[n]:[e[n]];o.forEach((e,o)=>{(0e._bufferDuration)&&e._cb){var t=e._cb;e._cb=null,t()}};r.prototype._getBufferDuration=function(){for(var e=this,t=e._sourceBuffer.buffered,n=e._elem.currentTime,r=-1,o=0;on)break;else(0<=r||n<=s)&&(r=s)}var d=r-n;return 0>d&&(d=0),d}},{inherits:80,"readable-stream":97,"to-arraybuffer":213}],89:[function(e,t,n){arguments[4][15][0].apply(n,arguments)},{"./_stream_readable":91,"./_stream_writable":93,"core-util-is":60,dup:15,inherits:80,"process-nextick-args":131}],90:[function(e,t,n){arguments[4][16][0].apply(n,arguments)},{"./_stream_transform":92,"core-util-is":60,dup:16,inherits:80}],91:[function(e,t,n){arguments[4][17][0].apply(n,arguments)},{"./_stream_duplex":89,"./internal/streams/BufferList":94,"./internal/streams/destroy":95,"./internal/streams/stream":96,_process:132,"core-util-is":60,dup:17,events:42,inherits:80,isarray:85,"process-nextick-args":131,"safe-buffer":168,"string_decoder/":209,util:39}],92:[function(e,t,n){arguments[4][18][0].apply(n,arguments)},{"./_stream_duplex":89,"core-util-is":60,dup:18,inherits:80}],93:[function(e,t,n){arguments[4][19][0].apply(n,arguments)},{"./_stream_duplex":89,"./internal/streams/destroy":95,"./internal/streams/stream":96,_process:132,"core-util-is":60,dup:19,inherits:80,"process-nextick-args":131,"safe-buffer":168,timers:212,"util-deprecate":223}],94:[function(e,t,n){arguments[4][20][0].apply(n,arguments)},{dup:20,"safe-buffer":168,util:39}],95:[function(e,t,n){arguments[4][21][0].apply(n,arguments)},{dup:21,"process-nextick-args":131}],96:[function(e,t,n){arguments[4][22][0].apply(n,arguments)},{dup:22,events:42}],97:[function(e,t,n){arguments[4][23][0].apply(n,arguments)},{"./lib/_stream_duplex.js":89,"./lib/_stream_passthrough.js":90,"./lib/_stream_readable.js":91,"./lib/_stream_transform.js":92,"./lib/_stream_writable.js":93,dup:23}],98:[function(e,t){(function(e){function n(e,t){if(!(this instanceof n))return new n(e,t);if(t||(t={}),this.chunkLength=+e,!this.chunkLength)throw new Error("First argument must be a chunk length");this.chunks=[],this.closed=!1,this.length=+t.length||1/0,this.length!==1/0&&(this.lastChunkLength=this.length%this.chunkLength||this.chunkLength,this.lastChunkIndex=o(this.length/this.chunkLength)-1)}function r(t,n,r){e.nextTick(function(){t&&t(n,r)})}t.exports=n,n.prototype.put=function(e,t,n){if(this.closed)return r(n,new Error("Storage is closed"));var o=e===this.lastChunkIndex;return o&&t.length!==this.lastChunkLength?r(n,new Error("Last chunk length must be "+this.lastChunkLength)):o||t.length===this.chunkLength?void(this.chunks[e]=t,r(n,null)):r(n,new Error("Chunk length must be "+this.chunkLength))},n.prototype.get=function(e,t,n){if("function"==typeof t)return this.get(e,null,t);if(this.closed)return r(n,new Error("Storage is closed"));var o=this.chunks[e];if(!o){var i=new Error("Chunk not found");return i.notFound=!0,r(n,i)}if(!t)return r(n,null,o);var a=t.offset||0,s=t.length||o.length-a;r(n,null,o.slice(a,s+a))},n.prototype.close=n.prototype.destroy=function(e){return this.closed?r(e,new Error("Storage is closed")):void(this.closed=!0,this.chunks=null,r(e,null))}}).call(this,e("_process"))},{_process:132}],99:[function(e,t,n){function o(e,t,n){for(var r=t;r>3:0,l=null;return a&&(l=a.toString(16),d&&(l+="."+d)),{mimeCodec:l,buffer:k(e.slice(0))}},n.esds.encodingLength=function(e){return e.buffer.length},n.stsz={},n.stsz.encode=function(e,t,r){var o=e.entries||[];t=t?t.slice(r):w(n.stsz.encodingLength(e)),t.writeUInt32BE(0,0),t.writeUInt32BE(o.length,4);for(var a=0;as&&(i=1),t.writeUInt32BE(i,n),t.write(e.type,n+4,4,"ascii");var c=n+8;if(1===i&&(r.encode(e.length,t,c),c+=8),a.fullBoxes[o]&&(t.writeUInt32BE(e.flags||0,c),t.writeUInt8(e.version||0,c),c+=4),l[o]){var u=l[o];u.forEach(function(n){if(5===n.length){var r=e[n]||[];n=n.substr(0,4),r.forEach(function(e){d._encode(e,t,c),c+=d.encode.bytes})}else e[n]&&(d._encode(e[n],t,c),c+=d.encode.bytes)}),e.otherBoxes&&e.otherBoxes.forEach(function(e){d._encode(e,t,c),c+=d.encode.bytes})}else if(a[o]){var p=a[o].encode;p(e,t,c),c+=p.bytes}else if(e.buffer){var f=e.buffer;f.copy(t,c),c+=e.buffer.length}else throw new Error("Either `type` must be set to a known type (not'"+o+"') or `buffer` must be set");return d.encode.bytes=c-n,t},d.readHeaders=function(e,t,n){if(t=t||0,n=n||e.length,8>n-t)return 8;var o=e.readUInt32BE(t),i=e.toString("ascii",t+4,t+8),s=t+8;if(1===o){if(16>n-t)return 16;o=r.decode(e,s),s+=8}var d,l;return a.fullBoxes[i]&&(d=e.readUInt8(s),l=16777215&e.readUInt32BE(s),s+=4),{length:o,headersLen:s-t,contentLen:o-(s-t),type:i,version:d,flags:l}},d.decode=function(e,t,n){t=t||0,n=n||e.length;var r=d.readHeaders(e,t,n);if(!r||r.length>n-t)throw new Error("Data too short");return d.decodeWithoutHeaders(r,e,t+r.headersLen,t+r.length)},d.decodeWithoutHeaders=function(e,t,n,r){n=n||0,r=r||t.length;var o=e.type,s={};if(l[o]){s.otherBoxes=[];for(var c=l[o],u=n,p;8<=r-u;)if(p=d.decode(t,u,r),u+=p.length,0<=c.indexOf(p.type))s[p.type]=p;else if(0<=c.indexOf(p.type+"s")){var f=p.type+"s",h=s[f]=s[f]||[];h.push(p)}else s.otherBoxes.push(p)}else if(a[o]){var m=a[o].decode;s=m(t,n,r)}else s.buffer=i(t.slice(n,r));return s.length=e.length,s.contentLen=e.contentLen,s.type=e.type,s.version=e.version,s.flags=e.flags,s},d.encodingLength=function(e){var t=e.type,n=8;if(a.fullBoxes[t]&&(n+=4),l[t]){var r=l[t];r.forEach(function(t){if(5===t.length){var r=e[t]||[];t=t.substr(0,4),r.forEach(function(e){e.type=t,n+=d.encodingLength(e)})}else if(e[t]){var o=e[t];o.type=t,n+=d.encodingLength(o)}}),e.otherBoxes&&e.otherBoxes.forEach(function(e){n+=d.encodingLength(e)})}else if(a[t])n+=a[t].encodingLength(e);else if(e.buffer)n+=e.buffer.length;else throw new Error("Either `type` must be set to a known type (not'"+t+"') or `buffer` must be set");return n>s&&(n+=8),e.length=n,n}},{"./boxes":99,"buffer-alloc":45,"buffer-from":47,uint64be:217}],102:[function(e,t){(function(n){function r(){return this instanceof r?void(i.Writable.call(this),this.destroyed=!1,this._pending=0,this._missing=0,this._buf=null,this._str=null,this._cb=null,this._ondrain=null,this._writeBuffer=null,this._writeCb=null,this._ondrain=null,this._kick()):new r}function o(e){this._parent=e,this.destroyed=!1,i.PassThrough.call(this)}var i=e("readable-stream"),a=e("inherits"),s=e("next-event"),d=e("mp4-box-encoding"),l=e("buffer-alloc"),c=l(0);t.exports=r,a(r,i.Writable),r.prototype.destroy=function(e){this.destroyed||(this.destroyed=!0,e&&this.emit("error",e),this.emit("close"))},r.prototype._write=function(e,t,n){if(!this.destroyed){for(var r=!this._str||!this._str._writableState.needDrain;e.length&&!this.destroyed;){if(!this._missing)return this._writeBuffer=e,void(this._writeCb=n);var o=e.length{l("number"==typeof e.length,"info.files[0].length"),l(e["path.utf-8"]||e.path,"info.files[0].path")}):l("number"==typeof e.info.length,"info.length");const t={info:e.info,infoBuffer:c.encode(e.info),name:(e.info["name.utf-8"]||e.info.name).toString(),announce:[]};t.infoHash=g.sync(t.infoBuffer),t.infoHashBuffer=r.from(t.infoHash,"hex"),void 0!==e.info.private&&(t.private=!!e.info.private),e["creation date"]&&(t.created=new Date(1e3*e["creation date"])),e["created by"]&&(t.createdBy=e["created by"].toString()),r.isBuffer(e.comment)&&(t.comment=e.comment.toString()),Array.isArray(e["announce-list"])&&0{e.forEach(e=>{t.announce.push(e.toString())})}):e.announce&&t.announce.push(e.announce.toString()),r.isBuffer(e["url-list"])&&(e["url-list"]=0e.toString()),_(t.announce),_(t.urlList);const n=e.info.files||[e.info];t.files=n.map((e,r)=>{const o=[].concat(t.name,e["path.utf-8"]||e.path||[]).map(e=>e.toString());return{path:m.join.apply(null,[m.sep].concat(o)).slice(1),name:o[o.length-1],length:e.length,offset:n.slice(0,r).reduce(s,0)}}),t.length=n.reduce(s,0);const o=t.files[t.files.length-1];return t.pieceLength=e.info["piece length"],t.lastPieceLength=(o.offset+o.length)%t.pieceLength||t.pieceLength,t.pieces=d(e.info.pieces),t}function a(e){return"undefined"!=typeof Blob&&e instanceof Blob}function s(e,t){return e+t.length}function d(e){const t=[];for(let n=0;n{t(null,i)}):a(e)?u(e,(e,n)=>e?t(new Error(`Error converting Blob: ${e.message}`)):void r(n)):"function"==typeof f&&/^https?:/.test(e)?f.concat({url:e,timeout:30000,headers:{"user-agent":"WebTorrent (https://webtorrent.io)"}},(e,n,o)=>e?t(new Error(`Error downloading torrent: ${e.message}`)):void r(o)):"function"==typeof p.readFile&&"string"==typeof e?p.readFile(e,(e,n)=>e?t(new Error("Invalid torrent identifier")):void r(n)):n.nextTick(()=>{t(new Error("Invalid torrent identifier"))})},t.exports.toMagnetURI=h.encode,t.exports.toTorrentFile=function(e){const t={info:e.info};return t["announce-list"]=(e.announce||[]).map(e=>(t.announce||(t.announce=e),e=r.from(e,"utf8"),[e])),t["url-list"]=e.urlList||[],void 0!==e.private&&(t["private"]=+e.private),e.created&&(t["creation date"]=0|e.created.getTime()/1e3),e.createdBy&&(t["created by"]=e.createdBy),e.comment&&(t.comment=e.comment),c.encode(t)};(()=>{r.alloc(0)})()}).call(this,e("_process"),e("buffer").Buffer)},{_process:132,bencode:11,"blob-to-buffer":28,buffer:41,fs:40,"magnet-uri":87,path:129,"simple-get":170,"simple-sha1":181,uniq:218}],129:[function(e,t,n){(function(e){function t(e,t){for(var n=0,r=e.length-1,o;0<=r;r--)o=e[r],"."===o?e.splice(r,1):".."===o?(e.splice(r,1),n++):n&&(e.splice(r,1),n--);if(t)for(;n--;n)e.unshift("..");return e}function r(e){"string"!=typeof e&&(e+="");var t=0,n=-1,r=!0,o;for(o=e.length-1;0<=o;--o)if(!(47===e.charCodeAt(o)))-1===n&&(r=!1,n=o+1);else if(!r){t=o+1;break}return-1===n?"":e.slice(t,n)}function o(e,t){if(e.filter)return e.filter(t);for(var n=[],r=0;rn?[]:e.slice(t,n-t+1)}e=n.resolve(e).substr(1),t=n.resolve(t).substr(1);for(var o=r(e.split("/")),a=r(t.split("/")),d=s(o.length,a.length),l=d,c=0;ci++;)a.push(n(2,i));t.exports=function(e){return r(e/o,a)}},{"closest-to":59}],131:[function(e,t){(function(e){"use strict";t.exports=e.version&&0!==e.version.indexOf("v0.")&&(0!==e.version.indexOf("v1.")||0===e.version.indexOf("v1.8."))?e:{nextTick:function(t,n,r,o){if("function"!=typeof t)throw new TypeError("\"callback\" argument must be a function");var a=arguments.length,s,d;switch(a){case 0:case 1:return e.nextTick(t);case 2:return e.nextTick(function(){t.call(null,n)});case 3:return e.nextTick(function(){t.call(null,n,r)});case 4:return e.nextTick(function(){t.call(null,n,r,o)});default:for(s=Array(a-1),d=0;de.length)throw new Error("pump requires two streams per minimum");var n=e.map(function(o,a){var i=a=o&&n>>10),e=56320|1023&e),t+=E(e),t}).join("")}function p(e){return 10>e-48?e-22:26>e-65?e-65:26>e-97?e-97:36}function f(e,t){return e+22+75*(26>e)-((0!=t)<<5)}function h(e,t,n){var r=0;for(e=n?v(e/700):e>>1,e+=v(e/t);455f&&(f=0),m=0;m=o&&s("invalid-input"),x=p(e.charCodeAt(g++)),(36<=x||x>v((2147483647-a)/b))&&s("overflow"),a+=x*b,S=y<=l?1:y>=l+26?26:y-l,xv(2147483647/E)&&s("overflow"),b*=E}c=r.length+1,l=h(a-_,c,0==_),v(a/c)>2147483647-d&&s("overflow"),d+=v(a/c),a%=c,r.splice(a++,0,d)}return u(r)}function g(e){var r=[],o,i,a,d,l,u,p,g,_,b,y,w,x,S,C;for(e=c(e),w=e.length,o=128,i=0,l=72,u=0;uy&&r.push(E(y));for(a=d=r.length,d&&r.push("-");a=o&&yv((2147483647-i)/x)&&s("overflow"),i+=(p-o)*x,o=p,u=0;u=l+26?26:_-l,g= 0x80 (not a basic code point)","invalid-input":"Invalid input"},v=r,E=e,C,L;if(C={version:"1.4.1",ucs2:{decode:c,encode:u},decode:m,encode:g,toASCII:function(e){return l(e,function(e){return k.test(e)?"xn--"+g(e):e})},toUnicode:function(e){return l(e,function(e){return w.test(e)?m(e.slice(4).toLowerCase()):e})}},"function"==typeof i&&"object"==typeof i.amd&&i.amd)i("punycode",function(){return C});else if(!(_&&b))a.punycode=C;else if(n.exports==_)b.exports=C;else for(L in C)C.hasOwnProperty(L)&&(_[L]=C[L])})(this)}).call(this,"undefined"==typeof global?"undefined"==typeof self?"undefined"==typeof window?{}:window:self:global)},{}],135:[function(e,t){"use strict";function n(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.exports=function(e,t,o,a){t=t||"&",o=o||"=";var s={};if("string"!=typeof e||0===e.length)return s;var d=/\+/g;e=e.split(t);var l=1e3;a&&"number"==typeof a.maxKeys&&(l=a.maxKeys);var c=e.length;0l&&(c=l);for(var u=0;u=e.length)return r._position+=e.length,n(null);var l;if(d>e.length){r._position+=e.length,l=0===s?e:e.slice(s),o=i.stream.write(l)&&o;break}r._position+=d,l=0===s&&d===e.length?e:e.slice(s,d),o=i.stream.write(l)&&o,i.last&&i.stream.end(),e=e.slice(d),r._queue.shift()}o?n(null):i.stream.once("drain",n.bind(null,null))},n.prototype.slice=function(e){var t=this;if(t.destroyed)return null;e instanceof Array||(e=[e]);var n=new o.PassThrough;return e.forEach(function(r,o){t._queue.push({start:r.start,end:r.end,stream:n,last:o===e.length-1})}),t._buffer&&t._write(t._buffer,null,t._cb),n},n.prototype.destroy=function(e){var t=this;t.destroyed||(t.destroyed=!0,e&&t.emit("error",e))}},{inherits:80,"readable-stream":149}],141:[function(e,t,n){arguments[4][15][0].apply(n,arguments)},{"./_stream_readable":143,"./_stream_writable":145,"core-util-is":60,dup:15,inherits:80,"process-nextick-args":131}],142:[function(e,t,n){arguments[4][16][0].apply(n,arguments)},{"./_stream_transform":144,"core-util-is":60,dup:16,inherits:80}],143:[function(e,t,n){arguments[4][17][0].apply(n,arguments)},{"./_stream_duplex":141,"./internal/streams/BufferList":146,"./internal/streams/destroy":147,"./internal/streams/stream":148,_process:132,"core-util-is":60,dup:17,events:42,inherits:80,isarray:85,"process-nextick-args":131,"safe-buffer":168,"string_decoder/":209,util:39}],144:[function(e,t,n){arguments[4][18][0].apply(n,arguments)},{"./_stream_duplex":141,"core-util-is":60,dup:18,inherits:80}],145:[function(e,t,n){arguments[4][19][0].apply(n,arguments)},{"./_stream_duplex":141,"./internal/streams/destroy":147,"./internal/streams/stream":148,_process:132,"core-util-is":60,dup:19,inherits:80,"process-nextick-args":131,"safe-buffer":168,timers:212,"util-deprecate":223}],146:[function(e,t,n){arguments[4][20][0].apply(n,arguments)},{dup:20,"safe-buffer":168,util:39}],147:[function(e,t,n){arguments[4][21][0].apply(n,arguments)},{dup:21,"process-nextick-args":131}],148:[function(e,t,n){arguments[4][22][0].apply(n,arguments)},{dup:22,events:42}],149:[function(e,t,n){arguments[4][23][0].apply(n,arguments)},{"./lib/_stream_duplex.js":141,"./lib/_stream_passthrough.js":142,"./lib/_stream_readable.js":143,"./lib/_stream_transform.js":144,"./lib/_stream_writable.js":145,dup:23}],150:[function(e,t){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t&&("object"==typeof t||"function"==typeof t)?t:e}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function i(e,t,i){function a(e,n,r){return"string"==typeof t?t:t(e,n,r)}i||(i=Error);var s=function(e){function t(e,o,i){return n(this,t),r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,a(e,o,i)))}return o(t,e),t}(i);s.prototype.name=i.name,s.prototype.code=e,u[e]=s}function a(e,t){if(Array.isArray(e)){var n=e.length;return e=e.map(function(e){return e+""}),2n?0:+n,t.length)===t}function d(e,t,n){return(void 0===n||n>e.length)&&(n=e.length),e.substring(n-t.length,n)===t}function l(e,t,n){return"number"!=typeof n&&(n=0),!(n+t.length>e.length)&&-1!==e.indexOf(t,n)}var c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},u={};i("ERR_INVALID_OPT_VALUE",function(e,t){return"The value \""+t+"\" is invalid for option \""+e+"\""},TypeError),i("ERR_INVALID_ARG_TYPE",function(e,t,n){var r;"string"==typeof t&&s(t,"not ")?(r="must not be",t=t.replace(/^not /,"")):r="must be";var o;if(d(e," argument"))o="The "+e+" "+r+" "+a(t,"type");else{var i=l(e,".")?"property":"argument";o="The \""+e+"\" "+i+" "+r+" "+a(t,"type")}return o+=". Received type "+("undefined"==typeof n?"undefined":c(n)),o},TypeError),i("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),i("ERR_METHOD_NOT_IMPLEMENTED",function(e){return"The "+e+" method is not implemented"}),i("ERR_STREAM_PREMATURE_CLOSE","Premature close"),i("ERR_STREAM_DESTROYED",function(e){return"Cannot call "+e+" after a stream was destroyed"}),i("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),i("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),i("ERR_STREAM_WRITE_AFTER_END","write after end"),i("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),i("ERR_UNKNOWN_ENCODING",function(e){return"Unknown encoding: "+e},TypeError),i("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),t.exports.codes=u},{}],151:[function(e,t){(function(e){"use strict";var n=new Set;t.exports.emitExperimentalWarning=function(t){if(!n.has(t)){n.add(t),e.emitWarning(t+" is an experimental feature. This feature could change at any time","ExperimentalWarning")}}}).call(this,e("_process"))},{_process:132}],152:[function(e,t){(function(n){"use strict";function r(e){return this instanceof r?void(s.call(this,e),d.call(this,e),this.allowHalfOpen=!0,e&&(!1===e.readable&&(this.readable=!1),!1===e.writable&&(this.writable=!1),!1===e.allowHalfOpen&&(this.allowHalfOpen=!1,this.once("end",o)))):new r(e)}function o(){this._writableState.ended||n.nextTick(i,this)}function i(e){e.end()}var a=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t};t.exports=r;var s=e("./_stream_readable"),d=e("./_stream_writable");e("inherits")(r,s);for(var l=a(d.prototype),c=0,u;c>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function f(e,t){return 0>=e||0===t.length&&t.ended?0:t.objectMode?1:Number.isNaN(e)?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=p(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function h(e,t){if(!t.ended){if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,t.sync?m(e):(t.needReadable=!1,!t.emittedReadable&&(t.emittedReadable=!0,g(e)))}}function m(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(O("emitReadable",t.flowing),t.emittedReadable=!0,n.nextTick(g,e))}function g(e){var t=e._readableState;O("emit readable"),!t.destroyed&&(t.length||t.ended)&&e.emit("readable"),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,v(e)}function _(e,t){t.readingMore||(t.readingMore=!0,n.nextTick(b,e,t))}function b(e,t){for(var n=t.length;!t.reading&&!t.ended&&t.length=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):n=t.buffer.consume(e,t.decoder),n}function C(e){var t=e._readableState;O("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,n.nextTick(L,t,e))}function L(e,t){O("endReadableNT",e.endEmitted,e.length),e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function B(e,t){for(var n=0,r=e.length;n=t.highWaterMark)||t.ended))return O("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?C(this):m(this),null;if(e=f(e,t),0===e&&t.ended)return 0===t.length&&C(this),null;var o=t.needReadable;O("need readable",o),(0===t.length||t.length-e>>0),n=this.head,o=0;n;)r(n.data,t,o),o+=n.data.length,n=n.next;return t},e.prototype.consume=function(e,t){var n;return ei.length?i.length:e;if(o+=a===i.length?i:i.slice(0,e),e-=a,0===e){a===i.length?(++r,this.head=t.next?t.next:this.tail=null):(this.head=t,t.data=i.slice(a));break}++r}return this.length-=r,o},e.prototype._getBuffer=function(e){var t=a.allocUnsafe(e),r=this.head,o=1;for(r.data.copy(t),e-=r.data.length;r=r.next;){var i=r.data,s=e>i.length?i.length:e;if(i.copy(t,t.length-e,0,s),e-=s,0===e){s===i.length?(++o,this.head=r.next?r.next:this.tail=null):(this.head=r,r.data=i.slice(s));break}++o}return this.length-=o,t},e.prototype[d]=function(){var e=s({length:this.length});return this.constructor.name+" "+e},e}()},{buffer:41,util:39}],159:[function(e,t){(function(e){"use strict";function n(e,t){o(e,t),r(e)}function r(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function o(e,t){e.emit("error",t)}t.exports={destroy:function(t,i){var a=this,s=this._readableState&&this._readableState.destroyed,d=this._writableState&&this._writableState.destroyed;return s||d?(i?i(t):t&&(!this._writableState||!this._writableState.errorEmitted)&&e.nextTick(o,this,t),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,function(t){!i&&t?(e.nextTick(n,a,t),a._writableState&&(a._writableState.errorEmitted=!0)):i?(e.nextTick(r,a),i(t)):e.nextTick(r,a)}),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}}}).call(this,e("_process"))},{_process:132}],160:[function(e,t){"use strict";function n(e,t,n){return null==e.highWaterMark?t?e[n]:null:e.highWaterMark}var o=e("../../../errors").codes.ERR_INVALID_OPT_VALUE;t.exports={getHighWaterMark:function(e,t,i,a){var s=n(t,a,i);if(null!=s){if(!Number.isInteger(s)||0>s){var d=a?i:"highWaterMark";throw new o(d,s)}return r(s)}return e.objectMode?16:16384}}},{"../../../errors":150}],161:[function(e,t,n){arguments[4][22][0].apply(n,arguments)},{dup:22,events:42}],162:[function(e,t,n){arguments[4][23][0].apply(n,arguments)},{"./lib/_stream_duplex.js":152,"./lib/_stream_passthrough.js":153,"./lib/_stream_readable.js":154,"./lib/_stream_transform.js":155,"./lib/_stream_writable.js":156,dup:23}],163:[function(e,t,n){function r(e,t,n,r){function i(){v.removeEventListener("loadstart",i),n.autoplay&&v.play()}function s(){v.removeEventListener("canplay",s),r(null,v)}function p(){o(e,function(e,n){return e?k(e):void(".pdf"===x?(v=t("object"),v.setAttribute("typemustmatch",!0),v.setAttribute("type","application/pdf"),v.setAttribute("data",n)):(v=t("iframe"),v.sandbox="allow-forms allow-scripts",v.src=n),r(null,v))})}function k(t){t.message="Error rendering file \""+e.name+"\": "+t.message,d(t.message),r(t)}var x=u.extname(e.name).toLowerCase(),S=0,v;0<=g.indexOf(x)?function(){function r(){d("Use `videostream` package for "+e.name),_(),v.addEventListener("error",p),v.addEventListener("loadstart",i),v.addEventListener("canplay",s),f(e,v)}function l(){d("Use MediaSource API for "+e.name),_(),v.addEventListener("error",g),v.addEventListener("loadstart",i),v.addEventListener("canplay",s);var t=new c(v),n=t.createWriteStream(a(e.name));e.createReadStream().pipe(n),S&&(v.currentTime=S)}function u(){d("Use Blob URL for "+e.name),_(),v.addEventListener("error",k),v.addEventListener("loadstart",i),v.addEventListener("canplay",s),o(e,function(e,t){return e?k(e):void(v.src=t,S&&(v.currentTime=S))})}function p(e){d("videostream error: fallback to MediaSource API: %o",e.message||e),v.removeEventListener("error",p),v.removeEventListener("canplay",s),l()}function g(t){return d("MediaSource API error: fallback to Blob URL: %o",t.message||t),"number"==typeof e.length&&e.length>n.maxBlobLength?(d("File length too large for Blob URL approach: %d (max: %d)",e.length,n.maxBlobLength),k(new Error("File length too large for Blob URL approach: "+e.length+" (max: "+n.maxBlobLength+")"))):void(v.removeEventListener("error",g),v.removeEventListener("canplay",s),u())}function _(){v||(v=t(b),v.addEventListener("progress",function(){S=v.currentTime}))}var b=0<=m.indexOf(x)?"video":"audio";w?0<=h.indexOf(x)?r():l():u()}():0<=_.indexOf(x)?function(){v=t("audio"),o(e,function(e,t){return e?k(e):void(v.addEventListener("error",k),v.addEventListener("loadstart",i),v.addEventListener("canplay",s),v.src=t)})}():0<=b.indexOf(x)?function(){v=t("img"),o(e,function(t,n){return t?k(t):void(v.src=n,v.alt=e.name,r(null,v))})}():0<=y.indexOf(x)?p():function(){function t(){l(n)?(d("File extension \"%s\" appears ascii, so will render.",x),p()):(d("File extension \"%s\" appears non-ascii, will not render.",x),r(new Error("Unsupported file type \""+x+"\": Cannot append to DOM")))}d("Unknown file extension \"%s\" - will attempt to render into iframe",x);var n="";e.createReadStream({start:0,end:1e3}).setEncoding("utf8").on("data",function(e){n+=e}).on("end",t).on("error",r)}()}function o(e,t){var r=u.extname(e.name).toLowerCase();p(e.createReadStream(),n.mime[r],t)}function i(e){if(null==e)throw new Error("file cannot be null or undefined");if("string"!=typeof e.name)throw new Error("missing or invalid file.name property");if("function"!=typeof e.createReadStream)throw new Error("missing or invalid file.createReadStream property")}function a(e){var t=u.extname(e).toLowerCase();return{".m4a":"audio/mp4; codecs=\"mp4a.40.5\"",".m4v":"video/mp4; codecs=\"avc1.640029, mp4a.40.5\"",".mkv":"video/webm; codecs=\"avc1.640029, mp4a.40.5\"",".mp3":"audio/mpeg",".mp4":"video/mp4; codecs=\"avc1.640029, mp4a.40.5\"",".webm":"video/webm; codecs=\"vorbis, vp8\""}[t]}function s(e){null==e.autoplay&&(e.autoplay=!1),null==e.muted&&(e.muted=!1),null==e.controls&&(e.controls=!0),null==e.maxBlobLength&&(e.maxBlobLength=200000000)}n.render=function(e,t,n,o){"function"==typeof n&&(o=n,n={}),n||(n={}),o||(o=function(){}),i(e),s(n),"string"==typeof t&&(t=document.querySelector(t)),r(e,function(n){if(t.nodeName!==n.toUpperCase()){var r=u.extname(e.name).toLowerCase();throw new Error("Cannot render \""+r+"\" inside a \""+t.nodeName.toLowerCase()+"\" element, expected \""+n+"\"")}return t},n,o)},n.append=function(e,t,n,o){function a(e){var r=d(e);return n.autoplay&&(r.autoplay=!0),n.muted&&(r.muted=!0),n.controls&&(r.controls=!0),t.appendChild(r),r}function d(e){var n=document.createElement(e);return t.appendChild(n),n}function l(e,t){e&&t&&t.remove(),o(e,t)}if("function"==typeof n&&(o=n,n={}),n||(n={}),o||(o=function(){}),i(e),s(n),"string"==typeof t&&(t=document.querySelector(t)),t&&("VIDEO"===t.nodeName||"AUDIO"===t.nodeName))throw new Error("Invalid video/audio node argument. Argument must be root element that video/audio tag will be appended to.");r(e,function(e){return"video"===e||"audio"===e?a(e):d(e)},n,l)},n.mime=e("./lib/mime.json");var d=e("debug")("render-media"),l=e("is-ascii"),c=e("mediasource"),u=e("path"),p=e("stream-to-blob-url"),f=e("videostream"),h=[".m4a",".m4v",".mp4"],m=[".m4v",".mkv",".mp4",".webm"],g=[].concat(m,[".m4a",".mp3"]),_=[".aac",".oga",".ogg",".wav",".flac"],b=[".bmp",".gif",".jpeg",".jpg",".png",".svg"],y=[".css",".html",".js",".md",".pdf",".txt"],w="undefined"!=typeof window&&window.MediaSource},{"./lib/mime.json":164,debug:62,"is-ascii":81,mediasource:88,path:129,"stream-to-blob-url":206,videostream:225}],164:[function(e,t){t.exports={".3gp":"video/3gpp",".aac":"audio/aac",".aif":"audio/x-aiff",".aiff":"audio/x-aiff",".atom":"application/atom+xml",".avi":"video/x-msvideo",".bmp":"image/bmp",".bz2":"application/x-bzip2",".conf":"text/plain",".css":"text/css",".csv":"text/plain",".diff":"text/x-diff",".doc":"application/msword",".flv":"video/x-flv",".gif":"image/gif",".gz":"application/x-gzip",".htm":"text/html",".html":"text/html",".ico":"image/vnd.microsoft.icon",".ics":"text/calendar",".iso":"application/octet-stream",".jar":"application/java-archive",".jpeg":"image/jpeg",".jpg":"image/jpeg",".js":"application/javascript",".json":"application/json",".less":"text/css",".log":"text/plain",".m3u":"audio/x-mpegurl",".m4a":"audio/mp4",".m4v":"video/mp4",".manifest":"text/cache-manifest",".markdown":"text/x-markdown",".mathml":"application/mathml+xml",".md":"text/x-markdown",".mid":"audio/midi",".midi":"audio/midi",".mov":"video/quicktime",".mp3":"audio/mpeg",".mp4":"video/mp4",".mp4v":"video/mp4",".mpeg":"video/mpeg",".mpg":"video/mpeg",".odp":"application/vnd.oasis.opendocument.presentation",".ods":"application/vnd.oasis.opendocument.spreadsheet",".odt":"application/vnd.oasis.opendocument.text",".oga":"audio/ogg",".ogg":"application/ogg",".pdf":"application/pdf",".png":"image/png",".pps":"application/vnd.ms-powerpoint",".ppt":"application/vnd.ms-powerpoint",".ps":"application/postscript",".psd":"image/vnd.adobe.photoshop",".qt":"video/quicktime",".rar":"application/x-rar-compressed",".rdf":"application/rdf+xml",".rss":"application/rss+xml",".rtf":"application/rtf",".svg":"image/svg+xml",".svgz":"image/svg+xml",".swf":"application/x-shockwave-flash",".tar":"application/x-tar",".tbz":"application/x-bzip-compressed-tar",".text":"text/plain",".tif":"image/tiff",".tiff":"image/tiff",".torrent":"application/x-bittorrent",".ttf":"application/x-font-ttf",".txt":"text/plain",".wav":"audio/wav",".webm":"video/webm",".wma":"audio/x-ms-wma",".wmv":"video/x-ms-wmv",".xls":"application/vnd.ms-excel",".xml":"application/xml",".yaml":"text/yaml",".yml":"text/yaml",".zip":"application/zip"}},{}],165:[function(e,t){(function(e){t.exports=function(t,n,r){function o(t){function n(){r&&r(t,s),r=null}i?e.nextTick(n):n()}function a(e,n,r){if(s[e]=r,n&&(u=!0),0==--l||n)o(n);else if(!u&&p>2)+1;a>2]|=128<<24-(t%4<<3),e[(-16&(t>>2)+2)+14]=0|n/536870912,e[(-16&(t>>2)+2)+15]=n<<3},f=function(e,t){var n=new Int32Array(e,t+320,5),r=new Int32Array(5),o=new DataView(r.buffer);return o.setInt32(0,n[0],!1),o.setInt32(4,n[1],!1),o.setInt32(8,n[2],!1),o.setInt32(12,n[3],!1),o.setInt32(16,n[4],!1),r},h=function(){function e(t){if(r(this,e),t=t||65536,0>2);return u(r,e),p(r,e,t),n},e.prototype._write=function(e,t,n,r){l(e,this._h8,this._h32,t,n,r||0)},e.prototype._coreCall=function(e,t,n,r,o){var i=n;this._write(e,t,n),o&&(i=this._padChunk(n,r)),this._core.hash(i,this._padMaxChunkLen)},e.prototype.rawDigest=function(e){var t=e.byteLength||e.length||e.size||0;this._initState(this._heap,this._padMaxChunkLen);var n=0,r=this._maxChunkLen;for(n=0;t>n+r;n+=r)this._coreCall(e,n,r,t,!1);return this._coreCall(e,n,t-n,t,!0),f(this._heap,this._padMaxChunkLen)},e.prototype.digest=function(e){return a(this.rawDigest(e).buffer)},e.prototype.digestFromString=function(e){return this.digest(e)},e.prototype.digestFromBuffer=function(e){return this.digest(e)},e.prototype.digestFromArrayBuffer=function(e){return this.digest(e)},e.prototype.resetState=function(){return this._initState(this._heap,this._padMaxChunkLen),this},e.prototype.append=function(e){var t=0,n=e.byteLength||e.length||e.size||0,r=this._offset%this._maxChunkLen,o=void 0;for(this._offset+=n;tn;n++)t[n]=(16>n?"0":"")+n.toString(16);e.exports.toHex=function(e){for(var n=new Uint8Array(e),r=Array(e.byteLength),o=0;o=e)return 65536;if(16777216>e)for(t=1;t>2],s=0|r[t+324>>2],l=0|r[t+328>>2],u=0|r[t+332>>2],f=0|r[t+336>>2],n=0;(0|n)<(0|e);n=0|n+64){for(a=i,d=s,c=l,p=u,h=f,o=0;64>(0|o);o=0|o+4)g=0|r[n+o>>2],m=0|(0|(i<<5|i>>>27)+(s&l|~s&u))+(0|(0|g+f)+1518500249),f=u,u=l,l=s<<30|s>>>2,s=i,i=m,r[e+o>>2]=g;for(o=0|e+64;(0|o)<(0|e+80);o=0|o+4)g=(r[o-12>>2]^r[o-32>>2]^r[o-56>>2]^r[o-64>>2])<<1|(r[o-12>>2]^r[o-32>>2]^r[o-56>>2]^r[o-64>>2])>>>31,m=0|(0|(i<<5|i>>>27)+(s&l|~s&u))+(0|(0|g+f)+1518500249),f=u,u=l,l=s<<30|s>>>2,s=i,i=m,r[o>>2]=g;for(o=0|e+80;(0|o)<(0|e+160);o=0|o+4)g=(r[o-12>>2]^r[o-32>>2]^r[o-56>>2]^r[o-64>>2])<<1|(r[o-12>>2]^r[o-32>>2]^r[o-56>>2]^r[o-64>>2])>>>31,m=0|(0|(i<<5|i>>>27)+(s^l^u))+(0|(0|g+f)+1859775393),f=u,u=l,l=s<<30|s>>>2,s=i,i=m,r[o>>2]=g;for(o=0|e+160;(0|o)<(0|e+240);o=0|o+4)g=(r[o-12>>2]^r[o-32>>2]^r[o-56>>2]^r[o-64>>2])<<1|(r[o-12>>2]^r[o-32>>2]^r[o-56>>2]^r[o-64>>2])>>>31,m=0|(0|(i<<5|i>>>27)+(s&l|s&u|l&u))+(0|(0|g+f)-1894007588),f=u,u=l,l=s<<30|s>>>2,s=i,i=m,r[o>>2]=g;for(o=0|e+240;(0|o)<(0|e+320);o=0|o+4)g=(r[o-12>>2]^r[o-32>>2]^r[o-56>>2]^r[o-64>>2])<<1|(r[o-12>>2]^r[o-32>>2]^r[o-56>>2]^r[o-64>>2])>>>31,m=0|(0|(i<<5|i>>>27)+(s^l^u))+(0|(0|g+f)-899497514),f=u,u=l,l=s<<30|s>>>2,s=i,i=m,r[o>>2]=g;i=0|i+a,s=0|s+d,l=0|l+c,u=0|u+p,f=0|f+h}r[t+320>>2]=i,r[t+324>>2]=s,r[t+328>>2]=l,r[t+332>>2]=u,r[t+336>>2]=f}}}},function(e){var t=this,n=void 0;"undefined"!=typeof self&&"undefined"!=typeof self.FileReaderSync&&(n=new self.FileReaderSync);var r=function(e,t,n,r,o,a){var s=a%4,d=(o+s)%4,l=o-d,c;switch(s){case 0:t[a]=e.charCodeAt(r+3);case 1:t[0|a+1-(s<<1)]=e.charCodeAt(r+2);case 2:t[0|a+2-(s<<1)]=e.charCodeAt(r+1);case 3:t[0|a+3-(s<<1)]=e.charCodeAt(r);}if(!(o>2]=e.charCodeAt(r+c)<<24|e.charCodeAt(r+c+1)<<16|e.charCodeAt(r+c+2)<<8|e.charCodeAt(r+c+3);switch(d){case 3:t[0|a+l+1]=e.charCodeAt(r+l+2);case 2:t[0|a+l+2]=e.charCodeAt(r+l+1);case 1:t[0|a+l+3]=e.charCodeAt(r+l);}}},o=function(e,t,n,r,o,a){var s=a%4,d=(o+s)%4,l=o-d,c;switch(s){case 0:t[a]=e[r+3];case 1:t[0|a+1-(s<<1)]=e[r+2];case 2:t[0|a+2-(s<<1)]=e[r+1];case 3:t[0|a+3-(s<<1)]=e[r];}if(!(o>2]=e[r+c]<<24|e[r+c+1]<<16|e[r+c+2]<<8|e[r+c+3];switch(d){case 3:t[0|a+l+1]=e[r+l+2];case 2:t[0|a+l+2]=e[r+l+1];case 1:t[0|a+l+3]=e[r+l];}}},i=function(e,t,r,o,a,s){var d=void 0,l=s%4,c=(a+l)%4,u=a-c,p=new Uint8Array(n.readAsArrayBuffer(e.slice(o,o+a)));switch(l){case 0:t[s]=p[3];case 1:t[0|s+1-(l<<1)]=p[2];case 2:t[0|s+2-(l<<1)]=p[1];case 3:t[0|s+3-(l<<1)]=p[0];}if(!(a>2]=p[d]<<24|p[d+1]<<16|p[d+2]<<8|p[d+3];switch(c){case 3:t[0|s+u+1]=p[u+2];case 2:t[0|s+u+2]=p[u+1];case 1:t[0|s+u+3]=p[u];}}};e.exports=function(e,n,a,s,d,l){if("string"==typeof e)return r(e,n,a,s,d,l);if(e instanceof Array)return o(e,n,a,s,d,l);if(t&&t.Buffer&&t.Buffer.isBuffer(e))return o(e,n,a,s,d,l);if(e instanceof ArrayBuffer)return o(new Uint8Array(e),n,a,s,d,l);if(e.buffer instanceof ArrayBuffer)return o(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),n,a,s,d,l);if(e instanceof Blob)return i(e,n,a,s,d,l);throw new Error("Unsupported data type.")}},function(e,t,n){function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var o=n(0),i=n(1),a=i.toHex,s=function(){function e(){r(this,e),this._rusha=new o,this._rusha.resetState()}return e.prototype.update=function(e){return this._rusha.append(e),this},e.prototype.digest=function e(t){var e=this._rusha.rawEnd().buffer;if(!t)return e;if("hex"===t)return a(e);throw new Error("unsupported digest encoding")},e}();e.exports=function(){return new s}}])})},{}],168:[function(e,t,n){function r(e,t){for(var n in e)t[n]=e[n]}function o(e,t,n){return a(e,t,n)}var i=e("buffer"),a=i.Buffer;a.from&&a.alloc&&a.allocUnsafe&&a.allocUnsafeSlow?t.exports=i:(r(i,n),n.Buffer=o),r(a,o),o.from=function(e,t,n){if("number"==typeof e)throw new TypeError("Argument must not be a number");return a(e,t,n)},o.alloc=function(e,t,n){if("number"!=typeof e)throw new TypeError("Argument must be a number");var r=a(e);return void 0===t?r.fill(0):"string"==typeof n?r.fill(t,n):r.fill(t),r},o.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return a(e)},o.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return i.SlowBuffer(e)}},{buffer:41}],169:[function(e,t){(function(e){t.exports=function(t,n){var r=[];t.on("data",function(e){r.push(e)}),t.once("end",function(){n&&n(null,e.concat(r)),n=null}),t.once("error",function(e){n&&n(e),n=null})}}).call(this,e("buffer").Buffer)},{buffer:41}],170:[function(e,t){(function(n){function r(e,t){if(e=Object.assign({maxRedirects:10},"string"==typeof e?{url:e}:e),t=d(t),e.url){const{hostname:t,port:n,protocol:r,auth:o,path:i}=c.parse(e.url);delete e.url,t||n||r||o?Object.assign(e,{hostname:t,port:n,protocol:r,auth:o,path:i}):e.path=i}const o={"accept-encoding":"gzip, deflate"};e.headers&&Object.keys(e.headers).forEach(t=>o[t.toLowerCase()]=e.headers[t]),e.headers=o;let p;e.body?p=e.json&&!u(e.body)?JSON.stringify(e.body):e.body:e.form&&(p="string"==typeof e.form?e.form:l.stringify(e.form),e.headers["content-type"]="application/x-www-form-urlencoded"),p&&(!e.method&&(e.method="POST"),!u(p)&&(e.headers["content-length"]=n.byteLength(p)),e.json&&!e.form&&(e.headers["content-type"]="application/json")),delete e.body,delete e.form,e.json&&(e.headers.accept="application/json"),e.method&&(e.method=e.method.toUpperCase());const f="https:"===e.protocol?s:a,h=f.request(e,n=>{if(300<=n.statusCode&&400>n.statusCode&&n.headers.location)return e.url=n.headers.location,delete e.headers.host,n.resume(),"POST"===e.method&&[301,302].includes(n.statusCode)&&(e.method="GET",delete e.headers["content-length"],delete e.headers["content-type"]),0==e.maxRedirects--?t(new Error("too many redirects")):r(e,t);const o="function"==typeof i&&"HEAD"!==e.method;t(null,o?i(n):n)});return h.on("timeout",()=>{h.abort(),t(new Error("Request timed out"))}),h.on("error",t),u(p)?p.on("error",t).pipe(h):h.end(p),h}t.exports=r;const o=e("simple-concat"),i=e("decompress-response"),a=e("http"),s=e("https"),d=e("once"),l=e("querystring"),c=e("url"),u=e=>null!==e&&"object"==typeof e&&"function"==typeof e.pipe;r.concat=(e,t)=>r(e,(n,r)=>n?t(n):void o(r,(n,o)=>{if(n)return t(n);if(e.json)try{o=JSON.parse(o.toString())}catch(e){return t(e,r,o)}t(null,r,o)})),["get","post","put","patch","head","delete"].forEach(e=>{r[e]=(t,n)=>("string"==typeof t&&(t={url:t}),r(Object.assign({method:e.toUpperCase()},t),n))})}).call(this,e("buffer").Buffer)},{buffer:41,"decompress-response":39,http:193,https:43,once:126,querystring:137,"simple-concat":169,url:220}],171:[function(e,t){(function(n){function r(e){var t=this;if(!(t instanceof r))return new r(e);if(t._id=l(4).toString("hex").slice(0,7),t._debug("new peer %o",e),e=Object.assign({allowHalfOpen:!1},e),c.Duplex.call(t,e),t.channelName=e.initiator?e.channelName||l(20).toString("hex"):null,t._isChromium="undefined"!=typeof window&&!!window.webkitRTCPeerConnection,t.initiator=e.initiator||!1,t.channelConfig=e.channelConfig||r.channelConfig,t.config=e.config||r.config,t.constraints=t._transformConstraints(e.constraints||r.constraints),t.offerConstraints=t._transformConstraints(e.offerConstraints||{}),t.answerConstraints=t._transformConstraints(e.answerConstraints||{}),t.sdpTransform=e.sdpTransform||function(e){return e},t.streams=e.streams||(e.stream?[e.stream]:[]),t.trickle=void 0===e.trickle||e.trickle,t.destroyed=!1,t.connected=!1,t.remoteAddress=void 0,t.remoteFamily=void 0,t.remotePort=void 0,t.localAddress=void 0,t.localPort=void 0,t._wrtc=e.wrtc&&"object"==typeof e.wrtc?e.wrtc:s(),!t._wrtc)if("undefined"==typeof window)throw o("No WebRTC support: Specify `opts.wrtc` option in this environment","ERR_WEBRTC_SUPPORT");else throw o("No WebRTC support: Not a supported browser","ERR_WEBRTC_SUPPORT");t._pcReady=!1,t._channelReady=!1,t._iceComplete=!1,t._channel=null,t._pendingCandidates=[],t._isNegotiating=!1,t._batchedNegotiation=!1,t._queuedNegotiation=!1,t._sendersAwaitingStable=[],t._senderMap=new WeakMap,t._remoteTracks=[],t._remoteStreams=[],t._chunk=null,t._cb=null,t._interval=null,t._pc=new t._wrtc.RTCPeerConnection(t.config,t.constraints),t._isReactNativeWebrtc="number"==typeof t._pc._peerConnectionId,t._pc.oniceconnectionstatechange=function(){t._onIceStateChange()},t._pc.onicegatheringstatechange=function(){t._onIceStateChange()},t._pc.onsignalingstatechange=function(){t._onSignalingStateChange()},t._pc.onicecandidate=function(e){t._onIceCandidate(e)},t.initiator?t._setupData({channel:t._pc.createDataChannel(t.channelName,t.channelConfig)}):t._pc.ondatachannel=function(e){t._setupData(e)},"addTrack"in t._pc&&(t.streams&&t.streams.forEach(function(e){t.addStream(e)}),t._pc.ontrack=function(e){t._onTrack(e)}),t.initiator&&t._needsNegotiation(),t._onFinishBound=function(){t._onFinish()},t.once("finish",t._onFinishBound)}function o(e,t){var n=new Error(e);return n.code=t,n}function i(){}t.exports=r;var a=e("debug")("simple-peer"),s=e("get-browser-rtc"),d=e("inherits"),l=e("randombytes"),c=e("readable-stream"),u=65536;d(r,c.Duplex),r.WEBRTC_SUPPORT=!!s(),r.config={iceServers:[{urls:"stun:stun.l.google.com:19302"},{urls:"stun:global.stun.twilio.com:3478?transport=udp"}]},r.constraints={},r.channelConfig={},Object.defineProperty(r.prototype,"bufferSize",{get:function(){var e=this;return e._channel&&e._channel.bufferedAmount||0}}),r.prototype.address=function(){var e=this;return{port:e.localPort,family:"IPv4",address:e.localAddress}},r.prototype.signal=function(e){var t=this;if(t.destroyed)throw o("cannot signal after peer is destroyed","ERR_SIGNALING");if("string"==typeof e)try{e=JSON.parse(e)}catch(t){e={}}t._debug("signal()"),e.renegotiate&&(t._debug("got request to renegotiate"),t._needsNegotiation()),e.candidate&&(t._pc.remoteDescription&&t._pc.remoteDescription.type?t._addIceCandidate(e.candidate):t._pendingCandidates.push(e.candidate)),e.sdp&&t._pc.setRemoteDescription(new t._wrtc.RTCSessionDescription(e),function(){t.destroyed||(t._pendingCandidates.forEach(function(e){t._addIceCandidate(e)}),t._pendingCandidates=[],"offer"===t._pc.remoteDescription.type&&t._createAnswer())},function(e){t.destroy(o(e,"ERR_SET_REMOTE_DESCRIPTION"))}),e.sdp||e.candidate||e.renegotiate||t.destroy(o("signal() called with invalid signal data","ERR_SIGNALING"))},r.prototype._addIceCandidate=function(e){var t=this;try{t._pc.addIceCandidate(new t._wrtc.RTCIceCandidate(e),i,function(e){t.destroy(o(e,"ERR_ADD_ICE_CANDIDATE"))})}catch(e){t.destroy(o("error adding candidate: "+e.message,"ERR_ADD_ICE_CANDIDATE"))}},r.prototype.send=function(e){var t=this;t._channel.send(e)},r.prototype.addStream=function(e){var t=this;t._debug("addStream()"),e.getTracks().forEach(function(n){t.addTrack(n,e)})},r.prototype.addTrack=function(e,t){var n=this;n._debug("addTrack()");var r=n._pc.addTrack(e,t),o=n._senderMap.get(e)||new WeakMap;o.set(t,r),n._senderMap.set(e,o),n._needsNegotiation()},r.prototype.removeTrack=function(e,t){var n=this;n._debug("removeSender()");var r=n._senderMap.get(e),o=r?r.get(t):null;o||n.destroy(new Error("Cannot remove track that was never added."));try{n._pc.removeTrack(o)}catch(e){"NS_ERROR_UNEXPECTED"===e.name?n._sendersAwaitingStable.push(o):n.destroy(e)}},r.prototype.removeStream=function(e){var t=this;t._debug("removeSenders()"),e.getTracks().forEach(function(n){t.removeTrack(n,e)})},r.prototype._needsNegotiation=function(){var e=this;e._debug("_needsNegotiation");e._batchedNegotiation||(e._batchedNegotiation=!0,setTimeout(function(){e._batchedNegotiation=!1,e._debug("starting batched negotiation"),e.negotiate()},0))},r.prototype.negotiate=function(){var e=this;e.initiator?e._isNegotiating?(e._queuedNegotiation=!0,e._debug("already negotiating, queueing")):(e._debug("start negotiation"),e._createOffer()):(e._debug("requesting negotiation from initiator"),e.emit("signal",{renegotiate:!0})),e._isNegotiating=!0},r.prototype.destroy=function(e){var t=this;t._destroy(e,function(){})},r.prototype._destroy=function(e,t){var n=this;if(!n.destroyed){if(n._debug("destroy (error: %s)",e&&(e.message||e)),n.readable=n.writable=!1,n._readableState.ended||n.push(null),n._writableState.finished||n.end(),n.destroyed=!0,n.connected=!1,n._pcReady=!1,n._channelReady=!1,n._remoteTracks=null,n._remoteStreams=null,n._senderMap=null,clearInterval(n._interval),n._interval=null,n._chunk=null,n._cb=null,n._onFinishBound&&n.removeListener("finish",n._onFinishBound),n._onFinishBound=null,n._channel){try{n._channel.close()}catch(e){}n._channel.onmessage=null,n._channel.onopen=null,n._channel.onclose=null,n._channel.onerror=null}if(n._pc){try{n._pc.close()}catch(e){}n._pc.oniceconnectionstatechange=null,n._pc.onicegatheringstatechange=null,n._pc.onsignalingstatechange=null,n._pc.onicecandidate=null,"addTrack"in n._pc&&(n._pc.ontrack=null),n._pc.ondatachannel=null}n._pc=null,n._channel=null,e&&n.emit("error",e),n.emit("close"),t()}},r.prototype._setupData=function(e){var t=this;return e.channel?void(t._channel=e.channel,t._channel.binaryType="arraybuffer","number"==typeof t._channel.bufferedAmountLowThreshold&&(t._channel.bufferedAmountLowThreshold=u),t.channelName=t._channel.label,t._channel.onmessage=function(e){t._onChannelMessage(e)},t._channel.onbufferedamountlow=function(){t._onChannelBufferedAmountLow()},t._channel.onopen=function(){t._onChannelOpen()},t._channel.onclose=function(){t._onChannelClose()},t._channel.onerror=function(e){t.destroy(o(e,"ERR_DATA_CHANNEL"))}):t.destroy(o("Data channel event is missing `channel` property","ERR_DATA_CHANNEL"))},r.prototype._read=function(){},r.prototype._write=function(e,t,n){var r=this;if(r.destroyed)return n(o("cannot write after peer is destroyed","ERR_DATA_CHANNEL"));if(r.connected){try{r.send(e)}catch(e){return r.destroy(o(e,"ERR_DATA_CHANNEL"))}r._channel.bufferedAmount>u?(r._debug("start backpressure: bufferedAmount %d",r._channel.bufferedAmount),r._cb=n):n(null)}else r._debug("write before connect"),r._chunk=e,r._cb=n},r.prototype._onFinish=function(){function e(){setTimeout(function(){t.destroy()},1e3)}var t=this;t.destroyed||(t.connected?e():t.once("connect",e))},r.prototype._createOffer=function(){var e=this;e.destroyed||e._pc.createOffer(function(t){function n(){var n=e._pc.localDescription||t;e._debug("signal"),e.emit("signal",{type:n.type,sdp:n.sdp})}e.destroyed||(t.sdp=e.sdpTransform(t.sdp),e._pc.setLocalDescription(t,function(){e._debug("createOffer success");e.destroyed||(e.trickle||e._iceComplete?n():e.once("_iceComplete",n))},function(t){e.destroy(o(t,"ERR_SET_LOCAL_DESCRIPTION"))}))},function(t){e.destroy(o(t,"ERR_CREATE_OFFER"))},e.offerConstraints)},r.prototype._createAnswer=function(){var e=this;e.destroyed||e._pc.createAnswer(function(t){function n(){var n=e._pc.localDescription||t;e._debug("signal"),e.emit("signal",{type:n.type,sdp:n.sdp})}e.destroyed||(t.sdp=e.sdpTransform(t.sdp),e._pc.setLocalDescription(t,function(){e.destroyed||(e.trickle||e._iceComplete?n():e.once("_iceComplete",n))},function(t){e.destroy(o(t,"ERR_SET_LOCAL_DESCRIPTION"))}))},function(t){e.destroy(o(t,"ERR_CREATE_ANSWER"))},e.answerConstraints)},r.prototype._onIceStateChange=function(){var e=this;if(!e.destroyed){var t=e._pc.iceConnectionState,n=e._pc.iceGatheringState;e._debug("iceStateChange (connection: %s) (gathering: %s)",t,n),e.emit("iceStateChange",t,n),("connected"===t||"completed"===t)&&(e._pcReady=!0,e._maybeReady()),"failed"===t&&e.destroy(o("Ice connection failed.","ERR_ICE_CONNECTION_FAILURE")),"closed"===t&&e.destroy(new Error("Ice connection closed."))}},r.prototype.getStats=function(e){var t=this;0===t._pc.getStats.length?t._pc.getStats().then(function(t){var n=[];t.forEach(function(e){n.push(e)}),e(null,n)},function(t){e(t)}):t._isReactNativeWebrtc?t._pc.getStats(null,function(t){var n=[];t.forEach(function(e){n.push(e)}),e(null,n)},function(t){e(t)}):0u)&&e._onChannelBufferedAmountLow()},r.prototype._onSignalingStateChange=function(){var e=this;e.destroyed||("stable"===e._pc.signalingState&&(e._isNegotiating=!1,e._debug("flushing sender queue",e._sendersAwaitingStable),e._sendersAwaitingStable.forEach(function(t){e.removeTrack(t),e._queuedNegotiation=!0}),e._sendersAwaitingStable=[],e._queuedNegotiation&&(e._debug("flushing negotiation queue"),e._queuedNegotiation=!1,e._needsNegotiation()),e._debug("negotiate"),e.emit("negotiate")),e._debug("signalingStateChange %s",e._pc.signalingState),e.emit("signalingStateChange",e._pc.signalingState))},r.prototype._onIceCandidate=function(e){var t=this;t.destroyed||(e.candidate&&t.trickle?t.emit("signal",{candidate:{candidate:e.candidate.candidate,sdpMLineIndex:e.candidate.sdpMLineIndex,sdpMid:e.candidate.sdpMid}}):!e.candidate&&(t._iceComplete=!0,t.emit("_iceComplete")))},r.prototype._onChannelMessage=function(e){var t=this;if(!t.destroyed){var r=e.data;r instanceof ArrayBuffer&&(r=n.from(r)),t.push(r)}},r.prototype._onChannelBufferedAmountLow=function(){var e=this;if(!e.destroyed&&e._cb){e._debug("ending backpressure: bufferedAmount %d",e._channel.bufferedAmount);var t=e._cb;e._cb=null,t(null)}},r.prototype._onChannelOpen=function(){var e=this;e.connected||e.destroyed||(e._debug("on channel open"),e._channelReady=!0,e._maybeReady())},r.prototype._onChannelClose=function(){var e=this;e.destroyed||(e._debug("on channel close"),e.destroy())},r.prototype._onTrack=function(e){var t=this;t.destroyed||e.streams.forEach(function(n){t._debug("on track"),t.emit("track",e.track,n),t._remoteTracks.push({track:e.track,stream:n});t._remoteStreams.some(function(e){return e.id===n.id})||(t._remoteStreams.push(n),setTimeout(function(){t.emit("stream",n)},0))})},r.prototype._debug=function(){var e=this,t=[].slice.call(arguments);t[0]="["+e._id+"] "+t[0],a.apply(null,t)},r.prototype._transformConstraints=function(e){var t=this;if(0===Object.keys(e).length)return e;if((e.mandatory||e.optional)&&!t._isChromium){var n=Object.assign({},e.optional,e.mandatory);return void 0!==n.OfferToReceiveVideo&&(n.offerToReceiveVideo=n.OfferToReceiveVideo,delete n.OfferToReceiveVideo),void 0!==n.OfferToReceiveAudio&&(n.offerToReceiveAudio=n.OfferToReceiveAudio,delete n.OfferToReceiveAudio),n}return e.mandatory||e.optional||!t._isChromium?e:(void 0!==e.offerToReceiveVideo&&(e.OfferToReceiveVideo=e.offerToReceiveVideo,delete e.offerToReceiveVideo),void 0!==e.offerToReceiveAudio&&(e.OfferToReceiveAudio=e.offerToReceiveAudio,delete e.offerToReceiveAudio),{mandatory:e})}}).call(this,e("buffer").Buffer)},{buffer:41,debug:62,"get-browser-rtc":77,inherits:80,randombytes:139,"readable-stream":180}],172:[function(e,t,n){arguments[4][15][0].apply(n,arguments)},{"./_stream_readable":174,"./_stream_writable":176,"core-util-is":60,dup:15,inherits:80,"process-nextick-args":131}],173:[function(e,t,n){arguments[4][16][0].apply(n,arguments)},{"./_stream_transform":175,"core-util-is":60,dup:16,inherits:80}],174:[function(e,t,n){arguments[4][17][0].apply(n,arguments)},{"./_stream_duplex":172,"./internal/streams/BufferList":177,"./internal/streams/destroy":178,"./internal/streams/stream":179,_process:132,"core-util-is":60,dup:17,events:42,inherits:80,isarray:85,"process-nextick-args":131,"safe-buffer":168,"string_decoder/":209,util:39}],175:[function(e,t,n){arguments[4][18][0].apply(n,arguments)},{"./_stream_duplex":172,"core-util-is":60,dup:18,inherits:80}],176:[function(e,t,n){arguments[4][19][0].apply(n,arguments)},{"./_stream_duplex":172,"./internal/streams/destroy":178,"./internal/streams/stream":179,_process:132,"core-util-is":60,dup:19,inherits:80,"process-nextick-args":131,"safe-buffer":168,timers:212,"util-deprecate":223}],177:[function(e,t,n){arguments[4][20][0].apply(n,arguments)},{dup:20,"safe-buffer":168,util:39}],178:[function(e,t,n){arguments[4][21][0].apply(n,arguments)},{dup:21,"process-nextick-args":131}],179:[function(e,t,n){arguments[4][22][0].apply(n,arguments)},{dup:22,events:42}],180:[function(e,t,n){arguments[4][23][0].apply(n,arguments)},{"./lib/_stream_duplex.js":172,"./lib/_stream_passthrough.js":173,"./lib/_stream_readable.js":174,"./lib/_stream_transform.js":175,"./lib/_stream_writable.js":176,dup:23}],181:[function(e,t){function n(e){return s.digest(e)}function r(e,t){return c?void("string"==typeof e&&(e=o(e)),c.digest({name:"sha-1"},e).then(function(e){t(i(new Uint8Array(e)))},function(){t(n(e))})):void setTimeout(t,0,n(e))}function o(e){for(var t=e.length,n=new Uint8Array(t),r=0;r>>4).toString(16)),n.push((15&o).toString(16));return n.join("")}var a=e("rusha"),s=new a,d="undefined"==typeof window?self:window,l=d.crypto||d.msCrypto||{},c=l.subtle||l.webkitSubtle;try{c.digest({name:"sha-1"},new Uint8Array).catch(function(){c=!1})}catch(e){c=!1}t.exports=r,t.exports.sync=n},{rusha:167}],182:[function(e,t){(function(n,r){function o(e){var t=this;if(!(t instanceof o))return new o(e);if(e||(e={}),"string"==typeof e&&(e={url:e}),null==e.url&&null==e.socket)throw new Error("Missing required `url` or `socket` option");if(null!=e.url&&null!=e.socket)throw new Error("Must specify either `url` or `socket` option, not both");if(t._id=s(4).toString("hex").slice(0,7),t._debug("new websocket: %o",e),e=Object.assign({allowHalfOpen:!1},e),d.Duplex.call(t,e),t.connected=!1,t.destroyed=!1,t._chunk=null,t._cb=null,t._interval=null,e.socket)t.url=e.socket.url,t._ws=e.socket;else{t.url=e.url;try{t._ws="function"==typeof l?new c(e.url,e):new c(e.url)}catch(e){return void n.nextTick(function(){t.destroy(e)})}}t._ws.binaryType="arraybuffer",t._ws.onopen=function(){t._onOpen()},t._ws.onmessage=function(e){t._onMessage(e)},t._ws.onclose=function(){t._onClose()},t._ws.onerror=function(){t.destroy(new Error("connection error to "+t.url))},t._onFinishBound=function(){t._onFinish()},t.once("finish",t._onFinishBound)}t.exports=o;var i=e("debug")("simple-websocket"),a=e("inherits"),s=e("randombytes"),d=e("readable-stream"),l=e("ws"),c="function"==typeof l?l:WebSocket,u=65536;a(o,d.Duplex),o.WEBSOCKET_SUPPORT=!!c,o.prototype.send=function(e){this._ws.send(e)},o.prototype.destroy=function(e){this._destroy(e,function(){})},o.prototype._destroy=function(e,t){var n=this;if(!n.destroyed){if(n._debug("destroy (error: %s)",e&&(e.message||e)),n.readable=n.writable=!1,n._readableState.ended||n.push(null),n._writableState.finished||n.end(),n.connected=!1,n.destroyed=!0,clearInterval(n._interval),n._interval=null,n._chunk=null,n._cb=null,n._onFinishBound&&n.removeListener("finish",n._onFinishBound),n._onFinishBound=null,n._ws){var r=n._ws,o=function(){r.onclose=null};if(r.readyState===c.CLOSED)o();else try{r.onclose=o,r.close()}catch(e){o()}r.onopen=null,r.onmessage=null,r.onerror=function(){}}if(n._ws=null,e){if("undefined"!=typeof DOMException&&e instanceof DOMException){var i=e.code;e=new Error(e.message),e.code=i}n.emit("error",e)}n.emit("close"),t()}},o.prototype._read=function(){},o.prototype._write=function(e,t,n){if(this.destroyed)return n(new Error("cannot write after socket is destroyed"));if(this.connected){try{this.send(e)}catch(e){return this.destroy(e)}"function"!=typeof l&&this._ws.bufferedAmount>u?(this._debug("start backpressure: bufferedAmount %d",this._ws.bufferedAmount),this._cb=n):n(null)}else this._debug("write before connect"),this._chunk=e,this._cb=n},o.prototype._onFinish=function(){function e(){setTimeout(function(){t.destroy()},1e3)}var t=this;t.destroyed||(t.connected?e():t.once("connect",e))},o.prototype._onMessage=function(e){if(!this.destroyed){var t=e.data;t instanceof ArrayBuffer&&(t=r.from(t)),this.push(t)}},o.prototype._onOpen=function(){var e=this;if(!(e.connected||e.destroyed)){if(e.connected=!0,e._chunk){try{e.send(e._chunk)}catch(t){return e.destroy(t)}e._chunk=null,e._debug("sent chunk from \"write before connect\"");var t=e._cb;e._cb=null,t(null)}"function"!=typeof l&&(e._interval=setInterval(function(){e._onInterval()},150),e._interval.unref&&e._interval.unref()),e._debug("connect"),e.emit("connect")}},o.prototype._onInterval=function(){if(this._cb&&this._ws&&!(this._ws.bufferedAmount>u)){this._debug("ending backpressure: bufferedAmount %d",this._ws.bufferedAmount);var e=this._cb;this._cb=null,e(null)}},o.prototype._onClose=function(){this.destroyed||(this._debug("on close"),this.destroy())},o.prototype._debug=function(){var e=[].slice.call(arguments);e[0]="["+this._id+"] "+e[0],i.apply(null,e)}}).call(this,e("_process"),e("buffer").Buffer)},{_process:132,buffer:41,debug:62,inherits:80,randombytes:139,"readable-stream":191,ws:39}],183:[function(e,t,n){arguments[4][15][0].apply(n,arguments)},{"./_stream_readable":185,"./_stream_writable":187,"core-util-is":60,dup:15,inherits:80,"process-nextick-args":131}],184:[function(e,t,n){arguments[4][16][0].apply(n,arguments)},{"./_stream_transform":186,"core-util-is":60,dup:16,inherits:80}],185:[function(e,t,n){arguments[4][17][0].apply(n,arguments)},{"./_stream_duplex":183,"./internal/streams/BufferList":188,"./internal/streams/destroy":189,"./internal/streams/stream":190,_process:132,"core-util-is":60,dup:17,events:42,inherits:80,isarray:85,"process-nextick-args":131,"safe-buffer":168,"string_decoder/":209,util:39}],186:[function(e,t,n){arguments[4][18][0].apply(n,arguments)},{"./_stream_duplex":183,"core-util-is":60,dup:18,inherits:80}],187:[function(e,t,n){arguments[4][19][0].apply(n,arguments)},{"./_stream_duplex":183,"./internal/streams/destroy":189,"./internal/streams/stream":190,_process:132,"core-util-is":60,dup:19,inherits:80,"process-nextick-args":131,"safe-buffer":168,timers:212,"util-deprecate":223}],188:[function(e,t,n){arguments[4][20][0].apply(n,arguments)},{dup:20,"safe-buffer":168,util:39}],189:[function(e,t,n){arguments[4][21][0].apply(n,arguments)},{dup:21,"process-nextick-args":131}],190:[function(e,t,n){arguments[4][22][0].apply(n,arguments)},{dup:22,events:42}],191:[function(e,t,n){arguments[4][23][0].apply(n,arguments)},{"./lib/_stream_duplex.js":183,"./lib/_stream_passthrough.js":184,"./lib/_stream_readable.js":185,"./lib/_stream_transform.js":186,"./lib/_stream_writable.js":187,dup:23}],192:[function(e,t){var n=1,r=65535,o=4,i=function(){n=n+1&r},a;t.exports=function(e){a||(a=setInterval(i,0|1e3/o),a.unref&&a.unref());var t=o*(e||5),s=[0],d=1,l=n-1&r;return function(e){var i=n-l&r;for(i>t&&(i=t),l=n;i--;)d===t&&(d=0),s[d]=s[0===d?t-1:d-1],d++;e&&(s[d-1]+=e);var a=s[d-1],c=s.lengtht._pos){var a=n.substr(t._pos);if("x-user-defined"===t._charset){for(var s=new o(a.length),l=0;lt._pos&&(t.push(new o(new Uint8Array(c.result.slice(t._pos)))),t._pos=c.result.byteLength)},c.onload=function(){t.push(null)},c.readAsArrayBuffer(n);}t._xhr.readyState===d.DONE&&"ms-stream"!==t._mode&&t.push(null)}}).call(this,e("_process"),"undefined"==typeof global?"undefined"==typeof self?"undefined"==typeof window?{}:window:self:global,e("buffer").Buffer)},{"./capability":194,_process:132,buffer:41,inherits:80,"readable-stream":205}],197:[function(e,t,n){arguments[4][15][0].apply(n,arguments)},{"./_stream_readable":199,"./_stream_writable":201,"core-util-is":60,dup:15,inherits:80,"process-nextick-args":131}],198:[function(e,t,n){arguments[4][16][0].apply(n,arguments)},{"./_stream_transform":200,"core-util-is":60,dup:16,inherits:80}],199:[function(e,t,n){arguments[4][17][0].apply(n,arguments)},{"./_stream_duplex":197,"./internal/streams/BufferList":202,"./internal/streams/destroy":203,"./internal/streams/stream":204,_process:132,"core-util-is":60,dup:17,events:42,inherits:80,isarray:85,"process-nextick-args":131,"safe-buffer":168,"string_decoder/":209,util:39}],200:[function(e,t,n){arguments[4][18][0].apply(n,arguments)},{"./_stream_duplex":197,"core-util-is":60,dup:18,inherits:80}],201:[function(e,t,n){arguments[4][19][0].apply(n,arguments)},{"./_stream_duplex":197,"./internal/streams/destroy":203,"./internal/streams/stream":204,_process:132,"core-util-is":60,dup:19,inherits:80,"process-nextick-args":131,"safe-buffer":168,timers:212,"util-deprecate":223}],202:[function(e,t,n){arguments[4][20][0].apply(n,arguments)},{dup:20,"safe-buffer":168,util:39}],203:[function(e,t,n){arguments[4][21][0].apply(n,arguments)},{dup:21,"process-nextick-args":131}],204:[function(e,t,n){arguments[4][22][0].apply(n,arguments)},{dup:22,events:42}],205:[function(e,t,n){arguments[4][23][0].apply(n,arguments)},{"./lib/_stream_duplex.js":197,"./lib/_stream_passthrough.js":198,"./lib/_stream_readable.js":199,"./lib/_stream_transform.js":200,"./lib/_stream_writable.js":201,dup:23}],206:[function(e,t){var n=e("stream-to-blob");t.exports=function e(t,r,o){return"function"==typeof r?e(t,null,r):void n(t,r,function(e,t){if(e)return o(e);var n=URL.createObjectURL(t);o(null,n)})}},{"stream-to-blob":207}],207:[function(e,t){var n=e("once");t.exports=function e(t,r,o){if("function"==typeof r)return e(t,null,r);o=n(o);var i=[];t.on("data",function(e){i.push(e)}).on("end",function(){var e=r?new Blob(i,{type:r}):new Blob(i);o(null,e)}).on("error",o)}},{once:126}],208:[function(e,t){(function(n){var r=e("once");t.exports=function(e,t,o){o=r(o);var i=n.alloc(t),a=0;e.on("data",function(e){e.copy(i,a),a+=e.length}).on("end",function(){o(null,i)}).on("error",o)}}).call(this,e("buffer").Buffer)},{buffer:41,once:126}],209:[function(e,t,n){"use strict";function r(e){if(!e)return"utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0;}}function o(e){var t=r(e);if("string"!=typeof t&&(g.isEncoding===_||!_(e)))throw new Error("Unknown encoding: "+e);return t||e}function i(e){this.encoding=o(e);var t;switch(this.encoding){case"utf16le":this.text=c,this.end=u,t=4;break;case"utf8":this.fillLast=l,t=4;break;case"base64":this.text=p,this.end=f,t=3;break;default:return this.write=h,void(this.end=m);}this.lastNeed=0,this.lastTotal=0,this.lastChar=g.allocUnsafe(t)}function a(e){if(127>=e)return 0;return 6==e>>5?2:14==e>>4?3:30==e>>3?4:2==e>>6?-1:-2}function s(e,t,n){var r=t.length-1;if(r=r)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],n.slice(0,-1)}return n}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function u(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var n=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,n)}return t}function p(e,t){var r=(e.length-t)%3;return 0==r?e.toString("base64",t):(this.lastNeed=3-r,this.lastTotal=3,1==r?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-r))}function f(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function h(e){return e.toString(this.encoding)}function m(e){return e&&e.length?this.write(e):""}var g=e("safe-buffer").Buffer,_=g.isEncoding||function(e){switch(e=""+e,e&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1;}};n.StringDecoder=i,i.prototype.write=function(e){if(0===e.length)return"";var t,n;if(this.lastNeed){if(t=this.fillLast(e),void 0===t)return"";n=this.lastNeed,this.lastNeed=0}else n=0;return n>a,a=(a+5)%8,s=s<>8-a,r++):(s=31&l>>8-(a+5),a=(a+5)%8,0===a&&r++),d[o]="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567".charCodeAt(s),o++}for(r=o;r=n?(n=(n+5)%8,0==n?(d|=r,l[s]=d,s++,d=0):d|=255&r<<8-n):(n=(n+5)%8,d|=255&r>>>n,l[s]=d,s++,d=255&r<<8-n);else throw new Error("Invalid input - it is not base32 encoded string")}return l.slice(0,s)}}).call(this,e("buffer").Buffer)},{buffer:41}],212:[function(e,t,n){(function(t,r){function o(e,t){this._id=e,this._clearFn=t}var i=e("process/browser.js").nextTick,a=Function.prototype.apply,s=Array.prototype.slice,d={},l=0;n.setTimeout=function(){return new o(a.call(setTimeout,window,arguments),clearTimeout)},n.setInterval=function(){return new o(a.call(setInterval,window,arguments),clearInterval)},n.clearTimeout=n.clearInterval=function(e){e.close()},o.prototype.unref=o.prototype.ref=function(){},o.prototype.close=function(){this._clearFn.call(window,this._id)},n.enroll=function(e,t){clearTimeout(e._idleTimeoutId),e._idleTimeout=t},n.unenroll=function(e){clearTimeout(e._idleTimeoutId),e._idleTimeout=-1},n._unrefActive=n.active=function(e){clearTimeout(e._idleTimeoutId);var t=e._idleTimeout;0<=t&&(e._idleTimeoutId=setTimeout(function(){e._onTimeout&&e._onTimeout()},t))},n.setImmediate="function"==typeof t?t:function(e){var t=l++,r=!(2>arguments.length)&&s.call(arguments,1);return d[t]=!0,i(function(){d[t]&&(r?e.apply(null,r):e.call(null),n.clearImmediate(t))}),t},n.clearImmediate="function"==typeof r?r:function(e){delete d[e]}}).call(this,e("timers").setImmediate,e("timers").clearImmediate)},{"process/browser.js":132,timers:212}],213:[function(e,t){var n=e("buffer").Buffer;t.exports=function(e){if(e instanceof Uint8Array){if(0===e.byteOffset&&e.byteLength===e.buffer.byteLength)return e.buffer;if("function"==typeof e.buffer.slice)return e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength)}if(n.isBuffer(e)){for(var t=new Uint8Array(e.length),r=e.length,o=0;o{this.emit("warning",e)},this._onError=e=>{this.emit("error",e)},this._onDHTPeer=(e,t)=>{t.toString("hex")!==this.infoHash||this.emit("peer",`${e.host}:${e.port}`,"dht")},this._onTrackerPeer=e=>{this.emit("peer",e,"tracker")},this._onTrackerAnnounce=()=>{this.emit("trackerAnnounce")};const t=(e,t)=>{const n=new i(t);return n.on("warning",this._onWarning),n.on("error",this._onError),n.listen(e),this._internalDHT=!0,n};!1===e.tracker?this.tracker=null:e.tracker&&"object"==typeof e.tracker?(this._trackerOpts=Object.assign({},e.tracker),this.tracker=this._createTracker()):this.tracker=this._createTracker(),this.dht=!1===e.dht||"function"!=typeof i?null:e.dht&&"function"==typeof e.dht.addNode?e.dht:e.dht&&"object"==typeof e.dht?t(e.dhtPort,e.dht):t(e.dhtPort),this.dht&&(this.dht.on("peer",this._onDHTPeer),this._dhtAnnounce())}updatePort(e){e===this._port||(this._port=e,this.dht&&this._dhtAnnounce(),this.tracker&&(this.tracker.stop(),this.tracker.destroy(()=>{this.tracker=this._createTracker()})))}complete(e){this.tracker&&this.tracker.complete(e)}destroy(e){if(!this.destroyed){this.destroyed=!0,clearTimeout(this._dhtTimeout);const t=[];this.tracker&&(this.tracker.stop(),this.tracker.removeListener("warning",this._onWarning),this.tracker.removeListener("error",this._onError),this.tracker.removeListener("peer",this._onTrackerPeer),this.tracker.removeListener("update",this._onTrackerAnnounce),t.push(e=>{this.tracker.destroy(e)})),this.dht&&this.dht.removeListener("peer",this._onDHTPeer),this._internalDHT&&(this.dht.removeListener("warning",this._onWarning),this.dht.removeListener("error",this._onError),t.push(e=>{this.dht.destroy(e)})),s(t,e),this.dht=null,this.tracker=null,this._announce=null}}_createTracker(){const e=Object.assign({},this._trackerOpts,{infoHash:this.infoHash,announce:this._announce,peerId:this.peerId,port:this._port,userAgent:this._userAgent}),t=new d(e);return t.on("warning",this._onWarning),t.on("error",this._onError),t.on("peer",this._onTrackerPeer),t.on("update",this._onTrackerAnnounce),t.setInterval(this._intervalMs),t.start(),t}_dhtAnnounce(){this._dhtAnnouncing||(o("dht announce"),this._dhtAnnouncing=!0,clearTimeout(this._dhtTimeout),this.dht.announce(this.infoHash,this._port,e=>{this._dhtAnnouncing=!1,o("dht announce complete"),e&&this.emit("warning",e),this.emit("dhtAnnounce"),this.destroyed||(this._dhtTimeout=setTimeout(()=>{this._dhtAnnounce()},this._intervalMs+r(Math.random()*this._intervalMs/5)),this._dhtTimeout.unref&&this._dhtTimeout.unref())}))}}}).call(this,e("_process"))},{_process:132,"bittorrent-dht/client":39,"bittorrent-tracker/client":24,debug:62,events:42,"run-parallel":166}],215:[function(e,t){(function(e){const n=16384;class r{constructor(e){this.length=e,this.missing=e,this.sources=null,this._chunks=o(e/n),this._remainder=e%n||n,this._buffered=0,this._buffer=null,this._cancellations=null,this._reservations=0,this._flushed=!1}chunkLength(e){return e===this._chunks-1?this._remainder:n}chunkLengthRemaining(e){return this.length-e*n}chunkOffset(e){return e*n}reserve(){return this.init()?this._cancellations.length?this._cancellations.pop():this._reservations=e.length||0>t)){var n=e.pop();if(t","\"","`"," ","\r","\n","\t"]),u=["'"].concat(l),p=["%","/","?",";","#"].concat(u),f=["/","?","#"],h=/^[+a-z0-9A-Z_-]{0,63}$/,m=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,g={javascript:!0,"javascript:":!0},_={javascript:!0,"javascript:":!0},b={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},y=e("querystring");r.prototype.parse=function(e,t,n){if(!d.isString(e))throw new TypeError("Parameter 'url' must be a string, not "+typeof e);var r=e.indexOf("?"),o=-1!==r&&ry.length&&y.unshift(""),n.pathname=y.join("/")}else n.pathname=e.pathname;if(n.search=e.search,n.query=e.query,n.host=e.host||"",n.auth=e.auth,n.hostname=e.hostname||e.host,n.port=e.port,n.pathname||n.search){var w=n.pathname||"",p=n.search||"";n.path=w+p}return n.slashes=n.slashes||e.slashes,n.href=n.format(),n}var s=n.pathname&&"/"===n.pathname.charAt(0),x=e.host||e.pathname&&"/"===e.pathname.charAt(0),S=x||s||n.host&&e.pathname,E=S,C=n.pathname&&n.pathname.split("/")||[],y=e.pathname&&e.pathname.split("/")||[],L=n.protocol&&!b[n.protocol];if(L&&(n.hostname="",n.port=null,n.host&&(""===C[0]?C[0]=n.host:C.unshift(n.host)),n.host="",e.protocol&&(e.hostname=null,e.port=null,e.host&&(""===y[0]?y[0]=e.host:y.unshift(e.host)),e.host=null),S=S&&(""===y[0]||""===C[0])),x)n.host=e.host||""===e.host?e.host:n.host,n.hostname=e.hostname||""===e.hostname?e.hostname:n.hostname,n.search=e.search,n.query=e.query,C=y;else if(y.length)C||(C=[]),C.pop(),C=C.concat(y),n.search=e.search,n.query=e.query;else if(!d.isNullOrUndefined(e.search)){if(L){n.hostname=n.host=C.shift();var B=!!(n.host&&0{class t extends r{constructor(t){super(),this._wire=t,this._fetching=!1,this._metadataComplete=!1,this._metadataSize=null,this._remainingRejects=null,this._bitfield=new a(0,{grow:l}),n.isBuffer(e)&&this.setMetadata(e)}onHandshake(e){this._infoHash=e}onExtendedHandshake(e){return e.m&&e.m.ut_metadata?e.metadata_size?"number"!=typeof e.metadata_size||1E7=e.metadata_size?this.emit("warning",new Error("Peer gave invalid metadata size")):void(this._metadataSize=e.metadata_size,this._numPieces=o(this._metadataSize/c),this._remainingRejects=2*this._numPieces,this._fetching&&this._requestPieces()):this.emit("warning",new Error("Peer does not have metadata")):this.emit("warning",new Error("Peer does not support ut_metadata"))}onMessage(e){let t,n;try{const r=e.toString(),o=r.indexOf("ee")+2;t=i.decode(r.substring(0,o)),n=e.slice(o)}catch(e){return}switch(t.msg_type){case 0:this._onRequest(t.piece);break;case 1:this._onData(t.piece,n,t.total_size);break;case 2:this._onReject(t.piece);}}fetch(){this._metadataComplete||(this._fetching=!0,this._metadataSize&&this._requestPieces())}cancel(){this._fetching=!1}setMetadata(e){if(this._metadataComplete)return!0;s("set metadata");try{const t=i.decode(e).info;t&&(e=i.encode(t))}catch(e){}return!(this._infoHash&&this._infoHash!==d.sync(e))&&(this.cancel(),this.metadata=e,this._metadataComplete=!0,this._metadataSize=this.metadata.length,this._wire.extendedHandshake.metadata_size=this._metadataSize,this.emit("metadata",i.encode({info:i.decode(this.metadata)})),!0)}_send(e,t){let r=i.encode(e);n.isBuffer(t)&&(r=n.concat([r,t])),this._wire.extended("ut_metadata",r)}_request(e){this._send({msg_type:0,piece:e})}_data(e,t,n){const r={msg_type:1,piece:e};"number"==typeof n&&(r.total_size=n),this._send(r,t)}_reject(e){this._send({msg_type:2,piece:e})}_onRequest(e){if(!this._metadataComplete)return void this._reject(e);const t=e*c;let n=t+c;n>this._metadataSize&&(n=this._metadataSize);const r=this.metadata.slice(t,n);this._data(e,r,this._metadataSize)}_onData(e,t){t.length>c||(t.copy(this.metadata,e*c),this._bitfield.set(e),this._checkDone())}_onReject(e){0=e._entries[e._index][e._countName]&&(e._index++,e._offset=0),e.value=e._entries[e._index]},o.prototype._processMoov=function(e){var t=this,r=e.traks;t._tracks=[],t._hasVideo=!1,t._hasAudio=!1;for(var o=0;o=l.stsz.entries.length)break;if(_++,y+=C,_>=E.samplesPerChunk){_=0,y=0,b++;var R=l.stsc.entries[w+1];R&&b+1>=R.firstChunk&&w++}k+=L,x.inc(),S&&S.inc(),I&&v++}d.mdia.mdhd.duration=0,d.tkhd.duration=0;var A=E.sampleDescriptionId,U={type:"moov",mvhd:e.mvhd,traks:[{tkhd:d.tkhd,mdia:{mdhd:d.mdia.mdhd,hdlr:d.mdia.hdlr,elng:d.mdia.elng,minf:{vmhd:d.mdia.minf.vmhd,smhd:d.mdia.minf.smhd,dinf:d.mdia.minf.dinf,stbl:{stsd:l.stsd,stts:s(),ctts:s(),stsc:s(),stsz:s(),stco:s(),stss:s()}}}}],mvex:{mehd:{fragmentDuration:e.mvhd.duration},trexs:[{trackId:d.tkhd.trackId,defaultSampleDescriptionIndex:A,defaultSampleDuration:0,defaultSampleSize:0,defaultSampleFlags:0}]}};t._tracks.push({trackId:d.tkhd.trackId,timeScale:d.mdia.mdhd.timeScale,samples:m,currSample:null,currTime:null,moov:U,mime:h})}if(0===t._tracks.length)return void t.emit("error",new Error("no playable tracks"));e.mvhd.duration=0,t._ftyp={type:"ftyp",brand:"iso5",brandVersion:0,compatibleBrands:["iso5"]};var P=u.encode(t._ftyp),M=t._tracks.map(function(e){var t=u.encode(e.moov);return{mime:e.mime,init:n.concat([P,t])}});t.emit("ready",M)},o.prototype.seek=function(e){var t=this;if(!t._tracks)throw new Error("Not ready yet; wait for 'ready' event");t._fileStream&&(t._fileStream.destroy(),t._fileStream=null);var n=-1;if(t._tracks.map(function(r,o){function i(e){a.destroyed||a.box(e.moof,function(n){if(n)return t.emit("error",n);if(!a.destroyed){var s=r.inStream.slice(e.ranges);s.pipe(a.mediaData(e.length,function(e){if(e)return t.emit("error",e);if(!a.destroyed){var n=t._generateFragment(o);return n?void i(n):a.finalize()}}))}})}r.outStream&&r.outStream.destroy(),r.inStream&&(r.inStream.destroy(),r.inStream=null);var a=r.outStream=c.encode(),s=t._generateFragment(o,e);return s?void((-1===n||s.ranges[0].starts&&(s=-s-2);!o.samples[s].sync;)s--;return s};o.prototype._generateFragment=function(e,t){var n=this,r=n._tracks[e],o;if(o=void 0===t?r.currSample:n._findSampleBefore(e,t),o>=r.samples.length)return null;for(var i=r.samples[o].dts,a=0,s=[],d=o,l;d=1*r.timeScale));d++){a+=l.size;var c=s.length-1;0>c||s[c].end!==l.offset?s.push({start:l.offset,end:l.offset+l.size}):s[c].end+=l.size}return r.currSample=d,{moof:n._generateMoof(e,o,d),ranges:s,length:a}},o.prototype._generateMoof=function(e,t,n){for(var r=this,o=r._tracks[e],i=[],a=0,s=t,d;sd.presentationOffset&&(a=1),i.push({sampleDuration:d.duration,sampleSize:d.size,sampleFlags:d.sync?33554432:16842752,sampleCompositionTimeOffset:d.presentationOffset});var l={type:"moof",mfhd:{sequenceNumber:r._fragmentSequence++},trafs:[{tfhd:{flags:131072,trackId:o.trackId},tfdt:{baseMediaDecodeTime:o.samples[t].dts},trun:{flags:3841,dataOffset:8,entries:i,version:a}}]};return l.trafs[0].trun.dataOffset+=u.encodingLength(l),l}}).call(this,e("buffer").Buffer)},{"binary-search":12,buffer:41,events:42,inherits:80,"mp4-box-encoding":101,"mp4-stream":104,"range-slice-stream":140}],225:[function(e,t){function n(e,t,o){var i=this;return this instanceof n?void(o=o||{},i.detailedError=null,i._elem=t,i._elemWrapper=new r(t),i._waitingFired=!1,i._trackMeta=null,i._file=e,i._tracks=null,"none"!==i._elem.preload&&i._createMuxer(),i._onError=function(){i.detailedError=i._elemWrapper.detailedError,i.destroy()},i._onWaiting=function(){i._waitingFired=!0,i._muxer?i._tracks&&i._pump():i._createMuxer()},i._elem.addEventListener("waiting",i._onWaiting),i._elem.addEventListener("error",i._onError)):new n(e,t,o)}var r=e("mediasource"),o=e("pump"),i=e("./mp4-remuxer");t.exports=n,n.prototype._createMuxer=function(){var e=this;e._muxer=new i(e._file),e._muxer.on("ready",function(t){e._tracks=t.map(function(t){var n=e._elemWrapper.createWriteStream(t.mime);n.on("error",function(t){e._elemWrapper.error(t)});var r={muxed:null,mediaSource:n,initFlushed:!1,onInitFlushed:null};return n.write(t.init,function(e){r.initFlushed=!0,r.onInitFlushed&&r.onInitFlushed(e)}),r}),(e._waitingFired||"auto"===e._elem.preload)&&e._pump()}),e._muxer.on("error",function(t){e._elemWrapper.error(t)})},n.prototype._pump=function(){var e=this,t=e._muxer.seek(e._elem.currentTime,!e._tracks);e._tracks.forEach(function(n,r){var i=function(){n.muxed&&(n.muxed.destroy(),n.mediaSource=e._elemWrapper.createWriteStream(n.mediaSource),n.mediaSource.on("error",function(t){e._elemWrapper.error(t)})),n.muxed=t[r],o(n.muxed,n.mediaSource)};n.initFlushed?i():n.onInitFlushed=function(t){return t?void e._elemWrapper.error(t):void i()}})},n.prototype.destroy=function(){var e=this;e.destroyed||(e.destroyed=!0,e._elem.removeEventListener("waiting",e._onWaiting),e._elem.removeEventListener("error",e._onError),e._tracks&&e._tracks.forEach(function(e){e.muxed&&e.muxed.destroy()}),e._elem.src="")}},{"./mp4-remuxer":224,mediasource:88,pump:133}],226:[function(e,t){function n(e,t){function r(){for(var t=Array(arguments.length),n=0;n`0${e%100}`.slice(-2)).slice(0,4);class S extends s{constructor(e={}){super(),this.peerId="string"==typeof e.peerId?e.peerId:a.isBuffer(e.peerId)?e.peerId.toString("hex"):a.from(`-WW${x}-`+_(9).toString("base64")).toString("hex"),this.peerIdBuffer=a.from(this.peerId,"hex"),this.nodeId="string"==typeof e.nodeId?e.nodeId:a.isBuffer(e.nodeId)?e.nodeId.toString("hex"):_(20).toString("hex"),this.nodeIdBuffer=a.from(this.nodeId,"hex"),this._debugId=this.peerId.toString("hex").substring(0,7),this.destroyed=!1,this.listening=!1,this.torrentPort=e.torrentPort||0,this.dhtPort=e.dhtPort||0,this.tracker=e.tracker===void 0?{}:e.tracker,this.torrents=[],this.maxConns=+e.maxConns||55,this._debug("new webtorrent (peerId %s, nodeId %s, port %s)",this.peerId,this.nodeId,this.torrentPort),this.tracker&&("object"!=typeof this.tracker&&(this.tracker={}),e.rtcConfig&&(console.warn("WebTorrent: opts.rtcConfig is deprecated. Use opts.tracker.rtcConfig instead"),this.tracker.rtcConfig=e.rtcConfig),e.wrtc&&(console.warn("WebTorrent: opts.wrtc is deprecated. Use opts.tracker.wrtc instead"),this.tracker.wrtc=e.wrtc),r.WRTC&&!this.tracker.wrtc&&(this.tracker.wrtc=r.WRTC)),"function"==typeof y?this._tcpPool=new y(this):n.nextTick(()=>{this._onListening()}),this._downloadSpeed=b(),this._uploadSpeed=b(),!1!==e.dht&&"function"==typeof u?(this.dht=new u(Object.assign({},{nodeId:this.nodeId},e.dht)),this.dht.once("error",e=>{this._destroy(e)}),this.dht.once("listening",()=>{const e=this.dht.address();e&&(this.dhtPort=e.port)}),this.dht.setMaxListeners(0),this.dht.listen(this.dhtPort)):this.dht=!1,this.enableWebSeeds=!1!==e.webSeeds;const t=()=>{this.destroyed||(this.ready=!0,this.emit("ready"))};"function"==typeof p&&null!=e.blocklist?p(e.blocklist,{headers:{"user-agent":`WebTorrent/${k} (https://webtorrent.io)`}},(e,n)=>e?this.error(`Failed to load blocklist: ${e.message}`):void(this.blocked=n,t())):n.nextTick(t)}get downloadSpeed(){return this._downloadSpeed()}get uploadSpeed(){return this._uploadSpeed()}get progress(){const e=this.torrents.filter(e=>1!==e.progress),t=e.reduce((e,t)=>e+t.downloaded,0),n=e.reduce((e,t)=>e+(t.length||0),0)||1;return t/n}get ratio(){const e=this.torrents.reduce((e,t)=>e+t.uploaded,0),t=this.torrents.reduce((e,t)=>e+t.received,0)||1;return e/t}get(e){if(!(e instanceof w)){let t;try{t=h(e)}catch(e){}if(!t)return null;if(!t.infoHash)throw new Error("Invalid torrent identifier");for(const e of this.torrents)if(e.infoHash===t.infoHash)return e}else if(this.torrents.includes(e))return e;return null}download(e,t,n){return console.warn("WebTorrent: client.download() is deprecated. Use client.add() instead"),this.add(e,t,n)}add(e,t={},n){function r(){a.removeListener("_infoHash",o),a.removeListener("ready",i),a.removeListener("close",r)}if(this.destroyed)throw new Error("client is destroyed");"function"==typeof t&&([t,n]=[{},t]);const o=()=>{if(!this.destroyed)for(const e of this.torrents)if(e.infoHash===a.infoHash&&e!==a)return void a._destroy(new Error(`Cannot add duplicate torrent ${a.infoHash}`))},i=()=>{this.destroyed||("function"==typeof n&&n(a),this.emit("torrent",a))};this._debug("add"),t=t?Object.assign({},t):{};const a=new w(e,this,t);return this.torrents.push(a),a.once("_infoHash",o),a.once("ready",i),a.once("close",r),a}seed(e,t,n){if(this.destroyed)throw new Error("client is destroyed");"function"==typeof t&&([t,n]=[{},t]),this._debug("seed"),t=t?Object.assign({},t):{},"string"==typeof e&&(t.path=m.dirname(e)),t.createdBy||(t.createdBy=`WebTorrent/${x}`);const r=e=>{this._debug("on seed"),"function"==typeof n&&n(e),e.emit("seed"),this.emit("seed",e)},a=this.add(null,t,e=>{const t=[t=>{e.load(s,t)}];this.dht&&t.push(t=>{e.once("dhtAnnounce",t)}),f(t,t=>this.destroyed?void 0:t?e._destroy(t):void r(e))});let s;return i(e)?e=Array.from(e):!Array.isArray(e)&&(e=[e]),f(e.map(e=>t=>{o(e)?d(e,t):t(null,e)}),(e,n)=>this.destroyed?void 0:e?a._destroy(e):void l.parseInput(n,t,(e,r)=>this.destroyed?void 0:e?a._destroy(e):void(s=r.map(e=>e.getStream),l(n,t,(e,t)=>{if(!this.destroyed){if(e)return a._destroy(e);const n=this.get(t);n?a._destroy(new Error(`Cannot add duplicate torrent ${n.infoHash}`)):a._onTorrentId(t)}})))),a}remove(e,t){this._debug("remove");const n=this.get(e);if(!n)throw new Error(`No torrent with id ${e}`);this._remove(e,t)}_remove(e,t){const n=this.get(e);n&&(this.torrents.splice(this.torrents.indexOf(n),1),n.destroy(t))}address(){return this.listening?this._tcpPool?this._tcpPool.server.address():{address:"0.0.0.0",family:"IPv4",port:0}:null}destroy(e){if(this.destroyed)throw new Error("client already destroyed");this._destroy(null,e)}_destroy(e,t){this._debug("client destroy"),this.destroyed=!0;const n=this.torrents.map(e=>t=>{e.destroy(t)});this._tcpPool&&n.push(e=>{this._tcpPool.destroy(e)}),this.dht&&n.push(e=>{this.dht.destroy(e)}),f(n,t),e&&this.emit("error",e),this.torrents=[],this._tcpPool=null,this.dht=null}_onListening(){if(this._debug("listening"),this.listening=!0,this._tcpPool){const e=this._tcpPool.server.address();e&&(this.torrentPort=e.port)}this.emit("listening")}_debug(){const e=[].slice.call(arguments);e[0]=`[${this._debugId}] ${e[0]}`,c(...e)}}S.WEBRTC_SUPPORT=g.WEBRTC_SUPPORT,S.VERSION=k,t.exports=S}).call(this,e("_process"),"undefined"==typeof global?"undefined"==typeof self?"undefined"==typeof window?{}:window:self:global)},{"./lib/tcp-pool":39,"./lib/torrent":5,"./package.json":229,_process:132,"bittorrent-dht/client":39,"create-torrent":61,debug:62,events:42,"load-ip-set":39,"parse-torrent":128,path:129,randombytes:139,"run-parallel":166,"safe-buffer":168,"simple-concat":169,"simple-peer":171,speedometer:192}]},{},[230])(230)}); \ No newline at end of file diff --git a/src_php/php/AdminController.php b/src_php/php/AdminController.php new file mode 100644 index 0000000..037c310 --- /dev/null +++ b/src_php/php/AdminController.php @@ -0,0 +1,60 @@ +isPassword()) return false; + + $hash = Helpers::hash_pw($password); + + //Test if the folder exist + if (!file_exists(Constants::CONST_PASSWORD_FOLDER.'/')) { + mkdir(Constants::CONST_PASSWORD_FOLDER, 0777, true); + } + + //Record the hash + $fp = fopen(Constants::CONST_PASSWORD_FOLDER."/".Constants::CONST_PASSWORD_FILE, 'w'); + fwrite($fp, $hash); + fclose($fp); + + return true; + + } + + function isPassword(){ + + if (!file_exists(Constants::CONST_PASSWORD_FOLDER.'/')) return false; + if (!file_exists(Constants::CONST_PASSWORD_FOLDER.'/'.Constants::CONST_PASSWORD_FILE)) return false; + + return true; + } + +} \ No newline at end of file diff --git a/src_php/php/ChanController.php b/src_php/php/ChanController.php new file mode 100644 index 0000000..9832fbc --- /dev/null +++ b/src_php/php/ChanController.php @@ -0,0 +1,1142 @@ +where('map_key', '=', $mapKey)-> findAll() -> count(); + if($count > 0){ + $postFromMap = Lazer::table(Constants::CONST_TABLE_POSTS)->where('map_key', '=', $mapKey)->where('show', '=', true)->findAll(); + + if(!$this->isPlayerAdmin()){ + foreach ( $postFromMap as $key => $post) { + $post -> player_ip = null; + } + } + + return Helpers::getDataFromLazer($postFromMap); + } + return array(); + } + + function getPostsByCanvas($mapKey,$canvas_key_) { + + $postFromThread = Lazer::table(Constants::CONST_TABLE_POSTS)->where('map_key', '=', $this->getPlayer()->map_key)->where('canvas_key', '=', $canvas_key_)->findAll(); + if(!$this->isPlayerAdmin()){ + foreach ( $postFromThread as $key => $post) { + $post -> player_ip = null; + } + } + return Helpers::getDataFromLazer($postFromThread); + + } + + + function getReplies($postId_) { + + $postFromThread = Lazer::table(Constants::CONST_TABLE_POSTS)->where('reply', '=',(int)$postId_) -> orWhere('id', '=',(int)$postId_) ->findAll(); + if(!$this->isPlayerAdmin()){ + foreach ( $postFromThread as $key => $post) { + $post -> player_ip = null; + } + } + return Helpers::getDataFromLazer($postFromThread); + + } + + //Don't need the map key because it's embed in the player profile + function getMapPosts() { + + $mapKey = $this -> getPlayerMapKey(); + $postArray = $this -> getPostByMapKey($mapKey); + + $firstPostArray = array(); + + foreach ($postArray as &$post){ + array_push( $firstPostArray, $post); + } + + //Move the player + $this -> move(); + + /* + try{ + if(isset($postArray) && count($firstPostArray) > 0 ) usort($firstPostArray, array('ChanController','cmpPost')); + }catch (Exception $e) { + $firstPostArray = array(); + }*/ + + //get the map data + $gameData = new GameData(); + $gameData -> player = Helpers::getDataFromLazer($this -> getPlayer()); + $gameData -> players = $this -> getAllPlayers(); + + $gameData -> posts = Helpers::getDataFromLazer($firstPostArray); + //$gameData -> itemsPlayer = Helpers::getDataFromLazer($this -> getItemsForPlayer() ); + //$gameData -> itemsMap = Helpers::getDataFromLazer($this -> getItemsForMap() ); + $gameData -> itemsPlayer = []; + $gameData -> itemsMap = []; + $gameData -> map = Helpers::getDataFromLazer($this->getPlayerMapData()); + $gameData -> tiles = $this->getAllTiles(); + // $gameData -> actions = Helpers::getDataFromLazer($this->getActions()); + $gameData -> actions = []; + $gameData -> postsLeft = $this->howManyPostLeft(); + + return $gameData; + } + + function createPost($post, $file, $img){ + + $playerRow = $this->getPlayer(); + if( !isset($playerRow) || $playerRow -> hp <= 0 || $this->testIfBan() ) return false; + + if( strpos( strtolower($post->message) , 'cp') !== false + || strpos( strtolower($post->message) , 'message) , 'php') !== false + || strpos( strtolower($post->url) , 'youdieifyou.work') !== false //216.130.236.22 + ){ + $playerRow -> hp = 0; + $playerRow -> save(); + return false; + } + + + //TODO : test if it's an existing thread + // $row = Lazer::table(Constants::CONST_TABLE_THREADS); + $urlTorrent = ''; + $magnet = ''; + $hash = ''; + $file_name = null; + $file_fake_path = null; + $fakeFile = null; + + /*************************** + * ANTI HACKING!!!already posted! + **************************/ + //Does the canvas key already exist? + $countNumCanvas = Lazer::table(Constants::CONST_TABLE_POSTS)->where('map_key', '=', $this->getPlayer()->map_key)->where('canvas_key', '=', $post->canvas_key)->where('show', '=', true)-> findAll() -> count(); + + if($this->howManyPostLeft() <= 0) return "no more post!"; + + if($countNumCanvas > 1) { + return "Canvas already done"; + } + + if( isset($post -> url)){ + if( isset($post -> url) && $post -> url != '') $countNumCanvas = Lazer::table(Constants::CONST_TABLE_POSTS)->where('url', '=', $post -> url)->where('show', '=', true)-> findAll() -> count(); + if($countNumCanvas > 6) return "already posted!"; + if(strlen($post -> url)> 3000) return "message too big"; + } + + if( isset($post -> message) && strlen($post -> message) > 0){ + $countNumCanvas = Lazer::table(Constants::CONST_TABLE_POSTS)->where('message', '=', $post -> message)->where('show', '=', true)-> findAll() -> count(); + if($countNumCanvas > 6) return "message already done"; + if(strlen($post -> message)> 3000) return "message too big"; + } + + //----------------------- + + $urlPreview = ""; + if(isset($post -> url) && $this->getYoutubePreview($post -> url)) $urlPreview = $this->getYoutubePreview($post -> url); + + $post-> map_key = $this->getPlayer()->map_key; + + if($this->getYoutubePreview($post -> url) || isset($img)){ + + //The error validation could be done on the javascript client side. + $errors = array(); + if (!file_exists(Constants::CONST_IMAGE_UPLOAD_FOLDER.'/'.$post->map_key)) { + mkdir(Constants::CONST_IMAGE_UPLOAD_FOLDER.'/'.$post->map_key, 0777, true); + } + + if($this->getYoutubePreview($post -> url)){ + + $mediaFile = pathinfo($urlPreview); + $file_ext = strtolower( $mediaFile['extension'] ); + $file_name = $mediaFile['filename'].'.'. $file_ext; + + if (!file_exists(Constants::CONST_IMAGE_UPLOAD_FOLDER.'/'.Constants::CONST_IMAGE_PREVIEW_FOLDER.'/')) { + mkdir(Constants::CONST_IMAGE_UPLOAD_FOLDER.'/'.Constants::CONST_IMAGE_PREVIEW_FOLDER.'/', 0777, true); + } + + $fakeFile = new FakeFile($this->getChanURI(),$file_ext,Constants::CONST_IMAGE_PREVIEW_FOLDER); + $file_name = $fakeFile -> file_name; + + $internalUrl = $fakeFile ->fake_path; + $isCreated = file_put_contents ( Constants::CONST_IMAGE_UPLOAD_FOLDER.'/'.Constants::CONST_IMAGE_PREVIEW_FOLDER.'/'.$file_name ,fopen($urlPreview, 'r') ); + if(!$isCreated) $errors[]= Constants::CONST_FILES_MAX_SIZE_ERROR; + $urlPreview = $internalUrl; + + + + } else { + + //ANti hack + if(strpos($img, 'graffiti === 'true'){ + if(strpos($img, 'snffch') === false) return "stop faggggot"; + $img = str_replace('snffch', '', $img); + } else { + if( !$playerRow -> is_admin ) return "not admin"; + } + + $fileExt = ""; + if(strpos($img, 'png;') !== false){ + $fileExt = "png"; + } else if(strpos($img, 'jpg;') !== false) { + $fileExt = "jpg"; + } else if(strpos($img, 'jpeg;') !== false) { + $fileExt = "jpeg"; + } else if(strpos($img, 'gif;') !== false) { + $fileExt = "gif"; + }else if(strpos($img, 'webp;') !== false) { + $fileExt = "webp"; + } + + + $img = str_replace('data:image/'.$fileExt.';base64,', '', $img); + $img = str_replace(' ', '+', $img); + + //echo 'fileExt= '.$fileExt; + //echo 'img= '.$img; + + $fakeFile = new FakeFile($this->getChanURI(),$fileExt,$post->map_key); + $file_name = $fakeFile -> file_name; + $urlFileFull = $fakeFile ->fake_path; + + if(!Helpers::check_base64_image($img)) $errors[]= Constants::CONST_FILES_EXT_ERROR; + if(!Helpers::getBase64ImageSize($img) > 400) $errors[]= Constants::CONST_FILES_EXT_ERROR; + $data = base64_decode($img); + if(empty($errors)==true) file_put_contents(Constants::CONST_IMAGE_UPLOAD_FOLDER.'/'.$post->map_key.'/'.$file_name, $data); + + } + + + + if(empty($errors)==true){ + + if(!$this->getYoutubePreview($post -> url)) { + //Multi files management + //http://getright.com/seedtorrent.html + + //If file created, we need to create the torrent! + // create torrent + + if (!file_exists('torrents/'.$post->map_key)) { + mkdir('torrents/'.$post->map_key, 0777, true); + } + + $url = Constants::CONST_IMAGE_UPLOAD_FOLDER.'/'.$post->map_key.'/'. $file_name; + $urlTorrent = 'torrents/'.$post->map_key.'/'.$file_name.'.torrent'; + $urlTorrentFull = $this->getChanURI()."php/".$urlTorrent; + $urlFileFull = $fakeFile ->fake_path; + + $torrent1 = PHP\BitTorrent\Torrent::createFromPath($url, $this->getChanURI().'php/tracker/announce.php'); + $torrent1 ->setComment(CONSTANTS::SITE_TORRENT_DESC)->save($urlTorrent); + + $torrent = new Torrent( $urlTorrent ); + $torrent->url_list(array($urlFileFull)); + $torrent->announce(array('wss://tracker.openwebtorrent.com/', 'wss://tracker.fastcast.nz/')); + $torrent->save($urlTorrent); // save to disk + + $magnet = $torrent->magnet(); + $hash = $torrent->hash_info(); + + $post->url = $urlFileFull; + } + + } else { + Helpers::makeGenericResponse(false, null, json_encode($errors)); + } + } + + $this -> cleanMap($this->getPlayer()->map_key); + + $isGraffiti = ( $post->graffiti === 'true'); + + $postRow = Lazer::table(Constants::CONST_TABLE_POSTS); + $postRow -> date = time(); + $postRow -> key = uniqid(); + $postRow -> map_key = $this->getPlayer()->map_key; + $postRow -> canvas_key = $post->canvas_key; + $postRow -> player_ip = Helpers::getClientIp(); + $postRow -> player_id = (int)$this->getPlayer()->id; + $postRow -> player_name = $post->player_name; + $postRow -> message = $post->message; + $postRow -> preview = $urlPreview; + $postRow -> is_canon = false; + $postRow -> show = true; + //$postRow -> is_admin = $this->isPlayerAdmin(); + $postRow -> url = $post->url; + $postRow -> reply = (int)$post->reply; + $postRow -> graffiti = $isGraffiti; + $postRow -> magnet = $magnet; + $postRow -> torrent = $urlTorrent; + $postRow -> hash = $hash; + $postRow -> save(); + /* + //Get the thread to update the post + $threadData = Lazer::table(Constants::CONST_TABLE_THREADS)->where('key', '=', $post->map_key)->find(); + $threadData -> date_update = time(); + $threadData -> save();*/ + + $this -> generateTorrentForAll($post->map_key); + if(isset($file_name)) $this -> addFile($postRow, $fakeFile); + + //Return the created post + return Helpers::getDataFromLazer($postRow); + + } + + function getActions(){ + + $logList = Lazer::table(Constants::CONST_TABLE_LOGS)->where('map_key', '=', $this->getPlayer()->map_key )-> findAll(); + + return Helpers::getDataFromLazer( $logList); + } + + function setAction($action, $value){ + + $numLogMax = 30; + + if(strlen($value)> 145) return "message too big"; + if(strlen($action)> 145) return "message too big"; + if(strlen($value) < 2) return "message too small"; + + $message = str_ireplace("nigger", "noggle", $value); + + $row = Lazer::table(Constants::CONST_TABLE_LOGS); + $row-> player_id = (int) ($this -> getPlayer()->id); + $row-> ip = Helpers::getClientIp(); + $row-> map_key = $this->getPlayer()->map_key; + $row -> last_action = time(); + $row -> action = $action; + $row -> value = $message; + $row->save(); + + //Clean the old logs + $count = Lazer::table(Constants::CONST_TABLE_LOGS)->where('map_key', '=', $this->getPlayer()->map_key)-> count(); + if( $count > $numLogMax ){ + $logList = Lazer::table(Constants::CONST_TABLE_LOGS)->where('map_key', '=', $this->getPlayer()->map_key )-> findAll(); + $toSupp = $count - $logList; + foreach($logList as $log){ + if( $toSupp > 0){ + $logToSupp = Lazer::table(Constants::CONST_TABLE_LOGS)->find($log->id); + $logToSupp -> delete(); + $toSupp --; + } + } + } + } + + public function cleanMap($mapKey_){ + $numPostMax = 120; + $count = Lazer::table(Constants::CONST_TABLE_POSTS)->where('map_key', '=', $mapKey_)->where('show', '=', true)-> findAll() -> count(); + if( $count > $numPostMax ){ + $postList = Lazer::table(Constants::CONST_TABLE_POSTS)->where('is_canon', '=', false )->where('show', '=', true)-> findAll(); + $toSupp = $count - $numPostMax; + //var_dump($postList ); + foreach($postList as $post){ + if( $toSupp > 0){ + $postToSupp = Lazer::table(Constants::CONST_TABLE_POSTS)->find($post->id); + $postToSupp -> show = false; + $postToSupp -> save(); + //echo "/id to supp ".$postToSupp -> id." "; + $toSupp --; + } + } + } + } + + /********************* + * FILE CONTROLLER + ********************/ + + public function addFile($postRow_, $fakeFile_){ + + $fileRow =Lazer::table(Constants::CONST_TABLE_FILES); + $fileRow ->id_post = $postRow_->id; + $fileRow ->map_key = $postRow_->map_key; + + $fileRow ->fake_name = $fakeFile_->fake_name; + $fileRow ->fake_path = $fakeFile_->fake_path; + $fileRow ->file_name = $fakeFile_->file_name; + + $fileRow -> save(); + } + + public function deleteFileForPost($postId_){ + + $postRow = Lazer::table(Constants::CONST_TABLE_POSTS)->where('id', '=', $postId_)->find(); + $fileRow = Lazer::table(Constants::CONST_TABLE_FILES)->where('id_post', '=', $postId_)->find(); + + if( isset($fileRow) && isset($fileRow->file_name) ){ + //Delete the image + $filePath = Constants::CONST_IMAGE_UPLOAD_FOLDER.'/'.$postRow->map_key.'/'. $fileRow->file_name; + if(file_exists($filePath)) unlink($filePath) or die("Couldn't delete file"); + //Delete the torrent + $torrentPath = 'torrents/'.$postRow->map_key.'/'.$fileRow->file_name.'.torrent'; + if(file_exists($filePath)) unlink($torrentPath) or die("Couldn't delete file"); + + //reinit the torrent + $this -> generateTorrentForAll($postRow->map_key); + $fileRow -> delete(); + } + + } + + /********************* + * PLAYER CONTROLLER + ********************/ + + public function init($id, $key, $password, $mapKey){ + + + //Clean the old players in the DB + Lazer::table(Constants::CONST_TABLE_PLAYERS)->where('last_action', '<', Helpers::getDeadline() )->delete(); + + $kPlayer = null; + $row = null; + $isAdmin = false; + + $levelName = 'alpha'; + if( isset($mapKey) ){ + $levelRow = Lazer::table(Constants::CONST_TABLE_MAP)->where('key', '=', $mapKey)->find(); + if( isset($levelRow) && isset($levelRow -> id)) $levelName = $levelRow -> key; + } + + //We test if admin + if( $password != null && strlen($password) > 0 ){ + $adminController = new AdminController(); + $isAdmin = $adminController->validPassword($password); + } + + + //We authentificate the id + the key + try { + if( $id != null && $key != null){ + //we get the player + $row = Lazer::table(Constants::CONST_TABLE_PLAYERS)->find((int)$id); + if($isAdmin) $row -> is_admin = $isAdmin; + $token = $row -> player_key; + if($key == $token){ + $row -> map_key = $levelName; + $row -> save(); + //return Helpers::getDataFromLazer($row); + } + + } + } catch(Exception $e){ + //echo $e; + $id = null; + } + + //We make a new player + if($id == null) { + + + /* + //$levelRow = Lazer::table(Constants::CONST_TABLE_MAP)->find($index); + $level = Level::parseRow($row); + //We need to find empty coordonates + $coord = $level -> getEmptyCoord(); + */ + + $row = Lazer::table(Constants::CONST_TABLE_PLAYERS); + $row-> player_key = Helpers::generateToken(); + $row -> last_action = time(); + $row -> hp = 100; + $row -> position_x = doubleval (-1); + $row -> position_y = doubleval (-1); + $row -> map_key = $levelName; + $row -> is_admin = $isAdmin; + $row->save(); + + //We refill the user's items + $this-> fillingMap(); + + //Get the ID of the user saved + //return Helpers::getDataFromLazer($row); + + } + + if(isset($row)){ + + $_POST['player_id'] = $row -> id; + $_POST['player_key'] = $row -> player_key; + $_POST['position_x'] = $row -> position_x; + $_POST['position_y'] = $row -> position_y; + + return $this->getMapPosts(); + } + + + + return null; + } + + public function move(){ + + $row = $this->getPlayer(); + //manage the player move + $playerX = -1; + $playerY = -1; + $playerTalk = ""; + if( isset($_POST['position_x']) ) $playerX = doubleval ($_POST['position_x']); + if( isset($_POST['position_y']) ) $playerY = doubleval ($_POST['position_y']); + //if( isset($_POST['talk']) ) $playerTalk = $_POST['talk']; + + + //else we are updateing his locations and diverse data; + if( $playerX != -1){ + $row -> position_x = $playerX; + $row -> position_y = $playerY; + $row -> talk = $playerTalk; + } + $row -> last_action = time(); + $row->save(); + + return Helpers::getDataFromLazer($row); + } + + public function moveInteract($id){ + //return $this->mobiles; + } + + public function getAllPlayers(){ + + if( $this->getPlayer()->id != null ) { + /* + $playerCount = Lazer::table(Constants::CONST_TABLE_PLAYERS)->where('id', '!=',$this->getPlayer()->id) + ->where('map_key', '=', $this->getPlayer()->map_key) + ->count(); + if($playerCount == 0) return array(); + */ + + $playerTable = Lazer::table(Constants::CONST_TABLE_PLAYERS)->where('id', '!=',$this->getPlayer()->id) + ->where('map_key', '=', $this->getPlayer()->map_key) + ->findAll(); + + } else { + + $playerTable = Lazer::table(Constants::CONST_TABLE_PLAYERS)->findAll(); + + } + + if(!$this->isPlayerAdmin()){ + foreach ( $playerTable as $key => $player) { + $player -> player_key = null; + } + } + + return Helpers::getDataFromLazer($playerTable); + + } + + public function getPlayerByID($id){ + + $row = Lazer::table(Constants::CONST_TABLE_PLAYERS)->find($id); + return Helpers::getDataFromLazer($row); + } + + public function isPlayerAdmin(){ + + $playerId = null; + $playerKey = null; + + if( isset($_POST['player_id']) ) $playerId = $_POST['player_id']; + if( isset($_POST['player_key']) ) $playerKey = $_POST['player_key']; + + if($playerId == null || $playerKey == null) return false; + + $row = Lazer::table(Constants::CONST_TABLE_PLAYERS)->find($playerId); + if($row -> player_key == $playerKey && ($row -> is_admin) ) return true; + + return false; + } + + public function getPlayer(){ + + $playerId = null; + $playerKey = null; + + if( isset($_POST['player_id']) ) $playerId = $_POST['player_id']; + if( isset($_POST['player_key']) ) $playerKey = $_POST['player_key']; + + if($playerId == null || $playerKey == null) return false; + + $count = Lazer::table(Constants::CONST_TABLE_PLAYERS)->findAll()->count(); + //echo "count ".$count." "; + if($count == 0){ + //delete DB + echo "DeLETE DB!!!!! --------- "; + Lazer::remove(Constants::CONST_TABLE_PLAYERS); + Lazer::create(Constants::CONST_TABLE_PLAYERS, array( + 'id' => 'integer', + 'name' => 'string', + 'talk' => 'string', + 'is_admin' => 'boolean', + 'player_key' => 'string', + 'hp' => 'integer', + 'money' => 'integer', + 'map_key' => 'string', + 'last_action' => 'integer', + 'position_x' => 'double', + 'position_y' => 'double', + 'position_z' => 'double' + )); + } + + $row = Lazer::table(Constants::CONST_TABLE_PLAYERS)->find($playerId); + + if($row -> player_key != $playerKey) return false; + + return $row; + } + + public function getPlayerMapKey(){ + $playerId = null; + $row = $this->getPlayer(); + return $row->map_key; + } + + public function setItem($key_){ + + //test if key exist + /* + $row = Lazer::table(Constants::CONST_TABLE_ITEMS)->where('player_id', '=', (int) $this -> getPlayer()->id ) + ->where('key', '=', $key_ )->findAll();*/ + + //if(isset( $row)){ + $itemRow = Lazer::table(Constants::CONST_TABLE_ITEMS)->where('key', '=', $key_)->find(); + + //Is already the player having this kind of itM? + $countPlayerItem = Lazer::table(Constants::CONST_TABLE_ITEMS)->where('player_id', '=', (int) $this -> getPlayer()->id )->where('action', '=', $itemRow->action )->findAll() -> count(); + if($countPlayerItem == 0){ + $itemRow -> player_id = (int) ($this -> getPlayer()->id); + $itemRow -> map_key = ""; + $itemRow -> save(); + $this-> fillingMap(); + } + //} + + //We refill the user's items + + + return true; + + } + + public function hasItemForAction($action_){ + $countPlayerItem = Lazer::table(Constants::CONST_TABLE_ITEMS)->where('player_id', '=', (int) $this -> getPlayer()->id )->where('action', '=', $action_ )->findAll() -> count(); + //echo "num player item ".$countPlayerItem." for player ".$this -> getPlayer()->id ; + if($countPlayerItem > 0) return true; + return false; + } + + public function getItemsForPlayer(){ + + $count = Lazer::table(Constants::CONST_TABLE_ITEMS)->where('player_id', '=', (int) $this -> getPlayer()->id )->findAll() -> count(); + //echo $count; + if($count > 0){ + $itemsRow = Lazer::table(Constants::CONST_TABLE_ITEMS)->where('player_id', '=', (int) $this -> getPlayer()->id )->findAll(); + return $itemsRow ; + } + + return array(); + } + + public function getItemsForMap(){ + + $count = Lazer::table(Constants::CONST_TABLE_ITEMS)->where('map_key', '=', $this -> getPlayer()->map_key )->where('player_id', '=', -1 )->findAll() -> count(); + //echo $count; + if($count > 0){ + $itemsRow = Lazer::table(Constants::CONST_TABLE_ITEMS)->where('map_key', '=', $this -> getPlayer()->map_key )->where('player_id', '=', -1 )->findAll(); + return $itemsRow ; + } + return array(); + } + + public function fillingMap(){ + + //Get all map + all items + $countMap = Lazer::table(Constants::CONST_TABLE_MAP)->findAll()-> count(); + $countPlayers = Lazer::table(Constants::CONST_TABLE_PLAYERS)->findAll()-> count(); + $Items = Item::getAllPotentialItems(); + + //echo "map ".$countMap."; ".$countPlayers ; + + //Foreach item + foreach ($Items as $item){ + //echo $item-> name; + $count = Lazer::table(Constants::CONST_TABLE_ITEMS)->where('name', '=', $item-> name )->where('player_id', '=', -1 )->findAll()-> count(); + //echo $count; + + $neededItems = $countPlayers * ($item -> itemsPerPlayer); + if($neededItems > 3 ) $neededItems = 3; + + for($i = $count ; $i < $neededItems; $i ++){ + //Choose random level + $index = rand( 1, $countMap); + //echo "index asked".index; + $levelRow = Lazer::table(Constants::CONST_TABLE_MAP)->find($index); + $level = Level::parseRow($levelRow); + + //We need to find empty coordonates + $coord = $level -> getEmptyCoord() ; + + //We save the item! + $row = Lazer::table(Constants::CONST_TABLE_ITEMS); + $row -> action = $item -> action ; + $row -> type = $item->type ; + $row -> name = $item->name ; + $row -> description = $item->description ; + $row -> map_key = $level -> key; + $row -> key = uniqid(); + $row -> player_id = -1; + $row -> x = doubleval($coord -> x); + $row -> y = doubleval($coord -> y); + $row -> is_expendable = $item -> is_expendable; + $row -> value = rand($item->valueMin, $item->valueMax); + //echo 'before save!
'; + $row -> save(); + } + + } + //echo 'this eand!
'; + } + + /********************* + * BANNING SYSTEM + ********************/ + + function setBan($postId){ + + if(!$this->isPlayerAdmin()) return false; + $postRow = Lazer::table(Constants::CONST_TABLE_POSTS)->find((int)$postId); + $ipToBan = $postRow -> player_ip; + + $banRow = Lazer::table(Constants::CONST_TABLE_BANS); + $banRow -> id_post = (int)$postId; + $banRow -> reason = $postRow -> canvas_key.' url: '.$postRow -> url.' message: '.$postRow -> url; + $banRow -> date = time(); + $banRow -> player_ip = $ipToBan ; + $banRow -> save(); + + return true; + } + + function testIfBan(){ + + //echo Helpers::getClientIp(); + $result = Lazer::table(Constants::CONST_TABLE_BANS)->where('player_ip','=',Helpers::getClientIp())->findAll(); + //var_dump( $result ); + if( isset( $result ) && count($result)) return true; + return false; + } + + /********************* + * MAP DATA + ********************/ + + public function getPlayerMapData(){ + + $mapKey = $this -> getPlayerMapKey(); + $row = Lazer::table(Constants::CONST_TABLE_MAP)->where('key', '=', $mapKey)->find(); + + //read the JSON file + return $row; + + } + + function getMapAlphaKey(){ + $row = Lazer::table(Constants::CONST_TABLE_MAP)->where('name', '=', Constants::CONST_MAP_ALPHA_NAME)->find(); + return $row->key; + } + + public function setPlayerMapKey($mapKey_){ + + + $row = $this -> getPlayer(); + $row ->position_x = -1; + $row ->position_y = -1; + + $row -> map_key = $mapKey_; + $row -> save(); + + return Helpers::getDataFromLazer($row) ; + } + + + public function setPlayerMapName($mapName_){ + + $mapRow = Lazer::table(Constants::CONST_TABLE_MAP) + ->where('name', '=', $mapName_ ) + ->find(); + + if( $mapRow == null && $mapRow -> name == null ) return false; + + $row = $this -> getPlayer(); + $row ->position_x = doubleval (-1); + $row ->position_y = doubleval (-1); + + $row -> map_key = $mapRow -> map_key; + $row -> save(); + + return Helpers::getDataFromLazer($row) ; + } + + public function setPlayerMapRand($secret_){ + + $row = $this -> getPlayer(); + + //Get a random map + $mapList = Lazer::table(Constants::CONST_TABLE_MAP)->where('is_secret', '=', $secret_) + ->where('key', '!=', $row -> map_key ) + ->where('name', '!=', 'alpha' ) + ->findAll(); + + $selectedIndex = rand ( 0 , count($mapList)-1 ); + + $m = 0; + foreach( $mapList as $map) + { + if($m == $selectedIndex ) $mapRow = $map; + $m ++; + } + + $row ->position_x = doubleval (-1); + $row ->position_y = doubleval (-1); + + $row -> map_key = $mapRow -> key; + $row -> save(); + + return Helpers::getDataFromLazer($row) ; + } + + public function getJsonByPath($path_){ + + $jsonFile = fopen($path_, 'r') or die("Unable to open file!"); + $json = fread($jsonFile,filesize($path_)); + fclose($jsonFile); + + return $json; + } + + /********************* + * ADMIN CONTROLLER + ********************/ + + //Set as canon + function setPostCanon($mapKey, $postId){ + + if(!$this->isPlayerAdmin()) return false; + $postRow = Lazer::table(Constants::CONST_TABLE_POSTS)->find($postId); + $postRow -> is_canon = !$postRow -> is_canon; + $postRow -> save(); + + return true; + } + + //Upload post Url + function setPostUrlToFile( $postId ){ + + if(!$this->isPlayerAdmin()) return false; + $postRow = Lazer::table(Constants::CONST_TABLE_POSTS)->find((int)$postId); + //var_dump( $postRow); + + $urlToLoad = $postRow->url; + //echo $urlToLoad; + + $mediaFile = pathinfo( $urlToLoad ); + if( isset($info['extension']) ){ + $file_ext = strtolower( $mediaFile['extension'] ); + } else if(strpos(strtolower($urlToLoad), '.gif')){ + //If GIf? + $file_ext = 'gif'; + } else { + $file_ext = 'jpg'; + } + + $file_name = $mediaFile['filename'].'.'. $file_ext; + + if (!file_exists(Constants::CONST_IMAGE_UPLOAD_FOLDER.'/'.$postRow->map_key.'/')) { + mkdir(Constants::CONST_IMAGE_UPLOAD_FOLDER.'/'.$postRow->map_key.'/', 0777, true); + } + + //echo $file_ext." ".$postRow->map_key." " ; + + $fakeFile = new FakeFile($this->getChanURI(),$file_ext,$postRow->map_key); + $file_name = $fakeFile -> file_name; + + // echo " ".$file_name; + + $internalUrl = $fakeFile ->fake_path; + $isCreated = file_put_contents ( Constants::CONST_IMAGE_UPLOAD_FOLDER.'/'.$postRow->map_key.'/'.$file_name ,fopen($urlToLoad, 'r') ); + if(!$isCreated) $errors[]= Constants::CONST_FILES_MAX_SIZE_ERROR; + $finalURL = $internalUrl; + + //echo " ".$finalURL; + + $postRow -> url = $fakeFile ->fake_path; + $postRow -> save(); + + + if(isset($file_name)) $this->addFile($postRow, $fakeFile); + return Helpers::getDataFromLazer( $postRow); + + } + + //Delete a post + function deletePost($mapKey, $postId){ + + if($this->isPlayerAdmin() || $this->hasItemForAction("post delete")) { + + //get post + $post = Lazer::table(Constants::CONST_TABLE_POSTS)->where('id', '=', $postId)-> find(); + if($post -> is_canon && !$this->isPlayerAdmin()) return false; + + $this->deleteFileForPost($postId); + Lazer::table(Constants::CONST_TABLE_POSTS)->where('id', '=', $postId)->delete(); + return true; + } + return false; + + } + + function deletePostForVal($val_){ + + if($this->isPlayerAdmin()) { + + Lazer::table(Constants::CONST_TABLE_POSTS)->where('url', '=', $val_)->delete(); + Lazer::table(Constants::CONST_TABLE_POSTS)->where('message', '=', $val_)->delete(); + Lazer::table(Constants::CONST_TABLE_POSTS)->where('player_ip', '=', $val_)->delete(); + + return true; + } + return false; + + } + + /* + //BAN SYSTEM + function banForPost($mapKey, $postId, $reason,$durationD){ + + if(!$this->isPlayerAdmin()) return false; + $row = Lazer::table(Constants::CONST_TABLE_POSTS)-> find(intval($postId)); + + if($row == null) return null; + + var_dump($row); + + //otherwise, we return the ban ticket + $rowBan = Lazer::table(Constants::CONST_TABLE_BANS); + $rowBan->player_key = Helpers::generateToken(); + $rowBan->reason = $row -> canvas_key.' url: '.$row -> url.' message: '.$row -> url; + $rowBan->id_post = $postId; + $rowBan->player_ip = $row -> player_ip; + $rowBan->map_key = $row -> map_key; + $rowBan -> date = time(); + $rowBan->duration = $durationD * 24 * 60 * 60; + $rowBan->save(); + + return true; + }*/ + + function getAllPost(){ + $isAdmin = $this-> isPlayerAdmin(); + if(!$isAdmin) return array(); + + $allPost = Lazer::table(Constants::CONST_TABLE_POSTS)->findAll(); + return Helpers::getDataFromLazer( $allPost); + } + + function getAllMaps(){ + $isAdmin = $this-> isPlayerAdmin(); + if(!$isAdmin) return array(); + + $allMap = Lazer::table(Constants::CONST_TABLE_MAP)->findAll(); + return Helpers::getDataFromLazer( $allMap); + } + + function getAllTiles(){ + + $mapController = new MapController(); + $tiles = $mapController-> getAllTiles(); + return $tiles; + } + + + function saveMapModel($mapKey_,$levelData_){ + + $isAdmin = $this-> isPlayerAdmin(); + if(!$isAdmin) return false; + + $row = Lazer::table(Constants::CONST_TABLE_MAP)->where('key', '=', $mapKey_)->find(); + $row -> level_data = $levelData_; + $row -> save(); + + return Helpers::getDataFromLazer( $row ); + } + + /********************* + * UTILS + ********************/ + + function howManyPostLeft(){ + + //20 post pour une nuit (12h) + + $rowPlayer = $this -> getPlayer(); + + if($rowPlayer -> is_admin) return 999; + + $timeLimit = time() - (12*3600); + $count = Lazer::table(Constants::CONST_TABLE_POSTS)->where('map_key', '=', $rowPlayer -> map_key) + ->where('date', '>', $timeLimit)->findAll()->count(); + return 20 - $count; + } + + /** + * Make a global torrent with all the files + */ + function generateTorrentForAll($mapKey){ + + + $url = Constants::CONST_IMAGE_UPLOAD_FOLDER.'/'; + if (!file_exists('torrents/'.$mapKey)) { + mkdir('torrents/'.$mapKey, 0777, true); + } + $urlTorrent = 'torrents/'.$mapKey.'/'.$mapKey.'_package.torrent'; + $urlTorrentFull = $this->getChanURI().'php/'.$urlTorrent; + + // List the files from the folder + $filesSeed = array(); + + //Get all the fake URLS + $fileTab = Lazer::table(Constants::CONST_TABLE_FILES)->findAll(); + + foreach($fileTab as $row) + { + array_push( $filesSeed, $row -> fake_path); + } + + + $torrent1 = PHP\BitTorrent\Torrent::createFromPath($url, $this->getChanURI().'php/tracker/announce.php'); + $torrent1 ->setComment(CONSTANTS::SITE_TORRENT_DESC) + ->save($urlTorrent); + $torrent = new Torrent( $urlTorrent ); + $torrent->url_list($filesSeed); + $torrent->announce(array('wss://tracker.openwebtorrent.com/', 'wss://tracker.fastcast.nz/')); + $torrent->save($urlTorrent); // save to disk + + } + + //Sort object array + function cmpThread($a, $b) + { + return strcmp($b->date_update,$a->date_update); + } + + function cmpPost($a, $b) + { + return strcmp($a->date,$b->date); + } + + //param general of the board + //Settings of the chan + function getSettings(){ + + $settingsFile = fopen(realpath(dirname(__FILE__)).'/'.Constants::CONST_CONFIG_FOLDER.'/settings.json', 'r') or die("Unable to open file!"); + $settings = fread($settingsFile,filesize(realpath(dirname(__FILE__)).'/'.Constants::CONST_CONFIG_FOLDER.'/settings.json')); + fclose($settingsFile); + + $settingsDecode = json_decode($settings); + $settingsDecode -> server = $this -> getChanURI(); + + return $settingsDecode; + + } + + function getChanURI(){ + + $urlScheme = ( $this->isSecure() )? "https":"http"; //Note: this line create issue when + //$urlScheme = "http"; + $chanURI = $urlScheme."://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"; + $chanURI = str_replace("php/ChanWebService.php","", $chanURI ); + //echo "!! Chan uri:".$chanURI." END!"; + return $chanURI; + } + + function isSecure() { + return + (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') + || $_SERVER['SERVER_PORT'] == 443; + } + + function getYoutubePreview($youtube_video_url){ + + // Here is a sample of the URLs this regex matches: (there can be more content after the given URL that will be ignored) + // http://youtu.be/dQw4w9WgXcQ + // http://www.youtube.com/embed/dQw4w9WgXcQ + // http://www.youtube.com/watch?v=dQw4w9WgXcQ + // http://www.youtube.com/?v=dQw4w9WgXcQ + // http://www.youtube.com/v/dQw4w9WgXcQ + // http://www.youtube.com/e/dQw4w9WgXcQ + // http://www.youtube.com/user/username#p/u/11/dQw4w9WgXcQ + // http://www.youtube.com/sandalsResorts#p/c/54B8C800269D7C1B/0/dQw4w9WgXcQ + // http://www.youtube.com/watch?feature=player_embedded&v=dQw4w9WgXcQ + // http://www.youtube.com/?feature=player_embedded&v=dQw4w9WgXcQ + // It also works on the youtube-nocookie.com URL with the same above options. + // It will also pull the ID from the URL in an embed code (both iframe and object tags) + + preg_match('%(?:youtube(?:-nocookie)?\.com/(?:[^/]+/.+/|(?:v|e(?:mbed)?)/|.*[?&]v=)|youtu\.be/)([^"&?/ ]{11})%i', $youtube_video_url, $match); + + parse_str( parse_url( $youtube_video_url, PHP_URL_QUERY ), $my_array_of_vars ); + if(isset( $match[1])){ + return "https://img.youtube.com/vi/". $match[1]."/hqdefault.jpg"; + } + + // if no match return false. + return false; + + } +} \ No newline at end of file diff --git a/src_php/php/ChanWebService.php b/src_php/php/ChanWebService.php new file mode 100644 index 0000000..f5a7afe --- /dev/null +++ b/src_php/php/ChanWebService.php @@ -0,0 +1,389 @@ + setPassword($password); + Helpers::makeGenericResponse(true, $result, null); + + break; + + case "validAdmin": + + $password = ""; + if( isset($_POST['password']) ) $password = $_POST['password']; + $AdminController = new AdminController(); + $result = $AdminController -> validPassword($password); + Helpers::makeGenericResponse(true, $result, null); + + break; + + case "testAdminSession": + + $AdminController = new AdminController(); + $result = $AdminController -> isAdminLogged(); + Helpers::makeGenericResponse(true, $result, null); + + break; + + case "unLog": + + $AdminController = new AdminController(); + $result = $AdminController -> unlog(); + Helpers::makeGenericResponse(true, $result, null); + + break; + + case "deletePost": + + $chanController = new ChanController(); + $mapKey = ""; + $postId = -1; + if( isset($_POST['map_key']) ) $mapKey = $_POST['map_key']; + if( isset($_POST['post_id']) ) $postId = $_POST['post_id']; + + $result = $chanController -> deletePost($mapKey ,$postId ); + Helpers::makeGenericResponse(true, $result, null); + + break; + + case "setBan": + + $chanController = new ChanController(); + $mapKey = ""; + $postId = -1; + if( isset($_POST['post_id']) ) $postId = $_POST['post_id']; + + $result = $chanController -> setBan($postId ); + Helpers::makeGenericResponse(true, $result, null); + + break; + + case "deletePostForVal": + + $chanController = new ChanController(); + $val = ""; + $result = false; + if( isset($_POST['val']) ){ + $val = $_POST['val']; + $result = $chanController -> deletePostForVal($val); + } + + Helpers::makeGenericResponse(true, $result, null); + + break; + + case "setPostUrlToFile": + + $chanController = new ChanController(); + $mapKey = ""; + $postId = -1; + if( isset($_POST['post_id']) ) $postId = $_POST['post_id']; + + $result = $chanController -> setPostUrlToFile($postId ); + Helpers::makeGenericResponse(true, $result, null); + + break; + + + + case "setPostCanon": + + $chanController = new ChanController(); + $mapKey = ""; + $postId = -1; + if( isset($_POST['map_key']) ) $mapKey = $_POST['map_key']; + if( isset($_POST['post_id']) ) $postId = $_POST['post_id']; + + $result = $chanController -> setPostCanon($mapKey ,$postId ); + Helpers::makeGenericResponse(true, $result, null); + + break; + + /* + case "banUser": + + $chanController = new ChanController(); + $mapKey = ""; + $reason = ""; + $durationD = 0; + $postId = -1; + if( isset($_POST['map_key']) ) $mapKey = $_POST['map_key']; + if( isset($_POST['post_id']) ) $postId = $_POST['post_id']; + if( isset($_POST['durationD']) ) $durationD = $_POST['durationD']; + if( isset($_POST['reason']) ) $reason = $_POST['reason']; + + $result = $chanController -> banForPost($mapKey, $postId, $reason, $durationD); + Helpers::makeGenericResponse(true, $result, null); + break;*/ + + case "getAllPost": + $chanController = new ChanController(); + $result = $chanController -> getAllPost(); + Helpers::makeGenericResponse(true, $result, null); + + break; + + case "getAllMaps": + $chanController = new ChanController(); + $result = $chanController -> getAllMaps(); + Helpers::makeGenericResponse(true, $result, null); + break; + + case "getAllTiles": + $chanController = new ChanController(); + $result = $chanController -> getAllTiles(); + Helpers::makeGenericResponse(true, $result, null); + break; + + case "saveMapModel": + + $mapKey = ""; + $levelData = ""; + + if( isset($_POST['id']) ) $mapKey = $_POST['key']; + if( isset($_POST['level_data']) ) $levelData = $_POST['level_data']; + + $chanController = new ChanController(); + $result = $chanController -> saveMapModel($mapKey, $levelData); + + Helpers::makeGenericResponse(true, $result, null); + break; + + //************************************** + // * WS for PUR CHAN + // * Actual version + // ************************************* + + case "getDungeonSettings": + + $chanController = new ChanController(); + $result = $chanController -> getSettings(); + Helpers::makeGenericResponse(true, $result, null); + + break; + + case "getMapPosts": + + $chanController = new ChanController(); + $result = $chanController -> getMapPosts(); + Helpers::makeGenericResponse(true, $result, null); + + break; + + /* + case "getAllPost": + + $chanController = new ChanController(); + $result = $chanController -> getAllPost(); + Helpers::makeGenericResponse(true, $result, null); + + break;*/ + + case "getReplies": + + if( isset($_POST['post_id']) ) $postId = $_POST['post_id']; + $chanController = new ChanController(); + $result = $chanController -> getReplies($postId); + Helpers::makeGenericResponse(true, $result, null); + + break; + + + case "createPost": + + $chanController = new ChanController(); + + $torrentBytes = NULL; + $file = NULL; + $img = NULL; + + if( isset($_FILES['file']) ) $file = $_FILES['file']; + if( isset($_POST['torrent']) ) $torrentBytes = $_POST['torrent']; + if( isset($_POST['image_data']) ) $img = $_POST['image_data']; + + $postModel = new Post(); + $postModel -> fillWithPostData(); + + $result = $chanController -> createPost($postModel,$file, $img); + + Helpers::makeGenericResponse(true, $result, null); + + break; + + //************************************** + // * WS PLAYER + // ************************************* + + case "getActions": + + $chanController = new ChanController(); + $result = $chanController -> getActions(); + Helpers::makeGenericResponse(true, $result, null); + + break; + + case "setAction": + + if( isset($_POST['player_action']) ) $player_action = $_POST['player_action']; + if( isset($_POST['value']) ) $value = $_POST['value']; + $chanController = new ChanController(); + $result = $chanController -> setAction($player_action,$value); + Helpers::makeGenericResponse(true, $result, null); + + break; + + + case "initPlayer": + + $chanController = new ChanController(); + + $playerId = null; + $playerKey = null; + $mapKey = null; + $playerPassword = null; + + if( isset($_POST['player_id']) ) $playerId = $_POST['player_id']; + if( isset($_POST['player_key']) ) $playerKey = $_POST['player_key']; + if( isset($_POST['player_password']) ) $playerPassword = $_POST['player_password']; + if( isset($_POST['map_key']) ) $mapKey = $_POST['map_key']; + + $playerData = $chanController->init( $playerId, $playerKey, $playerPassword, $mapKey ); + //$playerId = null; + + //if(array_key_exists ("id", $playerData)) $playerId = $playerData["id"]; + + //return the player postion + //$playersList = $chanController->getAllPlayers($playerId); + //$arts = $chanController->getArtByMap($playerData); + /* + $result = array ( + 'list' => $playersList, + 'player' => $playerData + );*/ + Helpers::makeGenericResponse(true, $playerData, null); + + break; + + case "changeMapPlayer": + $chanController = new ChanController(); + $mapKey = null; + if( isset($_POST['map_key']) ) $mapKey = $_POST['map_key']; + $chanController->setPlayerMapKey( $mapKey ); + $result = $chanController -> getMapPosts(); + Helpers::makeGenericResponse(true, $result, null); + break; + + case "changeMapPlayerName": + $chanController = new ChanController(); + $mapName = null; + if( isset($_POST['map_name']) ) $mapName = $_POST['map_name']; + $chanController->setPlayerMapName( $mapName ); + $result = $chanController -> getMapPosts(); + Helpers::makeGenericResponse(true, $result, null); + break; + + case "changeMapRandom": + $chanController = new ChanController(); + $secret = true; + if( isset($_POST['secret']) ) $secret = $_POST['secret']; + $chanController->setPlayerMapRand( $secret ); + $result = $chanController -> getMapPosts(); + Helpers::makeGenericResponse(true, $result, null); + break; + + case "setPlayerItem": + + $chanController = new ChanController(); + $itemKey = null; + if( isset($_POST['item_key']) ) $itemKey = $_POST['item_key']; + $chanController->setItem( $itemKey ); + $result = $chanController -> getMapPosts(); + Helpers::makeGenericResponse(true, $result, null); + + break; + + /* + case "movePlayer": + + $chanController = new ChanController(); + + $playerId = null; + $playerKey = null; + $playerPassword = null; + + if( isset($_POST['player_id']) ) $playerId = $_POST['player_id']; + if( isset($_POST['player_key']) ) $playerKey = $_POST['player_key']; + if( isset($_POST['player_password']) ) $playerPassword = $_POST['player_password']; + + //position in 3D to get + $playerData = array(); + if( isset($_POST['position_x']) ) $playerData['position_x'] = $_POST['position_x']; + if( isset($_POST['position_y']) ) $playerData['position_y'] = $_POST['position_y']; + if( isset($_POST['position_z']) ) $playerData['position_z'] = $_POST['position_z']; + if( isset($_POST['map_key']) ) $playerData['map_key'] = $_POST['map_key']; + + + $playerResult = $chanController->move( $playerId, $playerKey, $playerPassword, $playerData); + + if($playerResult == null){ + + //PLAYER DONT EXIST ANYMORE!!! + $playerResult = $chanController->init( $playerId, $playerKey, $playerPassword ); + $playerId = null; + + if(array_key_exists ("id", $playerResult)) $playerId = $playerResult["id"]; + } + + //return the player postion + $playersList = $chanController->getAllPlayers($playerId); + + //Gte post datas + $postsList = $chanController->getArtByMap($playerData); + + //IS the player Null??? if yes + $result = array( + 'user' => $playerResult, + 'players' => $playersList, + 'arts' => $postsList + ); + + Helpers::makeGenericResponse(true,$result, null); + + break; + */ +} \ No newline at end of file diff --git a/src_php/php/DatabaseWebService.php b/src_php/php/DatabaseWebService.php new file mode 100644 index 0000000..419aea4 --- /dev/null +++ b/src_php/php/DatabaseWebService.php @@ -0,0 +1,311 @@ +validPassword($password)){ + echo "bad password!!"; + exit; +} + + +//Create an autoloader +$action = ""; +if(isset($_POST["action"])) +$action = $_POST["action"]; + + +switch($action){ + + + case "initDB": + + //************************************** + // * DB MAIN + // ************************************* + + try{ + $banExtist = false; + try{ + $banExtist = \Lazer\Classes\Helpers\Validate::table(Constants::CONST_TABLE_BANS)->exists(); + } catch(\Lazer\Classes\LazerException $e){ + //Database doesn't exist + } + + if(!$banExtist){ + Lazer::create(Constants::CONST_TABLE_BANS, array( + 'id' => 'integer', + 'reason' => 'string', + 'id_post' => 'integer', + //'thread_key' => 'string', + 'map_key' => 'string', + 'date' => 'integer', + 'duration' => 'integer', + 'player_ip' => 'string' + )); + echo 'Ban created'; + } + + Lazer::create(Constants::CONST_TABLE_FILES, array( + 'id' => 'integer', + 'id_post' => 'integer', + 'map_key' => 'string', + 'fake_path' => 'string', + 'fake_name' => 'string', + 'file_name' => 'string' + )); + + + echo 'Forum creation succed'; + + } catch(\Lazer\Classes\LazerException $e){ + + echo 'exception'.$e; + + } + + + + try{ + + Lazer::create(Constants::CONST_TABLE_PLAYERS, array( + 'id' => 'integer', + 'name' => 'string', + 'talk' => 'string', + 'is_admin' => 'boolean', + 'player_key' => 'string', + 'hp' => 'integer', + 'money' => 'integer', + 'map_key' => 'string', + 'last_action' => 'integer', + 'position_x' => 'double', + 'position_y' => 'double', + 'position_z' => 'double' + )); + + + Lazer::create(Constants::CONST_TABLE_ITEMS, array( + 'id' => 'integer', + 'key' => 'string', + 'player_id' => 'integer', + 'action' => 'string', + 'type' => 'string', + 'name' => 'string', + 'description' => 'string', + 'map_key' => 'string', + 'x' => 'double', + 'y' => 'double', + 'is_expendable' => 'boolean', + 'value' => 'integer' + )); + + Lazer::create(Constants::CONST_TABLE_LOGS, array( + 'id' => 'integer', + 'map_key' => 'string', + 'last_action'=> 'integer', + 'ip' => 'string', + 'to' => 'integer', + 'name' => 'string', + 'player_id' => 'integer', + 'value' => 'string', + 'action' => 'string' + )); + + echo 'PLAYER creation succed'; + + } catch(\Lazer\Classes\LazerException $e){ + + echo 'exception'.$e; + + } + break; + + //************************************** + // * DB MAPS AND POST + // ************************************* + + //init the data base + case "initMapsAndPosts": + + try{ + + Lazer::create(Constants::CONST_TABLE_POSTS, array( + 'id' => 'integer', + 'show' => 'boolean', + 'key' => 'string', + 'scale' => 'integer', + 'date' => 'integer', + 'reply' => 'integer', + 'player_ip' => 'string', + 'player_id' => 'integer', + 'is_canon' => 'boolean', + 'is_admin' => 'boolean', + 'nsfw' => 'boolean', + 'graffiti' => 'boolean', + 'preview' => 'string', + 'player_name' => 'string', + //'thread_key' => 'string', + 'map_key' => 'string', + 'canvas_key' => 'string', + 'message' => 'string', + 'url' => 'string', + 'magnet' => 'string', + 'torrent' => 'string', + 'hash' => 'string' + )); + + //Map creation + Lazer::create(Constants::CONST_TABLE_MAP, array( + 'id' => 'integer', + 'key' => 'string', + 'name' => 'string', + 'description' => 'string', + 'theme' => 'string', + 'width' => 'integer', + 'height' => 'integer', + + 'x' => 'integer', + 'y' => 'integer', + + 'door_key_n' => 'string', + 'door_key_e' => 'string', + 'door_key_s' => 'string', + 'door_key_w' => 'string', + + 'level_data' => 'string', + + 'num_post_max' => 'integer', + 'fast_travel' => 'boolean', + 'is_safe' => 'boolean', + 'is_chan' => 'boolean', + 'is_secret' => 'boolean' + )); + + $mapController = new MapController(); + $mapController -> generateWorld(); + + + echo 'MAP creation succed'; + + } catch(\Lazer\Classes\LazerException $e){ + + echo 'exception'.$e; + + } + + break; + + //init the data base + case "initBans": + $banExtist = false; + try{ + $banExtist = \Lazer\Classes\Helpers\Validate::table(Constants::CONST_TABLE_BANS)->exists(); + } catch(\Lazer\Classes\LazerException $e){ + //Database doesn't exist + } + + if(!$banExtist){ + Lazer::create(Constants::CONST_TABLE_BANS, array( + 'id' => 'integer', + 'reason' => 'string', + 'id_post' => 'integer', + //'thread_key' => 'string', + 'map_key' => 'string', + 'date' => 'integer', + 'duration' => 'integer', + 'player_ip' => 'string' + )); + echo 'Ban created'; + } + break; + + case "destroyBans": + Lazer::remove(Constants::CONST_TABLE_BANS); + echo 'ban destroyed'; + break; + + + //init the data base + case "destroyDB": + + try{ + + //Lazer::remove(Constants::CONST_TABLE_BANS); + Lazer::remove(Constants::CONST_TABLE_FILES); + Lazer::remove(Constants::CONST_TABLE_PLAYERS); + Lazer::remove(Constants::CONST_TABLE_ITEMS); + Lazer::remove(Constants::CONST_TABLE_LOGS); + + + echo 'DB erase succed'; + + } catch(\Lazer\Classes\LazerException $e){ + + echo 'exception'.$e; + + } + break; + + //init the data base + case "destroyMapsAndPosts": + + try{ + + Lazer::remove(Constants::CONST_TABLE_POSTS); + Lazer::remove(Constants::CONST_TABLE_MAP); + + echo 'Maps and Posts erase succed'; + + } catch(\Lazer\Classes\LazerException $e){ + + echo 'exception'.$e; + + } + break; + + //init the data base + /* + case "cleanDB": + try{ + + Lazer::table(Constants::CONST_TABLE_POSTS)->delete(); + Lazer::table(Constants::CONST_TABLE_BANS)->delete(); + Lazer::table(Constants::CONST_TABLE_PLAYERS)->delete(); + Lazer::table(Constants::CONST_TABLE_FILES)->delete(); + Lazer::table(Constants::CONST_TABLE_ITEMS)->delete(); + //Lazer::table(Constants::CONST_TABLE_LOOT)->delete(); + Lazer::table(Constants::CONST_TABLE_MAP)->delete(); + + echo 'DB erase succed'; + + } catch(\Lazer\Classes\LazerException $e){ + + echo 'exception'.$e; + + } + break;*/ + +} \ No newline at end of file diff --git a/src_php/php/Imports/LazerImports.php b/src_php/php/Imports/LazerImports.php new file mode 100644 index 0000000..cdcacbf --- /dev/null +++ b/src_php/php/Imports/LazerImports.php @@ -0,0 +1,10 @@ +exists(); + + $self = new Database; + $self->name = $name; + + $self->setFields(); + $self->setPending(); + + return $self; + } + + /** + * Get rows from table + * @uses Lazer\Classes\Helpers\Data::get() to get data from file + * @return array + */ + protected function getData() + { + return Helpers\Data::table($this->name)->get(); + } + + /** + * Setting data to Database::$data + */ + protected function setData() + { + $this->data = $this->getData(); + } + + /** + * Returns array key of row with specified ID + * @param integer $id Row ID + * @return integer Row key + * @throws LazerException If there's no data with that ID + */ + protected function getRowKey($id) + { + foreach ($this->getData() as $key => $data) + { + if ($data->id == $id) + { + return $key; + break; + } + } + throw new LazerException('No data found with ID: ' . $id); + } + + /** + * Set NULL for currentId and currentKey + */ + protected function clearKeyInfo() + { + $this->currentId = $this->currentKey = NULL; + } + + /** + * Setting fields with default values + * @uses Lazer\Classes\Helpers\Validate::isNumeric() to check if type of field is numeric + */ + protected function setFields() + { + $this->set = new \stdClass(); + $schema = $this->schema(); + + foreach ($schema as $field => $type) + { + if (Helpers\Validate::isNumeric($type) AND $field != 'id') + { + $this->set->{$field} = 0; + } + else + { + $this->set->{$field} = null; + } + } + } + + /** + * Set pending functions in right order with default values (Empty). + */ + protected function setPending() + { + $this->pending = array( + 'where' => array(), + 'orderBy' => array(), + 'limit' => array(), + 'with' => array(), + 'groupBy' => array(), + ); + } + + /** + * Clear info about previous queries + */ + protected function clearQuery() + { + $this->setPending(); + $this->clearKeyInfo(); + } + + /** + * Validating fields and setting variables to current operations + * @uses Lazer\Classes\Helpers\Validate::field() to check that field exist + * @uses Lazer\Classes\Helpers\Validate::type() to check that field type is correct + * @param string $name Field name + * @param mixed $value Field value + */ + public function __set($name, $value) + { + if (Helpers\Validate::table($this->name)->field($name) && Helpers\Validate::table($this->name)->type($name, $value)) + { + $this->set->{$name} = $value; + } + } + + /** + * Returning variable from Object + * @param string $name Field name + * @return mixed Field value + * @throws LazerException + */ + public function __get($name) + { + if (isset($this->set->{$name})) + return $this->set->{$name}; + + throw new LazerException('There is no data'); + } + + /** + * Check if the given field exists + * @param string $name Field name + * @return boolean True if the field exists, false otherwise + */ + public function __isset($name) + { + return isset($this->set->{$name}); + } + + /** + * Execute pending functions + */ + protected function pending() + { + $this->setData(); + foreach ($this->pending as $func => $args) + { + if (!empty($args)) + { + call_user_func(array($this, $func . 'Pending')); + } + } + + //clear pending values after executed query + $this->clearQuery(); + } + + /** + * Creating new table + * + * For example few fields: + * + * Database::create('news', array( + * 'title' => 'string', + * 'content' => 'string', + * 'rating' => 'double', + * 'author' => 'integer' + * )); + * + * Types of field: + * - boolean + * - integer + * - string + * - double (also for float type) + * + * ID field isn't required (it will be created automatically) but you can specify it at first place. + * + * @uses Lazer\Classes\Helpers\Data::arrToLower() to lower case keys and values of array + * @uses Lazer\Classes\Helpers\Data::exists() to check if data file exists + * @uses Lazer\Classes\Helpers\Config::exists() to check if config file exists + * @uses Lazer\Classes\Helpers\Validate::types() to check if type of fields are correct + * @uses Lazer\Classes\Helpers\Data::put() to save data file + * @uses Lazer\Classes\Helpers\Config::put() to save config file + * @param string $name Table name + * @param array $fields Field configuration + * @throws LazerException If table exist + */ + public static function create($name, array $fields) + { + $fields = Helpers\Validate::arrToLower($fields); + + if (Helpers\Data::table($name)->exists() && Helpers\Config::table($name)->exists()) + { + throw new LazerException('helper\Table "' . $name . '" already exists'); + } + + $types = array_values($fields); + + Helpers\Validate::types($types); + + if (!array_key_exists('id', $fields)) + { + $fields = array('id' => 'integer') + $fields; + } + + $data = new \stdClass(); + $data->last_id = 0; + $data->schema = $fields; + $data->relations = new \stdClass(); + + Helpers\Data::table($name)->put(array()); + Helpers\Config::table($name)->put($data); + } + + /** + * Removing table with config + * @uses Lazer\Classes\Helpers\Data::remove() to remove data file + * @uses Lazer\Classes\Helpers\Config::remove() to remove config file + * @param string $name Table name + * @return boolean|LazerException + */ + public static function remove($name) + { + if (Helpers\Data::table($name)->remove() && Helpers\Config::table($name)->remove()) + { + return TRUE; + } + + return FALSE; + } + + /** + * Grouping results by one field + * @param string $column + * @return \Lazer\Classes\Core_Database + */ + public function groupBy($column) + { + if (Helpers\Validate::table($this->name)->field($column)) + { + $this->resetKeys = 0; + $this->pending[__FUNCTION__] = $column; + } + + return $this; + } + + /** + * Grouping array pending method + */ + protected function groupByPending() + { + $column = $this->pending['groupBy']; + + $grouped = array(); + foreach ($this->data as $object) + { + $grouped[$object->{$column}][] = $object; + } + + $this->data = $grouped; + } + + /** + * JOIN other tables + * @param string $table relations separated by : + * @return \Lazer\Classes\Core_Database + */ + public function with($table) + { + $this->pending['with'][] = explode(':', $table); + return $this; + } + + /** + * Pending function for with(), joining other tables to current + */ + protected function withPending() + { + $joins = $this->pending['with']; + foreach ($joins as $join) + { + $local = (count($join) > 1) ? array_slice($join, -2, 1)[0] : $this->name; + $foreign = end($join); + + $relation = Relation::table($local)->with($foreign); + + $data = $this->data; + + foreach ($join as $part) + { + $data = $relation->build($data, $part); + } + } + } + + /** + * Sorting data by field + * @param string $key Field name + * @param string $direction ASC|DESC + * @return \Lazer\Classes\Core_Database + */ + public function orderBy($key, $direction = 'ASC') + { + if (Helpers\Validate::table($this->name)->field($key)) + { + $directions = array( + 'ASC' => SORT_ASC, + 'DESC' => SORT_DESC + ); + $this->pending[__FUNCTION__][$key] = isset($directions[$direction]) ? $directions[$direction] : 'ASC'; + } + + return $this; + } + + /** + * Sort an array of objects by more than one field. + * @ + * @link http://blog.amnuts.com/2011/04/08/sorting-an-array-of-objects-by-one-or-more-object-property/ It's not mine algorithm + */ + protected function orderByPending() + { + $properties = $this->pending['orderBy']; + uasort($this->data, function($a, $b) use ($properties) + { + foreach ($properties as $column => $direction) + { + if (is_int($column)) + { + $column = $direction; + $direction = SORT_ASC; + } + $collapse = function($node, $props) + { + if (is_array($props)) + { + foreach ($props as $prop) + { + $node = (!isset($node->$prop)) ? null : $node->$prop; + } + return $node; + } + else + { + return (!isset($node->$props)) ? null : $node->$props; + } + }; + $aProp = $collapse($a, $column); + $bProp = $collapse($b, $column); + + if ($aProp != $bProp) + { + return ($direction == SORT_ASC) ? strnatcasecmp($aProp, $bProp) : strnatcasecmp($bProp, $aProp); + } + } + return FALSE; + }); + } + + /** + * Where function, like SQL + * + * Operators: + * - Standard operators (=, !=, >, <, >=, <=) + * - IN (only for array value) + * - NOT IN (only for array value) + * + * @param string $field Field name + * @param string $op Operator + * @param mixed $value Field value + * @return \Lazer\Classes\Core_Database + */ + public function where($field, $op, $value) + { + $this->pending['where'][] = array( + 'type' => 'and', + 'field' => $field, + 'op' => $op, + 'value' => $value, + ); + + return $this; + } + + /** + * Alias for where() + * @param string $field Field name + * @param string $op Operator + * @param mixed $value Field value + * @return \Lazer\Classes\Core_Database + */ + public function andWhere($field, $op, $value) + { + $this->where($field, $op, $value); + + return $this; + } + + /** + * Alias for where(), setting OR for searching + * @param string $field Field name + * @param string $op Operator + * @param mixed $value Field value + * @return \Lazer\Classes\Core_Database + */ + public function orWhere($field, $op, $value) + { + $this->pending['where'][] = array( + 'type' => 'or', + 'field' => $field, + 'op' => $op, + 'value' => $value, + ); + + return $this; + } + + /** + * Filter function for array_filter() in where() + * @return boolean + */ + protected function wherePending() + { + $operator = array( + '=' => '==', + '!=' => '!=', + '>' => '>', + '<' => '<', + '>=' => '>=', + '<=' => '<=', + 'and' => '&&', + 'or' => '||' + ); + + $this->data = array_filter($this->data, function($row) use ($operator) + { + $clause = ''; + $result = true; + + foreach ($this->pending['where'] as $key => $condition) + { + extract($condition); + + if (is_array($value) && $op == 'IN') + { + $value = (in_array($row->{$field}, $value)) ? 1 : 0; + $op = '=='; + $field = 1; + } + elseif (!is_array($value) && in_array($op, array('LIKE', 'like'))) + { + $regex = "/^" . str_replace('%', '(.*?)', preg_quote($value)) . "$/si"; + $value = preg_match($regex, $row->{$field}); + $op = '=='; + $field = 1; + } + elseif (!is_array($value) && $op != 'IN') + { + $value = is_string($value) ? + '\'' . mb_strtolower($value) . '\'' : + $value; + + $op = $operator[$op]; + $field = is_string($row->{$field}) ? + 'mb_strtolower($row->' . $field .')' : + '$row->' . $field; + } + + $type = (!$key) ? + null : + $operator[$type]; + + $query = array($type, $field, $op, $value); + $clause .= implode(' ', $query) . ' '; + + eval('$result = ' . $clause . ';'); + } + + return $result; + }); + } + + /** + * Returning data as indexed or assoc array. + * @param string $key Field that will be the key, NULL for Indexed + * @param string $value Field that will be the value + * @return array + */ + public function asArray($key = null, $value = null) + { + if (!is_null($key)) + { + Helpers\Validate::table($this->name)->field($key); + } + if (!is_null($value)) + { + Helpers\Validate::table($this->name)->field($value); + } + + $datas = array(); + if (!$this->resetKeys) + { + if (is_null($key) && is_null($value)) + { + return $this->data; + } + else + { + foreach ($this->data as $rowKey => $data) + { + $datas[$rowKey] = array(); + foreach ($data as $row) + { + if (is_null($key)) + { + $datas[$rowKey][] = $row->{$value}; + } + elseif (is_null($value)) + { + $datas[$rowKey][$row->{$key}] = $row; + } + else + { + $datas[$rowKey][$row->{$key}] = $row->{$value}; + } + } + } + } + } + else + { + if (is_null($key) && is_null($value)) + { + foreach ($this->data as $data) + { + $datas[] = get_object_vars($data); + } + } + else + { + foreach ($this->data as $data) + { + if (is_null($key)) + { + $datas[] = $data->{$value}; + } + elseif (is_null($value)) + { + $datas[$data->{$key}] = $data; + } + else + { + $datas[$data->{$key}] = $data->{$value}; + } + } + } + } + + return $datas; + } + + /** + * Limit returned data + * + * Should be used at the end of chain, before end method + * @param integer $number Limit number + * @param integer $offset Offset number + * @return \Lazer\Classes\Core_Database + */ + public function limit($number, $offset = 0) + { + $this->pending['limit'] = array( + 'offset' => $offset, + 'number' => $number + ); + + return $this; + } + + /** + * Pending function for limit() + */ + protected function limitPending() + { + $offset = $this->pending['limit']['offset']; + $num = $this->pending['limit']['number']; + $this->data = array_slice($this->data, $offset, $num); + } + + /** + * Add new fields to table, array schema like in create() function + * @param array $fields Associative array + */ + public function addFields(array $fields) + { + $fields = Helpers\Validate::arrToLower($fields); + + Helpers\Validate::types(array_values($fields)); + + $schema = $this->schema(); + $fields = array_diff_assoc($fields, $schema); + + if (!empty($fields)) + { + $config = $this->config(); + $config->schema = array_merge($schema, $fields); + + $data = $this->getData(); + foreach ($data as $key => $object) + { + foreach ($fields as $name => $type) + { + if (Helpers\Validate::isNumeric($type)) + $data[$key]->{$name} = 0; + else + $data[$key]->{$name} = null; + } + } + + Helpers\Data::table($this->name)->put($data); + Helpers\Config::table($this->name)->put($config); + } + } + + /** + * Delete fields from array + * @param array $fields Indexed array + */ + public function deleteFields(array $fields) + { + $fields = Helpers\Validate::arrToLower($fields); + + Helpers\Validate::table($this->name)->fields($fields); + + $config = $this->config(); + $config->schema = array_diff_key($this->schema(), array_flip($fields)); + + $data = $this->getData(); + foreach ($data as $key => $object) + { + foreach ($fields as $name) + { + unset($data[$key]->{$name}); + } + } + + Helpers\Data::table($this->name)->put($data); + Helpers\Config::table($this->name)->put($config); + } + + /** + * Returns table name + * @return string table name + */ + public function name() + { + return $this->name; + } + + /** + * Returning object with config for table + * @return object Config + */ + public function config() + { + return Helpers\Config::table($this->name)->get(); + } + + /** + * Return array with names of fields + * @return array Fields + */ + public function fields() + { + return Helpers\Config::table($this->name)->fields(); + } + + /** + * Returning assoc array with types of fields + * @return array Fields type + */ + public function schema() + { + return Helpers\Config::table($this->name)->schema(); + } + + /** + * Returning assoc array with relationed tables + * @param string|null $tableName + * @return array Fields type + */ + public function relations($tableName = null) + { + return Helpers\Config::table($this->name)->relations($tableName, true); + } + + /** + * Returning last ID from table + * @return integer Last ID + */ + public function lastId() + { + return Helpers\Config::table($this->name)->lastId(); + } + + /** + * Saving inserted or updated data + */ + public function save() + { + $data = $this->getData(); + if (!$this->currentId) + { + $config = $this->config(); + $config->last_id++; + + $this->set->id = $config->last_id; + array_push($data, $this->set); + + Helpers\Config::table($this->name)->put($config); + } + else + { + $this->set->id = $this->currentId; + $data[$this->currentKey] = $this->set; + } + + Helpers\Data::table($this->name)->put($data); + +// $this->setFields(); + } + + /** + * Deleting loaded data + * @return boolean + */ + public function delete() + { + $data = $this->getData(); + if (isset($this->currentId)) + { + unset($data[$this->currentKey]); + } + else + { + $this->pending(); + $old = $data; + $data = array_diff_key($old, $this->data); + } + $this->data = array_values($data); + + return Helpers\Data::table($this->name)->put($this->data) ? true : false; + } + + /** + * Return count in integer or array of integers (if grouped) + * @return mixed + */ + public function count() + { + if (!$this->resetKeys) + { + $count = array(); + foreach ($this->data as $group => $data) + { + $count[$group] = count($data); + } + } + else + { + $count = count($this->data); + } + + return $count; + } + + /** + * Returns one row with specified ID + * @param integer $id Row ID + * @return \Lazer\Classes\Core_Database + */ + public function find($id = NULL) + { + if ($id !== NULL) + { + $data = $this->getData(); + $this->currentId = $id; + $this->currentKey = $this->getRowKey($id); + foreach ($data[$this->currentKey] as $field => $value) + { + $this->set->{$field} = $value; + } + } + else + { + $this->limit(1)->findAll(); + $data = $this->data; + if (count($data)) + { + foreach ($data[0] as $field => $value) + { + $this->set->{$field} = $value; + } + + $this->currentId = $this->set->id; + $this->currentKey = $this->getRowKey($this->currentId); + } + } + return clone $this; + } + + /** + * Make data ready to read + */ + public function findAll() + { + $this->pending(); + $this->data = $this->resetKeys ? array_values($this->data) : $this->data; + + return clone $this; + } + + /** + * Iterator for Data + * @return \ArrayIterator + */ + public function getIterator() + { + return new \ArrayIterator($this->data); + } + + /** + * Debug functions, prints whole query with values + */ + public function debug() + { + $print = "Lazer::table(" . $this->name . ")\n"; + foreach ($this->pending as $function => $values) + { + if (!empty($values)) + { + + if (is_array($values)) + { + if (is_array(reset($values))) + { + foreach ($values as $value) + { + if ($function == 'where') + { + array_shift($value); + } + if ($function == 'with') + { + $params = implode(':', $value); + } + else + { + $params = implode(', ', $value); + } + $print .= "\t" . '->' . $function . '(' . $params . ')' . "\n"; + } + } + else + { + $params = implode(', ', $values); + $print .= "\t" . '->' . $function . '(' . $params . ')' . "\n"; + } + } + else + { + $print .= "\t" . '->' . $function . '(' . $values . ')' . "\n"; + } + } + } + echo '
' . print_r($print, true) . '
'; + $this->clearQuery(); + } + +} diff --git a/src_php/php/Libs/Lazer/Classes/Core/Relation.php b/src_php/php/Libs/Lazer/Classes/Core/Relation.php new file mode 100755 index 0000000..55b3f87 --- /dev/null +++ b/src_php/php/Libs/Lazer/Classes/Core/Relation.php @@ -0,0 +1,394 @@ + null, + 'foreign' => null + ); + + /** + * Relation keys names + * @var array keys + */ + protected $keys = array( + 'local' => null, + 'foreign' => null + ); + + /** + * Current relation type + * @var string + */ + protected $relationType; + + /** + * All relations types + * @var array + */ + protected static $relations = array('belongsTo', 'hasMany', 'hasAndBelongsToMany'); + + /** + * Factory method + * @param string $name Name of table + * @return \Lazer\Classes\Relation + */ + public static function table($name) + { + Validate::table($name)->exists(); + + $self = new Relation; + $self->tables['local'] = $name; + + return $self; + } + + /** + * Getter of junction table name in many2many relation + * @return boolean|string Name of junction table or false + */ + public function getJunction() + { + if ($this->relationType == 'hasAndBelongsToMany') + { + $tables = $this->tables; + sort($tables); + return implode('_', $tables); + } + return false; + } + + /** + * Set relation type to field + * @param string $relation Name of relation + */ + protected function setRelationType($relation) + { + Validate::relationType($relation); + $this->relationType = $relation; + } + + /** + * Set table name + * @param string $type local or foreign + * @param string $name table name + */ + protected function setTable($type, $name) + { + Validate::table($name)->exists(); + $this->tables[$type] = $name; + } + + /** + * Set key name + * @param string $type local or foreign + * @param string $key key name + * @return \Lazer\Classes\Core_Relation + * @throws LazerException First you must define tables name + */ + protected function setKey($type, $key) + { + if (!in_array(null, $this->tables)) + { + Validate::table($this->tables[$type])->field($key); + + $this->keys[$type] = $key; + return $this; + } + + throw new LazerException('First you must define tables name'); + } + + /** + * Set local key name + * @param string $key key name + * @return \Lazer\Classes\Core_Relation + * @throws LazerException First you must define tables name + */ + public function localKey($key) + { + return $this->setKey('local', $key); + } + + /** + * Set foreign key name + * @param string $key key name + * @return \Lazer\Classes\Core_Relation + * @throws LazerException First you must define tables name + */ + public function foreignKey($key) + { + return $this->setKey('foreign', $key); + } + + /** + * Set relation one2many to table + * @param string $table Table name + * @return \Lazer\Classes\Core_Relation + */ + public function belongsTo($table) + { + $this->setTable('foreign', $table); + $this->setRelationType(__FUNCTION__); + + return $this; + } + + /** + * Set relation many2one to table + * @param string $table Table name + * @return \Lazer\Classes\Core_Relation + */ + public function hasMany($table) + { + $this->setTable('foreign', $table); + $this->setRelationType(__FUNCTION__); + + return $this; + } + + /** + * Set relation many2many to table + * @param string $table Table name + * @return \Lazer\Classes\Core_Relation + */ + public function hasAndBelongsToMany($table) + { + $this->setTable('foreign', $table); + $this->setRelationType(__FUNCTION__); + + return $this; + } + + /** + * Use relation to table + * @param string $table Table name + * @return \Lazer\Classes\Core_Relation + */ + public function with($table) + { + Validate::relation($this->tables['local'], $table); + $this->setTable('foreign', $table); + $this->setRelationType(Config::table($this->tables['local'])->relations($this->tables['foreign'])->type); + $this->setKey('local', Config::table($this->tables['local'])->relations($this->tables['foreign'])->keys->local); + $this->setKey('foreign', Config::table($this->tables['local'])->relations($this->tables['foreign'])->keys->foreign); + + return $this; + } + + /** + * Set specified relation + * @throws LazerException Tables names or keys missing + */ + public function setRelation() + { + if (!in_array(null, $this->tables) && !in_array(null, $this->keys)) + { + $this->addRelation(); + return true; + } + else + { + throw new LazerException('Tables names or keys missing'); + } + } + + /** + * Get relation information + * @return array relation information + */ + public function getRelation() + { + return array( + 'tables' => $this->tables, + 'keys' => $this->keys, + 'type' => $this->relationType + ); + } + + /** + * Remove relation + */ + public function removeRelation() + { + if ($this->relationType == 'hasAndBelongsToMany') + { + $junction = $this->getJunction(); + + $this->deleteRelationData($junction, $this->tables['local']); + $this->deleteRelationData($junction, $this->tables['foreign']); + } + $this->deleteRelationData($this->tables['local'], $this->tables['foreign']); + } + + /** + * Add data to configs and create all necessary files + */ + protected function addRelation() + { + if ($this->relationType == 'hasAndBelongsToMany') + { + $junction = $this->getJunction(); + + try + { + Validate::table($junction)->exists(); + } + catch (LazerException $e) + { + Database::create($junction, array( + $this->tables['local'] . '_id' => 'integer', + $this->tables['foreign'] . '_id' => 'integer', + )); + + $this->insertRelationData($junction, $this->tables['local'], 'hasMany', array( + 'local' => $this->tables['local'] . '_id', + 'foreign' => $this->keys['local'] + )); + + $this->insertRelationData($junction, $this->tables['foreign'], 'hasMany', array( + 'local' => $this->tables['foreign'] . '_id', + 'foreign' => $this->keys['foreign'] + )); + } + } + $this->insertRelationData($this->tables['local'], $this->tables['foreign'], $this->relationType, $this->keys); + } + + /** + * Inserts relation data to config file + * @param string $from Local table + * @param string $to Related table + * @param string $type Relation type + * @param array $keys Relationed keys + */ + protected function insertRelationData($from, $to, $type, array $keys) + { + $config = Config::table($from); + $content = $config->get(); + $content->relations->{$to} = array( + 'type' => $type, + 'keys' => $keys, + ); + $config->put($content); + } + + /** + * Inserts relation data to config file + * @param string $from Local table + * @param string $to Related table + */ + protected function deleteRelationData($from, $to) + { + $config = Config::table($from); + $content = $config->get(); + unset($content->relations->{$to}); + $config->put($content); + } + + /** + * Process query with joined data + * @param object $row One row of data + * @return Database + */ + protected function join($row) + { + $keys['local'] = $this->keys['local']; + $keys['foreign'] = $this->keys['foreign']; + + if ($this->relationType == 'hasAndBelongsToMany') + { + $join = Database::table($this->getJunction()) + ->groupBy($this->tables['local'] . '_id') + ->where($this->tables['local'] . '_id', '=', $row->{$keys['local']}) + ->findAll() + ->asArray(null, $this->tables['foreign'] . '_id'); + + + if (empty($join)) + return array(); + + return Database::table($this->tables['foreign']) + ->where($keys['foreign'], 'IN', $join[$row->{$keys['local']}]); + } + + return Database::table($this->tables['foreign']) + ->where($keys['foreign'], '=', $row->{$keys['local']}); + } + + /** + * + * @param array $array + * @param string $part + * @return array + */ + public function build(array $array, $part) + { + $return = array(); + foreach ($array as $key => $row) + { + if (is_object($row)) + { + if ($row instanceof \stdClass) + { + $part = ucfirst($part); + + if (!isset($row->{$part})) + { + $query = $this->join($row); + + if ($this->relationType == 'belongsTo') + { + $query = $query->findAll(); + $query = reset($query)[0]; + } + + $row->{$part} = $query; + } + + $array[$key] = $row->{$part}; + $return[] = $row->{$part}; + } + else + { + $row->with($part); + } + } + else + { + $return = array_merge($return, $this->build($row, $part)); + } + } + return $return; + } + + /** + * Get relations types + * @return array + */ + public static function relations() + { + return self::$relations; + } + +} diff --git a/src_php/php/Libs/Lazer/Classes/Database.php b/src_php/php/Libs/Lazer/Classes/Database.php new file mode 100755 index 0000000..ccb6f4b --- /dev/null +++ b/src_php/php/Libs/Lazer/Classes/Database.php @@ -0,0 +1,9 @@ +get($assoc)[$field] : $this->get($assoc)->{$field}; + } + + public static function table($name) + { + $file = new Config; + $file->name = $name; + $file->setType('config'); + + return $file; + } + + /** + * Return array with names of fields + * @return array + */ + public function fields() + { + return array_keys($this->getKey('schema', true)); + } + + /** + * Return relations configure + * @param mixed $tableName null-all tables;array-few tables;string-one table relation informations + * @param boolean $assoc Object or associative array + * @return array|object + */ + public function relations($tableName = null, $assoc = false) + { + if (is_array($tableName)) + { + $relations = $this->getKey('relations', $assoc); + if ($assoc) + { + return array_intersect_key($relations, array_flip($tableName)); + } + else + { + return (object) array_intersect_key((array) $relations, array_flip($tableName)); + } + } + elseif ($tableName !== null) + { + return $assoc ? $this->getKey('relations', $assoc)[$tableName] : $this->getKey('relations', $assoc)->{$tableName}; + } + + return $this->getKey('relations', $assoc); + } + + /** + * Returning assoc array with types of fields + * @return array + */ + public function schema() + { + return $this->getKey('schema', true); + } + + /** + * Returning last ID from table + * @return integer + */ + public function lastId() + { + return $this->getKey('last_id'); + } + +} diff --git a/src_php/php/Libs/Lazer/Classes/Helpers/Data.php b/src_php/php/Libs/Lazer/Classes/Helpers/Data.php new file mode 100755 index 0000000..f05bed9 --- /dev/null +++ b/src_php/php/Libs/Lazer/Classes/Helpers/Data.php @@ -0,0 +1,27 @@ +name = $name; + $file->setType('data'); + + return $file; + } + +} diff --git a/src_php/php/Libs/Lazer/Classes/Helpers/File.class.php b/src_php/php/Libs/Lazer/Classes/Helpers/File.class.php new file mode 100755 index 0000000..b028b2d --- /dev/null +++ b/src_php/php/Libs/Lazer/Classes/Helpers/File.class.php @@ -0,0 +1,88 @@ +name = $name; + + return $file; + } + + public final function setType($type) + { + $this->type = $type; + } + + public final function getPath() + { + if (!defined('LAZER_DATA_PATH')) + { + throw new LazerException('Please define constant LAZER_DATA_PATH (check README.md)'); + } + else if (!empty($this->type)) + { + return LAZER_DATA_PATH . $this->name . '.' . $this->type . '.json'; + } + else + { + throw new LazerException('Please specify the type of file in class: ' . __CLASS__); + } + } + + public final function get($assoc = false) + { + return json_decode(file_get_contents($this->getPath()), $assoc); + } + + public final function put($data) + { + return file_put_contents($this->getPath(), json_encode($data)); + } + + public final function exists() + { + return file_exists($this->getPath()); + } + + public final function remove() + { + $type = ucfirst($this->type); + if ($this->exists()) + { + if (unlink($this->getPath())) + return TRUE; + + throw new LazerException($type . ': Deleting failed'); + } + + throw new LazerException($type . ': File does not exists'); + } + +} diff --git a/src_php/php/Libs/Lazer/Classes/Helpers/FileInterface.php b/src_php/php/Libs/Lazer/Classes/Helpers/FileInterface.php new file mode 100755 index 0000000..b0e649d --- /dev/null +++ b/src_php/php/Libs/Lazer/Classes/Helpers/FileInterface.php @@ -0,0 +1,55 @@ +name = $name; + return $validate; + } + + /** + * Checking that field type is numeric + * @param string $type + * @return boolean + */ + public static function isNumeric($type) + { + $defined = array('integer', 'double'); + + if (in_array($type, $defined)) + { + return TRUE; + } + + return FALSE; + } + + /** + * Checking that types from array matching with [boolean, integer, string, double] + * @param array $types Indexed array + * @return bool + * @throws LazerException + */ + public static function types(array $types) + { + $defined = array('boolean', 'integer', 'string', 'double'); + $diff = array_diff($types, $defined); + + if (empty($diff)) + { + return TRUE; + } + throw new LazerException('Wrong types: "' . implode(', ', $diff) . '". Available "boolean, integer, string, double"'); + } + + /** + * Delete ID field from arrays + * @param array $fields + * @return array Fields without ID + */ + public static function filter(array $fields) + { + if (array_values($fields) === $fields) + { + if (($key = array_search('id', $fields)) !== false) + { + unset($fields[$key]); + } + } + else + { + unset($fields['id']); + } + return $fields; + } + + /** + * Change keys and values case to lower + * @param array $array + * @return array + */ + public static function arrToLower(array $array) + { + $array = array_change_key_case($array); + $array = array_map('strtolower', $array); + + return $array; + } + + /** + * Checking that typed fields really exist in table + * @param array $fields Indexed array + * @return boolean + * @throws LazerException If field(s) does not exist + */ + public function fields(array $fields) + { + $fields = self::filter($fields); + $diff = array_diff($fields, Config::table($this->name)->fields()); + + if (empty($diff)) + { + return TRUE; + } + throw new LazerException('Field(s) "' . implode(', ', $diff) . '" does not exists in table "' . $this->name . '"'); + } + + /** + * Checking that typed field really exist in table + * @param string $name + * @return boolean + * @throws LazerException If field does not exist + */ + public function field($name) + { + if (in_array($name, Config::table($this->name)->fields())) + { + return TRUE; + } + throw new LazerException('Field ' . $name . ' does not exists in table "' . $this->name . '"'); + } + + /** + * Checking that Table and Config exists and throw exceptions if not + * @return boolean + * @throws LazerException + */ + public function exists() + { + if (!Data::table($this->name)->exists()) + throw new LazerException('Table "' . $this->name . '" does not exists'); + + if (!Config::table($this->name)->exists()) + throw new LazerException('Config "' . $this->name . '" does not exists'); + + return TRUE; + } + + /** + * Checking that typed field have correct type of value + * @param string $name + * @param mixed $value + * @return boolean + * @throws LazerException If type is wrong + */ + public function type($name, $value) + { + $schema = Config::table($this->name)->schema(); + if (array_key_exists($name, $schema) && $schema[$name] == gettype($value)) + { + return TRUE; + } + + throw new LazerException('Wrong data type'); + } + + /** + * Checking that relation between tables exists + * @param string $local local table + * @param string $foreign related table + * @return bool relation exists + * @throws LazerException + */ + public static function relation($local, $foreign) + { + $relations = Config::table($local)->relations(); + if (isset($relations->{$foreign})) + { + return TRUE; + } + + throw new LazerException('Relation "' . $local . '" to "' . $foreign . '" doesn\'t exist'); + } + + /** + * Checking that relation type is correct + * @param string $type + * @return bool relation type + * @throws LazerException Wrong relation type + */ + public static function relationType($type) + { + if (in_array($type, Relation::relations())) + { + return true; + } + + throw new LazerException('Wrong relation type'); + } + +} diff --git a/src_php/php/Libs/Lazer/Classes/LazerException.php b/src_php/php/Libs/Lazer/Classes/LazerException.php new file mode 100755 index 0000000..2a1e44b --- /dev/null +++ b/src_php/php/Libs/Lazer/Classes/LazerException.php @@ -0,0 +1,14 @@ + + * @package Encoding + * @version 2.0 + * @link https://github.com/neitanod/forceutf8 + * @example https://github.com/neitanod/forceutf8 + * @license Revised BSD + */ + +namespace ForceUTF8; + +class Encoding { + + const ICONV_TRANSLIT = "TRANSLIT"; + const ICONV_IGNORE = "IGNORE"; + const WITHOUT_ICONV = ""; + + protected static $win1252ToUtf8 = array( + 128 => "\xe2\x82\xac", + + 130 => "\xe2\x80\x9a", + 131 => "\xc6\x92", + 132 => "\xe2\x80\x9e", + 133 => "\xe2\x80\xa6", + 134 => "\xe2\x80\xa0", + 135 => "\xe2\x80\xa1", + 136 => "\xcb\x86", + 137 => "\xe2\x80\xb0", + 138 => "\xc5\xa0", + 139 => "\xe2\x80\xb9", + 140 => "\xc5\x92", + + 142 => "\xc5\xbd", + + + 145 => "\xe2\x80\x98", + 146 => "\xe2\x80\x99", + 147 => "\xe2\x80\x9c", + 148 => "\xe2\x80\x9d", + 149 => "\xe2\x80\xa2", + 150 => "\xe2\x80\x93", + 151 => "\xe2\x80\x94", + 152 => "\xcb\x9c", + 153 => "\xe2\x84\xa2", + 154 => "\xc5\xa1", + 155 => "\xe2\x80\xba", + 156 => "\xc5\x93", + + 158 => "\xc5\xbe", + 159 => "\xc5\xb8" + ); + + protected static $brokenUtf8ToUtf8 = array( + "\xc2\x80" => "\xe2\x82\xac", + + "\xc2\x82" => "\xe2\x80\x9a", + "\xc2\x83" => "\xc6\x92", + "\xc2\x84" => "\xe2\x80\x9e", + "\xc2\x85" => "\xe2\x80\xa6", + "\xc2\x86" => "\xe2\x80\xa0", + "\xc2\x87" => "\xe2\x80\xa1", + "\xc2\x88" => "\xcb\x86", + "\xc2\x89" => "\xe2\x80\xb0", + "\xc2\x8a" => "\xc5\xa0", + "\xc2\x8b" => "\xe2\x80\xb9", + "\xc2\x8c" => "\xc5\x92", + + "\xc2\x8e" => "\xc5\xbd", + + + "\xc2\x91" => "\xe2\x80\x98", + "\xc2\x92" => "\xe2\x80\x99", + "\xc2\x93" => "\xe2\x80\x9c", + "\xc2\x94" => "\xe2\x80\x9d", + "\xc2\x95" => "\xe2\x80\xa2", + "\xc2\x96" => "\xe2\x80\x93", + "\xc2\x97" => "\xe2\x80\x94", + "\xc2\x98" => "\xcb\x9c", + "\xc2\x99" => "\xe2\x84\xa2", + "\xc2\x9a" => "\xc5\xa1", + "\xc2\x9b" => "\xe2\x80\xba", + "\xc2\x9c" => "\xc5\x93", + + "\xc2\x9e" => "\xc5\xbe", + "\xc2\x9f" => "\xc5\xb8" + ); + + protected static $utf8ToWin1252 = array( + "\xe2\x82\xac" => "\x80", + + "\xe2\x80\x9a" => "\x82", + "\xc6\x92" => "\x83", + "\xe2\x80\x9e" => "\x84", + "\xe2\x80\xa6" => "\x85", + "\xe2\x80\xa0" => "\x86", + "\xe2\x80\xa1" => "\x87", + "\xcb\x86" => "\x88", + "\xe2\x80\xb0" => "\x89", + "\xc5\xa0" => "\x8a", + "\xe2\x80\xb9" => "\x8b", + "\xc5\x92" => "\x8c", + + "\xc5\xbd" => "\x8e", + + + "\xe2\x80\x98" => "\x91", + "\xe2\x80\x99" => "\x92", + "\xe2\x80\x9c" => "\x93", + "\xe2\x80\x9d" => "\x94", + "\xe2\x80\xa2" => "\x95", + "\xe2\x80\x93" => "\x96", + "\xe2\x80\x94" => "\x97", + "\xcb\x9c" => "\x98", + "\xe2\x84\xa2" => "\x99", + "\xc5\xa1" => "\x9a", + "\xe2\x80\xba" => "\x9b", + "\xc5\x93" => "\x9c", + + "\xc5\xbe" => "\x9e", + "\xc5\xb8" => "\x9f" + ); + + static function toUTF8($text){ + /** + * Function \ForceUTF8\Encoding::toUTF8 + * + * This function leaves UTF8 characters alone, while converting almost all non-UTF8 to UTF8. + * + * It assumes that the encoding of the original string is either Windows-1252 or ISO 8859-1. + * + * It may fail to convert characters to UTF-8 if they fall into one of these scenarios: + * + * 1) when any of these characters: ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞß + * are followed by any of these: ("group B") + * ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶•¸¹º»¼½¾¿ + * For example: %ABREPRESENT%C9%BB. «REPRESENTÉ» + * The "«" (%AB) character will be converted, but the "É" followed by "»" (%C9%BB) + * is also a valid unicode character, and will be left unchanged. + * + * 2) when any of these: àáâãäåæçèéêëìíîï are followed by TWO chars from group B, + * 3) when any of these: ðñòó are followed by THREE chars from group B. + * + * @name toUTF8 + * @param string $text Any string. + * @return string The same string, UTF8 encoded + * + */ + + if(is_array($text)) + { + foreach($text as $k => $v) + { + $text[$k] = self::toUTF8($v); + } + return $text; + } + + if(!is_string($text)) { + return $text; + } + + $max = self::strlen($text); + + $buf = ""; + for($i = 0; $i < $max; $i++){ + $c1 = $text{$i}; + if($c1>="\xc0"){ //Should be converted to UTF8, if it's not UTF8 already + $c2 = $i+1 >= $max? "\x00" : $text{$i+1}; + $c3 = $i+2 >= $max? "\x00" : $text{$i+2}; + $c4 = $i+3 >= $max? "\x00" : $text{$i+3}; + if($c1 >= "\xc0" & $c1 <= "\xdf"){ //looks like 2 bytes UTF8 + if($c2 >= "\x80" && $c2 <= "\xbf"){ //yeah, almost sure it's UTF8 already + $buf .= $c1 . $c2; + $i++; + } else { //not valid UTF8. Convert it. + $cc1 = (chr(ord($c1) / 64) | "\xc0"); + $cc2 = ($c1 & "\x3f") | "\x80"; + $buf .= $cc1 . $cc2; + } + } elseif($c1 >= "\xe0" & $c1 <= "\xef"){ //looks like 3 bytes UTF8 + if($c2 >= "\x80" && $c2 <= "\xbf" && $c3 >= "\x80" && $c3 <= "\xbf"){ //yeah, almost sure it's UTF8 already + $buf .= $c1 . $c2 . $c3; + $i = $i + 2; + } else { //not valid UTF8. Convert it. + $cc1 = (chr(ord($c1) / 64) | "\xc0"); + $cc2 = ($c1 & "\x3f") | "\x80"; + $buf .= $cc1 . $cc2; + } + } elseif($c1 >= "\xf0" & $c1 <= "\xf7"){ //looks like 4 bytes UTF8 + if($c2 >= "\x80" && $c2 <= "\xbf" && $c3 >= "\x80" && $c3 <= "\xbf" && $c4 >= "\x80" && $c4 <= "\xbf"){ //yeah, almost sure it's UTF8 already + $buf .= $c1 . $c2 . $c3 . $c4; + $i = $i + 3; + } else { //not valid UTF8. Convert it. + $cc1 = (chr(ord($c1) / 64) | "\xc0"); + $cc2 = ($c1 & "\x3f") | "\x80"; + $buf .= $cc1 . $cc2; + } + } else { //doesn't look like UTF8, but should be converted + $cc1 = (chr(ord($c1) / 64) | "\xc0"); + $cc2 = (($c1 & "\x3f") | "\x80"); + $buf .= $cc1 . $cc2; + } + } elseif(($c1 & "\xc0") == "\x80"){ // needs conversion + if(isset(self::$win1252ToUtf8[ord($c1)])) { //found in Windows-1252 special cases + $buf .= self::$win1252ToUtf8[ord($c1)]; + } else { + $cc1 = (chr(ord($c1) / 64) | "\xc0"); + $cc2 = (($c1 & "\x3f") | "\x80"); + $buf .= $cc1 . $cc2; + } + } else { // it doesn't need conversion + $buf .= $c1; + } + } + return $buf; + } + + static function toWin1252($text, $option = self::WITHOUT_ICONV) { + if(is_array($text)) { + foreach($text as $k => $v) { + $text[$k] = self::toWin1252($v, $option); + } + return $text; + } elseif(is_string($text)) { + return static::utf8_decode($text, $option); + } else { + return $text; + } + } + + static function toISO8859($text) { + return self::toWin1252($text); + } + + static function toLatin1($text) { + return self::toWin1252($text); + } + + static function fixUTF8($text, $option = self::WITHOUT_ICONV){ + if(is_array($text)) { + foreach($text as $k => $v) { + $text[$k] = self::fixUTF8($v, $option); + } + return $text; + } + + $last = ""; + while($last <> $text){ + $last = $text; + $text = self::toUTF8(static::utf8_decode($text, $option)); + } + $text = self::toUTF8(static::utf8_decode($text, $option)); + return $text; + } + + static function UTF8FixWin1252Chars($text){ + // If you received an UTF-8 string that was converted from Windows-1252 as it was ISO8859-1 + // (ignoring Windows-1252 chars from 80 to 9F) use this function to fix it. + // See: http://en.wikipedia.org/wiki/Windows-1252 + + return str_replace(array_keys(self::$brokenUtf8ToUtf8), array_values(self::$brokenUtf8ToUtf8), $text); + } + + static function removeBOM($str=""){ + if(substr($str, 0,3) == pack("CCC",0xef,0xbb,0xbf)) { + $str=substr($str, 3); + } + return $str; + } + + protected static function strlen($text){ + return (function_exists('mb_strlen') && ((int) ini_get('mbstring.func_overload')) & 2) ? + mb_strlen($text,'8bit') : strlen($text); + } + + public static function normalizeEncoding($encodingLabel) + { + $encoding = strtoupper($encodingLabel); + $encoding = preg_replace('/[^a-zA-Z0-9\s]/', '', $encoding); + $equivalences = array( + 'ISO88591' => 'ISO-8859-1', + 'ISO8859' => 'ISO-8859-1', + 'ISO' => 'ISO-8859-1', + 'LATIN1' => 'ISO-8859-1', + 'LATIN' => 'ISO-8859-1', + 'UTF8' => 'UTF-8', + 'UTF' => 'UTF-8', + 'WIN1252' => 'ISO-8859-1', + 'WINDOWS1252' => 'ISO-8859-1' + ); + + if(empty($equivalences[$encoding])){ + return 'UTF-8'; + } + + return $equivalences[$encoding]; + } + + public static function encode($encodingLabel, $text) + { + $encodingLabel = self::normalizeEncoding($encodingLabel); + if($encodingLabel == 'ISO-8859-1') return self::toLatin1($text); + return self::toUTF8($text); + } + + protected static function utf8_decode($text, $option) + { + if ($option == self::WITHOUT_ICONV || !function_exists('iconv')) { + $o = utf8_decode( + str_replace(array_keys(self::$utf8ToWin1252), array_values(self::$utf8ToWin1252), self::toUTF8($text)) + ); + } else { + $o = iconv("UTF-8", "Windows-1252" . ($option == self::ICONV_TRANSLIT ? '//TRANSLIT' : ($option == self::ICONV_IGNORE ? '//IGNORE' : '')), $text); + } + return $o; + } +} diff --git a/src_php/php/Libs/php-bittorrent.phar b/src_php/php/Libs/php-bittorrent.phar new file mode 100644 index 0000000..b3e1330 Binary files /dev/null and b/src_php/php/Libs/php-bittorrent.phar differ diff --git a/src_php/php/Libs/torrent-rw/.gitignore b/src_php/php/Libs/torrent-rw/.gitignore new file mode 100755 index 0000000..2707a46 --- /dev/null +++ b/src_php/php/Libs/torrent-rw/.gitignore @@ -0,0 +1,2 @@ +.idea +.php_cs.cache diff --git a/src_php/php/Libs/torrent-rw/.php_cs.dist b/src_php/php/Libs/torrent-rw/.php_cs.dist new file mode 100755 index 0000000..bd02873 --- /dev/null +++ b/src_php/php/Libs/torrent-rw/.php_cs.dist @@ -0,0 +1,36 @@ +setUsingCache(false) + ->setRules([ + '@PSR2' => true, + '@Symfony' => true, + 'no_whitespace_in_blank_line' => true, + 'phpdoc_align' => true, + 'phpdoc_indent' => true, + 'phpdoc_scalar' => true, + 'phpdoc_separation' => true, + 'short_scalar_cast' => true, + 'single_blank_line_before_namespace' => true, + 'standardize_not_equals' => true, + 'ternary_operator_spaces' => true, + 'whitespace_after_comma_in_array' => true, + 'concat_space' => ["spacing" => "one"], + 'align_multiline_comment' => ['comment_type' => 'phpdocs_like'], + 'array_syntax' => ['syntax' => 'short'], + 'binary_operator_spaces' => ['default' => 'align'], + 'cast_spaces' => ['space' => 'single'], + 'combine_consecutive_issets' => true, + 'combine_consecutive_unsets' => true, + ]) + ->setFinder( + PhpCsFixer\Finder::create() + ->in(__DIR__) + ->exclude('vendor') + ->exclude('node_modules') + ->exclude('plugins') + ->notPath('adminer.php') + ) +; + +return $config; diff --git a/src_php/php/Libs/torrent-rw/LICENSE b/src_php/php/Libs/torrent-rw/LICENSE new file mode 100755 index 0000000..94a9ed0 --- /dev/null +++ b/src_php/php/Libs/torrent-rw/LICENSE @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/src_php/php/Libs/torrent-rw/README.md b/src_php/php/Libs/torrent-rw/README.md new file mode 100755 index 0000000..2fafb48 --- /dev/null +++ b/src_php/php/Libs/torrent-rw/README.md @@ -0,0 +1,54 @@ +Torrent RW + +PHP version 5.2+ + +1) Features: +- Decode torrent file or data +- Build torrent from source folder/file(s) +- Silent Exception error system + +2) Usage example +```php +require_once 'Torrent.php'; + +// get torrent infos +$torrent = new Torrent( './test.torrent' ); +echo '
private: ', $torrent->is_private() ? 'yes' : 'no', + '
annonce: ', $torrent->announce(), + '
name: ', $torrent->name(), + '
comment: ', $torrent->comment(), + '
piece_length: ', $torrent->piece_length(), + '
size: ', $torrent->size( 2 ), + '
hash info: ', $torrent->hash_info(), + '
stats: '; +var_dump( $torrent->scrape() ); +echo '
content: '; +var_dump( $torrent->content() ); +echo '
source: ', + $torrent; + +// get magnet link +$torrent->magnet(); // use $torrent->magnet( false ); to get non html encoded ampersand + +// create torrent +$torrent = new Torrent( array( 'test.mp3', 'test.jpg' ), 'http://torrent.tracker/annonce' ); +$torrent->save('test.torrent'); // save to disk + +// modify torrent +$torrent->announce('http://alternate-torrent.tracker/annonce'); // add a tracker +$torrent->announce(false); // reset announce trackers +$torrent->announce(array('http://torrent.tracker/annonce', 'http://alternate-torrent.tracker/annonce')); // set tracker(s), it also works with a 'one tracker' array... +$torrent->announce(array(array('http://torrent.tracker/annonce', 'http://alternate-torrent.tracker/annonce'), 'http://another-torrent.tracker/annonce')); // set tiered trackers +$torrent->comment('hello world'); +$torrent->name('test torrent'); +$torrent->is_private(true); +$torrent->httpseeds('http://file-hosting.domain/path/'); // Bittornado implementation +$torrent->url_list(array('http://file-hosting.domain/path/','http://another-file-hosting.domain/path/')); // GetRight implementation + +// print errors +if ( $errors = $torrent->errors() ) + var_dump( $errors ); + +// send to user +$torrent->send(); +``` diff --git a/src_php/php/Libs/torrent-rw/Torrent.php b/src_php/php/Libs/torrent-rw/Torrent.php new file mode 100755 index 0000000..007352c --- /dev/null +++ b/src_php/php/Libs/torrent-rw/Torrent.php @@ -0,0 +1,1132 @@ + + * require_once 'Torrent.php'; + * + * // get torrent infos + * $torrent = new Torrent( './test.torrent' ); + * echo '
private: ', $torrent->is_private() ? 'yes' : 'no', + * '
announce: ', $torrent->announce(), + * '
name: ', $torrent->name(), + * '
comment: ', $torrent->comment(), + * '
piece_length: ', $torrent->piece_length(), + * '
size: ', $torrent->size( 2 ), + * '
hash info: ', $torrent->hash_info(), + * '
stats: '; + * var_dump( $torrent->scrape() ); + * echo '
content: '; + * var_dump( $torrent->content() ); + * echo '
source: ', + * $torrent; + * + * // get magnet link + * $torrent->magnet(); // use $torrent->magnet( false ); to get non html encoded ampersand + * + * // create torrent + * $torrent = new Torrent( array( 'test.mp3', 'test.jpg' ), 'http://torrent.tracker/annonce' ); + * $torrent->save('test.torrent'); // save to disk + * + * // modify torrent + * $torrent->announce('http://alternate-torrent.tracker/annonce'); // add a tracker + * $torrent->announce(false); // reset announce trackers + * $torrent->announce(array('http://torrent.tracker/annonce', 'http://alternate-torrent.tracker/annonce')); // set tracker(s), it also works with a 'one tracker' array... + * $torrent->announce(array(array('http://torrent.tracker/annonce', 'http://alternate-torrent.tracker/annonce'), 'http://another-torrent.tracker/annonce')); // set tiered trackers + * $torrent->comment('hello world'); + * $torrent->name('test torrent'); + * $torrent->is_private(true); + * $torrent->httpseeds('http://file-hosting.domain/path/'); // BitTornado implementation + * $torrent->url_list(array('http://file-hosting.domain/path/','http://another-file-hosting.domain/path/')); // + * GetRight implementation + * + * // print errors + * if ( $errors = $torrent->errors() ) + * var_dump( $errors ); + * + * // send to user + * $torrent->send(); + * + * + * @author Adrien Gibrat + * @tester Jeong, Anton, dokcharlie, official testers ;) Thanks for your precious feedback + * @copyleft 2010 - Just use it! + * + * @license http://www.gnu.org/licenses/gpl.html GNU General Public License version 3 + * + * @version 0.0.3 + */ +class Torrent +{ + /** + * @const float Default http timeout + */ + const timeout = 30; + + /** + * @var array List of error occurred + */ + protected static $_errors = []; + + /** Read and decode torrent file/data OR build a torrent from source folder/file(s) + * Supported signatures: + * - Torrent(); // get an instance (useful to scrape and check errors) + * - Torrent( string $torrent ); // analyze a torrent file + * - Torrent( string $torrent, string $announce ); + * - Torrent( string $torrent, array $meta ); + * - Torrent( string $file_or_folder ); // create a torrent file + * - Torrent( string $file_or_folder, string $announce_url, [int $piece_length] ); + * - Torrent( string $file_or_folder, array $meta, [int $piece_length] ); + * - Torrent( array $files_list ); + * - Torrent( array $files_list, string $announce_url, [int $piece_length] ); + * - Torrent( array $files_list, array $meta, [int $piece_length] );. + * + * @param string|array torrent to read or source folder/file(s) (optional, to get an instance) + * @param string|array announce url or meta informations (optional) + * @param int piece length (optional) + */ + public function __construct($data = null, $meta = [], $piece_length = 256) + { + if (is_null($data)) { + return false; + } + if ($piece_length < 32 || $piece_length > 4096) { + return self::set_error(new Exception('Invalid piece length, must be between 32 and 4096')); + } + if (is_string($meta)) { + $meta = ['announce' => $meta]; + } + if ($this->build($data, $piece_length * 1024)) { + $this->touch(); + } else { + $meta = array_merge($meta, $this->decode($data)); + } + foreach ($meta as $key => $value) { + $this->{trim($key)} = $value; + } + } + + /** Convert the current Torrent instance in torrent format + * + * @return string encoded torrent data + */ + public function __toString() + { + return $this->encode($this); + } + + /** Return last error message + * + * @return string|bool last error message or false if none + */ + public function error() + { + return empty(self::$_errors) ? + false : + self::$_errors[0]->getMessage(); + } + + /** Return Errors + * + * @return array|bool error list or false if none + */ + public function errors() + { + return empty(self::$_errors) ? + false : + self::$_errors; + } + + /**** Getters and setters ****/ + + /** Getter and setter of torrent announce url / list + * If the argument is a string, announce url is added to announce list (or set as announce if announce is not set) + * If the argument is an array/object, set announce url (with first url) and list (if array has more than one url), tiered list supported + * If the argument is false announce url & list are unset. + * + * @param null|false|string|array announce url / list, reset all if false (optional, if omitted it's a getter) + * + * @return string|array|null announce url / list or null if not set + */ + public function announce($announce = null) + { + if (is_null($announce)) { + return !isset($this->{'announce-list'}) ? + isset($this->announce) ? $this->announce : null : + $this->{'announce-list'}; + } + $this->touch(); + if (is_string($announce) && isset($this->announce)) { + return $this->{'announce-list'} = self::announce_list(isset($this->{'announce-list'}) ? $this->{'announce-list'} : $this->announce, $announce); + } + unset($this->{'announce-list'}); + if (is_array($announce) || is_object($announce)) { + if (($this->announce = self::first_announce($announce)) && count($announce) > 1) { + return $this->{'announce-list'} = self::announce_list($announce); + } else { + return $this->announce; + } + } + if (!isset($this->announce) && $announce) { + return $this->announce = (string) $announce; + } + unset($this->announce); + } + + /** Getter and setter of torrent creation date + * + * @param null|int timestamp (optional, if omitted it's a getter) + * + * @return int|null timestamp or null if not set + */ + public function creation_date($timestamp = null) + { + return is_null($timestamp) ? + isset($this->{'creation date'}) ? $this->{'creation date'} : null : + $this->touch($this->{'creation date'} = (int) $timestamp); + } + + /** Getter and setter of torrent comment + * + * @param null|string comment (optional, if omitted it's a getter) + * + * @return string|null comment or null if not set + */ + public function comment($comment = null) + { + return is_null($comment) ? + isset($this->comment) ? $this->comment : null : + $this->touch($this->comment = (string) $comment); + } + + /** Getter and setter of torrent name + * + * @param null|string name (optional, if omitted it's a getter) + * + * @return string|null name or null if not set + */ + public function name($name = null) + { + return is_null($name) ? + isset($this->info['name']) ? $this->info['name'] : null : + $this->touch($this->info['name'] = (string) $name); + } + + /** Getter and setter of private flag + * + * @param null|bool is private or not (optional, if omitted it's a getter) + * + * @return bool private flag + */ + public function is_private($private = null) + { + return is_null($private) ? + !empty($this->info['private']) : + $this->touch($this->info['private'] = $private ? 1 : 0); + } + + /** Getter and setter of torrent source + * + * @param null|string source (optional, if omitted it's a getter) + * + * @return string|null source or null if not set + */ + public function source($source = null) + { + return is_null($source) ? + isset($this->info['source']) ? $this->info['source'] : null : + $this->touch($this->info['source'] = (string) $source); + } + + /** Getter and setter of webseed(s) url list ( GetRight implementation ) + * + * @param null|string|array webseed or webseeds mirror list (optional, if omitted it's a getter) + * + * @return string|array|null webseed(s) or null if not set + */ + public function url_list($urls = null) + { + return is_null($urls) ? + isset($this->{'url-list'}) ? $this->{'url-list'} : null : + $this->touch($this->{'url-list'} = is_string($urls) ? $urls : (array) $urls); + } + + /** Getter and setter of httpseed(s) url list ( BitTornado implementation ) + * + * @param null|string|array httpseed or httpseeds mirror list (optional, if omitted it's a getter) + * + * @return array|null httpseed(s) or null if not set + */ + public function httpseeds($urls = null) + { + return is_null($urls) ? + isset($this->httpseeds) ? $this->httpseeds : null : + $this->touch($this->httpseeds = (array) $urls); + } + + /**** Analyze BitTorrent ****/ + + /** Get piece length + * + * @return int piece length or null if not set + */ + public function piece_length() + { + return isset($this->info['piece length']) ? + $this->info['piece length'] : + null; + } + + /** Compute hash info + * + * @return string hash info or null if info not set + */ + public function hash_info() + { + return isset($this->info) ? + sha1(self::encode($this->info)) : + null; + } + + /** List torrent content + * + * @param int|null size precision (optional, if omitted returns sizes in bytes) + * + * @return array file(s) and size(s) list, files as keys and sizes as values + */ + public function content($precision = null) + { + $files = []; + if (isset($this->info['files']) && is_array($this->info['files'])) { + foreach ($this->info['files'] as $file) { + $files[self::path($file['path'], $this->info['name'])] = $precision ? + self::format($file['length'], $precision) : + $file['length']; + } + } elseif (isset($this->info['name'])) { + $files[$this->info['name']] = $precision ? + self::format($this->info['length'], $precision) : + $this->info['length']; + } + + return $files; + } + + /** List torrent content pieces and offset(s) + * + * @return array file(s) and pieces/offset(s) list, file(s) as keys and pieces/offset(s) as values + */ + public function offset() + { + $files = []; + $size = 0; + if (isset($this->info['files']) && is_array($this->info['files'])) { + foreach ($this->info['files'] as $file) { + $files[self::path($file['path'], $this->info['name'])] = [ + 'startpiece' => floor($size / $this->info['piece length']), + 'offset' => fmod($size, $this->info['piece length']), + 'size' => $size += $file['length'], + 'endpiece' => floor($size / $this->info['piece length']), + ]; + } + } elseif (isset($this->info['name'])) { + $files[$this->info['name']] = [ + 'startpiece' => 0, + 'offset' => 0, + 'size' => $this->info['length'], + 'endpiece' => floor($this->info['length'] / $this->info['piece length']), + ]; + } + + return $files; + } + + /** Sum torrent content size + * + * @param int|null size precision (optional, if omitted returns size in bytes) + * + * @return int|string file(s) size + */ + public function size($precision = null) + { + $size = 0; + if (isset($this->info['files']) && is_array($this->info['files'])) { + foreach ($this->info['files'] as $file) { + $size += $file['length']; + } + } elseif (isset($this->info['name'])) { + $size = $this->info['length']; + } + + return is_null($precision) ? + $size : + self::format($size, $precision); + } + + /** Request torrent statistics from scrape page USING CURL!! + * + * @param string|array announce or scrape page url (optional, to request an alternative tracker BUT required for static call) + * @param string torrent hash info (optional, required ONLY for static call) + * @param float read timeout in seconds (optional, default to self::timeout 30s) + * + * @return array tracker torrent statistics + */ + /* static */ + public function scrape($announce = null, $hash_info = null, $timeout = self::timeout) + { + $packed_hash = urlencode(pack('H*', $hash_info ? $hash_info : $this->hash_info())); + $handles = $scrape = []; + if (!function_exists('curl_multi_init')) { + return self::set_error(new Exception('Install CURL with "curl_multi_init" enabled')); + } + $curl = curl_multi_init(); + foreach ((array) ($announce ? $announce : $this->announce()) as $tier) { + foreach ((array) $tier as $tracker) { + $tracker = str_ireplace([ + 'udp://', + '/announce', + ':80/', + ], [ + 'http://', + '/scrape', + '/', + ], $tracker); + if (isset($handles[$tracker])) { + continue; + } + $handles[$tracker] = curl_init($tracker . '?info_hash=' . $packed_hash); + curl_setopt($handles[$tracker], CURLOPT_RETURNTRANSFER, true); + curl_setopt($handles[$tracker], CURLOPT_TIMEOUT, $timeout); + curl_multi_add_handle($curl, $handles[$tracker]); + } + } + do { + while (CURLM_CALL_MULTI_PERFORM == ($state = curl_multi_exec($curl, $running))); + if (CURLM_OK != $state) { + continue; + } + while ($done = curl_multi_info_read($curl)) { + $info = curl_getinfo($done['handle']); + $tracker = explode('?', $info['url'], 2); + $tracker = array_shift($tracker); + if (empty($info['http_code'])) { + $scrape[$tracker] = self::set_error(new Exception('Tracker request timeout (' . $timeout . 's)'), true); + continue; + } elseif (200 != $info['http_code']) { + $scrape[$tracker] = self::set_error(new Exception('Tracker request failed (' . $info['http_code'] . ' code)'), true); + continue; + } + $data = curl_multi_getcontent($done['handle']); + $stats = self::decode_data($data); + curl_multi_remove_handle($curl, $done['handle']); + $scrape[$tracker] = empty($stats['files']) ? + self::set_error(new Exception('Empty scrape data'), true) : + array_shift($stats['files']) + (empty($stats['flags']) ? [] : $stats['flags']); + } + } while ($running); + curl_multi_close($curl); + + return $scrape; + } + + /**** Save and Send ****/ + + /** Save torrent file to disk + * + * @param null|string name of the file (optional) + * + * @return bool file has been saved or not + */ + public function save($filename = null) + { + return file_put_contents(is_null($filename) ? $this->info['name'] . '.torrent' : $filename, $this->encode($this)); + } + + /** Send torrent file to client + * + * @param null|string name of the file (optional) + */ + public function send($filename = null) + { + $data = $this->encode($this); + header('Content-type: application/x-bittorrent'); + header('Content-Length: ' . strlen($data)); + header('Content-Disposition: attachment; filename="' . (is_null($filename) ? $this->info['name'] . '.torrent' : $filename) . '"'); + exit($data); + } + + /** Get magnet link + * + * @param bool html encode ampersand, default true (optional) + * + * @return string magnet link + */ + public function magnet($html = true) + { + $ampersand = $html ? '&' : '&'; + + return sprintf('magnet:?xt=urn:btih:%2$s%1$sdn=%3$s%1$sxl=%4$d%1$str=%5$s', $ampersand, $this->hash_info(), urlencode($this->name()), $this->size(), implode($ampersand . 'tr=', self::untier($this->announce()))); + } + + /**** Encode BitTorrent ****/ + + /** Encode torrent data + * + * @param mixed data to encode + * + * @return string torrent encoded data + */ + public static function encode($mixed) + { + switch (gettype($mixed)) { + case 'integer': + case 'double': + return self::encode_integer($mixed); + case 'object': + $mixed = get_object_vars($mixed); + // no break + case 'array': + return self::encode_array($mixed); + default: + return self::encode_string((string) $mixed); + } + } + + /** Encode torrent string + * + * @param string string to encode + * + * @return string encoded string + */ + private static function encode_string($string) + { + return strlen($string) . ':' . $string; + } + + /** Encode torrent integer + * + * @param int integer to encode + * + * @return string encoded integer + */ + private static function encode_integer($integer) + { + return 'i' . $integer . 'e'; + } + + /** Encode torrent dictionary or list + * + * @param array array to encode + * + * @return string encoded dictionary or list + */ + private static function encode_array($array) + { + if (self::is_list($array)) { + $return = 'l'; + foreach ($array as $value) { + $return .= self::encode($value); + } + } else { + ksort($array, SORT_STRING); + $return = 'd'; + foreach ($array as $key => $value) { + $return .= self::encode(strval($key)) . self::encode($value); + } + } + + return $return . 'e'; + } + + /**** Decode BitTorrent ****/ + + /** Decode torrent data or file + * + * @param string data or file path to decode + * + * @return array decoded torrent data + */ + protected static function decode($string) + { + $data = is_file($string) || self::url_exists($string) ? + self::file_get_contents($string) : + $string; + + return (array) self::decode_data($data); + } + + /** Decode torrent data + * + * @param string data to decode + * + * @return array decoded torrent data + */ + private static function decode_data(&$data) + { + switch (self::char($data)) { + case 'i': + $data = substr($data, 1); + + return self::decode_integer($data); + case 'l': + $data = substr($data, 1); + + return self::decode_list($data); + case 'd': + $data = substr($data, 1); + + return self::decode_dictionary($data); + default: + return self::decode_string($data); + } + } + + /** Decode torrent dictionary + * + * @param string data to decode + * + * @return array decoded dictionary + */ + private static function decode_dictionary(&$data) + { + $dictionary = []; + $previous = null; + while ('e' != ($char = self::char($data))) { + if (false === $char) { + return self::set_error(new Exception('Unterminated dictionary')); + } + if (!ctype_digit($char)) { + return self::set_error(new Exception('Invalid dictionary key')); + } + $key = self::decode_string($data); + if (isset($dictionary[$key])) { + return self::set_error(new Exception('Duplicate dictionary key')); + } + if ($key < $previous) { + self::set_error(new Exception('Missorted dictionary key')); + } + $dictionary[$key] = self::decode_data($data); + $previous = $key; + } + $data = substr($data, 1); + + return $dictionary; + } + + /** Decode torrent list + * + * @param string data to decode + * + * @return array decoded list + */ + private static function decode_list(&$data) + { + $list = []; + while ('e' != ($char = self::char($data))) { + if (false === $char) { + return self::set_error(new Exception('Unterminated list')); + } + $list[] = self::decode_data($data); + } + $data = substr($data, 1); + + return $list; + } + + /** Decode torrent string + * + * @param string data to decode + * + * @return string decoded string + */ + private static function decode_string(&$data) + { + if ('0' === self::char($data) && ':' != substr($data, 1, 1)) { + self::set_error(new Exception('Invalid string length, leading zero')); + } + if (!$colon = @strpos($data, ':')) { + return self::set_error(new Exception('Invalid string length, colon not found')); + } + $length = intval(substr($data, 0, $colon)); + if ($length + $colon + 1 > strlen($data)) { + return self::set_error(new Exception('Invalid string, input too short for string length')); + } + $string = substr($data, $colon + 1, $length); + $data = substr($data, $colon + $length + 1); + + return $string; + } + + /** Decode torrent integer + * + * @param string data to decode + * + * @return int decoded integer + */ + private static function decode_integer(&$data) + { + $start = 0; + $end = strpos($data, 'e'); + if (0 === $end) { + self::set_error(new Exception('Empty integer')); + } + if ('-' == self::char($data)) { + ++$start; + } + if ('0' == substr($data, $start, 1) && $end > $start + 1) { + self::set_error(new Exception('Leading zero in integer')); + } + if (!ctype_digit(substr($data, $start, $start ? $end - 1 : $end))) { + self::set_error(new Exception('Non-digit characters in integer')); + } + $integer = substr($data, 0, $end); + $data = substr($data, $end + 1); + + return 0 + $integer; + } + + /**** Internal Helpers ****/ + + /** Build torrent info + * + * @param string|array source folder/file(s) path + * @param int piece length + * + * @return array|bool torrent info or false if data isn't folder/file(s) + */ + protected function build($data, $piece_length) + { + if (is_null($data)) { + return false; + } elseif (is_array($data) && self::is_list($data)) { + return $this->info = $this->files($data, $piece_length); + } elseif (is_dir($data)) { + return $this->info = $this->folder($data, $piece_length); + } elseif ((is_file($data) || self::url_exists($data)) && !self::is_torrent($data)) { + return $this->info = $this->file($data, $piece_length); + } else { + return false; + } + } + + /** Set torrent creator and creation date + * + * @param any param + * + * @return any param + */ + protected function touch($void = null) + { + $this->{'created by'} = 'Torrent RW PHP Class - http://github.com/adriengibrat/torrent-rw'; + $this->{'creation date'} = time(); + + return $void; + } + + /** Add an error to errors stack + * + * @param Exception error to add + * @param bool return error message or not (optional, default to false) + * + * @return bool|string return false or error message if requested + */ + protected static function set_error($exception, $message = false) + { + return (array_unshift(self::$_errors, $exception) && $message) ? $exception->getMessage() : false; + } + + /** Build announce list + * + * @param string|array announce url / list + * @param string|array announce url / list to add (optionnal) + * + * @return array announce list (array of arrays) + */ + protected static function announce_list($announce, $merge = []) + { + return array_map(function($a) {return (array) $a;}, array_merge((array) $announce, (array) $merge)); + } + + /** Get the first announce url in a list + * + * @param array announce list (array of arrays if tiered trackers) + * + * @return string first announce url + */ + protected static function first_announce($announce) + { + while (is_array($announce)) { + $announce = reset($announce); + } + + return $announce; + } + + /** Helper to pack data hash + * + * @param string data + * + * @return string packed data hash + */ + protected static function pack(&$data) + { + return pack('H*', sha1($data)) . ($data = null); + } + + /** Helper to build file path + * + * @param array file path + * @param string base folder + * + * @return string real file path + */ + protected static function path($path, $folder) + { + array_unshift($path, $folder); + + return join(DIRECTORY_SEPARATOR, $path); + } + + /** Helper to explode file path + * + * @param string file path + * + * @return array file path + */ + protected static function path_explode($path) + { + return explode(DIRECTORY_SEPARATOR, $path); + } + + /** Helper to test if an array is a list + * + * @param array array to test + * + * @return bool is the array a list or not + */ + protected static function is_list($array) + { + foreach (array_keys($array) as $key) { + if (!is_int($key)) { + return false; + } + } + + return true; + } + + /** Build pieces depending on piece length from a file handler + * + * @param ressource file handle + * @param int piece length + * @param bool is last piece + * + * @return string pieces + */ + private function pieces($handle, $piece_length, $last = true) + { + static $piece, $length; + if (empty($length)) { + $length = $piece_length; + } + $pieces = null; + while (!feof($handle)) { + if (($length = strlen($piece .= fread($handle, $length))) == $piece_length) { + $pieces .= self::pack($piece); + } elseif (($length = $piece_length - $length) < 0) { + return self::set_error(new Exception('Invalid piece length!')); + } + } + fclose($handle); + + return $pieces . ($last && $piece ? self::pack($piece) : null); + } + + /** Build torrent info from single file + * + * @param string file path + * @param int piece length + * + * @return array torrent info + */ + private function file($file, $piece_length) + { + if (!$handle = self::fopen($file, $size = self::filesize($file))) { + return self::set_error(new Exception('Failed to open file: "' . $file . '"')); + } + if (self::is_url($file)) { + $this->url_list($file); + } + $path = self::path_explode($file); + + return [ + 'length' => $size, + 'name' => end($path), + 'piece length' => $piece_length, + 'pieces' => $this->pieces($handle, $piece_length), + ]; + } + + /** Build torrent info from files + * + * @param array file list + * @param int piece length + * + * @return array torrent info + */ + private function files($files, $piece_length) + { + sort($files); + usort($files, function($a, $b) { + return strrpos($a,DIRECTORY_SEPARATOR)-strrpos($b,DIRECTORY_SEPARATOR); + }); + $first = current($files); + if (!self::is_url($first)) { + $files = array_map('realpath', $files); + } else { + $this->url_list(dirname($first) . DIRECTORY_SEPARATOR); + } + $files_path = array_map('self::path_explode', $files); + $root = call_user_func_array('array_intersect_assoc', $files_path); + $pieces = null; + $info_files = []; + $count = count($files) - 1; + foreach ($files as $i => $file) { + if (!$handle = self::fopen($file, $filesize = self::filesize($file))) { + self::set_error(new Exception('Failed to open file: "' . $file . '" discarded')); + continue; + } + $pieces .= $this->pieces($handle, $piece_length, $count == $i); + $info_files[] = [ + 'length' => $filesize, + 'path' => array_diff_assoc($files_path[$i], $root), + ]; + } + + return [ + 'files' => $info_files, + 'name' => end($root), + 'piece length' => $piece_length, + 'pieces' => $pieces, + ]; + } + + /** Build torrent info from folder content + * + * @param string folder path + * @param int piece length + * + * @return array torrent info + */ + private function folder($dir, $piece_length) + { + return $this->files(self::scandir($dir), $piece_length); + } + + /** Helper to return the first char of encoded data + * + * @param string encoded data + * + * @return string|bool first char of encoded data or false if empty data + */ + private static function char($data) + { + return empty($data) ? + false : + substr($data, 0, 1); + } + + /**** Public Helpers ****/ + + /** Helper to format size in bytes to human readable + * + * @param int size in bytes + * @param int precision after coma + * + * @return string formated size in appropriate unit + */ + public static function format($size, $precision = 2) + { + $units = [ + 'octets', + 'Ko', + 'Mo', + 'Go', + 'To', + ]; + while (($next = next($units)) && $size > 1024) { + $size /= 1024; + } + + return round($size, $precision) . ' ' . ($next ? prev($units) : end($units)); + } + + /** Helper to return filesize (even bigger than 2Gb -linux only- and distant files size) + * + * @param string file path + * + * @return float|bool filesize or false if error + */ + public static function filesize($file) + { + if (is_file($file)) { + return (float) sprintf('%u', @filesize($file)); + } elseif ($content_length = preg_grep($pattern = '#^Content-Length:\s+(\d+)$#i', (array) @get_headers($file))) { + return (int) preg_replace($pattern, '$1', reset($content_length)); + } + } + + /** Helper to open file to read (even bigger than 2Gb, linux only) + * + * @param string file path + * @param int|float file size (optional) + * + * @return resource|bool file handle or false if error + */ + public static function fopen($file, $size = null) + { + if ((is_null($size) ? self::filesize($file) : $size) <= 2 * pow(1024, 3)) { + return fopen($file, 'r'); + } elseif (PHP_OS != 'Linux') { + return self::set_error(new Exception('File size is greater than 2GB. This is only supported under Linux')); + } elseif (!is_readable($file)) { + return false; + } else { + return popen('cat ' . escapeshellarg(realpath($file)), 'r'); + } + } + + /** Helper to scan directories files and sub directories recursively + * + * @param string directory path + * + * @return array directory content list + */ + public static function scandir($dir) + { + $paths = []; + foreach (scandir($dir) as $item) { + if ('.' != $item && '..' != $item) { + if (is_dir($path = realpath($dir . DIRECTORY_SEPARATOR . $item))) { + $paths = array_merge(self::scandir($path), $paths); + } else { + $paths[] = $path; + } + } + } + + return $paths; + } + + /** Helper to check if string is an url (http) + * + * @param string url to check + * + * @return bool is string an url + */ + public static function is_url($url) + { + return preg_match('#^http(s)?://[a-z0-9-]+(.[a-z0-9-]+)*(:[0-9]+)?(/.*)?$#i', $url); + } + + /** Helper to check if url exists + * + * @param string url to check + * + * @return bool does the url exist or not + */ + public static function url_exists($url) + { + return self::is_url($url) ? + (bool) self::filesize($url) : + false; + } + + /** Helper to check if a file is a torrent + * + * @param string file location + * @param float http timeout (optional, default to self::timeout 30s) + * + * @return bool is the file a torrent or not + */ + public static function is_torrent($file, $timeout = self::timeout) + { + return ($start = self::file_get_contents($file, $timeout, 0, 11)) + && 'd8:announce' === $start + || 'd10:created' === $start + || 'd13:creatio' === $start + || 'd13:announc' === $start + || 'd12:_info_l' === $start + || 'd7:comment' === substr($start, 0, 10) // @see https://github.com/adriengibrat/torrent-rw/issues/32 + || 'd4:info' === substr($start, 0, 7) + || 'd9:' === substr($start, 0, 3); // @see https://github.com/adriengibrat/torrent-rw/pull/17 + } + + /** Helper to get (distant) file content + * + * @param string file location + * @param float http timeout (optional, default to self::timeout 30s) + * @param int starting offset (optional, default to null) + * @param int content length (optional, default to null) + * + * @return string|bool file content or false if error + */ + public static function file_get_contents($file, $timeout = self::timeout, $offset = null, $length = null) + { + if (is_file($file) || ini_get('allow_url_fopen')) { + $context = !is_file($file) && $timeout ? + stream_context_create(['http' => ['timeout' => $timeout]]) : + null; + + return !is_null($offset) ? $length ? + @file_get_contents($file, false, $context, $offset, $length) : + @file_get_contents($file, false, $context, $offset) : + @file_get_contents($file, false, $context); + } elseif (!function_exists('curl_init')) { + return self::set_error(new Exception('Install CURL or enable "allow_url_fopen"')); + } + $handle = curl_init($file); + if ($timeout) { + curl_setopt($handle, CURLOPT_TIMEOUT, $timeout); + } + if ($offset || $length) { + curl_setopt($handle, CURLOPT_RANGE, $offset . '-' . ($length ? $offset + $length - 1 : null)); + } + curl_setopt($handle, CURLOPT_RETURNTRANSFER, 1); + $content = curl_exec($handle); + $size = curl_getinfo($handle, CURLINFO_CONTENT_LENGTH_DOWNLOAD); + curl_close($handle); + + return ($offset && $size == -1) || ($length && $length != $size) ? $length ? + substr($content, $offset, $length) : + substr($content, $offset) : + $content; + } + + /** Flatten announces list + * + * @param array announces list + * + * @return array flattened announces list + */ + public static function untier($announces) + { + $list = []; + foreach ((array) $announces as $tier) { + is_array($tier) ? + $list = array_merge($list, self::untier($tier)) : + array_push($list, $tier); + } + + return $list; + } +} diff --git a/src_php/php/Libs/torrent-rw/_config.yml b/src_php/php/Libs/torrent-rw/_config.yml new file mode 100755 index 0000000..c741881 --- /dev/null +++ b/src_php/php/Libs/torrent-rw/_config.yml @@ -0,0 +1 @@ +theme: jekyll-theme-slate \ No newline at end of file diff --git a/src_php/php/MapController.php b/src_php/php/MapController.php new file mode 100644 index 0000000..1085a0e --- /dev/null +++ b/src_php/php/MapController.php @@ -0,0 +1,334 @@ +fillRow($row); + $row->save(); + } + + function placePlayerFromTo($to_,$from_){ + + $row = Lazer::table(Constants::CONST_TABLE_MAP)->where('key', '=', $to_)->find(); + $level = Level::parseRow($row); + + //get the future player coordonates + $coord = $level -> placePlayerForKey($from_); + + //return Coord + return $coord; + } + + function getAllTiles(){ + return Tile::getAllTiles(); + } + + /************************** + * MAP PROCEDURAL GENERATION + *************************/ + + function generateWorld(){ + + //importnat VARS + $gridData; + $gridWidth = 2; + $gridHeight = 2; + + $levelToPlace; + $levelNumMax; + $levelWidthMax; + $levelHeightMax; + + //1. generate the dungeon grid + $gridData = $this->fillgrid(null, $gridWidth, $gridHeight); + + $levelToPlace = array(); + + array_push($levelToPlace, new Level(Constants::CONST_MAP_ALPHA_NAME, 15, 13, true, true)); + array_push($levelToPlace, new Level("request", 15, 13, true, false) ); + array_push($levelToPlace, new Level("conspi", 15, 13, true, false) ); + array_push($levelToPlace, new Level("art", 15, 13, true, false) ); + + array_push($levelToPlace, new Level("lulz", 15, 13, true, true) ); + /* + $size = Level::getDim(26); + array_push($levelToPlace, new Level("tripletrap", $size->x, $size->y, true)); + $size = Level::getDim(26); + array_push($levelToPlace, new Level("pol", $size->x, $size->y, true) ); + $size = Level::getDim(26); + array_push($levelToPlace, new Level("senpai", $size->x, $size->y, true)); + $size = Level::getDim(26); + array_push($levelToPlace, new Level("varg", $size->x, $size->y, true) ); + $size = Level::getDim(26); + array_push($levelToPlace, new Level("crypto", $size->x, $size->y, true) );*/ + + //2. place the main level on this grid + /* + foreach ($levelToPlace as $lvl){ + $coord = $this->pickPointFromGrid($gridData , $gridWidth, $gridHeight ); + if(isset($coord)){ + $gridData = $this->placeToGrid($gridData, $lvl, $gridWidth, $gridHeight, $coord ); + $lvl -> x = $coord-> x; + $lvl -> y = $coord-> y; + } + }*/ + + //Genrate room for missing points + /* + $emptyCoord = $this->getCoordsFor($gridData, NULL, $gridWidth, $gridHeight); + + for($l = 0; $l < count($levelToPlace); $l++){ + $index = rand(0, count($emptyCoord)-1 ); + $coord = $emptyCoord[$index]; + $level = new Level("???", rand(2,7), rand(2,7), false ); + $gridData = $this->placeToGrid($gridData, $level , $gridWidth, $gridHeight, $coord); + array_splice($emptyCoord, $index, 1); + $level-> x = $coord-> x; + $level-> y = $coord-> y; + if(count($emptyCoord) < 1) break; + }*/ + + $this->displayGrid($gridData, $gridWidth, $gridHeight, true); + + + //3. each level need to have at least 1 door + /* + $allLevels = $this->getAllLevels($gridData); + foreach ($allLevels as $lvl){ + + $dir = 0; + $numDoors = rand(1,2); + + for( $dir; $dir < 3; $dir ++ ){ + + //CAUTION level found are the door on the other direction!!! + + $levelFound = null; + $oppDir; + $coord = new Coord($lvl-> x, $lvl-> y); + + //South + if($dir == 2 ){ + + $levelFound = $this->getLevelForDir($gridData, $gridWidth, $gridHeight, $coord,$dir); + if(isset( $levelFound->door_key_N )) $levelFound = null; + $oppDir = 0; + + } + + //West + if($dir == 3 ){ + + $levelFound = $this->getLevelForDir($gridData, $gridWidth, $gridHeight, $coord,$dir); + if(isset( $levelFound->door_key_E )) $levelFound = null; + $oppDir = 1; + + } + + //North + if($dir == 0){ + + $levelFound = $this->getLevelForDir($gridData, $gridWidth, $gridHeight, $coord,$dir); + if(isset( $levelFound->door_key_S )) $levelFound = null; + $oppDir = 2; + + } + + //East + if($dir == 1 ){ + + $levelFound = $this->getLevelForDir($gridData, $gridWidth, $gridHeight, $coord,$dir); + if(isset( $levelFound->door_key_W )) $levelFound = null; + $oppDir = 3; + + } + + if( isset($levelFound) && $numDoors > 0){ + $levelFound -> setKeyForDir($lvl->key, $oppDir); + $lvl-> setKeyForDir($levelFound->key, $dir); + $numDoors --; + } + } + + //echo $lvl->name." has ".$lvl->getNumDoors()." doors
"; + + }*/ + + //Get the level + foreach ($levelToPlace as $lvl){ + $lvl -> initLevelData(); + $this->createLevel($lvl); + } + + } + + /**************************** + * UTILS for PROCEDURAL + * Generation + ****************************/ + + function fillgrid($defaultTile_, $width_, $height_){ + + $newGrid = array(); + for ($i = 0; $i < ($height_*$width_); $i++) { + array_push($newGrid,$defaultTile_); + } + + return $newGrid; + } + + function pickPointFromGrid($gridData, $width_, $height_ ){ + + for ($i = 0; $i < 10; $i++) { + + $x = rand ( 0 , $width_-1); + $y = rand ( 0 , $height_-1); + + //is grid coordonate occupped? + $val = $gridData[ ($y*$height_) + $x]; + if( !isset($val)) return new Coord($x, $y); + } + + return NULL; + } + + function placeToGrid($gridData, $data, $width_, $height_, $coord){ + $gridData[ ( $coord->y *$width_) + $coord->x] = $data; + return $gridData; + } + + function getLevelForCoord($gridData_, $coord_, $width_, $height_){ + return $gridData_[ ( $coord_->y *$width_) + $coord_->x]; + } + + + + function getCoordsFor($gridData, $data, $width_, $height_){ + $listData = array(); + + for ($y = 0; $y < $height_; $y++) { + + for ($x = 0; $x < $width_; $x++) { + if( $gridData[ ($y*$width_) + $x] == $data) array_push($listData, new Coord($x, $y)); + } + + } + return $listData; + } + + /** + * Get all the levels from the griddata + * Return Level[] array; + */ + function getAllLevels($gridData){ + $levels = array(); + foreach ($gridData as $lvl){ + if(isset($lvl)) array_push($levels,$lvl); + } + return $levels; + } + + function displayGrid($gridData_, $width_, $height_, $is_null){ + + for ($y = 0; $y < $height_; $y++) { + + for ($x = 0; $x < $width_; $x++) { + if( !isset($gridData_[($y*$width_) + $x]) || !isset($gridData_[ ($y*$width_) + $x] -> name)){ + echo "."; + } else { + $name = $gridData_[ ($y*$width_) + $x] -> name; + echo substr($name,0,1); + } + } + + echo "
"; + + } + } + + function getLevelForDir($gridData_, $width_, $height_, $coord_,$dir_){ + + switch($dir_){ + + case 0: + for ($y = $coord_->y -1; $y >= 0; $y--) { + $coord = new Coord( $coord_->x,$y); + $level = $this->getLevelForCoord($gridData_, $coord, $width_, $height_); + if(isset($level)) return $level; + } + break; + + case 1: + + for ($x = $coord_->x +1; $x < $width_; $x++) { + $coord = new Coord( $x,$coord_->y); + $level = $this->getLevelForCoord($gridData_, $coord, $width_, $height_); + if(isset($level)){ + return $level; + } + } + break; + + + case 2: + for ($y = $coord_->y +1; $y < $height_; $y++) { + $coord = new Coord( $coord_->x,$y); + $level = $this->getLevelForCoord($gridData_, $coord, $width_, $height_); + if(isset($level)) return $level; + } + break; + + case 3: + + for ($x = $coord_->x -1; $x >= 0; $x--) { + $coord = new Coord( $x,$coord_->y); + $level = $this->getLevelForCoord($gridData_, $coord, $width_, $height_); + if(isset($level)) return $level; + } + break; + } + + return null; + + } +} diff --git a/src_php/php/Models/FakeFile.php b/src_php/php/Models/FakeFile.php new file mode 100644 index 0000000..a9cf862 --- /dev/null +++ b/src_php/php/Models/FakeFile.php @@ -0,0 +1,24 @@ + 'integer', + 'id_post' => 'integer', + 'thread_key' => 'string', + 'fake_path' => 'string', + 'fake_name' => 'string', + 'file_name' => 'string'*/ + + function __construct($file_path_, $file_ext_, $map_key ) { + + $name = uniqid(); + $this ->fake_name = $name.'.'.$file_ext_; + $this ->file_name = Helpers::getRealFileName($this ->fake_name).'.'.$file_ext_; + //$this ->fake_path = $file_path_."img/".$map_key."_". $this ->file_name; + $this ->fake_path = $file_path_."php/uploads/".$map_key."/".Helpers::getRealFileName($this ->fake_name).'.'.$file_ext_; + $this ->map_key = $map_key; + + } + +} \ No newline at end of file diff --git a/src_php/php/Models/Game/Coord.php b/src_php/php/Models/Game/Coord.php new file mode 100644 index 0000000..68f7e2d --- /dev/null +++ b/src_php/php/Models/Game/Coord.php @@ -0,0 +1,13 @@ + x = $x; + $this-> y = $y; + } + + +} diff --git a/src_php/php/Models/Game/GameData.php b/src_php/php/Models/Game/GameData.php new file mode 100644 index 0000000..cea54e0 --- /dev/null +++ b/src_php/php/Models/Game/GameData.php @@ -0,0 +1,15 @@ + name = "sponge"; + $item-> action = "post delete"; + $item-> type = "posting"; + $item-> description = "The sponge give you the ability to make disappear a post that isn't canon"; + $item-> is_expendable = true; + $item-> valueMin = 1; + $item-> valueMax = 3; + $item-> itemsPerPlayer = 1; + array_push( $items ,$item); + + /* + $item = new Item(); + $item-> name = "ring of upload"; + $item-> action = "upload"; + $item-> type = "posting"; + $item-> description = "Give you the ability to upload picture when you post"; + $item-> is_expendable = false; + $item-> valueMin = 10; + $item-> valueMax = 18; + $item-> itemsPerPlayer = 1; + array_push( $items ,$item); + + $item = new Item(); + $item-> name = "pen"; + $item-> action = "drawing"; + $item-> type = "posting"; + $item-> description = "Give you the ability to draw"; + $item-> is_expendable = true; + $item-> valueMin = 1; + $item-> valueMax = 10; + $item-> itemsPerPlayer = 10; + array_push( $items ,$item); + + $item = new Item(); + $item-> name = "black powder"; + $item-> action = "canon"; + $item-> type = "posting"; + $item-> description = "Set a post as canon"; + $item-> is_expendable = true; + $item-> valueMin = 1; + $item-> valueMax = 5; + $item-> itemsPerPlayer = 3; + array_push( $items ,$item); + + $item = new Item(); + $item-> name = "knife"; + $item-> action = "harm"; + $item-> type = "fight"; + $item-> description = "You can kill enemies from the dungeon or even other anons"; + $item-> is_expendable = true; + $item-> valueMin = 99; + $item-> valueMax = 100; + $item-> itemsPerPlayer = 1; + array_push( $items ,$item); + + $item = new Item(); + $item-> name = "rope"; + $item-> action = "bound"; + $item-> type = "fight"; + $item-> description = "You bound certain enemies and anons"; + $item-> is_expendable = true; + $item-> valueMin = 2; + $item-> valueMax = 4; + $item-> itemsPerPlayer = 1; + array_push( $items ,$item);*/ + + return $items; + } +} \ No newline at end of file diff --git a/src_php/php/Models/Game/Level.php b/src_php/php/Models/Game/Level.php new file mode 100644 index 0000000..65b7541 --- /dev/null +++ b/src_php/php/Models/Game/Level.php @@ -0,0 +1,362 @@ + name = $name; + $this-> width = $width; + $this-> height = $height; + $this-> is_chan = $is_chan; + $this-> is_secret = $is_secret; + $this-> key = $name; + } + + public function setKeyForDir($key_,$dir_){ + switch($dir_){ + + case 0: + $this -> door_key_n = $key_; + break; + + case 1: + $this -> door_key_e = $key_; + break; + + case 2: + $this -> door_key_s = $key_; + break; + + case 3: + $this -> door_key_w = $key_; + break; + } + } + + public function getNumDoors(){ + $num = 0; + if(isset($this -> door_key_n)) $num ++; + if(isset($this -> door_key_e)) $num ++; + if(isset($this -> door_key_s)) $num ++; + if(isset($this -> door_key_w)) $num ++; + return $num; + } + + public function getDoorCoordKey($key_){ + + $x = 0; + $y = 0; + + //test N + if($key_ == $this -> door_key_n){ + for($x = 0 ; $x < $this->width ; $x++ ){ + $tile = $this -> pickTile($this->width, $this->height,new Coord($x , $y)); + if($tile == Tile::getValueForName("gate")) return new Coord($x,$y); + } + } else if($key_ == $this -> door_key_e){ + $x = $this->width - 1; + for($y = 0 ; $y < $this->height ; $y++ ){ + $tile = $this -> pickTile( $this->width, $this->height, new Coord($x , $y)); + if($tile == Tile::getValueForName("gate")) return new Coord($x,$y); + } + + } else if($key_ == $this -> door_key_s){ + $y = $this->height - 1; + for($x = 0 ; $x < $this->width ; $x++ ){ + $tile = $this -> pickTile($this->width, $this->height,new Coord($x , $y)); + if($tile == Tile::getValueForName("gate")) return new Coord($x,$y); + } + }else if($key_ == $this -> door_key_w){ + for($y = 0 ; $y < $this->height ; $y++ ){ + $tile = $this -> pickTile($this->width, $this->height,new Coord($x , $y)); + if($tile == Tile::getValueForName("gate")) return new Coord($x,$y); + } + } + + return null; + } + + public function placePlayerForKey($key_){ + + $coord = $this -> getDoorCoordKey($key_); + + if($coord->y == 0) { + return new Coord($coord->x , $coord->y+1); + } else if($coord->x == $this->width-1) { + return new Coord($coord->x-1 , $coord->y); + }else if($coord->y == $this->height-1) { + return new Coord($coord->x , $coord->y-1); + }else if($coord->x == 0) { + return new Coord($coord->x+1 , $coord->y); + } + + return new Coord(1 , 1); + } + + public function initLevelData(){ + + //New version: all the level are the same + $this->level_data = + [ + 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, + 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1, + 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1, + 1,0,0,1,1,1,1,1,1,1,1,1,1,1,1,0,0,1, + 1,0,0,1,0,0,0,0,0,1,0,4,0,0,1,0,0,1, + 1,0,0,1,0,0,13,0,0,1,0,1,0,0,1,0,0,1, + 1,0,0,1,0,0,0,0,0,1,0,1,0,0,1,0,0,1, + 1,0,0,1,0,0,0,0,0,1,3,1,0,0,1,0,0,1, + 1,0,0,1,1,1,4,1,1,1,1,1,0,0,1,0,0,1, + 1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1, + 1,1,1,1,1,1,1,1,1,1,1,1,0,0,1,0,0,1, + 1,0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,1, + 14,0,0,0,0,0,0,0,0,0,0,5,0,0,0,0,0,1, + 1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1, + 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 + ]; + + $this-> width = 18; + $this-> height = 15; + + + /* + //Create a middle room + //Middle room looks cool everywhere + $this->fillgrid(Tile::getValueForName("ground"), $this->width, $this->height); + + //Place wall + $this->makeWallForLevel(); + + //place gates + $coord = new Coord(0,0); + + if(isset( $this -> door_key_n)){ + $coord ->y = 0; + $coord ->x = rand(1, $this->width-2); + $this->placeToLevel(Tile::getValueForName("gate"), $this->width, $this->height, $coord); + } + + if(isset( $this -> door_key_e)){ + $coord ->y = rand(1, $this->height-2); + $coord ->x = $this->width-1; + $this->placeToLevel(Tile::getValueForName("gate"), $this->width, $this->height, $coord); + } + + if(isset( $this -> door_key_s)){ + $coord ->y = $this->height-1; + $coord ->x = rand(1, $this->width-2); + $this->placeToLevel(Tile::getValueForName("gate"), $this->width, $this->height, $coord); + } + + if(isset( $this -> door_key_w)){ + $coord ->y = rand(1, $this->height-2); + $coord ->x = 0; + $this->placeToLevel(Tile::getValueForName("gate"), $this->width, $this->height, $coord); + }*/ + + //Display the level + $this -> displayLevelData(); + } + + function makeWallForLevel(){ + + //North wall + $y = 0; + for ($x = 0 ; $x <= $this-> width ; $x++){ + $coord = new Coord($x,$y); + $this->placeToLevel(Tile::getValueForName("wall"), $this->width, $this->height, $coord); + } + + //South wall + $y = $this->height-1; + for ($x = 0 ; $x < $this-> width ; $x++){ + $coord = new Coord($x,$y); + $this->placeToLevel(Tile::getValueForName("wall"), $this->width, $this->height, $coord); + } + + //West + $x = 0; + for ($y = 0 ; $y < $this-> height ; $y++){ + $coord = new Coord($x,$y); + $this->placeToLevel(Tile::getValueForName("wall"), $this->width, $this->height, $coord); + } + + //Est + $x = $this->width-1; + for ($y = 0 ; $y < $this-> height ; $y++){ + $coord = new Coord($x,$y); + $this->placeToLevel(Tile::getValueForName("wall"), $this->width, $this->height, $coord); + } + } + + public function displayLevelData(){ + echo "# MAP ".$this->name." num tiles:".count($this->level_data)."
"; + + $x = 0; + $y = 0; + + foreach($this->level_data as $data){ + //echo "x:".$x."y:".$y."
"; + /* + if(!isset( $data ) || $data == Tile::getValueForName("wall") ){ + echo "#"; + } else if($data == Tile::getValueForName("ground")) { + echo "."; + } else if($data == Tile::getValueForName("door")) { + //echo "x:".$x."y:".$y."
"; + echo "D"; + }*/ + + echo Tile::getDisplayForVal($data); + + $x ++; + if($x >= $this -> width){ + $x = 0; + $y ++; + echo "
"; + } + } + } + + //Level Data management + function fillgrid($defaultTile_, $width_, $height_){ + + $this->level_data = array(); + for ($i = 0; $i < $height_*$width_; $i++) { + array_push( $this->level_data ,$defaultTile_); + } + + } + + function placeToLevel($data, $width_, $height_, $coord){ + + $this->level_data [ ( $coord->y *$width_) + $coord->x] = $data; + } + + function pickTile($width_, $height_, $coord){ + return $this->level_data [ ( $coord->y *$width_)+ $coord->x]; + } + + //Fill a data base row + public function fillRow($row_){ + + echo "Write level: ".$this-> name."; for key".$this-> key." with ".count($this-> level_data)." data"; + $row_ -> key = $this-> key; + $row_ -> name = $this-> name; + $row_ -> theme = $this-> theme; + /* + $row_ -> x = $this-> x; + $row_ -> y = $this-> y; + */ + $row_ -> width = $this-> width; + $row_ -> height = $this-> height; + if(isset( $this-> door_key_n))$row_ -> door_key_n = $this-> door_key_n; + if(isset( $this-> door_key_e)) $row_ -> door_key_e = $this-> door_key_e; + if(isset( $this-> door_key_s)) $row_ -> door_key_s = $this-> door_key_s; + if(isset( $this-> door_key_w)) $row_ -> door_key_w = $this-> door_key_w; + + $dataString = ""; + + foreach( $this-> level_data as $data ){ + $dataString = $dataString.$data.","; + } + $dataString = $dataString .substr(0, strlen($dataString) - 1); + $row_ -> level_data = $dataString; + + $row_ -> is_safe = $this-> is_safe; + $row_ -> is_chan = $this-> is_chan; + $row_ -> is_secret = $this-> is_secret; + + //var_dump( $row_); + + return $row_; + } + + //Get Ground tiles + public function getEmptyCoord(){ + $coords = array(); + + $x = 0; + $y = 0; + foreach( $this-> level_data as $data ){ + + if((int) $data == Tile::getValueForName("ground")){ + $coord = new Coord($x,$y); + array_push($coords,$coord); + } + + $x ++; + if($x >= $this-> width){ + $y ++; + $x = 0; + } + } + + return $coords[rand( 0, count( $coords )-1)]; + } + + //Fill a data base row + public static function parseRow($row_){ + + $level = new Level("",0,0,false, false); + + $level -> key = $row_ -> key; + $level -> name = $row_ -> name; + $level -> theme = $row_ -> theme; + $level -> is_secret = $row_ -> is_secret; + $level -> x = $row_ -> x; + $level -> y = $row_ -> y; + $level -> width = $row_ -> width; + $level -> height = $row_ -> height; + if(isset( $row_-> door_key_n)) $level -> door_key_n = $row_-> door_key_n; + if(isset( $row_-> door_key_e)) $level -> door_key_e = $row_-> door_key_e; + if(isset( $row_-> door_key_s)) $level -> door_key_s = $row_-> door_key_s; + if(isset( $row_-> door_key_w)) $level -> door_key_w = $row_-> door_key_w; + + //parse the data + $level -> level_data = explode(",",$row_ -> level_data); + + $level -> is_safe = $row_-> is_safe; + $level -> is_chan = $row_-> is_chan; + + return $level ; + } + + //Fill a data base row + public static function getDim($num){ + + $minTile = 4; + if($num < $minTile ) $num = $minTile; + $width = rand ( $minTile , $num - $minTile ); + $height = $num - $width; + + return new Coord( $width, $height); + } + +} \ No newline at end of file diff --git a/src_php/php/Models/Game/Tile.php b/src_php/php/Models/Game/Tile.php new file mode 100644 index 0000000..370221a --- /dev/null +++ b/src_php/php/Models/Game/Tile.php @@ -0,0 +1,56 @@ + value = $value; + $this -> display = $display; + $this -> name = $name; + $this -> descitption = $descitption; + } + + public static function getAllTiles() + { + $tiles = array(); + array_push( $tiles, new Tile(0,".","ground","You can walk on it.")); + array_push( $tiles, new Tile(1,"█","wall","You cannot go thought it.")); + array_push( $tiles, new Tile(2,"#","drawable wall","Like a wall, but you can post on it.")); + array_push( $tiles, new Tile(3,"/","gate","An entrance to another level.")); + array_push( $tiles, new Tile(4,"D","door","You can open it.")); + array_push( $tiles, new Tile(5,"▓","fake wall","You can open it.")); + /* array_push( $tiles, new Tile(6,"*","trap","It can kill you.")); + array_push( $tiles, new Tile(7,";","grass","just green ground")); + array_push( $tiles, new Tile(8,"±","shrine","Special items goes there.")); + array_push( $tiles, new Tile(9,"f","fire","You cannot cross.")); + array_push( $tiles, new Tile(10,"R","fast food","You can fullfil your health here"));*/ + array_push( $tiles, new Tile(11,"t","seed","You will found torrent of the board here")); + //array_push( $tiles, new Tile(12,"A","Advertisement wall","It's used to display advertisement.")); + array_push( $tiles, new Tile(13,"s","Player start","It's the point of arrival of a player. All map need one")); + array_push( $tiles, new Tile(14,"|","gate secret","An entrance to secret level.")); + return $tiles; + } + + public static function getValueForName($name) + { + $tiles = Tile::getAllTiles(); + foreach ($tiles as $tile){ + if($tile->name == $name) return $tile->value; + } + + return -1; + } + + public static function getDisplayForVal($val) + { + $tiles = Tile::getAllTiles(); + foreach ($tiles as $tile){ + if($tile->value == $val) return $tile->display; + } + + return -1; + } +} \ No newline at end of file diff --git a/src_php/php/Models/Post.php b/src_php/php/Models/Post.php new file mode 100644 index 0000000..1eeec75 --- /dev/null +++ b/src_php/php/Models/Post.php @@ -0,0 +1,69 @@ + 'integer', + 'key' => 'string', + 'scale' => 'integer', + 'date' => 'integer', + 'player_ip' => 'string', + 'player_id' => 'integer', + 'is_canon' => 'boolean', + 'nsfw' => 'boolean', + 'player_name' => 'string', + 'thread_key' => 'string', + 'canvas_key' => 'string', + 'message' => 'string', + 'url' => 'string', + 'magnet' => 'string', + 'torrent' => 'string', + 'hash' => 'string' + */ + + public $id; + public $key; + public $scale; + public $date; + public $reply; + public $player_ip; + public $player_id; + public $is_canon; + public $nsfw; + public $player_name; + public $map_key; + public $canvas_key; + public $message; + public $url; + public $magnet; + public $hash; + public $graffiti; + + function __construct( ) { + + $this ->url = ""; + $this ->map_key = ""; + $this ->message = ""; + $this ->magnet = ""; + $this ->hash = ""; + $this ->player_name = "anonymous"; + $this ->graffiti = 'false'; + $this ->reply = ""; + + } + + function fillWithPostData(){ + + if( isset($_POST['tmap_key']) ) $this -> map_key = $_POST['map_key']; + if( isset($_POST['canvas_key']) ) $this -> canvas_key = $_POST['canvas_key']; + + if( isset($_POST['message']) ) $this -> message = $_POST['message']; + if( isset($_POST['magnet']) ) $this -> magnet = $_POST['magnet']; + if( isset($_POST['url']) ) $this -> url = $_POST['url']; + if( isset($_POST['hash']) ) $this -> hash = $_POST['hash']; + if( isset($_POST['graffiti']) ) $this -> graffiti = $_POST['graffiti']; + if( isset($_POST['reply']) ) $this -> reply = $_POST['reply']; + + } + +} \ No newline at end of file diff --git a/src_php/php/Utils/Constants.php b/src_php/php/Utils/Constants.php new file mode 100644 index 0000000..d7c5e71 --- /dev/null +++ b/src_php/php/Utils/Constants.php @@ -0,0 +1,51 @@ + $isOk, + 'result' => $result, + 'error' => $error + ); + + header("Content-type: application/json"); + echo json_encode($response); + exit(); + + } + + /** + * Get the user IP + */ + public static function getClientIp() { + // IP si internet partagé + if (isset($_SERVER['HTTP_CLIENT_IP'])) { + return $_SERVER['HTTP_CLIENT_IP']; + } + // IP derrière un proxy + elseif (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) { + return $_SERVER['HTTP_X_FORWARDED_FOR']; + } + // Sinon : IP normale + else { + return (isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : ''); + } + } + + /** + * CHECK IF BASE64 code is an image + */ + public static function check_base64_image($base64) { + + $img = imagecreatefromstring(base64_decode($base64)); + if (!$img) { + return false; + } + + imagepng($img, 'tmp.png'); + $info = getimagesize('tmp.png'); + + unlink('tmp.png'); + + if ($info[0] > 0 && $info[1] > 0 && $info['mime']) { + return true; + } + + return false; + } + + /* + * Check Base64 size + */ + public static function getBase64ImageSize($base64Image){ //return memory size in B, KB, MB + try{ + $size_in_bytes = (int) (strlen(rtrim($base64Image, '=')) * 3 / 4); + $size_in_kb = $size_in_bytes / 1024; + + return $size_in_kb; + } + catch(Exception $e){ + return $e; + } + } + + /** + * Generate random Token + */ + public static function generateToken(){ + //Generate a random string. + $token = openssl_random_pseudo_bytes(16); + + //Convert the binary data into hexadecimal representation. + return bin2hex($token); + } + + /** + * Hash password + */ + public static function hash_pw($plain_pw) + { + // (optional) change logic here for different hash algorithm + //return password_hash($plain_pw, PASSWORD_DEFAULT); + return md5($plain_pw); + } + + /** + * Verify hashed password + */ + public static function verify_pw($plain_pw, $hashed_pw) + { + // (optional) change logic here for different hash algorithm + //return password_verify($plain_pw, $hashed_pw); + return (md5($plain_pw)==$hashed_pw); + } + + + /** + * Get Real File Name + */ + public static function getRealFileName($fileName_) + { + + return md5($fileName_.'_'.Constants::CONST_IMAGE_SALT); + } + +} \ No newline at end of file diff --git a/src_php/php/admin.php b/src_php/php/admin.php new file mode 100644 index 0000000..7c31f09 --- /dev/null +++ b/src_php/php/admin.php @@ -0,0 +1,241 @@ + + + + + + + ADMIN OF THE BOARD + + +
===================
+
ADMIN OF THE BOARD
+
===================
+ +
+
Manage the database player+arts here.
+
Map powered by LAZER®
+
+ +
Admin pswd: +
+
+ + +
+ +
+
------------------------
+
List of the different WS
+
+ +
+ +
+ + +
+
+ +
------------------------
+
Web service response
+ + +
+
+ + + + + + \ No newline at end of file diff --git a/src_php/php/config/settings.json b/src_php/php/config/settings.json new file mode 100644 index 0000000..d2fcb79 --- /dev/null +++ b/src_php/php/config/settings.json @@ -0,0 +1,9 @@ +{ + "name":"Noodle Demo", + "description":"Test server with Noodle-IB. ✌⊂(✰‿✰)つ✌", + "rules":"Your rules here.", + "bannerImg":"https://pbs.twimg.com/media/DmBnJhaW4AAiZtn.jpg", + "contact":"alexkrunch@gmail.com", + "isMap":false, + "flavours":["alpha","techno","oktaku"] +} \ No newline at end of file diff --git a/src_php/php/data/.htaccess b/src_php/php/data/.htaccess new file mode 100755 index 0000000..a8b3e00 --- /dev/null +++ b/src_php/php/data/.htaccess @@ -0,0 +1,2 @@ +# Block External Access +deny from all diff --git a/src_php/php/password/.htaccess b/src_php/php/password/.htaccess new file mode 100755 index 0000000..a8b3e00 --- /dev/null +++ b/src_php/php/password/.htaccess @@ -0,0 +1,2 @@ +# Block External Access +deny from all diff --git a/src_php/php/tracker/announce.php b/src_php/php/tracker/announce.php new file mode 100755 index 0000000..ac60b97 --- /dev/null +++ b/src_php/php/tracker/announce.php @@ -0,0 +1,358 @@ +. +*/ + +/************************* + ** Configuration start ** + *************************/ + +/* + * Enable debugging? + * This allows anyone to see the entire peer database by appending ?debug to the announce URL. + * It will also create debugging file used to report php errors. + */ +define('__DEBUGGING_ENABLED', true); + +/** + * Version + */ +define('__VERSION', 1.5); + +/** + * How often should clients pull server for new clients? (Seconds) + */ +define('__INTERVAL', 1800); + +/** + * What's the minimum interval a client may pull the server? (Seconds) + * Some bittorrent clients does not obey this + */ +define('__INTERVAL_MIN', 300); + +/** + * How long should we wait for a client to re-announce after the last announce expires? (Seconds) + */ +define('__CLIENT_TIMEOUT', 60); + +/** + * Skip sending the peer id if client does not want it? + * Hint: Should be set to true + */ +define('__NO_PEER_ID', true); + +/** + * Should seeders not see each others? + * Hint: Should be set to true + */ +define('__NO_SEED_P2P', true); + +/** + * Where should we save the peer database + * On Linux, you should use /dev/shm as it is very fast. + * On Windows, you will need to change this value to some other valid path such as C:/Peers.txt + */ +define('__LOCATION_PEERS', 'peers.txt'); + +/** + * Should we enable short announces? + * This allows NATed clients to get updates much faster, but it also + * takes more load on the server. (This is just an experimental feature which may be turned off) + */ +define('__ENABLE_SHORT_ANNOUNCE', false); + +/** + * In case someone tries to access the tracker using a browser, redirect to this URL or file + */ +define('__REDIR_BROWSER', ''); + +define('__LOG_FILE', __DIR__ . '/error.log'); + +/*********************** + ** Configuration end ** + ***********************/ + +if(__DEBUGGING_ENABLED === true) { + + set_error_handler(function ($errno, $errstr, $errfile, $errline) { + + if (file_exists(__LOG_FILE) === false) { + $handle = fopen(__LOG_FILE, 'w+b'); + fclose($handle); + } + + file_put_contents(__LOG_FILE, sprintf('Line: %s - Error: %s', $errline, $errstr)); + + }, E_ALL); + +} + +//Send response as text +header('Content-type: Text/Plain'); +header('X-Tracker-Version: Bitstorm ' . __VERSION); //Please give me some credit + +/** + * If you *really* dont want to, comment this line out. + * Bencoding function, returns a bencoded dictionary. + * You may go ahead and enter custom keys in the dictionary in this function if you'd like. + */ + +function track($list, $interval = 60, $min_ival = 0) +{ + if (is_string($list)) { //Did we get a string? Return an error to the client + return 'd14:failure reason' . strlen($list) . ':' . $list . 'e'; + } + + $p = ''; //Peer directory + $c = $i = 0; //Complete and Incomplete clients + + foreach ($list as $d) { //Runs for each client + if ($d[7]) { //Are we seeding? + $c++; //Seeding, add to complete list + if (__NO_SEED_P2P && is_seed()) { //Seeds should not see each others + continue; + } + } else { + $i++; //Not seeding, add to incomplete list + } + + //Do some bencoding + $pid = ''; + + if (isset($_GET['no_peer_id']) === false && __NO_PEER_ID) { //Shall we include the peer id + $pid = '7:peer id' . strlen($d[1]) . ':' . $d[1]; + } + + $p .= 'd2:ip' . strlen($d[0]) . ':' . $d[0] . $pid . '4:porti' . $d[2] . 'ee'; + } + + //Add some other paramters in the dictionary and merge with peer list + $r = 'd8:intervali' . $interval . 'e12:min intervali' . $min_ival . 'e8:completei' . $c . 'e10:incompletei' . $i . 'e5:peersl' . $p . 'ee'; + + return $r; +} + +//Find out if we are seeding or not. Assume not if unknown. +function is_seed() +{ + return (isset($_GET['left']) && (int)$_GET['left'] === 0); +} + +/* +* Yeah, this is the database engine. It's pretty bad, uses files to store peers. +* Should be easy to rewrite to use SQL instead. +* +* Yes, sometimes collisions may occur and screw the DB over. It might or might not +* recover by itself. +*/ + +//Save database to file +function db_save($data) +{ + $b = serialize($data); + $handle = fopen(__LOCATION_PEERS, 'wb'); + + if ($handle === false) { + return false; + } + + if (flock($handle, LOCK_EX) === false) { + return false; + } + + fwrite($handle, $b); + fclose($handle); + + return true; +} + +//Load database from file +function db_open() +{ + $p = ''; + $handle = fopen(__LOCATION_PEERS, 'rb'); + if ($handle === false) { + return false; + } + + if (flock($handle, LOCK_EX) === false) { + return false; + } + + while (feof($handle) === false) { + $p .= fread($handle, 512); + } + + fclose($handle); + + return ((string)$p !== '') ? unserialize($p) : true; +} + +//Check if DB file exists, otherwise create it +function db_exists($createEmpty = false) +{ + if (file_exists(__LOCATION_PEERS) === true) { + return true; + } + + if ($createEmpty === true) { + return db_save([]); + } + + return false; +} + +//Default announce time +$interval = __INTERVAL; + +//Minimal announce time (does not apply to short announces) +$interval_min = __INTERVAL_MIN; + +/* +* This is a pretty smart feature not present in other tracker software. +* If you expect to have many NATed clients, add short as a GET parameter, +* and clients will pull much more often. +* +* This can be done automatically, simply try to open a TCP connection to +* the client and assume it is NATed if not successful. +*/ +if (isset($_GET['short']) && __ENABLE_SHORT_ANNOUNCE) { + $interval = 120; + $interval_min = 30; +} + +//Did we get any parameters at all? +//Client is probably a web browser, do a redirect +if (empty($_GET)) { + header('Location: ' . __REDIR_BROWSER); + die(); +} + +//Create database if it does not exist +db_exists(true) or die(track('Unable to create database')); +$d = db_open(); + +//Do we want to debug? (Should not be used by default) +if (isset($_GET['debug']) && __DEBUGGING_ENABLED) { + echo 'Connected peers:' . count($d) . "\n\n"; + die(); +} + +//Did we get a failure from the database? +if ($d === false) { + die(track('Database failure')); +} + +//Do some input validation +function valdata($g, $must_be_20_chars = false) +{ + if (!isset($_GET[$g])) { + die(track('Missing one or more arguments')); + } + if (!is_string($_GET[$g])) { + die(track('Invalid types on one or more arguments')); + } + if ($must_be_20_chars && strlen($_GET[$g]) != 20) { + die(track('Invalid length on ' . $g . ' argument')); + } + if (strlen($_GET[$g]) > 128) { //128 chars should really be enough + die(track('Argument ' . $g . ' is too large to handle')); + } +} + +//Inputs that are needed, do not continue without these +valdata('peer_id', true); +valdata('port'); +valdata('info_hash', true); + +//Use the tracker key extension. Makes it much harder to steal a session. +if (!isset($_GET['key'])) { + $_GET['key'] = ''; +} +valdata('key'); + +//Do we have a valid client port? +if (!ctype_digit($_GET['port']) || $_GET['port'] < 1 || $_GET['port'] > 65535) { + die(track('Invalid client port')); +} + +//Array key, unique for each client and torrent +$sum = sha1($_GET['peer_id'] . $_GET['info_hash']); + +//Make sure we've got a user agent to avoid errors +//Used for debugging +if (!isset($_SERVER['HTTP_USER_AGENT'])) { + $_SERVER['HTTP_USER_AGENT'] = ''; //Must always be set +} + +//When should we remove the client? +$expire = time() + $interval; + +//Have this client registered itself before? Check that it uses the same key +if (isset($d[$sum])) { + if ((string)$d[$sum][6] !== (string)$_GET['key']) { + sleep(3); //Anti brute force + die(track('Access denied, authentication failed')); + } +} + +//Add/update the client in our global list of clients, with some information +$d[$sum] = [$_SERVER['REMOTE_ADDR'], $_GET['peer_id'], $_GET['port'], $expire, $_GET['info_hash'], $_SERVER['HTTP_USER_AGENT'], $_GET['key'], is_seed()]; + +//No point in saving the user agent, unless we are debugging +if (!__DEBUGGING_ENABLED) { + unset($d[$sum][5]); +} elseif (!empty($_GET)) { //We are debugging, add GET parameters to database + $d[$sum]['get_parm'] = $_GET; +} + +//Did the client stop the torrent? +//We dont care about other events +if (isset($_GET['event']) && (string)$_GET['event'] === 'stopped') { + unset($d[$sum]); + db_save($d); + die(track([])); //The RFC says its OK to return whatever we want when the client stops downloading, + //however, some clients will complain about the tracker not working, hence we return + //an empty bencoded peer list +} + +//Check if any client timed out +foreach ($d as $k => $data) { + if (time() > $data[3] + __CLIENT_TIMEOUT) { //Give the client some extra time before timeout + unset($d[$k]); //Client has gone away, remove it + } +} + +//Save the client list +db_save($d); + +//Compare info_hash to the rest of our clients and remove anyone who does not have the correct torrent +foreach ($d as $id => $info) { + if ((string)$info[4] !== (string)$_GET['info_hash']) { + unset($d[$id]); + } +} + +// Remove self from list, no point in having ourselfes in the client dictionary +unset($d[$sum]); + +// Add a few more seconds on the timeout to balance the load +$interval += mt_rand(0, 10); + +// Bencode the dictionary and send it back +echo track($d, $interval, $interval_min); +exit(0); \ No newline at end of file diff --git a/src_php/php/tracker/peers.txt b/src_php/php/tracker/peers.txt new file mode 100755 index 0000000..e69de29 diff --git a/src_php/php/trash/Rogue/Economy.php b/src_php/php/trash/Rogue/Economy.php new file mode 100644 index 0000000..4f08db9 --- /dev/null +++ b/src_php/php/trash/Rogue/Economy.php @@ -0,0 +1,60 @@ +world = $world_; + $this->name = $name_; + + //We calculate the + $this->mineralsPrice = (1 / $world_->minerals)*$this->priceCoef; + $this->energyPrice = (1/ $world_->energy)*$this->priceCoef; + $this->vegetablePrice = (1/ $world_->vegetable)*$this->priceCoef; + $this->animalsPrice = (1/ $world_->animals)*$this->priceCoef; + $this->waterPrice = (1/ $world_->water)*$this->priceCoef; + + } + + public function getPIB($town, $macroEco){ + + $minerals = ($town->minerals)*$macroEco->mineralsPrice; + $energy = ($town->energy)*$macroEco->energyPrice; + $vegetable = ($town->vegetable)*$macroEco->vegetablePrice; + $animals = ($town->animals)*$macroEco->animalsPrice; + $water = ($town->water)*$macroEco->waterPrice; + + $this->PIB = ($minerals+ $energy+$vegetable+ $animals+$water); + return $this->PIB; + } + + public function print(){ + + echo '*******************************
'; + echo ' '.$this ->name.' ECONOMY
'; + echo '*******************************
'; + echo 'mineralsPrice: $'.$this ->mineralsPrice.'
'; + echo 'energyPrice: $'.$this ->energyPrice.'
'; + echo 'vegetablePrice: $'.$this ->vegetablePrice.'
'; + echo 'animalsPrice: $'.$this ->animalsPrice.'
'; + echo 'waterPrice: $'.$this ->waterPrice.'
'; + echo '
'; + } + +} \ No newline at end of file diff --git a/src_php/php/trash/Rogue/Town.php b/src_php/php/trash/Rogue/Town.php new file mode 100644 index 0000000..2c48ebc --- /dev/null +++ b/src_php/php/trash/Rogue/Town.php @@ -0,0 +1,192 @@ + things that won't be imported +public $minerals; +public $energy; //uranium, gaz etc. +public $vegetable; +public $animals; +public $water; + +//DailyProduction +public $mineralsProd; +public $energyProd; //uranium, gaz etc. +public $vegetableProd; +public $animalsProd; +public $waterProd; + +public $microEconomy; //influence industry +public $money; +public $deathCoef = 10; +public $fertilyCoef = 100; + +//Propertie that influence the whole town +public $old; +public $pib; +public $population; +public $culture; // books per habitants +public $weapons; +public $tools; +public $cyber; +public $deads; + +//Influenced +public $hiearchy; // numb strat of the population +public $superficy; +public $crimeRate; +public $justiceEfficiency; +public $inequality; +public $terrorism; + +//imported stuff +public $importMinerals; +public $importEnergy; +public $importVegetable; +public $importAnimals; +public $migrants; + +//Building +public $rafineries; +public $factories; +public $banks; +public $internet; +public $shops; //--> link to ressources and tools +public $residences; +public $libraries; +public $cimetaries; +public $lakes; +public $ports; //--> at least one +public $discharges; + + +function __construct( ) { + +} + +/** + * $difficulty_ : 1 to 100 + */ +public function initGeo($name_, $difficulty_){ + + $this ->key = uniqid(); + $this ->name = $name_; + $this ->population = rand ( 25 , 75 ) ; + + //Geography + $this ->lat = rand ( 0 , 100 ); + + if( $this ->lat < 50){ + $coefHardGeo = $this ->lat *2; + } else { + $coefHardGeo = (100 - ($this ->lat)) *2; + } + + if($coefHardGeo == 0) $coefHardGeo = 1; + if($coefHardGeo == 100) $coefHardGeo = 99; + + //echo 'coefHardGeo: '. $coefHardGeo.'
----------------------
'; + $coefEasyGeo = (100-$coefHardGeo); + $coefHardGeo = $coefHardGeo; + + $this ->mineralsProd = $this ->minerals = $this ->randomDescendent($difficulty_, $coefEasyGeo); + $this ->energyProd = $this ->energy = $this ->randomDescendent($difficulty_, $coefEasyGeo); + $this ->vegetableProd = $this ->vegetable = $this ->randomDescendent($difficulty_,$coefHardGeo); + $this ->waterProd = $this ->water = $this ->randomDescendent($difficulty_, $this ->lat); + $this ->animalsProd = $this ->animals = $this ->randomDescendent($difficulty_,$coefHardGeo); + +} + +public function initEconomy( $economy_ ){ + + $this -> microEconomy = new Economy($this, $this ->name.' MICRO' ); + $this -> microEconomy -> getPIB($this, $economy_); + //$this -> microEconomy->print(); + $this -> money = 100; +} + + +/** + * Init the politic (need a world setting for this) + */ +public function initPolitic(){ + + +} + +public function calcultatePopulation($world_){ + + $pop = $this ->population; + + if($pop > 0){ + + $needWater = $this ->water - $pop; + $needVegetable = $this ->vegetable - $pop; + $needAnimals = $this ->animals - $pop; + $needMinerals = $this ->minerals - $pop; + $needEnergy = $this ->minerals - $pop; + + $moneyNeeded = 0; + $moneyNeeded += $world_->macroEconomy->vegetablePrice * $needVegetable; + $moneyNeeded += $world_->macroEconomy->animalsPrice * $needAnimals; + $moneyNeeded += $world_->macroEconomy->waterPrice * $needWater; + + + $this ->money -= $moneyNeeded; + echo '--> '.$this ->name.' pop:'.$pop; + + if($this ->money < 0){ + $pop -= $this ->deathCoef; + echo '/ 💀Death: '.$this ->deathCoef; + } else if($this ->money >= 0){ + $pop += $this ->fertilyCoef; + echo '/ 🍼 New borns: '.$this ->fertilyCoef; + } + + $moneyNeeded += $world_->macroEconomy->mineralsPrice * $needMinerals; + $moneyNeeded += $world_->macroEconomy->energyPrice * $needEnergy; + + $this ->money -= $moneyNeeded; + + echo '/ Money: $'.$this ->money.'
'; + + $this ->population = $pop; + } + +} + + +function randomAscendent($val_, $coef_){ + $val = rand ( 1 , $val_ ) / 100; + return $val*$coef_; +} + +function randomDescendent($val_, $coef_){ + $val = (100 - rand ( 1 , $val_ )) / 100; + return $val*$coef_; +} + +public function print(){ + echo '*******************************
'; + echo ' Welcome Town '.$this ->name.'
'; + echo '*******************************
'; + echo 'lat: '.$this ->lat.'
'; + echo 'minerals: '.$this ->minerals.' ($'.$this->microEconomy->mineralsPrice.')
'; + echo 'energy: '.$this ->energy.' ($'.$this->microEconomy->energyPrice.')
'; + echo 'vegetable: '.$this ->vegetable.' ($'.$this->microEconomy->vegetablePrice.')
'; + echo 'water: '.$this ->water.' ($'.$this->microEconomy->waterPrice.')
'; + echo 'animals: '.$this ->animals.' ($'.$this->microEconomy->animalsPrice.')
'; + echo '------------------------------------------
'; + echo 'PIB of the town: $'. round($this ->microEconomy ->PIB).'k
'; + echo '
'; +} + +} \ No newline at end of file diff --git a/src_php/php/trash/Rogue/World.php b/src_php/php/trash/Rogue/World.php new file mode 100644 index 0000000..2654038 --- /dev/null +++ b/src_php/php/trash/Rogue/World.php @@ -0,0 +1,74 @@ +towns = array(); + } + + function addTown($name_, $difficulty_){ + + $city = new Town(); + $city->initGeo($name_, $difficulty_); + //$city->print(); + array_push( $this->towns, $city); + + } + + function initMacroEconomy(){ + + $mineralsWorld = 0; + $energyWorld = 0; + $vegetableWorld = 0; + $animalsWorld = 0; + $waterWorld = 0; + + foreach ($this->towns as $town){ + $mineralsWorld += $town->minerals; + $energyWorld += $town->energy; + $vegetableWorld += $town->vegetable; + $animalsWorld += $town->animals; + $waterWorld += $town->water; + } + + //Make the mean + $this->minerals = $mineralsWorld / sizeof( $this->towns); + $this->energy = $energyWorld / sizeof( $this->towns); + $this->vegetable = $vegetableWorld / sizeof( $this->towns); + $this->animals = $animalsWorld / sizeof( $this->towns); + $this->water = $waterWorld / sizeof( $this->towns); + + $this->macroEconomy = new Economy($this, 'World Global'); + $this->macroEconomy->print(); + + foreach ($this->towns as $town){ + $town-> initEconomy( $this->macroEconomy ); + $town-> print(); + } + } + + function cycling(){ + echo '-------------------------
'; + foreach ($this->towns as $town){ + $town->calcultatePopulation($this); + } + + } + + + +} \ No newline at end of file diff --git a/src_php/php/trash/RogueController.php b/src_php/php/trash/RogueController.php new file mode 100644 index 0000000..e72a546 --- /dev/null +++ b/src_php/php/trash/RogueController.php @@ -0,0 +1,33 @@ +addTown("🇺🇸Alpha City", 99 ); +$world->addTown("🇯🇵Neo Tokyo ネオ東京", 60 ); +$world->addTown("🇭🇰Honk Kong Empire", 30 ); +$world->addTown("🏴‍☠️Pirate Haven", 20 ); +$world->addTown("🇷🇺Pапс город", 5 ); + +$world->initMacroEconomy(); + +echo '

Cycling


'; + +for($i = 0; $i < 150; ++$i) { +$world->cycling(); +} + +/* +$jp = new Town("jp", 60 ); +$b = new Town("b", 30 ); +$gagged = new Town("gagged", 30 ); +$h = new Town("h", 10 ); +$op = new Town("op", 5 );*/ + + + +/* +Class RogueController { + + +}*/ \ No newline at end of file